mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: add a texture offset uniform parameter to vertex shader
It would be used for a new implementation of the half pixel offset hack Hopefully it doesn't badly impact the perf on low end iGPU
This commit is contained in:
parent
f6cad2235b
commit
c2229e3c0b
|
@ -120,12 +120,16 @@ public:
|
|||
struct alignas(32) VSConstantBuffer
|
||||
{
|
||||
GSVector4 Vertex_Scale_Offset;
|
||||
|
||||
GSVector4 TextureOffset;
|
||||
|
||||
GSVector2i DepthMask;
|
||||
GSVector2 PointSize;
|
||||
|
||||
VSConstantBuffer()
|
||||
{
|
||||
Vertex_Scale_Offset = GSVector4::zero();
|
||||
TextureOffset = GSVector4::zero();
|
||||
DepthMask = GSVector2i(0);
|
||||
PointSize = GSVector2(0);
|
||||
}
|
||||
|
@ -135,7 +139,7 @@ public:
|
|||
GSVector4i* a = (GSVector4i*)this;
|
||||
GSVector4i* b = (GSVector4i*)cb;
|
||||
|
||||
if(!((a[0] == b[0]) & (a[1] == b[1])).alltrue())
|
||||
if(!((a[0] == b[0]) & (a[1] == b[1]) & (a[2] == b[2])).alltrue())
|
||||
{
|
||||
a[0] = b[0];
|
||||
a[1] = b[1];
|
||||
|
|
|
@ -60,11 +60,14 @@ layout(std140, binding = 15) uniform cb15
|
|||
#if defined(VERTEX_SHADER) || defined(GEOMETRY_SHADER)
|
||||
layout(std140, binding = 20) uniform cb20
|
||||
{
|
||||
vec2 VertexScale;
|
||||
vec2 VertexOffset;
|
||||
uint DepthMask;
|
||||
uint cb20_pad;
|
||||
vec2 PointSize;
|
||||
vec2 VertexScale;
|
||||
vec2 VertexOffset;
|
||||
|
||||
vec4 TextureOffset;
|
||||
|
||||
uint DepthMask;
|
||||
uint cb20_pad;
|
||||
vec2 PointSize;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ const float exp_min32 = exp2(-32.0f);
|
|||
|
||||
void texture_coord()
|
||||
{
|
||||
vec2 uv = vec2(i_uv);
|
||||
vec2 uv = vec2(i_uv) - TextureOffset.xy;
|
||||
|
||||
// Float coordinate
|
||||
VSout.t_float.xy = i_st;
|
||||
VSout.t_float.xy = i_st - TextureOffset.zw; // FIXME or .xy check final code
|
||||
VSout.t_float.w = i_q;
|
||||
|
||||
// Integer coordinate => normalized
|
||||
|
|
|
@ -88,11 +88,14 @@ static const char* const common_header_glsl =
|
|||
"#if defined(VERTEX_SHADER) || defined(GEOMETRY_SHADER)\n"
|
||||
"layout(std140, binding = 20) uniform cb20\n"
|
||||
"{\n"
|
||||
" vec2 VertexScale;\n"
|
||||
" vec2 VertexOffset;\n"
|
||||
" uint DepthMask;\n"
|
||||
" uint cb20_pad;\n"
|
||||
" vec2 PointSize;\n"
|
||||
" vec2 VertexScale;\n"
|
||||
" vec2 VertexOffset;\n"
|
||||
"\n"
|
||||
" vec4 TextureOffset;\n"
|
||||
"\n"
|
||||
" uint DepthMask;\n"
|
||||
" uint cb20_pad;\n"
|
||||
" vec2 PointSize;\n"
|
||||
"};\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
|
@ -764,10 +767,10 @@ static const char* const tfx_vgs_glsl =
|
|||
"\n"
|
||||
"void texture_coord()\n"
|
||||
"{\n"
|
||||
" vec2 uv = vec2(i_uv);\n"
|
||||
" vec2 uv = vec2(i_uv) - TextureOffset.xy;\n"
|
||||
"\n"
|
||||
" // Float coordinate\n"
|
||||
" VSout.t_float.xy = i_st;\n"
|
||||
" VSout.t_float.xy = i_st - TextureOffset.zw; // FIXME or .xy check final code\n"
|
||||
" VSout.t_float.w = i_q;\n"
|
||||
"\n"
|
||||
" // Integer coordinate => normalized\n"
|
||||
|
|
Loading…
Reference in New Issue