From fc947f5985faf846a9a7a84b1e9c0db6723f0799 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 4 Feb 2018 23:36:00 +0100 Subject: [PATCH] [dxbc] Implemented Geometry SV RenderTargetId --- src/dxbc/dxbc_compiler.cpp | 19 +++++++++++++++++++ src/dxbc/dxbc_compiler.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 1f7dd9b41..1db046416 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -4598,6 +4598,25 @@ namespace dxvk { emitVsSystemValueStore(sv, mask, value); break; + case DxbcSystemValue::RenderTargetId: { + if (m_gs.builtinLayer == 0) { + m_gs.builtinLayer = emitNewBuiltinVariable({ + { DxbcScalarType::Uint32, 1, 0 }, + spv::StorageClassOutput }, + spv::BuiltInLayer, + "gs_layer"); + } + + DxbcRegisterPointer ptr; + ptr.type.ctype = DxbcScalarType::Uint32; + ptr.type.ccount = 1; + ptr.id = m_gs.builtinLayer; + + emitValueStore( + ptr, emitRegisterExtract(value, mask), + DxbcRegMask(true, false, false, false)); + } break; + default: Logger::warn(str::format( "DxbcCompiler: Unhandled GS SV output: ", sv)); diff --git a/src/dxbc/dxbc_compiler.h b/src/dxbc/dxbc_compiler.h index 7ab0172e3..6c42abfe5 100644 --- a/src/dxbc/dxbc_compiler.h +++ b/src/dxbc/dxbc_compiler.h @@ -116,6 +116,8 @@ namespace dxvk { DxbcPrimitiveTopology outputTopology = DxbcPrimitiveTopology::Undefined; uint32_t outputVertexCount = 0; uint32_t functionId = 0; + + uint32_t builtinLayer = 0; };