| 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"); | 143 extensions.count("GL_CHROMIUM_swapbuffers_complete_callback") > 0; |
| 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"); | 148 extensions.count("GL_CHROMIUM_set_visibility") > 0; |
| 149 | 149 |
| 150 if (extensions.count("GL_CHROMIUM_iosurface")) | 150 if (extensions.count("GL_CHROMIUM_iosurface") > 0) |
| 151 DCHECK(extensions.count("GL_ARB_texture_rectangle")); | 151 DCHECK(extensions.count("GL_ARB_texture_rectangle") > 0); |
| 152 | 152 |
| 153 capabilities_.using_gpu_memory_manager = | 153 capabilities_.using_gpu_memory_manager = |
| 154 extensions.count("GL_CHROMIUM_gpu_memory_manager") && | 154 extensions.count("GL_CHROMIUM_gpu_memory_manager") > 0 && |
| 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 = extensions.count("GL_OES_EGL_image_external"); | 159 capabilities_.using_egl_image = |
| 160 extensions.count("GL_OES_EGL_image_external") > 0; |
| 160 | 161 |
| 161 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 162 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
| 162 capabilities_.best_texture_format = resource_provider_->best_texture_format(); | 163 capabilities_.best_texture_format = resource_provider_->best_texture_format(); |
| 163 | 164 |
| 164 // The updater can access textures while the GLRenderer is using them. | 165 // The updater can access textures while the GLRenderer is using them. |
| 165 capabilities_.allow_partial_texture_updates = true; | 166 capabilities_.allow_partial_texture_updates = true; |
| 166 | 167 |
| 167 // Check for texture fast paths. Currently we always use MO8 textures, | 168 // Check for texture fast paths. Currently we always use MO8 textures, |
| 168 // so we only need to avoid POT textures if we have an NPOT fast-path. | 169 // so we only need to avoid POT textures if we have an NPOT fast-path. |
| 169 capabilities_.avoid_pow2_textures = | 170 capabilities_.avoid_pow2_textures = |
| 170 extensions.count("GL_CHROMIUM_fast_NPOT_MO8_textures"); | 171 extensions.count("GL_CHROMIUM_fast_NPOT_MO8_textures") > 0; |
| 171 | 172 |
| 172 capabilities_.using_offscreen_context3d = true; | 173 capabilities_.using_offscreen_context3d = true; |
| 173 | 174 |
| 174 is_using_bind_uniform_ = | 175 is_using_bind_uniform_ = |
| 175 extensions.count("GL_CHROMIUM_bind_uniform_location"); | 176 extensions.count("GL_CHROMIUM_bind_uniform_location") > 0; |
| 176 | 177 |
| 177 // Make sure scissoring starts as disabled. | 178 // Make sure scissoring starts as disabled. |
| 178 GLC(context_, context_->disable(GL_SCISSOR_TEST)); | 179 GLC(context_, context_->disable(GL_SCISSOR_TEST)); |
| 179 DCHECK(!is_scissor_enabled_); | 180 DCHECK(!is_scissor_enabled_); |
| 180 | 181 |
| 181 if (!InitializeSharedObjects()) | 182 if (!InitializeSharedObjects()) |
| 182 return false; | 183 return false; |
| 183 | 184 |
| 184 // Make sure the viewport and context gets initialized, even if it is to zero. | 185 // Make sure the viewport and context gets initialized, even if it is to zero. |
| 185 ViewportChanged(); | 186 ViewportChanged(); |
| (...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 2453 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
| 2453 | 2454 |
| 2454 ReleaseRenderPassTextures(); | 2455 ReleaseRenderPassTextures(); |
| 2455 } | 2456 } |
| 2456 | 2457 |
| 2457 bool GLRenderer::IsContextLost() { | 2458 bool GLRenderer::IsContextLost() { |
| 2458 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 2459 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 2459 } | 2460 } |
| 2460 | 2461 |
| 2461 } // namespace cc | 2462 } // namespace cc |
| OLD | NEW |