From 6e9964b43ee00a84b97c2a3b5d2c42518f1d7158 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Mon, 15 Oct 2018 23:16:34 +0300 Subject: [PATCH] [D3D12] ROV: Fix depth testing --- src/xenia/gpu/d3d12/d3d12_command_processor.cc | 8 ++++---- src/xenia/gpu/dxbc_shader_translator.cc | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index 410ec2ca3..c6eb60e3f 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -1646,16 +1646,16 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( if (render_target_cache_->IsROVUsedForEDRAM()) { uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32; if (rb_depthcontrol & 0x2) { - if (DepthRenderTargetFormat(rb_depth_info) == - DepthRenderTargetFormat::kD24FS8) { - flags |= DxbcShaderTranslator::kSysFlag_DepthFloat24; - } // Read depth/stencil if depth comparison function is not "always". uint32_t depth_comparison = (rb_depthcontrol >> 4) & 0x7; flags |= depth_comparison << DxbcShaderTranslator::kSysFlag_DepthPassIfLess_Shift; if (depth_comparison != 0x7) { flags |= DxbcShaderTranslator::kSysFlag_DepthStencilRead; + if (DepthRenderTargetFormat(rb_depth_info) == + DepthRenderTargetFormat::kD24FS8) { + flags |= DxbcShaderTranslator::kSysFlag_DepthFloat24; + } } if (rb_depthcontrol & 0x4) { flags |= DxbcShaderTranslator::kSysFlag_DepthStencilWrite; diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index 521ec5516..7e1b3b62b 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -1750,8 +1750,8 @@ void DxbcShaderTranslator::CompletePixelShader_WriteToROV_LoadColor( shader_code_.push_back( EncodeVectorReplicatedOperand(D3D10_SB_OPERAND_TYPE_TEMP, rt_index, 1)); shader_code_.push_back(edram_dword_offset_low_temp); - shader_code_.push_back(EncodeVectorSwizzledOperand( - D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, kSwizzleXYZW, 2)); + shader_code_.push_back(EncodeVectorReplicatedOperand( + D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, 0, 2)); shader_code_.push_back(0); shader_code_.push_back(0); ++stat_.instruction_count; @@ -1806,8 +1806,8 @@ void DxbcShaderTranslator::CompletePixelShader_WriteToROV_LoadColor( shader_code_.push_back( EncodeVectorReplicatedOperand(D3D10_SB_OPERAND_TYPE_TEMP, rt_index, 1)); shader_code_.push_back(edram_dword_offset_high_temp); - shader_code_.push_back(EncodeVectorSwizzledOperand( - D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, kSwizzleXYZW, 2)); + shader_code_.push_back(EncodeVectorReplicatedOperand( + D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, 0, 2)); shader_code_.push_back(0); shader_code_.push_back(0); ++stat_.instruction_count; @@ -3529,8 +3529,8 @@ void DxbcShaderTranslator::CompletePixelShader_WriteToROV() { shader_code_.push_back( EncodeVectorReplicatedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1)); shader_code_.push_back(system_temp_depth_); - shader_code_.push_back(EncodeVectorSwizzledOperand( - D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, kSwizzleXYZW, 2)); + shader_code_.push_back(EncodeVectorReplicatedOperand( + D3D11_SB_OPERAND_TYPE_UNORDERED_ACCESS_VIEW, 0, 2)); shader_code_.push_back(0); shader_code_.push_back(0); ++stat_.instruction_count;