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

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

Issue 2728173004: HDR: Do nonlinear blending in the compositor (Closed)
Patch Set: Fix windows build Created 3 years, 9 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 | cc/output/gl_renderer_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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 418 }
419 419
420 bool GLRenderer::CanPartialSwap() { 420 bool GLRenderer::CanPartialSwap() {
421 if (use_swap_with_bounds_) 421 if (use_swap_with_bounds_)
422 return false; 422 return false;
423 auto* context_provider = output_surface_->context_provider(); 423 auto* context_provider = output_surface_->context_provider();
424 return context_provider->ContextCapabilities().post_sub_buffer; 424 return context_provider->ContextCapabilities().post_sub_buffer;
425 } 425 }
426 426
427 ResourceFormat GLRenderer::BackbufferFormat() const { 427 ResourceFormat GLRenderer::BackbufferFormat() const {
428 // TODO(ccameron): If we are targeting high bit depth or HDR, we should use 428 if (current_frame()->current_render_pass->color_space.IsHDR() &&
429 // RGBA_F16 here. 429 resource_provider_->IsResourceFormatSupported(RGBA_F16)) {
430 return RGBA_F16;
431 }
430 return resource_provider_->best_texture_format(); 432 return resource_provider_->best_texture_format();
431 } 433 }
432 434
433 void GLRenderer::DidChangeVisibility() { 435 void GLRenderer::DidChangeVisibility() {
434 if (visible_) { 436 if (visible_) {
435 output_surface_->EnsureBackbuffer(); 437 output_surface_->EnsureBackbuffer();
436 } else { 438 } else {
437 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources"); 439 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources");
438 ReleaseRenderPassTextures(); 440 ReleaseRenderPassTextures();
439 output_surface_->DiscardBackbuffer(); 441 output_surface_->DiscardBackbuffer();
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 if (params->mask_resource_lock) { 1308 if (params->mask_resource_lock) {
1307 mask_mode = HAS_MASK; 1309 mask_mode = HAS_MASK;
1308 sampler_type = 1310 sampler_type =
1309 SamplerTypeFromTextureTarget(params->mask_resource_lock->target()); 1311 SamplerTypeFromTextureTarget(params->mask_resource_lock->target());
1310 } 1312 }
1311 1313
1312 SetUseProgram(ProgramKey::RenderPass( 1314 SetUseProgram(ProgramKey::RenderPass(
1313 tex_coord_precision, sampler_type, shader_blend_mode, 1315 tex_coord_precision, sampler_type, shader_blend_mode,
1314 params->use_aa ? USE_AA : NO_AA, mask_mode, 1316 params->use_aa ? USE_AA : NO_AA, mask_mode,
1315 mask_for_background, params->use_color_matrix), 1317 mask_for_background, params->use_color_matrix),
1316 current_frame()->current_render_pass->color_space); 1318 params->contents_resource_lock
1319 ? params->contents_resource_lock->color_space()
1320 : gfx::ColorSpace());
1317 } 1321 }
1318 1322
1319 void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) { 1323 void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) {
1320 gfx::RectF tex_rect(params->src_offset.x(), params->src_offset.y(), 1324 gfx::RectF tex_rect(params->src_offset.x(), params->src_offset.y(),
1321 params->dst_rect.width(), params->dst_rect.height()); 1325 params->dst_rect.width(), params->dst_rect.height());
1322 gfx::Size texture_size; 1326 gfx::Size texture_size;
1323 if (params->filter_image) { 1327 if (params->filter_image) {
1324 texture_size.set_width(params->filter_image->width()); 1328 texture_size.set_width(params->filter_image->width());
1325 texture_size.set_height(params->filter_image->height()); 1329 texture_size.set_height(params->filter_image->height());
1326 } else { 1330 } else {
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 return; 3502 return;
3499 3503
3500 // Report GPU overdraw as a percentage of |max_result|. 3504 // Report GPU overdraw as a percentage of |max_result|.
3501 TRACE_COUNTER1( 3505 TRACE_COUNTER1(
3502 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3506 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3503 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3507 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3504 max_result); 3508 max_result);
3505 } 3509 }
3506 3510
3507 } // namespace cc 3511 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698