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 "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "webkit/common/gpu/webgraphicscontext3d_impl.h" |
15 #include "webkit/common/gpu/webkit_gpu_export.h" | 16 #include "webkit/common/gpu/webkit_gpu_export.h" |
16 | 17 |
17 namespace gpu { | 18 namespace gpu { |
18 class ContextSupport; | 19 class ContextSupport; |
19 | 20 |
20 namespace gles2 { | 21 namespace gles2 { |
21 class GLES2Interface; | 22 class GLES2Interface; |
22 class GLES2Implementation; | 23 class GLES2Implementation; |
23 } | 24 } |
24 } | 25 } |
25 | 26 |
26 using blink::WebGLId; | |
27 | |
28 using blink::WGC3Dbyte; | |
29 using blink::WGC3Dchar; | |
30 using blink::WGC3Denum; | |
31 using blink::WGC3Dboolean; | |
32 using blink::WGC3Dbitfield; | |
33 using blink::WGC3Dint; | |
34 using blink::WGC3Dsizei; | |
35 using blink::WGC3Duint; | |
36 using blink::WGC3Dfloat; | |
37 using blink::WGC3Dclampf; | |
38 using blink::WGC3Dintptr; | |
39 using blink::WGC3Dsizeiptr; | |
40 | |
41 namespace gpu { | 27 namespace gpu { |
42 class GLInProcessContext; | 28 class GLInProcessContext; |
43 struct GLInProcessContextAttribs; | 29 struct GLInProcessContextAttribs; |
44 } | 30 } |
45 | 31 |
46 namespace webkit { | 32 namespace webkit { |
47 namespace gpu { | 33 namespace gpu { |
48 | 34 |
49 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 35 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
50 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { | 36 : public content::WebGraphicsContext3DImpl { |
51 public: | 37 public: |
52 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 38 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
53 CreateViewContext( | 39 CreateViewContext( |
54 const blink::WebGraphicsContext3D::Attributes& attributes, | 40 const blink::WebGraphicsContext3D::Attributes& attributes, |
55 bool lose_context_when_out_of_memory, | 41 bool lose_context_when_out_of_memory, |
56 gfx::AcceleratedWidget window); | 42 gfx::AcceleratedWidget window); |
57 | 43 |
58 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 44 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
59 CreateOffscreenContext( | 45 CreateOffscreenContext( |
60 const blink::WebGraphicsContext3D::Attributes& attributes, | 46 const blink::WebGraphicsContext3D::Attributes& attributes, |
61 bool lose_context_when_out_of_memory); | 47 bool lose_context_when_out_of_memory); |
62 | 48 |
63 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 49 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
64 WrapContext( | 50 WrapContext( |
65 scoped_ptr< ::gpu::GLInProcessContext> context, | 51 scoped_ptr< ::gpu::GLInProcessContext> context, |
66 const blink::WebGraphicsContext3D::Attributes& attributes); | 52 const blink::WebGraphicsContext3D::Attributes& attributes); |
67 | 53 |
68 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 54 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
69 | 55 |
70 // Convert WebGL context creation attributes into GLInProcessContext / EGL | 56 // Convert WebGL context creation attributes into GLInProcessContext / EGL |
71 // size requests. | 57 // size requests. |
72 static void ConvertAttributes( | 58 static void ConvertAttributes( |
73 const blink::WebGraphicsContext3D::Attributes& attributes, | 59 const blink::WebGraphicsContext3D::Attributes& attributes, |
74 ::gpu::GLInProcessContextAttribs* output_attribs); | 60 ::gpu::GLInProcessContextAttribs* output_attribs); |
75 | 61 |
76 //---------------------------------------------------------------------- | 62 //---------------------------------------------------------------------- |
77 // WebGraphicsContext3D methods | 63 // WebGraphicsContext3D methods |
78 virtual bool makeContextCurrent(); | 64 virtual bool makeContextCurrent(); |
79 | 65 |
80 virtual uint32_t lastFlushID(); | |
81 | |
82 virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor); | |
83 | |
84 virtual void prepareTexture(); | |
85 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height); | |
86 | |
87 virtual void activeTexture(WGC3Denum texture); | |
88 virtual void attachShader(WebGLId program, WebGLId shader); | |
89 virtual void bindAttribLocation(WebGLId program, WGC3Duint index, | |
90 const WGC3Dchar* name); | |
91 virtual void bindBuffer(WGC3Denum target, WebGLId buffer); | |
92 virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer); | |
93 virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer); | |
94 virtual void bindTexture(WGC3Denum target, WebGLId texture); | |
95 virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, | |
96 WGC3Dclampf blue, WGC3Dclampf alpha); | |
97 virtual void blendEquation(WGC3Denum mode); | |
98 virtual void blendEquationSeparate(WGC3Denum modeRGB, | |
99 WGC3Denum modeAlpha); | |
100 virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor); | |
101 virtual void blendFuncSeparate(WGC3Denum srcRGB, | |
102 WGC3Denum dstRGB, | |
103 WGC3Denum srcAlpha, | |
104 WGC3Denum dstAlpha); | |
105 | |
106 virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, | |
107 const void* data, WGC3Denum usage); | |
108 virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, | |
109 WGC3Dsizeiptr size, const void* data); | |
110 | |
111 virtual WGC3Denum checkFramebufferStatus(WGC3Denum target); | |
112 virtual void clear(WGC3Dbitfield mask); | |
113 virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, | |
114 WGC3Dclampf blue, WGC3Dclampf alpha); | |
115 virtual void clearDepth(WGC3Dclampf depth); | |
116 virtual void clearStencil(WGC3Dint s); | |
117 virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, | |
118 WGC3Dboolean blue, WGC3Dboolean alpha); | |
119 virtual void compileShader(WebGLId shader); | |
120 | |
121 virtual void compressedTexImage2D(WGC3Denum target, | |
122 WGC3Dint level, | |
123 WGC3Denum internalformat, | |
124 WGC3Dsizei width, | |
125 WGC3Dsizei height, | |
126 WGC3Dint border, | |
127 WGC3Dsizei imageSize, | |
128 const void* data); | |
129 virtual void compressedTexSubImage2D(WGC3Denum target, | |
130 WGC3Dint level, | |
131 WGC3Dint xoffset, | |
132 WGC3Dint yoffset, | |
133 WGC3Dsizei width, | |
134 WGC3Dsizei height, | |
135 WGC3Denum format, | |
136 WGC3Dsizei imageSize, | |
137 const void* data); | |
138 virtual void copyTexImage2D(WGC3Denum target, | |
139 WGC3Dint level, | |
140 WGC3Denum internalformat, | |
141 WGC3Dint x, | |
142 WGC3Dint y, | |
143 WGC3Dsizei width, | |
144 WGC3Dsizei height, | |
145 WGC3Dint border); | |
146 virtual void copyTexSubImage2D(WGC3Denum target, | |
147 WGC3Dint level, | |
148 WGC3Dint xoffset, | |
149 WGC3Dint yoffset, | |
150 WGC3Dint x, | |
151 WGC3Dint y, | |
152 WGC3Dsizei width, | |
153 WGC3Dsizei height); | |
154 virtual void cullFace(WGC3Denum mode); | |
155 virtual void depthFunc(WGC3Denum func); | |
156 virtual void depthMask(WGC3Dboolean flag); | |
157 virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar); | |
158 virtual void detachShader(WebGLId program, WebGLId shader); | |
159 virtual void disable(WGC3Denum cap); | |
160 virtual void disableVertexAttribArray(WGC3Duint index); | |
161 virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count); | |
162 virtual void drawElements(WGC3Denum mode, | |
163 WGC3Dsizei count, | |
164 WGC3Denum type, | |
165 WGC3Dintptr offset); | |
166 | |
167 virtual void enable(WGC3Denum cap); | |
168 virtual void enableVertexAttribArray(WGC3Duint index); | |
169 virtual void finish(); | |
170 virtual void flush(); | |
171 virtual void framebufferRenderbuffer(WGC3Denum target, | |
172 WGC3Denum attachment, | |
173 WGC3Denum renderbuffertarget, | |
174 WebGLId renderbuffer); | |
175 virtual void framebufferTexture2D(WGC3Denum target, | |
176 WGC3Denum attachment, | |
177 WGC3Denum textarget, | |
178 WebGLId texture, | |
179 WGC3Dint level); | |
180 virtual void frontFace(WGC3Denum mode); | |
181 virtual void generateMipmap(WGC3Denum target); | |
182 | |
183 virtual bool getActiveAttrib(WebGLId program, | |
184 WGC3Duint index, | |
185 ActiveInfo&); | |
186 virtual bool getActiveUniform(WebGLId program, | |
187 WGC3Duint index, | |
188 ActiveInfo&); | |
189 | |
190 virtual void getAttachedShaders(WebGLId program, | |
191 WGC3Dsizei maxCount, | |
192 WGC3Dsizei* count, | |
193 WebGLId* shaders); | |
194 | |
195 virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name); | |
196 | |
197 virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value); | |
198 | |
199 virtual void getBufferParameteriv(WGC3Denum target, | |
200 WGC3Denum pname, | |
201 WGC3Dint* value); | |
202 | |
203 virtual Attributes getContextAttributes(); | |
204 | |
205 virtual WGC3Denum getError(); | |
206 | |
207 virtual bool isContextLost(); | 66 virtual bool isContextLost(); |
208 | 67 |
209 virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value); | |
210 | |
211 virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, | |
212 WGC3Denum attachment, | |
213 WGC3Denum pname, | |
214 WGC3Dint* value); | |
215 | |
216 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); | |
217 | |
218 virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value); | |
219 | |
220 virtual blink::WebString getProgramInfoLog(WebGLId program); | |
221 | |
222 virtual void getRenderbufferParameteriv(WGC3Denum target, | |
223 WGC3Denum pname, | |
224 WGC3Dint* value); | |
225 | |
226 virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value); | |
227 | |
228 virtual blink::WebString getShaderInfoLog(WebGLId shader); | |
229 | |
230 virtual void getShaderPrecisionFormat(WGC3Denum shadertype, | |
231 WGC3Denum precisiontype, | |
232 WGC3Dint* range, | |
233 WGC3Dint* precision); | |
234 | |
235 virtual blink::WebString getShaderSource(WebGLId shader); | |
236 virtual blink::WebString getString(WGC3Denum name); | |
237 | |
238 virtual void getTexParameterfv(WGC3Denum target, | |
239 WGC3Denum pname, | |
240 WGC3Dfloat* value); | |
241 virtual void getTexParameteriv(WGC3Denum target, | |
242 WGC3Denum pname, | |
243 WGC3Dint* value); | |
244 | |
245 virtual void getUniformfv(WebGLId program, | |
246 WGC3Dint location, | |
247 WGC3Dfloat* value); | |
248 virtual void getUniformiv(WebGLId program, | |
249 WGC3Dint location, | |
250 WGC3Dint* value); | |
251 | |
252 virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name); | |
253 | |
254 virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, | |
255 WGC3Dfloat* value); | |
256 virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, | |
257 WGC3Dint* value); | |
258 | |
259 virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname); | |
260 | |
261 virtual void hint(WGC3Denum target, WGC3Denum mode); | |
262 virtual WGC3Dboolean isBuffer(WebGLId buffer); | |
263 virtual WGC3Dboolean isEnabled(WGC3Denum cap); | |
264 virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer); | |
265 virtual WGC3Dboolean isProgram(WebGLId program); | |
266 virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer); | |
267 virtual WGC3Dboolean isShader(WebGLId shader); | |
268 virtual WGC3Dboolean isTexture(WebGLId texture); | |
269 virtual void lineWidth(WGC3Dfloat); | |
270 virtual void linkProgram(WebGLId program); | |
271 virtual void pixelStorei(WGC3Denum pname, WGC3Dint param); | |
272 virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units); | |
273 | |
274 virtual void readPixels(WGC3Dint x, | |
275 WGC3Dint y, | |
276 WGC3Dsizei width, | |
277 WGC3Dsizei height, | |
278 WGC3Denum format, | |
279 WGC3Denum type, | |
280 void* pixels); | |
281 | |
282 virtual void releaseShaderCompiler(); | |
283 virtual void renderbufferStorage(WGC3Denum target, | |
284 WGC3Denum internalformat, | |
285 WGC3Dsizei width, | |
286 WGC3Dsizei height); | |
287 virtual void sampleCoverage(WGC3Dfloat value, WGC3Dboolean invert); | |
288 virtual void scissor(WGC3Dint x, WGC3Dint y, | |
289 WGC3Dsizei width, WGC3Dsizei height); | |
290 virtual void shaderSource(WebGLId shader, const WGC3Dchar* string); | |
291 virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask); | |
292 virtual void stencilFuncSeparate(WGC3Denum face, | |
293 WGC3Denum func, | |
294 WGC3Dint ref, | |
295 WGC3Duint mask); | |
296 virtual void stencilMask(WGC3Duint mask); | |
297 virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask); | |
298 virtual void stencilOp(WGC3Denum fail, | |
299 WGC3Denum zfail, | |
300 WGC3Denum zpass); | |
301 virtual void stencilOpSeparate(WGC3Denum face, | |
302 WGC3Denum fail, | |
303 WGC3Denum zfail, | |
304 WGC3Denum zpass); | |
305 | |
306 virtual void texImage2D(WGC3Denum target, | |
307 WGC3Dint level, | |
308 WGC3Denum internalformat, | |
309 WGC3Dsizei width, | |
310 WGC3Dsizei height, | |
311 WGC3Dint border, | |
312 WGC3Denum format, | |
313 WGC3Denum type, | |
314 const void* pixels); | |
315 | |
316 virtual void texParameterf(WGC3Denum target, | |
317 WGC3Denum pname, | |
318 WGC3Dfloat param); | |
319 virtual void texParameteri(WGC3Denum target, | |
320 WGC3Denum pname, | |
321 WGC3Dint param); | |
322 | |
323 virtual void texSubImage2D(WGC3Denum target, | |
324 WGC3Dint level, | |
325 WGC3Dint xoffset, | |
326 WGC3Dint yoffset, | |
327 WGC3Dsizei width, | |
328 WGC3Dsizei height, | |
329 WGC3Denum format, | |
330 WGC3Denum type, | |
331 const void* pixels); | |
332 | |
333 virtual void uniform1f(WGC3Dint location, WGC3Dfloat x); | |
334 virtual void uniform1fv(WGC3Dint location, | |
335 WGC3Dsizei count, const WGC3Dfloat* v); | |
336 virtual void uniform1i(WGC3Dint location, WGC3Dint x); | |
337 virtual void uniform1iv(WGC3Dint location, | |
338 WGC3Dsizei count, const WGC3Dint* v); | |
339 virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y); | |
340 virtual void uniform2fv(WGC3Dint location, | |
341 WGC3Dsizei count, const WGC3Dfloat* v); | |
342 virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y); | |
343 virtual void uniform2iv(WGC3Dint location, | |
344 WGC3Dsizei count, const WGC3Dint* v); | |
345 virtual void uniform3f(WGC3Dint location, | |
346 WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); | |
347 virtual void uniform3fv(WGC3Dint location, | |
348 WGC3Dsizei count, const WGC3Dfloat* v); | |
349 virtual void uniform3i(WGC3Dint location, | |
350 WGC3Dint x, WGC3Dint y, WGC3Dint z); | |
351 virtual void uniform3iv(WGC3Dint location, | |
352 WGC3Dsizei count, const WGC3Dint* v); | |
353 virtual void uniform4f(WGC3Dint location, | |
354 WGC3Dfloat x, WGC3Dfloat y, | |
355 WGC3Dfloat z, WGC3Dfloat w); | |
356 virtual void uniform4fv(WGC3Dint location, | |
357 WGC3Dsizei count, const WGC3Dfloat* v); | |
358 virtual void uniform4i(WGC3Dint location, | |
359 WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w); | |
360 virtual void uniform4iv(WGC3Dint location, | |
361 WGC3Dsizei count, const WGC3Dint* v); | |
362 virtual void uniformMatrix2fv(WGC3Dint location, | |
363 WGC3Dsizei count, | |
364 WGC3Dboolean transpose, | |
365 const WGC3Dfloat* value); | |
366 virtual void uniformMatrix3fv(WGC3Dint location, | |
367 WGC3Dsizei count, | |
368 WGC3Dboolean transpose, | |
369 const WGC3Dfloat* value); | |
370 virtual void uniformMatrix4fv(WGC3Dint location, | |
371 WGC3Dsizei count, | |
372 WGC3Dboolean transpose, | |
373 const WGC3Dfloat* value); | |
374 | |
375 virtual void useProgram(WebGLId program); | |
376 virtual void validateProgram(WebGLId program); | |
377 | |
378 virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x); | |
379 virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values); | |
380 virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y); | |
381 virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values); | |
382 virtual void vertexAttrib3f(WGC3Duint index, | |
383 WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z); | |
384 virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values); | |
385 virtual void vertexAttrib4f(WGC3Duint index, | |
386 WGC3Dfloat x, WGC3Dfloat y, | |
387 WGC3Dfloat z, WGC3Dfloat w); | |
388 virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values); | |
389 virtual void vertexAttribPointer(WGC3Duint index, | |
390 WGC3Dint size, | |
391 WGC3Denum type, | |
392 WGC3Dboolean normalized, | |
393 WGC3Dsizei stride, | |
394 WGC3Dintptr offset); | |
395 | |
396 virtual void viewport(WGC3Dint x, WGC3Dint y, | |
397 WGC3Dsizei width, WGC3Dsizei height); | |
398 | |
399 // Support for buffer creation and deletion | |
400 virtual void genBuffers(WGC3Dsizei count, WebGLId* ids); | |
401 virtual void genFramebuffers(WGC3Dsizei count, WebGLId* ids); | |
402 virtual void genRenderbuffers(WGC3Dsizei count, WebGLId* ids); | |
403 virtual void genTextures(WGC3Dsizei count, WebGLId* ids); | |
404 | |
405 virtual void deleteBuffers(WGC3Dsizei count, WebGLId* ids); | |
406 virtual void deleteFramebuffers(WGC3Dsizei count, WebGLId* ids); | |
407 virtual void deleteRenderbuffers(WGC3Dsizei count, WebGLId* ids); | |
408 virtual void deleteTextures(WGC3Dsizei count, WebGLId* ids); | |
409 | |
410 virtual WebGLId createBuffer(); | |
411 virtual WebGLId createFramebuffer(); | |
412 virtual WebGLId createRenderbuffer(); | |
413 virtual WebGLId createTexture(); | |
414 | |
415 virtual void deleteBuffer(WebGLId); | |
416 virtual void deleteFramebuffer(WebGLId); | |
417 virtual void deleteRenderbuffer(WebGLId); | |
418 virtual void deleteTexture(WebGLId); | |
419 | |
420 virtual WebGLId createProgram(); | |
421 virtual WebGLId createShader(WGC3Denum); | |
422 | |
423 virtual void deleteProgram(WebGLId); | |
424 virtual void deleteShader(WebGLId); | |
425 | |
426 virtual void synthesizeGLError(WGC3Denum); | |
427 | |
428 virtual void* mapBufferSubDataCHROMIUM( | |
429 WGC3Denum target, WGC3Dintptr offset, | |
430 WGC3Dsizeiptr size, WGC3Denum access); | |
431 virtual void unmapBufferSubDataCHROMIUM(const void*); | |
432 virtual void* mapTexSubImage2DCHROMIUM( | |
433 WGC3Denum target, | |
434 WGC3Dint level, | |
435 WGC3Dint xoffset, | |
436 WGC3Dint yoffset, | |
437 WGC3Dsizei width, | |
438 WGC3Dsizei height, | |
439 WGC3Denum format, | |
440 WGC3Denum type, | |
441 WGC3Denum access); | |
442 virtual void unmapTexSubImage2DCHROMIUM(const void*); | |
443 | |
444 virtual void setVisibilityCHROMIUM(bool visible); | |
445 | |
446 virtual void discardFramebufferEXT(WGC3Denum target, | |
447 WGC3Dsizei numAttachments, | |
448 const WGC3Denum* attachments); | |
449 | |
450 virtual void copyTextureToParentTextureCHROMIUM( | |
451 WebGLId texture, WebGLId parentTexture); | |
452 | |
453 virtual blink::WebString getRequestableExtensionsCHROMIUM(); | |
454 virtual void requestExtensionCHROMIUM(const char*); | |
455 | |
456 virtual void blitFramebufferCHROMIUM( | |
457 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, | |
458 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, | |
459 WGC3Dbitfield mask, WGC3Denum filter); | |
460 virtual void renderbufferStorageMultisampleCHROMIUM( | |
461 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, | |
462 WGC3Dsizei width, WGC3Dsizei height); | |
463 | |
464 virtual blink::WebString getTranslatedShaderSourceANGLE(WebGLId shader); | |
465 | |
466 virtual void setContextLostCallback( | |
467 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); | |
468 virtual WGC3Denum getGraphicsResetStatusARB(); | 68 virtual WGC3Denum getGraphicsResetStatusARB(); |
469 | 69 |
470 virtual void texImageIOSurface2DCHROMIUM( | |
471 WGC3Denum target, WGC3Dint width, WGC3Dint height, | |
472 WGC3Duint ioSurfaceId, WGC3Duint plane); | |
473 | |
474 virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId); | |
475 virtual void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId); | |
476 | |
477 virtual void texStorage2DEXT( | |
478 WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, | |
479 WGC3Dint width, WGC3Dint height); | |
480 virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width, | |
481 WGC3Dsizei height, | |
482 WGC3Denum internalformat, | |
483 WGC3Denum usage); | |
484 virtual void destroyImageCHROMIUM(WGC3Duint image_id); | |
485 virtual void getImageParameterivCHROMIUM( | |
486 WGC3Duint image_id, WGC3Denum pname, WGC3Dint* params); | |
487 virtual void* mapImageCHROMIUM(WGC3Duint image_id); | |
488 virtual void unmapImageCHROMIUM(WGC3Duint image_id); | |
489 virtual WebGLId createQueryEXT(); | |
490 virtual void deleteQueryEXT(WebGLId query); | |
491 virtual WGC3Dboolean isQueryEXT(WebGLId query); | |
492 virtual void beginQueryEXT(WGC3Denum target, WebGLId query); | |
493 virtual void endQueryEXT(WGC3Denum target); | |
494 virtual void getQueryivEXT( | |
495 WGC3Denum target, WGC3Denum pname, WGC3Dint* params); | |
496 virtual void getQueryObjectuivEXT( | |
497 WebGLId query, WGC3Denum pname, WGC3Duint* params); | |
498 | |
499 virtual void copyTextureCHROMIUM(WGC3Denum target, WGC3Duint source_id, | |
500 WGC3Duint dest_id, WGC3Dint level, | |
501 WGC3Denum internal_format, | |
502 WGC3Denum dest_type); | |
503 | |
504 virtual void bindUniformLocationCHROMIUM(WebGLId program, WGC3Dint location, | |
505 const WGC3Dchar* uniform); | |
506 | |
507 virtual void shallowFlushCHROMIUM(); | |
508 virtual void shallowFinishCHROMIUM(); | |
509 | |
510 virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox); | |
511 virtual void produceTextureCHROMIUM(WGC3Denum target, | |
512 const WGC3Dbyte* mailbox); | |
513 virtual void consumeTextureCHROMIUM(WGC3Denum target, | |
514 const WGC3Dbyte* mailbox); | |
515 | |
516 virtual void insertEventMarkerEXT(const WGC3Dchar* marker); | |
517 virtual void pushGroupMarkerEXT(const WGC3Dchar* marker); | |
518 virtual void popGroupMarkerEXT(); | |
519 | |
520 virtual void* mapBufferCHROMIUM(WGC3Denum target, WGC3Denum access); | |
521 virtual WGC3Dboolean unmapBufferCHROMIUM(WGC3Denum target); | |
522 | |
523 virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target, | |
524 WGC3Denum attachment, | |
525 WGC3Denum textarget, | |
526 WebGLId texture, | |
527 WGC3Dint level, | |
528 WGC3Dsizei samples); | |
529 virtual void renderbufferStorageMultisampleEXT(WGC3Denum target, | |
530 WGC3Dsizei samples, | |
531 WGC3Denum internalformat, | |
532 WGC3Dsizei width, | |
533 WGC3Dsizei height); | |
534 | |
535 | |
536 // Async pixel transfer functions. | |
537 virtual void asyncTexImage2DCHROMIUM( | |
538 WGC3Denum target, | |
539 WGC3Dint level, | |
540 WGC3Denum internalformat, | |
541 WGC3Dsizei width, | |
542 WGC3Dsizei height, | |
543 WGC3Dint border, | |
544 WGC3Denum format, | |
545 WGC3Denum type, | |
546 const void* pixels); | |
547 virtual void asyncTexSubImage2DCHROMIUM( | |
548 WGC3Denum target, | |
549 WGC3Dint level, | |
550 WGC3Dint xoffset, | |
551 WGC3Dint yoffset, | |
552 WGC3Dsizei width, | |
553 WGC3Dsizei height, | |
554 WGC3Denum format, | |
555 WGC3Denum type, | |
556 const void* pixels); | |
557 virtual void waitAsyncTexImage2DCHROMIUM(WGC3Denum target); | |
558 | |
559 virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs); | |
560 | |
561 virtual unsigned insertSyncPoint(); | |
562 | |
563 virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other); | |
564 | |
565 virtual GrGLInterface* createGrGLInterface(); | |
566 | |
567 ::gpu::gles2::GLES2Interface* GetGLInterface(); | |
568 ::gpu::ContextSupport* GetContextSupport(); | 70 ::gpu::ContextSupport* GetContextSupport(); |
569 | 71 |
570 ::gpu::gles2::GLES2Implementation* GetImplementation() { | 72 ::gpu::gles2::GLES2Implementation* GetImplementation() { |
571 return gl_; | 73 return real_gl_; |
572 } | 74 } |
573 | 75 |
574 private: | 76 private: |
575 WebGraphicsContext3DInProcessCommandBufferImpl( | 77 WebGraphicsContext3DInProcessCommandBufferImpl( |
576 scoped_ptr< ::gpu::GLInProcessContext> context, | 78 scoped_ptr< ::gpu::GLInProcessContext> context, |
577 const blink::WebGraphicsContext3D::Attributes& attributes, | 79 const blink::WebGraphicsContext3D::Attributes& attributes, |
578 bool lose_context_when_out_of_memory, | 80 bool lose_context_when_out_of_memory, |
579 bool is_offscreen, | 81 bool is_offscreen, |
580 gfx::AcceleratedWidget window); | 82 gfx::AcceleratedWidget window); |
581 | 83 |
582 void OnContextLost(); | 84 void OnContextLost(); |
583 | 85 |
584 bool MaybeInitializeGL(); | 86 bool MaybeInitializeGL(); |
585 | 87 |
586 // Used to try to find bugs in code that calls gl directly through the gl api | 88 // Used to try to find bugs in code that calls gl directly through the gl api |
587 // instead of going through WebGraphicsContext3D. | 89 // instead of going through WebGraphicsContext3D. |
588 void ClearContext(); | 90 void ClearContext(); |
589 | 91 |
590 bool is_offscreen_; | 92 bool is_offscreen_; |
591 // Only used when not offscreen. | 93 // Only used when not offscreen. |
592 gfx::AcceleratedWidget window_; | 94 gfx::AcceleratedWidget window_; |
593 | 95 |
594 bool initialized_; | |
595 bool initialize_failed_; | |
596 | |
597 // The context we use for OpenGL rendering. | 96 // The context we use for OpenGL rendering. |
598 scoped_ptr< ::gpu::GLInProcessContext> context_; | 97 scoped_ptr< ::gpu::GLInProcessContext> context_; |
599 // The GLES2Implementation we use for OpenGL rendering. | 98 // The GLES2Implementation we use for OpenGL rendering. |
600 ::gpu::gles2::GLES2Implementation* gl_; | 99 ::gpu::gles2::GLES2Implementation* real_gl_; |
601 | |
602 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | |
603 WGC3Denum context_lost_reason_; | |
604 | |
605 blink::WebGraphicsContext3D::Attributes attributes_; | |
606 bool lose_context_when_out_of_memory_; | |
607 | |
608 // Errors raised by synthesizeGLError(). | |
609 std::vector<WGC3Denum> synthetic_errors_; | |
610 | |
611 uint32_t flush_id_; | |
612 }; | 100 }; |
613 | 101 |
614 } // namespace gpu | 102 } // namespace gpu |
615 } // namespace webkit | 103 } // namespace webkit |
616 | 104 |
617 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ | 105 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ |
OLD | NEW |