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:
parent
45461ee54e
commit
538b55921e
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user