[Vulkan] Add spirv_disable_rounding_mode_rte

RenderDoc's shader debugger doesn't support RoundingModeRTE and crashes.

Co-Authored-By: Herman S. <429230+has207@users.noreply.github.com>
This commit is contained in:
goldislead
2026-08-08 10:47:00 -07:00
committed by Radosław Gliński
parent 31168682b0
commit 61a8aa3607
2 changed files with 16 additions and 4 deletions

View File

@@ -15,12 +15,20 @@
#include "third_party/fmt/include/fmt/format.h"
#include "third_party/glslang/SPIRV/GLSL.std.450.h"
#include "xenia/base/assert.h"
#include "xenia/base/cvar.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/base/string_buffer.h"
#include "xenia/gpu/spirv_compatibility.h"
#include "xenia/gpu/spirv_shader.h"
DEFINE_bool(
spirv_disable_rounding_mode_rte, false,
"Disable RoundingModeRTE capability in SPIR-V shaders. Enable this to "
"allow shader debugging in RenderDoc, which doesn't support this "
"capability.",
"GPU");
namespace xe {
namespace gpu {
@@ -833,7 +841,8 @@ std::vector<uint8_t> SpirvShaderTranslator::CompleteTranslation() {
builder_->addExecutionMode(function_main_,
spv::ExecutionModeSignedZeroInfNanPreserve, 32);
}
if (features_.rounding_mode_rte_float32) {
if (features_.rounding_mode_rte_float32 &&
!cvars::spirv_disable_rounding_mode_rte) {
builder_->addCapability(spv::CapabilityRoundingModeRTE);
builder_->addExecutionMode(function_main_,
spv::ExecutionModeRoundingModeRTE, 32);

View File

@@ -59,6 +59,9 @@ DEFINE_int32(
"the number of threads explicitly (up to the number of logical CPU cores), "
"0 to disable multithreaded pipeline creation.",
"Vulkan");
DECLARE_bool(spirv_disable_rounding_mode_rte);
namespace xe {
namespace gpu {
namespace vulkan {
@@ -88,11 +91,11 @@ bool VulkanPipelineCache::Initialize() {
signed_zero_inf_nan_preserve_float32_ =
features.signed_zero_inf_nan_preserve_float32;
denorm_flush_to_zero_float32_ = features.denorm_flush_to_zero_float32;
rounding_mode_rte_float32_ = features.rounding_mode_rte_float32;
rounding_mode_rte_float32_ = features.rounding_mode_rte_float32 &&
!cvars::spirv_disable_rounding_mode_rte;
shader_translator_ = std::make_unique<SpirvShaderTranslator>(
features,
render_target_cache_.msaa_2x_attachments_supported(),
features, render_target_cache_.msaa_2x_attachments_supported(),
render_target_cache_.msaa_2x_no_attachments_supported(),
edram_fragment_shader_interlock,
render_target_cache_.draw_resolution_scale_x(),