1 // Copyright 2011 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 CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_
6 #define CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_
10 #include "base/hash_tables.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/stl_util.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
14 #include "third_party/khronos/GLES2/gl2.h"
18 // WebGraphicsContext3D base class for use in WebKit unit tests.
19 // All operations are no-ops (returning 0 if necessary).
20 class FakeWebGraphicsContext3D
: public WebKit::WebGraphicsContext3D
{
22 static scoped_ptr
<FakeWebGraphicsContext3D
> Create() {
23 return make_scoped_ptr(new FakeWebGraphicsContext3D());
25 static scoped_ptr
<FakeWebGraphicsContext3D
> Create(
26 const WebKit::WebGraphicsContext3D::Attributes
& attributes
) {
27 return make_scoped_ptr(new FakeWebGraphicsContext3D(attributes
));
29 virtual ~FakeWebGraphicsContext3D();
31 virtual bool makeContextCurrent();
36 virtual void reshape(int width
, int height
);
38 virtual bool isGLES2Compliant();
40 virtual bool readBackFramebuffer(
41 unsigned char* pixels
,
43 WebKit::WebGLId framebuffer
,
47 virtual WebKit::WebGLId
getPlatformTextureId();
49 virtual void prepareTexture() {}
51 virtual void postSubBufferCHROMIUM(int x
, int y
, int width
, int height
) {}
53 virtual void synthesizeGLError(WebKit::WGC3Denum
) {}
55 virtual bool isContextLost();
56 virtual WebKit::WGC3Denum
getGraphicsResetStatusARB();
58 virtual void* mapBufferSubDataCHROMIUM(
59 WebKit::WGC3Denum target
,
60 WebKit::WGC3Dintptr offset
,
61 WebKit::WGC3Dsizeiptr size
,
62 WebKit::WGC3Denum access
);
64 virtual void unmapBufferSubDataCHROMIUM(const void*) {}
65 virtual void* mapTexSubImage2DCHROMIUM(
66 WebKit::WGC3Denum target
,
67 WebKit::WGC3Dint level
,
68 WebKit::WGC3Dint xoffset
,
69 WebKit::WGC3Dint yoffset
,
70 WebKit::WGC3Dsizei width
,
71 WebKit::WGC3Dsizei height
,
72 WebKit::WGC3Denum format
,
73 WebKit::WGC3Denum type
,
74 WebKit::WGC3Denum access
);
75 virtual void unmapTexSubImage2DCHROMIUM(const void*) {}
77 virtual void setVisibilityCHROMIUM(bool visible
) {}
79 virtual void discardFramebufferEXT(
80 WebKit::WGC3Denum target
,
81 WebKit::WGC3Dsizei num_attachments
,
82 const WebKit::WGC3Denum
* attachments
) {}
83 virtual void ensureFramebufferCHROMIUM() {}
85 virtual void setMemoryAllocationChangedCallbackCHROMIUM(
86 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM
* callback
) {}
88 virtual WebKit::WebString
getRequestableExtensionsCHROMIUM();
89 virtual void requestExtensionCHROMIUM(const char*) {}
91 virtual void blitFramebufferCHROMIUM(
92 WebKit::WGC3Dint srcX0
, WebKit::WGC3Dint srcY0
,
93 WebKit::WGC3Dint srcX1
, WebKit::WGC3Dint srcY1
,
94 WebKit::WGC3Dint dstX0
, WebKit::WGC3Dint dstY0
,
95 WebKit::WGC3Dint dstX1
, WebKit::WGC3Dint dstY1
,
96 WebKit::WGC3Dbitfield mask
,
97 WebKit::WGC3Denum filter
) {}
98 virtual void renderbufferStorageMultisampleCHROMIUM(
99 WebKit::WGC3Denum target
,
100 WebKit::WGC3Dsizei samples
,
101 WebKit::WGC3Denum internalformat
,
102 WebKit::WGC3Dsizei width
,
103 WebKit::WGC3Dsizei height
) {}
105 virtual void activeTexture(WebKit::WGC3Denum texture
) {}
106 virtual void attachShader(WebKit::WebGLId program
, WebKit::WebGLId shader
);
107 virtual void bindAttribLocation(
108 WebKit::WebGLId program
,
109 WebKit::WGC3Duint index
,
110 const WebKit::WGC3Dchar
* name
) {}
111 virtual void bindBuffer(WebKit::WGC3Denum target
, WebKit::WebGLId buffer
);
112 virtual void bindFramebuffer(
113 WebKit::WGC3Denum target
, WebKit::WebGLId framebuffer
);
114 virtual void bindRenderbuffer(
115 WebKit::WGC3Denum target
, WebKit::WebGLId renderbuffer
);
116 virtual void bindTexture(
117 WebKit::WGC3Denum target
,
118 WebKit::WebGLId texture_id
);
119 virtual void blendColor(
120 WebKit::WGC3Dclampf red
,
121 WebKit::WGC3Dclampf green
,
122 WebKit::WGC3Dclampf blue
,
123 WebKit::WGC3Dclampf alpha
) {}
124 virtual void blendEquation(WebKit::WGC3Denum mode
) {}
125 virtual void blendEquationSeparate(
126 WebKit::WGC3Denum mode_rgb
,
127 WebKit::WGC3Denum mode_alpha
) {}
128 virtual void blendFunc(
129 WebKit::WGC3Denum sfactor
,
130 WebKit::WGC3Denum dfactor
) {}
131 virtual void blendFuncSeparate(
132 WebKit::WGC3Denum src_rgb
,
133 WebKit::WGC3Denum dst_rgb
,
134 WebKit::WGC3Denum src_alpha
,
135 WebKit::WGC3Denum dst_alpha
) {}
137 virtual void bufferData(
138 WebKit::WGC3Denum target
,
139 WebKit::WGC3Dsizeiptr size
,
141 WebKit::WGC3Denum usage
) {}
142 virtual void bufferSubData(
143 WebKit::WGC3Denum target
,
144 WebKit::WGC3Dintptr offset
,
145 WebKit::WGC3Dsizeiptr size
,
148 virtual WebKit::WGC3Denum
checkFramebufferStatus(WebKit::WGC3Denum target
);
150 virtual void clear(WebKit::WGC3Dbitfield mask
) {}
151 virtual void clearColor(
152 WebKit::WGC3Dclampf red
,
153 WebKit::WGC3Dclampf green
,
154 WebKit::WGC3Dclampf blue
,
155 WebKit::WGC3Dclampf alpha
) {}
156 virtual void clearDepth(WebKit::WGC3Dclampf depth
) {}
157 virtual void clearStencil(WebKit::WGC3Dint s
) {}
158 virtual void colorMask(
159 WebKit::WGC3Dboolean red
,
160 WebKit::WGC3Dboolean green
,
161 WebKit::WGC3Dboolean blue
,
162 WebKit::WGC3Dboolean alpha
) {}
163 virtual void compileShader(WebKit::WebGLId shader
) {}
165 virtual void compressedTexImage2D(
166 WebKit::WGC3Denum target
,
167 WebKit::WGC3Dint level
,
168 WebKit::WGC3Denum internal_format
,
169 WebKit::WGC3Dsizei width
,
170 WebKit::WGC3Dsizei height
,
171 WebKit::WGC3Dint border
,
172 WebKit::WGC3Dsizei imageSize
,
174 virtual void compressedTexSubImage2D(
175 WebKit::WGC3Denum target
,
176 WebKit::WGC3Dint level
,
177 WebKit::WGC3Dint xoffset
,
178 WebKit::WGC3Dint yoffset
,
179 WebKit::WGC3Dsizei width
,
180 WebKit::WGC3Dsizei height
,
181 WebKit::WGC3Denum format
,
182 WebKit::WGC3Dsizei imageSize
,
184 virtual void copyTexImage2D(
185 WebKit::WGC3Denum target
,
186 WebKit::WGC3Dint level
,
187 WebKit::WGC3Denum internalformat
,
190 WebKit::WGC3Dsizei width
,
191 WebKit::WGC3Dsizei height
,
192 WebKit::WGC3Dint border
) {}
193 virtual void copyTexSubImage2D(
194 WebKit::WGC3Denum target
,
195 WebKit::WGC3Dint level
,
196 WebKit::WGC3Dint xoffset
,
197 WebKit::WGC3Dint yoffset
,
200 WebKit::WGC3Dsizei width
,
201 WebKit::WGC3Dsizei height
) {}
202 virtual void cullFace(WebKit::WGC3Denum mode
) {}
203 virtual void depthFunc(WebKit::WGC3Denum func
) {}
204 virtual void depthMask(WebKit::WGC3Dboolean flag
) {}
205 virtual void depthRange(
206 WebKit::WGC3Dclampf zNear
,
207 WebKit::WGC3Dclampf zFar
) {}
208 virtual void detachShader(WebKit::WebGLId program
, WebKit::WebGLId shader
) {}
209 virtual void disable(WebKit::WGC3Denum cap
) {}
210 virtual void disableVertexAttribArray(WebKit::WGC3Duint index
) {}
211 virtual void drawArrays(
212 WebKit::WGC3Denum mode
,
213 WebKit::WGC3Dint first
,
214 WebKit::WGC3Dsizei count
) {}
215 virtual void drawElements(
216 WebKit::WGC3Denum mode
,
217 WebKit::WGC3Dsizei count
,
218 WebKit::WGC3Denum type
,
219 WebKit::WGC3Dintptr offset
) {}
221 virtual void enable(WebKit::WGC3Denum cap
) {}
222 virtual void enableVertexAttribArray(WebKit::WGC3Duint index
) {}
223 virtual void finish() {}
224 virtual void flush() {}
225 virtual void framebufferRenderbuffer(
226 WebKit::WGC3Denum target
,
227 WebKit::WGC3Denum attachment
,
228 WebKit::WGC3Denum renderbuffertarget
,
229 WebKit::WebGLId renderbuffer
) {}
230 virtual void framebufferTexture2D(
231 WebKit::WGC3Denum target
,
232 WebKit::WGC3Denum attachment
,
233 WebKit::WGC3Denum textarget
,
234 WebKit::WebGLId texture
,
235 WebKit::WGC3Dint level
) {}
236 virtual void frontFace(WebKit::WGC3Denum mode
) {}
237 virtual void generateMipmap(WebKit::WGC3Denum target
) {}
239 virtual bool getActiveAttrib(
240 WebKit::WebGLId program
,
241 WebKit::WGC3Duint index
, ActiveInfo
&);
242 virtual bool getActiveUniform(
243 WebKit::WebGLId program
,
244 WebKit::WGC3Duint index
,
246 virtual void getAttachedShaders(
247 WebKit::WebGLId program
,
248 WebKit::WGC3Dsizei maxCount
,
249 WebKit::WGC3Dsizei
* count
,
250 WebKit::WebGLId
* shaders
) {}
251 virtual WebKit::WGC3Dint
getAttribLocation(
252 WebKit::WebGLId program
,
253 const WebKit::WGC3Dchar
* name
);
254 virtual void getBooleanv(
255 WebKit::WGC3Denum pname
,
256 WebKit::WGC3Dboolean
* value
) {}
257 virtual void getBufferParameteriv(
258 WebKit::WGC3Denum target
,
259 WebKit::WGC3Denum pname
,
260 WebKit::WGC3Dint
* value
) {}
261 virtual Attributes
getContextAttributes();
262 virtual WebKit::WGC3Denum
getError();
263 virtual void getFloatv(
264 WebKit::WGC3Denum pname
,
265 WebKit::WGC3Dfloat
* value
) {}
266 virtual void getFramebufferAttachmentParameteriv(
267 WebKit::WGC3Denum target
,
268 WebKit::WGC3Denum attachment
,
269 WebKit::WGC3Denum pname
,
270 WebKit::WGC3Dint
* value
) {}
272 virtual void getIntegerv(
273 WebKit::WGC3Denum pname
,
274 WebKit::WGC3Dint
* value
);
276 virtual void getProgramiv(
277 WebKit::WebGLId program
,
278 WebKit::WGC3Denum pname
,
279 WebKit::WGC3Dint
* value
);
281 virtual WebKit::WebString
getProgramInfoLog(WebKit::WebGLId program
);
282 virtual void getRenderbufferParameteriv(
283 WebKit::WGC3Denum target
,
284 WebKit::WGC3Denum pname
,
285 WebKit::WGC3Dint
* value
) {}
287 virtual void getShaderiv(
288 WebKit::WebGLId shader
,
289 WebKit::WGC3Denum pname
,
290 WebKit::WGC3Dint
* value
);
292 virtual WebKit::WebString
getShaderInfoLog(WebKit::WebGLId shader
);
293 virtual void getShaderPrecisionFormat(
294 WebKit::WGC3Denum shadertype
,
295 WebKit::WGC3Denum precisiontype
,
296 WebKit::WGC3Dint
* range
,
297 WebKit::WGC3Dint
* precision
) {}
298 virtual WebKit::WebString
getShaderSource(WebKit::WebGLId shader
);
299 virtual WebKit::WebString
getString(WebKit::WGC3Denum name
);
300 virtual void getTexParameterfv(
301 WebKit::WGC3Denum target
,
302 WebKit::WGC3Denum pname
,
303 WebKit::WGC3Dfloat
* value
) {}
304 virtual void getTexParameteriv(
305 WebKit::WGC3Denum target
,
306 WebKit::WGC3Denum pname
,
307 WebKit::WGC3Dint
* value
) {}
308 virtual void getUniformfv(
309 WebKit::WebGLId program
,
310 WebKit::WGC3Dint location
,
311 WebKit::WGC3Dfloat
* value
) {}
312 virtual void getUniformiv(
313 WebKit::WebGLId program
,
314 WebKit::WGC3Dint location
,
315 WebKit::WGC3Dint
* value
) {}
316 virtual WebKit::WGC3Dint
getUniformLocation(
317 WebKit::WebGLId program
,
318 const WebKit::WGC3Dchar
* name
);
319 virtual void getVertexAttribfv(
320 WebKit::WGC3Duint index
,
321 WebKit::WGC3Denum pname
,
322 WebKit::WGC3Dfloat
* value
) {}
323 virtual void getVertexAttribiv(
324 WebKit::WGC3Duint index
,
325 WebKit::WGC3Denum pname
,
326 WebKit::WGC3Dint
* value
) {}
327 virtual WebKit::WGC3Dsizeiptr
getVertexAttribOffset(
328 WebKit::WGC3Duint index
,
329 WebKit::WGC3Denum pname
);
331 virtual void hint(WebKit::WGC3Denum target
, WebKit::WGC3Denum mode
) {}
332 virtual WebKit::WGC3Dboolean
isBuffer(WebKit::WebGLId buffer
);
333 virtual WebKit::WGC3Dboolean
isEnabled(WebKit::WGC3Denum cap
);
334 virtual WebKit::WGC3Dboolean
isFramebuffer(WebKit::WebGLId framebuffer
);
335 virtual WebKit::WGC3Dboolean
isProgram(WebKit::WebGLId program
);
336 virtual WebKit::WGC3Dboolean
isRenderbuffer(WebKit::WebGLId renderbuffer
);
337 virtual WebKit::WGC3Dboolean
isShader(WebKit::WebGLId shader
);
338 virtual WebKit::WGC3Dboolean
isTexture(WebKit::WebGLId texture
);
339 virtual void lineWidth(WebKit::WGC3Dfloat
) {}
340 virtual void linkProgram(WebKit::WebGLId program
) {}
341 virtual void pixelStorei(WebKit::WGC3Denum pname
, WebKit::WGC3Dint param
) {}
342 virtual void polygonOffset(
343 WebKit::WGC3Dfloat factor
,
344 WebKit::WGC3Dfloat units
) {}
346 virtual void readPixels(
349 WebKit::WGC3Dsizei width
,
350 WebKit::WGC3Dsizei height
,
351 WebKit::WGC3Denum format
,
352 WebKit::WGC3Denum type
,
355 virtual void releaseShaderCompiler() {}
357 virtual void renderbufferStorage(
358 WebKit::WGC3Denum target
,
359 WebKit::WGC3Denum internalformat
,
360 WebKit::WGC3Dsizei width
,
361 WebKit::WGC3Dsizei height
) {}
362 virtual void sampleCoverage(
363 WebKit::WGC3Dclampf value
,
364 WebKit::WGC3Dboolean invert
) {}
365 virtual void scissor(
368 WebKit::WGC3Dsizei width
,
369 WebKit::WGC3Dsizei height
) {}
370 virtual void shaderSource(
371 WebKit::WebGLId shader
,
372 const WebKit::WGC3Dchar
* string
) {}
373 virtual void stencilFunc(
374 WebKit::WGC3Denum func
,
375 WebKit::WGC3Dint ref
,
376 WebKit::WGC3Duint mask
) {}
377 virtual void stencilFuncSeparate(
378 WebKit::WGC3Denum face
,
379 WebKit::WGC3Denum func
,
380 WebKit::WGC3Dint ref
,
381 WebKit::WGC3Duint mask
) {}
382 virtual void stencilMask(WebKit::WGC3Duint mask
) {}
383 virtual void stencilMaskSeparate(
384 WebKit::WGC3Denum face
,
385 WebKit::WGC3Duint mask
) {}
386 virtual void stencilOp(
387 WebKit::WGC3Denum fail
,
388 WebKit::WGC3Denum zfail
,
389 WebKit::WGC3Denum zpass
) {}
390 virtual void stencilOpSeparate(
391 WebKit::WGC3Denum face
,
392 WebKit::WGC3Denum fail
,
393 WebKit::WGC3Denum zfail
,
394 WebKit::WGC3Denum zpass
) {}
396 virtual void texImage2D(
397 WebKit::WGC3Denum target
,
398 WebKit::WGC3Dint level
,
399 WebKit::WGC3Denum internalformat
,
400 WebKit::WGC3Dsizei width
,
401 WebKit::WGC3Dsizei height
,
402 WebKit::WGC3Dint border
,
403 WebKit::WGC3Denum format
,
404 WebKit::WGC3Denum type
,
405 const void* pixels
) {}
407 virtual void texParameterf(
408 WebKit::WGC3Denum target
,
409 WebKit::WGC3Denum pname
,
410 WebKit::WGC3Dfloat param
) {}
411 virtual void texParameteri(
412 WebKit::WGC3Denum target
,
413 WebKit::WGC3Denum pname
,
414 WebKit::WGC3Dint param
) {}
416 virtual void texSubImage2D(
417 WebKit::WGC3Denum target
,
418 WebKit::WGC3Dint level
,
419 WebKit::WGC3Dint xoffset
,
420 WebKit::WGC3Dint yoffset
,
421 WebKit::WGC3Dsizei width
,
422 WebKit::WGC3Dsizei height
,
423 WebKit::WGC3Denum format
,
424 WebKit::WGC3Denum type
,
425 const void* pixels
) {}
427 virtual void uniform1f(WebKit::WGC3Dint location
, WebKit::WGC3Dfloat x
) {}
428 virtual void uniform1fv(
429 WebKit::WGC3Dint location
,
430 WebKit::WGC3Dsizei count
,
431 const WebKit::WGC3Dfloat
* v
) {}
432 virtual void uniform1i(WebKit::WGC3Dint location
, WebKit::WGC3Dint x
) {}
433 virtual void uniform1iv(
434 WebKit::WGC3Dint location
,
435 WebKit::WGC3Dsizei count
,
436 const WebKit::WGC3Dint
* v
) {}
437 virtual void uniform2f(
438 WebKit::WGC3Dint location
,
439 WebKit::WGC3Dfloat x
,
440 WebKit::WGC3Dfloat y
) {}
441 virtual void uniform2fv(
442 WebKit::WGC3Dint location
,
443 WebKit::WGC3Dsizei count
,
444 const WebKit::WGC3Dfloat
* v
) {}
445 virtual void uniform2i(
446 WebKit::WGC3Dint location
,
448 WebKit::WGC3Dint y
) {}
449 virtual void uniform2iv(
450 WebKit::WGC3Dint location
,
451 WebKit::WGC3Dsizei count
,
452 const WebKit::WGC3Dint
* v
) {}
453 virtual void uniform3f(
454 WebKit::WGC3Dint location
,
455 WebKit::WGC3Dfloat x
,
456 WebKit::WGC3Dfloat y
,
457 WebKit::WGC3Dfloat z
) {}
458 virtual void uniform3fv(
459 WebKit::WGC3Dint location
,
460 WebKit::WGC3Dsizei count
,
461 const WebKit::WGC3Dfloat
* v
) {}
462 virtual void uniform3i(
463 WebKit::WGC3Dint location
,
466 WebKit::WGC3Dint z
) {}
467 virtual void uniform3iv(
468 WebKit::WGC3Dint location
,
469 WebKit::WGC3Dsizei count
,
470 const WebKit::WGC3Dint
* v
) {}
471 virtual void uniform4f(
472 WebKit::WGC3Dint location
,
473 WebKit::WGC3Dfloat x
,
474 WebKit::WGC3Dfloat y
,
475 WebKit::WGC3Dfloat z
,
476 WebKit::WGC3Dfloat w
) {}
477 virtual void uniform4fv(
478 WebKit::WGC3Dint location
,
479 WebKit::WGC3Dsizei count
,
480 const WebKit::WGC3Dfloat
* v
) {}
481 virtual void uniform4i(
482 WebKit::WGC3Dint location
,
486 WebKit::WGC3Dint w
) {}
487 virtual void uniform4iv(
488 WebKit::WGC3Dint location
,
489 WebKit::WGC3Dsizei count
,
490 const WebKit::WGC3Dint
* v
) {}
491 virtual void uniformMatrix2fv(
492 WebKit::WGC3Dint location
,
493 WebKit::WGC3Dsizei count
,
494 WebKit::WGC3Dboolean transpose
,
495 const WebKit::WGC3Dfloat
* value
) {}
496 virtual void uniformMatrix3fv(
497 WebKit::WGC3Dint location
,
498 WebKit::WGC3Dsizei count
,
499 WebKit::WGC3Dboolean transpose
,
500 const WebKit::WGC3Dfloat
* value
) {}
501 virtual void uniformMatrix4fv(
502 WebKit::WGC3Dint location
,
503 WebKit::WGC3Dsizei count
,
504 WebKit::WGC3Dboolean transpose
,
505 const WebKit::WGC3Dfloat
* value
) {}
507 virtual void useProgram(WebKit::WebGLId program
);
508 virtual void validateProgram(WebKit::WebGLId program
) {}
510 virtual void vertexAttrib1f(WebKit::WGC3Duint index
, WebKit::WGC3Dfloat x
) {}
511 virtual void vertexAttrib1fv(
512 WebKit::WGC3Duint index
,
513 const WebKit::WGC3Dfloat
* values
) {}
514 virtual void vertexAttrib2f(
515 WebKit::WGC3Duint index
,
516 WebKit::WGC3Dfloat x
,
517 WebKit::WGC3Dfloat y
) {}
518 virtual void vertexAttrib2fv(
519 WebKit::WGC3Duint index
,
520 const WebKit::WGC3Dfloat
* values
) {}
521 virtual void vertexAttrib3f(
522 WebKit::WGC3Duint index
,
523 WebKit::WGC3Dfloat x
,
524 WebKit::WGC3Dfloat y
,
525 WebKit::WGC3Dfloat z
) {}
526 virtual void vertexAttrib3fv(
527 WebKit::WGC3Duint index
,
528 const WebKit::WGC3Dfloat
* values
) {}
529 virtual void vertexAttrib4f(
530 WebKit::WGC3Duint index
,
531 WebKit::WGC3Dfloat x
,
532 WebKit::WGC3Dfloat y
,
533 WebKit::WGC3Dfloat z
,
534 WebKit::WGC3Dfloat w
) {}
535 virtual void vertexAttrib4fv(
536 WebKit::WGC3Duint index
,
537 const WebKit::WGC3Dfloat
* values
) {}
538 virtual void vertexAttribPointer(
539 WebKit::WGC3Duint index
,
540 WebKit::WGC3Dint size
,
541 WebKit::WGC3Denum type
,
542 WebKit::WGC3Dboolean normalized
,
543 WebKit::WGC3Dsizei stride
,
544 WebKit::WGC3Dintptr offset
) {}
546 virtual void viewport(
549 WebKit::WGC3Dsizei width
,
550 WebKit::WGC3Dsizei height
) {}
552 virtual WebKit::WebGLId
createBuffer();
553 virtual WebKit::WebGLId
createFramebuffer();
554 virtual WebKit::WebGLId
createProgram();
555 virtual WebKit::WebGLId
createRenderbuffer();
556 virtual WebKit::WebGLId
createShader(WebKit::WGC3Denum
);
557 virtual WebKit::WebGLId
createTexture();
559 virtual void deleteBuffer(WebKit::WebGLId id
);
560 virtual void deleteFramebuffer(WebKit::WebGLId id
);
561 virtual void deleteProgram(WebKit::WebGLId id
);
562 virtual void deleteRenderbuffer(WebKit::WebGLId id
);
563 virtual void deleteShader(WebKit::WebGLId id
);
564 virtual void deleteTexture(WebKit::WebGLId texture_id
);
566 virtual void texStorage2DEXT(
567 WebKit::WGC3Denum target
,
568 WebKit::WGC3Dint levels
,
569 WebKit::WGC3Duint internalformat
,
570 WebKit::WGC3Dint width
,
571 WebKit::WGC3Dint height
) {}
573 virtual WebKit::WebGLId
createQueryEXT();
574 virtual void deleteQueryEXT(WebKit::WebGLId query
) {}
575 virtual WebKit::WGC3Dboolean
isQueryEXT(WebKit::WebGLId query
);
576 virtual void beginQueryEXT(
577 WebKit::WGC3Denum target
,
578 WebKit::WebGLId query
) {}
579 virtual void endQueryEXT(WebKit::WGC3Denum target
);
580 virtual void getQueryivEXT(
581 WebKit::WGC3Denum target
,
582 WebKit::WGC3Denum pname
,
583 WebKit::WGC3Dint
* params
) {}
584 virtual void getQueryObjectuivEXT(
585 WebKit::WebGLId query
,
586 WebKit::WGC3Denum pname
,
587 WebKit::WGC3Duint
* params
);
589 virtual void setContextLostCallback(
590 WebGraphicsContextLostCallback
* callback
);
592 virtual void loseContextCHROMIUM(WebKit::WGC3Denum current
,
593 WebKit::WGC3Denum other
);
595 // When set, MakeCurrent() will fail after this many times.
596 void set_times_make_current_succeeds(int times
) {
597 times_make_current_succeeds_
= times
;
599 void set_times_bind_texture_succeeds(int times
) {
600 times_bind_texture_succeeds_
= times
;
602 void set_times_end_query_succeeds(int times
) {
603 times_end_query_succeeds_
= times
;
606 size_t NumTextures() const { return textures_
.size(); }
607 WebKit::WebGLId
TextureAt(int i
) const { return textures_
[i
]; }
609 size_t NumUsedTextures() const { return used_textures_
.size(); }
610 bool UsedTexture(int texture
) const {
611 return ContainsKey(used_textures_
, texture
);
613 void ResetUsedTextures() { used_textures_
.clear(); }
615 void set_have_extension_io_surface(bool have
) {
616 have_extension_io_surface_
= have
;
618 void set_have_extension_egl_image(bool have
) {
619 have_extension_egl_image_
= have
;
622 static const WebKit::WebGLId kExternalTextureId
;
623 virtual WebKit::WebGLId
NextTextureId();
626 FakeWebGraphicsContext3D();
627 FakeWebGraphicsContext3D(
628 const WebKit::WebGraphicsContext3D::Attributes
& attributes
);
630 unsigned context_id_
;
631 unsigned next_texture_id_
;
632 Attributes attributes_
;
633 bool have_extension_io_surface_
;
634 bool have_extension_egl_image_
;
635 int times_make_current_succeeds_
;
636 int times_bind_texture_succeeds_
;
637 int times_end_query_succeeds_
;
639 WebGraphicsContextLostCallback
* context_lost_callback_
;
640 std::vector
<WebKit::WebGLId
> textures_
;
641 base::hash_set
<WebKit::WebGLId
> used_textures_
;
648 #endif // CC_TEST_FAKE_WEB_GRAPHICS_CONTEXT_3D_H_