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 bool FakeWebGraphicsContext3D::isGLES2Compliant() {
32 WebGLId
FakeWebGraphicsContext3D::getPlatformTextureId() {
36 bool FakeWebGraphicsContext3D::isContextLost() {
40 WGC3Denum
FakeWebGraphicsContext3D::getGraphicsResetStatusARB() {
44 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
46 WebKit::WGC3Dintptr offset
,
47 WebKit::WGC3Dsizeiptr size
,
52 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
54 WebKit::WGC3Dint level
,
55 WebKit::WGC3Dint xoffset
,
56 WebKit::WGC3Dint yoffset
,
57 WebKit::WGC3Dsizei width
,
58 WebKit::WGC3Dsizei height
,
65 WebKit::WebString
FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() {
66 return WebKit::WebString();
69 WGC3Denum
FakeWebGraphicsContext3D::checkFramebufferStatus(
71 return GL_FRAMEBUFFER_COMPLETE
;
74 bool FakeWebGraphicsContext3D::getActiveAttrib(
76 WebKit::WGC3Duint index
,
81 bool FakeWebGraphicsContext3D::getActiveUniform(
83 WebKit::WGC3Duint index
,
88 WebKit::WGC3Dint
FakeWebGraphicsContext3D::getAttribLocation(
90 const WebKit::WGC3Dchar
* name
) {
94 WebGraphicsContext3D::Attributes
95 FakeWebGraphicsContext3D::getContextAttributes() {
96 return WebGraphicsContext3D::Attributes();
99 WGC3Denum
FakeWebGraphicsContext3D::getError() {
103 void FakeWebGraphicsContext3D::getIntegerv(
105 WebKit::WGC3Dint
* value
) {
106 if (pname
== GL_MAX_TEXTURE_SIZE
)
108 else if (pname
== GL_ACTIVE_TEXTURE
)
109 *value
= GL_TEXTURE0
;
112 void FakeWebGraphicsContext3D::getProgramiv(
115 WebKit::WGC3Dint
* value
) {
116 if (pname
== GL_LINK_STATUS
)
120 WebKit::WebString
FakeWebGraphicsContext3D::getProgramInfoLog(
122 return WebKit::WebString();
125 void FakeWebGraphicsContext3D::getShaderiv(
128 WebKit::WGC3Dint
* value
) {
129 if (pname
== GL_COMPILE_STATUS
)
133 WebKit::WebString
FakeWebGraphicsContext3D::getShaderInfoLog(
135 return WebKit::WebString();
138 void FakeWebGraphicsContext3D::getShaderPrecisionFormat(
139 WebKit::WGC3Denum shadertype
,
140 WebKit::WGC3Denum precisiontype
,
141 WebKit::WGC3Dint
* range
,
142 WebKit::WGC3Dint
* precision
) {
143 // Return the minimum precision requirements of the GLES specificatin.
144 switch (precisiontype
) {
165 case GL_MEDIUM_FLOAT
:
181 WebKit::WebString
FakeWebGraphicsContext3D::getShaderSource(
183 return WebKit::WebString();
186 WebKit::WebString
FakeWebGraphicsContext3D::getString(WGC3Denum name
) {
187 return WebKit::WebString();
190 WebKit::WGC3Dint
FakeWebGraphicsContext3D::getUniformLocation(
192 const WebKit::WGC3Dchar
* name
) {
196 WebKit::WGC3Dsizeiptr
FakeWebGraphicsContext3D::getVertexAttribOffset(
197 WebKit::WGC3Duint index
,
202 WGC3Dboolean
FakeWebGraphicsContext3D::isBuffer(
207 WGC3Dboolean
FakeWebGraphicsContext3D::isEnabled(
212 WGC3Dboolean
FakeWebGraphicsContext3D::isFramebuffer(
213 WebGLId framebuffer
) {
217 WGC3Dboolean
FakeWebGraphicsContext3D::isProgram(
222 WGC3Dboolean
FakeWebGraphicsContext3D::isRenderbuffer(
223 WebGLId renderbuffer
) {
227 WGC3Dboolean
FakeWebGraphicsContext3D::isShader(
232 WGC3Dboolean
FakeWebGraphicsContext3D::isTexture(
237 WebGLId
FakeWebGraphicsContext3D::createBuffer() {
241 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id
) {
244 WebGLId
FakeWebGraphicsContext3D::createFramebuffer() {
248 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id
) {
251 WebGLId
FakeWebGraphicsContext3D::createProgram() {
255 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id
) {
258 WebGLId
FakeWebGraphicsContext3D::createRenderbuffer() {
262 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id
) {
265 WebGLId
FakeWebGraphicsContext3D::createShader(WGC3Denum
) {
269 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id
) {
272 WebGLId
FakeWebGraphicsContext3D::createTexture() {
276 void FakeWebGraphicsContext3D::deleteTexture(WebGLId texture_id
) {
279 void FakeWebGraphicsContext3D::attachShader(WebGLId program
, WebGLId shader
) {
282 void FakeWebGraphicsContext3D::useProgram(WebGLId program
) {
285 void FakeWebGraphicsContext3D::bindBuffer(WGC3Denum target
, WebGLId buffer
) {
288 void FakeWebGraphicsContext3D::bindFramebuffer(
289 WGC3Denum target
, WebGLId framebuffer
) {
292 void FakeWebGraphicsContext3D::bindRenderbuffer(
293 WGC3Denum target
, WebGLId renderbuffer
) {
296 void FakeWebGraphicsContext3D::bindTexture(
297 WGC3Denum target
, WebGLId texture_id
) {
300 WebGLId
FakeWebGraphicsContext3D::createQueryEXT() {
304 WGC3Dboolean
FakeWebGraphicsContext3D::isQueryEXT(WebGLId query
) {
308 void FakeWebGraphicsContext3D::endQueryEXT(WebKit::WGC3Denum target
) {
311 void FakeWebGraphicsContext3D::getQueryObjectuivEXT(
312 WebKit::WebGLId query
,
313 WebKit::WGC3Denum pname
,
314 WebKit::WGC3Duint
* params
) {
317 void FakeWebGraphicsContext3D::setContextLostCallback(
318 WebGraphicsContextLostCallback
* callback
) {
321 void FakeWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current
,
325 WebKit::WGC3Duint
FakeWebGraphicsContext3D::createImageCHROMIUM(
326 WebKit::WGC3Dsizei width
, WebKit::WGC3Dsizei height
,
327 WebKit::WGC3Denum internalformat
) {
331 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id
,
332 WebKit::WGC3Denum access
) {