GS:GL: Move TextureOffset to vs cb

It's used by the vs, why would you put it in the ps cb?
This commit is contained in:
TellowKrinkle 2021-11-15 22:46:38 -06:00 committed by tellowkrinkle
parent 8d6569be95
commit e04e0e38d1
4 changed files with 24 additions and 16 deletions

View File

@ -127,17 +127,17 @@ public:
{
GSVector4 Vertex_Scale_Offset;
GSVector4 TextureOffset;
GSVector4 Texture_Scale_Offset;
GSVector2 PointSize;
GSVector2i MaxDepth;
VSConstantBuffer()
{
Vertex_Scale_Offset = GSVector4::zero();
TextureOffset = GSVector4::zero();
PointSize = GSVector2(0);
MaxDepth = GSVector2i(0);
Vertex_Scale_Offset = GSVector4::zero();
Texture_Scale_Offset = GSVector4::zero();
PointSize = GSVector2(0);
MaxDepth = GSVector2i(0);
}
__forceinline bool Update(const VSConstantBuffer* cb)
@ -221,7 +221,7 @@ public:
GSVector4 HalfTexel;
GSVector4 MinMax;
GSVector4 TC_OH_TS;
GSVector4 TC_OH;
GSVector4 MaxDepth;
GSVector4 DitherMatrix[4];
@ -234,7 +234,7 @@ public:
TA_Af = GSVector4::zero();
MinMax = GSVector4::zero();
MskFix = GSVector4i::zero();
TC_OH_TS = GSVector4::zero();
TC_OH = GSVector4::zero();
FbMask = GSVector4i::zero();
MaxDepth = GSVector4::zero();

View File

@ -759,7 +759,9 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex)
// The purpose of texture shuffle is to move color channel. Extra interpolation is likely a bad idea.
bilinear &= m_vt.IsLinear();
vs_cb.TextureOffset = RealignTargetTextureCoordinate(tex);
GSVector4 half_offset = RealignTargetTextureCoordinate(tex);
vs_cb.Texture_Scale_Offset.z = half_offset.x;
vs_cb.Texture_Scale_Offset.w = half_offset.y;
}
else if (tex->m_target)
{
@ -817,7 +819,9 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex)
bilinear &= m_vt.IsLinear();
}
vs_cb.TextureOffset = RealignTargetTextureCoordinate(tex);
GSVector4 half_offset = RealignTargetTextureCoordinate(tex);
vs_cb.Texture_Scale_Offset.z = half_offset.x;
vs_cb.Texture_Scale_Offset.w = half_offset.y;
}
else if (tex->m_palette)
{
@ -882,7 +886,10 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex)
// TC Offset Hack
m_ps_sel.tcoffsethack = m_userhacks_tcoffset;
ps_cb.TC_OH_TS = GSVector4(1 / 16.0f, 1 / 16.0f, m_userhacks_tcoffset_x, m_userhacks_tcoffset_y) / WH.xyxy();
GSVector4 tc_oh_ts = GSVector4(1 / 16.0f, 1 / 16.0f, m_userhacks_tcoffset_x, m_userhacks_tcoffset_y) / WH.xyxy();
ps_cb.TC_OH = tc_oh_ts.zwzw();
vs_cb.Texture_Scale_Offset.x = tc_oh_ts.x;
vs_cb.Texture_Scale_Offset.y = tc_oh_ts.y;
// Must be done after all coordinates math
if (m_context->HasFixedTEX0() && !PRIM->FST)
@ -1138,7 +1145,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
const bool ate_second_pass = m_context->TEST.DoSecondPass();
ResetStates();
vs_cb.TextureOffset = GSVector4(0.0f);
vs_cb.Texture_Scale_Offset = GSVector4(0.0f);
ASSERT(m_dev != NULL);
GSDeviceOGL* dev = (GSDeviceOGL*)m_dev;

View File

@ -63,7 +63,8 @@ layout(std140, binding = 20) uniform cb20
vec2 VertexScale;
vec2 VertexOffset;
vec4 TextureOffset;
vec2 TextureScale;
vec2 TextureOffset;
vec2 PointSize;
uint MaxDepth;
@ -91,10 +92,10 @@ layout(std140, binding = 21) uniform cb21
vec4 MinMax;
vec2 TextureScale;
vec2 pad1_cb21;
vec2 TC_OffsetHack;
vec3 pad1_cb21;
vec3 pad2_cb21;
float MaxDepthPS;
mat4 DitherMatrix;

View File

@ -24,8 +24,8 @@ const float exp_min32 = exp2(-32.0f);
void texture_coord()
{
vec2 uv = vec2(i_uv) - TextureOffset.xy;
vec2 st = i_st - TextureOffset.xy;
vec2 uv = vec2(i_uv) - TextureOffset;
vec2 st = i_st - TextureOffset;
// Float coordinate
VSout.t_float.xy = st;