mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
rsx: Validate depth test setup to avoid address contention
This commit is contained in:
parent
77ac875b0b
commit
8d1505752f
1 changed files with 25 additions and 2 deletions
|
@ -1084,7 +1084,7 @@ namespace rsx
|
||||||
const bool depth_test_enabled = rsx::method_registers.depth_test_enabled();
|
const bool depth_test_enabled = rsx::method_registers.depth_test_enabled();
|
||||||
|
|
||||||
// Check write masks
|
// Check write masks
|
||||||
layout.zeta_write_enabled = rsx::method_registers.depth_write_enabled();
|
layout.zeta_write_enabled = (depth_test_enabled && rsx::method_registers.depth_write_enabled());
|
||||||
if (!layout.zeta_write_enabled && stencil_test_enabled)
|
if (!layout.zeta_write_enabled && stencil_test_enabled)
|
||||||
{
|
{
|
||||||
// Check if stencil data is modified
|
// Check if stencil data is modified
|
||||||
|
@ -1130,8 +1130,31 @@ namespace rsx
|
||||||
break;
|
break;
|
||||||
case rsx::framebuffer_creation_context::context_draw:
|
case rsx::framebuffer_creation_context::context_draw:
|
||||||
// NOTE: As with all other hw, depth/stencil writes involve the corresponding depth/stencil test, i.e No test = No write
|
// NOTE: As with all other hw, depth/stencil writes involve the corresponding depth/stencil test, i.e No test = No write
|
||||||
|
// NOTE: Depth test is not really using the memory if its set to always or never
|
||||||
|
// TODO: Perform similar checks for stencil test
|
||||||
|
if (!stencil_test_enabled)
|
||||||
|
{
|
||||||
|
if (!depth_test_enabled)
|
||||||
|
{
|
||||||
|
depth_buffer_unused = true;
|
||||||
|
}
|
||||||
|
else if (!rsx::method_registers.depth_write_enabled())
|
||||||
|
{
|
||||||
|
// Depth test is enabled but depth write is disabled
|
||||||
|
switch (rsx::method_registers.depth_func())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case rsx::comparison_function::never:
|
||||||
|
case rsx::comparison_function::always:
|
||||||
|
// No access to depth buffer memory
|
||||||
|
depth_buffer_unused = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
color_buffer_unused = !color_write_enabled || layout.target == rsx::surface_target::none;
|
color_buffer_unused = !color_write_enabled || layout.target == rsx::surface_target::none;
|
||||||
depth_buffer_unused = !depth_test_enabled && !stencil_test_enabled;
|
|
||||||
m_framebuffer_state_contested = color_buffer_unused || depth_buffer_unused;
|
m_framebuffer_state_contested = color_buffer_unused || depth_buffer_unused;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue