| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 return resource_provider_->best_texture_format(); | 432 return resource_provider_->best_texture_format(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void GLRenderer::DidChangeVisibility() { | 435 void GLRenderer::DidChangeVisibility() { |
| 436 if (visible_) { | 436 if (visible_) { |
| 437 output_surface_->EnsureBackbuffer(); | 437 output_surface_->EnsureBackbuffer(); |
| 438 } else { | 438 } else { |
| 439 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources"); | 439 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources"); |
| 440 ReleaseRenderPassTextures(); | 440 ReleaseRenderPassTextures(); |
| 441 output_surface_->DiscardBackbuffer(); | 441 output_surface_->DiscardBackbuffer(); |
| 442 gl_->ReleaseShaderCompiler(); |
| 442 } | 443 } |
| 443 | 444 |
| 444 PrepareGeometry(NO_BINDING); | 445 PrepareGeometry(NO_BINDING); |
| 445 | 446 |
| 446 auto* context_provider = output_surface_->context_provider(); | 447 auto* context_provider = output_surface_->context_provider(); |
| 447 auto* cache_controller = context_provider->CacheController(); | 448 auto* cache_controller = context_provider->CacheController(); |
| 448 if (visible_) { | 449 if (visible_) { |
| 449 DCHECK(!context_visibility_); | 450 DCHECK(!context_visibility_); |
| 450 context_visibility_ = cache_controller->ClientBecameVisible(); | 451 context_visibility_ = cache_controller->ClientBecameVisible(); |
| 451 } else { | 452 } else { |
| (...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 if (!transform) { | 3090 if (!transform) { |
| 3090 transform = gfx::ColorTransform::NewColorTransform( | 3091 transform = gfx::ColorTransform::NewColorTransform( |
| 3091 src, dst, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL); | 3092 src, dst, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL); |
| 3092 } | 3093 } |
| 3093 return transform.get(); | 3094 return transform.get(); |
| 3094 } | 3095 } |
| 3095 | 3096 |
| 3096 void GLRenderer::CleanupSharedObjects() { | 3097 void GLRenderer::CleanupSharedObjects() { |
| 3097 shared_geometry_ = nullptr; | 3098 shared_geometry_ = nullptr; |
| 3098 | 3099 |
| 3100 gl_->ReleaseShaderCompiler(); |
| 3099 for (auto& iter : program_cache_) | 3101 for (auto& iter : program_cache_) |
| 3100 iter.second->Cleanup(gl_); | 3102 iter.second->Cleanup(gl_); |
| 3101 program_cache_.clear(); | 3103 program_cache_.clear(); |
| 3102 color_transform_cache_.clear(); | 3104 color_transform_cache_.clear(); |
| 3103 | 3105 |
| 3104 if (offscreen_framebuffer_id_) | 3106 if (offscreen_framebuffer_id_) |
| 3105 gl_->DeleteFramebuffers(1, &offscreen_framebuffer_id_); | 3107 gl_->DeleteFramebuffers(1, &offscreen_framebuffer_id_); |
| 3106 | 3108 |
| 3107 if (offscreen_stencil_renderbuffer_id_) | 3109 if (offscreen_stencil_renderbuffer_id_) |
| 3108 gl_->DeleteRenderbuffers(1, &offscreen_stencil_renderbuffer_id_); | 3110 gl_->DeleteRenderbuffers(1, &offscreen_stencil_renderbuffer_id_); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3609 return; | 3611 return; |
| 3610 | 3612 |
| 3611 // Report GPU overdraw as a percentage of |max_result|. | 3613 // Report GPU overdraw as a percentage of |max_result|. |
| 3612 TRACE_COUNTER1( | 3614 TRACE_COUNTER1( |
| 3613 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3615 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
| 3614 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3616 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
| 3615 max_result); | 3617 max_result); |
| 3616 } | 3618 } |
| 3617 | 3619 |
| 3618 } // namespace cc | 3620 } // namespace cc |
| OLD | NEW |