From af4dabe8b4846db1ec703f3132fddc0ffaf37236 Mon Sep 17 00:00:00 2001 From: Margen67 Date: Tue, 12 Mar 2024 22:54:40 -0700 Subject: [PATCH] Option cleanup (WIP) cpu: Make it clear this does nothing since there's no backends other than x64. native_2x_msaa: Disabling this only makes performance worse, and idiots think this disables anti-aliasing for some reason. --- src/xenia/cpu/cpu_flags.cc | 3 +- src/xenia/cpu/ppc/ppc_translator.cc | 7 +++- .../gpu/d3d12/d3d12_render_target_cache.cc | 39 +++++++++++++++++++ src/xenia/gpu/render_target_cache.cc | 2 + 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/xenia/cpu/cpu_flags.cc b/src/xenia/cpu/cpu_flags.cc index 02c9d2b18..0da928be0 100644 --- a/src/xenia/cpu/cpu_flags.cc +++ b/src/xenia/cpu/cpu_flags.cc @@ -9,7 +9,7 @@ #include "xenia/cpu/cpu_flags.h" -DEFINE_string(cpu, "any", "CPU backend [any, x64].", "CPU"); +DEFINE_string(cpu, "any", "Does nothing. CPU backend [any, x64].", "CPU"); DEFINE_string( load_module_map, "", @@ -31,6 +31,7 @@ DEFINE_bool(trace_function_data, false, "Generate tracing for function result data.", "CPU"); DEFINE_bool(validate_hir, false, + "Only does anything on debug builds. " "Perform validation checks on the HIR during compilation.", "CPU"); DEFINE_uint64( diff --git a/src/xenia/cpu/ppc/ppc_translator.cc b/src/xenia/cpu/ppc/ppc_translator.cc index 69b0da4e3..db2f51e18 100644 --- a/src/xenia/cpu/ppc/ppc_translator.cc +++ b/src/xenia/cpu/ppc/ppc_translator.cc @@ -45,7 +45,12 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) { assembler_ = backend->CreateAssembler(); assembler_->Initialize(); - bool validate = cvars::validate_hir; + bool validate = + #ifdef DEBUG + cvars::validate_hir; + #else + 0; + #endif // Merge blocks early. This will let us use more context in other passes. // The CFG is required for simplification and dirtied by it. diff --git a/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc b/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc index 9dadff46e..65bb8bcac 100644 --- a/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc +++ b/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc @@ -447,7 +447,9 @@ bool D3D12RenderTargetCache::Initialize() { // Using the cvar on emulator initialization so used pipelines are consistent // across different titles launched in one emulator instance. use_stencil_reference_output_ = + #ifdef DEBUG cvars::native_stencil_value_output && + #endif provider.IsPSSpecifiedStencilReferenceSupported() && (cvars::native_stencil_value_output_d3d12_intel || provider.GetAdapterVendorID() != @@ -464,6 +466,7 @@ bool D3D12RenderTargetCache::Initialize() { // Check if 2x MSAA is supported or needs to be emulated with 4x MSAA // instead. + #ifdef DEBUG if (cvars::native_2x_msaa) { msaa_2x_supported_ = true; static const DXGI_FORMAT kRenderTargetDXGIFormats[] = { @@ -502,6 +505,42 @@ bool D3D12RenderTargetCache::Initialize() { } else { msaa_2x_supported_ = false; } + #else // DEBUG + msaa_2x_supported_ = true; + static const DXGI_FORMAT kRenderTargetDXGIFormats[] = { + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_SNORM, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R16G16_FLOAT, + DXGI_FORMAT_R16G16_SNORM, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_D24_UNORM_S8_UINT, + // For ownership transfer. + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R32G32_UINT, + DXGI_FORMAT_R16G16_UINT, + DXGI_FORMAT_R32_UINT, + }; + D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS multisample_quality_levels; + multisample_quality_levels.SampleCount = 2; + multisample_quality_levels.Flags = + D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE; + for (size_t i = 0; i < xe::countof(kRenderTargetDXGIFormats); ++i) { + multisample_quality_levels.Format = kRenderTargetDXGIFormats[i]; + multisample_quality_levels.NumQualityLevels = 0; + if (FAILED(device->CheckFeatureSupport( + D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, + &multisample_quality_levels, + sizeof(multisample_quality_levels))) || + !multisample_quality_levels.NumQualityLevels) { + msaa_2x_supported_ = false; + break; + } + } + #endif // DEBUG if (!msaa_2x_supported_) { XELOGW( "2x MSAA is not supported, emulated via top-left and bottom-right " diff --git a/src/xenia/gpu/render_target_cache.cc b/src/xenia/gpu/render_target_cache.cc index c66ffd61f..408ed940c 100644 --- a/src/xenia/gpu/render_target_cache.cc +++ b/src/xenia/gpu/render_target_cache.cc @@ -172,6 +172,7 @@ DEFINE_bool( "GPU"); DEFINE_bool( native_2x_msaa, true, + "Only does anything in debug builds." "Use host 2x MSAA when available. Can be disabled for scalability testing " "on host GPU APIs where 2x is not mandatory, in this case, 2 samples of 4x " "MSAA will be used instead (with similar or worse quality and higher " @@ -179,6 +180,7 @@ DEFINE_bool( "GPU"); DEFINE_bool( native_stencil_value_output, true, + "Only does anything in debug builds." "Use pixel shader stencil reference output where available for purposes " "like copying between render targets. Can be disabled for scalability " "testing, in this case, much more expensive drawing of 8 quads will be "