| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 settings->gl_composited_texture_quad_border), | 390 settings->gl_composited_texture_quad_border), |
| 391 bound_geometry_(NO_BINDING), | 391 bound_geometry_(NO_BINDING), |
| 392 color_lut_cache_(gl_) { | 392 color_lut_cache_(gl_) { |
| 393 DCHECK(gl_); | 393 DCHECK(gl_); |
| 394 DCHECK(context_support_); | 394 DCHECK(context_support_); |
| 395 | 395 |
| 396 const auto& context_caps = | 396 const auto& context_caps = |
| 397 output_surface_->context_provider()->ContextCapabilities(); | 397 output_surface_->context_provider()->ContextCapabilities(); |
| 398 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); | 398 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); |
| 399 | 399 |
| 400 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | |
| 401 capabilities_.best_texture_format = resource_provider_->best_texture_format(); | |
| 402 | |
| 403 use_discard_framebuffer_ = context_caps.discard_framebuffer; | 400 use_discard_framebuffer_ = context_caps.discard_framebuffer; |
| 404 use_sync_query_ = context_caps.sync_query; | 401 use_sync_query_ = context_caps.sync_query; |
| 405 use_blend_equation_advanced_ = context_caps.blend_equation_advanced; | 402 use_blend_equation_advanced_ = context_caps.blend_equation_advanced; |
| 406 use_blend_equation_advanced_coherent_ = | 403 use_blend_equation_advanced_coherent_ = |
| 407 context_caps.blend_equation_advanced_coherent; | 404 context_caps.blend_equation_advanced_coherent; |
| 408 | 405 |
| 409 InitializeSharedObjects(); | 406 InitializeSharedObjects(); |
| 410 } | 407 } |
| 411 | 408 |
| 412 GLRenderer::~GLRenderer() { | 409 GLRenderer::~GLRenderer() { |
| 413 while (!pending_async_read_pixels_.empty()) { | 410 while (!pending_async_read_pixels_.empty()) { |
| 414 PendingAsyncReadPixels* pending_read = | 411 PendingAsyncReadPixels* pending_read = |
| 415 pending_async_read_pixels_.back().get(); | 412 pending_async_read_pixels_.back().get(); |
| 416 pending_read->finished_read_pixels_callback.Cancel(); | 413 pending_read->finished_read_pixels_callback.Cancel(); |
| 417 pending_async_read_pixels_.pop_back(); | 414 pending_async_read_pixels_.pop_back(); |
| 418 } | 415 } |
| 419 | 416 |
| 420 CleanupSharedObjects(); | 417 CleanupSharedObjects(); |
| 421 } | 418 } |
| 422 | 419 |
| 423 const RendererCapabilitiesImpl& GLRenderer::Capabilities() const { | |
| 424 return capabilities_; | |
| 425 } | |
| 426 | |
| 427 bool GLRenderer::CanPartialSwap() { | 420 bool GLRenderer::CanPartialSwap() { |
| 428 auto* context_provider = output_surface_->context_provider(); | 421 auto* context_provider = output_surface_->context_provider(); |
| 429 return context_provider->ContextCapabilities().post_sub_buffer; | 422 return context_provider->ContextCapabilities().post_sub_buffer; |
| 430 } | 423 } |
| 431 | 424 |
| 432 void GLRenderer::DidChangeVisibility() { | 425 void GLRenderer::DidChangeVisibility() { |
| 433 if (visible_) { | 426 if (visible_) { |
| 434 output_surface_->EnsureBackbuffer(); | 427 output_surface_->EnsureBackbuffer(); |
| 435 } else { | 428 } else { |
| 436 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources"); | 429 TRACE_EVENT0("cc", "GLRenderer::DidChangeVisibility dropping resources"); |
| (...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 | 4026 |
| 4034 gl_->ScheduleCALayerSharedStateCHROMIUM( | 4027 gl_->ScheduleCALayerSharedStateCHROMIUM( |
| 4035 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, | 4028 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, |
| 4036 sorting_context_id, gl_transform); | 4029 sorting_context_id, gl_transform); |
| 4037 gl_->ScheduleCALayerCHROMIUM( | 4030 gl_->ScheduleCALayerCHROMIUM( |
| 4038 texture_id, contents_rect, ca_layer_overlay->background_color, | 4031 texture_id, contents_rect, ca_layer_overlay->background_color, |
| 4039 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); | 4032 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); |
| 4040 } | 4033 } |
| 4041 | 4034 |
| 4042 } // namespace cc | 4035 } // namespace cc |
| OLD | NEW |