| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (initialized_) | 141 if (initialized_) |
| 142 return true; | 142 return true; |
| 143 | 143 |
| 144 if (initialize_failed_) | 144 if (initialize_failed_) |
| 145 return false; | 145 return false; |
| 146 | 146 |
| 147 // Ensure the gles2 library is initialized first in a thread safe way. | 147 // Ensure the gles2 library is initialized first in a thread safe way. |
| 148 g_gles2_initializer.Get(); | 148 g_gles2_initializer.Get(); |
| 149 | 149 |
| 150 if (!context_) { | 150 if (!context_) { |
| 151 const char* preferred_extensions = "*"; | |
| 152 | |
| 153 // TODO(kbr): More work will be needed in this implementation to | 151 // TODO(kbr): More work will be needed in this implementation to |
| 154 // properly support GPU switching. Like in the out-of-process | 152 // properly support GPU switching. Like in the out-of-process |
| 155 // command buffer implementation, all previously created contexts | 153 // command buffer implementation, all previously created contexts |
| 156 // will need to be lost either when the first context requesting the | 154 // will need to be lost either when the first context requesting the |
| 157 // discrete GPU is created, or the last one is destroyed. | 155 // discrete GPU is created, or the last one is destroyed. |
| 158 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 156 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 159 | 157 |
| 160 ::gpu::GLInProcessContextAttribs attrib_struct; | 158 ::gpu::GLInProcessContextAttribs attrib_struct; |
| 161 ConvertAttributes(attributes_, &attrib_struct), | 159 ConvertAttributes(attributes_, &attrib_struct), |
| 162 | 160 |
| 163 context_.reset(GLInProcessContext::CreateContext( | 161 context_.reset(GLInProcessContext::CreateContext( |
| 164 is_offscreen_, | 162 is_offscreen_, |
| 165 window_, | 163 window_, |
| 166 gfx::Size(1, 1), | 164 gfx::Size(1, 1), |
| 167 attributes_.shareResources, | 165 attributes_.shareResources, |
| 168 preferred_extensions, | |
| 169 attrib_struct, | 166 attrib_struct, |
| 170 gpu_preference)); | 167 gpu_preference)); |
| 171 } | 168 } |
| 172 | 169 |
| 173 if (context_) { | 170 if (context_) { |
| 174 base::Closure context_lost_callback = base::Bind( | 171 base::Closure context_lost_callback = base::Bind( |
| 175 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost, | 172 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost, |
| 176 base::Unretained(this)); | 173 base::Unretained(this)); |
| 177 context_->SetContextLostCallback(context_lost_callback); | 174 context_->SetContextLostCallback(context_lost_callback); |
| 178 } else { | 175 } else { |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 | 1205 |
| 1209 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, | 1206 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, |
| 1210 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, | 1207 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, |
| 1211 WGC3Denum, WGC3Denum, const void*) | 1208 WGC3Denum, WGC3Denum, const void*) |
| 1212 | 1209 |
| 1213 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1210 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
| 1214 WGC3Denum) | 1211 WGC3Denum) |
| 1215 | 1212 |
| 1216 } // namespace gpu | 1213 } // namespace gpu |
| 1217 } // namespace webkit | 1214 } // namespace webkit |
| OLD | NEW |