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 applyScreenSpaceAntialiasingCHROMIUM();
54 virtual void attachShader(blink::WebGLId program
, blink::WebGLId shader
);
55 virtual void bindAttribLocation(blink::WebGLId program
,
56 blink::WGC3Duint index
,
57 const blink::WGC3Dchar
* name
);
58 virtual void bindBuffer(blink::WGC3Denum target
, blink::WebGLId buffer
);
59 virtual void bindFramebuffer(blink::WGC3Denum target
,
60 blink::WebGLId framebuffer
);
61 virtual void bindRenderbuffer(blink::WGC3Denum target
,
62 blink::WebGLId renderbuffer
);
63 virtual void bindTexture(blink::WGC3Denum target
, blink::WebGLId texture
);
64 virtual void blendColor(blink::WGC3Dclampf red
,
65 blink::WGC3Dclampf green
,
66 blink::WGC3Dclampf blue
,
67 blink::WGC3Dclampf alpha
);
68 virtual void blendEquation(blink::WGC3Denum mode
);
69 virtual void blendEquationSeparate(blink::WGC3Denum modeRGB
,
70 blink::WGC3Denum modeAlpha
);
71 virtual void blendFunc(blink::WGC3Denum sfactor
, blink::WGC3Denum dfactor
);
72 virtual void blendFuncSeparate(blink::WGC3Denum srcRGB
,
73 blink::WGC3Denum dstRGB
,
74 blink::WGC3Denum srcAlpha
,
75 blink::WGC3Denum dstAlpha
);
77 virtual void bufferData(blink::WGC3Denum target
,
78 blink::WGC3Dsizeiptr size
,
80 blink::WGC3Denum usage
);
81 virtual void bufferSubData(blink::WGC3Denum target
,
82 blink::WGC3Dintptr offset
,
83 blink::WGC3Dsizeiptr size
,
86 virtual blink::WGC3Denum
checkFramebufferStatus(blink::WGC3Denum target
);
87 virtual void clear(blink::WGC3Dbitfield mask
);
88 virtual void clearColor(blink::WGC3Dclampf red
,
89 blink::WGC3Dclampf green
,
90 blink::WGC3Dclampf blue
,
91 blink::WGC3Dclampf alpha
);
92 virtual void clearDepth(blink::WGC3Dclampf depth
);
93 virtual void clearStencil(blink::WGC3Dint s
);
94 virtual void colorMask(blink::WGC3Dboolean red
,
95 blink::WGC3Dboolean green
,
96 blink::WGC3Dboolean blue
,
97 blink::WGC3Dboolean alpha
);
98 virtual void compileShader(blink::WebGLId shader
);
100 virtual void compressedTexImage2D(blink::WGC3Denum target
,
101 blink::WGC3Dint level
,
102 blink::WGC3Denum internalformat
,
103 blink::WGC3Dsizei width
,
104 blink::WGC3Dsizei height
,
105 blink::WGC3Dint border
,
106 blink::WGC3Dsizei imageSize
,
108 virtual void compressedTexSubImage2D(blink::WGC3Denum target
,
109 blink::WGC3Dint level
,
110 blink::WGC3Dint xoffset
,
111 blink::WGC3Dint yoffset
,
112 blink::WGC3Dsizei width
,
113 blink::WGC3Dsizei height
,
114 blink::WGC3Denum format
,
115 blink::WGC3Dsizei imageSize
,
117 virtual void copyTexImage2D(blink::WGC3Denum target
,
118 blink::WGC3Dint level
,
119 blink::WGC3Denum internalformat
,
122 blink::WGC3Dsizei width
,
123 blink::WGC3Dsizei height
,
124 blink::WGC3Dint border
);
125 virtual void copyTexSubImage2D(blink::WGC3Denum target
,
126 blink::WGC3Dint level
,
127 blink::WGC3Dint xoffset
,
128 blink::WGC3Dint yoffset
,
131 blink::WGC3Dsizei width
,
132 blink::WGC3Dsizei height
);
133 virtual void cullFace(blink::WGC3Denum mode
);
134 virtual void depthFunc(blink::WGC3Denum func
);
135 virtual void depthMask(blink::WGC3Dboolean flag
);
136 virtual void depthRange(blink::WGC3Dclampf zNear
, blink::WGC3Dclampf zFar
);
137 virtual void detachShader(blink::WebGLId program
, blink::WebGLId shader
);
138 virtual void disable(blink::WGC3Denum cap
);
139 virtual void disableVertexAttribArray(blink::WGC3Duint index
);
140 virtual void drawArrays(blink::WGC3Denum mode
,
141 blink::WGC3Dint first
,
142 blink::WGC3Dsizei count
);
143 virtual void drawElements(blink::WGC3Denum mode
,
144 blink::WGC3Dsizei count
,
145 blink::WGC3Denum type
,
146 blink::WGC3Dintptr offset
);
148 virtual void enable(blink::WGC3Denum cap
);
149 virtual void enableVertexAttribArray(blink::WGC3Duint index
);
150 virtual void finish();
151 virtual void flush();
152 virtual void framebufferRenderbuffer(blink::WGC3Denum target
,
153 blink::WGC3Denum attachment
,
154 blink::WGC3Denum renderbuffertarget
,
155 blink::WebGLId renderbuffer
);
156 virtual void framebufferTexture2D(blink::WGC3Denum target
,
157 blink::WGC3Denum attachment
,
158 blink::WGC3Denum textarget
,
159 blink::WebGLId texture
,
160 blink::WGC3Dint level
);
161 virtual void frontFace(blink::WGC3Denum mode
);
162 virtual void generateMipmap(blink::WGC3Denum target
);
164 virtual bool getActiveAttrib(blink::WebGLId program
,
165 blink::WGC3Duint index
,
167 virtual bool getActiveUniform(blink::WebGLId program
,
168 blink::WGC3Duint index
,
171 virtual void getAttachedShaders(blink::WebGLId program
,
172 blink::WGC3Dsizei maxCount
,
173 blink::WGC3Dsizei
* count
,
174 blink::WebGLId
* shaders
);
176 virtual blink::WGC3Dint
getAttribLocation(blink::WebGLId program
,
177 const blink::WGC3Dchar
* name
);
179 virtual void getBooleanv(blink::WGC3Denum pname
, blink::WGC3Dboolean
* value
);
181 virtual void getBufferParameteriv(blink::WGC3Denum target
,
182 blink::WGC3Denum pname
,
183 blink::WGC3Dint
* value
);
185 virtual blink::WGC3Denum
getError();
187 virtual void getFloatv(blink::WGC3Denum pname
, blink::WGC3Dfloat
* value
);
189 virtual void getFramebufferAttachmentParameteriv(blink::WGC3Denum target
,
190 blink::WGC3Denum attachment
,
191 blink::WGC3Denum pname
,
192 blink::WGC3Dint
* value
);
194 virtual void getIntegerv(blink::WGC3Denum pname
, blink::WGC3Dint
* value
);
196 virtual void getInteger64v(blink::WGC3Denum pname
, blink::WGC3Dint64
* value
);
198 virtual void getProgramiv(blink::WebGLId program
,
199 blink::WGC3Denum pname
,
200 blink::WGC3Dint
* value
);
202 virtual blink::WebString
getProgramInfoLog(blink::WebGLId program
);
204 virtual void getRenderbufferParameteriv(blink::WGC3Denum target
,
205 blink::WGC3Denum pname
,
206 blink::WGC3Dint
* value
);
208 virtual void getShaderiv(blink::WebGLId shader
,
209 blink::WGC3Denum pname
,
210 blink::WGC3Dint
* value
);
212 virtual blink::WebString
getShaderInfoLog(blink::WebGLId shader
);
214 virtual void getShaderPrecisionFormat(blink::WGC3Denum shadertype
,
215 blink::WGC3Denum precisiontype
,
216 blink::WGC3Dint
* range
,
217 blink::WGC3Dint
* precision
);
219 virtual blink::WebString
getShaderSource(blink::WebGLId shader
);
220 virtual blink::WebString
getString(blink::WGC3Denum name
);
222 virtual void getTexParameterfv(blink::WGC3Denum target
,
223 blink::WGC3Denum pname
,
224 blink::WGC3Dfloat
* value
);
225 virtual void getTexParameteriv(blink::WGC3Denum target
,
226 blink::WGC3Denum pname
,
227 blink::WGC3Dint
* value
);
229 virtual void getUniformfv(blink::WebGLId program
,
230 blink::WGC3Dint location
,
231 blink::WGC3Dfloat
* value
);
232 virtual void getUniformiv(blink::WebGLId program
,
233 blink::WGC3Dint location
,
234 blink::WGC3Dint
* value
);
236 virtual blink::WGC3Dint
getUniformLocation(blink::WebGLId program
,
237 const blink::WGC3Dchar
* name
);
239 virtual void getVertexAttribfv(blink::WGC3Duint index
,
240 blink::WGC3Denum pname
,
241 blink::WGC3Dfloat
* value
);
242 virtual void getVertexAttribiv(blink::WGC3Duint index
,
243 blink::WGC3Denum pname
,
244 blink::WGC3Dint
* value
);
246 virtual blink::WGC3Dsizeiptr
getVertexAttribOffset(blink::WGC3Duint index
,
247 blink::WGC3Denum pname
);
249 virtual void hint(blink::WGC3Denum target
, blink::WGC3Denum mode
);
250 virtual blink::WGC3Dboolean
isBuffer(blink::WebGLId buffer
);
251 virtual blink::WGC3Dboolean
isEnabled(blink::WGC3Denum cap
);
252 virtual blink::WGC3Dboolean
isFramebuffer(blink::WebGLId framebuffer
);
253 virtual blink::WGC3Dboolean
isProgram(blink::WebGLId program
);
254 virtual blink::WGC3Dboolean
isRenderbuffer(blink::WebGLId renderbuffer
);
255 virtual blink::WGC3Dboolean
isShader(blink::WebGLId shader
);
256 virtual blink::WGC3Dboolean
isTexture(blink::WebGLId texture
);
257 virtual void lineWidth(blink::WGC3Dfloat
);
258 virtual void linkProgram(blink::WebGLId program
);
259 virtual void pixelStorei(blink::WGC3Denum pname
, blink::WGC3Dint param
);
260 virtual void polygonOffset(blink::WGC3Dfloat factor
, blink::WGC3Dfloat units
);
262 virtual void readPixels(blink::WGC3Dint x
,
264 blink::WGC3Dsizei width
,
265 blink::WGC3Dsizei height
,
266 blink::WGC3Denum format
,
267 blink::WGC3Denum type
,
270 virtual void releaseShaderCompiler();
271 virtual void renderbufferStorage(blink::WGC3Denum target
,
272 blink::WGC3Denum internalformat
,
273 blink::WGC3Dsizei width
,
274 blink::WGC3Dsizei height
);
275 virtual void sampleCoverage(blink::WGC3Dfloat value
,
276 blink::WGC3Dboolean invert
);
277 virtual void scissor(blink::WGC3Dint x
,
279 blink::WGC3Dsizei width
,
280 blink::WGC3Dsizei height
);
281 virtual void shaderSource(blink::WebGLId shader
,
282 const blink::WGC3Dchar
* string
);
283 virtual void stencilFunc(blink::WGC3Denum func
,
285 blink::WGC3Duint mask
);
286 virtual void stencilFuncSeparate(blink::WGC3Denum face
,
287 blink::WGC3Denum func
,
289 blink::WGC3Duint mask
);
290 virtual void stencilMask(blink::WGC3Duint mask
);
291 virtual void stencilMaskSeparate(blink::WGC3Denum face
,
292 blink::WGC3Duint mask
);
293 virtual void stencilOp(blink::WGC3Denum fail
,
294 blink::WGC3Denum zfail
,
295 blink::WGC3Denum zpass
);
296 virtual void stencilOpSeparate(blink::WGC3Denum face
,
297 blink::WGC3Denum fail
,
298 blink::WGC3Denum zfail
,
299 blink::WGC3Denum zpass
);
301 virtual void texImage2D(blink::WGC3Denum target
,
302 blink::WGC3Dint level
,
303 blink::WGC3Denum internalformat
,
304 blink::WGC3Dsizei width
,
305 blink::WGC3Dsizei height
,
306 blink::WGC3Dint border
,
307 blink::WGC3Denum format
,
308 blink::WGC3Denum type
,
311 virtual void texParameterf(blink::WGC3Denum target
,
312 blink::WGC3Denum pname
,
313 blink::WGC3Dfloat param
);
314 virtual void texParameteri(blink::WGC3Denum target
,
315 blink::WGC3Denum pname
,
316 blink::WGC3Dint param
);
318 virtual void texSubImage2D(blink::WGC3Denum target
,
319 blink::WGC3Dint level
,
320 blink::WGC3Dint xoffset
,
321 blink::WGC3Dint yoffset
,
322 blink::WGC3Dsizei width
,
323 blink::WGC3Dsizei height
,
324 blink::WGC3Denum format
,
325 blink::WGC3Denum type
,
328 virtual void uniform1f(blink::WGC3Dint location
, blink::WGC3Dfloat x
);
329 virtual void uniform1fv(blink::WGC3Dint location
,
330 blink::WGC3Dsizei count
,
331 const blink::WGC3Dfloat
* v
);
332 virtual void uniform1i(blink::WGC3Dint location
, blink::WGC3Dint x
);
333 virtual void uniform1iv(blink::WGC3Dint location
,
334 blink::WGC3Dsizei count
,
335 const blink::WGC3Dint
* v
);
336 virtual void uniform2f(blink::WGC3Dint location
,
338 blink::WGC3Dfloat y
);
339 virtual void uniform2fv(blink::WGC3Dint location
,
340 blink::WGC3Dsizei count
,
341 const blink::WGC3Dfloat
* v
);
342 virtual void uniform2i(blink::WGC3Dint location
,
345 virtual void uniform2iv(blink::WGC3Dint location
,
346 blink::WGC3Dsizei count
,
347 const blink::WGC3Dint
* v
);
348 virtual void uniform3f(blink::WGC3Dint location
,
351 blink::WGC3Dfloat z
);
352 virtual void uniform3fv(blink::WGC3Dint location
,
353 blink::WGC3Dsizei count
,
354 const blink::WGC3Dfloat
* v
);
355 virtual void uniform3i(blink::WGC3Dint location
,
359 virtual void uniform3iv(blink::WGC3Dint location
,
360 blink::WGC3Dsizei count
,
361 const blink::WGC3Dint
* v
);
362 virtual void uniform4f(blink::WGC3Dint location
,
366 blink::WGC3Dfloat w
);
367 virtual void uniform4fv(blink::WGC3Dint location
,
368 blink::WGC3Dsizei count
,
369 const blink::WGC3Dfloat
* v
);
370 virtual void uniform4i(blink::WGC3Dint location
,
375 virtual void uniform4iv(blink::WGC3Dint location
,
376 blink::WGC3Dsizei count
,
377 const blink::WGC3Dint
* v
);
378 virtual void uniformMatrix2fv(blink::WGC3Dint location
,
379 blink::WGC3Dsizei count
,
380 blink::WGC3Dboolean transpose
,
381 const blink::WGC3Dfloat
* value
);
382 virtual void uniformMatrix3fv(blink::WGC3Dint location
,
383 blink::WGC3Dsizei count
,
384 blink::WGC3Dboolean transpose
,
385 const blink::WGC3Dfloat
* value
);
386 virtual void uniformMatrix4fv(blink::WGC3Dint location
,
387 blink::WGC3Dsizei count
,
388 blink::WGC3Dboolean transpose
,
389 const blink::WGC3Dfloat
* value
);
391 virtual void useProgram(blink::WebGLId program
);
392 virtual void validateProgram(blink::WebGLId program
);
394 virtual void vertexAttrib1f(blink::WGC3Duint index
, blink::WGC3Dfloat x
);
395 virtual void vertexAttrib1fv(blink::WGC3Duint index
,
396 const blink::WGC3Dfloat
* values
);
397 virtual void vertexAttrib2f(blink::WGC3Duint index
,
399 blink::WGC3Dfloat y
);
400 virtual void vertexAttrib2fv(blink::WGC3Duint index
,
401 const blink::WGC3Dfloat
* values
);
402 virtual void vertexAttrib3f(blink::WGC3Duint index
,
405 blink::WGC3Dfloat z
);
406 virtual void vertexAttrib3fv(blink::WGC3Duint index
,
407 const blink::WGC3Dfloat
* values
);
408 virtual void vertexAttrib4f(blink::WGC3Duint index
,
412 blink::WGC3Dfloat w
);
413 virtual void vertexAttrib4fv(blink::WGC3Duint index
,
414 const blink::WGC3Dfloat
* values
);
415 virtual void vertexAttribPointer(blink::WGC3Duint index
,
416 blink::WGC3Dint size
,
417 blink::WGC3Denum type
,
418 blink::WGC3Dboolean normalized
,
419 blink::WGC3Dsizei stride
,
420 blink::WGC3Dintptr offset
);
422 virtual void viewport(blink::WGC3Dint x
,
424 blink::WGC3Dsizei width
,
425 blink::WGC3Dsizei height
);
427 virtual blink::WebGLId
createBuffer();
428 virtual blink::WebGLId
createFramebuffer();
429 virtual blink::WebGLId
createRenderbuffer();
430 virtual blink::WebGLId
createTexture();
432 virtual void deleteBuffer(blink::WebGLId
);
433 virtual void deleteFramebuffer(blink::WebGLId
);
434 virtual void deleteRenderbuffer(blink::WebGLId
);
435 virtual void deleteTexture(blink::WebGLId
);
437 virtual blink::WebGLId
createProgram();
438 virtual blink::WebGLId
createShader(blink::WGC3Denum
);
440 virtual void deleteProgram(blink::WebGLId
);
441 virtual void deleteShader(blink::WebGLId
);
443 virtual void synthesizeGLError(blink::WGC3Denum
);
445 virtual void* mapBufferSubDataCHROMIUM(blink::WGC3Denum target
,
446 blink::WGC3Dintptr offset
,
447 blink::WGC3Dsizeiptr size
,
448 blink::WGC3Denum access
);
449 virtual void unmapBufferSubDataCHROMIUM(const void*);
450 virtual void* mapTexSubImage2DCHROMIUM(blink::WGC3Denum target
,
451 blink::WGC3Dint level
,
452 blink::WGC3Dint xoffset
,
453 blink::WGC3Dint yoffset
,
454 blink::WGC3Dsizei width
,
455 blink::WGC3Dsizei height
,
456 blink::WGC3Denum format
,
457 blink::WGC3Denum type
,
458 blink::WGC3Denum access
);
459 virtual void unmapTexSubImage2DCHROMIUM(const void*);
461 virtual void setVisibilityCHROMIUM(bool visible
);
463 virtual void discardFramebufferEXT(blink::WGC3Denum target
,
464 blink::WGC3Dsizei numAttachments
,
465 const blink::WGC3Denum
* attachments
);
466 virtual void copyTextureToParentTextureCHROMIUM(blink::WebGLId texture
,
467 blink::WebGLId parentTexture
);
469 virtual blink::WebString
getRequestableExtensionsCHROMIUM();
470 virtual void requestExtensionCHROMIUM(const char*);
472 virtual void blitFramebufferCHROMIUM(blink::WGC3Dint srcX0
,
473 blink::WGC3Dint srcY0
,
474 blink::WGC3Dint srcX1
,
475 blink::WGC3Dint srcY1
,
476 blink::WGC3Dint dstX0
,
477 blink::WGC3Dint dstY0
,
478 blink::WGC3Dint dstX1
,
479 blink::WGC3Dint dstY1
,
480 blink::WGC3Dbitfield mask
,
481 blink::WGC3Denum filter
);
482 virtual void renderbufferStorageMultisampleCHROMIUM(
483 blink::WGC3Denum target
,
484 blink::WGC3Dsizei samples
,
485 blink::WGC3Denum internalformat
,
486 blink::WGC3Dsizei width
,
487 blink::WGC3Dsizei height
);
489 virtual blink::WebString
getTranslatedShaderSourceANGLE(
490 blink::WebGLId shader
);
492 virtual void setContextLostCallback(
493 WebGraphicsContext3D::WebGraphicsContextLostCallback
* callback
);
495 virtual void setErrorMessageCallback(
496 WebGraphicsContext3D::WebGraphicsErrorMessageCallback
* callback
);
498 virtual void texImageIOSurface2DCHROMIUM(blink::WGC3Denum target
,
499 blink::WGC3Dint width
,
500 blink::WGC3Dint height
,
501 blink::WGC3Duint ioSurfaceId
,
502 blink::WGC3Duint plane
);
504 virtual void texStorage2DEXT(blink::WGC3Denum target
,
505 blink::WGC3Dint levels
,
506 blink::WGC3Duint internalformat
,
507 blink::WGC3Dint width
,
508 blink::WGC3Dint height
);
510 virtual blink::WebGLId
createQueryEXT();
511 virtual void deleteQueryEXT(blink::WebGLId query
);
512 virtual blink::WGC3Dboolean
isQueryEXT(blink::WGC3Duint query
);
513 virtual void beginQueryEXT(blink::WGC3Denum target
, blink::WebGLId query
);
514 virtual void endQueryEXT(blink::WGC3Denum target
);
515 virtual void getQueryivEXT(blink::WGC3Denum target
,
516 blink::WGC3Denum pname
,
517 blink::WGC3Dint
* params
);
518 virtual void getQueryObjectuivEXT(blink::WebGLId query
,
519 blink::WGC3Denum pname
,
520 blink::WGC3Duint
* params
);
522 virtual void queryCounterEXT(blink::WebGLId query
, blink::WGC3Denum target
);
523 virtual void getQueryObjectui64vEXT(blink::WebGLId query
,
524 blink::WGC3Denum pname
,
525 blink::WGC3Duint64
* params
);
527 void copyTextureCHROMIUM(
528 blink::WGC3Denum target
,
529 blink::WebGLId source_id
,
530 blink::WebGLId dest_id
,
531 blink::WGC3Denum internal_format
,
532 blink::WGC3Denum dest_type
,
533 blink::WGC3Dboolean unpack_flip_y
,
534 blink::WGC3Dboolean unpack_premultiply_alpha
,
535 blink::WGC3Dboolean unpack_unmultiply_alpha
) override
;
537 void copySubTextureCHROMIUM(
538 blink::WGC3Denum target
,
539 blink::WebGLId source_id
,
540 blink::WebGLId dest_id
,
541 blink::WGC3Dint xoffset
,
542 blink::WGC3Dint yoffset
,
545 blink::WGC3Dsizei width
,
546 blink::WGC3Dsizei height
,
547 blink::WGC3Dboolean unpack_flip_y
,
548 blink::WGC3Dboolean unpack_premultiply_alpha
,
549 blink::WGC3Dboolean unpack_unmultiply_alpha
) override
;
551 virtual void bindUniformLocationCHROMIUM(blink::WebGLId program
,
552 blink::WGC3Dint location
,
553 const blink::WGC3Dchar
* uniform
);
555 virtual void shallowFlushCHROMIUM();
556 virtual void shallowFinishCHROMIUM();
558 virtual void genMailboxCHROMIUM(blink::WGC3Dbyte
* mailbox
);
559 virtual void produceTextureCHROMIUM(blink::WGC3Denum target
,
560 const blink::WGC3Dbyte
* mailbox
);
561 virtual void produceTextureDirectCHROMIUM(blink::WebGLId texture
,
562 blink::WGC3Denum target
,
563 const blink::WGC3Dbyte
* mailbox
);
564 virtual void consumeTextureCHROMIUM(blink::WGC3Denum target
,
565 const blink::WGC3Dbyte
* mailbox
);
566 virtual blink::WebGLId
createAndConsumeTextureCHROMIUM(
567 blink::WGC3Denum target
,
568 const blink::WGC3Dbyte
* mailbox
);
570 virtual void genValuebuffersCHROMIUM(blink::WGC3Dsizei count
,
571 blink::WebGLId
* ids
);
572 virtual blink::WebGLId
createValuebufferCHROMIUM();
573 virtual void deleteValuebuffersCHROMIUM(blink::WGC3Dsizei count
,
574 blink::WebGLId
* ids
);
575 virtual void deleteValuebufferCHROMIUM(blink::WebGLId
);
576 virtual void bindValuebufferCHROMIUM(blink::WGC3Denum target
,
577 blink::WebGLId valuebuffer
);
578 virtual blink::WGC3Dboolean
isValuebufferCHROMIUM(
579 blink::WebGLId renderbuffer
);
580 virtual void subscribeValueCHROMIUM(blink::WGC3Denum target
,
581 blink::WGC3Denum subscription
);
582 virtual void populateSubscribedValuesCHROMIUM(blink::WGC3Denum target
);
583 virtual void uniformValuebufferCHROMIUM(blink::WGC3Dint location
,
584 blink::WGC3Denum target
,
585 blink::WGC3Denum subscription
);
586 virtual void traceBeginCHROMIUM(const blink::WGC3Dchar
* category_name
,
587 const blink::WGC3Dchar
* trace_name
);
588 virtual void traceEndCHROMIUM();
590 virtual void insertEventMarkerEXT(const blink::WGC3Dchar
* marker
);
591 virtual void pushGroupMarkerEXT(const blink::WGC3Dchar
* marker
);
592 virtual void popGroupMarkerEXT();
594 // GL_OES_vertex_array_object
595 virtual blink::WebGLId
createVertexArrayOES();
596 virtual void deleteVertexArrayOES(blink::WebGLId array
);
597 virtual blink::WGC3Dboolean
isVertexArrayOES(blink::WebGLId array
);
598 virtual void bindVertexArrayOES(blink::WebGLId array
);
600 virtual void bindTexImage2DCHROMIUM(blink::WGC3Denum target
,
601 blink::WGC3Dint image_id
);
602 virtual void releaseTexImage2DCHROMIUM(blink::WGC3Denum target
,
603 blink::WGC3Dint image_id
);
605 virtual void* mapBufferCHROMIUM(blink::WGC3Denum target
,
606 blink::WGC3Denum access
);
607 virtual blink::WGC3Dboolean
unmapBufferCHROMIUM(blink::WGC3Denum target
);
609 // GL_EXT_draw_buffers
610 virtual void drawBuffersEXT(blink::WGC3Dsizei n
,
611 const blink::WGC3Denum
* bufs
);
613 // GL_ANGLE_instanced_arrays
614 virtual void drawArraysInstancedANGLE(blink::WGC3Denum mode
,
615 blink::WGC3Dint first
,
616 blink::WGC3Dsizei count
,
617 blink::WGC3Dsizei primcount
);
618 virtual void drawElementsInstancedANGLE(blink::WGC3Denum mode
,
619 blink::WGC3Dsizei count
,
620 blink::WGC3Denum type
,
621 blink::WGC3Dintptr offset
,
622 blink::WGC3Dsizei primcount
);
623 virtual void vertexAttribDivisorANGLE(blink::WGC3Duint index
,
624 blink::WGC3Duint divisor
);
626 // GL_CHROMIUM_gpu_memory_buffer_image
627 virtual blink::WGC3Duint
createGpuMemoryBufferImageCHROMIUM(
628 blink::WGC3Dsizei width
,
629 blink::WGC3Dsizei height
,
630 blink::WGC3Denum internalformat
,
631 blink::WGC3Denum usage
);
632 virtual void destroyImageCHROMIUM(blink::WGC3Duint image_id
);
634 // GL_EXT_multisampled_render_to_texture
635 virtual void framebufferTexture2DMultisampleEXT(blink::WGC3Denum target
,
636 blink::WGC3Denum attachment
,
637 blink::WGC3Denum textarget
,
638 blink::WebGLId texture
,
639 blink::WGC3Dint level
,
640 blink::WGC3Dsizei samples
);
641 virtual void renderbufferStorageMultisampleEXT(
642 blink::WGC3Denum target
,
643 blink::WGC3Dsizei samples
,
644 blink::WGC3Denum internalformat
,
645 blink::WGC3Dsizei width
,
646 blink::WGC3Dsizei height
);
648 // OpenGL ES 3.0 functions not represented by pre-existing extensions
649 virtual void beginTransformFeedback(blink::WGC3Denum primitiveMode
);
650 virtual void bindBufferBase(blink::WGC3Denum target
,
651 blink::WGC3Duint index
,
652 blink::WGC3Duint buffer
);
653 virtual void bindBufferRange(blink::WGC3Denum target
,
654 blink::WGC3Duint index
,
655 blink::WGC3Duint buffer
,
656 blink::WGC3Dintptr offset
,
657 blink::WGC3Dsizeiptr size
);
658 virtual void bindSampler(blink::WGC3Duint unit
, blink::WebGLId sampler
);
659 virtual void bindTransformFeedback(blink::WGC3Denum target
,
660 blink::WebGLId transformfeedback
);
661 virtual void clearBufferfi(blink::WGC3Denum buffer
,
662 blink::WGC3Dint drawbuffer
,
663 blink::WGC3Dfloat depth
,
664 blink::WGC3Dint stencil
);
665 virtual void clearBufferfv(blink::WGC3Denum buffer
,
666 blink::WGC3Dint drawbuffer
,
667 const blink::WGC3Dfloat
* value
);
668 virtual void clearBufferiv(blink::WGC3Denum buffer
,
669 blink::WGC3Dint drawbuffer
,
670 const blink::WGC3Dint
* value
);
671 virtual void clearBufferuiv(blink::WGC3Denum buffer
,
672 blink::WGC3Dint drawbuffer
,
673 const blink::WGC3Duint
* value
);
674 virtual blink::WGC3Denum
clientWaitSync(blink::WGC3Dsync sync
,
675 blink::WGC3Dbitfield flags
,
676 blink::WGC3Duint64 timeout
);
677 virtual void compressedTexImage3D(blink::WGC3Denum target
,
678 blink::WGC3Dint level
,
679 blink::WGC3Denum internalformat
,
680 blink::WGC3Dsizei width
,
681 blink::WGC3Dsizei height
,
682 blink::WGC3Dsizei depth
,
683 blink::WGC3Dint border
,
684 blink::WGC3Dsizei imageSize
,
686 virtual void compressedTexSubImage3D(blink::WGC3Denum target
,
687 blink::WGC3Dint level
,
688 blink::WGC3Dint xoffset
,
689 blink::WGC3Dint yoffset
,
690 blink::WGC3Dint zoffset
,
691 blink::WGC3Dsizei width
,
692 blink::WGC3Dsizei height
,
693 blink::WGC3Dsizei depth
,
694 blink::WGC3Denum format
,
695 blink::WGC3Dsizei imageSize
,
697 virtual void copyBufferSubData(blink::WGC3Denum readTarget
,
698 blink::WGC3Denum writeTarget
,
699 blink::WGC3Dintptr readOffset
,
700 blink::WGC3Dintptr writeOffset
,
701 blink::WGC3Dsizeiptr size
);
702 virtual void copyTexSubImage3D(blink::WGC3Denum target
,
703 blink::WGC3Dint level
,
704 blink::WGC3Dint xoffset
,
705 blink::WGC3Dint yoffset
,
706 blink::WGC3Dint zoffset
,
709 blink::WGC3Dsizei width
,
710 blink::WGC3Dsizei height
);
711 virtual blink::WebGLId
createSampler();
712 virtual blink::WebGLId
createTransformFeedback();
713 virtual void deleteSampler(blink::WebGLId sampler
);
714 virtual void deleteSync(blink::WGC3Dsync sync
);
715 virtual void deleteTransformFeedback(blink::WebGLId transformfeedback
);
716 virtual void drawRangeElements(blink::WGC3Denum mode
,
717 blink::WGC3Duint start
,
718 blink::WGC3Duint end
,
719 blink::WGC3Dsizei count
,
720 blink::WGC3Denum type
,
721 blink::WGC3Dintptr offset
);
722 virtual void endTransformFeedback(void);
723 virtual blink::WGC3Dsync
fenceSync(blink::WGC3Denum condition
,
724 blink::WGC3Dbitfield flags
);
725 virtual void framebufferTextureLayer(blink::WGC3Denum target
,
726 blink::WGC3Denum attachment
,
727 blink::WGC3Duint texture
,
728 blink::WGC3Dint level
,
729 blink::WGC3Dint layer
);
730 virtual void getActiveUniformBlockName(blink::WGC3Duint program
,
731 blink::WGC3Duint uniformBlockIndex
,
732 blink::WGC3Dsizei bufSize
,
733 blink::WGC3Dsizei
* length
,
734 blink::WGC3Dchar
* uniformBlockName
);
735 virtual void getActiveUniformBlockiv(blink::WGC3Duint program
,
736 blink::WGC3Duint uniformBlockIndex
,
737 blink::WGC3Denum pname
,
738 blink::WGC3Dint
* params
);
739 virtual void getActiveUniformsiv(blink::WGC3Duint program
,
740 blink::WGC3Dsizei uniformCount
,
741 const blink::WGC3Duint
*uniformIndices
,
742 blink::WGC3Denum pname
,
743 blink::WGC3Dint
*params
);
744 virtual blink::WGC3Dint
getFragDataLocation(blink::WGC3Duint program
,
745 const blink::WGC3Dchar
* name
);
746 virtual void getInternalformativ(blink::WGC3Denum target
,
747 blink::WGC3Denum internalformat
,
748 blink::WGC3Denum pname
,
749 blink::WGC3Dsizei bufSize
,
750 blink::WGC3Dint
* params
);
751 virtual void getSamplerParameterfv(blink::WGC3Duint sampler
,
752 blink::WGC3Denum pname
,
753 blink::WGC3Dfloat
* params
);
754 virtual void getSamplerParameteriv(blink::WGC3Duint sampler
,
755 blink::WGC3Denum pname
,
756 blink::WGC3Dint
* params
);
757 virtual void getTransformFeedbackVarying(blink::WGC3Duint program
,
758 blink::WGC3Duint index
,
759 blink::WGC3Dsizei bufSize
,
760 blink::WGC3Dsizei
*length
,
761 blink::WGC3Dsizei
*size
,
762 blink::WGC3Denum
*type
,
763 blink::WGC3Dchar
*name
);
764 virtual blink::WGC3Duint
getUniformBlockIndex(
765 blink::WGC3Duint program
, const blink::WGC3Dchar
* uniformBlockName
);
766 virtual void getUniformIndices(blink::WGC3Duint program
,
767 blink::WGC3Dsizei uniformCount
,
768 const blink::WGC3Dchar
*const*uniformNames
,
769 blink::WGC3Duint
*uniformIndices
);
770 virtual void getUniformuiv(blink::WGC3Duint program
,
771 blink::WGC3Dint location
,
772 blink::WGC3Duint
*params
);
773 virtual void getVertexAttribIiv(blink::WGC3Duint index
,
774 blink::WGC3Denum pname
,
775 blink::WGC3Dint
*params
);
776 virtual void getVertexAttribIuiv(blink::WGC3Duint index
,
777 blink::WGC3Denum pname
,
778 blink::WGC3Duint
*params
);
779 virtual void invalidateFramebuffer(blink::WGC3Denum target
,
780 blink::WGC3Dsizei numAttachments
,
781 const blink::WGC3Denum
* attachments
);
782 virtual void invalidateSubFramebuffer(blink::WGC3Denum target
,
783 blink::WGC3Dsizei numAttachments
,
784 const blink::WGC3Denum
* attachments
,
787 blink::WGC3Dsizei width
,
788 blink::WGC3Dsizei height
);
789 virtual blink::WGC3Dboolean
isSampler(blink::WebGLId sampler
);
790 virtual blink::WGC3Dboolean
isSync(blink::WGC3Dsync sync
);
791 virtual blink::WGC3Dboolean
isTransformFeedback(blink::WGC3Duint id
);
792 virtual void* mapBufferRange(blink::WGC3Denum target
,
793 blink::WGC3Dintptr offset
,
794 blink::WGC3Dsizeiptr length
,
795 blink::WGC3Dbitfield access
);
796 virtual void pauseTransformFeedback(void);
797 //virtual void programParameteri(blink::WGC3Duint program,
798 // blink::WGC3Denum pname,
799 // blink::WGC3Dint value);
800 virtual void readBuffer(blink::WGC3Denum src
);
801 virtual void resumeTransformFeedback(void);
802 virtual void samplerParameterf(blink::WGC3Duint sampler
,
803 blink::WGC3Denum pname
,
804 blink::WGC3Dfloat param
);
805 virtual void samplerParameterfv(blink::WGC3Duint sampler
,
806 blink::WGC3Denum pname
,
807 const blink::WGC3Dfloat
* param
);
808 virtual void samplerParameteri(blink::WGC3Duint sampler
,
809 blink::WGC3Denum pname
,
810 blink::WGC3Dint param
);
811 virtual void samplerParameteriv(blink::WGC3Duint sampler
,
812 blink::WGC3Denum pname
,
813 const blink::WGC3Dint
* param
);
814 virtual void texImage3D(blink::WGC3Denum target
,
815 blink::WGC3Dint level
,
816 blink::WGC3Dint internalformat
,
817 blink::WGC3Dsizei width
,
818 blink::WGC3Dsizei height
,
819 blink::WGC3Dsizei depth
,
820 blink::WGC3Dint border
,
821 blink::WGC3Denum format
,
822 blink::WGC3Denum type
,
824 virtual void texStorage3D(blink::WGC3Denum target
,
825 blink::WGC3Dsizei levels
,
826 blink::WGC3Denum internalformat
,
827 blink::WGC3Dsizei width
,
828 blink::WGC3Dsizei height
,
829 blink::WGC3Dsizei depth
);
830 virtual void texSubImage3D(blink::WGC3Denum target
,
831 blink::WGC3Dint level
,
832 blink::WGC3Dint xoffset
,
833 blink::WGC3Dint yoffset
,
834 blink::WGC3Dint zoffset
,
835 blink::WGC3Dsizei width
,
836 blink::WGC3Dsizei height
,
837 blink::WGC3Dsizei depth
,
838 blink::WGC3Denum format
,
839 blink::WGC3Denum type
,
841 virtual void transformFeedbackVaryings(
842 blink::WGC3Duint program
,
843 blink::WGC3Dsizei count
,
844 const blink::WGC3Dchar
* const* varyings
,
845 blink::WGC3Denum bufferMode
);
846 virtual void uniform1ui(blink::WGC3Dint location
, blink::WGC3Duint x
);
847 virtual void uniform1uiv(blink::WGC3Dint location
,
848 blink::WGC3Dsizei count
,
849 const blink::WGC3Duint
* value
);
850 virtual void uniform2ui(blink::WGC3Dint location
,
853 virtual void uniform2uiv(blink::WGC3Dint location
,
854 blink::WGC3Dsizei count
,
855 const blink::WGC3Duint
* value
);
856 virtual void uniform3ui(blink::WGC3Dint location
,
860 virtual void uniform3uiv(blink::WGC3Dint location
,
861 blink::WGC3Dsizei count
,
862 const blink::WGC3Duint
* value
);
863 virtual void uniform4ui(blink::WGC3Dint location
,
868 virtual void uniform4uiv(blink::WGC3Dint location
,
869 blink::WGC3Dsizei count
,
870 const blink::WGC3Duint
* value
);
871 virtual void uniformBlockBinding(blink::WGC3Duint program
,
872 blink::WGC3Duint uniformBlockIndex
,
873 blink::WGC3Duint uniformBlockBinding
);
874 virtual void uniformMatrix2x3fv(blink::WGC3Dint location
,
875 blink::WGC3Dsizei count
,
876 blink::WGC3Dboolean transpose
,
877 const blink::WGC3Dfloat
* value
);
878 virtual void uniformMatrix2x4fv(blink::WGC3Dint location
,
879 blink::WGC3Dsizei count
,
880 blink::WGC3Dboolean transpose
,
881 const blink::WGC3Dfloat
* value
);
882 virtual void uniformMatrix3x2fv(blink::WGC3Dint location
,
883 blink::WGC3Dsizei count
,
884 blink::WGC3Dboolean transpose
,
885 const blink::WGC3Dfloat
* value
);
886 virtual void uniformMatrix3x4fv(blink::WGC3Dint location
,
887 blink::WGC3Dsizei count
,
888 blink::WGC3Dboolean transpose
,
889 const blink::WGC3Dfloat
* value
);
890 virtual void uniformMatrix4x2fv(blink::WGC3Dint location
,
891 blink::WGC3Dsizei count
,
892 blink::WGC3Dboolean transpose
,
893 const blink::WGC3Dfloat
* value
);
894 virtual void uniformMatrix4x3fv(blink::WGC3Dint location
,
895 blink::WGC3Dsizei count
,
896 blink::WGC3Dboolean transpose
,
897 const blink::WGC3Dfloat
* value
);
898 virtual blink::WGC3Dboolean
unmapBuffer(blink::WGC3Denum target
);
899 virtual void vertexAttribI4i(blink::WGC3Duint index
,
904 virtual void vertexAttribI4iv(blink::WGC3Duint index
,
905 const blink::WGC3Dint
* v
);
906 virtual void vertexAttribI4ui(blink::WGC3Duint index
,
911 virtual void vertexAttribI4uiv(blink::WGC3Duint index
,
912 const blink::WGC3Duint
* v
);
913 virtual void vertexAttribIPointer(blink::WGC3Duint index
,
914 blink::WGC3Dint size
,
915 blink::WGC3Denum type
,
916 blink::WGC3Dsizei stride
,
917 blink::WGC3Dintptr pointer
);
918 virtual void waitSync(blink::WGC3Dsync sync
,
919 blink::WGC3Dbitfield flags
,
920 blink::WGC3Duint64 timeout
);
922 virtual bool isContextLost();
923 virtual blink::WGC3Denum
getGraphicsResetStatusARB();
925 virtual GrGLInterface
* createGrGLInterface();
927 ::gpu::gles2::GLES2Interface
* GetGLInterface() {
931 // Convert WebGL context creation attributes into command buffer / EGL size
933 static void ConvertAttributes(
934 const blink::WebGraphicsContext3D::Attributes
& attributes
,
935 ::gpu::gles2::ContextCreationAttribHelper
* output_attribs
);
938 friend class WebGraphicsContext3DErrorMessageCallback
;
940 WebGraphicsContext3DImpl();
942 ::gpu::gles2::GLES2ImplementationErrorMessageCallback
*
943 getErrorMessageCallback();
944 virtual void OnErrorMessage(const std::string
& message
, int id
);
946 void setGLInterface(::gpu::gles2::GLES2Interface
* gl
) {
951 bool initialize_failed_
;
953 WebGraphicsContext3D::WebGraphicsContextLostCallback
* context_lost_callback_
;
955 WebGraphicsContext3D::WebGraphicsErrorMessageCallback
*
956 error_message_callback_
;
957 scoped_ptr
<WebGraphicsContext3DErrorMessageCallback
>
958 client_error_message_callback_
;
960 // Errors raised by synthesizeGLError().
961 std::vector
<blink::WGC3Denum
> synthetic_errors_
;
963 ::gpu::gles2::GLES2Interface
* gl_
;
964 bool lose_context_when_out_of_memory_
;
968 } // namespace gpu_blink
970 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_