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

[dxso] Perform saturate after bitshift modifier

This commit is contained in:
Joshua Ashton 2019-12-22 18:14:46 +00:00
parent 3ff9c4cc43
commit d39ff9020e

View File

@ -487,14 +487,6 @@ namespace dxvk {
if (value.type.ctype == DxsoScalarType::Float32) {
const uint32_t typeId = getVectorTypeId(value.type);
// Saturating only makes sense on floats
if (saturate) {
value.id = m_module.opNClamp(
typeId, value.id,
m_module.constfReplicant(0.0f, value.type.ccount),
m_module.constfReplicant(1.0f, value.type.ccount));
}
// There doesn't seem to be a nice float bitshift method for float vectors
// in Spirv that I can see... Resorting to multiplication.
if (shift != 0) {
@ -509,6 +501,14 @@ namespace dxvk {
else
value.id = m_module.opVectorTimesScalar(typeId, value.id, shiftConst);
}
// Saturating only makes sense on floats
if (saturate) {
value.id = m_module.opNClamp(
typeId, value.id,
m_module.constfReplicant(0.0f, value.type.ccount),
m_module.constfReplicant(1.0f, value.type.ccount));
}
}
this->emitValueStore(ptr, value, writeMask, predicate);