Fix build break
[chromium-blink-merge.git] / cc / debug / fake_web_graphics_context_3d.cc
blobd3ab18a3c4f96e23f64343b5616623ea9aa9b474
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 int FakeWebGraphicsContext3D::width() {
29 return 1;
32 int FakeWebGraphicsContext3D::height() {
33 return 1;
36 void FakeWebGraphicsContext3D::reshape(int width, int height) {
39 bool FakeWebGraphicsContext3D::isGLES2Compliant() {
40 return false;
43 bool FakeWebGraphicsContext3D::readBackFramebuffer(
44 unsigned char* pixels,
45 size_t buffer_size,
46 WebGLId framebuffer,
47 int width,
48 int height) {
49 return false;
52 WebGLId FakeWebGraphicsContext3D::getPlatformTextureId() {
53 return 0;
56 bool FakeWebGraphicsContext3D::isContextLost() {
57 return false;
60 WGC3Denum FakeWebGraphicsContext3D::getGraphicsResetStatusARB() {
61 return GL_NO_ERROR;
64 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM(
65 WGC3Denum target,
66 WebKit::WGC3Dintptr offset,
67 WebKit::WGC3Dsizeiptr size,
68 WGC3Denum access) {
69 return 0;
72 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM(
73 WGC3Denum target,
74 WebKit::WGC3Dint level,
75 WebKit::WGC3Dint xoffset,
76 WebKit::WGC3Dint yoffset,
77 WebKit::WGC3Dsizei width,
78 WebKit::WGC3Dsizei height,
79 WGC3Denum format,
80 WGC3Denum type,
81 WGC3Denum access) {
82 return 0;
85 WebKit::WebString FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() {
86 return WebKit::WebString();
89 WGC3Denum FakeWebGraphicsContext3D::checkFramebufferStatus(
90 WGC3Denum target) {
91 return GL_FRAMEBUFFER_COMPLETE;
94 bool FakeWebGraphicsContext3D::getActiveAttrib(
95 WebGLId program,
96 WebKit::WGC3Duint index,
97 ActiveInfo&) {
98 return false;
101 bool FakeWebGraphicsContext3D::getActiveUniform(
102 WebGLId program,
103 WebKit::WGC3Duint index,
104 ActiveInfo&) {
105 return false;
108 WebKit::WGC3Dint FakeWebGraphicsContext3D::getAttribLocation(
109 WebGLId program,
110 const WebKit::WGC3Dchar* name) {
111 return 0;
114 WebGraphicsContext3D::Attributes
115 FakeWebGraphicsContext3D::getContextAttributes() {
116 return WebGraphicsContext3D::Attributes();
119 WGC3Denum FakeWebGraphicsContext3D::getError() {
120 return 0;
123 void FakeWebGraphicsContext3D::getIntegerv(
124 WGC3Denum pname,
125 WebKit::WGC3Dint* value) {
126 if (pname == GL_MAX_TEXTURE_SIZE)
127 *value = 1024;
130 void FakeWebGraphicsContext3D::getProgramiv(
131 WebGLId program,
132 WGC3Denum pname,
133 WebKit::WGC3Dint* value) {
134 if (pname == GL_LINK_STATUS)
135 *value = 1;
138 WebKit::WebString FakeWebGraphicsContext3D::getProgramInfoLog(
139 WebGLId program) {
140 return WebKit::WebString();
143 void FakeWebGraphicsContext3D::getShaderiv(
144 WebGLId shader,
145 WGC3Denum pname,
146 WebKit::WGC3Dint* value) {
147 if (pname == GL_COMPILE_STATUS)
148 *value = 1;
151 WebKit::WebString FakeWebGraphicsContext3D::getShaderInfoLog(
152 WebGLId shader) {
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) {
163 case GL_LOW_INT:
164 range[0] = 8;
165 range[1] = 8;
166 *precision = 0;
167 break;
168 case GL_MEDIUM_INT:
169 range[0] = 10;
170 range[1] = 10;
171 *precision = 0;
172 break;
173 case GL_HIGH_INT:
174 range[0] = 16;
175 range[1] = 16;
176 *precision = 0;
177 break;
178 case GL_LOW_FLOAT:
179 range[0] = 8;
180 range[1] = 8;
181 *precision = 8;
182 break;
183 case GL_MEDIUM_FLOAT:
184 range[0] = 14;
185 range[1] = 14;
186 *precision = 10;
187 break;
188 case GL_HIGH_FLOAT:
189 range[0] = 62;
190 range[1] = 62;
191 *precision = 16;
192 break;
193 default:
194 NOTREACHED();
195 break;
199 WebKit::WebString FakeWebGraphicsContext3D::getShaderSource(
200 WebGLId shader) {
201 return WebKit::WebString();
204 WebKit::WebString FakeWebGraphicsContext3D::getString(WGC3Denum name) {
205 return WebKit::WebString();
208 WebKit::WGC3Dint FakeWebGraphicsContext3D::getUniformLocation(
209 WebGLId program,
210 const WebKit::WGC3Dchar* name) {
211 return 0;
214 WebKit::WGC3Dsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset(
215 WebKit::WGC3Duint index,
216 WGC3Denum pname) {
217 return 0;
220 WGC3Dboolean FakeWebGraphicsContext3D::isBuffer(
221 WebGLId buffer) {
222 return false;
225 WGC3Dboolean FakeWebGraphicsContext3D::isEnabled(
226 WGC3Denum cap) {
227 return false;
230 WGC3Dboolean FakeWebGraphicsContext3D::isFramebuffer(
231 WebGLId framebuffer) {
232 return false;
235 WGC3Dboolean FakeWebGraphicsContext3D::isProgram(
236 WebGLId program) {
237 return false;
240 WGC3Dboolean FakeWebGraphicsContext3D::isRenderbuffer(
241 WebGLId renderbuffer) {
242 return false;
245 WGC3Dboolean FakeWebGraphicsContext3D::isShader(
246 WebGLId shader) {
247 return false;
250 WGC3Dboolean FakeWebGraphicsContext3D::isTexture(
251 WebGLId texture) {
252 return false;
255 WebGLId FakeWebGraphicsContext3D::createBuffer() {
256 return 1;
259 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id) {
262 WebGLId FakeWebGraphicsContext3D::createFramebuffer() {
263 return 1;
266 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id) {
269 WebGLId FakeWebGraphicsContext3D::createProgram() {
270 return 1;
273 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id) {
276 WebGLId FakeWebGraphicsContext3D::createRenderbuffer() {
277 return 1;
280 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id) {
283 WebGLId FakeWebGraphicsContext3D::createShader(WGC3Denum) {
284 return 1;
287 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id) {
290 WebGLId FakeWebGraphicsContext3D::createTexture() {
291 return 1;
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() {
319 return 1;
322 WGC3Dboolean FakeWebGraphicsContext3D::isQueryEXT(WebGLId query) {
323 return true;
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,
340 WGC3Denum other) {
343 } // namespace cc