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_
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"
21 class GLES2ImplementationErrorMessageCallback
;
22 struct ContextCreationAttribHelper
;
28 class WebGraphicsContext3DErrorMessageCallback
;
30 class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
31 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D
) {
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
,
79 blink::WGC3Denum usage
);
80 virtual void bufferSubData(blink::WGC3Denum target
,
81 blink::WGC3Dintptr offset
,
82 blink::WGC3Dsizeiptr size
,
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
,
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
,
116 virtual void copyTexImage2D(blink::WGC3Denum target
,
117 blink::WGC3Dint level
,
118 blink::WGC3Denum internalformat
,
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
,
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
,
166 virtual bool getActiveUniform(blink::WebGLId program
,
167 blink::WGC3Duint index
,
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
,
263 blink::WGC3Dsizei width
,
264 blink::WGC3Dsizei height
,
265 blink::WGC3Denum format
,
266 blink::WGC3Denum type
,
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
,
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
,
284 blink::WGC3Duint mask
);
285 virtual void stencilFuncSeparate(blink::WGC3Denum face
,
286 blink::WGC3Denum func
,
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
,
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
,
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
,
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
,
344 virtual void uniform2iv(blink::WGC3Dint location
,
345 blink::WGC3Dsizei count
,
346 const blink::WGC3Dint
* v
);
347 virtual void uniform3f(blink::WGC3Dint location
,
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
,
358 virtual void uniform3iv(blink::WGC3Dint location
,
359 blink::WGC3Dsizei count
,
360 const blink::WGC3Dint
* v
);
361 virtual void uniform4f(blink::WGC3Dint location
,
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
,
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
,
398 blink::WGC3Dfloat y
);
399 virtual void vertexAttrib2fv(blink::WGC3Duint index
,
400 const blink::WGC3Dfloat
* values
);
401 virtual void vertexAttrib3f(blink::WGC3Duint index
,
404 blink::WGC3Dfloat z
);
405 virtual void vertexAttrib3fv(blink::WGC3Duint index
,
406 const blink::WGC3Dfloat
* values
);
407 virtual void vertexAttrib4f(blink::WGC3Duint index
,
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
,
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(blink::WGC3Denum target
,
522 blink::WebGLId source_id
,
523 blink::WebGLId dest_id
,
524 blink::WGC3Denum internal_format
,
525 blink::WGC3Denum dest_type
) override
;
527 void copySubTextureCHROMIUM(blink::WGC3Denum target
,
528 blink::WebGLId source_id
,
529 blink::WebGLId dest_id
,
530 blink::WGC3Dint xoffset
,
531 blink::WGC3Dint yoffset
,
534 blink::WGC3Dsizei width
,
535 blink::WGC3Dsizei height
) override
;
537 virtual void bindUniformLocationCHROMIUM(blink::WebGLId program
,
538 blink::WGC3Dint location
,
539 const blink::WGC3Dchar
* uniform
);
541 virtual void shallowFlushCHROMIUM();
542 virtual void shallowFinishCHROMIUM();
544 virtual void genMailboxCHROMIUM(blink::WGC3Dbyte
* mailbox
);
545 virtual void produceTextureCHROMIUM(blink::WGC3Denum target
,
546 const blink::WGC3Dbyte
* mailbox
);
547 virtual void produceTextureDirectCHROMIUM(blink::WebGLId texture
,
548 blink::WGC3Denum target
,
549 const blink::WGC3Dbyte
* mailbox
);
550 virtual void consumeTextureCHROMIUM(blink::WGC3Denum target
,
551 const blink::WGC3Dbyte
* mailbox
);
552 virtual blink::WebGLId
createAndConsumeTextureCHROMIUM(
553 blink::WGC3Denum target
,
554 const blink::WGC3Dbyte
* mailbox
);
556 virtual void genValuebuffersCHROMIUM(blink::WGC3Dsizei count
,
557 blink::WebGLId
* ids
);
558 virtual blink::WebGLId
createValuebufferCHROMIUM();
559 virtual void deleteValuebuffersCHROMIUM(blink::WGC3Dsizei count
,
560 blink::WebGLId
* ids
);
561 virtual void deleteValuebufferCHROMIUM(blink::WebGLId
);
562 virtual void bindValuebufferCHROMIUM(blink::WGC3Denum target
,
563 blink::WebGLId valuebuffer
);
564 virtual blink::WGC3Dboolean
isValuebufferCHROMIUM(
565 blink::WebGLId renderbuffer
);
566 virtual void subscribeValueCHROMIUM(blink::WGC3Denum target
,
567 blink::WGC3Denum subscription
);
568 virtual void populateSubscribedValuesCHROMIUM(blink::WGC3Denum target
);
569 virtual void uniformValuebufferCHROMIUM(blink::WGC3Dint location
,
570 blink::WGC3Denum target
,
571 blink::WGC3Denum subscription
);
572 virtual void traceBeginCHROMIUM(const blink::WGC3Dchar
* category_name
,
573 const blink::WGC3Dchar
* trace_name
);
574 virtual void traceEndCHROMIUM();
576 virtual void insertEventMarkerEXT(const blink::WGC3Dchar
* marker
);
577 virtual void pushGroupMarkerEXT(const blink::WGC3Dchar
* marker
);
578 virtual void popGroupMarkerEXT();
580 // GL_OES_vertex_array_object
581 virtual blink::WebGLId
createVertexArrayOES();
582 virtual void deleteVertexArrayOES(blink::WebGLId array
);
583 virtual blink::WGC3Dboolean
isVertexArrayOES(blink::WebGLId array
);
584 virtual void bindVertexArrayOES(blink::WebGLId array
);
586 virtual void bindTexImage2DCHROMIUM(blink::WGC3Denum target
,
587 blink::WGC3Dint image_id
);
588 virtual void releaseTexImage2DCHROMIUM(blink::WGC3Denum target
,
589 blink::WGC3Dint image_id
);
591 virtual void* mapBufferCHROMIUM(blink::WGC3Denum target
,
592 blink::WGC3Denum access
);
593 virtual blink::WGC3Dboolean
unmapBufferCHROMIUM(blink::WGC3Denum target
);
595 // Async pixel transfer functions.
596 virtual void asyncTexImage2DCHROMIUM(blink::WGC3Denum target
,
597 blink::WGC3Dint level
,
598 blink::WGC3Denum internalformat
,
599 blink::WGC3Dsizei width
,
600 blink::WGC3Dsizei height
,
601 blink::WGC3Dint border
,
602 blink::WGC3Denum format
,
603 blink::WGC3Denum type
,
605 virtual void asyncTexSubImage2DCHROMIUM(blink::WGC3Denum target
,
606 blink::WGC3Dint level
,
607 blink::WGC3Dint xoffset
,
608 blink::WGC3Dint yoffset
,
609 blink::WGC3Dsizei width
,
610 blink::WGC3Dsizei height
,
611 blink::WGC3Denum format
,
612 blink::WGC3Denum type
,
614 virtual void waitAsyncTexImage2DCHROMIUM(blink::WGC3Denum target
);
616 // GL_EXT_draw_buffers
617 virtual void drawBuffersEXT(blink::WGC3Dsizei n
,
618 const blink::WGC3Denum
* bufs
);
620 // GL_ANGLE_instanced_arrays
621 virtual void drawArraysInstancedANGLE(blink::WGC3Denum mode
,
622 blink::WGC3Dint first
,
623 blink::WGC3Dsizei count
,
624 blink::WGC3Dsizei primcount
);
625 virtual void drawElementsInstancedANGLE(blink::WGC3Denum mode
,
626 blink::WGC3Dsizei count
,
627 blink::WGC3Denum type
,
628 blink::WGC3Dintptr offset
,
629 blink::WGC3Dsizei primcount
);
630 virtual void vertexAttribDivisorANGLE(blink::WGC3Duint index
,
631 blink::WGC3Duint divisor
);
633 // GL_CHROMIUM_gpu_memory_buffer_image
634 virtual blink::WGC3Duint
createGpuMemoryBufferImageCHROMIUM(
635 blink::WGC3Dsizei width
,
636 blink::WGC3Dsizei height
,
637 blink::WGC3Denum internalformat
,
638 blink::WGC3Denum usage
);
639 virtual void destroyImageCHROMIUM(blink::WGC3Duint image_id
);
641 // GL_EXT_multisampled_render_to_texture
642 virtual void framebufferTexture2DMultisampleEXT(blink::WGC3Denum target
,
643 blink::WGC3Denum attachment
,
644 blink::WGC3Denum textarget
,
645 blink::WebGLId texture
,
646 blink::WGC3Dint level
,
647 blink::WGC3Dsizei samples
);
648 virtual void renderbufferStorageMultisampleEXT(
649 blink::WGC3Denum target
,
650 blink::WGC3Dsizei samples
,
651 blink::WGC3Denum internalformat
,
652 blink::WGC3Dsizei width
,
653 blink::WGC3Dsizei height
);
655 // OpenGL ES 3.0 functions not represented by pre-existing extensions
656 virtual void beginTransformFeedback(blink::WGC3Denum primitiveMode
);
657 virtual void bindBufferBase(blink::WGC3Denum target
,
658 blink::WGC3Duint index
,
659 blink::WGC3Duint buffer
);
660 virtual void bindBufferRange(blink::WGC3Denum target
,
661 blink::WGC3Duint index
,
662 blink::WGC3Duint buffer
,
663 blink::WGC3Dintptr offset
,
664 blink::WGC3Dsizeiptr size
);
665 virtual void bindSampler(blink::WGC3Duint unit
, blink::WebGLId sampler
);
666 virtual void bindTransformFeedback(blink::WGC3Denum target
,
667 blink::WebGLId transformfeedback
);
668 virtual void clearBufferfi(blink::WGC3Denum buffer
,
669 blink::WGC3Dint drawbuffer
,
670 blink::WGC3Dfloat depth
,
671 blink::WGC3Dint stencil
);
672 virtual void clearBufferfv(blink::WGC3Denum buffer
,
673 blink::WGC3Dint drawbuffer
,
674 const blink::WGC3Dfloat
* value
);
675 virtual void clearBufferiv(blink::WGC3Denum buffer
,
676 blink::WGC3Dint drawbuffer
,
677 const blink::WGC3Dint
* value
);
678 virtual void clearBufferuiv(blink::WGC3Denum buffer
,
679 blink::WGC3Dint drawbuffer
,
680 const blink::WGC3Duint
* value
);
681 virtual blink::WGC3Denum
clientWaitSync(blink::WGC3Dsync sync
,
682 blink::WGC3Dbitfield flags
,
683 blink::WGC3Duint64 timeout
);
684 virtual void compressedTexImage3D(blink::WGC3Denum target
,
685 blink::WGC3Dint level
,
686 blink::WGC3Denum internalformat
,
687 blink::WGC3Dsizei width
,
688 blink::WGC3Dsizei height
,
689 blink::WGC3Dsizei depth
,
690 blink::WGC3Dint border
,
691 blink::WGC3Dsizei imageSize
,
693 virtual void compressedTexSubImage3D(blink::WGC3Denum target
,
694 blink::WGC3Dint level
,
695 blink::WGC3Dint xoffset
,
696 blink::WGC3Dint yoffset
,
697 blink::WGC3Dint zoffset
,
698 blink::WGC3Dsizei width
,
699 blink::WGC3Dsizei height
,
700 blink::WGC3Dsizei depth
,
701 blink::WGC3Denum format
,
702 blink::WGC3Dsizei imageSize
,
704 virtual void copyBufferSubData(blink::WGC3Denum readTarget
,
705 blink::WGC3Denum writeTarget
,
706 blink::WGC3Dintptr readOffset
,
707 blink::WGC3Dintptr writeOffset
,
708 blink::WGC3Dsizeiptr size
);
709 virtual void copyTexSubImage3D(blink::WGC3Denum target
,
710 blink::WGC3Dint level
,
711 blink::WGC3Dint xoffset
,
712 blink::WGC3Dint yoffset
,
713 blink::WGC3Dint zoffset
,
716 blink::WGC3Dsizei width
,
717 blink::WGC3Dsizei height
);
718 virtual blink::WebGLId
createSampler();
719 virtual blink::WebGLId
createTransformFeedback();
720 virtual void deleteSampler(blink::WebGLId sampler
);
721 virtual void deleteSync(blink::WGC3Dsync sync
);
722 virtual void deleteTransformFeedback(blink::WebGLId transformfeedback
);
723 virtual void drawRangeElements(blink::WGC3Denum mode
,
724 blink::WGC3Duint start
,
725 blink::WGC3Duint end
,
726 blink::WGC3Dsizei count
,
727 blink::WGC3Denum type
,
728 blink::WGC3Dintptr offset
);
729 virtual void endTransformFeedback(void);
730 virtual blink::WGC3Dsync
fenceSync(blink::WGC3Denum condition
,
731 blink::WGC3Dbitfield flags
);
732 virtual void framebufferTextureLayer(blink::WGC3Denum target
,
733 blink::WGC3Denum attachment
,
734 blink::WGC3Duint texture
,
735 blink::WGC3Dint level
,
736 blink::WGC3Dint layer
);
737 virtual void getActiveUniformBlockName(blink::WGC3Duint program
,
738 blink::WGC3Duint uniformBlockIndex
,
739 blink::WGC3Dsizei bufSize
,
740 blink::WGC3Dsizei
* length
,
741 blink::WGC3Dchar
* uniformBlockName
);
742 virtual void getActiveUniformBlockiv(blink::WGC3Duint program
,
743 blink::WGC3Duint uniformBlockIndex
,
744 blink::WGC3Denum pname
,
745 blink::WGC3Dint
* params
);
746 virtual void getActiveUniformsiv(blink::WGC3Duint program
,
747 blink::WGC3Dsizei uniformCount
,
748 const blink::WGC3Duint
*uniformIndices
,
749 blink::WGC3Denum pname
,
750 blink::WGC3Dint
*params
);
751 virtual blink::WGC3Dint
getFragDataLocation(blink::WGC3Duint program
,
752 const blink::WGC3Dchar
* name
);
753 virtual void getInternalformativ(blink::WGC3Denum target
,
754 blink::WGC3Denum internalformat
,
755 blink::WGC3Denum pname
,
756 blink::WGC3Dsizei bufSize
,
757 blink::WGC3Dint
* params
);
758 virtual void getSamplerParameterfv(blink::WGC3Duint sampler
,
759 blink::WGC3Denum pname
,
760 blink::WGC3Dfloat
* params
);
761 virtual void getSamplerParameteriv(blink::WGC3Duint sampler
,
762 blink::WGC3Denum pname
,
763 blink::WGC3Dint
* params
);
764 virtual void getTransformFeedbackVarying(blink::WGC3Duint program
,
765 blink::WGC3Duint index
,
766 blink::WGC3Dsizei bufSize
,
767 blink::WGC3Dsizei
*length
,
768 blink::WGC3Dsizei
*size
,
769 blink::WGC3Denum
*type
,
770 blink::WGC3Dchar
*name
);
771 virtual blink::WGC3Duint
getUniformBlockIndex(
772 blink::WGC3Duint program
, const blink::WGC3Dchar
* uniformBlockName
);
773 virtual void getUniformIndices(blink::WGC3Duint program
,
774 blink::WGC3Dsizei uniformCount
,
775 const blink::WGC3Dchar
*const*uniformNames
,
776 blink::WGC3Duint
*uniformIndices
);
777 virtual void getUniformuiv(blink::WGC3Duint program
,
778 blink::WGC3Dint location
,
779 blink::WGC3Duint
*params
);
780 virtual void getVertexAttribIiv(blink::WGC3Duint index
,
781 blink::WGC3Denum pname
,
782 blink::WGC3Dint
*params
);
783 virtual void getVertexAttribIuiv(blink::WGC3Duint index
,
784 blink::WGC3Denum pname
,
785 blink::WGC3Duint
*params
);
786 virtual void invalidateFramebuffer(blink::WGC3Denum target
,
787 blink::WGC3Dsizei numAttachments
,
788 const blink::WGC3Denum
* attachments
);
789 virtual void invalidateSubFramebuffer(blink::WGC3Denum target
,
790 blink::WGC3Dsizei numAttachments
,
791 const blink::WGC3Denum
* attachments
,
794 blink::WGC3Dsizei width
,
795 blink::WGC3Dsizei height
);
796 virtual blink::WGC3Dboolean
isSampler(blink::WebGLId sampler
);
797 virtual blink::WGC3Dboolean
isSync(blink::WGC3Dsync sync
);
798 virtual blink::WGC3Dboolean
isTransformFeedback(blink::WGC3Duint id
);
799 virtual void* mapBufferRange(blink::WGC3Denum target
,
800 blink::WGC3Dintptr offset
,
801 blink::WGC3Dsizeiptr length
,
802 blink::WGC3Dbitfield access
);
803 virtual void pauseTransformFeedback(void);
804 //virtual void programParameteri(blink::WGC3Duint program,
805 // blink::WGC3Denum pname,
806 // blink::WGC3Dint value);
807 virtual void readBuffer(blink::WGC3Denum src
);
808 virtual void resumeTransformFeedback(void);
809 virtual void samplerParameterf(blink::WGC3Duint sampler
,
810 blink::WGC3Denum pname
,
811 blink::WGC3Dfloat param
);
812 virtual void samplerParameterfv(blink::WGC3Duint sampler
,
813 blink::WGC3Denum pname
,
814 const blink::WGC3Dfloat
* param
);
815 virtual void samplerParameteri(blink::WGC3Duint sampler
,
816 blink::WGC3Denum pname
,
817 blink::WGC3Dint param
);
818 virtual void samplerParameteriv(blink::WGC3Duint sampler
,
819 blink::WGC3Denum pname
,
820 const blink::WGC3Dint
* param
);
821 virtual void texImage3D(blink::WGC3Denum target
,
822 blink::WGC3Dint level
,
823 blink::WGC3Dint internalformat
,
824 blink::WGC3Dsizei width
,
825 blink::WGC3Dsizei height
,
826 blink::WGC3Dsizei depth
,
827 blink::WGC3Dint border
,
828 blink::WGC3Denum format
,
829 blink::WGC3Denum type
,
831 virtual void texStorage3D(blink::WGC3Denum target
,
832 blink::WGC3Dsizei levels
,
833 blink::WGC3Denum internalformat
,
834 blink::WGC3Dsizei width
,
835 blink::WGC3Dsizei height
,
836 blink::WGC3Dsizei depth
);
837 virtual void texSubImage3D(blink::WGC3Denum target
,
838 blink::WGC3Dint level
,
839 blink::WGC3Dint xoffset
,
840 blink::WGC3Dint yoffset
,
841 blink::WGC3Dint zoffset
,
842 blink::WGC3Dsizei width
,
843 blink::WGC3Dsizei height
,
844 blink::WGC3Dsizei depth
,
845 blink::WGC3Denum format
,
846 blink::WGC3Denum type
,
848 virtual void transformFeedbackVaryings(
849 blink::WGC3Duint program
,
850 blink::WGC3Dsizei count
,
851 const blink::WGC3Dchar
* const* varyings
,
852 blink::WGC3Denum bufferMode
);
853 virtual void uniform1ui(blink::WGC3Dint location
, blink::WGC3Duint x
);
854 virtual void uniform1uiv(blink::WGC3Dint location
,
855 blink::WGC3Dsizei count
,
856 const blink::WGC3Duint
* value
);
857 virtual void uniform2ui(blink::WGC3Dint location
,
860 virtual void uniform2uiv(blink::WGC3Dint location
,
861 blink::WGC3Dsizei count
,
862 const blink::WGC3Duint
* value
);
863 virtual void uniform3ui(blink::WGC3Dint location
,
867 virtual void uniform3uiv(blink::WGC3Dint location
,
868 blink::WGC3Dsizei count
,
869 const blink::WGC3Duint
* value
);
870 virtual void uniform4ui(blink::WGC3Dint location
,
875 virtual void uniform4uiv(blink::WGC3Dint location
,
876 blink::WGC3Dsizei count
,
877 const blink::WGC3Duint
* value
);
878 virtual void uniformBlockBinding(blink::WGC3Duint program
,
879 blink::WGC3Duint uniformBlockIndex
,
880 blink::WGC3Duint uniformBlockBinding
);
881 virtual void uniformMatrix2x3fv(blink::WGC3Dint location
,
882 blink::WGC3Dsizei count
,
883 blink::WGC3Dboolean transpose
,
884 const blink::WGC3Dfloat
* value
);
885 virtual void uniformMatrix2x4fv(blink::WGC3Dint location
,
886 blink::WGC3Dsizei count
,
887 blink::WGC3Dboolean transpose
,
888 const blink::WGC3Dfloat
* value
);
889 virtual void uniformMatrix3x2fv(blink::WGC3Dint location
,
890 blink::WGC3Dsizei count
,
891 blink::WGC3Dboolean transpose
,
892 const blink::WGC3Dfloat
* value
);
893 virtual void uniformMatrix3x4fv(blink::WGC3Dint location
,
894 blink::WGC3Dsizei count
,
895 blink::WGC3Dboolean transpose
,
896 const blink::WGC3Dfloat
* value
);
897 virtual void uniformMatrix4x2fv(blink::WGC3Dint location
,
898 blink::WGC3Dsizei count
,
899 blink::WGC3Dboolean transpose
,
900 const blink::WGC3Dfloat
* value
);
901 virtual void uniformMatrix4x3fv(blink::WGC3Dint location
,
902 blink::WGC3Dsizei count
,
903 blink::WGC3Dboolean transpose
,
904 const blink::WGC3Dfloat
* value
);
905 virtual blink::WGC3Dboolean
unmapBuffer(blink::WGC3Denum target
);
906 virtual void vertexAttribI4i(blink::WGC3Duint index
,
911 virtual void vertexAttribI4iv(blink::WGC3Duint index
,
912 const blink::WGC3Dint
* v
);
913 virtual void vertexAttribI4ui(blink::WGC3Duint index
,
918 virtual void vertexAttribI4uiv(blink::WGC3Duint index
,
919 const blink::WGC3Duint
* v
);
920 virtual void vertexAttribIPointer(blink::WGC3Duint index
,
921 blink::WGC3Dint size
,
922 blink::WGC3Denum type
,
923 blink::WGC3Dsizei stride
,
924 blink::WGC3Dintptr pointer
);
925 virtual void waitSync(blink::WGC3Dsync sync
,
926 blink::WGC3Dbitfield flags
,
927 blink::WGC3Duint64 timeout
);
929 virtual bool isContextLost();
930 virtual blink::WGC3Denum
getGraphicsResetStatusARB();
932 virtual GrGLInterface
* createGrGLInterface();
934 ::gpu::gles2::GLES2Interface
* GetGLInterface() {
938 // Convert WebGL context creation attributes into command buffer / EGL size
940 static void ConvertAttributes(
941 const blink::WebGraphicsContext3D::Attributes
& attributes
,
942 ::gpu::gles2::ContextCreationAttribHelper
* output_attribs
);
945 friend class WebGraphicsContext3DErrorMessageCallback
;
947 WebGraphicsContext3DImpl();
949 ::gpu::gles2::GLES2ImplementationErrorMessageCallback
*
950 getErrorMessageCallback();
951 virtual void OnErrorMessage(const std::string
& message
, int id
);
953 void setGLInterface(::gpu::gles2::GLES2Interface
* gl
) {
958 bool initialize_failed_
;
960 WebGraphicsContext3D::WebGraphicsContextLostCallback
* context_lost_callback_
;
962 WebGraphicsContext3D::WebGraphicsErrorMessageCallback
*
963 error_message_callback_
;
964 scoped_ptr
<WebGraphicsContext3DErrorMessageCallback
>
965 client_error_message_callback_
;
967 // Errors raised by synthesizeGLError().
968 std::vector
<blink::WGC3Denum
> synthetic_errors_
;
970 ::gpu::gles2::GLES2Interface
* gl_
;
971 bool lose_context_when_out_of_memory_
;
975 } // namespace gpu_blink
977 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_