Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / gpu / blink / webgraphicscontext3d_impl.h
blobf3d03d34a7472d921e60af2ab5f0318f19e5c01e
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 void copyTextureCHROMIUM(
522 blink::WGC3Denum target,
523 blink::WebGLId source_id,
524 blink::WebGLId dest_id,
525 blink::WGC3Denum internal_format,
526 blink::WGC3Denum dest_type,
527 blink::WGC3Dboolean unpack_flip_y,
528 blink::WGC3Dboolean unpack_premultiply_alpha,
529 blink::WGC3Dboolean unpack_unmultiply_alpha) override;
531 void copySubTextureCHROMIUM(
532 blink::WGC3Denum target,
533 blink::WebGLId source_id,
534 blink::WebGLId dest_id,
535 blink::WGC3Dint xoffset,
536 blink::WGC3Dint yoffset,
537 blink::WGC3Dint x,
538 blink::WGC3Dint y,
539 blink::WGC3Dsizei width,
540 blink::WGC3Dsizei height,
541 blink::WGC3Dboolean unpack_flip_y,
542 blink::WGC3Dboolean unpack_premultiply_alpha,
543 blink::WGC3Dboolean unpack_unmultiply_alpha) override;
545 virtual void bindUniformLocationCHROMIUM(blink::WebGLId program,
546 blink::WGC3Dint location,
547 const blink::WGC3Dchar* uniform);
549 virtual void shallowFlushCHROMIUM();
550 virtual void shallowFinishCHROMIUM();
552 virtual void genMailboxCHROMIUM(blink::WGC3Dbyte* mailbox);
553 virtual void produceTextureCHROMIUM(blink::WGC3Denum target,
554 const blink::WGC3Dbyte* mailbox);
555 virtual void produceTextureDirectCHROMIUM(blink::WebGLId texture,
556 blink::WGC3Denum target,
557 const blink::WGC3Dbyte* mailbox);
558 virtual void consumeTextureCHROMIUM(blink::WGC3Denum target,
559 const blink::WGC3Dbyte* mailbox);
560 virtual blink::WebGLId createAndConsumeTextureCHROMIUM(
561 blink::WGC3Denum target,
562 const blink::WGC3Dbyte* mailbox);
564 virtual void genValuebuffersCHROMIUM(blink::WGC3Dsizei count,
565 blink::WebGLId* ids);
566 virtual blink::WebGLId createValuebufferCHROMIUM();
567 virtual void deleteValuebuffersCHROMIUM(blink::WGC3Dsizei count,
568 blink::WebGLId* ids);
569 virtual void deleteValuebufferCHROMIUM(blink::WebGLId);
570 virtual void bindValuebufferCHROMIUM(blink::WGC3Denum target,
571 blink::WebGLId valuebuffer);
572 virtual blink::WGC3Dboolean isValuebufferCHROMIUM(
573 blink::WebGLId renderbuffer);
574 virtual void subscribeValueCHROMIUM(blink::WGC3Denum target,
575 blink::WGC3Denum subscription);
576 virtual void populateSubscribedValuesCHROMIUM(blink::WGC3Denum target);
577 virtual void uniformValuebufferCHROMIUM(blink::WGC3Dint location,
578 blink::WGC3Denum target,
579 blink::WGC3Denum subscription);
580 virtual void traceBeginCHROMIUM(const blink::WGC3Dchar* category_name,
581 const blink::WGC3Dchar* trace_name);
582 virtual void traceEndCHROMIUM();
584 virtual void insertEventMarkerEXT(const blink::WGC3Dchar* marker);
585 virtual void pushGroupMarkerEXT(const blink::WGC3Dchar* marker);
586 virtual void popGroupMarkerEXT();
588 // GL_OES_vertex_array_object
589 virtual blink::WebGLId createVertexArrayOES();
590 virtual void deleteVertexArrayOES(blink::WebGLId array);
591 virtual blink::WGC3Dboolean isVertexArrayOES(blink::WebGLId array);
592 virtual void bindVertexArrayOES(blink::WebGLId array);
594 virtual void bindTexImage2DCHROMIUM(blink::WGC3Denum target,
595 blink::WGC3Dint image_id);
596 virtual void releaseTexImage2DCHROMIUM(blink::WGC3Denum target,
597 blink::WGC3Dint image_id);
599 virtual void* mapBufferCHROMIUM(blink::WGC3Denum target,
600 blink::WGC3Denum access);
601 virtual blink::WGC3Dboolean unmapBufferCHROMIUM(blink::WGC3Denum target);
603 // Async pixel transfer functions.
604 virtual void asyncTexImage2DCHROMIUM(blink::WGC3Denum target,
605 blink::WGC3Dint level,
606 blink::WGC3Denum internalformat,
607 blink::WGC3Dsizei width,
608 blink::WGC3Dsizei height,
609 blink::WGC3Dint border,
610 blink::WGC3Denum format,
611 blink::WGC3Denum type,
612 const void* pixels);
613 virtual void asyncTexSubImage2DCHROMIUM(blink::WGC3Denum target,
614 blink::WGC3Dint level,
615 blink::WGC3Dint xoffset,
616 blink::WGC3Dint yoffset,
617 blink::WGC3Dsizei width,
618 blink::WGC3Dsizei height,
619 blink::WGC3Denum format,
620 blink::WGC3Denum type,
621 const void* pixels);
622 virtual void waitAsyncTexImage2DCHROMIUM(blink::WGC3Denum target);
624 // GL_EXT_draw_buffers
625 virtual void drawBuffersEXT(blink::WGC3Dsizei n,
626 const blink::WGC3Denum* bufs);
628 // GL_ANGLE_instanced_arrays
629 virtual void drawArraysInstancedANGLE(blink::WGC3Denum mode,
630 blink::WGC3Dint first,
631 blink::WGC3Dsizei count,
632 blink::WGC3Dsizei primcount);
633 virtual void drawElementsInstancedANGLE(blink::WGC3Denum mode,
634 blink::WGC3Dsizei count,
635 blink::WGC3Denum type,
636 blink::WGC3Dintptr offset,
637 blink::WGC3Dsizei primcount);
638 virtual void vertexAttribDivisorANGLE(blink::WGC3Duint index,
639 blink::WGC3Duint divisor);
641 // GL_CHROMIUM_gpu_memory_buffer_image
642 virtual blink::WGC3Duint createGpuMemoryBufferImageCHROMIUM(
643 blink::WGC3Dsizei width,
644 blink::WGC3Dsizei height,
645 blink::WGC3Denum internalformat,
646 blink::WGC3Denum usage);
647 virtual void destroyImageCHROMIUM(blink::WGC3Duint image_id);
649 // GL_EXT_multisampled_render_to_texture
650 virtual void framebufferTexture2DMultisampleEXT(blink::WGC3Denum target,
651 blink::WGC3Denum attachment,
652 blink::WGC3Denum textarget,
653 blink::WebGLId texture,
654 blink::WGC3Dint level,
655 blink::WGC3Dsizei samples);
656 virtual void renderbufferStorageMultisampleEXT(
657 blink::WGC3Denum target,
658 blink::WGC3Dsizei samples,
659 blink::WGC3Denum internalformat,
660 blink::WGC3Dsizei width,
661 blink::WGC3Dsizei height);
663 // OpenGL ES 3.0 functions not represented by pre-existing extensions
664 virtual void beginTransformFeedback(blink::WGC3Denum primitiveMode);
665 virtual void bindBufferBase(blink::WGC3Denum target,
666 blink::WGC3Duint index,
667 blink::WGC3Duint buffer);
668 virtual void bindBufferRange(blink::WGC3Denum target,
669 blink::WGC3Duint index,
670 blink::WGC3Duint buffer,
671 blink::WGC3Dintptr offset,
672 blink::WGC3Dsizeiptr size);
673 virtual void bindSampler(blink::WGC3Duint unit, blink::WebGLId sampler);
674 virtual void bindTransformFeedback(blink::WGC3Denum target,
675 blink::WebGLId transformfeedback);
676 virtual void clearBufferfi(blink::WGC3Denum buffer,
677 blink::WGC3Dint drawbuffer,
678 blink::WGC3Dfloat depth,
679 blink::WGC3Dint stencil);
680 virtual void clearBufferfv(blink::WGC3Denum buffer,
681 blink::WGC3Dint drawbuffer,
682 const blink::WGC3Dfloat* value);
683 virtual void clearBufferiv(blink::WGC3Denum buffer,
684 blink::WGC3Dint drawbuffer,
685 const blink::WGC3Dint* value);
686 virtual void clearBufferuiv(blink::WGC3Denum buffer,
687 blink::WGC3Dint drawbuffer,
688 const blink::WGC3Duint* value);
689 virtual blink::WGC3Denum clientWaitSync(blink::WGC3Dsync sync,
690 blink::WGC3Dbitfield flags,
691 blink::WGC3Duint64 timeout);
692 virtual void compressedTexImage3D(blink::WGC3Denum target,
693 blink::WGC3Dint level,
694 blink::WGC3Denum internalformat,
695 blink::WGC3Dsizei width,
696 blink::WGC3Dsizei height,
697 blink::WGC3Dsizei depth,
698 blink::WGC3Dint border,
699 blink::WGC3Dsizei imageSize,
700 const void *data);
701 virtual void compressedTexSubImage3D(blink::WGC3Denum target,
702 blink::WGC3Dint level,
703 blink::WGC3Dint xoffset,
704 blink::WGC3Dint yoffset,
705 blink::WGC3Dint zoffset,
706 blink::WGC3Dsizei width,
707 blink::WGC3Dsizei height,
708 blink::WGC3Dsizei depth,
709 blink::WGC3Denum format,
710 blink::WGC3Dsizei imageSize,
711 const void *data);
712 virtual void copyBufferSubData(blink::WGC3Denum readTarget,
713 blink::WGC3Denum writeTarget,
714 blink::WGC3Dintptr readOffset,
715 blink::WGC3Dintptr writeOffset,
716 blink::WGC3Dsizeiptr size);
717 virtual void copyTexSubImage3D(blink::WGC3Denum target,
718 blink::WGC3Dint level,
719 blink::WGC3Dint xoffset,
720 blink::WGC3Dint yoffset,
721 blink::WGC3Dint zoffset,
722 blink::WGC3Dint x,
723 blink::WGC3Dint y,
724 blink::WGC3Dsizei width,
725 blink::WGC3Dsizei height);
726 virtual blink::WebGLId createSampler();
727 virtual blink::WebGLId createTransformFeedback();
728 virtual void deleteSampler(blink::WebGLId sampler);
729 virtual void deleteSync(blink::WGC3Dsync sync);
730 virtual void deleteTransformFeedback(blink::WebGLId transformfeedback);
731 virtual void drawRangeElements(blink::WGC3Denum mode,
732 blink::WGC3Duint start,
733 blink::WGC3Duint end,
734 blink::WGC3Dsizei count,
735 blink::WGC3Denum type,
736 blink::WGC3Dintptr offset);
737 virtual void endTransformFeedback(void);
738 virtual blink::WGC3Dsync fenceSync(blink::WGC3Denum condition,
739 blink::WGC3Dbitfield flags);
740 virtual void framebufferTextureLayer(blink::WGC3Denum target,
741 blink::WGC3Denum attachment,
742 blink::WGC3Duint texture,
743 blink::WGC3Dint level,
744 blink::WGC3Dint layer);
745 virtual void getActiveUniformBlockName(blink::WGC3Duint program,
746 blink::WGC3Duint uniformBlockIndex,
747 blink::WGC3Dsizei bufSize,
748 blink::WGC3Dsizei* length,
749 blink::WGC3Dchar* uniformBlockName);
750 virtual void getActiveUniformBlockiv(blink::WGC3Duint program,
751 blink::WGC3Duint uniformBlockIndex,
752 blink::WGC3Denum pname,
753 blink::WGC3Dint* params);
754 virtual void getActiveUniformsiv(blink::WGC3Duint program,
755 blink::WGC3Dsizei uniformCount,
756 const blink::WGC3Duint *uniformIndices,
757 blink::WGC3Denum pname,
758 blink::WGC3Dint *params);
759 virtual blink::WGC3Dint getFragDataLocation(blink::WGC3Duint program,
760 const blink::WGC3Dchar* name);
761 virtual void getInternalformativ(blink::WGC3Denum target,
762 blink::WGC3Denum internalformat,
763 blink::WGC3Denum pname,
764 blink::WGC3Dsizei bufSize,
765 blink::WGC3Dint* params);
766 virtual void getSamplerParameterfv(blink::WGC3Duint sampler,
767 blink::WGC3Denum pname,
768 blink::WGC3Dfloat* params);
769 virtual void getSamplerParameteriv(blink::WGC3Duint sampler,
770 blink::WGC3Denum pname,
771 blink::WGC3Dint* params);
772 virtual void getTransformFeedbackVarying(blink::WGC3Duint program,
773 blink::WGC3Duint index,
774 blink::WGC3Dsizei bufSize,
775 blink::WGC3Dsizei *length,
776 blink::WGC3Dsizei *size,
777 blink::WGC3Denum *type,
778 blink::WGC3Dchar *name);
779 virtual blink::WGC3Duint getUniformBlockIndex(
780 blink::WGC3Duint program, const blink::WGC3Dchar* uniformBlockName);
781 virtual void getUniformIndices(blink::WGC3Duint program,
782 blink::WGC3Dsizei uniformCount,
783 const blink::WGC3Dchar *const*uniformNames,
784 blink::WGC3Duint *uniformIndices);
785 virtual void getUniformuiv(blink::WGC3Duint program,
786 blink::WGC3Dint location,
787 blink::WGC3Duint *params);
788 virtual void getVertexAttribIiv(blink::WGC3Duint index,
789 blink::WGC3Denum pname,
790 blink::WGC3Dint *params);
791 virtual void getVertexAttribIuiv(blink::WGC3Duint index,
792 blink::WGC3Denum pname,
793 blink::WGC3Duint *params);
794 virtual void invalidateFramebuffer(blink::WGC3Denum target,
795 blink::WGC3Dsizei numAttachments,
796 const blink::WGC3Denum* attachments);
797 virtual void invalidateSubFramebuffer(blink::WGC3Denum target,
798 blink::WGC3Dsizei numAttachments,
799 const blink::WGC3Denum* attachments,
800 blink::WGC3Dint x,
801 blink::WGC3Dint y,
802 blink::WGC3Dsizei width,
803 blink::WGC3Dsizei height);
804 virtual blink::WGC3Dboolean isSampler(blink::WebGLId sampler);
805 virtual blink::WGC3Dboolean isSync(blink::WGC3Dsync sync);
806 virtual blink::WGC3Dboolean isTransformFeedback(blink::WGC3Duint id);
807 virtual void* mapBufferRange(blink::WGC3Denum target,
808 blink::WGC3Dintptr offset,
809 blink::WGC3Dsizeiptr length,
810 blink::WGC3Dbitfield access);
811 virtual void pauseTransformFeedback(void);
812 //virtual void programParameteri(blink::WGC3Duint program,
813 // blink::WGC3Denum pname,
814 // blink::WGC3Dint value);
815 virtual void readBuffer(blink::WGC3Denum src);
816 virtual void resumeTransformFeedback(void);
817 virtual void samplerParameterf(blink::WGC3Duint sampler,
818 blink::WGC3Denum pname,
819 blink::WGC3Dfloat param);
820 virtual void samplerParameterfv(blink::WGC3Duint sampler,
821 blink::WGC3Denum pname,
822 const blink::WGC3Dfloat* param);
823 virtual void samplerParameteri(blink::WGC3Duint sampler,
824 blink::WGC3Denum pname,
825 blink::WGC3Dint param);
826 virtual void samplerParameteriv(blink::WGC3Duint sampler,
827 blink::WGC3Denum pname,
828 const blink::WGC3Dint* param);
829 virtual void texImage3D(blink::WGC3Denum target,
830 blink::WGC3Dint level,
831 blink::WGC3Dint internalformat,
832 blink::WGC3Dsizei width,
833 blink::WGC3Dsizei height,
834 blink::WGC3Dsizei depth,
835 blink::WGC3Dint border,
836 blink::WGC3Denum format,
837 blink::WGC3Denum type,
838 const void* pixels);
839 virtual void texStorage3D(blink::WGC3Denum target,
840 blink::WGC3Dsizei levels,
841 blink::WGC3Denum internalformat,
842 blink::WGC3Dsizei width,
843 blink::WGC3Dsizei height,
844 blink::WGC3Dsizei depth);
845 virtual void texSubImage3D(blink::WGC3Denum target,
846 blink::WGC3Dint level,
847 blink::WGC3Dint xoffset,
848 blink::WGC3Dint yoffset,
849 blink::WGC3Dint zoffset,
850 blink::WGC3Dsizei width,
851 blink::WGC3Dsizei height,
852 blink::WGC3Dsizei depth,
853 blink::WGC3Denum format,
854 blink::WGC3Denum type,
855 const void* pixels);
856 virtual void transformFeedbackVaryings(
857 blink::WGC3Duint program,
858 blink::WGC3Dsizei count,
859 const blink::WGC3Dchar* const* varyings,
860 blink::WGC3Denum bufferMode);
861 virtual void uniform1ui(blink::WGC3Dint location, blink::WGC3Duint x);
862 virtual void uniform1uiv(blink::WGC3Dint location,
863 blink::WGC3Dsizei count,
864 const blink::WGC3Duint* value);
865 virtual void uniform2ui(blink::WGC3Dint location,
866 blink::WGC3Duint x,
867 blink::WGC3Duint y);
868 virtual void uniform2uiv(blink::WGC3Dint location,
869 blink::WGC3Dsizei count,
870 const blink::WGC3Duint* value);
871 virtual void uniform3ui(blink::WGC3Dint location,
872 blink::WGC3Duint x,
873 blink::WGC3Duint y,
874 blink::WGC3Duint z);
875 virtual void uniform3uiv(blink::WGC3Dint location,
876 blink::WGC3Dsizei count,
877 const blink::WGC3Duint* value);
878 virtual void uniform4ui(blink::WGC3Dint location,
879 blink::WGC3Duint x,
880 blink::WGC3Duint y,
881 blink::WGC3Duint z,
882 blink::WGC3Duint w);
883 virtual void uniform4uiv(blink::WGC3Dint location,
884 blink::WGC3Dsizei count,
885 const blink::WGC3Duint* value);
886 virtual void uniformBlockBinding(blink::WGC3Duint program,
887 blink::WGC3Duint uniformBlockIndex,
888 blink::WGC3Duint uniformBlockBinding);
889 virtual void uniformMatrix2x3fv(blink::WGC3Dint location,
890 blink::WGC3Dsizei count,
891 blink::WGC3Dboolean transpose,
892 const blink::WGC3Dfloat* value);
893 virtual void uniformMatrix2x4fv(blink::WGC3Dint location,
894 blink::WGC3Dsizei count,
895 blink::WGC3Dboolean transpose,
896 const blink::WGC3Dfloat* value);
897 virtual void uniformMatrix3x2fv(blink::WGC3Dint location,
898 blink::WGC3Dsizei count,
899 blink::WGC3Dboolean transpose,
900 const blink::WGC3Dfloat* value);
901 virtual void uniformMatrix3x4fv(blink::WGC3Dint location,
902 blink::WGC3Dsizei count,
903 blink::WGC3Dboolean transpose,
904 const blink::WGC3Dfloat* value);
905 virtual void uniformMatrix4x2fv(blink::WGC3Dint location,
906 blink::WGC3Dsizei count,
907 blink::WGC3Dboolean transpose,
908 const blink::WGC3Dfloat* value);
909 virtual void uniformMatrix4x3fv(blink::WGC3Dint location,
910 blink::WGC3Dsizei count,
911 blink::WGC3Dboolean transpose,
912 const blink::WGC3Dfloat* value);
913 virtual blink::WGC3Dboolean unmapBuffer(blink::WGC3Denum target);
914 virtual void vertexAttribI4i(blink::WGC3Duint index,
915 blink::WGC3Dint x,
916 blink::WGC3Dint y,
917 blink::WGC3Dint z,
918 blink::WGC3Dint w);
919 virtual void vertexAttribI4iv(blink::WGC3Duint index,
920 const blink::WGC3Dint* v);
921 virtual void vertexAttribI4ui(blink::WGC3Duint index,
922 blink::WGC3Duint x,
923 blink::WGC3Duint y,
924 blink::WGC3Duint z,
925 blink::WGC3Duint w);
926 virtual void vertexAttribI4uiv(blink::WGC3Duint index,
927 const blink::WGC3Duint* v);
928 virtual void vertexAttribIPointer(blink::WGC3Duint index,
929 blink::WGC3Dint size,
930 blink::WGC3Denum type,
931 blink::WGC3Dsizei stride,
932 blink::WGC3Dintptr pointer);
933 virtual void waitSync(blink::WGC3Dsync sync,
934 blink::WGC3Dbitfield flags,
935 blink::WGC3Duint64 timeout);
937 virtual bool isContextLost();
938 virtual blink::WGC3Denum getGraphicsResetStatusARB();
940 virtual GrGLInterface* createGrGLInterface();
942 ::gpu::gles2::GLES2Interface* GetGLInterface() {
943 return gl_;
946 // Convert WebGL context creation attributes into command buffer / EGL size
947 // requests.
948 static void ConvertAttributes(
949 const blink::WebGraphicsContext3D::Attributes& attributes,
950 ::gpu::gles2::ContextCreationAttribHelper* output_attribs);
952 protected:
953 friend class WebGraphicsContext3DErrorMessageCallback;
955 WebGraphicsContext3DImpl();
957 ::gpu::gles2::GLES2ImplementationErrorMessageCallback*
958 getErrorMessageCallback();
959 virtual void OnErrorMessage(const std::string& message, int id);
961 void setGLInterface(::gpu::gles2::GLES2Interface* gl) {
962 gl_ = gl;
965 bool initialized_;
966 bool initialize_failed_;
968 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
970 WebGraphicsContext3D::WebGraphicsErrorMessageCallback*
971 error_message_callback_;
972 scoped_ptr<WebGraphicsContext3DErrorMessageCallback>
973 client_error_message_callback_;
975 // Errors raised by synthesizeGLError().
976 std::vector<blink::WGC3Denum> synthetic_errors_;
978 ::gpu::gles2::GLES2Interface* gl_;
979 bool lose_context_when_out_of_memory_;
980 uint32_t flush_id_;
983 } // namespace gpu_blink
985 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_