Implement KHR advanced blend equation extensions

This commit is contained in:
baldurk committed 2014-12-20 19:54:50 +00:00
1 parent c02a8d7786
commit da93a4e0a0
9 files changed
+50 -2

No files matched your search

+1
View File
@@ -78,6 +78,7 @@ void DoVendorChecks(const GLHookSet &gl, GLWindowingData context)
EXT_CHECK(ARB_clip_control);
EXT_CHECK(ARB_enhanced_layouts);
EXT_CHECK(EXT_polygon_offset_clamp);
EXT_CHECK(KHR_blend_equation_advanced_coherent);
#undef EXT_CHECK
}
+2
View File
@@ -98,6 +98,7 @@ enum ExtensionCheckEnum
ExtensionSupported_ARB_enhanced_layouts = 0,
ExtensionSupported_ARB_clip_control,
ExtensionSupported_EXT_polygon_offset_clamp,
ExtensionSupported_KHR_blend_equation_advanced_coherent,
ExtensionSupported_Count,
};
extern bool ExtensionSupported[ExtensionSupported_Count];
@@ -265,6 +266,7 @@ enum GLChunkType
BLEND_EQI,
BLEND_EQ_SEP,
BLEND_EQ_SEPI,
BLEND_BARRIER,
LOGIC_OP,
STENCIL_OP,
STENCIL_OP_SEP,
+6
View File
@@ -160,6 +160,7 @@ const char *GLChunkNames[] =
"glBlendEquationi",
"glBlendEquationSeparate",
"glBlendEquationSeparatei",
"glBlendBarrierKHR",
"glLogicOp",
"glStencilOp",
"glStencilOpSeparate",
@@ -463,6 +464,8 @@ WrappedOpenGL::WrappedOpenGL(const char *logfile, const GLHookSet &funcs)
globalExts.push_back("GL_GREMEDY_string_marker");
globalExts.push_back("GL_GREMEDY_frame_terminator");
globalExts.push_back("GL_KHR_debug");
globalExts.push_back("GL_KHR_blend_equation_advanced");
globalExts.push_back("GL_KHR_blend_equation_advanced_coherent");
// we'll be sorting the implementation extension array, so make sure the
// sorts are identical so we can do the intersection easily
@@ -2206,6 +2209,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
case BLEND_EQ_SEPI:
Serialise_glBlendEquationSeparatei(0, eGL_NONE, eGL_NONE);
break;
case BLEND_BARRIER:
Serialise_glBlendBarrierKHR();
break;
case LOGIC_OP:
Serialise_glLogicOp(eGL_NONE);
+1
View File
@@ -376,6 +376,7 @@ class WrappedOpenGL
IMPLEMENT_FUNCTION_SERIALISED(void, glBlendEquationi(GLuint buf, GLenum mode));
IMPLEMENT_FUNCTION_SERIALISED(void, glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha));
IMPLEMENT_FUNCTION_SERIALISED(void, glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha));
IMPLEMENT_FUNCTION_SERIALISED(void, glBlendBarrierKHR());
IMPLEMENT_FUNCTION_SERIALISED(void, glLogicOp(GLenum opcode));
IMPLEMENT_FUNCTION_SERIALISED(void, glStencilFunc(GLenum func, GLint ref, GLuint mask));
IMPLEMENT_FUNCTION_SERIALISED(void, glStencilMask(GLuint mask));
+1
View File
@@ -237,6 +237,7 @@ struct GLHookSet
PFNGLBLENDEQUATIONIPROC glBlendEquationi; // aliases glBlendEquationiARB
PFNGLBLENDEQUATIONSEPARATEPROC glBlendEquationSeparate; // aliases glBlendEquationSeparateARB
PFNGLBLENDEQUATIONSEPARATEIPROC glBlendEquationSeparatei; // aliases glBlendEquationSeparateiARB
PFNGLBLENDBARRIERKHRPROC glBlendBarrierKHR;
PFNGLSTENCILFUNCSEPARATEPROC glStencilFuncSeparate;
PFNGLSTENCILMASKSEPARATEPROC glStencilMaskSeparate;
PFNGLSTENCILOPSEPARATEPROC glStencilOpSeparate;
+2 -2
View File
@@ -739,6 +739,7 @@
HookExtension(PFNGLREADNPIXELSPROC, glReadnPixels); \
HookExtensionAlias(PFNGLREADNPIXELSPROC, glReadnPixels, glReadnPixelsARB); \
HookExtension(PFNGLTEXTUREBARRIERPROC, glTextureBarrier); \
HookExtension(PFNGLBLENDBARRIERKHRPROC, glBlendBarrierKHR); \
HookExtension(PFNGLDEPTHBOUNDSEXTPROC, glDepthBoundsEXT); \
HookExtension(PFNGLTEXTUREPARAMETERFEXTPROC, glTextureParameterfEXT); \
HookExtension(PFNGLTEXTUREPARAMETERFVEXTPROC, glTextureParameterfvEXT); \
@@ -1513,6 +1514,7 @@
HookWrapper4(void, glGetnUniformuiv, GLuint, program, GLint, location, GLsizei, bufSize, GLuint *, params); \
HookWrapper8(void, glReadnPixels, GLint, x, GLint, y, GLsizei, width, GLsizei, height, GLenum, format, GLenum, type, GLsizei, bufSize, void *, data); \
HookWrapper0(void, glTextureBarrier); \
HookWrapper0(void, glBlendBarrierKHR); \
HookWrapper2(void, glDepthBoundsEXT, GLclampd, zmin, GLclampd, zmax); \
HookWrapper4(void, glTextureParameterfEXT, GLuint, texture, GLenum, target, GLenum, pname, GLfloat, param); \
HookWrapper4(void, glTextureParameterfvEXT, GLuint, texture, GLenum, target, GLenum, pname, const GLfloat *, params); \
@@ -2048,7 +2050,6 @@
HookWrapper1(void, glwindowpos3ivarb, const GLint *, v); \
HookWrapper3(void, glwindowpos3sarb, GLshort, x, GLshort, y, GLshort, z); \
HookWrapper1(void, glwindowpos3svarb, const GLshort *, v); \
HookWrapper0(void, glblendbarrierkhr); \
HookWrapper2(void, glmultitexcoord1boes, GLenum, texture, GLbyte, s); \
HookWrapper2(void, glmultitexcoord1bvoes, GLenum, texture, const GLbyte *, coords); \
HookWrapper3(void, glmultitexcoord2boes, GLenum, texture, GLbyte, s, GLbyte, t); \
@@ -3743,7 +3744,6 @@
HandleUnsupported(PFNGLWINDOWPOS3IVARBPROC, glwindowpos3ivarb); \
HandleUnsupported(PFNGLWINDOWPOS3SARBPROC, glwindowpos3sarb); \
HandleUnsupported(PFNGLWINDOWPOS3SVARBPROC, glwindowpos3svarb); \
HandleUnsupported(PFNGLBLENDBARRIERKHRPROC, glblendbarrierkhr); \
HandleUnsupported(PFNGLMULTITEXCOORD1BOESPROC, glmultitexcoord1boes); \
HandleUnsupported(PFNGLMULTITEXCOORD1BVOESPROC, glmultitexcoord1bvoes); \
HandleUnsupported(PFNGLMULTITEXCOORD2BOESPROC, glmultitexcoord2boes); \
+15
View File
@@ -76,12 +76,21 @@ void GLRenderState::FetchState(void *ctx, WrappedOpenGL *gl)
eGL_SAMPLE_MASK,
eGL_STENCIL_TEST,
eGL_TEXTURE_CUBE_MAP_SEAMLESS,
eGL_BLEND_ADVANCED_COHERENT_KHR,
};
RDCCOMPILE_ASSERT(ARRAY_COUNT(pnames) == eEnabled_Count, "Wrong number of pnames");
for(GLuint i=0; i < eEnabled_Count; i++)
{
if(pnames[i] == eGL_BLEND_ADVANCED_COHERENT_KHR && !ExtensionSupported[ExtensionSupported_KHR_blend_equation_advanced_coherent])
{
Enabled[i] = true;
continue;
}
Enabled[i] = (m_Real->glIsEnabled(pnames[i]) == GL_TRUE);
}
}
m_Real->glGetIntegerv(eGL_ACTIVE_TEXTURE, (GLint *)&ActiveTexture);
@@ -340,12 +349,18 @@ void GLRenderState::ApplyState(void *ctx, WrappedOpenGL *gl)
eGL_SAMPLE_MASK,
eGL_STENCIL_TEST,
eGL_TEXTURE_CUBE_MAP_SEAMLESS,
eGL_BLEND_ADVANCED_COHERENT_KHR,
};
RDCCOMPILE_ASSERT(ARRAY_COUNT(pnames) == eEnabled_Count, "Wrong number of pnames");
for(GLuint i=0; i < eEnabled_Count; i++)
{
if(pnames[i] == eGL_BLEND_ADVANCED_COHERENT_KHR && !ExtensionSupported[ExtensionSupported_KHR_blend_equation_advanced_coherent])
continue;
if(Enabled[i]) m_Real->glEnable(pnames[i]); else m_Real->glDisable(pnames[i]);
}
}
for(GLuint i=0; i < (GLuint)ARRAY_COUNT(Tex2D); i++)
+1
View File
@@ -75,6 +75,7 @@ struct GLRenderState
//eEnabled_ScissorTest, handled below with scissor values
eEnabled_StencilTest,
eEnabled_TexCubeSeamless,
eEnabled_BlendCoherent,
eEnabled_Count,
};
@@ -269,6 +269,27 @@ void WrappedOpenGL::glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum
}
}
bool WrappedOpenGL::Serialise_glBlendBarrierKHR()
{
if(m_State <= EXECUTING)
m_Real.glBlendBarrierKHR();
return true;
}
void WrappedOpenGL::glBlendBarrierKHR()
{
m_Real.glBlendBarrierKHR();
if(m_State == WRITING_CAPFRAME)
{
SCOPED_SERIALISE_CONTEXT(BLEND_BARRIER);
Serialise_glBlendBarrierKHR();
m_ContextRecord->AddChunk(scope.Get());
}
}
bool WrappedOpenGL::Serialise_glLogicOp(GLenum opcode)
{
SERIALISE_ELEMENT(GLenum, Op, opcode);