cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / gpu / blink / webgraphicscontext3d_impl.h
blob51c162a8b5cf40e438517a3a56434ec1cd217e13
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
3 // found in the LICENSE file.
5 #ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
6 #define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "gpu/blink/gpu_blink_export.h"
14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
15 #include "third_party/WebKit/public/platform/WebString.h"
17 namespace gpu {
19 namespace gles2 {
20 class GLES2Interface;
21 class GLES2ImplementationErrorMessageCallback;
22 struct ContextCreationAttribHelper;
26 namespace gpu_blink {
28 class WebGraphicsContext3DErrorMessageCallback;
30 class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
31 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) {
32 public:
33 virtual ~WebGraphicsContext3DImpl();
35 //----------------------------------------------------------------------
36 // WebGraphicsContext3D methods
38 virtual uint32_t lastFlushID();
40 virtual unsigned int insertSyncPoint();
41 virtual void waitSyncPoint(unsigned int sync_point);
43 virtual void loseContextCHROMIUM(blink::WGC3Denum current,
44 blink::WGC3Denum other);
46 virtual void reshapeWithScaleFactor(
47 int width, int height, float scale_factor);
49 virtual void prepareTexture();
50 virtual void postSubBufferCHROMIUM(int x, int y, int width, int height);
52 virtual void activeTexture(blink::WGC3Denum texture);
53 virtual void attachShader(blink::WebGLId program, blink::WebGLId shader);
54 virtual void bindAttribLocation(blink::WebGLId program,
55 blink::WGC3Duint index,
56 const blink::WGC3Dchar* name);
57 virtual void bindBuffer(blink::WGC3Denum target, blink::WebGLId buffer);
58 virtual void bindFramebuffer(blink::WGC3Denum target,
59 blink::WebGLId framebuffer);
60 virtual void bindRenderbuffer(blink::WGC3Denum target,
61 blink::WebGLId renderbuffer);
62 virtual void bindTexture(blink::WGC3Denum target, blink::WebGLId texture);
63 virtual void blendColor(blink::WGC3Dclampf red,
64 blink::WGC3Dclampf green,
65 blink::WGC3Dclampf blue,
66 blink::WGC3Dclampf alpha);
67 virtual void blendEquation(blink::WGC3Denum mode);
68 virtual void blendEquationSeparate(blink::WGC3Denum modeRGB,
69 blink::WGC3Denum modeAlpha);
70 virtual void blendFunc(blink::WGC3Denum sfactor, blink::WGC3Denum dfactor);
71 virtual void blendFuncSeparate(blink::WGC3Denum srcRGB,
72 blink::WGC3Denum dstRGB,
73 blink::WGC3Denum srcAlpha,
74 blink::WGC3Denum dstAlpha);
76 virtual void bufferData(blink::WGC3Denum target,
77 blink::WGC3Dsizeiptr size,
78 const void* data,
79 blink::WGC3Denum usage);
80 virtual void bufferSubData(blink::WGC3Denum target,
81 blink::WGC3Dintptr offset,
82 blink::WGC3Dsizeiptr size,
83 const void* data);
85 virtual blink::WGC3Denum checkFramebufferStatus(blink::WGC3Denum target);
86 virtual void clear(blink::WGC3Dbitfield mask);
87 virtual void clearColor(blink::WGC3Dclampf red,
88 blink::WGC3Dclampf green,
89 blink::WGC3Dclampf blue,
90 blink::WGC3Dclampf alpha);
91 virtual void clearDepth(blink::WGC3Dclampf depth);
92 virtual void clearStencil(blink::WGC3Dint s);
93 virtual void colorMask(blink::WGC3Dboolean red,
94 blink::WGC3Dboolean green,
95 blink::WGC3Dboolean blue,
96 blink::WGC3Dboolean alpha);
97 virtual void compileShader(blink::WebGLId shader);
99 virtual void compressedTexImage2D(blink::WGC3Denum target,
100 blink::WGC3Dint level,
101 blink::WGC3Denum internalformat,
102 blink::WGC3Dsizei width,
103 blink::WGC3Dsizei height,
104 blink::WGC3Dint border,
105 blink::WGC3Dsizei imageSize,
106 const void* data);
107 virtual void compressedTexSubImage2D(blink::WGC3Denum target,
108 blink::WGC3Dint level,
109 blink::WGC3Dint xoffset,
110 blink::WGC3Dint yoffset,
111 blink::WGC3Dsizei width,
112 blink::WGC3Dsizei height,
113 blink::WGC3Denum format,
114 blink::WGC3Dsizei imageSize,
115 const void* data);
116 virtual void copyTexImage2D(blink::WGC3Denum target,
117 blink::WGC3Dint level,
118 blink::WGC3Denum internalformat,
119 blink::WGC3Dint x,
120 blink::WGC3Dint y,
121 blink::WGC3Dsizei width,
122 blink::WGC3Dsizei height,
123 blink::WGC3Dint border);
124 virtual void copyTexSubImage2D(blink::WGC3Denum target,
125 blink::WGC3Dint level,
126 blink::WGC3Dint xoffset,
127 blink::WGC3Dint yoffset,
128 blink::WGC3Dint x,
129 blink::WGC3Dint y,
130 blink::WGC3Dsizei width,
131 blink::WGC3Dsizei height);
132 virtual void cullFace(blink::WGC3Denum mode);
133 virtual void depthFunc(blink::WGC3Denum func);
134 virtual void depthMask(blink::WGC3Dboolean flag);
135 virtual void depthRange(blink::WGC3Dclampf zNear, blink::WGC3Dclampf zFar);
136 virtual void detachShader(blink::WebGLId program, blink::WebGLId shader);
137 virtual void disable(blink::WGC3Denum cap);
138 virtual void disableVertexAttribArray(blink::WGC3Duint index);
139 virtual void drawArrays(blink::WGC3Denum mode,
140 blink::WGC3Dint first,
141 blink::WGC3Dsizei count);
142 virtual void drawElements(blink::WGC3Denum mode,
143 blink::WGC3Dsizei count,
144 blink::WGC3Denum type,
145 blink::WGC3Dintptr offset);
147 virtual void enable(blink::WGC3Denum cap);
148 virtual void enableVertexAttribArray(blink::WGC3Duint index);
149 virtual void finish();
150 virtual void flush();
151 virtual void framebufferRenderbuffer(blink::WGC3Denum target,
152 blink::WGC3Denum attachment,
153 blink::WGC3Denum renderbuffertarget,
154 blink::WebGLId renderbuffer);
155 virtual void framebufferTexture2D(blink::WGC3Denum target,
156 blink::WGC3Denum attachment,
157 blink::WGC3Denum textarget,
158 blink::WebGLId texture,
159 blink::WGC3Dint level);
160 virtual void frontFace(blink::WGC3Denum mode);
161 virtual void generateMipmap(blink::WGC3Denum target);
163 virtual bool getActiveAttrib(blink::WebGLId program,
164 blink::WGC3Duint index,
165 ActiveInfo&);
166 virtual bool getActiveUniform(blink::WebGLId program,
167 blink::WGC3Duint index,
168 ActiveInfo&);
170 virtual void getAttachedShaders(blink::WebGLId program,
171 blink::WGC3Dsizei maxCount,
172 blink::WGC3Dsizei* count,
173 blink::WebGLId* shaders);
175 virtual blink::WGC3Dint getAttribLocation(blink::WebGLId program,
176 const blink::WGC3Dchar* name);
178 virtual void getBooleanv(blink::WGC3Denum pname, blink::WGC3Dboolean* value);
180 virtual void getBufferParameteriv(blink::WGC3Denum target,
181 blink::WGC3Denum pname,
182 blink::WGC3Dint* value);
184 virtual blink::WGC3Denum getError();
186 virtual void getFloatv(blink::WGC3Denum pname, blink::WGC3Dfloat* value);
188 virtual void getFramebufferAttachmentParameteriv(blink::WGC3Denum target,
189 blink::WGC3Denum attachment,
190 blink::WGC3Denum pname,
191 blink::WGC3Dint* value);
193 virtual void getIntegerv(blink::WGC3Denum pname, blink::WGC3Dint* value);
195 virtual void getInteger64v(blink::WGC3Denum pname, blink::WGC3Dint64* value);
197 virtual void getProgramiv(blink::WebGLId program,
198 blink::WGC3Denum pname,
199 blink::WGC3Dint* value);
201 virtual blink::WebString getProgramInfoLog(blink::WebGLId program);
203 virtual void getRenderbufferParameteriv(blink::WGC3Denum target,
204 blink::WGC3Denum pname,
205 blink::WGC3Dint* value);
207 virtual void getShaderiv(blink::WebGLId shader,
208 blink::WGC3Denum pname,
209 blink::WGC3Dint* value);
211 virtual blink::WebString getShaderInfoLog(blink::WebGLId shader);
213 virtual void getShaderPrecisionFormat(blink::WGC3Denum shadertype,
214 blink::WGC3Denum precisiontype,
215 blink::WGC3Dint* range,
216 blink::WGC3Dint* precision);
218 virtual blink::WebString getShaderSource(blink::WebGLId shader);
219 virtual blink::WebString getString(blink::WGC3Denum name);
221 virtual void getTexParameterfv(blink::WGC3Denum target,
222 blink::WGC3Denum pname,
223 blink::WGC3Dfloat* value);
224 virtual void getTexParameteriv(blink::WGC3Denum target,
225 blink::WGC3Denum pname,
226 blink::WGC3Dint* value);
228 virtual void getUniformfv(blink::WebGLId program,
229 blink::WGC3Dint location,
230 blink::WGC3Dfloat* value);
231 virtual void getUniformiv(blink::WebGLId program,
232 blink::WGC3Dint location,
233 blink::WGC3Dint* value);
235 virtual blink::WGC3Dint getUniformLocation(blink::WebGLId program,
236 const blink::WGC3Dchar* name);
238 virtual void getVertexAttribfv(blink::WGC3Duint index,
239 blink::WGC3Denum pname,
240 blink::WGC3Dfloat* value);
241 virtual void getVertexAttribiv(blink::WGC3Duint index,
242 blink::WGC3Denum pname,
243 blink::WGC3Dint* value);
245 virtual blink::WGC3Dsizeiptr getVertexAttribOffset(blink::WGC3Duint index,
246 blink::WGC3Denum pname);
248 virtual void hint(blink::WGC3Denum target, blink::WGC3Denum mode);
249 virtual blink::WGC3Dboolean isBuffer(blink::WebGLId buffer);
250 virtual blink::WGC3Dboolean isEnabled(blink::WGC3Denum cap);
251 virtual blink::WGC3Dboolean isFramebuffer(blink::WebGLId framebuffer);
252 virtual blink::WGC3Dboolean isProgram(blink::WebGLId program);
253 virtual blink::WGC3Dboolean isRenderbuffer(blink::WebGLId renderbuffer);
254 virtual blink::WGC3Dboolean isShader(blink::WebGLId shader);
255 virtual blink::WGC3Dboolean isTexture(blink::WebGLId texture);
256 virtual void lineWidth(blink::WGC3Dfloat);
257 virtual void linkProgram(blink::WebGLId program);
258 virtual void pixelStorei(blink::WGC3Denum pname, blink::WGC3Dint param);
259 virtual void polygonOffset(blink::WGC3Dfloat factor, blink::WGC3Dfloat units);
261 virtual void readPixels(blink::WGC3Dint x,
262 blink::WGC3Dint y,
263 blink::WGC3Dsizei width,
264 blink::WGC3Dsizei height,
265 blink::WGC3Denum format,
266 blink::WGC3Denum type,
267 void* pixels);
269 virtual void releaseShaderCompiler();
270 virtual void renderbufferStorage(blink::WGC3Denum target,
271 blink::WGC3Denum internalformat,
272 blink::WGC3Dsizei width,
273 blink::WGC3Dsizei height);
274 virtual void sampleCoverage(blink::WGC3Dfloat value,
275 blink::WGC3Dboolean invert);
276 virtual void scissor(blink::WGC3Dint x,
277 blink::WGC3Dint y,
278 blink::WGC3Dsizei width,
279 blink::WGC3Dsizei height);
280 virtual void shaderSource(blink::WebGLId shader,
281 const blink::WGC3Dchar* string);
282 virtual void stencilFunc(blink::WGC3Denum func,
283 blink::WGC3Dint ref,
284 blink::WGC3Duint mask);
285 virtual void stencilFuncSeparate(blink::WGC3Denum face,
286 blink::WGC3Denum func,
287 blink::WGC3Dint ref,
288 blink::WGC3Duint mask);
289 virtual void stencilMask(blink::WGC3Duint mask);
290 virtual void stencilMaskSeparate(blink::WGC3Denum face,
291 blink::WGC3Duint mask);
292 virtual void stencilOp(blink::WGC3Denum fail,
293 blink::WGC3Denum zfail,
294 blink::WGC3Denum zpass);
295 virtual void stencilOpSeparate(blink::WGC3Denum face,
296 blink::WGC3Denum fail,
297 blink::WGC3Denum zfail,
298 blink::WGC3Denum zpass);
300 virtual void texImage2D(blink::WGC3Denum target,
301 blink::WGC3Dint level,
302 blink::WGC3Denum internalformat,
303 blink::WGC3Dsizei width,
304 blink::WGC3Dsizei height,
305 blink::WGC3Dint border,
306 blink::WGC3Denum format,
307 blink::WGC3Denum type,
308 const void* pixels);
310 virtual void texParameterf(blink::WGC3Denum target,
311 blink::WGC3Denum pname,
312 blink::WGC3Dfloat param);
313 virtual void texParameteri(blink::WGC3Denum target,
314 blink::WGC3Denum pname,
315 blink::WGC3Dint param);
317 virtual void texSubImage2D(blink::WGC3Denum target,
318 blink::WGC3Dint level,
319 blink::WGC3Dint xoffset,
320 blink::WGC3Dint yoffset,
321 blink::WGC3Dsizei width,
322 blink::WGC3Dsizei height,
323 blink::WGC3Denum format,
324 blink::WGC3Denum type,
325 const void* pixels);
327 virtual void uniform1f(blink::WGC3Dint location, blink::WGC3Dfloat x);
328 virtual void uniform1fv(blink::WGC3Dint location,
329 blink::WGC3Dsizei count,
330 const blink::WGC3Dfloat* v);
331 virtual void uniform1i(blink::WGC3Dint location, blink::WGC3Dint x);
332 virtual void uniform1iv(blink::WGC3Dint location,
333 blink::WGC3Dsizei count,
334 const blink::WGC3Dint* v);
335 virtual void uniform2f(blink::WGC3Dint location,
336 blink::WGC3Dfloat x,
337 blink::WGC3Dfloat y);
338 virtual void uniform2fv(blink::WGC3Dint location,
339 blink::WGC3Dsizei count,
340 const blink::WGC3Dfloat* v);
341 virtual void uniform2i(blink::WGC3Dint location,
342 blink::WGC3Dint x,
343 blink::WGC3Dint y);
344 virtual void uniform2iv(blink::WGC3Dint location,
345 blink::WGC3Dsizei count,
346 const blink::WGC3Dint* v);
347 virtual void uniform3f(blink::WGC3Dint location,
348 blink::WGC3Dfloat x,
349 blink::WGC3Dfloat y,
350 blink::WGC3Dfloat z);
351 virtual void uniform3fv(blink::WGC3Dint location,
352 blink::WGC3Dsizei count,
353 const blink::WGC3Dfloat* v);
354 virtual void uniform3i(blink::WGC3Dint location,
355 blink::WGC3Dint x,
356 blink::WGC3Dint y,
357 blink::WGC3Dint z);
358 virtual void uniform3iv(blink::WGC3Dint location,
359 blink::WGC3Dsizei count,
360 const blink::WGC3Dint* v);
361 virtual void uniform4f(blink::WGC3Dint location,
362 blink::WGC3Dfloat x,
363 blink::WGC3Dfloat y,
364 blink::WGC3Dfloat z,
365 blink::WGC3Dfloat w);
366 virtual void uniform4fv(blink::WGC3Dint location,
367 blink::WGC3Dsizei count,
368 const blink::WGC3Dfloat* v);
369 virtual void uniform4i(blink::WGC3Dint location,
370 blink::WGC3Dint x,
371 blink::WGC3Dint y,
372 blink::WGC3Dint z,
373 blink::WGC3Dint w);
374 virtual void uniform4iv(blink::WGC3Dint location,
375 blink::WGC3Dsizei count,
376 const blink::WGC3Dint* v);
377 virtual void uniformMatrix2fv(blink::WGC3Dint location,
378 blink::WGC3Dsizei count,
379 blink::WGC3Dboolean transpose,
380 const blink::WGC3Dfloat* value);
381 virtual void uniformMatrix3fv(blink::WGC3Dint location,
382 blink::WGC3Dsizei count,
383 blink::WGC3Dboolean transpose,
384 const blink::WGC3Dfloat* value);
385 virtual void uniformMatrix4fv(blink::WGC3Dint location,
386 blink::WGC3Dsizei count,
387 blink::WGC3Dboolean transpose,
388 const blink::WGC3Dfloat* value);
390 virtual void useProgram(blink::WebGLId program);
391 virtual void validateProgram(blink::WebGLId program);
393 virtual void vertexAttrib1f(blink::WGC3Duint index, blink::WGC3Dfloat x);
394 virtual void vertexAttrib1fv(blink::WGC3Duint index,
395 const blink::WGC3Dfloat* values);
396 virtual void vertexAttrib2f(blink::WGC3Duint index,
397 blink::WGC3Dfloat x,
398 blink::WGC3Dfloat y);
399 virtual void vertexAttrib2fv(blink::WGC3Duint index,
400 const blink::WGC3Dfloat* values);
401 virtual void vertexAttrib3f(blink::WGC3Duint index,
402 blink::WGC3Dfloat x,
403 blink::WGC3Dfloat y,
404 blink::WGC3Dfloat z);
405 virtual void vertexAttrib3fv(blink::WGC3Duint index,
406 const blink::WGC3Dfloat* values);
407 virtual void vertexAttrib4f(blink::WGC3Duint index,
408 blink::WGC3Dfloat x,
409 blink::WGC3Dfloat y,
410 blink::WGC3Dfloat z,
411 blink::WGC3Dfloat w);
412 virtual void vertexAttrib4fv(blink::WGC3Duint index,
413 const blink::WGC3Dfloat* values);
414 virtual void vertexAttribPointer(blink::WGC3Duint index,
415 blink::WGC3Dint size,
416 blink::WGC3Denum type,
417 blink::WGC3Dboolean normalized,
418 blink::WGC3Dsizei stride,
419 blink::WGC3Dintptr offset);
421 virtual void viewport(blink::WGC3Dint x,
422 blink::WGC3Dint y,
423 blink::WGC3Dsizei width,
424 blink::WGC3Dsizei height);
426 virtual blink::WebGLId createBuffer();
427 virtual blink::WebGLId createFramebuffer();
428 virtual blink::WebGLId createRenderbuffer();
429 virtual blink::WebGLId createTexture();
431 virtual void deleteBuffer(blink::WebGLId);
432 virtual void deleteFramebuffer(blink::WebGLId);
433 virtual void deleteRenderbuffer(blink::WebGLId);
434 virtual void deleteTexture(blink::WebGLId);
436 virtual blink::WebGLId createProgram();
437 virtual blink::WebGLId createShader(blink::WGC3Denum);
439 virtual void deleteProgram(blink::WebGLId);
440 virtual void deleteShader(blink::WebGLId);
442 virtual void synthesizeGLError(blink::WGC3Denum);
444 virtual void* mapBufferSubDataCHROMIUM(blink::WGC3Denum target,
445 blink::WGC3Dintptr offset,
446 blink::WGC3Dsizeiptr size,
447 blink::WGC3Denum access);
448 virtual void unmapBufferSubDataCHROMIUM(const void*);
449 virtual void* mapTexSubImage2DCHROMIUM(blink::WGC3Denum target,
450 blink::WGC3Dint level,
451 blink::WGC3Dint xoffset,
452 blink::WGC3Dint yoffset,
453 blink::WGC3Dsizei width,
454 blink::WGC3Dsizei height,
455 blink::WGC3Denum format,
456 blink::WGC3Denum type,
457 blink::WGC3Denum access);
458 virtual void unmapTexSubImage2DCHROMIUM(const void*);
460 virtual void setVisibilityCHROMIUM(bool visible);
462 virtual void discardFramebufferEXT(blink::WGC3Denum target,
463 blink::WGC3Dsizei numAttachments,
464 const blink::WGC3Denum* attachments);
465 virtual void copyTextureToParentTextureCHROMIUM(blink::WebGLId texture,
466 blink::WebGLId parentTexture);
468 virtual blink::WebString getRequestableExtensionsCHROMIUM();
469 virtual void requestExtensionCHROMIUM(const char*);
471 virtual void blitFramebufferCHROMIUM(blink::WGC3Dint srcX0,
472 blink::WGC3Dint srcY0,
473 blink::WGC3Dint srcX1,
474 blink::WGC3Dint srcY1,
475 blink::WGC3Dint dstX0,
476 blink::WGC3Dint dstY0,
477 blink::WGC3Dint dstX1,
478 blink::WGC3Dint dstY1,
479 blink::WGC3Dbitfield mask,
480 blink::WGC3Denum filter);
481 virtual void renderbufferStorageMultisampleCHROMIUM(
482 blink::WGC3Denum target,
483 blink::WGC3Dsizei samples,
484 blink::WGC3Denum internalformat,
485 blink::WGC3Dsizei width,
486 blink::WGC3Dsizei height);
488 virtual blink::WebString getTranslatedShaderSourceANGLE(
489 blink::WebGLId shader);
491 virtual void setContextLostCallback(
492 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback);
494 virtual void setErrorMessageCallback(
495 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* callback);
497 virtual void texImageIOSurface2DCHROMIUM(blink::WGC3Denum target,
498 blink::WGC3Dint width,
499 blink::WGC3Dint height,
500 blink::WGC3Duint ioSurfaceId,
501 blink::WGC3Duint plane);
503 virtual void texStorage2DEXT(blink::WGC3Denum target,
504 blink::WGC3Dint levels,
505 blink::WGC3Duint internalformat,
506 blink::WGC3Dint width,
507 blink::WGC3Dint height);
509 virtual blink::WebGLId createQueryEXT();
510 virtual void deleteQueryEXT(blink::WebGLId query);
511 virtual blink::WGC3Dboolean isQueryEXT(blink::WGC3Duint query);
512 virtual void beginQueryEXT(blink::WGC3Denum target, blink::WebGLId query);
513 virtual void endQueryEXT(blink::WGC3Denum target);
514 virtual void getQueryivEXT(blink::WGC3Denum target,
515 blink::WGC3Denum pname,
516 blink::WGC3Dint* params);
517 virtual void getQueryObjectuivEXT(blink::WebGLId query,
518 blink::WGC3Denum pname,
519 blink::WGC3Duint* params);
521 virtual void queryCounterEXT(blink::WebGLId query, blink::WGC3Denum target);
522 virtual void getQueryObjectui64vEXT(blink::WebGLId query,
523 blink::WGC3Denum pname,
524 blink::WGC3Duint64* params);
526 void copyTextureCHROMIUM(
527 blink::WGC3Denum target,
528 blink::WebGLId source_id,
529 blink::WebGLId dest_id,
530 blink::WGC3Denum internal_format,
531 blink::WGC3Denum dest_type,
532 blink::WGC3Dboolean unpack_flip_y,
533 blink::WGC3Dboolean unpack_premultiply_alpha,
534 blink::WGC3Dboolean unpack_unmultiply_alpha) override;
536 void copySubTextureCHROMIUM(
537 blink::WGC3Denum target,
538 blink::WebGLId source_id,
539 blink::WebGLId dest_id,
540 blink::WGC3Dint xoffset,
541 blink::WGC3Dint yoffset,
542 blink::WGC3Dint x,
543 blink::WGC3Dint y,
544 blink::WGC3Dsizei width,
545 blink::WGC3Dsizei height,
546 blink::WGC3Dboolean unpack_flip_y,
547 blink::WGC3Dboolean unpack_premultiply_alpha,
548 blink::WGC3Dboolean unpack_unmultiply_alpha) override;
550 virtual void bindUniformLocationCHROMIUM(blink::WebGLId program,
551 blink::WGC3Dint location,
552 const blink::WGC3Dchar* uniform);
554 virtual void shallowFlushCHROMIUM();
555 virtual void shallowFinishCHROMIUM();
557 virtual void genMailboxCHROMIUM(blink::WGC3Dbyte* mailbox);
558 virtual void produceTextureCHROMIUM(blink::WGC3Denum target,
559 const blink::WGC3Dbyte* mailbox);
560 virtual void produceTextureDirectCHROMIUM(blink::WebGLId texture,
561 blink::WGC3Denum target,
562 const blink::WGC3Dbyte* mailbox);
563 virtual void consumeTextureCHROMIUM(blink::WGC3Denum target,
564 const blink::WGC3Dbyte* mailbox);
565 virtual blink::WebGLId createAndConsumeTextureCHROMIUM(
566 blink::WGC3Denum target,
567 const blink::WGC3Dbyte* mailbox);
569 virtual void genValuebuffersCHROMIUM(blink::WGC3Dsizei count,
570 blink::WebGLId* ids);
571 virtual blink::WebGLId createValuebufferCHROMIUM();
572 virtual void deleteValuebuffersCHROMIUM(blink::WGC3Dsizei count,
573 blink::WebGLId* ids);
574 virtual void deleteValuebufferCHROMIUM(blink::WebGLId);
575 virtual void bindValuebufferCHROMIUM(blink::WGC3Denum target,
576 blink::WebGLId valuebuffer);
577 virtual blink::WGC3Dboolean isValuebufferCHROMIUM(
578 blink::WebGLId renderbuffer);
579 virtual void subscribeValueCHROMIUM(blink::WGC3Denum target,
580 blink::WGC3Denum subscription);
581 virtual void populateSubscribedValuesCHROMIUM(blink::WGC3Denum target);
582 virtual void uniformValuebufferCHROMIUM(blink::WGC3Dint location,
583 blink::WGC3Denum target,
584 blink::WGC3Denum subscription);
585 virtual void traceBeginCHROMIUM(const blink::WGC3Dchar* category_name,
586 const blink::WGC3Dchar* trace_name);
587 virtual void traceEndCHROMIUM();
589 virtual void insertEventMarkerEXT(const blink::WGC3Dchar* marker);
590 virtual void pushGroupMarkerEXT(const blink::WGC3Dchar* marker);
591 virtual void popGroupMarkerEXT();
593 // GL_OES_vertex_array_object
594 virtual blink::WebGLId createVertexArrayOES();
595 virtual void deleteVertexArrayOES(blink::WebGLId array);
596 virtual blink::WGC3Dboolean isVertexArrayOES(blink::WebGLId array);
597 virtual void bindVertexArrayOES(blink::WebGLId array);
599 virtual void bindTexImage2DCHROMIUM(blink::WGC3Denum target,
600 blink::WGC3Dint image_id);
601 virtual void releaseTexImage2DCHROMIUM(blink::WGC3Denum target,
602 blink::WGC3Dint image_id);
604 virtual void* mapBufferCHROMIUM(blink::WGC3Denum target,
605 blink::WGC3Denum access);
606 virtual blink::WGC3Dboolean unmapBufferCHROMIUM(blink::WGC3Denum target);
608 // GL_EXT_draw_buffers
609 virtual void drawBuffersEXT(blink::WGC3Dsizei n,
610 const blink::WGC3Denum* bufs);
612 // GL_ANGLE_instanced_arrays
613 virtual void drawArraysInstancedANGLE(blink::WGC3Denum mode,
614 blink::WGC3Dint first,
615 blink::WGC3Dsizei count,
616 blink::WGC3Dsizei primcount);
617 virtual void drawElementsInstancedANGLE(blink::WGC3Denum mode,
618 blink::WGC3Dsizei count,
619 blink::WGC3Denum type,
620 blink::WGC3Dintptr offset,
621 blink::WGC3Dsizei primcount);
622 virtual void vertexAttribDivisorANGLE(blink::WGC3Duint index,
623 blink::WGC3Duint divisor);
625 // GL_CHROMIUM_gpu_memory_buffer_image
626 virtual blink::WGC3Duint createGpuMemoryBufferImageCHROMIUM(
627 blink::WGC3Dsizei width,
628 blink::WGC3Dsizei height,
629 blink::WGC3Denum internalformat,
630 blink::WGC3Denum usage);
631 virtual void destroyImageCHROMIUM(blink::WGC3Duint image_id);
633 // GL_EXT_multisampled_render_to_texture
634 virtual void framebufferTexture2DMultisampleEXT(blink::WGC3Denum target,
635 blink::WGC3Denum attachment,
636 blink::WGC3Denum textarget,
637 blink::WebGLId texture,
638 blink::WGC3Dint level,
639 blink::WGC3Dsizei samples);
640 virtual void renderbufferStorageMultisampleEXT(
641 blink::WGC3Denum target,
642 blink::WGC3Dsizei samples,
643 blink::WGC3Denum internalformat,
644 blink::WGC3Dsizei width,
645 blink::WGC3Dsizei height);
647 // OpenGL ES 3.0 functions not represented by pre-existing extensions
648 virtual void beginTransformFeedback(blink::WGC3Denum primitiveMode);
649 virtual void bindBufferBase(blink::WGC3Denum target,
650 blink::WGC3Duint index,
651 blink::WGC3Duint buffer);
652 virtual void bindBufferRange(blink::WGC3Denum target,
653 blink::WGC3Duint index,
654 blink::WGC3Duint buffer,
655 blink::WGC3Dintptr offset,
656 blink::WGC3Dsizeiptr size);
657 virtual void bindSampler(blink::WGC3Duint unit, blink::WebGLId sampler);
658 virtual void bindTransformFeedback(blink::WGC3Denum target,
659 blink::WebGLId transformfeedback);
660 virtual void clearBufferfi(blink::WGC3Denum buffer,
661 blink::WGC3Dint drawbuffer,
662 blink::WGC3Dfloat depth,
663 blink::WGC3Dint stencil);
664 virtual void clearBufferfv(blink::WGC3Denum buffer,
665 blink::WGC3Dint drawbuffer,
666 const blink::WGC3Dfloat* value);
667 virtual void clearBufferiv(blink::WGC3Denum buffer,
668 blink::WGC3Dint drawbuffer,
669 const blink::WGC3Dint* value);
670 virtual void clearBufferuiv(blink::WGC3Denum buffer,
671 blink::WGC3Dint drawbuffer,
672 const blink::WGC3Duint* value);
673 virtual blink::WGC3Denum clientWaitSync(blink::WGC3Dsync sync,
674 blink::WGC3Dbitfield flags,
675 blink::WGC3Duint64 timeout);
676 virtual void compressedTexImage3D(blink::WGC3Denum target,
677 blink::WGC3Dint level,
678 blink::WGC3Denum internalformat,
679 blink::WGC3Dsizei width,
680 blink::WGC3Dsizei height,
681 blink::WGC3Dsizei depth,
682 blink::WGC3Dint border,
683 blink::WGC3Dsizei imageSize,
684 const void *data);
685 virtual void compressedTexSubImage3D(blink::WGC3Denum target,
686 blink::WGC3Dint level,
687 blink::WGC3Dint xoffset,
688 blink::WGC3Dint yoffset,
689 blink::WGC3Dint zoffset,
690 blink::WGC3Dsizei width,
691 blink::WGC3Dsizei height,
692 blink::WGC3Dsizei depth,
693 blink::WGC3Denum format,
694 blink::WGC3Dsizei imageSize,
695 const void *data);
696 virtual void copyBufferSubData(blink::WGC3Denum readTarget,
697 blink::WGC3Denum writeTarget,
698 blink::WGC3Dintptr readOffset,
699 blink::WGC3Dintptr writeOffset,
700 blink::WGC3Dsizeiptr size);
701 virtual void copyTexSubImage3D(blink::WGC3Denum target,
702 blink::WGC3Dint level,
703 blink::WGC3Dint xoffset,
704 blink::WGC3Dint yoffset,
705 blink::WGC3Dint zoffset,
706 blink::WGC3Dint x,
707 blink::WGC3Dint y,
708 blink::WGC3Dsizei width,
709 blink::WGC3Dsizei height);
710 virtual blink::WebGLId createSampler();
711 virtual blink::WebGLId createTransformFeedback();
712 virtual void deleteSampler(blink::WebGLId sampler);
713 virtual void deleteSync(blink::WGC3Dsync sync);
714 virtual void deleteTransformFeedback(blink::WebGLId transformfeedback);
715 virtual void drawRangeElements(blink::WGC3Denum mode,
716 blink::WGC3Duint start,
717 blink::WGC3Duint end,
718 blink::WGC3Dsizei count,
719 blink::WGC3Denum type,
720 blink::WGC3Dintptr offset);
721 virtual void endTransformFeedback(void);
722 virtual blink::WGC3Dsync fenceSync(blink::WGC3Denum condition,
723 blink::WGC3Dbitfield flags);
724 virtual void framebufferTextureLayer(blink::WGC3Denum target,
725 blink::WGC3Denum attachment,
726 blink::WGC3Duint texture,
727 blink::WGC3Dint level,
728 blink::WGC3Dint layer);
729 virtual void getActiveUniformBlockName(blink::WGC3Duint program,
730 blink::WGC3Duint uniformBlockIndex,
731 blink::WGC3Dsizei bufSize,
732 blink::WGC3Dsizei* length,
733 blink::WGC3Dchar* uniformBlockName);
734 virtual void getActiveUniformBlockiv(blink::WGC3Duint program,
735 blink::WGC3Duint uniformBlockIndex,
736 blink::WGC3Denum pname,
737 blink::WGC3Dint* params);
738 virtual void getActiveUniformsiv(blink::WGC3Duint program,
739 blink::WGC3Dsizei uniformCount,
740 const blink::WGC3Duint *uniformIndices,
741 blink::WGC3Denum pname,
742 blink::WGC3Dint *params);
743 virtual blink::WGC3Dint getFragDataLocation(blink::WGC3Duint program,
744 const blink::WGC3Dchar* name);
745 virtual void getInternalformativ(blink::WGC3Denum target,
746 blink::WGC3Denum internalformat,
747 blink::WGC3Denum pname,
748 blink::WGC3Dsizei bufSize,
749 blink::WGC3Dint* params);
750 virtual void getSamplerParameterfv(blink::WGC3Duint sampler,
751 blink::WGC3Denum pname,
752 blink::WGC3Dfloat* params);
753 virtual void getSamplerParameteriv(blink::WGC3Duint sampler,
754 blink::WGC3Denum pname,
755 blink::WGC3Dint* params);
756 virtual void getTransformFeedbackVarying(blink::WGC3Duint program,
757 blink::WGC3Duint index,
758 blink::WGC3Dsizei bufSize,
759 blink::WGC3Dsizei *length,
760 blink::WGC3Dsizei *size,
761 blink::WGC3Denum *type,
762 blink::WGC3Dchar *name);
763 virtual blink::WGC3Duint getUniformBlockIndex(
764 blink::WGC3Duint program, const blink::WGC3Dchar* uniformBlockName);
765 virtual void getUniformIndices(blink::WGC3Duint program,
766 blink::WGC3Dsizei uniformCount,
767 const blink::WGC3Dchar *const*uniformNames,
768 blink::WGC3Duint *uniformIndices);
769 virtual void getUniformuiv(blink::WGC3Duint program,
770 blink::WGC3Dint location,
771 blink::WGC3Duint *params);
772 virtual void getVertexAttribIiv(blink::WGC3Duint index,
773 blink::WGC3Denum pname,
774 blink::WGC3Dint *params);
775 virtual void getVertexAttribIuiv(blink::WGC3Duint index,
776 blink::WGC3Denum pname,
777 blink::WGC3Duint *params);
778 virtual void invalidateFramebuffer(blink::WGC3Denum target,
779 blink::WGC3Dsizei numAttachments,
780 const blink::WGC3Denum* attachments);
781 virtual void invalidateSubFramebuffer(blink::WGC3Denum target,
782 blink::WGC3Dsizei numAttachments,
783 const blink::WGC3Denum* attachments,
784 blink::WGC3Dint x,
785 blink::WGC3Dint y,
786 blink::WGC3Dsizei width,
787 blink::WGC3Dsizei height);
788 virtual blink::WGC3Dboolean isSampler(blink::WebGLId sampler);
789 virtual blink::WGC3Dboolean isSync(blink::WGC3Dsync sync);
790 virtual blink::WGC3Dboolean isTransformFeedback(blink::WGC3Duint id);
791 virtual void* mapBufferRange(blink::WGC3Denum target,
792 blink::WGC3Dintptr offset,
793 blink::WGC3Dsizeiptr length,
794 blink::WGC3Dbitfield access);
795 virtual void pauseTransformFeedback(void);
796 //virtual void programParameteri(blink::WGC3Duint program,
797 // blink::WGC3Denum pname,
798 // blink::WGC3Dint value);
799 virtual void readBuffer(blink::WGC3Denum src);
800 virtual void resumeTransformFeedback(void);
801 virtual void samplerParameterf(blink::WGC3Duint sampler,
802 blink::WGC3Denum pname,
803 blink::WGC3Dfloat param);
804 virtual void samplerParameterfv(blink::WGC3Duint sampler,
805 blink::WGC3Denum pname,
806 const blink::WGC3Dfloat* param);
807 virtual void samplerParameteri(blink::WGC3Duint sampler,
808 blink::WGC3Denum pname,
809 blink::WGC3Dint param);
810 virtual void samplerParameteriv(blink::WGC3Duint sampler,
811 blink::WGC3Denum pname,
812 const blink::WGC3Dint* param);
813 virtual void texImage3D(blink::WGC3Denum target,
814 blink::WGC3Dint level,
815 blink::WGC3Dint internalformat,
816 blink::WGC3Dsizei width,
817 blink::WGC3Dsizei height,
818 blink::WGC3Dsizei depth,
819 blink::WGC3Dint border,
820 blink::WGC3Denum format,
821 blink::WGC3Denum type,
822 const void* pixels);
823 virtual void texStorage3D(blink::WGC3Denum target,
824 blink::WGC3Dsizei levels,
825 blink::WGC3Denum internalformat,
826 blink::WGC3Dsizei width,
827 blink::WGC3Dsizei height,
828 blink::WGC3Dsizei depth);
829 virtual void texSubImage3D(blink::WGC3Denum target,
830 blink::WGC3Dint level,
831 blink::WGC3Dint xoffset,
832 blink::WGC3Dint yoffset,
833 blink::WGC3Dint zoffset,
834 blink::WGC3Dsizei width,
835 blink::WGC3Dsizei height,
836 blink::WGC3Dsizei depth,
837 blink::WGC3Denum format,
838 blink::WGC3Denum type,
839 const void* pixels);
840 virtual void transformFeedbackVaryings(
841 blink::WGC3Duint program,
842 blink::WGC3Dsizei count,
843 const blink::WGC3Dchar* const* varyings,
844 blink::WGC3Denum bufferMode);
845 virtual void uniform1ui(blink::WGC3Dint location, blink::WGC3Duint x);
846 virtual void uniform1uiv(blink::WGC3Dint location,
847 blink::WGC3Dsizei count,
848 const blink::WGC3Duint* value);
849 virtual void uniform2ui(blink::WGC3Dint location,
850 blink::WGC3Duint x,
851 blink::WGC3Duint y);
852 virtual void uniform2uiv(blink::WGC3Dint location,
853 blink::WGC3Dsizei count,
854 const blink::WGC3Duint* value);
855 virtual void uniform3ui(blink::WGC3Dint location,
856 blink::WGC3Duint x,
857 blink::WGC3Duint y,
858 blink::WGC3Duint z);
859 virtual void uniform3uiv(blink::WGC3Dint location,
860 blink::WGC3Dsizei count,
861 const blink::WGC3Duint* value);
862 virtual void uniform4ui(blink::WGC3Dint location,
863 blink::WGC3Duint x,
864 blink::WGC3Duint y,
865 blink::WGC3Duint z,
866 blink::WGC3Duint w);
867 virtual void uniform4uiv(blink::WGC3Dint location,
868 blink::WGC3Dsizei count,
869 const blink::WGC3Duint* value);
870 virtual void uniformBlockBinding(blink::WGC3Duint program,
871 blink::WGC3Duint uniformBlockIndex,
872 blink::WGC3Duint uniformBlockBinding);
873 virtual void uniformMatrix2x3fv(blink::WGC3Dint location,
874 blink::WGC3Dsizei count,
875 blink::WGC3Dboolean transpose,
876 const blink::WGC3Dfloat* value);
877 virtual void uniformMatrix2x4fv(blink::WGC3Dint location,
878 blink::WGC3Dsizei count,
879 blink::WGC3Dboolean transpose,
880 const blink::WGC3Dfloat* value);
881 virtual void uniformMatrix3x2fv(blink::WGC3Dint location,
882 blink::WGC3Dsizei count,
883 blink::WGC3Dboolean transpose,
884 const blink::WGC3Dfloat* value);
885 virtual void uniformMatrix3x4fv(blink::WGC3Dint location,
886 blink::WGC3Dsizei count,
887 blink::WGC3Dboolean transpose,
888 const blink::WGC3Dfloat* value);
889 virtual void uniformMatrix4x2fv(blink::WGC3Dint location,
890 blink::WGC3Dsizei count,
891 blink::WGC3Dboolean transpose,
892 const blink::WGC3Dfloat* value);
893 virtual void uniformMatrix4x3fv(blink::WGC3Dint location,
894 blink::WGC3Dsizei count,
895 blink::WGC3Dboolean transpose,
896 const blink::WGC3Dfloat* value);
897 virtual blink::WGC3Dboolean unmapBuffer(blink::WGC3Denum target);
898 virtual void vertexAttribI4i(blink::WGC3Duint index,
899 blink::WGC3Dint x,
900 blink::WGC3Dint y,
901 blink::WGC3Dint z,
902 blink::WGC3Dint w);
903 virtual void vertexAttribI4iv(blink::WGC3Duint index,
904 const blink::WGC3Dint* v);
905 virtual void vertexAttribI4ui(blink::WGC3Duint index,
906 blink::WGC3Duint x,
907 blink::WGC3Duint y,
908 blink::WGC3Duint z,
909 blink::WGC3Duint w);
910 virtual void vertexAttribI4uiv(blink::WGC3Duint index,
911 const blink::WGC3Duint* v);
912 virtual void vertexAttribIPointer(blink::WGC3Duint index,
913 blink::WGC3Dint size,
914 blink::WGC3Denum type,
915 blink::WGC3Dsizei stride,
916 blink::WGC3Dintptr pointer);
917 virtual void waitSync(blink::WGC3Dsync sync,
918 blink::WGC3Dbitfield flags,
919 blink::WGC3Duint64 timeout);
921 virtual bool isContextLost();
922 virtual blink::WGC3Denum getGraphicsResetStatusARB();
924 virtual GrGLInterface* createGrGLInterface();
926 ::gpu::gles2::GLES2Interface* GetGLInterface() {
927 return gl_;
930 // Convert WebGL context creation attributes into command buffer / EGL size
931 // requests.
932 static void ConvertAttributes(
933 const blink::WebGraphicsContext3D::Attributes& attributes,
934 ::gpu::gles2::ContextCreationAttribHelper* output_attribs);
936 protected:
937 friend class WebGraphicsContext3DErrorMessageCallback;
939 WebGraphicsContext3DImpl();
941 ::gpu::gles2::GLES2ImplementationErrorMessageCallback*
942 getErrorMessageCallback();
943 virtual void OnErrorMessage(const std::string& message, int id);
945 void setGLInterface(::gpu::gles2::GLES2Interface* gl) {
946 gl_ = gl;
949 bool initialized_;
950 bool initialize_failed_;
952 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
954 WebGraphicsContext3D::WebGraphicsErrorMessageCallback*
955 error_message_callback_;
956 scoped_ptr<WebGraphicsContext3DErrorMessageCallback>
957 client_error_message_callback_;
959 // Errors raised by synthesizeGLError().
960 std::vector<blink::WGC3Denum> synthetic_errors_;
962 ::gpu::gles2::GLES2Interface* gl_;
963 bool lose_context_when_out_of_memory_;
964 uint32_t flush_id_;
967 } // namespace gpu_blink
969 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_