[D3D12] Re-add accidentally deleted RT update trigger and treat Z test and write bits separately
This commit is contained in:
parent
ecc056912d
commit
25cc189e99
|
@ -1199,8 +1199,7 @@ bool D3D12CommandProcessor::IssueDraw(PrimitiveType primitive_type,
|
||||||
uint32_t color_mask = GetCurrentColorMask(pixel_shader);
|
uint32_t color_mask = GetCurrentColorMask(pixel_shader);
|
||||||
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
||||||
uint32_t rb_stencilrefmask = regs[XE_GPU_REG_RB_STENCILREFMASK].u32;
|
uint32_t rb_stencilrefmask = regs[XE_GPU_REG_RB_STENCILREFMASK].u32;
|
||||||
if (!memexport_used && !color_mask &&
|
if (!memexport_used && !color_mask && !(rb_depthcontrol & 0x4) &&
|
||||||
((rb_depthcontrol & (0x2 | 0x4)) != (0x2 | 0x4)) &&
|
|
||||||
(!(rb_depthcontrol & 0x1) || !(rb_stencilrefmask & (0xFF << 16)))) {
|
(!(rb_depthcontrol & 0x1) || !(rb_stencilrefmask & (0xFF << 16)))) {
|
||||||
// Not writing to color, depth or stencil, so doesn't draw.
|
// Not writing to color, depth or stencil, so doesn't draw.
|
||||||
return true;
|
return true;
|
||||||
|
@ -2018,12 +2017,12 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||||
// Disable depth and stencil if it aliases a color render target (for
|
// Disable depth and stencil if it aliases a color render target (for
|
||||||
// instance, during the XBLA logo in Banjo-Kazooie, though depth writing is
|
// instance, during the XBLA logo in Banjo-Kazooie, though depth writing is
|
||||||
// already disabled there).
|
// already disabled there).
|
||||||
if (IsROVUsedForEDRAM() && (rb_depthcontrol & (0x1 | 0x2))) {
|
if (IsROVUsedForEDRAM() && (rb_depthcontrol & (0x1 | 0x2 | 0x4))) {
|
||||||
uint32_t edram_base_depth = rb_depth_info & 0xFFF;
|
uint32_t edram_base_depth = rb_depth_info & 0xFFF;
|
||||||
for (uint32_t i = 0; i < 4; ++i) {
|
for (uint32_t i = 0; i < 4; ++i) {
|
||||||
if ((color_mask & (0xF << (i * 4))) &&
|
if ((color_mask & (0xF << (i * 4))) &&
|
||||||
edram_base_depth == (color_infos[i] & 0xFFF)) {
|
edram_base_depth == (color_infos[i] & 0xFFF)) {
|
||||||
rb_depthcontrol &= ~(uint32_t(0x1 | 0x2));
|
rb_depthcontrol &= ~(uint32_t(0x1 | 0x2 | 0x4));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2100,30 +2099,30 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||||
uint32_t(ColorRenderTargetFormat::k_8_8_8_8_GAMMA)) {
|
uint32_t(ColorRenderTargetFormat::k_8_8_8_8_GAMMA)) {
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_Color3Gamma;
|
flags |= DxbcShaderTranslator::kSysFlag_Color3Gamma;
|
||||||
}
|
}
|
||||||
if (IsROVUsedForEDRAM() && (rb_depthcontrol & (0x1 | 0x2))) {
|
if (IsROVUsedForEDRAM()) {
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_DepthStencil;
|
uint32_t depth_comparison;
|
||||||
if (DepthRenderTargetFormat((rb_depth_info >> 16) & 0x1) ==
|
|
||||||
DepthRenderTargetFormat::kD24FS8) {
|
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_DepthFloat24;
|
|
||||||
}
|
|
||||||
if (rb_depthcontrol & 0x2) {
|
if (rb_depthcontrol & 0x2) {
|
||||||
flags |= ((rb_depthcontrol >> 4) & 0x7)
|
depth_comparison = (rb_depthcontrol >> 4) & 0x7;
|
||||||
|
} else {
|
||||||
|
depth_comparison = 0b111;
|
||||||
|
}
|
||||||
|
if (depth_comparison != 0b111 || (rb_depthcontrol & (0x1 | 0x4))) {
|
||||||
|
flags |= DxbcShaderTranslator::kSysFlag_DepthStencil;
|
||||||
|
flags |= depth_comparison
|
||||||
<< DxbcShaderTranslator::kSysFlag_DepthPassIfLess_Shift;
|
<< DxbcShaderTranslator::kSysFlag_DepthPassIfLess_Shift;
|
||||||
|
if (DepthRenderTargetFormat((rb_depth_info >> 16) & 0x1) ==
|
||||||
|
DepthRenderTargetFormat::kD24FS8) {
|
||||||
|
flags |= DxbcShaderTranslator::kSysFlag_DepthFloat24;
|
||||||
|
}
|
||||||
if (rb_depthcontrol & 0x4) {
|
if (rb_depthcontrol & 0x4) {
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_DepthWriteMask |
|
flags |= DxbcShaderTranslator::kSysFlag_DepthWriteMask |
|
||||||
DxbcShaderTranslator::kSysFlag_DepthStencilWrite;
|
DxbcShaderTranslator::kSysFlag_DepthStencilWrite;
|
||||||
}
|
}
|
||||||
} else {
|
if (rb_depthcontrol & 0x1) {
|
||||||
// In case stencil is used without depth testing - always pass, and
|
flags |= DxbcShaderTranslator::kSysFlag_StencilTest;
|
||||||
// don't modify the stored depth.
|
if (rb_stencilrefmask & (0xFF << 16)) {
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_DepthPassIfLess |
|
flags |= DxbcShaderTranslator::kSysFlag_DepthStencilWrite;
|
||||||
DxbcShaderTranslator::kSysFlag_DepthPassIfEqual |
|
}
|
||||||
DxbcShaderTranslator::kSysFlag_DepthPassIfGreater;
|
|
||||||
}
|
|
||||||
if (rb_depthcontrol & 0x1) {
|
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_StencilTest;
|
|
||||||
if (rb_stencilrefmask & (0xFF << 16)) {
|
|
||||||
flags |= DxbcShaderTranslator::kSysFlag_DepthStencilWrite;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -584,10 +584,10 @@ bool PipelineCache::GetCurrentStateDescription(
|
||||||
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
||||||
if (rb_depthcontrol & 0x2) {
|
if (rb_depthcontrol & 0x2) {
|
||||||
description_out.depth_func = (rb_depthcontrol >> 4) & 0x7;
|
description_out.depth_func = (rb_depthcontrol >> 4) & 0x7;
|
||||||
description_out.depth_write = (rb_depthcontrol & 0x4) != 0;
|
|
||||||
} else {
|
} else {
|
||||||
description_out.depth_func = 0b111;
|
description_out.depth_func = 0b111;
|
||||||
}
|
}
|
||||||
|
description_out.depth_write = (rb_depthcontrol & 0x4) != 0;
|
||||||
if (rb_depthcontrol & 0x1) {
|
if (rb_depthcontrol & 0x1) {
|
||||||
description_out.stencil_enable = 1;
|
description_out.stencil_enable = 1;
|
||||||
uint32_t rb_stencilrefmask = regs[XE_GPU_REG_RB_STENCILREFMASK].u32;
|
uint32_t rb_stencilrefmask = regs[XE_GPU_REG_RB_STENCILREFMASK].u32;
|
||||||
|
|
|
@ -570,8 +570,8 @@ bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {
|
||||||
}
|
}
|
||||||
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
uint32_t rb_depthcontrol = regs[XE_GPU_REG_RB_DEPTHCONTROL].u32;
|
||||||
uint32_t rb_depth_info = regs[XE_GPU_REG_RB_DEPTH_INFO].u32;
|
uint32_t rb_depth_info = regs[XE_GPU_REG_RB_DEPTH_INFO].u32;
|
||||||
// 0x1 = stencil test, 0x2 = depth test.
|
// 0x1 = stencil test, 0x2 = depth test, 0x4 = depth writing.
|
||||||
enabled[4] = (rb_depthcontrol & (0x1 | 0x2)) != 0;
|
enabled[4] = (rb_depthcontrol & (0x1 | 0x2 | 0x4)) != 0;
|
||||||
edram_bases[4] = std::min(rb_depth_info & 0xFFF, 2048u);
|
edram_bases[4] = std::min(rb_depth_info & 0xFFF, 2048u);
|
||||||
formats[4] = (rb_depth_info >> 16) & 0x1;
|
formats[4] = (rb_depth_info >> 16) & 0x1;
|
||||||
formats_are_64bpp[4] = false;
|
formats_are_64bpp[4] = false;
|
||||||
|
@ -672,6 +672,7 @@ bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {
|
||||||
const RenderTargetBinding& binding = current_bindings_[i];
|
const RenderTargetBinding& binding = current_bindings_[i];
|
||||||
if (binding.is_bound) {
|
if (binding.is_bound) {
|
||||||
if (binding.edram_base != edram_bases[i]) {
|
if (binding.edram_base != edram_bases[i]) {
|
||||||
|
full_update = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rov_used) {
|
if (rov_used) {
|
||||||
|
|
Loading…
Reference in New Issue