| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 stencil_shadow_(false), | 330 stencil_shadow_(false), |
| 331 blend_shadow_(false), | 331 blend_shadow_(false), |
| 332 highp_threshold_min_(highp_threshold_min), | 332 highp_threshold_min_(highp_threshold_min), |
| 333 highp_threshold_cache_(0), | 333 highp_threshold_cache_(0), |
| 334 use_sync_query_(false), | 334 use_sync_query_(false), |
| 335 on_demand_tile_raster_resource_id_(0), | 335 on_demand_tile_raster_resource_id_(0), |
| 336 bound_geometry_(NO_BINDING) { | 336 bound_geometry_(NO_BINDING) { |
| 337 DCHECK(gl_); | 337 DCHECK(gl_); |
| 338 DCHECK(context_support_); | 338 DCHECK(context_support_); |
| 339 | 339 |
| 340 ContextProvider::Capabilities context_caps = | 340 const auto& context_caps = |
| 341 output_surface_->context_provider()->ContextCapabilities(); | 341 output_surface_->context_provider()->ContextCapabilities(); |
| 342 | 342 |
| 343 capabilities_.using_partial_swap = | 343 capabilities_.using_partial_swap = |
| 344 settings_->partial_swap_enabled && context_caps.gpu.post_sub_buffer; | 344 settings_->partial_swap_enabled && context_caps.post_sub_buffer; |
| 345 capabilities_.allow_empty_swap = capabilities_.using_partial_swap || | 345 capabilities_.allow_empty_swap = |
| 346 context_caps.gpu.commit_overlay_planes; | 346 capabilities_.using_partial_swap || context_caps.commit_overlay_planes; |
| 347 | 347 |
| 348 DCHECK(!context_caps.gpu.iosurface || context_caps.gpu.texture_rectangle); | 348 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); |
| 349 | 349 |
| 350 capabilities_.using_egl_image = context_caps.gpu.egl_image_external; | 350 capabilities_.using_egl_image = context_caps.egl_image_external; |
| 351 | 351 |
| 352 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 352 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
| 353 capabilities_.best_texture_format = resource_provider_->best_texture_format(); | 353 capabilities_.best_texture_format = resource_provider_->best_texture_format(); |
| 354 | 354 |
| 355 // The updater can access textures while the GLRenderer is using them. | 355 // The updater can access textures while the GLRenderer is using them. |
| 356 capabilities_.allow_partial_texture_updates = true; | 356 capabilities_.allow_partial_texture_updates = true; |
| 357 | 357 |
| 358 capabilities_.using_image = context_caps.gpu.image; | 358 capabilities_.using_image = context_caps.image; |
| 359 | 359 |
| 360 capabilities_.using_discard_framebuffer = | 360 capabilities_.using_discard_framebuffer = context_caps.discard_framebuffer; |
| 361 context_caps.gpu.discard_framebuffer; | |
| 362 | 361 |
| 363 capabilities_.allow_rasterize_on_demand = true; | 362 capabilities_.allow_rasterize_on_demand = true; |
| 364 | 363 |
| 365 // If MSAA is slow, we want this renderer to behave as though MSAA is not | 364 // If MSAA is slow, we want this renderer to behave as though MSAA is not |
| 366 // available. Set samples to 0 to achieve this. | 365 // available. Set samples to 0 to achieve this. |
| 367 if (context_caps.gpu.msaa_is_slow) | 366 if (context_caps.msaa_is_slow) |
| 368 capabilities_.max_msaa_samples = 0; | 367 capabilities_.max_msaa_samples = 0; |
| 369 else | 368 else |
| 370 capabilities_.max_msaa_samples = context_caps.gpu.max_samples; | 369 capabilities_.max_msaa_samples = context_caps.max_samples; |
| 371 | 370 |
| 372 use_sync_query_ = context_caps.gpu.sync_query; | 371 use_sync_query_ = context_caps.sync_query; |
| 373 use_blend_equation_advanced_ = context_caps.gpu.blend_equation_advanced; | 372 use_blend_equation_advanced_ = context_caps.blend_equation_advanced; |
| 374 use_blend_equation_advanced_coherent_ = | 373 use_blend_equation_advanced_coherent_ = |
| 375 context_caps.gpu.blend_equation_advanced_coherent; | 374 context_caps.blend_equation_advanced_coherent; |
| 376 | 375 |
| 377 InitializeSharedObjects(); | 376 InitializeSharedObjects(); |
| 378 } | 377 } |
| 379 | 378 |
| 380 GLRenderer::~GLRenderer() { | 379 GLRenderer::~GLRenderer() { |
| 381 while (!pending_async_read_pixels_.empty()) { | 380 while (!pending_async_read_pixels_.empty()) { |
| 382 PendingAsyncReadPixels* pending_read = | 381 PendingAsyncReadPixels* pending_read = |
| 383 pending_async_read_pixels_.back().get(); | 382 pending_async_read_pixels_.back().get(); |
| 384 pending_read->finished_read_pixels_callback.Cancel(); | 383 pending_read->finished_read_pixels_callback.Cancel(); |
| 385 pending_async_read_pixels_.pop_back(); | 384 pending_async_read_pixels_.pop_back(); |
| (...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 texture_id = pending_overlay_resources_.back()->texture_id(); | 3636 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3638 } | 3637 } |
| 3639 | 3638 |
| 3640 context_support_->ScheduleOverlayPlane( | 3639 context_support_->ScheduleOverlayPlane( |
| 3641 overlay.plane_z_order, overlay.transform, texture_id, | 3640 overlay.plane_z_order, overlay.transform, texture_id, |
| 3642 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3641 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3643 } | 3642 } |
| 3644 } | 3643 } |
| 3645 | 3644 |
| 3646 } // namespace cc | 3645 } // namespace cc |
| OLD | NEW |