gsdx ogl: emulate GL_ARB_draw_buffers_blend and GL_ARB_viewport_array

New functions only set the parameter to a single buffer whereas old function
set all buffers
This commit is contained in:
Gregory Hainaut 2016-05-14 17:15:30 +02:00
parent 4065730e36
commit cd9ee3c468
2 changed files with 36 additions and 8 deletions

View File

@ -151,6 +151,28 @@ PFNGLCREATEPROGRAMPIPELINESPROC glCreateProgramPipelines = NUL
PFNGLCLIPCONTROLPROC glClipControl = NULL;
PFNGLTEXTUREBARRIERPROC glTextureBarrier = NULL;
namespace ReplaceGL {
void APIENTRY BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
{
glBlendEquationSeparate(modeRGB, modeAlpha);
}
void APIENTRY BlendFuncSeparateiARB(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
void APIENTRY ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
{
glScissor(left, bottom, width, height);
}
void APIENTRY ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
{
glViewport(x, y, w, h);
}
}
namespace GLLoader {
bool fglrx_buggy_driver = false;
@ -315,6 +337,18 @@ namespace GLLoader {
}
#endif
if (!found_GL_ARB_viewport_array) {
fprintf(stderr, "GL_ARB_viewport_array: not supported ! function pointer will be replaced\n");
glScissorIndexed = ReplaceGL::ScissorIndexed;
glViewportIndexedf = ReplaceGL::ViewportIndexedf;
}
if (!found_GL_ARB_draw_buffers_blend) {
fprintf(stderr, "GL_ARB_draw_buffers_blend: not supported ! function pointer will be replaced\n");
glBlendFuncSeparateiARB = ReplaceGL::BlendFuncSeparateiARB;
glBlendEquationSeparateiARB = ReplaceGL::BlendEquationSeparateiARB;
}
fprintf(stdout, "\n");
return status;

View File

@ -1455,10 +1455,7 @@ void GSDeviceOGL::OMSetBlendState(uint8 blend_index, uint8 blend_factor, bool is
if (GLState::eq_RGB != b.op) {
GLState::eq_RGB = b.op;
if (glBlendEquationSeparateiARB)
glBlendEquationSeparateiARB(0, b.op, GL_FUNC_ADD);
else
glBlendEquationSeparate(b.op, GL_FUNC_ADD);
glBlendEquationSeparateiARB(0, b.op, GL_FUNC_ADD);
}
if (GLState::f_sRGB != b.src || GLState::f_dRGB != b.dst) {
@ -1480,10 +1477,7 @@ void GSDeviceOGL::OMSetBlendState(uint8 blend_index, uint8 blend_factor, bool is
}
// AMD DRIVER SUCK
if (glBlendFuncSeparateiARB)
glBlendFuncSeparateiARB(0, src, dst, GL_ONE, GL_ZERO);
else
glBlendFuncSeparate(src, dst, GL_ONE, GL_ZERO);
glBlendFuncSeparateiARB(0, src, dst, GL_ONE, GL_ZERO);
}
} else {