From ce1c66d7dc404c25562f33335cec52ddb6a2c26c Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Sun, 14 Nov 2021 16:27:39 +0100 Subject: [PATCH] [dxso] Omit relative constant range check when possible We can just rely on robustness2 when it's supported. --- src/dxso/dxso_compiler.cpp | 2 +- src/dxso/dxso_options.cpp | 2 ++ src/dxso/dxso_options.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dxso/dxso_compiler.cpp b/src/dxso/dxso_compiler.cpp index 5b8d16b6..cf7ed2d9 100644 --- a/src/dxso/dxso_compiler.cpp +++ b/src/dxso/dxso_compiler.cpp @@ -1029,7 +1029,7 @@ namespace dxvk { result.id = m_module.opLoad(typeId, ptrId); - if (relative) { + if (relative && !m_moduleInfo.options.robustness2Supported) { uint32_t constCount = m_module.constu32(m_layout->floatCount); // Expand condition to bvec4 since the result has four components diff --git a/src/dxso/dxso_options.cpp b/src/dxso/dxso_options.cpp index edcb978d..5e05ee65 100644 --- a/src/dxso/dxso_options.cpp +++ b/src/dxso/dxso_options.cpp @@ -43,6 +43,8 @@ namespace dxvk { longMad = options.longMad; alphaTestWiggleRoom = options.alphaTestWiggleRoom; + + robustness2Supported = devFeatures.extRobustness2.robustBufferAccess2; } } \ No newline at end of file diff --git a/src/dxso/dxso_options.h b/src/dxso/dxso_options.h index 2763aa6c..39104cc3 100644 --- a/src/dxso/dxso_options.h +++ b/src/dxso/dxso_options.h @@ -54,6 +54,9 @@ namespace dxvk { /// Workaround for games using alpha test == 1.0, etc due to wonky interpolation or /// misc. imprecision on some vendors bool alphaTestWiggleRoom; + + /// Whether or not we can rely on robustness2 to handle oob constant access + bool robustness2Supported; }; } \ No newline at end of file