diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 2a571e789..2cd766695 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -5069,7 +5069,18 @@ namespace dxvk { if (resource.type == DxbcOperandType::Rasterizer) { // SPIR-V has no gl_NumSamples equivalent, so we have // to work around it using a specialization constant - return getSpecConstant(DxvkSpecConstantId::RasterizerSampleCount); + if (!m_ps.specRsSampleCount) { + m_ps.specRsSampleCount = emitNewSpecConstant( + DxvkSpecConstantId::RasterizerSampleCount, + DxbcScalarType::Uint32, 1, + "RasterizerSampleCount"); + } + + DxbcRegisterValue result; + result.type.ctype = DxbcScalarType::Uint32; + result.type.ccount = 1; + result.id = m_ps.specRsSampleCount; + return result; } else { DxbcBufferInfo info = getBufferInfo(resource); diff --git a/src/dxbc/dxbc_compiler.h b/src/dxbc/dxbc_compiler.h index 20af80ebe..bd4256306 100644 --- a/src/dxbc/dxbc_compiler.h +++ b/src/dxbc/dxbc_compiler.h @@ -180,6 +180,8 @@ namespace dxvk { uint32_t builtinLaneId = 0; uint32_t killState = 0; + + uint32_t specRsSampleCount = 0; };