diff options
author | whunt@chromium.org <whunt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 19:16:15 +0000 |
---|---|---|
committer | whunt@chromium.org <whunt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 19:16:15 +0000 |
commit | ac33422c078be463011cfccb013de52d906c189e (patch) | |
tree | 75649c9bc215e3d3779b897adf0ec2c9d7bd3b0e | |
parent | 0fb4c098a531352cf9749090c123340bdce388bf (diff) | |
download | chromium_src-ac33422c078be463011cfccb013de52d906c189e.zip chromium_src-ac33422c078be463011cfccb013de52d906c189e.tar.gz chromium_src-ac33422c078be463011cfccb013de52d906c189e.tar.bz2 |
Moves sampler binding from init to draw time during batched drawing.
Removes the bindings to uniforms from initalization time to draw time
for batched drawing.
BUG=164540
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11506019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172916 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/gl_renderer.cc | 6 | ||||
-rw-r--r-- | cc/gl_renderer_draw_cache.h | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index 384e443..ad26183 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -985,6 +985,9 @@ void GLRenderer::flushTextureQuadCache() // Bind the program to the GL state. setUseProgram(m_drawCache.program_id); + // Bind the correct texture sampler location. + GLC(context(), context()->uniform1i(m_drawCache.sampler_location, 0)); + // Assume the current active textures is 0. ResourceProvider::ScopedReadLockGL lockedQuad(m_resourceProvider, m_drawCache.resource_id); GLC(context(), context()->bindTexture(GL_TEXTURE_2D, lockedQuad.textureId())); @@ -1052,6 +1055,7 @@ void GLRenderer::enqueueTextureQuad(const DrawingFrame& frame, const TextureDraw m_drawCache.alpha_location = binding.alphaLocation; m_drawCache.uv_xform_location = binding.texTransformLocation; m_drawCache.matrix_location = binding.matrixLocation; + m_drawCache.sampler_location = binding.samplerLocation; } // Generate the uv-transform @@ -1646,7 +1650,6 @@ const GLRenderer::TextureProgram* GLRenderer::textureProgram() if (!m_textureProgram->initialized()) { TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); m_textureProgram->initialize(m_context, m_isUsingBindUniform); - GLC(context(), context()->uniform1i(m_textureProgram.get()->fragmentShader().samplerLocation(), 0)); } return m_textureProgram.get(); } @@ -1658,7 +1661,6 @@ const GLRenderer::TextureProgramFlip* GLRenderer::textureProgramFlip() if (!m_textureProgramFlip->initialized()) { TRACE_EVENT0("cc", "GLRenderer::textureProgramFlip::initialize"); m_textureProgramFlip->initialize(m_context, m_isUsingBindUniform); - GLC(context(), context()->uniform1i(m_textureProgramFlip.get()->fragmentShader().samplerLocation(), 0)); } return m_textureProgramFlip.get(); } diff --git a/cc/gl_renderer_draw_cache.h b/cc/gl_renderer_draw_cache.h index c0a2b69..4ba4c65 100644 --- a/cc/gl_renderer_draw_cache.h +++ b/cc/gl_renderer_draw_cache.h @@ -32,6 +32,7 @@ struct TexturedQuadDrawCache { int alpha_location; int uv_xform_location; int matrix_location; + int sampler_location; // A cache for the coalesced quad data. std::vector<Float4> uv_xform_data; |