rsx: Improve early-Z disablement mechanism
This commit is contained in:
@@ -335,15 +335,12 @@ void GLFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||||||
|
|
||||||
OS << "\n" << " fs_main();\n\n";
|
OS << "\n" << " fs_main();\n\n";
|
||||||
|
|
||||||
if ((m_prog.ctrl & RSX_SHADER_CONTROL_DISABLE_EARLY_Z) &&
|
if (m_prog.ctrl & RSX_SHADER_CONTROL_DISABLE_EARLY_Z)
|
||||||
!(m_prog.ctrl & (CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT | RSX_SHADER_CONTROL_META_USES_DISCARD)) &&
|
|
||||||
g_cfg.video.shader_precision != gpu_preset_level::low)
|
|
||||||
{
|
{
|
||||||
// This is effectively unreachable code, but good enough to trick the GPU to skip early Z
|
// This is effectively pointless code, but good enough to trick the GPU to skip early Z
|
||||||
OS <<
|
OS <<
|
||||||
"// Insert NOP sequence to disable early-Z\n"
|
" // Insert pseudo-barrier sequence to disable early-Z\n"
|
||||||
"if (isnan(gl_FragCoord.z))\n"
|
" gl_FragDepth = gl_FragCoord.z;\n\n";
|
||||||
" discard;\n\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glsl::insert_rop(OS, m_shader_props);
|
glsl::insert_rop(OS, m_shader_props);
|
||||||
|
|||||||
@@ -2242,6 +2242,8 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sampler_descriptors[i]->is_cyclic_reference &&
|
if (sampler_descriptors[i]->is_cyclic_reference &&
|
||||||
|
!(current_fragment_program.ctrl & (CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT | RSX_SHADER_CONTROL_META_USES_DISCARD)) &&
|
||||||
|
!g_cfg.video.strict_rendering_mode &&
|
||||||
g_cfg.video.shader_precision != gpu_preset_level::low)
|
g_cfg.video.shader_precision != gpu_preset_level::low)
|
||||||
{
|
{
|
||||||
current_fragment_program.ctrl |= RSX_SHADER_CONTROL_DISABLE_EARLY_Z;
|
current_fragment_program.ctrl |= RSX_SHADER_CONTROL_DISABLE_EARLY_Z;
|
||||||
|
|||||||
@@ -471,16 +471,13 @@ void VKFragmentDecompilerThread::insertMainEnd(std::stringstream & OS)
|
|||||||
|
|
||||||
OS << "\n" << " fs_main();\n\n";
|
OS << "\n" << " fs_main();\n\n";
|
||||||
|
|
||||||
if ((m_prog.ctrl & RSX_SHADER_CONTROL_DISABLE_EARLY_Z) &&
|
if (m_prog.ctrl & RSX_SHADER_CONTROL_DISABLE_EARLY_Z)
|
||||||
!(m_prog.ctrl & (CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT | RSX_SHADER_CONTROL_META_USES_DISCARD)) &&
|
|
||||||
g_cfg.video.shader_precision != gpu_preset_level::low)
|
|
||||||
{
|
{
|
||||||
// This is effectively unreachable code, but good enough to trick the GPU to skip early Z
|
// This is effectively unreachable code, but good enough to trick the GPU to skip early Z
|
||||||
|
// For vulkan, depth export has stronger semantics than discard.
|
||||||
OS <<
|
OS <<
|
||||||
"// Insert NOP sequence to disable early-Z\n"
|
" // Insert pseudo-barrier sequence to disable early-Z\n"
|
||||||
" const uint rop_control = fs_contexts[_fs_context_offset].rop_control;\n"
|
" gl_FragDepth = gl_FragCoord.z;\n\n";
|
||||||
" if (_test_bit(rop_control, 0))\n"
|
|
||||||
" discard;\n\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glsl::insert_rop(OS, m_shader_props);
|
glsl::insert_rop(OS, m_shader_props);
|
||||||
|
|||||||
Reference in New Issue
Block a user