From d39ff9020eb04bf24448ff976663f783760861bb Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sun, 22 Dec 2019 18:14:46 +0000 Subject: [PATCH] [dxso] Perform saturate after bitshift modifier --- src/dxso/dxso_compiler.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dxso/dxso_compiler.h b/src/dxso/dxso_compiler.h index 169b1547d..7698a7be4 100644 --- a/src/dxso/dxso_compiler.h +++ b/src/dxso/dxso_compiler.h @@ -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);