mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 17:11:23 +00:00
rsx: Merge instruction expand flag with the other sign expand flags
- Avoids double expansion when both the exp_tex flag is set AND the texture also is sampled as signed - Should fix missing eyeballs in Mass Effect 1 with the previous sign expansion fix
This commit is contained in:
parent
ce587f43a0
commit
f4ec28d932
@ -48,13 +48,6 @@ void FragmentProgramDecompiler::SetDst(std::string code, u32 flags)
|
||||
|
||||
if (!dst.no_dest)
|
||||
{
|
||||
if (dst.exp_tex)
|
||||
{
|
||||
//Expand [0,1] to [-1, 1]. Confirmed by Castlevania: LOS
|
||||
AddCode("//exp tex flag is set");
|
||||
code = "((" + code + "- 0.5) * 2.)";
|
||||
}
|
||||
|
||||
if (dst.fp16 && device_props.has_native_half_support && !(flags & OPFLAGS::skip_type_cast))
|
||||
{
|
||||
// Cast to native data type
|
||||
@ -988,8 +981,20 @@ bool FragmentProgramDecompiler::handle_tex_srb(u32 opcode)
|
||||
}
|
||||
}
|
||||
|
||||
if (dst.exp_tex)
|
||||
{
|
||||
properties.has_exp_tex_op = true;
|
||||
AddCode("_enable_texture_expand();");
|
||||
}
|
||||
|
||||
auto function = functions[select];
|
||||
SetDst(getFunction(function) + mask);
|
||||
|
||||
if (dst.exp_tex)
|
||||
{
|
||||
// Cleanup
|
||||
AddCode("_disable_texture_expand();");
|
||||
}
|
||||
};
|
||||
|
||||
switch (opcode)
|
||||
|
@ -282,6 +282,7 @@ public:
|
||||
bool has_divsq = false;
|
||||
bool has_clamp = false;
|
||||
bool has_w_access = false;
|
||||
bool has_exp_tex_op = false;
|
||||
}
|
||||
properties;
|
||||
|
||||
|
@ -775,24 +775,39 @@ namespace glsl
|
||||
" }\n"
|
||||
"\n"
|
||||
" return rgba;\n"
|
||||
"}\n\n"
|
||||
"}\n\n";
|
||||
|
||||
if (props.require_texture_expand)
|
||||
{
|
||||
OS <<
|
||||
"uint _texture_flag_override = 0;\n"
|
||||
"#define _enable_texture_expand() _texture_flag_override = 0x3C0\n"
|
||||
"#define _disable_texture_expand() _texture_flag_override = 0\n"
|
||||
"#define TEX_FLAGS(index) (texture_parameters[index].flags | _texture_flag_override)\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
OS <<
|
||||
"#define TEX_FLAGS(index) texture_parameters[index].flags\n";
|
||||
}
|
||||
|
||||
OS <<
|
||||
"#define TEX_NAME(index) tex##index\n"
|
||||
"#define TEX_NAME_STENCIL(index) tex##index##_stencil\n\n"
|
||||
|
||||
"#define TEX1D(index, coord1) process_texel(texture(TEX_NAME(index), coord1 * texture_parameters[index].scale.x), texture_parameters[index].flags)\n"
|
||||
"#define TEX1D_BIAS(index, coord1, bias) process_texel(texture(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, bias), texture_parameters[index].flags)\n"
|
||||
"#define TEX1D_LOD(index, coord1, lod) process_texel(textureLod(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, lod), texture_parameters[index].flags)\n"
|
||||
"#define TEX1D_GRAD(index, coord1, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, dpdx, dpdy), texture_parameters[index].flags)\n"
|
||||
"#define TEX1D_PROJ(index, coord2) process_texel(textureProj(TEX_NAME(index), coord2 * vec2(texture_parameters[index].scale.x, 1.)), texture_parameters[index].flags)\n"
|
||||
"#define TEX1D(index, coord1) process_texel(texture(TEX_NAME(index), coord1 * texture_parameters[index].scale.x), TEX_FLAGS(index))\n"
|
||||
"#define TEX1D_BIAS(index, coord1, bias) process_texel(texture(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, bias), TEX_FLAGS(index))\n"
|
||||
"#define TEX1D_LOD(index, coord1, lod) process_texel(textureLod(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, lod), TEX_FLAGS(index))\n"
|
||||
"#define TEX1D_GRAD(index, coord1, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord1 * texture_parameters[index].scale.x, dpdx, dpdy), TEX_FLAGS(index))\n"
|
||||
"#define TEX1D_PROJ(index, coord2) process_texel(textureProj(TEX_NAME(index), coord2 * vec2(texture_parameters[index].scale.x, 1.)), TEX_FLAGS(index))\n"
|
||||
|
||||
"#define TEX2D(index, coord2) process_texel(texture(TEX_NAME(index), coord2 * texture_parameters[index].scale), texture_parameters[index].flags)\n"
|
||||
"#define TEX2D_BIAS(index, coord2, bias) process_texel(texture(TEX_NAME(index), coord2 * texture_parameters[index].scale, bias), texture_parameters[index].flags)\n"
|
||||
"#define TEX2D_LOD(index, coord2, lod) process_texel(textureLod(TEX_NAME(index), coord2 * texture_parameters[index].scale, lod), texture_parameters[index].flags)\n"
|
||||
"#define TEX2D_GRAD(index, coord2, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord2 * texture_parameters[index].scale, dpdx, dpdy), texture_parameters[index].flags)\n"
|
||||
"#define TEX2D_PROJ(index, coord4) process_texel(textureProj(TEX_NAME(index), coord4 * vec4(texture_parameters[index].scale, 1., 1.)), texture_parameters[index].flags)\n"
|
||||
"#define TEX2D(index, coord2) process_texel(texture(TEX_NAME(index), coord2 * texture_parameters[index].scale), TEX_FLAGS(index))\n"
|
||||
"#define TEX2D_BIAS(index, coord2, bias) process_texel(texture(TEX_NAME(index), coord2 * texture_parameters[index].scale, bias), TEX_FLAGS(index))\n"
|
||||
"#define TEX2D_LOD(index, coord2, lod) process_texel(textureLod(TEX_NAME(index), coord2 * texture_parameters[index].scale, lod), TEX_FLAGS(index))\n"
|
||||
"#define TEX2D_GRAD(index, coord2, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord2 * texture_parameters[index].scale, dpdx, dpdy), TEX_FLAGS(index))\n"
|
||||
"#define TEX2D_PROJ(index, coord4) process_texel(textureProj(TEX_NAME(index), coord4 * vec4(texture_parameters[index].scale, 1., 1.)), TEX_FLAGS(index))\n"
|
||||
|
||||
"#define TEX2D_DEPTH_RGBA8(index, coord2) process_texel(texture2DReconstruct(TEX_NAME(index), TEX_NAME_STENCIL(index), coord2 * texture_parameters[index].scale, texture_parameters[index].remap), texture_parameters[index].flags)\n";
|
||||
"#define TEX2D_DEPTH_RGBA8(index, coord2) process_texel(texture2DReconstruct(TEX_NAME(index), TEX_NAME_STENCIL(index), coord2 * texture_parameters[index].scale, texture_parameters[index].remap), TEX_FLAGS(index))\n";
|
||||
|
||||
if (props.emulate_shadow_compare)
|
||||
{
|
||||
@ -808,11 +823,11 @@ namespace glsl
|
||||
}
|
||||
|
||||
OS <<
|
||||
"#define TEX3D(index, coord3) process_texel(texture(TEX_NAME(index), coord3), texture_parameters[index].flags)\n"
|
||||
"#define TEX3D_BIAS(index, coord3, bias) process_texel(texture(TEX_NAME(index), coord3, bias), texture_parameters[index].flags)\n"
|
||||
"#define TEX3D_LOD(index, coord3, lod) process_texel(textureLod(TEX_NAME(index), coord3, lod), texture_parameters[index].flags)\n"
|
||||
"#define TEX3D_GRAD(index, coord3, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord3, dpdx, dpdy), texture_parameters[index].flags)\n"
|
||||
"#define TEX3D_PROJ(index, coord4) process_texel(textureProj(TEX_NAME(index), coord4), texture_parameters[index].flags)\n\n";
|
||||
"#define TEX3D(index, coord3) process_texel(texture(TEX_NAME(index), coord3), TEX_FLAGS(index))\n"
|
||||
"#define TEX3D_BIAS(index, coord3, bias) process_texel(texture(TEX_NAME(index), coord3, bias), TEX_FLAGS(index))\n"
|
||||
"#define TEX3D_LOD(index, coord3, lod) process_texel(textureLod(TEX_NAME(index), coord3, lod), TEX_FLAGS(index))\n"
|
||||
"#define TEX3D_GRAD(index, coord3, dpdx, dpdy) process_texel(textureGrad(TEX_NAME(index), coord3, dpdx, dpdy), TEX_FLAGS(index))\n"
|
||||
"#define TEX3D_PROJ(index, coord4) process_texel(textureProj(TEX_NAME(index), coord4), TEX_FLAGS(index))\n\n";
|
||||
}
|
||||
|
||||
if (props.require_wpos)
|
||||
|
@ -27,6 +27,7 @@ namespace glsl
|
||||
bool require_depth_conversion;
|
||||
bool require_texture_ops;
|
||||
bool require_shadow_ops;
|
||||
bool require_texture_expand;
|
||||
bool emulate_coverage_tests;
|
||||
bool emulate_shadow_compare;
|
||||
bool low_precision_tests;
|
||||
|
@ -206,6 +206,7 @@ void GLFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS)
|
||||
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_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;
|
||||
m_shader_props.low_precision_tests = ::gl::get_driver_caps().vendor_NVIDIA;
|
||||
|
@ -240,6 +240,7 @@ void VKFragmentDecompilerThread::insertGlobalFunctions(std::stringstream &OS)
|
||||
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_texture_expand = properties.has_exp_tex_op;
|
||||
m_shader_props.emulate_coverage_tests = g_cfg.video.antialiasing_level == msaa_level::none;
|
||||
m_shader_props.emulate_shadow_compare = device_props.emulate_depth_compare;
|
||||
m_shader_props.low_precision_tests = vk::get_driver_vendor() == vk::driver_vendor::NVIDIA;
|
||||
|
Loading…
Reference in New Issue
Block a user