Bug 1016086 - Part 4: Setup attribute configuration when we start compositing instead of for every draw command (r=Bas)

This commit is contained in:
Andreas Gal 2014-06-01 10:44:42 -07:00
Родитель 1ea7cf9b40
Коммит 1d8c6b36e5
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -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);