| OLD | NEW |
| 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 <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 always_clear = true; | 445 always_clear = true; |
| 446 #endif | 446 #endif |
| 447 if (always_clear || frame->current_render_pass->has_transparent_background) { | 447 if (always_clear || frame->current_render_pass->has_transparent_background) { |
| 448 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT; | 448 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT; |
| 449 if (always_clear) | 449 if (always_clear) |
| 450 clear_bits |= GL_STENCIL_BUFFER_BIT; | 450 clear_bits |= GL_STENCIL_BUFFER_BIT; |
| 451 gl_->Clear(clear_bits); | 451 gl_->Clear(clear_bits); |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 static ResourceId WaitOnResourceSyncPoints(ResourceProvider* resource_provider, | |
| 456 ResourceId resource_id) { | |
| 457 resource_provider->WaitSyncPointIfNeeded(resource_id); | |
| 458 return resource_id; | |
| 459 } | |
| 460 | |
| 461 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { | 455 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { |
| 462 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); | 456 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); |
| 463 | 457 |
| 464 scoped_refptr<ResourceProvider::Fence> read_lock_fence; | 458 scoped_refptr<ResourceProvider::Fence> read_lock_fence; |
| 465 if (use_sync_query_) { | 459 if (use_sync_query_) { |
| 466 // Block until oldest sync query has passed if the number of pending queries | 460 // Block until oldest sync query has passed if the number of pending queries |
| 467 // ever reach kMaxPendingSyncQueries. | 461 // ever reach kMaxPendingSyncQueries. |
| 468 if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) { | 462 if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) { |
| 469 LOG(ERROR) << "Reached limit of pending sync queries."; | 463 LOG(ERROR) << "Reached limit of pending sync queries."; |
| 470 | 464 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 485 | 479 |
| 486 read_lock_fence = current_sync_query_->Begin(); | 480 read_lock_fence = current_sync_query_->Begin(); |
| 487 } else { | 481 } else { |
| 488 read_lock_fence = | 482 read_lock_fence = |
| 489 make_scoped_refptr(new ResourceProvider::SynchronousFence(gl_)); | 483 make_scoped_refptr(new ResourceProvider::SynchronousFence(gl_)); |
| 490 } | 484 } |
| 491 resource_provider_->SetReadLockFence(read_lock_fence.get()); | 485 resource_provider_->SetReadLockFence(read_lock_fence.get()); |
| 492 | 486 |
| 493 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame, | 487 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame, |
| 494 // so that drawing can proceed without GL context switching interruptions. | 488 // so that drawing can proceed without GL context switching interruptions. |
| 495 DrawQuad::ResourceIteratorCallback wait_on_resource_syncpoints_callback = | 489 ResourceProvider* resource_provider = resource_provider_; |
| 496 base::Bind(&WaitOnResourceSyncPoints, resource_provider_); | |
| 497 | |
| 498 for (const auto& pass : *frame->render_passes_in_draw_order) { | 490 for (const auto& pass : *frame->render_passes_in_draw_order) { |
| 499 for (const auto& quad : pass->quad_list) | 491 for (const auto& quad : pass->quad_list) { |
| 500 quad->IterateResources(wait_on_resource_syncpoints_callback); | 492 quad->IterateResources([resource_provider](ResourceId resource_id) { |
| 493 resource_provider->WaitSyncPointIfNeeded(resource_id); |
| 494 return resource_id; |
| 495 }); |
| 496 } |
| 501 } | 497 } |
| 502 | 498 |
| 503 // TODO(enne): Do we need to reinitialize all of this state per frame? | 499 // TODO(enne): Do we need to reinitialize all of this state per frame? |
| 504 ReinitializeGLState(); | 500 ReinitializeGLState(); |
| 505 } | 501 } |
| 506 | 502 |
| 507 void GLRenderer::DoNoOp() { | 503 void GLRenderer::DoNoOp() { |
| 508 gl_->BindFramebuffer(GL_FRAMEBUFFER, 0); | 504 gl_->BindFramebuffer(GL_FRAMEBUFFER, 0); |
| 509 gl_->Flush(); | 505 gl_->Flush(); |
| 510 } | 506 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 ApplyBackgroundFilters(frame, quad, background_texture.get()); | 984 ApplyBackgroundFilters(frame, quad, background_texture.get()); |
| 989 } | 985 } |
| 990 } | 986 } |
| 991 | 987 |
| 992 if (!background_texture) { | 988 if (!background_texture) { |
| 993 // Something went wrong with reading the backdrop. | 989 // Something went wrong with reading the backdrop. |
| 994 DCHECK(!background_image); | 990 DCHECK(!background_image); |
| 995 use_shaders_for_blending = false; | 991 use_shaders_for_blending = false; |
| 996 } else if (background_image) { | 992 } else if (background_image) { |
| 997 // Reset original background texture if there is not any mask | 993 // Reset original background texture if there is not any mask |
| 998 if (!quad->mask_resource_id) | 994 if (!quad->mask_resource_id()) |
| 999 background_texture.reset(); | 995 background_texture.reset(); |
| 1000 } else if (CanApplyBlendModeUsingBlendFunc(blend_mode) && | 996 } else if (CanApplyBlendModeUsingBlendFunc(blend_mode) && |
| 1001 ShouldApplyBackgroundFilters(frame, quad)) { | 997 ShouldApplyBackgroundFilters(frame, quad)) { |
| 1002 // Something went wrong with applying background filters to the backdrop. | 998 // Something went wrong with applying background filters to the backdrop. |
| 1003 use_shaders_for_blending = false; | 999 use_shaders_for_blending = false; |
| 1004 background_texture.reset(); | 1000 background_texture.reset(); |
| 1005 } | 1001 } |
| 1006 } | 1002 } |
| 1007 // Need original background texture for mask? | 1003 // Need original background texture for mask? |
| 1008 bool mask_for_background = | 1004 bool mask_for_background = |
| 1009 background_texture && // Have original background texture | 1005 background_texture && // Have original background texture |
| 1010 background_image && // Have filtered background texture | 1006 background_image && // Have filtered background texture |
| 1011 quad->mask_resource_id; // Have mask texture | 1007 quad->mask_resource_id(); // Have mask texture |
| 1012 SetBlendEnabled( | 1008 SetBlendEnabled( |
| 1013 !use_shaders_for_blending && | 1009 !use_shaders_for_blending && |
| 1014 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); | 1010 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); |
| 1015 | 1011 |
| 1016 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 1012 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
| 1017 // the surface and its replica. Apply filters to the contents texture. | 1013 // the surface and its replica. Apply filters to the contents texture. |
| 1018 skia::RefPtr<SkImage> filter_image; | 1014 skia::RefPtr<SkImage> filter_image; |
| 1019 SkScalar color_matrix[20]; | 1015 SkScalar color_matrix[20]; |
| 1020 bool use_color_matrix = false; | 1016 bool use_color_matrix = false; |
| 1021 if (!quad->filters.IsEmpty()) { | 1017 if (!quad->filters.IsEmpty()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1038 filter_image = ApplyImageFilter( | 1034 filter_image = ApplyImageFilter( |
| 1039 ScopedUseGrContext::Create(this, frame), resource_provider_, | 1035 ScopedUseGrContext::Create(this, frame), resource_provider_, |
| 1040 quad->rect, quad->filters_scale, filter.get(), contents_texture); | 1036 quad->rect, quad->filters_scale, filter.get(), contents_texture); |
| 1041 } | 1037 } |
| 1042 } | 1038 } |
| 1043 } | 1039 } |
| 1044 | 1040 |
| 1045 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; | 1041 scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock; |
| 1046 unsigned mask_texture_id = 0; | 1042 unsigned mask_texture_id = 0; |
| 1047 SamplerType mask_sampler = SAMPLER_TYPE_NA; | 1043 SamplerType mask_sampler = SAMPLER_TYPE_NA; |
| 1048 if (quad->mask_resource_id) { | 1044 if (quad->mask_resource_id()) { |
| 1049 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( | 1045 mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL( |
| 1050 resource_provider_, quad->mask_resource_id, GL_TEXTURE1, GL_LINEAR)); | 1046 resource_provider_, quad->mask_resource_id(), GL_TEXTURE1, GL_LINEAR)); |
| 1051 mask_texture_id = mask_resource_lock->texture_id(); | 1047 mask_texture_id = mask_resource_lock->texture_id(); |
| 1052 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); | 1048 mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target()); |
| 1053 } | 1049 } |
| 1054 | 1050 |
| 1055 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; | 1051 scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock; |
| 1056 if (filter_image) { | 1052 if (filter_image) { |
| 1057 GrTexture* texture = filter_image->getTexture(); | 1053 GrTexture* texture = filter_image->getTexture(); |
| 1058 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 1054 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 1059 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); | 1055 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); |
| 1060 } else { | 1056 } else { |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 | 1624 |
| 1629 uniforms->sampler_location = program->fragment_shader().sampler_location(); | 1625 uniforms->sampler_location = program->fragment_shader().sampler_location(); |
| 1630 uniforms->alpha_location = program->fragment_shader().alpha_location(); | 1626 uniforms->alpha_location = program->fragment_shader().alpha_location(); |
| 1631 uniforms->fragment_tex_transform_location = | 1627 uniforms->fragment_tex_transform_location = |
| 1632 program->fragment_shader().fragment_tex_transform_location(); | 1628 program->fragment_shader().fragment_tex_transform_location(); |
| 1633 } | 1629 } |
| 1634 | 1630 |
| 1635 void GLRenderer::DrawTileQuad(const DrawingFrame* frame, | 1631 void GLRenderer::DrawTileQuad(const DrawingFrame* frame, |
| 1636 const TileDrawQuad* quad, | 1632 const TileDrawQuad* quad, |
| 1637 const gfx::QuadF* clip_region) { | 1633 const gfx::QuadF* clip_region) { |
| 1638 DrawContentQuad(frame, quad, quad->resource_id, clip_region); | 1634 DrawContentQuad(frame, quad, quad->resource_id(), clip_region); |
| 1639 } | 1635 } |
| 1640 | 1636 |
| 1641 void GLRenderer::DrawContentQuad(const DrawingFrame* frame, | 1637 void GLRenderer::DrawContentQuad(const DrawingFrame* frame, |
| 1642 const ContentDrawQuadBase* quad, | 1638 const ContentDrawQuadBase* quad, |
| 1643 ResourceId resource_id, | 1639 ResourceId resource_id, |
| 1644 const gfx::QuadF* clip_region) { | 1640 const gfx::QuadF* clip_region) { |
| 1645 gfx::Transform device_transform = | 1641 gfx::Transform device_transform = |
| 1646 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); | 1642 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); |
| 1647 device_transform.FlattenTo2d(); | 1643 device_transform.FlattenTo2d(); |
| 1648 | 1644 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 const YUVVideoDrawQuad* quad, | 1893 const YUVVideoDrawQuad* quad, |
| 1898 const gfx::QuadF* clip_region) { | 1894 const gfx::QuadF* clip_region) { |
| 1899 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1895 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1900 | 1896 |
| 1901 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1897 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1902 gl_, | 1898 gl_, |
| 1903 &highp_threshold_cache_, | 1899 &highp_threshold_cache_, |
| 1904 highp_threshold_min_, | 1900 highp_threshold_min_, |
| 1905 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1901 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1906 | 1902 |
| 1907 bool use_alpha_plane = quad->a_plane_resource_id != 0; | 1903 bool use_alpha_plane = quad->a_plane_resource_id() != 0; |
| 1908 | 1904 |
| 1909 ResourceProvider::ScopedSamplerGL y_plane_lock( | 1905 ResourceProvider::ScopedSamplerGL y_plane_lock( |
| 1910 resource_provider_, quad->y_plane_resource_id, GL_TEXTURE1, GL_LINEAR); | 1906 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR); |
| 1911 ResourceProvider::ScopedSamplerGL u_plane_lock( | 1907 ResourceProvider::ScopedSamplerGL u_plane_lock( |
| 1912 resource_provider_, quad->u_plane_resource_id, GL_TEXTURE2, GL_LINEAR); | 1908 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); |
| 1913 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); | 1909 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); |
| 1914 ResourceProvider::ScopedSamplerGL v_plane_lock( | 1910 ResourceProvider::ScopedSamplerGL v_plane_lock( |
| 1915 resource_provider_, quad->v_plane_resource_id, GL_TEXTURE3, GL_LINEAR); | 1911 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3, GL_LINEAR); |
| 1916 DCHECK_EQ(y_plane_lock.target(), v_plane_lock.target()); | 1912 DCHECK_EQ(y_plane_lock.target(), v_plane_lock.target()); |
| 1917 scoped_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock; | 1913 scoped_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock; |
| 1918 if (use_alpha_plane) { | 1914 if (use_alpha_plane) { |
| 1919 a_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( | 1915 a_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( |
| 1920 resource_provider_, quad->a_plane_resource_id, GL_TEXTURE4, GL_LINEAR)); | 1916 resource_provider_, quad->a_plane_resource_id(), GL_TEXTURE4, |
| 1917 GL_LINEAR)); |
| 1921 DCHECK_EQ(y_plane_lock.target(), a_plane_lock->target()); | 1918 DCHECK_EQ(y_plane_lock.target(), a_plane_lock->target()); |
| 1922 } | 1919 } |
| 1923 | 1920 |
| 1924 // All planes must have the same sampler type. | 1921 // All planes must have the same sampler type. |
| 1925 SamplerType sampler = SamplerTypeFromTextureTarget(y_plane_lock.target()); | 1922 SamplerType sampler = SamplerTypeFromTextureTarget(y_plane_lock.target()); |
| 1926 | 1923 |
| 1927 int matrix_location = -1; | 1924 int matrix_location = -1; |
| 1928 int ya_tex_scale_location = -1; | 1925 int ya_tex_scale_location = -1; |
| 1929 int ya_tex_offset_location = -1; | 1926 int ya_tex_offset_location = -1; |
| 1930 int uv_tex_scale_location = -1; | 1927 int uv_tex_scale_location = -1; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 | 2120 |
| 2124 const VideoStreamTextureProgram* program = | 2121 const VideoStreamTextureProgram* program = |
| 2125 GetVideoStreamTextureProgram(tex_coord_precision); | 2122 GetVideoStreamTextureProgram(tex_coord_precision); |
| 2126 SetUseProgram(program->program()); | 2123 SetUseProgram(program->program()); |
| 2127 | 2124 |
| 2128 ToGLMatrix(&gl_matrix[0], quad->matrix); | 2125 ToGLMatrix(&gl_matrix[0], quad->matrix); |
| 2129 gl_->UniformMatrix4fv(program->vertex_shader().tex_matrix_location(), 1, | 2126 gl_->UniformMatrix4fv(program->vertex_shader().tex_matrix_location(), 1, |
| 2130 false, gl_matrix); | 2127 false, gl_matrix); |
| 2131 | 2128 |
| 2132 ResourceProvider::ScopedReadLockGL lock(resource_provider_, | 2129 ResourceProvider::ScopedReadLockGL lock(resource_provider_, |
| 2133 quad->resource_id); | 2130 quad->resource_id()); |
| 2134 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 2131 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 2135 gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()); | 2132 gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()); |
| 2136 | 2133 |
| 2137 gl_->Uniform1i(program->fragment_shader().sampler_location(), 0); | 2134 gl_->Uniform1i(program->fragment_shader().sampler_location(), 0); |
| 2138 | 2135 |
| 2139 SetShaderOpacity(quad->opacity(), | 2136 SetShaderOpacity(quad->opacity(), |
| 2140 program->fragment_shader().alpha_location()); | 2137 program->fragment_shader().alpha_location()); |
| 2141 if (!clip_region) { | 2138 if (!clip_region) { |
| 2142 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, | 2139 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, |
| 2143 program->vertex_shader().matrix_location()); | 2140 program->vertex_shader().matrix_location()); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 FlushTextureQuadCache(SHARED_BINDING); | 2257 FlushTextureQuadCache(SHARED_BINDING); |
| 2261 } | 2258 } |
| 2262 | 2259 |
| 2263 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2260 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2264 gl_, | 2261 gl_, |
| 2265 &highp_threshold_cache_, | 2262 &highp_threshold_cache_, |
| 2266 highp_threshold_min_, | 2263 highp_threshold_min_, |
| 2267 quad->shared_quad_state->visible_content_rect.bottom_right()); | 2264 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 2268 | 2265 |
| 2269 ResourceProvider::ScopedReadLockGL lock(resource_provider_, | 2266 ResourceProvider::ScopedReadLockGL lock(resource_provider_, |
| 2270 quad->resource_id); | 2267 quad->resource_id()); |
| 2271 const SamplerType sampler = SamplerTypeFromTextureTarget(lock.target()); | 2268 const SamplerType sampler = SamplerTypeFromTextureTarget(lock.target()); |
| 2272 // Choose the correct texture program binding | 2269 // Choose the correct texture program binding |
| 2273 TexTransformTextureProgramBinding binding; | 2270 TexTransformTextureProgramBinding binding; |
| 2274 if (quad->premultiplied_alpha) { | 2271 if (quad->premultiplied_alpha) { |
| 2275 if (quad->background_color == SK_ColorTRANSPARENT) { | 2272 if (quad->background_color == SK_ColorTRANSPARENT) { |
| 2276 binding.Set(GetTextureProgram(tex_coord_precision, sampler)); | 2273 binding.Set(GetTextureProgram(tex_coord_precision, sampler)); |
| 2277 } else { | 2274 } else { |
| 2278 binding.Set(GetTextureBackgroundProgram(tex_coord_precision, sampler)); | 2275 binding.Set(GetTextureBackgroundProgram(tex_coord_precision, sampler)); |
| 2279 } | 2276 } |
| 2280 } else { | 2277 } else { |
| 2281 if (quad->background_color == SK_ColorTRANSPARENT) { | 2278 if (quad->background_color == SK_ColorTRANSPARENT) { |
| 2282 binding.Set( | 2279 binding.Set( |
| 2283 GetNonPremultipliedTextureProgram(tex_coord_precision, sampler)); | 2280 GetNonPremultipliedTextureProgram(tex_coord_precision, sampler)); |
| 2284 } else { | 2281 } else { |
| 2285 binding.Set(GetNonPremultipliedTextureBackgroundProgram( | 2282 binding.Set(GetNonPremultipliedTextureBackgroundProgram( |
| 2286 tex_coord_precision, sampler)); | 2283 tex_coord_precision, sampler)); |
| 2287 } | 2284 } |
| 2288 } | 2285 } |
| 2289 | 2286 |
| 2290 int resource_id = quad->resource_id; | 2287 int resource_id = quad->resource_id(); |
| 2291 | 2288 |
| 2292 if (draw_cache_.program_id != binding.program_id || | 2289 if (draw_cache_.program_id != binding.program_id || |
| 2293 draw_cache_.resource_id != resource_id || | 2290 draw_cache_.resource_id != resource_id || |
| 2294 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || | 2291 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || |
| 2295 draw_cache_.nearest_neighbor != quad->nearest_neighbor || | 2292 draw_cache_.nearest_neighbor != quad->nearest_neighbor || |
| 2296 draw_cache_.background_color != quad->background_color || | 2293 draw_cache_.background_color != quad->background_color || |
| 2297 draw_cache_.matrix_data.size() >= 8) { | 2294 draw_cache_.matrix_data.size() >= 8) { |
| 2298 FlushTextureQuadCache(SHARED_BINDING); | 2295 FlushTextureQuadCache(SHARED_BINDING); |
| 2299 draw_cache_.program_id = binding.program_id; | 2296 draw_cache_.program_id = binding.program_id; |
| 2300 draw_cache_.resource_id = resource_id; | 2297 draw_cache_.resource_id = resource_id; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 gl_->Uniform4f(binding.tex_transform_location, 0, 0, | 2376 gl_->Uniform4f(binding.tex_transform_location, 0, 0, |
| 2380 quad->io_surface_size.width(), | 2377 quad->io_surface_size.width(), |
| 2381 quad->io_surface_size.height()); | 2378 quad->io_surface_size.height()); |
| 2382 } | 2379 } |
| 2383 | 2380 |
| 2384 const float vertex_opacity[] = {quad->opacity(), quad->opacity(), | 2381 const float vertex_opacity[] = {quad->opacity(), quad->opacity(), |
| 2385 quad->opacity(), quad->opacity()}; | 2382 quad->opacity(), quad->opacity()}; |
| 2386 gl_->Uniform1fv(binding.vertex_opacity_location, 4, vertex_opacity); | 2383 gl_->Uniform1fv(binding.vertex_opacity_location, 4, vertex_opacity); |
| 2387 | 2384 |
| 2388 ResourceProvider::ScopedReadLockGL lock(resource_provider_, | 2385 ResourceProvider::ScopedReadLockGL lock(resource_provider_, |
| 2389 quad->io_surface_resource_id); | 2386 quad->io_surface_resource_id()); |
| 2390 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 2387 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 2391 gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, lock.texture_id()); | 2388 gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, lock.texture_id()); |
| 2392 | 2389 |
| 2393 if (!clip_region) { | 2390 if (!clip_region) { |
| 2394 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, | 2391 DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, |
| 2395 binding.matrix_location); | 2392 binding.matrix_location); |
| 2396 } else { | 2393 } else { |
| 2397 float uvs[8] = {0}; | 2394 float uvs[8] = {0}; |
| 2398 GetScaledUVs(quad->visible_rect, clip_region, uvs); | 2395 GetScaledUVs(quad->visible_rect, clip_region, uvs); |
| 2399 DrawQuadGeometryClippedByQuadF(frame, quad->quadTransform(), quad->rect, | 2396 DrawQuadGeometryClippedByQuadF(frame, quad->quadTransform(), quad->rect, |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3506 context_support_->ScheduleOverlayPlane( | 3503 context_support_->ScheduleOverlayPlane( |
| 3507 overlay.plane_z_order, | 3504 overlay.plane_z_order, |
| 3508 overlay.transform, | 3505 overlay.transform, |
| 3509 pending_overlay_resources_.back()->texture_id(), | 3506 pending_overlay_resources_.back()->texture_id(), |
| 3510 ToNearestRect(overlay.display_rect), | 3507 ToNearestRect(overlay.display_rect), |
| 3511 overlay.uv_rect); | 3508 overlay.uv_rect); |
| 3512 } | 3509 } |
| 3513 } | 3510 } |
| 3514 | 3511 |
| 3515 } // namespace cc | 3512 } // namespace cc |
| OLD | NEW |