From 86c66d6f5a630ae29e24d85b2e918fa35b2b41a4 Mon Sep 17 00:00:00 2001 From: Dan Glastonbury Date: Tue, 23 Sep 2014 15:38:01 +1000 Subject: [PATCH] Bug 1048745 - WebGL2 - GL symbols for VertexAttribI.; r=jgilbert --HG-- extra : rebase_source : 57ceb97a1f21c85427c8108ea7ff41f93fe24789 extra : source : 0d1c61620e601c851f61cd062e42204c2e50e3e0 --- gfx/gl/GLContext.cpp | 22 +++++++++++++++++ gfx/gl/GLContext.h | 47 ++++++++++++++++++++++++++++++++++-- gfx/gl/GLContextFeatures.cpp | 8 ++++++ gfx/gl/GLContextSymbols.h | 12 +++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp index 41b21e2fd082..166ecc52a0d6 100644 --- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -1112,6 +1112,28 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl) } } + if (IsSupported(GLFeature::integer_vertex_attribs)) { + SymLoadStruct integerVASymbols[] = { + { (PRFuncPtr*) &mSymbols.fVertexAttribI4i, { "VertexAttribI4i", nullptr } }, + { (PRFuncPtr*) &mSymbols.fVertexAttribI4iv, { "VertexAttribI4iv", nullptr } }, + { (PRFuncPtr*) &mSymbols.fVertexAttribI4ui, { "VertexAttribI4ui", nullptr } }, + { (PRFuncPtr*) &mSymbols.fVertexAttribI4uiv, { "VertexAttribI4uiv", nullptr } }, + { (PRFuncPtr*) &mSymbols.fVertexAttribIPointer, { "VertexAttribIPointer", nullptr } }, + { nullptr, { nullptr } } + }; + + if (!LoadSymbols(integerVASymbols, trygl, prefix)) { + NS_ERROR("GL supports integer vertex attribs without supplying its functions."); + + MarkUnsupported(GLFeature::integer_vertex_attribs); + mSymbols.fVertexAttribI4i = nullptr; + mSymbols.fVertexAttribI4iv = nullptr; + mSymbols.fVertexAttribI4ui = nullptr; + mSymbols.fVertexAttribI4uiv = nullptr; + mSymbols.fVertexAttribIPointer = nullptr; + } + } + if (IsSupported(GLFeature::map_buffer_range)) { SymLoadStruct mapBufferRangeSymbols[] = { { (PRFuncPtr*) &mSymbols.fMapBufferRange, { "MapBufferRange", nullptr } }, diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index d8637afc286d..9a47c972f678 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -97,6 +97,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature) get_query_object_iv, instanced_arrays, instanced_non_arrays, + integer_vertex_attribs, map_buffer_range, occlusion_query, occlusion_query_boolean, @@ -1978,6 +1979,46 @@ public: AFTER_GL_CALL; } + void fVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) + { + BEFORE_GL_CALL; + ASSERT_SYMBOL_PRESENT(fVertexAttribI4i); + mSymbols.fVertexAttribI4i(index, x, y, z, w); + AFTER_GL_CALL; + } + + void fVertexAttribI4iv(GLuint index, const GLint* v) + { + BEFORE_GL_CALL; + ASSERT_SYMBOL_PRESENT(fVertexAttribI4iv); + mSymbols.fVertexAttribI4iv(index, v); + AFTER_GL_CALL; + } + + void fVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) + { + BEFORE_GL_CALL; + ASSERT_SYMBOL_PRESENT(fVertexAttribI4ui); + mSymbols.fVertexAttribI4ui(index, x, y, z, w); + AFTER_GL_CALL; + } + + void fVertexAttribI4uiv(GLuint index, const GLuint* v) + { + BEFORE_GL_CALL; + ASSERT_SYMBOL_PRESENT(fVertexAttribI4uiv); + mSymbols.fVertexAttribI4uiv(index, v); + AFTER_GL_CALL; + } + + void fVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* offset) + { + BEFORE_GL_CALL; + ASSERT_SYMBOL_PRESENT(fVertexAttribIPointer); + mSymbols.fVertexAttribIPointer(index, size, type, stride, offset); + AFTER_GL_CALL; + } + void fCompileShader(GLuint shader) { BEFORE_GL_CALL; mSymbols.fCompileShader(shader); @@ -1985,13 +2026,15 @@ public: } private: - void raw_fCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + void raw_fCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) + { BEFORE_GL_CALL; mSymbols.fCopyTexImage2D(target, level, internalformat, x, y, width, height, border); AFTER_GL_CALL; } - void raw_fCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + void raw_fCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) + { BEFORE_GL_CALL; mSymbols.fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); AFTER_GL_CALL; diff --git a/gfx/gl/GLContextFeatures.cpp b/gfx/gl/GLContextFeatures.cpp index b8c5668c5075..b28c3fa9d922 100644 --- a/gfx/gl/GLContextFeatures.cpp +++ b/gfx/gl/GLContextFeatures.cpp @@ -259,6 +259,14 @@ static const FeatureInfo sFeatureInfoArr[] = { * has no such restriction. */ }, + { + "integer_vertex_attribs", + 300, // OpenGL version + 300, // OpenGL ES version + { + GLContext::Extensions_End + } + }, { "map_buffer_range", 300, // OpenGL version diff --git a/gfx/gl/GLContextSymbols.h b/gfx/gl/GLContextSymbols.h index db55a570fcab..3ef0c0229c6e 100644 --- a/gfx/gl/GLContextSymbols.h +++ b/gfx/gl/GLContextSymbols.h @@ -602,6 +602,18 @@ struct GLContextSymbols PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC fGetActiveUniformBlockName; typedef void (GLAPIENTRY * PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); PFNGLUNIFORMBLOCKBINDINGPROC fUniformBlockBinding; + + // vertex attrib - integer + typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); + PFNGLVERTEXATTRIBI4IPROC fVertexAttribI4i; + typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint* v); + PFNGLVERTEXATTRIBI4IVPROC fVertexAttribI4iv; + typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); + PFNGLVERTEXATTRIBI4UIPROC fVertexAttribI4ui; + typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint* v); + PFNGLVERTEXATTRIBI4UIVPROC fVertexAttribI4uiv; + typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* ptr); + PFNGLVERTEXATTRIBIPOINTERPROC fVertexAttribIPointer; }; }