rsx: Do not rely on program env state, instead, always use program ucode analysis results when doing codegen

- Some things can be present in program env but not ucode state
  e.g A texture can be active and bound in a redirected manner but not actually be used in ucode
  In such a case, only the ucode analysis or decompilation can decide whether to inject decoding routines
This commit is contained in:
kd-11 2020-12-24 21:44:15 +03:00 committed by kd-11
parent bee76fc8d1
commit a96b4412d3
4 changed files with 31 additions and 33 deletions

View file

@ -129,20 +129,17 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
const auto mask = (1 << index);
if (m_prog.redirected_textures & mask)
if (properties.redirected_sampler_mask & mask)
{
// Provide a stencil view of the main resource for the S channel
OS << "uniform u" << samplerType << " " << PI.name << "_stencil;\n";
}
else if (m_prog.shadow_textures & mask)
else if (properties.shadow_sampler_mask & mask)
{
if (m_shadow_sampled_textures & mask)
{
if (m_2d_sampled_textures & mask)
rsx_log.error("Texture unit %d is sampled as both a shadow texture and a depth texture", index);
else
samplerType = "sampler2DShadow";
}
if (properties.tex2d_sampler_mask & mask)
rsx_log.error("Texture unit %d is sampled as both a shadow texture and a depth texture", index);
else
samplerType = "sampler2DShadow";
}
OS << "uniform " << samplerType << " " << PI.name << ";\n";
@ -202,10 +199,10 @@ void GLFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS)
m_shader_props.domain = glsl::glsl_fragment_program;
m_shader_props.require_lit_emulation = properties.has_lit_op;
m_shader_props.fp32_outputs = !!(m_prog.ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS);
m_shader_props.require_depth_conversion = m_prog.redirected_textures != 0;
m_shader_props.require_depth_conversion = properties.redirected_sampler_mask != 0;
m_shader_props.require_wpos = !!(properties.in_register_mask & in_wpos);
m_shader_props.require_texture_ops = properties.has_tex_op;
m_shader_props.require_shadow_ops = m_prog.shadow_textures != 0;
m_shader_props.require_shadow_ops = properties.shadow_sampler_mask != 0;
m_shader_props.require_texture_expand = properties.has_exp_tex_op;
m_shader_props.emulate_coverage_tests = true; // g_cfg.video.antialiasing_level == msaa_level::none;
m_shader_props.emulate_shadow_compare = device_props.emulate_depth_compare;