Chromium Code Reviews| Index: cc/gl_renderer.cc |
| diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc |
| index e8454ccbf19edba2721f2f2b13abc6cf23992a5d..54774f50185d579b5d8551341d0dd0156e588c82 100644 |
| --- a/cc/gl_renderer.cc |
| +++ b/cc/gl_renderer.cc |
| @@ -539,14 +539,11 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua |
| filterBitmap = applyFilters(this, renderPass->filters, contentsTexture, m_client->hasImplThread()); |
| } |
| scoped_ptr<ResourceProvider::ScopedReadLockGL> contentsResourceLock; |
| - unsigned contentsTextureId = 0; |
| if (filterBitmap.getTexture()) { |
| GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTexture()); |
| - contentsTextureId = texture->getTextureHandle(); |
| - } else { |
| - contentsResourceLock = make_scoped_ptr(new ResourceProvider::ScopedReadLockGL(m_resourceProvider, contentsTexture->id())); |
| - contentsTextureId = contentsResourceLock->textureId(); |
| - } |
| + context()->bindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); |
|
jamesr
2012/11/26 06:54:26
you're moving a bind call up here but look at line
|
| + } else |
| + contentsResourceLock = make_scoped_ptr(new ResourceProvider::ScopedSamplerGL(m_resourceProvider, contentsTexture->id(), GL_TEXTURE_2D)); |
| // Draw the background texture if there is one. |
| if (backgroundTexture) { |
| @@ -577,8 +574,6 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua |
| // FIXME: use the backgroundTexture and blend the background in with this draw instead of having a separate copy of the background texture. |
| - context()->bindTexture(GL_TEXTURE_2D, contentsTextureId); |
| - |
| int shaderQuadLocation = -1; |
| int shaderEdgeLocation = -1; |
| int shaderMaskSamplerLocation = -1; |
| @@ -633,7 +628,7 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua |
| GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); |
| GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, quad->mask_tex_coord_scale_x, quad->mask_tex_coord_scale_y)); |
| GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, quad->mask_tex_coord_offset_x, quad->mask_tex_coord_offset_y)); |
| - context()->bindTexture(GL_TEXTURE_2D, maskTextureId); |
| + m_resourceProvider->bindForSampling(quad->mask_resource_id, GL_TEXTURE_2D); |
| GLC(context(), context()->activeTexture(GL_TEXTURE0)); |
| } |
| @@ -781,8 +776,8 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua |
| GLC(context(), context()->useProgram(uniforms.program)); |
| GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); |
| - ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resource_id); |
| - GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); |
| + GLenum filter = (quad->IsAntialiased() || texToGeomScaleX != 1 || texToGeomScaleY != 1 || !quad->quadTransform().isIntegerTranslation()) ? GL_LINEAR : GL_NEAREST; |
|
jamesr
2012/11/26 06:54:26
this line is crazy long - can you break it up a bi
Sami
2012/11/30 17:49:27
Agreed, this is long even for WebKit standards. I'
|
| + ResourceProvider::ScopedSamplerGL quadResourceLock(m_resourceProvider, quad->resource_id, GL_TEXTURE_2D, filter, filter); |
| bool useAA = !clipped && quad->IsAntialiased(); |
| if (useAA) { |
| @@ -886,15 +881,12 @@ void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQ |
| const VideoLayerImpl::FramePlane& uPlane = quad->u_plane; |
| const VideoLayerImpl::FramePlane& vPlane = quad->v_plane; |
| - ResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.resourceId); |
| - ResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.resourceId); |
| - ResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.resourceId); |
| GLC(context(), context()->activeTexture(GL_TEXTURE1)); |
| - GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())); |
| + ResourceProvider::ScopedSamplerGL yPlaneLock(m_resourceProvider, yPlane.resourceId, GL_TEXTURE_2D); |
| GLC(context(), context()->activeTexture(GL_TEXTURE2)); |
| - GLC(context(), context()->bindTexture(GL_TEXTURE_2D, uPlaneLock.textureId())); |
| + ResourceProvider::ScopedSamplerGL uPlaneLock(m_resourceProvider, uPlane.resourceId, GL_TEXTURE_2D); |
| GLC(context(), context()->activeTexture(GL_TEXTURE3)); |
| - GLC(context(), context()->bindTexture(GL_TEXTURE_2D, vPlaneLock.textureId())); |
| + ResourceProvider::ScopedSamplerGL vPlaneLock(m_resourceProvider, vPlane.resourceId, GL_TEXTURE_2D); |
| GLC(context(), context()->useProgram(program->program())); |
| @@ -990,8 +982,7 @@ void GLRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQua |
| const gfx::RectF& uvRect = quad->uv_rect; |
| GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height())); |
| - ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resource_id); |
| - GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); |
| + ResourceProvider::ScopedSamplerGL quadResourceLock(m_resourceProvider, quad->resource_id, GL_TEXTURE_2D); |
| if (!quad->premultiplied_alpha) { |
| // As it turns out, the premultiplied alpha blending function (ONE, ONE_MINUS_SRC_ALPHA) |