| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 real_gl_ = context_->GetImplementation(); | 159 real_gl_ = context_->GetImplementation(); |
| 160 setGLInterface(real_gl_); | 160 setGLInterface(real_gl_); |
| 161 | 161 |
| 162 if (real_gl_ && webgl_context_) | 162 if (real_gl_ && webgl_context_) |
| 163 real_gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); | 163 real_gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); |
| 164 | 164 |
| 165 initialized_ = true; | 165 initialized_ = true; |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool WebGraphicsContext3DInProcessCommandBufferImpl::makeContextCurrent() { | 169 bool WebGraphicsContext3DInProcessCommandBufferImpl::BindToCurrentThread() { |
| 170 if (!MaybeInitializeGL()) | 170 if (!MaybeInitializeGL()) |
| 171 return false; | 171 return false; |
| 172 ::gles2::SetGLContext(GetGLInterface()); | |
| 173 return context_ && !isContextLost(); | 172 return context_ && !isContextLost(); |
| 174 } | 173 } |
| 175 | 174 |
| 176 bool WebGraphicsContext3DInProcessCommandBufferImpl::isContextLost() { | 175 bool WebGraphicsContext3DInProcessCommandBufferImpl::isContextLost() { |
| 177 return context_lost_reason_ != GL_NO_ERROR; | 176 return context_lost_reason_ != GL_NO_ERROR; |
| 178 } | 177 } |
| 179 | 178 |
| 180 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: | 179 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 181 getGraphicsResetStatusARB() { | 180 getGraphicsResetStatusARB() { |
| 182 return context_lost_reason_; | 181 return context_lost_reason_; |
| 183 } | 182 } |
| 184 | 183 |
| 185 ::gpu::ContextSupport* | 184 ::gpu::ContextSupport* |
| 186 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { | 185 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { |
| 187 return real_gl_; | 186 return real_gl_; |
| 188 } | 187 } |
| 189 | 188 |
| 190 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 189 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
| 191 // TODO(kbr): improve the precision here. | 190 // TODO(kbr): improve the precision here. |
| 192 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 191 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 193 if (context_lost_callback_) { | 192 if (context_lost_callback_) { |
| 194 context_lost_callback_->onContextLost(); | 193 context_lost_callback_->onContextLost(); |
| 195 } | 194 } |
| 196 } | 195 } |
| 197 | 196 |
| 198 } // namespace gpu | 197 } // namespace gpu |
| 199 } // namespace webkit | 198 } // namespace webkit |
| OLD | NEW |