mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: use a local ALPHA register
It would allow to easy tune the parameter to support 24 bits format
This commit is contained in:
parent
d31bd97d59
commit
9ee3a173d0
|
@ -619,7 +619,7 @@ class GSDeviceOGL : public GSDevice
|
|||
GLuint CreateSampler(bool bilinear, bool tau, bool tav);
|
||||
GLuint CreateSampler(PSSamplerSelector sel);
|
||||
GSDepthStencilOGL* CreateDepthStencil(OMDepthStencilSelector dssel);
|
||||
GSBlendStateOGL* CreateBlend(OMBlendSelector bsel, uint8 afix);
|
||||
GSBlendStateOGL* CreateBlend(OMBlendSelector bsel, float afix);
|
||||
|
||||
|
||||
void SetupIA(const void* vertex, int vertex_count, const uint32* index, int index_count, int prim);
|
||||
|
@ -628,7 +628,7 @@ class GSDeviceOGL : public GSDevice
|
|||
void SetupPS(PSSelector sel);
|
||||
void SetupCB(const VSConstantBuffer* vs_cb, const PSConstantBuffer* ps_cb);
|
||||
void SetupSampler(PSSamplerSelector ssel);
|
||||
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix, bool sw_blending = false);
|
||||
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, float afix, bool sw_blending = false);
|
||||
GLuint GetSamplerID(PSSamplerSelector ssel);
|
||||
GLuint GetPaletteSamplerID();
|
||||
|
||||
|
|
|
@ -252,16 +252,19 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
// Format of the output
|
||||
ps_sel.dfmt = GSLocalMemory::m_psm[context->FRAME.PSM].fmt;
|
||||
|
||||
GIFRegALPHA ALPHA = context->ALPHA;
|
||||
float afix = (float)context->ALPHA.FIX / 0x80;
|
||||
|
||||
// Blend
|
||||
|
||||
if (!IsOpaque())
|
||||
{
|
||||
om_bsel.abe = PRIM->ABE || PRIM->AA1 && m_vt.m_primclass == GS_LINE_CLASS;
|
||||
|
||||
om_bsel.a = context->ALPHA.A;
|
||||
om_bsel.b = context->ALPHA.B;
|
||||
om_bsel.c = context->ALPHA.C;
|
||||
om_bsel.d = context->ALPHA.D;
|
||||
om_bsel.a = ALPHA.A;
|
||||
om_bsel.b = ALPHA.B;
|
||||
om_bsel.c = ALPHA.C;
|
||||
om_bsel.d = ALPHA.D;
|
||||
|
||||
if (env.PABE.PABE)
|
||||
{
|
||||
|
@ -439,25 +442,25 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
|
||||
bool colclip_wrap = env.COLCLAMP.CLAMP == 0 && !tex && PRIM->PRIM != GS_POINTLIST && !m_accurate_colclip;
|
||||
bool acc_colclip_wrap = env.COLCLAMP.CLAMP == 0 && m_accurate_colclip;
|
||||
if (context->ALPHA.A == context->ALPHA.B) { // Optimize-away colclip
|
||||
if (ALPHA.A == ALPHA.B) { // Optimize-away colclip
|
||||
// No addition neither substraction so no risk of overflow the [0:255] range.
|
||||
colclip_wrap = false;
|
||||
acc_colclip_wrap = false;
|
||||
#ifdef ENABLE_OGL_DEBUG
|
||||
if (colclip_wrap || acc_colclip_wrap) {
|
||||
const char *col[3] = {"Cs", "Cd", "0"};
|
||||
GL_INS("COLCLIP: DISABLED: blending is a plain copy of %s", col[context->ALPHA.D]);
|
||||
GL_INS("COLCLIP: DISABLED: blending is a plain copy of %s", col[ALPHA.D]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (colclip_wrap) {
|
||||
ps_sel.colclip = 1;
|
||||
GL_INS("COLCLIP ENABLED (blending is %d/%d/%d/%d)", context->ALPHA.A, context->ALPHA.B, context->ALPHA.C, context->ALPHA.D);
|
||||
GL_INS("COLCLIP ENABLED (blending is %d/%d/%d/%d)", ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D);
|
||||
} else if (acc_colclip_wrap) {
|
||||
ps_sel.colclip = 3;
|
||||
GL_INS("COLCLIP SW ENABLED (blending is %d/%d/%d/%d)", context->ALPHA.A, context->ALPHA.B, context->ALPHA.C, context->ALPHA.D);
|
||||
} else if (env.COLCLAMP.CLAMP == 0 && (context->ALPHA.A != context->ALPHA.B)) {
|
||||
GL_INS("COLCLIP NOT SUPPORTED (blending is %d/%d/%d/%d)", context->ALPHA.A, context->ALPHA.B, context->ALPHA.C, context->ALPHA.D);
|
||||
GL_INS("COLCLIP SW ENABLED (blending is %d/%d/%d/%d)", ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D);
|
||||
} else if (env.COLCLAMP.CLAMP == 0 && (ALPHA.A != ALPHA.B)) {
|
||||
GL_INS("COLCLIP NOT SUPPORTED (blending is %d/%d/%d/%d)", ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D);
|
||||
}
|
||||
|
||||
ps_sel.fba = context->FBA.FBA;
|
||||
|
@ -613,8 +616,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
dev->PSSetShaderResource(3, rt);
|
||||
|
||||
// Require the fix alpha vlaue
|
||||
if (context->ALPHA.C == 2) {
|
||||
ps_cb.AlphaCoeff = GSVector4((float)(int)context->ALPHA.FIX / 0x80);
|
||||
if (ALPHA.C == 2) {
|
||||
ps_cb.AlphaCoeff = GSVector4(afix);
|
||||
}
|
||||
|
||||
// No need to flush for every primitive
|
||||
|
@ -632,7 +635,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
|||
dev->SetupPS(ps_sel);
|
||||
|
||||
// rs
|
||||
uint8 afix = context->ALPHA.FIX;
|
||||
|
||||
GSVector4i scissor = GSVector4i(GSVector4(rtscale).xyxy() * context->scissor.in).rintersect(GSVector4i(rtsize).zwxy());
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ GSDepthStencilOGL* GSDeviceOGL::CreateDepthStencil(OMDepthStencilSelector dssel)
|
|||
return dss;
|
||||
}
|
||||
|
||||
GSBlendStateOGL* GSDeviceOGL::CreateBlend(OMBlendSelector bsel, uint8 afix)
|
||||
GSBlendStateOGL* GSDeviceOGL::CreateBlend(OMBlendSelector bsel, float afix)
|
||||
{
|
||||
GSBlendStateOGL* bs = new GSBlendStateOGL();
|
||||
|
||||
|
@ -119,7 +119,7 @@ GSBlendStateOGL* GSDeviceOGL::CreateBlend(OMBlendSelector bsel, uint8 afix)
|
|||
bs->SetRGB(m_blendMapD3D9[i].op, m_blendMapD3D9[i].src, GL_ONE);
|
||||
}
|
||||
|
||||
const string afixstr = format("%d >> 7", afix);
|
||||
const string afixstr = format("%f", afix);
|
||||
const char *col[3] = {"Cs", "Cd", "0"};
|
||||
const char *alpha[3] = {"As", "Ad", afixstr.c_str()};
|
||||
fprintf(stderr, "Impossible blend for D3D: (%s - %s) * %s + %s\n", col[bsel.a], col[bsel.b], alpha[bsel.c], col[bsel.d]);
|
||||
|
@ -235,7 +235,7 @@ GLuint GSDeviceOGL::GetPaletteSamplerID()
|
|||
return m_palette_ss;
|
||||
}
|
||||
|
||||
void GSDeviceOGL::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix, bool sw_blending)
|
||||
void GSDeviceOGL::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, float afix, bool sw_blending)
|
||||
{
|
||||
GSDepthStencilOGL* dss = m_om_dss[dssel];
|
||||
|
||||
|
@ -267,5 +267,5 @@ void GSDeviceOGL::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, ui
|
|||
// *************************************************************
|
||||
// Dynamic
|
||||
// *************************************************************
|
||||
OMSetBlendState(bs, (float)(int)afix / 0x80);
|
||||
OMSetBlendState(bs, afix);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue