From dc3cfc9fa07e8f7cbe318a6b2177b65c30ffc1f8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 30 Apr 2019 21:07:52 +0200 Subject: [PATCH] [dxbc] Use new spec constant API for rasterizer sample count --- src/dxbc/dxbc_compiler.cpp | 13 ++++++++++++- src/dxbc/dxbc_compiler.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) 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; };