From b3ba401503802e869b17513b6258841fb0b10763 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 8 Feb 2018 10:26:46 +0100 Subject: [PATCH] [dxbc] Added support for early fragment tests --- src/dxbc/dxbc_compiler.cpp | 5 ++++- src/dxbc/dxbc_decoder.cpp | 2 ++ src/dxbc/dxbc_decoder.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index e7c4a2d5..6e210951 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -256,7 +256,10 @@ namespace dxvk { void DxbcCompiler::emitDclGlobalFlags(const DxbcShaderInstruction& ins) { - // TODO implement properly + const DxbcGlobalFlags flags = ins.controls.globalFlags; + + if (flags.test(DxbcGlobalFlag::EarlyFragmentTests)) + m_module.setExecutionMode(m_entryPointId, spv::ExecutionModeEarlyFragmentTests); } diff --git a/src/dxbc/dxbc_decoder.cpp b/src/dxbc/dxbc_decoder.cpp index 496faa71..a0febb66 100644 --- a/src/dxbc/dxbc_decoder.cpp +++ b/src/dxbc/dxbc_decoder.cpp @@ -106,6 +106,8 @@ namespace dxvk { m_instruction.modifiers.precise = !!bit::extract(token, 19, 22); // Opcode controls. It will depend on the opcode itself which ones are valid. + m_instruction.controls.globalFlags = + static_cast(bit::extract(token, 11, 14)); m_instruction.controls.zeroTest = static_cast(bit::extract(token, 18, 18)); m_instruction.controls.syncFlags = diff --git a/src/dxbc/dxbc_decoder.h b/src/dxbc/dxbc_decoder.h index 131ff729..14095ec5 100644 --- a/src/dxbc/dxbc_decoder.h +++ b/src/dxbc/dxbc_decoder.h @@ -242,6 +242,7 @@ namespace dxvk { * only one of the members will be valid. */ struct DxbcShaderOpcodeControls { + DxbcGlobalFlags globalFlags; DxbcZeroTest zeroTest; DxbcSyncFlags syncFlags; DxbcResourceDim resourceDim;