Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: cc/gl_renderer.cc

Issue 11506019: Moves sampler binding from init to draw time during batched drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/gl_renderer_draw_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/gl_renderer.cc
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index a40dd3a245b80e384bea0d7cce273d2d441ff6ba..7e997f49bcb32adaee851b0abd8ab390092371e2 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();
}
« no previous file with comments | « no previous file | cc/gl_renderer_draw_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698