| 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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "gpu/blink/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 WebGraphicsContext3DInProcessCommandBufferImpl:: | 77 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 78 WebGraphicsContext3DInProcessCommandBufferImpl( | 78 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 79 scoped_ptr< ::gpu::GLInProcessContext> context, | 79 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 80 const blink::WebGraphicsContext3D::Attributes& attributes, | 80 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 81 bool lose_context_when_out_of_memory, | 81 bool lose_context_when_out_of_memory, |
| 82 bool is_offscreen, | 82 bool is_offscreen, |
| 83 gfx::AcceleratedWidget window) | 83 gfx::AcceleratedWidget window) |
| 84 : share_resources_(attributes.shareResources), | 84 : share_resources_(attributes.shareResources), |
| 85 webgl_context_(attributes.webGL), | |
| 86 is_offscreen_(is_offscreen), | 85 is_offscreen_(is_offscreen), |
| 87 window_(window), | 86 window_(window), |
| 88 context_(context.Pass()) { | 87 context_(context.Pass()) { |
| 89 ConvertAttributes(attributes, &attribs_); | 88 ConvertAttributes(attributes, &attribs_); |
| 90 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory; | 89 attribs_.lose_context_when_out_of_memory = lose_context_when_out_of_memory; |
| 91 } | 90 } |
| 92 | 91 |
| 93 WebGraphicsContext3DInProcessCommandBufferImpl:: | 92 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 94 ~WebGraphicsContext3DInProcessCommandBufferImpl() { | 93 ~WebGraphicsContext3DInProcessCommandBufferImpl() { |
| 95 } | 94 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 base::Unretained(this)); | 132 base::Unretained(this)); |
| 134 context_->SetContextLostCallback(context_lost_callback); | 133 context_->SetContextLostCallback(context_lost_callback); |
| 135 } else { | 134 } else { |
| 136 initialize_failed_ = true; | 135 initialize_failed_ = true; |
| 137 return false; | 136 return false; |
| 138 } | 137 } |
| 139 | 138 |
| 140 real_gl_ = context_->GetImplementation(); | 139 real_gl_ = context_->GetImplementation(); |
| 141 setGLInterface(real_gl_); | 140 setGLInterface(real_gl_); |
| 142 | 141 |
| 143 if (real_gl_ && webgl_context_) | |
| 144 real_gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); | |
| 145 | |
| 146 initialized_ = true; | 142 initialized_ = true; |
| 147 return true; | 143 return true; |
| 148 } | 144 } |
| 149 | 145 |
| 150 bool | 146 bool |
| 151 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { | 147 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { |
| 152 if (!MaybeInitializeGL()) | 148 if (!MaybeInitializeGL()) |
| 153 return false; | 149 return false; |
| 154 return context_ && !isContextLost(); | 150 return context_ && !isContextLost(); |
| 155 } | 151 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 174 | 170 |
| 175 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 171 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
| 176 // TODO(kbr): improve the precision here. | 172 // TODO(kbr): improve the precision here. |
| 177 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 173 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 178 if (context_lost_callback_) { | 174 if (context_lost_callback_) { |
| 179 context_lost_callback_->onContextLost(); | 175 context_lost_callback_->onContextLost(); |
| 180 } | 176 } |
| 181 } | 177 } |
| 182 | 178 |
| 183 } // namespace gpu_blink | 179 } // namespace gpu_blink |
| OLD | NEW |