gsdx-ogl: alpha bending equation/function are constant

Drop useless variables/state checking
This commit is contained in:
Gregory Hainaut 2015-05-05 11:20:25 +02:00
parent 8032e2c369
commit 5f5b901bca
4 changed files with 6 additions and 32 deletions

View File

@ -29,11 +29,8 @@ namespace GLState {
bool blend;
GLenum eq_RGB;
GLenum eq_A ;
GLenum f_sRGB;
GLenum f_dRGB;
GLenum f_sA;
GLenum f_dA;
uint32 wrgba;
float bf;
@ -79,11 +76,8 @@ namespace GLState {
blend = false;
eq_RGB = 0;
eq_A = 0;
f_sRGB = 0;
f_dRGB = 0;
f_sA = 0;
f_dA = 0;
wrgba = 0xF;
bf = 0.0;

View File

@ -31,11 +31,8 @@ namespace GLState {
extern bool blend;
extern GLenum eq_RGB;
extern GLenum eq_A;
extern GLenum f_sRGB;
extern GLenum f_dRGB;
extern GLenum f_sA;
extern GLenum f_dA;
extern uint32 wrgba;
extern float bf;

View File

@ -1030,8 +1030,8 @@ void GSDeviceOGL::OMSetColorMaskState(OMColorMaskSelector sel)
void GSDeviceOGL::OMSetBlendState(GSBlendStateOGL* bs, float bf)
{
// State is checkd inside the object but worst case is 15 comparaisons !
if ( m_state.bs != bs || (m_state.bf != bf && bs->HasConstantFactor()) )
// State is checkd inside the object but worst case is 8 comparaisons
if (m_state.bs != bs || m_state.bf != bf)
{
m_state.bs = bs;
m_state.bf = bf;

View File

@ -40,22 +40,16 @@ class GSBlendStateOGL {
// We will keep basic the first try
bool m_enable;
GLenum m_equation_RGB;
GLenum m_equation_A;
GLenum m_func_sRGB;
GLenum m_func_dRGB;
GLenum m_func_sA;
GLenum m_func_dA;
bool constant_factor;
public:
GSBlendStateOGL() : m_enable(false)
, m_equation_RGB(0)
, m_equation_A(GL_FUNC_ADD)
, m_func_sRGB(0)
, m_func_dRGB(0)
, m_func_sA(GL_ONE)
, m_func_dA(GL_ZERO)
, constant_factor(false)
{}
@ -67,13 +61,6 @@ public:
if (IsConstant(src) || IsConstant(dst)) constant_factor = true;
}
void SetALPHA(GLenum op, GLenum src, GLenum dst)
{
m_equation_A = op;
m_func_sA = src;
m_func_dA = dst;
}
void RevertOp()
{
if(m_equation_RGB == GL_FUNC_ADD)
@ -106,18 +93,14 @@ public:
}
}
if (GLState::eq_RGB != m_equation_RGB || GLState::eq_A != m_equation_A) {
if (GLState::eq_RGB != m_equation_RGB) {
GLState::eq_RGB = m_equation_RGB;
GLState::eq_A = m_equation_A;
gl_BlendEquationSeparateiARB(0, m_equation_RGB, m_equation_A);
gl_BlendEquationSeparateiARB(0, m_equation_RGB, GL_FUNC_ADD);
}
// FIXME align then SSE
if (GLState::f_sRGB != m_func_sRGB || GLState::f_dRGB != m_func_dRGB || GLState::f_sA != m_func_sA || GLState::f_dA != m_func_dA) {
if (GLState::f_sRGB != m_func_sRGB || GLState::f_dRGB != m_func_dRGB) {
GLState::f_sRGB = m_func_sRGB;
GLState::f_dRGB = m_func_dRGB;
GLState::f_sA = m_func_sA;
GLState::f_dA = m_func_dA;
gl_BlendFuncSeparateiARB(0, m_func_sRGB, m_func_dRGB, m_func_sA, m_func_dA);
gl_BlendFuncSeparateiARB(0, m_func_sRGB, m_func_dRGB, GL_ONE, GL_ZERO);
}
}
}