mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
gl: Fix unnormalized coord sampling.
This commit is contained in:
parent
f712b8aca4
commit
17c4b2387e
@ -1 +1 @@
|
||||
Subproject commit ec513f89f9354394fec465448a2838f106777640
|
||||
Subproject commit 1affe90f0ec7f9bccb6841a56a2a5b66861efe6a
|
@ -47,11 +47,11 @@ std::string getFunctionImpl(FUNCTION f)
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE1D_LOD:
|
||||
return "textureLod($t, $0.x, $1)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D:
|
||||
return "texture($t, $0.xy)";
|
||||
return "texture($t, $0.xy * $t_coord_scale)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_PROJ:
|
||||
return "textureProj($t, $0.xyz, $1.x)"; // Note: $1.x is bias
|
||||
return "textureProj($t, $0.xyz * vec3($t_coord_scale, 1.) , $1.x)"; // Note: $1.x is bias
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_LOD:
|
||||
return "textureLod($t, $0.xy, $1.x)";
|
||||
return "textureLod($t, $0.xy * $t_coord_scale, $1.x)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE:
|
||||
return "texture($t, $0.xyz)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_PROJ:
|
||||
|
@ -85,9 +85,6 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
||||
std::string samplerType = PT.type;
|
||||
int index = atoi(&PI.name.data()[3]);
|
||||
|
||||
if (m_prog.unnormalized_coords & (1 << index))
|
||||
samplerType = "sampler2DRect";
|
||||
|
||||
OS << "uniform " << samplerType << " " << PI.name << ";" << std::endl;
|
||||
}
|
||||
}
|
||||
@ -163,6 +160,27 @@ void GLFragmentDecompilerThread::insertMainStart(std::stringstream & OS)
|
||||
|
||||
OS << " vec4 ssa = gl_FrontFacing ? vec4(1.) : vec4(-1.);\n";
|
||||
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_UNIFORM])
|
||||
{
|
||||
if (PT.type != "sampler2D")
|
||||
continue;
|
||||
|
||||
for (const ParamItem& PI : PT.items)
|
||||
{
|
||||
std::string samplerType = PT.type;
|
||||
int index = atoi(&PI.name.data()[3]);
|
||||
|
||||
if (m_prog.unnormalized_coords & (1 << index))
|
||||
{
|
||||
OS << "vec2 tex" << index << "_coord_scale = 1. / textureSize(" << PI.name << ", 0);\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
OS << "vec2 tex" << index << "_coord_scale = vec2(1.);\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// search if there is fogc in inputs
|
||||
for (const ParamType& PT : m_parr.params[PF_PARAM_IN])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user