From 1d8c6b36e5bbfd0f5bf1b27c2514575e87556151 Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Sun, 1 Jun 2014 10:44:42 -0700 Subject: [PATCH] Bug 1016086 - Part 4: Setup attribute configuration when we start compositing instead of for every draw command (r=Bas) --- gfx/layers/opengl/CompositorOGL.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index e0a03a838a48..31bfcc2ac07a 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -779,6 +779,16 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion, mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0); mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT); #endif + + // Every shader uses a single attribute that we bind to mQuadVBO, which + // contains the four (0,0)(1,1) quads we set up above. + const GLuint coordAttribIndex = 0; + + mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mQuadVBO); + mGLContext->fVertexAttribPointer(coordAttribIndex, 4, + LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, + (GLvoid*) 0); + mGLContext->fEnableVertexAttribArray(coordAttribIndex); } void @@ -1523,14 +1533,6 @@ CompositorOGL::BindAndDrawQuads(ShaderProgramOGL *aProg, { NS_ASSERTION(aProg->HasInitialized(), "Shader program not correctly initialized"); - const GLuint coordAttribIndex = 0; - - mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mQuadVBO); - mGLContext->fVertexAttribPointer(coordAttribIndex, 4, - LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, - (GLvoid*) 0); - mGLContext->fEnableVertexAttribArray(coordAttribIndex); - aProg->SetLayerRects(aLayerRects); if (aProg->GetTextureCount() > 0) { aProg->SetTextureRects(aTextureRects);