mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
Settings: Add Default renderer option
This commit is contained in:
parent
c986d0ea78
commit
7edb57ca15
|
@ -894,9 +894,11 @@ const char* Settings::GetCPUFastmemModeDisplayName(CPUFastmemMode mode)
|
|||
return Host::TranslateToCString("CPUFastmemMode", s_cpu_fastmem_mode_display_names[static_cast<u8>(mode)]);
|
||||
}
|
||||
|
||||
static constexpr auto s_gpu_renderer_names = make_array(
|
||||
static constexpr std::array<const char*, static_cast<u32>(GPURenderer::Count)> s_gpu_renderer_names = {{
|
||||
"Automatic",
|
||||
#ifdef _WIN32
|
||||
"D3D11", "D3D12",
|
||||
"D3D11",
|
||||
"D3D12",
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
"Metal",
|
||||
|
@ -907,10 +909,13 @@ static constexpr auto s_gpu_renderer_names = make_array(
|
|||
#ifdef ENABLE_OPENGL
|
||||
"OpenGL",
|
||||
#endif
|
||||
"Software");
|
||||
static constexpr auto s_gpu_renderer_display_names = make_array(
|
||||
"Software",
|
||||
}};
|
||||
static constexpr std::array<const char*, static_cast<u32>(GPURenderer::Count)> s_gpu_renderer_display_names = {{
|
||||
TRANSLATE_NOOP("GPURenderer", "Automatic"),
|
||||
#ifdef _WIN32
|
||||
TRANSLATE_NOOP("GPURenderer", "Hardware (D3D11)"), TRANSLATE_NOOP("GPURenderer", "Hardware (D3D12)"),
|
||||
TRANSLATE_NOOP("GPURenderer", "Hardware (D3D11)"),
|
||||
TRANSLATE_NOOP("GPURenderer", "Hardware (D3D12)"),
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
TRANSLATE_NOOP("GPURenderer", "Hardware (Metal)"),
|
||||
|
@ -921,7 +926,8 @@ static constexpr auto s_gpu_renderer_display_names = make_array(
|
|||
#ifdef ENABLE_OPENGL
|
||||
TRANSLATE_NOOP("GPURenderer", "Hardware (OpenGL)"),
|
||||
#endif
|
||||
TRANSLATE_NOOP("GPURenderer", "Software"));
|
||||
TRANSLATE_NOOP("GPURenderer", "Software"),
|
||||
}};
|
||||
|
||||
std::optional<GPURenderer> Settings::ParseRendererName(const char* str)
|
||||
{
|
||||
|
@ -969,6 +975,7 @@ RenderAPI Settings::GetRenderAPIForRenderer(GPURenderer renderer)
|
|||
return RenderAPI::OpenGL;
|
||||
#endif
|
||||
case GPURenderer::Software:
|
||||
case GPURenderer::Automatic:
|
||||
default:
|
||||
return GPUDevice::GetPreferredAPI();
|
||||
}
|
||||
|
|
|
@ -412,19 +412,7 @@ struct Settings
|
|||
static const char* GetMultitapModeDisplayName(MultitapMode mode);
|
||||
|
||||
// Default to D3D11 on Windows as it's more performant and at this point, less buggy.
|
||||
#if defined(_WIN32) && defined(_M_ARM64)
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D12;
|
||||
#elif defined(_WIN32)
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D11;
|
||||
#elif defined(__APPLE__)
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareMetal;
|
||||
#elif defined(ENABLE_OPENGL)
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareOpenGL;
|
||||
#elif defined(ENABLE_VULKAN)
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareVulkan;
|
||||
#else
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Software;
|
||||
#endif
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Automatic;
|
||||
static constexpr GPUTextureFilter DEFAULT_GPU_TEXTURE_FILTER = GPUTextureFilter::Nearest;
|
||||
static constexpr GPUDownsampleMode DEFAULT_GPU_DOWNSAMPLE_MODE = GPUDownsampleMode::Disabled;
|
||||
static constexpr GPUWireframeMode DEFAULT_GPU_WIREFRAME_MODE = GPUWireframeMode::Disabled;
|
||||
|
|
|
@ -58,6 +58,7 @@ enum class PGXPMode : u8
|
|||
|
||||
enum class GPURenderer : u8
|
||||
{
|
||||
Automatic,
|
||||
#ifdef _WIN32
|
||||
HardwareD3D11,
|
||||
HardwareD3D12,
|
||||
|
|
|
@ -176,10 +176,24 @@ GPUDevice::~GPUDevice() = default;
|
|||
|
||||
RenderAPI GPUDevice::GetPreferredAPI()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_M_ARM64)
|
||||
// Perfer DX11 on Windows, except ARM64, where QCom has slow DX11 drivers.
|
||||
return RenderAPI::D3D11;
|
||||
#else
|
||||
#elif defined(_WIN32) && defined(_M_ARM64)
|
||||
return RenderAPI::D3D12;
|
||||
#elif defined(__APPLE__)
|
||||
// Prefer Metal on MacOS.
|
||||
return RenderAPI::Metal;
|
||||
#elif defined(ENABLE_OPENGL) && defined(ENABLE_VULKAN)
|
||||
// On Linux, if we have both GL and Vulkan, prefer VK if the driver isn't software.
|
||||
return VulkanDevice::IsSuitableDefaultRenderer() ? RenderAPI::Vulkan : RenderAPI::OpenGL;
|
||||
#elif defined(ENABLE_OPENGL)
|
||||
return RenderAPI::OpenGL;
|
||||
#elif defined(ENABLE_VULKAN)
|
||||
return RenderAPI::Vulkan;
|
||||
#else
|
||||
// Uhhh, what?
|
||||
return RenderAPI::None;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue