Bug 1250710 - Remove packAlign save/restore from ScopedGLDrawState. - r=jrmuizel draft
authorJeff Gilbert <jgilbert@mozilla.com>
Tue, 14 Jun 2016 10:08:59 -0700
changeset 383811 82cd7adbb8062bcb863fb665b18b280ea7cb565e
parent 383810 358802d5fce990bddd8eef3fbd0b6c173f706ea1
child 383812 d0dac84f683f895eabc870cca2f07562ac2b5463
push id22101
push userbmo:jgilbert@mozilla.com
push dateTue, 05 Jul 2016 04:23:13 +0000
reviewersjrmuizel
bugs1250710
milestone50.0a1
Bug 1250710 - Remove packAlign save/restore from ScopedGLDrawState. - r=jrmuizel MozReview-Commit-ID: CESZzSfHbFj
gfx/gl/ScopedGLHelpers.cpp
gfx/gl/ScopedGLHelpers.h
--- a/gfx/gl/ScopedGLHelpers.cpp
+++ b/gfx/gl/ScopedGLHelpers.cpp
@@ -429,25 +429,23 @@ ScopedGLDrawState::ScopedGLDrawState(GLC
     , depthTest   (aGL, LOCAL_GL_DEPTH_TEST, false)
     , dither      (aGL, LOCAL_GL_DITHER,     false)
     , polyOffsFill(aGL, LOCAL_GL_POLYGON_OFFSET_FILL,      false)
     , sampleAToC  (aGL, LOCAL_GL_SAMPLE_ALPHA_TO_COVERAGE, false)
     , sampleCover (aGL, LOCAL_GL_SAMPLE_COVERAGE, false)
     , scissor     (aGL, LOCAL_GL_SCISSOR_TEST,    false)
     , stencil     (aGL, LOCAL_GL_STENCIL_TEST,    false)
     , mGL(aGL)
-    , packAlign(4)
 {
-    mGL->GetUIntegerv(LOCAL_GL_UNPACK_ALIGNMENT, &packAlign);
     mGL->GetUIntegerv(LOCAL_GL_CURRENT_PROGRAM, &boundProgram);
     mGL->GetUIntegerv(LOCAL_GL_ARRAY_BUFFER_BINDING, &boundBuffer);
     mGL->GetUIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &maxAttrib);
     attrib_enabled = MakeUnique<GLint[]>(maxAttrib);
 
-    for (unsigned int i = 0; i < maxAttrib; i++) {
+    for (GLuint i = 0; i < maxAttrib; i++) {
         mGL->fGetVertexAttribiv(i, LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED, &attrib_enabled[i]);
         mGL->fDisableVertexAttribArray(i);
     }
     // Only Attrib0's client side state affected
     mGL->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE, &attrib0_size);
     mGL->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE, &attrib0_stride);
     mGL->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE, &attrib0_type);
     mGL->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &attrib0_normalized);
@@ -468,18 +466,16 @@ ScopedGLDrawState::~ScopedGLDrawState()
     mGL->fViewport(viewport[0], viewport[1],
                    viewport[2], viewport[3]);
 
     mGL->fColorMask(colorMask[0],
                     colorMask[1],
                     colorMask[2],
                     colorMask[3]);
 
-    mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, packAlign);
-
     for (unsigned int i = 0; i < maxAttrib; i++) {
         if (attrib_enabled[i])
             mGL->fEnableVertexAttribArray(i);
         else
             mGL->fDisableVertexAttribArray(i);
     }
 
 
--- a/gfx/gl/ScopedGLHelpers.h
+++ b/gfx/gl/ScopedGLHelpers.h
@@ -304,17 +304,18 @@ public:
                               GLsizei stride, GLuint buffer, const GLvoid* pointer);
     explicit ScopedVertexAttribPointer(GLContext* aGL, GLuint index);
 
 protected:
     void WrapImpl(GLuint index);
     void UnwrapImpl();
 };
 
-struct ScopedGLDrawState {
+struct ScopedGLDrawState
+{
     explicit ScopedGLDrawState(GLContext* gl);
     ~ScopedGLDrawState();
 
     GLuint boundProgram;
     GLuint boundBuffer;
 
     ScopedGLState blend;
     ScopedGLState cullFace;
@@ -334,17 +335,16 @@ struct ScopedGLDrawState {
     GLint attrib0_normalized;
     GLint attrib0_bufferBinding;
     void* attrib0_pointer;
 
     realGLboolean colorMask[4];
     GLint viewport[4];
     GLint scissorBox[4];
     GLContext* const mGL;
-    GLuint packAlign;
 };
 
 struct ScopedPackState
     : public ScopedGLWrapper<ScopedPackState>
 {
     friend struct ScopedGLWrapper<ScopedPackState>;
 
 protected: