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_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 10 #endif |
11 #include <GLES2/gl2ext.h> | 11 #include <GLES2/gl2ext.h> |
12 #include <GLES2/gl2extchromium.h> | 12 #include <GLES2/gl2extchromium.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/bind_helpers.h" | 18 #include "base/bind_helpers.h" |
19 #include "base/callback.h" | 19 #include "base/callback.h" |
20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "gpu/command_buffer/client/gl_in_process_context.h" | 22 #include "gpu/command_buffer/client/gl_in_process_context.h" |
23 #include "gpu/command_buffer/client/gles2_implementation.h" | 23 #include "gpu/command_buffer/client/gles2_implementation.h" |
24 #include "gpu/command_buffer/client/gles2_lib.h" | 24 #include "gpu/command_buffer/client/gles2_lib.h" |
25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
26 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
27 #include "ui/gl/gl_surface.h" | 27 #include "ui/gl/gl_implementation.h" |
28 | 28 |
29 using gpu::gles2::GLES2Implementation; | 29 using gpu::gles2::GLES2Implementation; |
30 using gpu::GLInProcessContext; | 30 using gpu::GLInProcessContext; |
31 | 31 |
32 namespace webkit { | 32 namespace webkit { |
33 namespace gpu { | 33 namespace gpu { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 const int32 kCommandBufferSize = 1024 * 1024; | 37 const int32 kCommandBufferSize = 1024 * 1024; |
(...skipping 29 matching lines...) Expand all Loading... |
67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = | 67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = |
68 LAZY_INSTANCE_INITIALIZER; | 68 LAZY_INSTANCE_INITIALIZER; |
69 | 69 |
70 } // namespace anonymous | 70 } // namespace anonymous |
71 | 71 |
72 // static | 72 // static |
73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( | 74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( |
75 const blink::WebGraphicsContext3D::Attributes& attributes, | 75 const blink::WebGraphicsContext3D::Attributes& attributes, |
76 gfx::AcceleratedWidget window) { | 76 gfx::AcceleratedWidget window) { |
77 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context; | 77 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); |
78 if (gfx::GLSurface::InitializeOneOff()) { | 78 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
79 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl( | |
80 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); | 79 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); |
81 } | |
82 return context.Pass(); | |
83 } | 80 } |
84 | 81 |
85 // static | 82 // static |
86 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 83 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
87 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 84 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
88 const blink::WebGraphicsContext3D::Attributes& attributes) { | 85 const blink::WebGraphicsContext3D::Attributes& attributes) { |
89 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( | 86 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
90 scoped_ptr< ::gpu::GLInProcessContext>(), | 87 scoped_ptr< ::gpu::GLInProcessContext>(), |
91 attributes, | 88 attributes, |
92 true, | 89 true, |
93 gfx::kNullAcceleratedWidget)) | 90 gfx::kNullAcceleratedWidget)); |
94 .Pass(); | |
95 } | 91 } |
96 | 92 |
97 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 93 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
98 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 94 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
99 scoped_ptr< ::gpu::GLInProcessContext> context, | 95 scoped_ptr< ::gpu::GLInProcessContext> context, |
100 const blink::WebGraphicsContext3D::Attributes& attributes) { | 96 const blink::WebGraphicsContext3D::Attributes& attributes) { |
101 return make_scoped_ptr( | 97 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
102 new WebGraphicsContext3DInProcessCommandBufferImpl( | 98 context.Pass(), |
103 context.Pass(), | 99 attributes, |
104 attributes, | 100 true /* is_offscreen. Not used. */, |
105 true /* is_offscreen. Not used. */, | 101 gfx::kNullAcceleratedWidget /* window. Not used. */)); |
106 gfx::kNullAcceleratedWidget /* window. Not used. */)) | |
107 .Pass(); | |
108 } | 102 } |
109 | 103 |
110 WebGraphicsContext3DInProcessCommandBufferImpl:: | 104 WebGraphicsContext3DInProcessCommandBufferImpl:: |
111 WebGraphicsContext3DInProcessCommandBufferImpl( | 105 WebGraphicsContext3DInProcessCommandBufferImpl( |
112 scoped_ptr< ::gpu::GLInProcessContext> context, | 106 scoped_ptr< ::gpu::GLInProcessContext> context, |
113 const blink::WebGraphicsContext3D::Attributes& attributes, | 107 const blink::WebGraphicsContext3D::Attributes& attributes, |
114 bool is_offscreen, | 108 bool is_offscreen, |
115 gfx::AcceleratedWidget window) | 109 gfx::AcceleratedWidget window) |
116 : is_offscreen_(is_offscreen), | 110 : is_offscreen_(is_offscreen), |
117 window_(window), | 111 window_(window), |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 | 1179 |
1186 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, | 1180 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, |
1187 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, | 1181 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, |
1188 WGC3Denum, WGC3Denum, const void*) | 1182 WGC3Denum, WGC3Denum, const void*) |
1189 | 1183 |
1190 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1184 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
1191 WGC3Denum) | 1185 WGC3Denum) |
1192 | 1186 |
1193 } // namespace gpu | 1187 } // namespace gpu |
1194 } // namespace webkit | 1188 } // namespace webkit |
OLD | NEW |