From 3ecd13cec25ec921f32d5279093984bf6499ed41 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 24 Mar 2022 12:46:58 +0100 Subject: [PATCH] [dxbc] Only emit temp array range check for dynamically indexed stores Generates less code and makes things slightly more readable. --- src/dxbc/dxbc_compiler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 5dcdc673..d1478a80 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -5721,7 +5721,12 @@ namespace dxvk { void DxbcCompiler::emitRegisterStore( const DxbcRegister& reg, DxbcRegisterValue value) { - if (reg.type == DxbcOperandType::IndexableTemp) { + bool doRangeCheck = false; + + if (reg.type == DxbcOperandType::IndexableTemp) + doRangeCheck = reg.idx[1].relReg != nullptr; + + if (doRangeCheck) { DxbcRegisterValue vectorId = emitIndexLoad(reg.idx[1]); uint32_t boundsCheck = m_module.opULessThan( m_module.defBoolType(), vectorId.id,