Bug 1048741 - WebGL2 - GL symbols for texture storage.; r=jgilbert

--HG--
extra : rebase_source : 4465ba102179f3ae338f19632d77547686df0220
This commit is contained in:
Dan Glastonbury 2014-09-23 15:49:19 +10:00
parent 4990473894
commit 7d49107084
4 changed files with 61 additions and 0 deletions

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_texture_storage",
"GL_ARB_transform_feedback2",
"GL_ARB_uniform_buffer_object",
"GL_ARB_vertex_array_object",
@ -121,6 +122,7 @@ static const char *sExtensionNames[] = {
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_texture_format_BGRA8888",
"GL_EXT_texture_sRGB",
"GL_EXT_texture_storage",
"GL_EXT_transform_feedback",
"GL_EXT_unpack_subimage",
"GL_IMG_read_format",
@ -926,6 +928,29 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsSupported(GLFeature::texture_storage)) {
SymLoadStruct coreSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fTexStorage2D, { "TexStorage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexStorage3D, { "TexStorage3D", nullptr } },
END_SYMBOLS
};
SymLoadStruct extSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fTexStorage2D, { "TexStorage2DEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexStorage3D, { "TexStorage3DEXT", nullptr } },
END_SYMBOLS
};
bool useCore = IsFeatureProvidedByCoreSymbols(GLFeature::texture_storage);
if (!LoadSymbols(useCore ? coreSymbols : extSymbols, trygl, prefix)) {
NS_ERROR("GL supports texture storage without supplying its functions.");
MarkUnsupported(GLFeature::texture_storage);
MarkExtensionSupported(useCore ? ARB_texture_storage : EXT_texture_storage);
ClearSymbols(coreSymbols);
}
}
// ARB_transform_feedback2/NV_transform_feedback2 is a
// superset of EXT_transform_feedback/NV_transform_feedback
// and adds glPauseTransformFeedback &

View File

@ -115,6 +115,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
texture_half_float,
texture_half_float_linear,
texture_non_power_of_two,
texture_storage,
transform_feedback2,
uniform_buffer_object,
uniform_matrix_nonsquare,
@ -370,6 +371,7 @@ public:
ARB_texture_float,
ARB_texture_non_power_of_two,
ARB_texture_rectangle,
ARB_texture_storage,
ARB_transform_feedback2,
ARB_uniform_buffer_object,
ARB_vertex_array_object,
@ -397,6 +399,7 @@ public:
EXT_texture_filter_anisotropic,
EXT_texture_format_BGRA8888,
EXT_texture_sRGB,
EXT_texture_storage,
EXT_transform_feedback,
EXT_unpack_subimage,
IMG_read_format,
@ -3059,6 +3062,23 @@ public:
AFTER_GL_CALL;
}
// -----------------------------------------------------------------------------
// Core GL 4.2, GL ES 3.0 & Extension ARB_texture_storage/EXT_texture_storage
void fTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fTexStorage2D);
mSymbols.fTexStorage2D(target, levels, internalformat, width, height);
AFTER_GL_CALL;
}
void fTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fTexStorage3D);
mSymbols.fTexStorage3D(target, levels, internalformat, width, height, depth);
AFTER_GL_CALL;
}
// -----------------------------------------------------------------------------
// Constructor

View File

@ -475,6 +475,16 @@ static const FeatureInfo sFeatureInfoArr[] = {
GLContext::Extensions_End
}
},
{
"texture_storage",
420, // OpenGL version
300, // OpenGL ES version
GLContext::ARB_texture_storage,
{
GLContext::EXT_texture_storage,
GLContext::Extensions_End
}
},
{
"transform_feedback2",
400, // OpenGL version

View File

@ -580,6 +580,12 @@ struct GLContextSymbols
typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
PFNGLGETSAMPLERPARAMETERFVPROC fGetSamplerParameterfv;
// texture_storage
typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
PFNGLTEXSTORAGE2DPROC fTexStorage2D;
typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
PFNGLTEXSTORAGE3DPROC fTexStorage3D;
// uniform_buffer_object
typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount,
const GLchar* const* uniformNames, GLuint* uniformIndices);