Bug 1048724 - WebGL2 - GL symbols for Transform Feedback.; r=jgilbert

--HG--
extra : rebase_source : f47b2a8203b0dc23dd871987c2b2f7dae28b2723
extra : source : a0ecb0468b8a2998b676da63678938d9f9d58f52
This commit is contained in:
Dan Glastonbury 2014-09-23 15:47:28 +10:00
parent 423c48f63d
commit 41848793bf
5 changed files with 96 additions and 18 deletions

View File

@ -75,7 +75,7 @@ WebGLContext::InitWebGL2()
};
const GLFeature sFeatureRequiredArr[] = {
GLFeature::instanced_non_arrays,
GLFeature::transform_feedback
GLFeature::transform_feedback2
};
// check WebGL extensions that are supposed to be natively supported

View File

@ -94,6 +94,7 @@ static const char *sExtensionNames[] = {
"GL_ARB_texture_float",
"GL_ARB_texture_non_power_of_two",
"GL_ARB_texture_rectangle",
"GL_ARB_transform_feedback2",
"GL_ARB_uniform_buffer_object",
"GL_ARB_vertex_array_object",
"GL_EXT_bgra",
@ -131,6 +132,7 @@ static const char *sExtensionNames[] = {
"GL_NV_half_float",
"GL_NV_instanced_arrays",
"GL_NV_transform_feedback",
"GL_NV_transform_feedback2",
"GL_OES_EGL_image",
"GL_OES_EGL_image_external",
"GL_OES_EGL_sync",
@ -924,14 +926,23 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsSupported(GLFeature::transform_feedback)) {
// ARB_transform_feedback2/NV_transform_feedback2 is a
// superset of EXT_transform_feedback/NV_transform_feedback
// and adds glPauseTransformFeedback &
// glResumeTransformFeedback, which are required for WebGL2.
if (IsSupported(GLFeature::transform_feedback2)) {
SymLoadStruct coreSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBindBufferBase, { "BindBufferBase", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindBufferRange, { "BindBufferRange", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenTransformFeedbacks, { "GenTransformFeedbacks", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteTransformFeedbacks, { "DeleteTransformFeedbacks", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsTransformFeedback, { "IsTransformFeedback", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBeginTransformFeedback, { "BeginTransformFeedback", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEndTransformFeedback, { "EndTransformFeedback", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTransformFeedbackVaryings, { "TransformFeedbackVaryings", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTransformFeedbackVarying, { "GetTransformFeedbackVarying", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPauseTransformFeedback, { "PauseTransformFeedback", nullptr } },
{ (PRFuncPtr*) &mSymbols.fResumeTransformFeedback, { "ResumeTransformFeedback", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetIntegeri_v, { "GetIntegeri_v", nullptr } },
END_SYMBOLS
};
@ -939,20 +950,25 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
SymLoadStruct extSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBindBufferBase, { "BindBufferBaseEXT", "BindBufferBaseNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindBufferRange, { "BindBufferRangeEXT", "BindBufferRangeNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenTransformFeedbacks, { "GenTransformFeedbacksNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteTransformFeedbacks, { "DeleteTransformFeedbacksNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsTransformFeedback, { "IsTransformFeedbackNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBeginTransformFeedback, { "BeginTransformFeedbackEXT", "BeginTransformFeedbackNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEndTransformFeedback, { "EndTransformFeedbackEXT", "EndTransformFeedbackNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTransformFeedbackVaryings, { "TransformFeedbackVaryingsEXT", "TransformFeedbackVaryingsNV", nullptr }},
{ (PRFuncPtr*) &mSymbols.fTransformFeedbackVaryings, { "TransformFeedbackVaryingsEXT", "TransformFeedbackVaryingsNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTransformFeedbackVarying, { "GetTransformFeedbackVaryingEXT", "GetTransformFeedbackVaryingNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPauseTransformFeedback, { "PauseTransformFeedbackNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fResumeTransformFeedback, { "ResumeTransformFeedbackNV", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetIntegeri_v, { "GetIntegerIndexedvEXT", "GetIntegerIndexedvNV", nullptr } },
END_SYMBOLS
};
bool useCore = IsFeatureProvidedByCoreSymbols(GLFeature::transform_feedback);
bool useCore = IsFeatureProvidedByCoreSymbols(GLFeature::transform_feedback2);
if (!LoadSymbols(useCore ? coreSymbols : extSymbols, trygl, prefix)) {
NS_ERROR("GL supports transform feedback without supplying its functions.");
MarkUnsupported(GLFeature::transform_feedback);
MarkUnsupported(GLFeature::transform_feedback2);
MarkUnsupported(GLFeature::bind_buffer_offset);
ClearSymbols(coreSymbols);
}

View File

@ -115,7 +115,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
texture_half_float,
texture_half_float_linear,
texture_non_power_of_two,
transform_feedback,
transform_feedback2,
uniform_buffer_object,
uniform_matrix_nonsquare,
vertex_array_object,
@ -370,6 +370,7 @@ public:
ARB_texture_float,
ARB_texture_non_power_of_two,
ARB_texture_rectangle,
ARB_transform_feedback2,
ARB_uniform_buffer_object,
ARB_vertex_array_object,
EXT_bgra,
@ -407,6 +408,7 @@ public:
NV_half_float,
NV_instanced_arrays,
NV_transform_feedback,
NV_transform_feedback2,
OES_EGL_image,
OES_EGL_image_external,
OES_EGL_sync,
@ -2670,7 +2672,7 @@ public:
// -----------------------------------------------------------------------------
// Package XXX_transform_feedback
// GL 4.0, GL ES 3.0, ARB_transform_feedback2, NV_transform_feedback2
public:
void fBindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
@ -2688,6 +2690,39 @@ public:
AFTER_GL_CALL;
}
void fGenTransformFeedbacks(GLsizei n, GLuint* ids)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGenTransformFeedbacks);
mSymbols.fGenTransformFeedbacks(n, ids);
AFTER_GL_CALL;
}
void fDeleteTransformFeedbacks(GLsizei n, GLuint* ids)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteTransformFeedbacks);
mSymbols.fDeleteTransformFeedbacks(n, ids);
AFTER_GL_CALL;
}
realGLboolean fIsTransformFeedback(GLuint id)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsTransformFeedback);
realGLboolean result = mSymbols.fIsTransformFeedback(id);
AFTER_GL_CALL;
return result;
}
void fBindTransformFeedback(GLenum target, GLuint id)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fBindTransformFeedback);
mSymbols.fBindTransformFeedback(target, id);
AFTER_GL_CALL;
}
void fBeginTransformFeedback(GLenum primitiveMode)
{
BEFORE_GL_CALL;
@ -2720,6 +2755,22 @@ public:
AFTER_GL_CALL;
}
void fPauseTransformFeedback()
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fPauseTransformFeedback);
mSymbols.fPauseTransformFeedback();
AFTER_GL_CALL;
}
void fResumeTransformFeedback()
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fResumeTransformFeedback);
mSymbols.fResumeTransformFeedback();
AFTER_GL_CALL;
}
void fGetIntegeri_v(GLenum param, GLuint index, GLint* values)
{
BEFORE_GL_CALL;

View File

@ -57,7 +57,7 @@ static const FeatureInfo sFeatureInfoArr[] = {
{
GLContext::EXT_transform_feedback,
GLContext::NV_transform_feedback,
GLContext::NV_transform_feedback2,
GLContext::Extensions_End
}
},
@ -476,13 +476,13 @@ static const FeatureInfo sFeatureInfoArr[] = {
}
},
{
"transform_feedback",
300, // OpenGL version
"transform_feedback2",
400, // OpenGL version
300, // OpenGL ES version
GLContext::Extension_None,
{
GLContext::EXT_transform_feedback,
GLContext::NV_transform_feedback,
GLContext::ARB_transform_feedback2,
GLContext::NV_transform_feedback2,
GLContext::Extensions_End
}
},

View File

@ -474,21 +474,32 @@ struct GLContextSymbols
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISOR) (GLuint index, GLuint divisor);
PFNGLVERTEXATTRIBDIVISOR fVertexAttribDivisor;
// EXT_transform_feedback / OpenGL (ES) 3.0
// ARB_transform_feedback2 / OpenGL 4.0 / OpenGL ES 3.0
typedef void (GLAPIENTRY * PFNGLBINDBUFFERBASE) (GLenum target, GLuint index, GLuint buffer);
PFNGLBINDBUFFERBASE fBindBufferBase;
typedef void (GLAPIENTRY * PFNGLBINDBUFFERRANGE) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
PFNGLBINDBUFFERRANGE fBindBufferRange;
typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACK) (GLenum primitiveMode);
PFNGLBEGINTRANSFORMFEEDBACK fBeginTransformFeedback;
typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACK) (void);
PFNGLENDTRANSFORMFEEDBACK fEndTransformFeedback;
typedef void (GLAPIENTRY * PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);
PFNGLGENTRANSFORMFEEDBACKSPROC fGenTransformFeedbacks;
typedef void (GLAPIENTRY * PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint* ids);
PFNGLDELETETRANSFORMFEEDBACKSPROC fDeleteTransformFeedbacks;
typedef realGLboolean (GLAPIENTRY * PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
PFNGLISTRANSFORMFEEDBACKPROC fIsTransformFeedback;
typedef void (GLAPIENTRY * PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
PFNGLBINDTRANSFORMFEEDBACKPROC fBindTransformFeedback;
typedef void (GLAPIENTRY * PFNGLTRANSFORMFEEDBACKVARYINGS) (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
PFNGLTRANSFORMFEEDBACKVARYINGS fTransformFeedbackVaryings;
typedef void (GLAPIENTRY * PFNGLGETTRANSFORMFEEDBACKVARYING) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
PFNGLGETTRANSFORMFEEDBACKVARYING fGetTransformFeedbackVarying;
typedef void (GLAPIENTRY * PFNGLBEGINTRANSFORMFEEDBACK) (GLenum primitiveMode);
PFNGLBEGINTRANSFORMFEEDBACK fBeginTransformFeedback;
typedef void (GLAPIENTRY * PFNGLENDTRANSFORMFEEDBACK) (void);
PFNGLENDTRANSFORMFEEDBACK fEndTransformFeedback;
typedef void (GLAPIENTRY * PFNGLPAUSETRANSFORMFEEDBACKPROC) ();
PFNGLPAUSETRANSFORMFEEDBACKPROC fPauseTransformFeedback;
typedef void (GLAPIENTRY * PFNGLRESUMETRANSFORMFEEDBACKPROC) ();
PFNGLRESUMETRANSFORMFEEDBACKPROC fResumeTransformFeedback;
typedef void (GLAPIENTRY * PFNGLGETINTEGERI_V) (GLenum param, GLuint index, GLint* values);
PFNGLGETINTEGERI_V fGetIntegeri_v;