gsdx-ogl: add the alpha value in a constant buffer

This commit is contained in:
Gregory Hainaut 2015-05-08 20:23:38 +02:00
parent 472608b879
commit f029e4763f
4 changed files with 10 additions and 1 deletions

View File

@ -256,6 +256,7 @@ class GSDeviceOGL : public GSDevice
GSVector4 WH;
GSVector4 MinF_TA;
GSVector4i MskFix;
GSVector4 AlphaCoeff;
GSVector4 HalfTexel;
GSVector4 MinMax;
@ -269,6 +270,7 @@ class GSDeviceOGL : public GSDevice
MinMax = GSVector4::zero();
MinF_TA = GSVector4::zero();
MskFix = GSVector4i::zero();
AlphaCoeff = GSVector4::zero();
}
__forceinline bool Update(const PSConstantBuffer* cb)
@ -278,13 +280,14 @@ class GSDeviceOGL : public GSDevice
// if WH matches both HalfTexel and TC_OffsetHack 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])).alltrue())
if(!((a[0] == b[0]) & (a[1] == b[1]) & (a[2] == b[2]) & (a[3] == b[3]) & (a[4] == b[4])).alltrue())
{
// Note previous check uses SSE already, a plain copy will be faster than any memcpy
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
a[4] = b[4];
return true;
}

View File

@ -572,6 +572,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
dev->SetupPS(ps_sel);
dev->PSSetShaderResource(3, rt);
if (bogus_blend == 6 || bogus_blend == 9 || bogus_blend == 12) {
ps_cb.AlphaCoeff = GSVector4((float)(int)afix / 0x80);
}
require_barrier = ((bogus_blend != 7) && (bogus_blend != 9));
}

View File

@ -65,6 +65,7 @@ layout(std140, binding = 21) uniform cb21
vec2 MinF;
vec2 TA;
uvec4 MskFix;
vec4 Af;
vec4 HalfTexel;
vec4 MinMax;
vec4 TC_OffsetHack;

View File

@ -779,6 +779,7 @@ static const char* tfx_fs_all_glsl =
" vec2 MinF;\n"
" vec2 TA;\n"
" uvec4 MskFix;\n"
" vec4 Af;\n"
" vec4 HalfTexel;\n"
" vec4 MinMax;\n"
" vec4 TC_OffsetHack;\n"