gsdx-ogl: move texture scale from vs_cb to fs_cb

It avoid useless update of the vs_cb.
This commit is contained in:
Gregory Hainaut 2015-08-20 21:39:30 +02:00
parent 499206f0ea
commit 7002ff3ec3
5 changed files with 64 additions and 15 deletions

View File

@ -200,7 +200,7 @@ class GSDeviceOGL : public GSDevice
GSVector4 HalfTexel;
GSVector4 MinMax;
GSVector4 TC_OffsetHack;
GSVector4 TC_OH_TS;
PSConstantBuffer()
{
@ -211,7 +211,7 @@ class GSDeviceOGL : public GSDevice
MinF_TA = GSVector4::zero();
MskFix = GSVector4i::zero();
AlphaCoeff = GSVector4::zero();
TC_OffsetHack = GSVector4::zero();
TC_OH_TS = GSVector4::zero();
FbMask = GSVector4i::zero();
}
@ -220,7 +220,7 @@ class GSDeviceOGL : public GSDevice
GSVector4i* a = (GSVector4i*)this;
GSVector4i* b = (GSVector4i*)cb;
// if WH matches both HalfTexel and TC_OffsetHack do too
// if WH matches both HalfTexel and TC_OH_TS do too
// MinMax depends on WH and MskFix so no need to check it too
if(!((a[0] == b[0]) & (a[1] == b[1]) & (a[2] == b[2]) & (a[3] == b[3]) & (a[4] == b[4]) & (a[5] == b[5])).alltrue())
{

View File

@ -353,7 +353,7 @@ bool GSRendererOGL::EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, bool DATE_G
case ACC_BLEND_ULTRA: sw_blending |= true;
case ACC_BLEND_FULL: if (!m_vt.m_alpha.valid && (ALPHA.C == 0)) GetAlphaMinMax();
sw_blending |= (ALPHA.A != ALPHA.B) &&
((ALPHA.C == 0 && m_vt.m_alpha.max > 128u) || (ALPHA.C == 2 && ALPHA.FIX > 128u));
((ALPHA.C == 0 && m_vt.m_alpha.max > 128) || (ALPHA.C == 2 && ALPHA.FIX > 128u));
case ACC_BLEND_CCLIP_DALPHA: sw_blending |= (ALPHA.C == 1) || (m_env.COLCLAMP.CLAMP == 0);
case ACC_BLEND_SPRITE: sw_blending |= m_vt.m_primclass == GS_SPRITE_CLASS;
case ACC_BLEND_FREE: sw_blending |= ps_sel.fbmask || impossible_or_free_blend;
@ -843,12 +843,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
GSVector4 WH(tw, th, w, h);
if (PRIM->FST)
{
// FIXME move it in the ps_cb
vs_cb.TextureScale = GSVector4(1.0f / 16) / WH.xyxy();
ps_sel.fst = 1;
}
ps_sel.fst = !!PRIM->FST;
ps_cb.WH = WH;
ps_cb.HalfTexel = GSVector4(-0.5f, 0.5f).xxyy() / WH.zwzw();
@ -859,7 +854,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
// TC Offset Hack
ps_sel.tcoffsethack = !!UserHacks_TCOffset;
ps_cb.TC_OffsetHack = GSVector4(UserHacks_TCO_x, UserHacks_TCO_y).xyxy() / WH.xyxy();
ps_cb.TC_OH_TS = GSVector4(1/16.0f, 1/16.0f, UserHacks_TCO_x, UserHacks_TCO_y).xyxy() / WH.xyxy();
GSVector4 clamp(ps_cb.MskFix);
GSVector4 ta(m_env.TEXA & GSVector4i::x000000ff());

View File

@ -59,6 +59,7 @@ layout(r32i, binding = 2) coherent uniform iimage2D img_prim_min;
#endif
// Warning duplicated in both GLSL file
layout(std140, binding = 21) uniform cb21
{
vec3 FogColor;
@ -80,8 +81,8 @@ layout(std140, binding = 21) uniform cb21
vec4 MinMax;
vec2 TextureScale;
vec2 TC_OffsetHack;
vec2 _pad2;
};
vec4 sample_c(vec2 uv)

View File

@ -4,10 +4,36 @@ layout(std140, binding = 20) uniform cb20
{
vec2 VertexScale;
vec2 VertexOffset;
vec2 TextureScale;
vec2 _removed_TextureScale;
vec2 PointSize;
};
// Warning duplicated in both GLSL file
layout(std140, binding = 21) uniform cb21
{
vec3 FogColor;
float AREF;
vec4 WH;
vec2 MinF;
vec2 TA;
uvec4 MskFix;
uvec4 FbMask;
vec3 _pad1;
float Af;
vec4 HalfTexel;
vec4 MinMax;
vec2 TextureScale;
vec2 TC_OffsetHack;
};
#ifdef VERTEX_SHADER
layout(location = 0) in vec2 i_st;
layout(location = 2) in vec4 i_c;

View File

@ -610,10 +610,36 @@ static const char* tfx_vgs_glsl =
"{\n"
" vec2 VertexScale;\n"
" vec2 VertexOffset;\n"
" vec2 TextureScale;\n"
" vec2 _removed_TextureScale;\n"
" vec2 PointSize;\n"
"};\n"
"\n"
"// Warning duplicated in both GLSL file\n"
"layout(std140, binding = 21) uniform cb21\n"
"{\n"
" vec3 FogColor;\n"
" float AREF;\n"
"\n"
" vec4 WH;\n"
"\n"
" vec2 MinF;\n"
" vec2 TA;\n"
"\n"
" uvec4 MskFix;\n"
"\n"
" uvec4 FbMask;\n"
"\n"
" vec3 _pad1;\n"
" float Af;\n"
"\n"
" vec4 HalfTexel;\n"
"\n"
" vec4 MinMax;\n"
"\n"
" vec2 TextureScale;\n"
" vec2 TC_OffsetHack;\n"
"};\n"
"\n"
"#ifdef VERTEX_SHADER\n"
"layout(location = 0) in vec2 i_st;\n"
"layout(location = 2) in vec4 i_c;\n"
@ -918,6 +944,7 @@ static const char* tfx_fs_all_glsl =
"#endif\n"
"\n"
"\n"
"// Warning duplicated in both GLSL file\n"
"layout(std140, binding = 21) uniform cb21\n"
"{\n"
" vec3 FogColor;\n"
@ -939,8 +966,8 @@ static const char* tfx_fs_all_glsl =
"\n"
" vec4 MinMax;\n"
"\n"
" vec2 TextureScale;\n"
" vec2 TC_OffsetHack;\n"
" vec2 _pad2;\n"
"};\n"
"\n"
"vec4 sample_c(vec2 uv)\n"