Run WebGL conformance tests on Android GPU bot
[chromium-blink-merge.git] / cc / debug / fake_web_graphics_context_3d.cc
blob25157bfe4971673778f2e4f4935240a41352a9aa
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;
15 namespace cc {
17 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D()
18 : WebKit::WebGraphicsContext3D() {
21 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() {
24 bool FakeWebGraphicsContext3D::makeContextCurrent() {
25 return true;
28 bool FakeWebGraphicsContext3D::isGLES2Compliant() {
29 return false;
32 WebGLId FakeWebGraphicsContext3D::getPlatformTextureId() {
33 return 0;
36 bool FakeWebGraphicsContext3D::isContextLost() {
37 return false;
40 WGC3Denum FakeWebGraphicsContext3D::getGraphicsResetStatusARB() {
41 return GL_NO_ERROR;
44 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
45 WGC3Denum target,
46 WebKit::WGC3Dintptr offset,
47 WebKit::WGC3Dsizeiptr size,
48 WGC3Denum access) {
49 return 0;
52 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
53 WGC3Denum target,
54 WebKit::WGC3Dint level,
55 WebKit::WGC3Dint xoffset,
56 WebKit::WGC3Dint yoffset,
57 WebKit::WGC3Dsizei width,
58 WebKit::WGC3Dsizei height,
59 WGC3Denum format,
60 WGC3Denum type,
61 WGC3Denum access) {
62 return 0;
65 WebKit::WebString FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() {
66 return WebKit::WebString();
69 WGC3Denum FakeWebGraphicsContext3D::checkFramebufferStatus(
70 WGC3Denum target) {
71 return GL_FRAMEBUFFER_COMPLETE;
74 bool FakeWebGraphicsContext3D::getActiveAttrib(
75 WebGLId program,
76 WebKit::WGC3Duint index,
77 ActiveInfo&) {
78 return false;
81 bool FakeWebGraphicsContext3D::getActiveUniform(
82 WebGLId program,
83 WebKit::WGC3Duint index,
84 ActiveInfo&) {
85 return false;
88 WebKit::WGC3Dint FakeWebGraphicsContext3D::getAttribLocation(
89 WebGLId program,
90 const WebKit::WGC3Dchar* name) {
91 return 0;
94 WebGraphicsContext3D::Attributes
95 FakeWebGraphicsContext3D::getContextAttributes() {
96 return WebGraphicsContext3D::Attributes();
99 WGC3Denum FakeWebGraphicsContext3D::getError() {
100 return 0;
103 void FakeWebGraphicsContext3D::getIntegerv(
104 WGC3Denum pname,
105 WebKit::WGC3Dint* value) {
106 if (pname == GL_MAX_TEXTURE_SIZE)
107 *value = 1024;
108 else if (pname == GL_ACTIVE_TEXTURE)
109 *value = GL_TEXTURE0;
112 void FakeWebGraphicsContext3D::getProgramiv(
113 WebGLId program,
114 WGC3Denum pname,
115 WebKit::WGC3Dint* value) {
116 if (pname == GL_LINK_STATUS)
117 *value = 1;
120 WebKit::WebString FakeWebGraphicsContext3D::getProgramInfoLog(
121 WebGLId program) {
122 return WebKit::WebString();
125 void FakeWebGraphicsContext3D::getShaderiv(
126 WebGLId shader,
127 WGC3Denum pname,
128 WebKit::WGC3Dint* value) {
129 if (pname == GL_COMPILE_STATUS)
130 *value = 1;
133 WebKit::WebString FakeWebGraphicsContext3D::getShaderInfoLog(
134 WebGLId shader) {
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) {
145 case GL_LOW_INT:
146 range[0] = 8;
147 range[1] = 8;
148 *precision = 0;
149 break;
150 case GL_MEDIUM_INT:
151 range[0] = 10;
152 range[1] = 10;
153 *precision = 0;
154 break;
155 case GL_HIGH_INT:
156 range[0] = 16;
157 range[1] = 16;
158 *precision = 0;
159 break;
160 case GL_LOW_FLOAT:
161 range[0] = 8;
162 range[1] = 8;
163 *precision = 8;
164 break;
165 case GL_MEDIUM_FLOAT:
166 range[0] = 14;
167 range[1] = 14;
168 *precision = 10;
169 break;
170 case GL_HIGH_FLOAT:
171 range[0] = 62;
172 range[1] = 62;
173 *precision = 16;
174 break;
175 default:
176 NOTREACHED();
177 break;
181 WebKit::WebString FakeWebGraphicsContext3D::getShaderSource(
182 WebGLId shader) {
183 return WebKit::WebString();
186 WebKit::WebString FakeWebGraphicsContext3D::getString(WGC3Denum name) {
187 return WebKit::WebString();
190 WebKit::WGC3Dint FakeWebGraphicsContext3D::getUniformLocation(
191 WebGLId program,
192 const WebKit::WGC3Dchar* name) {
193 return 0;
196 WebKit::WGC3Dsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset(
197 WebKit::WGC3Duint index,
198 WGC3Denum pname) {
199 return 0;
202 WGC3Dboolean FakeWebGraphicsContext3D::isBuffer(
203 WebGLId buffer) {
204 return false;
207 WGC3Dboolean FakeWebGraphicsContext3D::isEnabled(
208 WGC3Denum cap) {
209 return false;
212 WGC3Dboolean FakeWebGraphicsContext3D::isFramebuffer(
213 WebGLId framebuffer) {
214 return false;
217 WGC3Dboolean FakeWebGraphicsContext3D::isProgram(
218 WebGLId program) {
219 return false;
222 WGC3Dboolean FakeWebGraphicsContext3D::isRenderbuffer(
223 WebGLId renderbuffer) {
224 return false;
227 WGC3Dboolean FakeWebGraphicsContext3D::isShader(
228 WebGLId shader) {
229 return false;
232 WGC3Dboolean FakeWebGraphicsContext3D::isTexture(
233 WebGLId texture) {
234 return false;
237 WebGLId FakeWebGraphicsContext3D::createBuffer() {
238 return 1;
241 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id) {
244 WebGLId FakeWebGraphicsContext3D::createFramebuffer() {
245 return 1;
248 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id) {
251 WebGLId FakeWebGraphicsContext3D::createProgram() {
252 return 1;
255 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id) {
258 WebGLId FakeWebGraphicsContext3D::createRenderbuffer() {
259 return 1;
262 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id) {
265 WebGLId FakeWebGraphicsContext3D::createShader(WGC3Denum) {
266 return 1;
269 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id) {
272 WebGLId FakeWebGraphicsContext3D::createTexture() {
273 return 1;
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() {
301 return 1;
304 WGC3Dboolean FakeWebGraphicsContext3D::isQueryEXT(WebGLId query) {
305 return true;
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,
322 WGC3Denum other) {
325 WebKit::WGC3Duint FakeWebGraphicsContext3D::createImageCHROMIUM(
326 WebKit::WGC3Dsizei width, WebKit::WGC3Dsizei height,
327 WebKit::WGC3Denum internalformat) {
328 return 0;
331 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id,
332 WebKit::WGC3Denum access) {
333 return 0;
336 } // namespace cc