| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "cc/debug/fake_web_graphics_context_3d.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "third_party/khronos/GLES2/gl2.h" | |
| 9 | |
| 10 using WebKit::WGC3Dboolean; | |
| 11 using WebKit::WGC3Denum; | |
| 12 using WebKit::WGC3Dsizei; | |
| 13 using WebKit::WebGLId; | |
| 14 using WebKit::WebGraphicsContext3D; | |
| 15 | |
| 16 namespace cc { | |
| 17 | |
| 18 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D() | |
| 19 : WebKit::WebGraphicsContext3D() { | |
| 20 } | |
| 21 | |
| 22 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() { | |
| 23 } | |
| 24 | |
| 25 bool FakeWebGraphicsContext3D::makeContextCurrent() { | |
| 26 return true; | |
| 27 } | |
| 28 | |
| 29 bool FakeWebGraphicsContext3D::isGLES2Compliant() { | |
| 30 return false; | |
| 31 } | |
| 32 | |
| 33 WebGLId FakeWebGraphicsContext3D::getPlatformTextureId() { | |
| 34 return 0; | |
| 35 } | |
| 36 | |
| 37 bool FakeWebGraphicsContext3D::isContextLost() { | |
| 38 return false; | |
| 39 } | |
| 40 | |
| 41 WGC3Denum FakeWebGraphicsContext3D::getGraphicsResetStatusARB() { | |
| 42 return GL_NO_ERROR; | |
| 43 } | |
| 44 | |
| 45 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM( | |
| 46 WGC3Denum target, | |
| 47 WebKit::WGC3Dintptr offset, | |
| 48 WebKit::WGC3Dsizeiptr size, | |
| 49 WGC3Denum access) { | |
| 50 return 0; | |
| 51 } | |
| 52 | |
| 53 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM( | |
| 54 WGC3Denum target, | |
| 55 WebKit::WGC3Dint level, | |
| 56 WebKit::WGC3Dint xoffset, | |
| 57 WebKit::WGC3Dint yoffset, | |
| 58 WebKit::WGC3Dsizei width, | |
| 59 WebKit::WGC3Dsizei height, | |
| 60 WGC3Denum format, | |
| 61 WGC3Denum type, | |
| 62 WGC3Denum access) { | |
| 63 return 0; | |
| 64 } | |
| 65 | |
| 66 WebKit::WebString FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() { | |
| 67 return WebKit::WebString(); | |
| 68 } | |
| 69 | |
| 70 WGC3Denum FakeWebGraphicsContext3D::checkFramebufferStatus( | |
| 71 WGC3Denum target) { | |
| 72 return GL_FRAMEBUFFER_COMPLETE; | |
| 73 } | |
| 74 | |
| 75 bool FakeWebGraphicsContext3D::getActiveAttrib( | |
| 76 WebGLId program, | |
| 77 WebKit::WGC3Duint index, | |
| 78 ActiveInfo&) { | |
| 79 return false; | |
| 80 } | |
| 81 | |
| 82 bool FakeWebGraphicsContext3D::getActiveUniform( | |
| 83 WebGLId program, | |
| 84 WebKit::WGC3Duint index, | |
| 85 ActiveInfo&) { | |
| 86 return false; | |
| 87 } | |
| 88 | |
| 89 WebKit::WGC3Dint FakeWebGraphicsContext3D::getAttribLocation( | |
| 90 WebGLId program, | |
| 91 const WebKit::WGC3Dchar* name) { | |
| 92 return 0; | |
| 93 } | |
| 94 | |
| 95 WebGraphicsContext3D::Attributes | |
| 96 FakeWebGraphicsContext3D::getContextAttributes() { | |
| 97 return WebGraphicsContext3D::Attributes(); | |
| 98 } | |
| 99 | |
| 100 WGC3Denum FakeWebGraphicsContext3D::getError() { | |
| 101 return 0; | |
| 102 } | |
| 103 | |
| 104 void FakeWebGraphicsContext3D::getIntegerv( | |
| 105 WGC3Denum pname, | |
| 106 WebKit::WGC3Dint* value) { | |
| 107 if (pname == GL_MAX_TEXTURE_SIZE) | |
| 108 *value = 1024; | |
| 109 else if (pname == GL_ACTIVE_TEXTURE) | |
| 110 *value = GL_TEXTURE0; | |
| 111 } | |
| 112 | |
| 113 void FakeWebGraphicsContext3D::getProgramiv( | |
| 114 WebGLId program, | |
| 115 WGC3Denum pname, | |
| 116 WebKit::WGC3Dint* value) { | |
| 117 if (pname == GL_LINK_STATUS) | |
| 118 *value = 1; | |
| 119 } | |
| 120 | |
| 121 WebKit::WebString FakeWebGraphicsContext3D::getProgramInfoLog( | |
| 122 WebGLId program) { | |
| 123 return WebKit::WebString(); | |
| 124 } | |
| 125 | |
| 126 void FakeWebGraphicsContext3D::getShaderiv( | |
| 127 WebGLId shader, | |
| 128 WGC3Denum pname, | |
| 129 WebKit::WGC3Dint* value) { | |
| 130 if (pname == GL_COMPILE_STATUS) | |
| 131 *value = 1; | |
| 132 } | |
| 133 | |
| 134 WebKit::WebString FakeWebGraphicsContext3D::getShaderInfoLog( | |
| 135 WebGLId shader) { | |
| 136 return WebKit::WebString(); | |
| 137 } | |
| 138 | |
| 139 void FakeWebGraphicsContext3D::getShaderPrecisionFormat( | |
| 140 WebKit::WGC3Denum shadertype, | |
| 141 WebKit::WGC3Denum precisiontype, | |
| 142 WebKit::WGC3Dint* range, | |
| 143 WebKit::WGC3Dint* precision) { | |
| 144 // Return the minimum precision requirements of the GLES specificatin. | |
| 145 switch (precisiontype) { | |
| 146 case GL_LOW_INT: | |
| 147 range[0] = 8; | |
| 148 range[1] = 8; | |
| 149 *precision = 0; | |
| 150 break; | |
| 151 case GL_MEDIUM_INT: | |
| 152 range[0] = 10; | |
| 153 range[1] = 10; | |
| 154 *precision = 0; | |
| 155 break; | |
| 156 case GL_HIGH_INT: | |
| 157 range[0] = 16; | |
| 158 range[1] = 16; | |
| 159 *precision = 0; | |
| 160 break; | |
| 161 case GL_LOW_FLOAT: | |
| 162 range[0] = 8; | |
| 163 range[1] = 8; | |
| 164 *precision = 8; | |
| 165 break; | |
| 166 case GL_MEDIUM_FLOAT: | |
| 167 range[0] = 14; | |
| 168 range[1] = 14; | |
| 169 *precision = 10; | |
| 170 break; | |
| 171 case GL_HIGH_FLOAT: | |
| 172 range[0] = 62; | |
| 173 range[1] = 62; | |
| 174 *precision = 16; | |
| 175 break; | |
| 176 default: | |
| 177 NOTREACHED(); | |
| 178 break; | |
| 179 } | |
| 180 } | |
| 181 | |
| 182 WebKit::WebString FakeWebGraphicsContext3D::getShaderSource( | |
| 183 WebGLId shader) { | |
| 184 return WebKit::WebString(); | |
| 185 } | |
| 186 | |
| 187 WebKit::WebString FakeWebGraphicsContext3D::getString(WGC3Denum name) { | |
| 188 return WebKit::WebString(); | |
| 189 } | |
| 190 | |
| 191 WebKit::WGC3Dint FakeWebGraphicsContext3D::getUniformLocation( | |
| 192 WebGLId program, | |
| 193 const WebKit::WGC3Dchar* name) { | |
| 194 return 0; | |
| 195 } | |
| 196 | |
| 197 WebKit::WGC3Dsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset( | |
| 198 WebKit::WGC3Duint index, | |
| 199 WGC3Denum pname) { | |
| 200 return 0; | |
| 201 } | |
| 202 | |
| 203 WGC3Dboolean FakeWebGraphicsContext3D::isBuffer( | |
| 204 WebGLId buffer) { | |
| 205 return false; | |
| 206 } | |
| 207 | |
| 208 WGC3Dboolean FakeWebGraphicsContext3D::isEnabled( | |
| 209 WGC3Denum cap) { | |
| 210 return false; | |
| 211 } | |
| 212 | |
| 213 WGC3Dboolean FakeWebGraphicsContext3D::isFramebuffer( | |
| 214 WebGLId framebuffer) { | |
| 215 return false; | |
| 216 } | |
| 217 | |
| 218 WGC3Dboolean FakeWebGraphicsContext3D::isProgram( | |
| 219 WebGLId program) { | |
| 220 return false; | |
| 221 } | |
| 222 | |
| 223 WGC3Dboolean FakeWebGraphicsContext3D::isRenderbuffer( | |
| 224 WebGLId renderbuffer) { | |
| 225 return false; | |
| 226 } | |
| 227 | |
| 228 WGC3Dboolean FakeWebGraphicsContext3D::isShader( | |
| 229 WebGLId shader) { | |
| 230 return false; | |
| 231 } | |
| 232 | |
| 233 WGC3Dboolean FakeWebGraphicsContext3D::isTexture( | |
| 234 WebGLId texture) { | |
| 235 return false; | |
| 236 } | |
| 237 | |
| 238 void FakeWebGraphicsContext3D::genBuffers(WGC3Dsizei count, WebGLId* ids) { | |
| 239 for (int i = 0; i < count; ++i) | |
| 240 ids[i] = 1; | |
| 241 } | |
| 242 | |
| 243 void FakeWebGraphicsContext3D::genFramebuffers( | |
| 244 WGC3Dsizei count, WebGLId* ids) { | |
| 245 for (int i = 0; i < count; ++i) | |
| 246 ids[i] = 1; | |
| 247 } | |
| 248 | |
| 249 void FakeWebGraphicsContext3D::genRenderbuffers( | |
| 250 WGC3Dsizei count, WebGLId* ids) { | |
| 251 for (int i = 0; i < count; ++i) | |
| 252 ids[i] = 1; | |
| 253 } | |
| 254 | |
| 255 void FakeWebGraphicsContext3D::genTextures(WGC3Dsizei count, WebGLId* ids) { | |
| 256 for (int i = 0; i < count; ++i) | |
| 257 ids[i] = 1; | |
| 258 } | |
| 259 | |
| 260 void FakeWebGraphicsContext3D::deleteBuffers(WGC3Dsizei count, WebGLId* ids) { | |
| 261 } | |
| 262 | |
| 263 void FakeWebGraphicsContext3D::deleteFramebuffers( | |
| 264 WGC3Dsizei count, WebGLId* ids) { | |
| 265 } | |
| 266 | |
| 267 void FakeWebGraphicsContext3D::deleteRenderbuffers( | |
| 268 WGC3Dsizei count, WebGLId* ids) { | |
| 269 } | |
| 270 | |
| 271 void FakeWebGraphicsContext3D::deleteTextures(WGC3Dsizei count, WebGLId* ids) { | |
| 272 } | |
| 273 | |
| 274 WebGLId FakeWebGraphicsContext3D::createBuffer() { | |
| 275 return 1; | |
| 276 } | |
| 277 | |
| 278 WebGLId FakeWebGraphicsContext3D::createFramebuffer() { | |
| 279 return 1; | |
| 280 } | |
| 281 | |
| 282 WebGLId FakeWebGraphicsContext3D::createRenderbuffer() { | |
| 283 return 1; | |
| 284 } | |
| 285 | |
| 286 WebGLId FakeWebGraphicsContext3D::createTexture() { | |
| 287 return 1; | |
| 288 } | |
| 289 | |
| 290 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id) { | |
| 291 } | |
| 292 | |
| 293 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id) { | |
| 294 } | |
| 295 | |
| 296 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id) { | |
| 297 } | |
| 298 | |
| 299 void FakeWebGraphicsContext3D::deleteTexture(WebGLId texture_id) { | |
| 300 } | |
| 301 | |
| 302 WebGLId FakeWebGraphicsContext3D::createProgram() { | |
| 303 return 1; | |
| 304 } | |
| 305 | |
| 306 WebGLId FakeWebGraphicsContext3D::createShader(WGC3Denum) { | |
| 307 return 1; | |
| 308 } | |
| 309 | |
| 310 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id) { | |
| 311 } | |
| 312 | |
| 313 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id) { | |
| 314 } | |
| 315 | |
| 316 void FakeWebGraphicsContext3D::attachShader(WebGLId program, WebGLId shader) { | |
| 317 } | |
| 318 | |
| 319 void FakeWebGraphicsContext3D::useProgram(WebGLId program) { | |
| 320 } | |
| 321 | |
| 322 void FakeWebGraphicsContext3D::bindBuffer(WGC3Denum target, WebGLId buffer) { | |
| 323 } | |
| 324 | |
| 325 void FakeWebGraphicsContext3D::bindFramebuffer( | |
| 326 WGC3Denum target, WebGLId framebuffer) { | |
| 327 } | |
| 328 | |
| 329 void FakeWebGraphicsContext3D::bindRenderbuffer( | |
| 330 WGC3Denum target, WebGLId renderbuffer) { | |
| 331 } | |
| 332 | |
| 333 void FakeWebGraphicsContext3D::bindTexture( | |
| 334 WGC3Denum target, WebGLId texture_id) { | |
| 335 } | |
| 336 | |
| 337 WebGLId FakeWebGraphicsContext3D::createQueryEXT() { | |
| 338 return 1; | |
| 339 } | |
| 340 | |
| 341 WGC3Dboolean FakeWebGraphicsContext3D::isQueryEXT(WebGLId query) { | |
| 342 return true; | |
| 343 } | |
| 344 | |
| 345 void FakeWebGraphicsContext3D::endQueryEXT(WebKit::WGC3Denum target) { | |
| 346 } | |
| 347 | |
| 348 void FakeWebGraphicsContext3D::getQueryObjectuivEXT( | |
| 349 WebKit::WebGLId query, | |
| 350 WebKit::WGC3Denum pname, | |
| 351 WebKit::WGC3Duint* params) { | |
| 352 } | |
| 353 | |
| 354 void FakeWebGraphicsContext3D::setContextLostCallback( | |
| 355 WebGraphicsContextLostCallback* callback) { | |
| 356 } | |
| 357 | |
| 358 void FakeWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current, | |
| 359 WGC3Denum other) { | |
| 360 } | |
| 361 | |
| 362 WebKit::WGC3Duint FakeWebGraphicsContext3D::createImageCHROMIUM( | |
| 363 WebKit::WGC3Dsizei width, WebKit::WGC3Dsizei height, | |
| 364 WebKit::WGC3Denum internalformat) { | |
| 365 return 0; | |
| 366 } | |
| 367 | |
| 368 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id, | |
| 369 WebKit::WGC3Denum access) { | |
| 370 return 0; | |
| 371 } | |
| 372 | |
| 373 } // namespace cc | |
| OLD | NEW |