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 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "gpu/command_buffer/client/gl_in_process_context.h" | 12 #include "gpu/command_buffer/client/gl_in_process_context.h" |
13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
16 #include "webkit/common/gpu/webgraphicscontext3d_impl.h" | 16 #include "webkit/common/gpu/webgraphicscontext3d_impl.h" |
17 #include "webkit/common/gpu/webkit_gpu_export.h" | 17 #include "webkit/common/gpu/webkit_gpu_export.h" |
18 | 18 |
19 namespace gpu { | 19 namespace gpu { |
20 class ContextSupport; | 20 class ContextSupport; |
21 | 21 |
22 namespace gles2 { | 22 namespace gles2 { |
23 class GLES2Interface; | 23 class GLES2Interface; |
24 class GLES2Implementation; | 24 class GLES2Implementation; |
| 25 struct ContextCreationAttribHelper; |
25 } | 26 } |
26 } | 27 } |
27 | 28 |
28 namespace gpu { | 29 namespace gpu { |
29 class GLInProcessContext; | 30 class GLInProcessContext; |
30 struct GLInProcessContextAttribs; | |
31 } | 31 } |
32 | 32 |
33 namespace webkit { | 33 namespace webkit { |
34 namespace gpu { | 34 namespace gpu { |
35 | 35 |
36 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 36 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
37 : public WebGraphicsContext3DImpl { | 37 : public WebGraphicsContext3DImpl { |
38 public: | 38 public: |
39 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 39 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
40 CreateViewContext( | 40 CreateViewContext( |
41 const blink::WebGraphicsContext3D::Attributes& attributes, | 41 const blink::WebGraphicsContext3D::Attributes& attributes, |
42 bool lose_context_when_out_of_memory, | 42 bool lose_context_when_out_of_memory, |
43 gfx::AcceleratedWidget window); | 43 gfx::AcceleratedWidget window); |
44 | 44 |
45 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 45 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
46 CreateOffscreenContext( | 46 CreateOffscreenContext( |
47 const blink::WebGraphicsContext3D::Attributes& attributes, | 47 const blink::WebGraphicsContext3D::Attributes& attributes, |
48 bool lose_context_when_out_of_memory); | 48 bool lose_context_when_out_of_memory); |
49 | 49 |
50 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 50 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
51 WrapContext( | 51 WrapContext( |
52 scoped_ptr< ::gpu::GLInProcessContext> context, | 52 scoped_ptr< ::gpu::GLInProcessContext> context, |
53 const blink::WebGraphicsContext3D::Attributes& attributes); | 53 const blink::WebGraphicsContext3D::Attributes& attributes); |
54 | 54 |
55 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 55 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
56 | 56 |
57 // Convert WebGL context creation attributes into GLInProcessContext / EGL | |
58 // size requests. | |
59 static void ConvertAttributes( | |
60 const blink::WebGraphicsContext3D::Attributes& attributes, | |
61 ::gpu::GLInProcessContextAttribs* output_attribs); | |
62 | |
63 //---------------------------------------------------------------------- | 57 //---------------------------------------------------------------------- |
64 // WebGraphicsContext3D methods | 58 // WebGraphicsContext3D methods |
65 virtual bool makeContextCurrent(); | 59 virtual bool makeContextCurrent(); |
66 | 60 |
67 virtual bool isContextLost(); | 61 virtual bool isContextLost(); |
68 | 62 |
69 virtual WGC3Denum getGraphicsResetStatusARB(); | 63 virtual WGC3Denum getGraphicsResetStatusARB(); |
70 | 64 |
71 ::gpu::ContextSupport* GetContextSupport(); | 65 ::gpu::ContextSupport* GetContextSupport(); |
72 | 66 |
(...skipping 10 matching lines...) Expand all Loading... |
83 gfx::AcceleratedWidget window); | 77 gfx::AcceleratedWidget window); |
84 | 78 |
85 void OnContextLost(); | 79 void OnContextLost(); |
86 | 80 |
87 bool MaybeInitializeGL(); | 81 bool MaybeInitializeGL(); |
88 | 82 |
89 // Used to try to find bugs in code that calls gl directly through the gl api | 83 // Used to try to find bugs in code that calls gl directly through the gl api |
90 // instead of going through WebGraphicsContext3D. | 84 // instead of going through WebGraphicsContext3D. |
91 void ClearContext(); | 85 void ClearContext(); |
92 | 86 |
93 ::gpu::GLInProcessContextAttribs attribs_; | 87 ::gpu::gles2::ContextCreationAttribHelper attribs_; |
94 bool share_resources_; | 88 bool share_resources_; |
95 bool webgl_context_; | 89 bool webgl_context_; |
96 | 90 |
97 bool is_offscreen_; | 91 bool is_offscreen_; |
98 // Only used when not offscreen. | 92 // Only used when not offscreen. |
99 gfx::AcceleratedWidget window_; | 93 gfx::AcceleratedWidget window_; |
100 | 94 |
101 // The context we use for OpenGL rendering. | 95 // The context we use for OpenGL rendering. |
102 scoped_ptr< ::gpu::GLInProcessContext> context_; | 96 scoped_ptr< ::gpu::GLInProcessContext> context_; |
103 // The GLES2Implementation we use for OpenGL rendering. | 97 // The GLES2Implementation we use for OpenGL rendering. |
104 ::gpu::gles2::GLES2Implementation* real_gl_; | 98 ::gpu::gles2::GLES2Implementation* real_gl_; |
105 }; | 99 }; |
106 | 100 |
107 } // namespace gpu | 101 } // namespace gpu |
108 } // namespace webkit | 102 } // namespace webkit |
109 | 103 |
110 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ | 104 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ |
OLD | NEW |