1 // Copyright 2013 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 #include "cc/debug/fake_web_graphics_context_3d.h"
7 #include "base/logging.h"
8 #include "third_party/khronos/GLES2/gl2.h"
10 using WebKit::WGC3Dboolean
;
11 using WebKit::WGC3Denum
;
12 using WebKit::WebGLId
;
13 using WebKit::WebGraphicsContext3D
;
17 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D()
18 : WebKit::WebGraphicsContext3D() {
21 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() {
24 bool FakeWebGraphicsContext3D::makeContextCurrent() {
28 int FakeWebGraphicsContext3D::width() {
32 int FakeWebGraphicsContext3D::height() {
36 void FakeWebGraphicsContext3D::reshape(int width
, int height
) {
39 bool FakeWebGraphicsContext3D::isGLES2Compliant() {
43 bool FakeWebGraphicsContext3D::readBackFramebuffer(
44 unsigned char* pixels
,
52 WebGLId
FakeWebGraphicsContext3D::getPlatformTextureId() {
56 bool FakeWebGraphicsContext3D::isContextLost() {
60 WGC3Denum
FakeWebGraphicsContext3D::getGraphicsResetStatusARB() {
64 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
66 WebKit::WGC3Dintptr offset
,
67 WebKit::WGC3Dsizeiptr size
,
72 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
74 WebKit::WGC3Dint level
,
75 WebKit::WGC3Dint xoffset
,
76 WebKit::WGC3Dint yoffset
,
77 WebKit::WGC3Dsizei width
,
78 WebKit::WGC3Dsizei height
,
85 WebKit::WebString
FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() {
86 return WebKit::WebString();
89 WGC3Denum
FakeWebGraphicsContext3D::checkFramebufferStatus(
91 return GL_FRAMEBUFFER_COMPLETE
;
94 bool FakeWebGraphicsContext3D::getActiveAttrib(
96 WebKit::WGC3Duint index
,
101 bool FakeWebGraphicsContext3D::getActiveUniform(
103 WebKit::WGC3Duint index
,
108 WebKit::WGC3Dint
FakeWebGraphicsContext3D::getAttribLocation(
110 const WebKit::WGC3Dchar
* name
) {
114 WebGraphicsContext3D::Attributes
115 FakeWebGraphicsContext3D::getContextAttributes() {
116 return WebGraphicsContext3D::Attributes();
119 WGC3Denum
FakeWebGraphicsContext3D::getError() {
123 void FakeWebGraphicsContext3D::getIntegerv(
125 WebKit::WGC3Dint
* value
) {
126 if (pname
== GL_MAX_TEXTURE_SIZE
)
130 void FakeWebGraphicsContext3D::getProgramiv(
133 WebKit::WGC3Dint
* value
) {
134 if (pname
== GL_LINK_STATUS
)
138 WebKit::WebString
FakeWebGraphicsContext3D::getProgramInfoLog(
140 return WebKit::WebString();
143 void FakeWebGraphicsContext3D::getShaderiv(
146 WebKit::WGC3Dint
* value
) {
147 if (pname
== GL_COMPILE_STATUS
)
151 WebKit::WebString
FakeWebGraphicsContext3D::getShaderInfoLog(
153 return WebKit::WebString();
156 void FakeWebGraphicsContext3D::getShaderPrecisionFormat(
157 WebKit::WGC3Denum shadertype
,
158 WebKit::WGC3Denum precisiontype
,
159 WebKit::WGC3Dint
* range
,
160 WebKit::WGC3Dint
* precision
) {
161 // Return the minimum precision requirements of the GLES specificatin.
162 switch (precisiontype
) {
183 case GL_MEDIUM_FLOAT
:
199 WebKit::WebString
FakeWebGraphicsContext3D::getShaderSource(
201 return WebKit::WebString();
204 WebKit::WebString
FakeWebGraphicsContext3D::getString(WGC3Denum name
) {
205 return WebKit::WebString();
208 WebKit::WGC3Dint
FakeWebGraphicsContext3D::getUniformLocation(
210 const WebKit::WGC3Dchar
* name
) {
214 WebKit::WGC3Dsizeiptr
FakeWebGraphicsContext3D::getVertexAttribOffset(
215 WebKit::WGC3Duint index
,
220 WGC3Dboolean
FakeWebGraphicsContext3D::isBuffer(
225 WGC3Dboolean
FakeWebGraphicsContext3D::isEnabled(
230 WGC3Dboolean
FakeWebGraphicsContext3D::isFramebuffer(
231 WebGLId framebuffer
) {
235 WGC3Dboolean
FakeWebGraphicsContext3D::isProgram(
240 WGC3Dboolean
FakeWebGraphicsContext3D::isRenderbuffer(
241 WebGLId renderbuffer
) {
245 WGC3Dboolean
FakeWebGraphicsContext3D::isShader(
250 WGC3Dboolean
FakeWebGraphicsContext3D::isTexture(
255 WebGLId
FakeWebGraphicsContext3D::createBuffer() {
259 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id
) {
262 WebGLId
FakeWebGraphicsContext3D::createFramebuffer() {
266 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id
) {
269 WebGLId
FakeWebGraphicsContext3D::createProgram() {
273 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id
) {
276 WebGLId
FakeWebGraphicsContext3D::createRenderbuffer() {
280 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id
) {
283 WebGLId
FakeWebGraphicsContext3D::createShader(WGC3Denum
) {
287 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id
) {
290 WebGLId
FakeWebGraphicsContext3D::createTexture() {
294 void FakeWebGraphicsContext3D::deleteTexture(WebGLId texture_id
) {
297 void FakeWebGraphicsContext3D::attachShader(WebGLId program
, WebGLId shader
) {
300 void FakeWebGraphicsContext3D::useProgram(WebGLId program
) {
303 void FakeWebGraphicsContext3D::bindBuffer(WGC3Denum target
, WebGLId buffer
) {
306 void FakeWebGraphicsContext3D::bindFramebuffer(
307 WGC3Denum target
, WebGLId framebuffer
) {
310 void FakeWebGraphicsContext3D::bindRenderbuffer(
311 WGC3Denum target
, WebGLId renderbuffer
) {
314 void FakeWebGraphicsContext3D::bindTexture(
315 WGC3Denum target
, WebGLId texture_id
) {
318 WebGLId
FakeWebGraphicsContext3D::createQueryEXT() {
322 WGC3Dboolean
FakeWebGraphicsContext3D::isQueryEXT(WebGLId query
) {
326 void FakeWebGraphicsContext3D::endQueryEXT(WebKit::WGC3Denum target
) {
329 void FakeWebGraphicsContext3D::getQueryObjectuivEXT(
330 WebKit::WebGLId query
,
331 WebKit::WGC3Denum pname
,
332 WebKit::WGC3Duint
* params
) {
335 void FakeWebGraphicsContext3D::setContextLostCallback(
336 WebGraphicsContextLostCallback
* callback
) {
339 void FakeWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current
,
343 WebKit::WGC3Duint
FakeWebGraphicsContext3D::createImageCHROMIUM(
344 WebKit::WGC3Dsizei width
, WebKit::WGC3Dsizei height
,
345 WebKit::WGC3Denum internalformat
) {
349 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id
,
350 WebKit::WGC3Denum access
) {