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

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

Issue 2849743002: Allow binding multiple textures to one DC Layer overlay. (Closed)
Patch Set: improve test Created 3 years, 7 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
« no previous file with comments | « no previous file | gpu/GLES2/gl2chromium_autogen.h » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 if (overlay_resource_pool_) { 3225 if (overlay_resource_pool_) {
3226 overlay_resource_pool_->CheckBusyResources(); 3226 overlay_resource_pool_->CheckBusyResources();
3227 } 3227 }
3228 3228
3229 scoped_refptr<DCLayerOverlaySharedState> shared_state; 3229 scoped_refptr<DCLayerOverlaySharedState> shared_state;
3230 size_t copied_render_pass_count = 0; 3230 size_t copied_render_pass_count = 0;
3231 for (const DCLayerOverlay& dc_layer_overlay : 3231 for (const DCLayerOverlay& dc_layer_overlay :
3232 current_frame()->dc_layer_overlay_list) { 3232 current_frame()->dc_layer_overlay_list) {
3233 DCHECK(!dc_layer_overlay.rpdq); 3233 DCHECK(!dc_layer_overlay.rpdq);
3234 3234
3235 unsigned texture_id = 0; 3235 int i = 0;
3236 for (const auto& contents_resource_id : dc_layer_overlay.resources) { 3236 for (const auto& contents_resource_id : dc_layer_overlay.resources) {
3237 if (contents_resource_id) { 3237 if (contents_resource_id) {
3238 pending_overlay_resources_.push_back( 3238 pending_overlay_resources_.push_back(
3239 base::MakeUnique<ResourceProvider::ScopedReadLockGL>( 3239 base::MakeUnique<ResourceProvider::ScopedReadLockGL>(
3240 resource_provider_, contents_resource_id)); 3240 resource_provider_, contents_resource_id));
3241 if (!texture_id) 3241 gl_->SetDCLayerTextureCHROMIUM(
3242 texture_id = pending_overlay_resources_.back()->texture_id(); 3242 i++, pending_overlay_resources_.back()->texture_id());
3243 } 3243 }
3244 } 3244 }
3245 GLfloat contents_rect[4] = { 3245 GLfloat contents_rect[4] = {
3246 dc_layer_overlay.contents_rect.x(), dc_layer_overlay.contents_rect.y(), 3246 dc_layer_overlay.contents_rect.x(), dc_layer_overlay.contents_rect.y(),
3247 dc_layer_overlay.contents_rect.width(), 3247 dc_layer_overlay.contents_rect.width(),
3248 dc_layer_overlay.contents_rect.height(), 3248 dc_layer_overlay.contents_rect.height(),
3249 }; 3249 };
3250 GLfloat bounds_rect[4] = { 3250 GLfloat bounds_rect[4] = {
3251 dc_layer_overlay.bounds_rect.x(), dc_layer_overlay.bounds_rect.y(), 3251 dc_layer_overlay.bounds_rect.x(), dc_layer_overlay.bounds_rect.y(),
3252 dc_layer_overlay.bounds_rect.width(), 3252 dc_layer_overlay.bounds_rect.width(),
3253 dc_layer_overlay.bounds_rect.height(), 3253 dc_layer_overlay.bounds_rect.height(),
3254 }; 3254 };
3255 GLboolean is_clipped = dc_layer_overlay.shared_state->is_clipped; 3255 GLboolean is_clipped = dc_layer_overlay.shared_state->is_clipped;
3256 GLfloat clip_rect[4] = {dc_layer_overlay.shared_state->clip_rect.x(), 3256 GLfloat clip_rect[4] = {dc_layer_overlay.shared_state->clip_rect.x(),
3257 dc_layer_overlay.shared_state->clip_rect.y(), 3257 dc_layer_overlay.shared_state->clip_rect.y(),
3258 dc_layer_overlay.shared_state->clip_rect.width(), 3258 dc_layer_overlay.shared_state->clip_rect.width(),
3259 dc_layer_overlay.shared_state->clip_rect.height()}; 3259 dc_layer_overlay.shared_state->clip_rect.height()};
3260 GLint z_order = dc_layer_overlay.shared_state->z_order; 3260 GLint z_order = dc_layer_overlay.shared_state->z_order;
3261 GLfloat transform[16]; 3261 GLfloat transform[16];
3262 dc_layer_overlay.shared_state->transform.asColMajorf(transform); 3262 dc_layer_overlay.shared_state->transform.asColMajorf(transform);
3263 unsigned filter = dc_layer_overlay.filter; 3263 unsigned filter = dc_layer_overlay.filter;
3264 3264
3265 if (dc_layer_overlay.shared_state != shared_state) { 3265 if (dc_layer_overlay.shared_state != shared_state) {
3266 shared_state = dc_layer_overlay.shared_state; 3266 shared_state = dc_layer_overlay.shared_state;
3267 gl_->ScheduleDCLayerSharedStateCHROMIUM( 3267 gl_->ScheduleDCLayerSharedStateCHROMIUM(
3268 dc_layer_overlay.shared_state->opacity, is_clipped, clip_rect, 3268 dc_layer_overlay.shared_state->opacity, is_clipped, clip_rect,
3269 z_order, transform); 3269 z_order, transform);
3270 } 3270 }
3271 gl_->ScheduleDCLayerCHROMIUM( 3271 gl_->ScheduleDCLayerCHROMIUM(
3272 texture_id, contents_rect, dc_layer_overlay.background_color, 3272 contents_rect, dc_layer_overlay.background_color,
ccameron 2017/05/03 16:16:32 It may just be easier to have ScheduleDCLayerCHROM
3273 dc_layer_overlay.edge_aa_mask, bounds_rect, filter); 3273 dc_layer_overlay.edge_aa_mask, bounds_rect, filter);
3274 } 3274 }
3275 3275
3276 // Take the number of copied render passes in this frame, and use 3 times that 3276 // Take the number of copied render passes in this frame, and use 3 times that
3277 // amount as the cache limit. 3277 // amount as the cache limit.
3278 if (overlay_resource_pool_) { 3278 if (overlay_resource_pool_) {
3279 overlay_resource_pool_->SetResourceUsageLimits( 3279 overlay_resource_pool_->SetResourceUsageLimits(
3280 std::numeric_limits<std::size_t>::max(), copied_render_pass_count * 5); 3280 std::numeric_limits<std::size_t>::max(), copied_render_pass_count * 5);
3281 } 3281 }
3282 } 3282 }
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3603 return; 3603 return;
3604 3604
3605 // Report GPU overdraw as a percentage of |max_result|. 3605 // Report GPU overdraw as a percentage of |max_result|.
3606 TRACE_COUNTER1( 3606 TRACE_COUNTER1(
3607 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3607 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3608 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3608 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3609 max_result); 3609 max_result);
3610 } 3610 }
3611 3611
3612 } // namespace cc 3612 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | gpu/GLES2/gl2chromium_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698