1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxbc] Actually do the skip range check thing properly

Turns out the first attempt only worked because my test case didn't
do any dynamically indexed stores at all, but broke everything else.
Oops.
This commit is contained in:
Philip Rebohle 2022-03-24 12:53:29 +01:00
parent 3ecd13cec2
commit 0db26a0456
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -5721,13 +5721,11 @@ namespace dxvk {
void DxbcCompiler::emitRegisterStore(
const DxbcRegister& reg,
DxbcRegisterValue value) {
bool doRangeCheck = false;
if (reg.type == DxbcOperandType::IndexableTemp)
doRangeCheck = reg.idx[1].relReg != nullptr;
if (doRangeCheck) {
if (reg.type == DxbcOperandType::IndexableTemp) {
bool doBoundsCheck = reg.idx[1].relReg != nullptr;
DxbcRegisterValue vectorId = emitIndexLoad(reg.idx[1]);
if (doBoundsCheck) {
uint32_t boundsCheck = m_module.opULessThan(
m_module.defBoolType(), vectorId.id,
m_module.constu32(m_xRegs.at(reg.idx[0].offset).alength));
@ -5740,10 +5738,14 @@ namespace dxvk {
m_module.opBranchConditional(boundsCheck, cond.labelIf, cond.labelEnd);
m_module.opLabel(cond.labelIf);
emitValueStore(getIndexableTempPtr(reg, vectorId), value, reg.mask);
m_module.opBranch(cond.labelEnd);
m_module.opLabel (cond.labelEnd);
} else {
emitValueStore(getIndexableTempPtr(reg, vectorId), value, reg.mask);
}
} else {
emitValueStore(emitGetOperandPtr(reg), value, reg.mask);
}