OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef Extensions3DUtil_h | 5 #ifndef Extensions3DUtil_h |
6 #define Extensions3DUtil_h | 6 #define Extensions3DUtil_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/graphics/GraphicsTypes3D.h" | 9 #include "platform/graphics/GraphicsTypes3D.h" |
10 #include "third_party/khronos/GLES2/gl2.h" | 10 #include "third_party/khronos/GLES2/gl2.h" |
11 #include "third_party/khronos/GLES2/gl2ext.h" | 11 #include "third_party/khronos/GLES2/gl2ext.h" |
12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.h" |
13 #include "wtf/HashSet.h" | 13 #include "wtf/HashSet.h" |
14 #include "wtf/Noncopyable.h" | 14 #include "wtf/Noncopyable.h" |
15 #include "wtf/text/StringHash.h" | 15 #include "wtf/text/StringHash.h" |
16 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
17 | 17 |
| 18 namespace gpu { |
| 19 namespace gles2 { |
| 20 class GLES2Interface; |
| 21 } |
| 22 } |
| 23 |
18 namespace blink { | 24 namespace blink { |
19 | 25 |
20 class WebGraphicsContext3D; | 26 class WebGraphicsContext3D; |
21 | 27 |
22 class PLATFORM_EXPORT Extensions3DUtil final { | 28 class PLATFORM_EXPORT Extensions3DUtil final { |
23 USING_FAST_MALLOC(Extensions3DUtil); | 29 USING_FAST_MALLOC(Extensions3DUtil); |
24 WTF_MAKE_NONCOPYABLE(Extensions3DUtil); | 30 WTF_MAKE_NONCOPYABLE(Extensions3DUtil); |
25 public: | 31 public: |
26 // Creates a new Extensions3DUtil. If the passed WebGraphicsContext3D has be
en spontaneously lost, returns null. | 32 // Creates a new Extensions3DUtil. If the passed GLES2Interface has been spo
ntaneously lost, returns null. |
27 static PassOwnPtr<Extensions3DUtil> create(WebGraphicsContext3D*); | 33 static PassOwnPtr<Extensions3DUtil> create(WebGraphicsContext3D*, gpu::gles2
::GLES2Interface*); |
28 ~Extensions3DUtil(); | 34 ~Extensions3DUtil(); |
29 | 35 |
30 bool isValid() { return m_isValid; } | 36 bool isValid() { return m_isValid; } |
31 | 37 |
32 bool supportsExtension(const String& name); | 38 bool supportsExtension(const String& name); |
33 bool ensureExtensionEnabled(const String& name); | 39 bool ensureExtensionEnabled(const String& name); |
34 bool isExtensionEnabled(const String& name); | 40 bool isExtensionEnabled(const String& name); |
35 | 41 |
36 static bool canUseCopyTextureCHROMIUM(GLenum destTarget, GLenum destFormat,
GLenum destType, GLint level); | 42 static bool canUseCopyTextureCHROMIUM(GLenum destTarget, GLenum destFormat,
GLenum destType, GLint level); |
37 | 43 |
38 private: | 44 private: |
39 Extensions3DUtil(WebGraphicsContext3D*); | 45 Extensions3DUtil(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); |
40 void initializeExtensions(); | 46 void initializeExtensions(); |
41 | 47 |
42 WebGraphicsContext3D* m_context; | 48 WebGraphicsContext3D* m_context; |
| 49 gpu::gles2::GLES2Interface* m_gl; |
43 HashSet<String> m_enabledExtensions; | 50 HashSet<String> m_enabledExtensions; |
44 HashSet<String> m_requestableExtensions; | 51 HashSet<String> m_requestableExtensions; |
45 bool m_isValid; | 52 bool m_isValid; |
46 }; | 53 }; |
47 | 54 |
48 } // namespace blink | 55 } // namespace blink |
49 | 56 |
50 #endif // Extensions3DUtil_h | 57 #endif // Extensions3DUtil_h |
OLD | NEW |