| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 else | 133 else |
| 134 capabilities_.using_accelerated_painting = false; | 134 capabilities_.using_accelerated_painting = false; |
| 135 | 135 |
| 136 capabilities_.using_partial_swap = | 136 capabilities_.using_partial_swap = |
| 137 Settings().partial_swap_enabled && | 137 Settings().partial_swap_enabled && |
| 138 extensions.count("GL_CHROMIUM_post_sub_buffer"); | 138 extensions.count("GL_CHROMIUM_post_sub_buffer"); |
| 139 | 139 |
| 140 // Use the SwapBuffers callback only with the threaded proxy. | 140 // Use the SwapBuffers callback only with the threaded proxy. |
| 141 if (client_->HasImplThread()) | 141 if (client_->HasImplThread()) |
| 142 capabilities_.using_swap_complete_callback = | 142 capabilities_.using_swap_complete_callback = |
| 143 extensions.count("GL_CHROMIUM_swapbuffers_complete_callback") > 0; | 143 extensions.count("GL_CHROMIUM_swapbuffers_complete_callback"); |
| 144 if (capabilities_.using_swap_complete_callback) | 144 if (capabilities_.using_swap_complete_callback) |
| 145 context_->setSwapBuffersCompleteCallbackCHROMIUM(this); | 145 context_->setSwapBuffersCompleteCallbackCHROMIUM(this); |
| 146 | 146 |
| 147 capabilities_.using_set_visibility = | 147 capabilities_.using_set_visibility = |
| 148 extensions.count("GL_CHROMIUM_set_visibility") > 0; | 148 extensions.count("GL_CHROMIUM_set_visibility"); |
| 149 | 149 |
| 150 if (extensions.count("GL_CHROMIUM_iosurface") > 0) | 150 if (extensions.count("GL_CHROMIUM_iosurface")) |
| 151 DCHECK(extensions.count("GL_ARB_texture_rectangle") > 0); | 151 DCHECK(extensions.count("GL_ARB_texture_rectangle")); |
| 152 | 152 |
| 153 capabilities_.using_gpu_memory_manager = | 153 capabilities_.using_gpu_memory_manager = |
| 154 extensions.count("GL_CHROMIUM_gpu_memory_manager") > 0 && | 154 extensions.count("GL_CHROMIUM_gpu_memory_manager") && |
| 155 Settings().use_memory_management; | 155 Settings().use_memory_management; |
| 156 if (capabilities_.using_gpu_memory_manager) | 156 if (capabilities_.using_gpu_memory_manager) |
| 157 context_->setMemoryAllocationChangedCallbackCHROMIUM(this); | 157 context_->setMemoryAllocationChangedCallbackCHROMIUM(this); |
| 158 | 158 |
| 159 capabilities_.using_egl_image = | 159 capabilities_.using_egl_image = extensions.count("GL_OES_EGL_image_external"); |
| 160 extensions.count("GL_OES_EGL_image_external") > 0; | |
| 161 | 160 |
| 162 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 161 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
| 163 capabilities_.best_texture_format = resource_provider_->best_texture_format(); | 162 capabilities_.best_texture_format = resource_provider_->best_texture_format(); |
| 164 | 163 |
| 165 // The updater can access textures while the GLRenderer is using them. | 164 // The updater can access textures while the GLRenderer is using them. |
| 166 capabilities_.allow_partial_texture_updates = true; | 165 capabilities_.allow_partial_texture_updates = true; |
| 167 | 166 |
| 168 // Check for texture fast paths. Currently we always use MO8 textures, | 167 // Check for texture fast paths. Currently we always use MO8 textures, |
| 169 // so we only need to avoid POT textures if we have an NPOT fast-path. | 168 // so we only need to avoid POT textures if we have an NPOT fast-path. |
| 170 capabilities_.avoid_pow2_textures = | 169 capabilities_.avoid_pow2_textures = |
| 171 extensions.count("GL_CHROMIUM_fast_NPOT_MO8_textures") > 0; | 170 extensions.count("GL_CHROMIUM_fast_NPOT_MO8_textures"); |
| 172 | 171 |
| 173 capabilities_.using_offscreen_context3d = true; | 172 capabilities_.using_offscreen_context3d = true; |
| 174 | 173 |
| 175 is_using_bind_uniform_ = | 174 is_using_bind_uniform_ = |
| 176 extensions.count("GL_CHROMIUM_bind_uniform_location") > 0; | 175 extensions.count("GL_CHROMIUM_bind_uniform_location"); |
| 177 | 176 |
| 178 // Make sure scissoring starts as disabled. | 177 // Make sure scissoring starts as disabled. |
| 179 GLC(context_, context_->disable(GL_SCISSOR_TEST)); | 178 GLC(context_, context_->disable(GL_SCISSOR_TEST)); |
| 180 DCHECK(!is_scissor_enabled_); | 179 DCHECK(!is_scissor_enabled_); |
| 181 | 180 |
| 182 if (!InitializeSharedObjects()) | 181 if (!InitializeSharedObjects()) |
| 183 return false; | 182 return false; |
| 184 | 183 |
| 185 // Make sure the viewport and context gets initialized, even if it is to zero. | 184 // Make sure the viewport and context gets initialized, even if it is to zero. |
| 186 ViewportChanged(); | 185 ViewportChanged(); |
| (...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 2452 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
| 2454 | 2453 |
| 2455 ReleaseRenderPassTextures(); | 2454 ReleaseRenderPassTextures(); |
| 2456 } | 2455 } |
| 2457 | 2456 |
| 2458 bool GLRenderer::IsContextLost() { | 2457 bool GLRenderer::IsContextLost() { |
| 2459 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 2458 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 2460 } | 2459 } |
| 2461 | 2460 |
| 2462 } // namespace cc | 2461 } // namespace cc |
| OLD | NEW |