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_impl.h" | 5 #include "webkit/common/gpu/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/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 13 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
14 | 14 |
15 #include "third_party/khronos/GLES2/gl2.h" | 15 #include "third_party/khronos/GLES2/gl2.h" |
16 #ifndef GL_GLEXT_PROTOTYPES | 16 #ifndef GL_GLEXT_PROTOTYPES |
17 #define GL_GLEXT_PROTOTYPES 1 | 17 #define GL_GLEXT_PROTOTYPES 1 |
18 #endif | 18 #endif |
19 #include "third_party/khronos/GLES2/gl2ext.h" | 19 #include "third_party/khronos/GLES2/gl2ext.h" |
20 | 20 |
21 namespace content { | 21 namespace webkit { |
| 22 namespace gpu { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 uint32_t GenFlushID() { | 26 uint32_t GenFlushID() { |
26 static base::subtle::Atomic32 flush_id = 0; | 27 static base::subtle::Atomic32 flush_id = 0; |
27 | 28 |
28 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement( | 29 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement( |
29 &flush_id, 1); | 30 &flush_id, 1); |
30 return static_cast<uint32_t>(my_id); | 31 return static_cast<uint32_t>(my_id); |
31 } | 32 } |
32 | 33 |
33 } // namespace anonymous | 34 } // namespace anonymous |
34 | 35 |
35 class WebGraphicsContext3DErrorMessageCallback | 36 class WebGraphicsContext3DErrorMessageCallback |
36 : public gpu::gles2::GLES2ImplementationErrorMessageCallback { | 37 : public ::gpu::gles2::GLES2ImplementationErrorMessageCallback { |
37 public: | 38 public: |
38 WebGraphicsContext3DErrorMessageCallback( | 39 WebGraphicsContext3DErrorMessageCallback( |
39 WebGraphicsContext3DImpl* context) | 40 WebGraphicsContext3DImpl* context) |
40 : graphics_context_(context) { | 41 : graphics_context_(context) { |
41 } | 42 } |
42 | 43 |
43 virtual void OnErrorMessage(const char* msg, int id) OVERRIDE; | 44 virtual void OnErrorMessage(const char* msg, int id) OVERRIDE; |
44 | 45 |
45 private: | 46 private: |
46 WebGraphicsContext3DImpl* graphics_context_; | 47 WebGraphicsContext3DImpl* graphics_context_; |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 937 |
937 DELEGATE_TO_GL_5(renderbufferStorageMultisampleEXT, | 938 DELEGATE_TO_GL_5(renderbufferStorageMultisampleEXT, |
938 RenderbufferStorageMultisampleEXT, WGC3Denum, WGC3Dsizei, | 939 RenderbufferStorageMultisampleEXT, WGC3Denum, WGC3Dsizei, |
939 WGC3Denum, WGC3Dsizei, WGC3Dsizei) | 940 WGC3Denum, WGC3Dsizei, WGC3Dsizei) |
940 | 941 |
941 GrGLInterface* WebGraphicsContext3DImpl::createGrGLInterface() { | 942 GrGLInterface* WebGraphicsContext3DImpl::createGrGLInterface() { |
942 makeContextCurrent(); | 943 makeContextCurrent(); |
943 return skia_bindings::CreateCommandBufferSkiaGLBinding(); | 944 return skia_bindings::CreateCommandBufferSkiaGLBinding(); |
944 } | 945 } |
945 | 946 |
946 gpu::gles2::GLES2ImplementationErrorMessageCallback* | 947 ::gpu::gles2::GLES2ImplementationErrorMessageCallback* |
947 WebGraphicsContext3DImpl::getErrorMessageCallback() { | 948 WebGraphicsContext3DImpl::getErrorMessageCallback() { |
948 if (!client_error_message_callback_) { | 949 if (!client_error_message_callback_) { |
949 client_error_message_callback_.reset( | 950 client_error_message_callback_.reset( |
950 new WebGraphicsContext3DErrorMessageCallback(this)); | 951 new WebGraphicsContext3DErrorMessageCallback(this)); |
951 } | 952 } |
952 return client_error_message_callback_.get(); | 953 return client_error_message_callback_.get(); |
953 } | 954 } |
954 | 955 |
955 void WebGraphicsContext3DImpl::OnErrorMessage( | 956 void WebGraphicsContext3DImpl::OnErrorMessage( |
956 const std::string& message, int id) { | 957 const std::string& message, int id) { |
(...skipping 19 matching lines...) Expand all Loading... |
976 } | 977 } |
977 | 978 |
978 void WebGraphicsContext3DImpl::copyTextureToParentTextureCHROMIUM( | 979 void WebGraphicsContext3DImpl::copyTextureToParentTextureCHROMIUM( |
979 WebGLId texture, WebGLId parentTexture) { | 980 WebGLId texture, WebGLId parentTexture) { |
980 NOTIMPLEMENTED(); | 981 NOTIMPLEMENTED(); |
981 } | 982 } |
982 | 983 |
983 void WebGraphicsContext3DImpl::releaseShaderCompiler() { | 984 void WebGraphicsContext3DImpl::releaseShaderCompiler() { |
984 } | 985 } |
985 | 986 |
986 } // namespace content | 987 } // namespace gpu |
| 988 } // namespace webkit |
OLD | NEW |