diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 936ec42f1731..27b527c771b8 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -143,6 +143,7 @@ static const char *sExtensionNames[] = { "GL_OES_compressed_ETC1_RGB8_texture", "GL_EXT_draw_range_elements", "GL_EXT_shader_texture_lod", + "GL_NV_fence", nullptr }; @@ -1075,6 +1076,26 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) } } + if (IsExtensionSupported(NV_fence)) { + SymLoadStruct extSymbols[] = { + { (PRFuncPtr*) &mSymbols.fGenFences, { "GenFencesNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fDeleteFences, { "DeleteFencesNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fSetFence, { "SetFenceNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fTestFence, { "TestFenceNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fFinishFence, { "FinishFenceNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fIsFence, { "IsFenceNV", nullptr } }, + { (PRFuncPtr*) &mSymbols.fGetFenceiv, { "GetFenceivNV", nullptr } }, + END_SYMBOLS + }; + + if (!LoadSymbols(&extSymbols[0], trygl, prefix)) { + NS_ERROR("GL supports NV_fence without supplying its functions."); + + MarkExtensionUnsupported(NV_fence); + ClearSymbols(extSymbols); + } + } + // Load developer symbols, don't fail if we can't find them. SymLoadStruct auxSymbols[] = { { (PRFuncPtr*) &mSymbols.fGetTexImage, { "GetTexImage", nullptr } }, diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index c502386962d4..409c0de84721 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -412,6 +412,7 @@ public: OES_compressed_ETC1_RGB8_texture, EXT_draw_range_elements, EXT_shader_texture_lod, + NV_fence, Extensions_Max, Extensions_End }; @@ -2501,6 +2502,67 @@ public: return ret; } +// ----------------------------------------------------------------------------- +// Extension NV_fence +public: + void fGenFences(GLsizei n, GLuint* fences) + { + ASSERT_SYMBOL_PRESENT(fGenFences); + BEFORE_GL_CALL; + mSymbols.fGenFences(n, fences); + AFTER_GL_CALL; + } + + void fDeleteFences(GLsizei n, const GLuint* fences) + { + ASSERT_SYMBOL_PRESENT(fDeleteFences); + BEFORE_GL_CALL; + mSymbols.fDeleteFences(n, fences); + AFTER_GL_CALL; + } + + void fSetFence(GLuint fence, GLenum condition) + { + ASSERT_SYMBOL_PRESENT(fSetFence); + BEFORE_GL_CALL; + mSymbols.fSetFence(fence, condition); + AFTER_GL_CALL; + } + + realGLboolean fTestFence(GLuint fence) + { + ASSERT_SYMBOL_PRESENT(fTestFence); + BEFORE_GL_CALL; + realGLboolean ret = mSymbols.fTestFence(fence); + AFTER_GL_CALL; + return ret; + } + + void fFinishFence(GLuint fence) + { + ASSERT_SYMBOL_PRESENT(fFinishFence); + BEFORE_GL_CALL; + mSymbols.fFinishFence(fence); + AFTER_GL_CALL; + } + + realGLboolean fIsFence(GLuint fence) + { + ASSERT_SYMBOL_PRESENT(fIsFence); + BEFORE_GL_CALL; + realGLboolean ret = mSymbols.fIsFence(fence); + AFTER_GL_CALL; + return ret; + } + + void fGetFenceiv(GLuint fence, GLenum pname, GLint* params) + { + ASSERT_SYMBOL_PRESENT(fGetFenceiv); + BEFORE_GL_CALL; + mSymbols.fGetFenceiv(fence, pname, params); + AFTER_GL_CALL; + } + // ----------------------------------------------------------------------------- // Constructor diff --git a/gfx/gl/GLContextSymbols.h b/gfx/gl/GLContextSymbols.h index 28d2a679d58b..711704933a3f 100644 --- a/gfx/gl/GLContextSymbols.h +++ b/gfx/gl/GLContextSymbols.h @@ -497,6 +497,22 @@ struct GLContextSymbols // draw_range_elements typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTS) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices); PFNGLDRAWRANGEELEMENTS fDrawRangeElements; + + // NV_fence + typedef void (GLAPIENTRY * pfnGenFencesT) (GLsizei n, GLuint* fences); + pfnGenFencesT fGenFences; + typedef void (GLAPIENTRY * pfnDeleteFencesT) (GLsizei n, const GLuint* fences); + pfnDeleteFencesT fDeleteFences; + typedef void (GLAPIENTRY * pfnSetFenceT) (GLuint fence, GLenum condition); + pfnSetFenceT fSetFence; + typedef realGLboolean (GLAPIENTRY * pfnTestFenceT) (GLuint fence); + pfnTestFenceT fTestFence; + typedef void (GLAPIENTRY * pfnFinishFenceT) (GLuint fence); + pfnFinishFenceT fFinishFence; + typedef realGLboolean (GLAPIENTRY * pfnIsFenceT) (GLuint fence); + pfnIsFenceT fIsFence; + typedef void (GLAPIENTRY * pfnGetFenceivT) (GLuint fence, GLenum pname, GLint* params); + pfnGetFenceivT fGetFenceiv; }; }