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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 13445009: cc: Move video upload to VideoResourceUpdater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consume textures that were produced Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/output/delegating_renderer_unittest.cc ('k') | cc/quads/draw_quad_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 const YUVVideoDrawQuad* quad) { 1335 const YUVVideoDrawQuad* quad) {
1336 SetBlendEnabled(quad->ShouldDrawWithBlending()); 1336 SetBlendEnabled(quad->ShouldDrawWithBlending());
1337 1337
1338 TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( 1338 TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired(
1339 context_, highp_threshold_min_, 1339 context_, highp_threshold_min_,
1340 quad->shared_quad_state->visible_content_rect.bottom_right()); 1340 quad->shared_quad_state->visible_content_rect.bottom_right());
1341 1341
1342 const VideoYUVProgram* program = GetVideoYUVProgram(texCoordPrecision); 1342 const VideoYUVProgram* program = GetVideoYUVProgram(texCoordPrecision);
1343 DCHECK(program && (program->initialized() || IsContextLost())); 1343 DCHECK(program && (program->initialized() || IsContextLost()));
1344 1344
1345 const VideoLayerImpl::FramePlane& y_plane = quad->y_plane;
1346 const VideoLayerImpl::FramePlane& u_plane = quad->u_plane;
1347 const VideoLayerImpl::FramePlane& v_plane = quad->v_plane;
1348
1349 GLC(Context(), Context()->activeTexture(GL_TEXTURE1)); 1345 GLC(Context(), Context()->activeTexture(GL_TEXTURE1));
1350 ResourceProvider::ScopedSamplerGL y_plane_lock( 1346 ResourceProvider::ScopedSamplerGL y_plane_lock(
1351 resource_provider_, y_plane.resource_id, GL_TEXTURE_2D, GL_LINEAR); 1347 resource_provider_, quad->y_plane_resource_id, GL_TEXTURE_2D, GL_LINEAR);
1352 GLC(Context(), Context()->activeTexture(GL_TEXTURE2)); 1348 GLC(Context(), Context()->activeTexture(GL_TEXTURE2));
1353 ResourceProvider::ScopedSamplerGL u_plane_lock( 1349 ResourceProvider::ScopedSamplerGL u_plane_lock(
1354 resource_provider_, u_plane.resource_id, GL_TEXTURE_2D, GL_LINEAR); 1350 resource_provider_, quad->u_plane_resource_id, GL_TEXTURE_2D, GL_LINEAR);
1355 GLC(Context(), Context()->activeTexture(GL_TEXTURE3)); 1351 GLC(Context(), Context()->activeTexture(GL_TEXTURE3));
1356 ResourceProvider::ScopedSamplerGL v_plane_lock( 1352 ResourceProvider::ScopedSamplerGL v_plane_lock(
1357 resource_provider_, v_plane.resource_id, GL_TEXTURE_2D, GL_LINEAR); 1353 resource_provider_, quad->v_plane_resource_id, GL_TEXTURE_2D, GL_LINEAR);
1358 1354
1359 SetUseProgram(program->program()); 1355 SetUseProgram(program->program());
1360 1356
1361 GLC(Context(), 1357 GLC(Context(),
1362 Context()->uniform2f(program->vertex_shader().tex_scale_location(), 1358 Context()->uniform2f(program->vertex_shader().tex_scale_location(),
1363 quad->tex_scale.width(), 1359 quad->tex_scale.width(),
1364 quad->tex_scale.height())); 1360 quad->tex_scale.height()));
1365 GLC(Context(), 1361 GLC(Context(),
1366 Context()->uniform1i(program->fragment_shader().y_texture_location(), 1)); 1362 Context()->uniform1i(program->fragment_shader().y_texture_location(), 1));
1367 GLC(Context(), 1363 GLC(Context(),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 1413
1418 const VideoStreamTextureProgram* program = 1414 const VideoStreamTextureProgram* program =
1419 GetVideoStreamTextureProgram(texCoordPrecision); 1415 GetVideoStreamTextureProgram(texCoordPrecision);
1420 SetUseProgram(program->program()); 1416 SetUseProgram(program->program());
1421 1417
1422 ToGLMatrix(&gl_matrix[0], quad->matrix); 1418 ToGLMatrix(&gl_matrix[0], quad->matrix);
1423 GLC(Context(), 1419 GLC(Context(),
1424 Context()->uniformMatrix4fv( 1420 Context()->uniformMatrix4fv(
1425 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix)); 1421 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix));
1426 1422
1423 ResourceProvider::ScopedReadLockGL lock(resource_provider_,
1424 quad->resource_id);
1427 GLC(Context(), 1425 GLC(Context(),
1428 Context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->texture_id)); 1426 Context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()));
1429 1427
1430 GLC(Context(), 1428 GLC(Context(),
1431 Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); 1429 Context()->uniform1i(program->fragment_shader().sampler_location(), 0));
1432 1430
1433 SetShaderOpacity(quad->opacity(), 1431 SetShaderOpacity(quad->opacity(),
1434 program->fragment_shader().alpha_location()); 1432 program->fragment_shader().alpha_location());
1435 DrawQuadGeometry(frame, 1433 DrawQuadGeometry(frame,
1436 quad->quadTransform(), 1434 quad->quadTransform(),
1437 quad->rect, 1435 quad->rect,
1438 program->vertex_shader().matrix_location()); 1436 program->vertex_shader().matrix_location());
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 quad->io_surface_size.width(), 1713 quad->io_surface_size.width(),
1716 quad->io_surface_size.height())); 1714 quad->io_surface_size.height()));
1717 } 1715 }
1718 1716
1719 const float vertex_opacity[] = { quad->opacity(), quad->opacity(), 1717 const float vertex_opacity[] = { quad->opacity(), quad->opacity(),
1720 quad->opacity(), quad->opacity() }; 1718 quad->opacity(), quad->opacity() };
1721 GLC(Context(), 1719 GLC(Context(),
1722 Context()->uniform1fv( 1720 Context()->uniform1fv(
1723 binding.vertex_opacity_location, 4, vertex_opacity)); 1721 binding.vertex_opacity_location, 4, vertex_opacity));
1724 1722
1723 ResourceProvider::ScopedReadLockGL lock(resource_provider_,
1724 quad->io_surface_resource_id);
1725 GLC(Context(), 1725 GLC(Context(),
1726 Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1726 Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB,
1727 quad->io_surface_texture_id)); 1727 lock.texture_id()));
1728 1728
1729 DrawQuadGeometry( 1729 DrawQuadGeometry(
1730 frame, quad->quadTransform(), quad->rect, binding.matrix_location); 1730 frame, quad->quadTransform(), quad->rect, binding.matrix_location);
1731 1731
1732 GLC(Context(), Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); 1732 GLC(Context(), Context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0));
1733 } 1733 }
1734 1734
1735 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { 1735 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) {
1736 current_framebuffer_lock_.reset(); 1736 current_framebuffer_lock_.reset();
1737 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect)); 1737 swap_buffer_rect_.Union(gfx::ToEnclosingRect(frame->root_damage_rect));
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); 2583 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_);
2584 2584
2585 ReleaseRenderPassTextures(); 2585 ReleaseRenderPassTextures();
2586 } 2586 }
2587 2587
2588 bool GLRenderer::IsContextLost() { 2588 bool GLRenderer::IsContextLost() {
2589 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2589 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
2590 } 2590 }
2591 2591
2592 } // namespace cc 2592 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/delegating_renderer_unittest.cc ('k') | cc/quads/draw_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698