Bug 1411626 - Make GLContextSymbols a pure aggregate POD. - r=andi
MozReview-Commit-ID: CFRJqfcdXIJ
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -273,16 +273,17 @@ GLContext::GLContext(CreateContextFlags
mVersion(0),
mProfile(ContextProfile::Unknown),
mShadingLanguageVersion(0),
mVendor(GLVendor::Other),
mRenderer(GLRenderer::Other),
mTopError(LOCAL_GL_NO_ERROR),
mDebugFlags(ChooseDebugFlags(flags)),
mSharedContext(sharedContext),
+ mSymbols{},
mCaps(caps),
mScreen(nullptr),
mLockedSurface(nullptr),
mMaxTextureSize(0),
mMaxCubeMapTextureSize(0),
mMaxTextureImageSize(0),
mMaxRenderbufferSize(0),
mMaxSamples(0),
@@ -343,17 +344,17 @@ GLContext::InitWithPrefix(const char* pr
{
MOZ_RELEASE_ASSERT(!mSymbols.fBindFramebuffer,
"GFX: InitWithPrefix should only be called once.");
ScopedGfxFeatureReporter reporter("GL Context");
if (!InitWithPrefixImpl(prefix, trygl)) {
// If initialization fails, zero the symbols to avoid hard-to-understand bugs.
- mSymbols.Zero();
+ mSymbols = {};
NS_WARNING("GLContext::InitWithPrefix failed!");
return false;
}
reporter.SetSuccessful();
return true;
}
@@ -2135,17 +2136,17 @@ GLContext::MarkDestroyed()
mScreen = nullptr;
mBlitHelper = nullptr;
mReadTexImageHelper = nullptr;
if (!MakeCurrent()) {
NS_WARNING("MakeCurrent() failed during MarkDestroyed! Skipping GL object teardown.");
}
- mSymbols.Zero();
+ mSymbols = {};
}
#ifdef MOZ_GL_DEBUG
/* static */ void
GLContext::AssertNotPassingStackBufferToTheGL(const void* ptr)
{
int somethingOnTheStack;
const void* someStackPtr = &somethingOnTheStack;
--- a/gfx/gl/GLContextSymbols.h
+++ b/gfx/gl/GLContextSymbols.h
@@ -20,25 +20,19 @@
#define GLAPIENTRY
#endif
#define GLAPI
#endif
namespace mozilla {
namespace gl {
-struct GLContextSymbols
+struct GLContextSymbols final
{
- GLContextSymbols() {
- Zero();
- }
-
- void Zero() {
- memset(this, 0, sizeof(GLContextSymbols));
- }
+ GLContextSymbols() = delete; // Initialize with {}.
void (GLAPIENTRY * fActiveTexture)(GLenum);
void (GLAPIENTRY * fAttachShader)(GLuint, GLuint);
void (GLAPIENTRY * fBeginQuery)(GLenum, GLuint);
void (GLAPIENTRY * fBindAttribLocation)(GLuint, GLuint, const GLchar*);
void (GLAPIENTRY * fBindBuffer)(GLenum, GLuint);
void (GLAPIENTRY * fBindTexture)(GLenum, GLuint);
void (GLAPIENTRY * fBindVertexArray)(GLuint);