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

Unified Diff: cc/output/gl_renderer.cc

Issue 375303002: cc: Refactor ResourceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing typing error in build.gn Created 6 years, 5 months 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 | « cc/cc.gyp ('k') | cc/resources/gpu_raster_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index d249a2f472054b60ac0151cc12d55f93c1e7e43f..7123edf5b850cf2711116023d392c0be92a6fe2f 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -181,6 +181,12 @@ const size_t kMaxPendingSyncQueries = 16;
} // anonymous namespace
+static GLint GetActiveTextureUnit(GLES2Interface* gl) {
+ GLint active_unit = 0;
+ gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
+ return active_unit;
+}
+
class GLRenderer::ScopedUseGrContext {
public:
static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer,
@@ -1066,7 +1072,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
if (filter_bitmap.getTexture()) {
GrTexture* texture =
reinterpret_cast<GrTexture*>(filter_bitmap.getTexture());
- DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
+ DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle());
} else {
contents_resource_lock =
@@ -1854,7 +1860,7 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame,
ResourceProvider::ScopedReadLockGL lock(resource_provider_,
quad->resource_id);
- DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
+ DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()));
GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0));
@@ -1964,7 +1970,7 @@ void GLRenderer::FlushTextureQuadCache() {
// Assume the current active textures is 0.
ResourceProvider::ScopedReadLockGL locked_quad(resource_provider_,
draw_cache_.resource_id);
- DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
+ DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id()));
COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed);
@@ -2113,7 +2119,7 @@ void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame,
ResourceProvider::ScopedReadLockGL lock(resource_provider_,
quad->io_surface_resource_id);
- DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
+ DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, lock.texture_id()));
DrawQuadGeometry(
@@ -2266,7 +2272,7 @@ void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame,
}
SetShaderOpacity(1.f, program->fragment_shader().alpha_location());
- DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
+ DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, texture_id));
DrawQuadGeometry(
frame, draw_matrix, rect, program->vertex_shader().matrix_location());
« no previous file with comments | « cc/cc.gyp ('k') | cc/resources/gpu_raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698