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