| 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_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_impl.h" |
| 6 | 6 |
| 7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| 11 #include "gpu/command_buffer/client/gles2_implementation.h" | 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 12 #include "gpu/command_buffer/client/gles2_lib.h" | 12 #include "gpu/command_buffer/client/gles2_lib.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 14 #include "gpu/command_buffer/common/sync_token.h" |
| 14 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 15 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
| 15 | 16 |
| 16 #include "third_party/khronos/GLES2/gl2.h" | 17 #include "third_party/khronos/GLES2/gl2.h" |
| 17 #ifndef GL_GLEXT_PROTOTYPES | 18 #ifndef GL_GLEXT_PROTOTYPES |
| 18 #define GL_GLEXT_PROTOTYPES 1 | 19 #define GL_GLEXT_PROTOTYPES 1 |
| 19 #endif | 20 #endif |
| 20 #include "third_party/khronos/GLES2/gl2ext.h" | 21 #include "third_party/khronos/GLES2/gl2ext.h" |
| 21 | 22 |
| 22 using blink::WGC3Dbitfield; | 23 using blink::WGC3Dbitfield; |
| 23 using blink::WGC3Dboolean; | 24 using blink::WGC3Dboolean; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == | 207 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == |
| 207 synthetic_errors_.end()) { | 208 synthetic_errors_.end()) { |
| 208 synthetic_errors_.push_back(error); | 209 synthetic_errors_.push_back(error); |
| 209 } | 210 } |
| 210 } | 211 } |
| 211 | 212 |
| 212 uint32_t WebGraphicsContext3DImpl::lastFlushID() { | 213 uint32_t WebGraphicsContext3DImpl::lastFlushID() { |
| 213 return flush_id_; | 214 return flush_id_; |
| 214 } | 215 } |
| 215 | 216 |
| 216 DELEGATE_TO_GL_R(insertSyncPoint, InsertSyncPointCHROMIUM, unsigned int) | 217 bool WebGraphicsContext3DImpl::insertSyncPoint(WGC3Dbyte* sync_token) { |
| 218 const uint32_t sync_point = gl_->InsertSyncPointCHROMIUM(); |
| 219 if (!sync_point) |
| 220 return false; |
| 221 |
| 222 gpu::SyncToken sync_token_data(sync_point); |
| 223 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
| 224 return true; |
| 225 } |
| 217 | 226 |
| 218 DELEGATE_TO_GL_3(reshapeWithScaleFactor, ResizeCHROMIUM, int, int, float) | 227 DELEGATE_TO_GL_3(reshapeWithScaleFactor, ResizeCHROMIUM, int, int, float) |
| 219 | 228 |
| 220 DELEGATE_TO_GL_4R(mapBufferSubDataCHROMIUM, MapBufferSubDataCHROMIUM, WGC3Denum, | 229 DELEGATE_TO_GL_4R(mapBufferSubDataCHROMIUM, MapBufferSubDataCHROMIUM, WGC3Denum, |
| 221 WGC3Dintptr, WGC3Dsizeiptr, WGC3Denum, void*) | 230 WGC3Dintptr, WGC3Dsizeiptr, WGC3Denum, void*) |
| 222 | 231 |
| 223 DELEGATE_TO_GL_1(unmapBufferSubDataCHROMIUM, UnmapBufferSubDataCHROMIUM, | 232 DELEGATE_TO_GL_1(unmapBufferSubDataCHROMIUM, UnmapBufferSubDataCHROMIUM, |
| 224 const void*) | 233 const void*) |
| 225 | 234 |
| 226 DELEGATE_TO_GL_9R(mapTexSubImage2DCHROMIUM, MapTexSubImage2DCHROMIUM, WGC3Denum, | 235 DELEGATE_TO_GL_9R(mapTexSubImage2DCHROMIUM, MapTexSubImage2DCHROMIUM, WGC3Denum, |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 void WebGraphicsContext3DImpl::shallowFlushCHROMIUM() { | 882 void WebGraphicsContext3DImpl::shallowFlushCHROMIUM() { |
| 874 flush_id_ = GenFlushID(); | 883 flush_id_ = GenFlushID(); |
| 875 gl_->ShallowFlushCHROMIUM(); | 884 gl_->ShallowFlushCHROMIUM(); |
| 876 } | 885 } |
| 877 | 886 |
| 878 void WebGraphicsContext3DImpl::shallowFinishCHROMIUM() { | 887 void WebGraphicsContext3DImpl::shallowFinishCHROMIUM() { |
| 879 flush_id_ = GenFlushID(); | 888 flush_id_ = GenFlushID(); |
| 880 gl_->ShallowFinishCHROMIUM(); | 889 gl_->ShallowFinishCHROMIUM(); |
| 881 } | 890 } |
| 882 | 891 |
| 883 DELEGATE_TO_GL_1(waitSyncPoint, WaitSyncPointCHROMIUM, GLuint) | 892 DELEGATE_TO_GL_1(waitSyncToken, WaitSyncTokenCHROMIUM, const WGC3Dbyte*) |
| 884 | 893 |
| 885 void WebGraphicsContext3DImpl::loseContextCHROMIUM( | 894 void WebGraphicsContext3DImpl::loseContextCHROMIUM( |
| 886 WGC3Denum current, WGC3Denum other) { | 895 WGC3Denum current, WGC3Denum other) { |
| 887 gl_->LoseContextCHROMIUM(current, other); | 896 gl_->LoseContextCHROMIUM(current, other); |
| 888 gl_->Flush(); | 897 gl_->Flush(); |
| 889 } | 898 } |
| 890 | 899 |
| 891 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) | 900 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) |
| 892 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, | 901 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, |
| 893 WGC3Denum, const WGC3Dbyte*) | 902 WGC3Denum, const WGC3Dbyte*) |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1279 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1271 break; | 1280 break; |
| 1272 default: | 1281 default: |
| 1273 NOTREACHED(); | 1282 NOTREACHED(); |
| 1274 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; | 1283 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; |
| 1275 break; | 1284 break; |
| 1276 } | 1285 } |
| 1277 } | 1286 } |
| 1278 | 1287 |
| 1279 } // namespace gpu_blink | 1288 } // namespace gpu_blink |
| OLD | NEW |