1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxbc] Conditionally return zeroes for unbound textures in shader

May allow the driver to optimize away texture operations.
This commit is contained in:
Philip Rebohle 2020-11-24 18:39:20 +01:00
parent 45461ee54e
commit 538b55921e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -3543,6 +3543,14 @@ namespace dxvk {
result = emitRegisterSwizzle(result, result = emitRegisterSwizzle(result,
textureReg.swizzle, ins.dst[0].mask); textureReg.swizzle, ins.dst[0].mask);
DxbcRegisterValue bound;
bound.type = { DxbcScalarType::Bool, 1 };
bound.id = m_textures.at(textureId).specId;
result.id = m_module.opSelect(getVectorTypeId(result.type),
emitBuildVector(bound, result.type.ccount).id, result.id,
emitBuildZeroVector(result.type).id);
emitRegisterStore(ins.dst[0], result); emitRegisterStore(ins.dst[0], result);
} }
@ -3695,6 +3703,14 @@ namespace dxvk {
textureReg.swizzle, ins.dst[0].mask); textureReg.swizzle, ins.dst[0].mask);
} }
DxbcRegisterValue bound;
bound.type = { DxbcScalarType::Bool, 1 };
bound.id = m_textures.at(textureId).specId;
result.id = m_module.opSelect(getVectorTypeId(result.type),
emitBuildVector(bound, result.type.ccount).id, result.id,
emitBuildZeroVector(result.type).id);
emitRegisterStore(ins.dst[0], result); emitRegisterStore(ins.dst[0], result);
} }