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