| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/test/fake_web_graphics_context_3d.h" | 5 #include "cc/test/fake_web_graphics_context_3d.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
| 9 | 9 |
| 10 using WebKit::WGC3Dboolean; | 10 using blink::WGC3Dboolean; |
| 11 using WebKit::WGC3Denum; | 11 using blink::WGC3Denum; |
| 12 using WebKit::WGC3Dsizei; | 12 using blink::WGC3Dsizei; |
| 13 using WebKit::WebGLId; | 13 using blink::WebGLId; |
| 14 using WebKit::WebGraphicsContext3D; | 14 using blink::WebGraphicsContext3D; |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D() | 18 FakeWebGraphicsContext3D::FakeWebGraphicsContext3D() |
| 19 : WebKit::WebGraphicsContext3D() { | 19 : blink::WebGraphicsContext3D() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() { | 22 FakeWebGraphicsContext3D::~FakeWebGraphicsContext3D() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool FakeWebGraphicsContext3D::makeContextCurrent() { | 25 bool FakeWebGraphicsContext3D::makeContextCurrent() { |
| 26 return true; | 26 return true; |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool FakeWebGraphicsContext3D::isGLES2Compliant() { | 29 bool FakeWebGraphicsContext3D::isGLES2Compliant() { |
| 30 return false; | 30 return false; |
| 31 } | 31 } |
| 32 | 32 |
| 33 WebGLId FakeWebGraphicsContext3D::getPlatformTextureId() { | 33 WebGLId FakeWebGraphicsContext3D::getPlatformTextureId() { |
| 34 return 0; | 34 return 0; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool FakeWebGraphicsContext3D::isContextLost() { | 37 bool FakeWebGraphicsContext3D::isContextLost() { |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM( | 41 void* FakeWebGraphicsContext3D::mapBufferSubDataCHROMIUM( |
| 42 WGC3Denum target, | 42 WGC3Denum target, |
| 43 WebKit::WGC3Dintptr offset, | 43 blink::WGC3Dintptr offset, |
| 44 WebKit::WGC3Dsizeiptr size, | 44 blink::WGC3Dsizeiptr size, |
| 45 WGC3Denum access) { | 45 WGC3Denum access) { |
| 46 return 0; | 46 return 0; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM( | 49 void* FakeWebGraphicsContext3D::mapTexSubImage2DCHROMIUM( |
| 50 WGC3Denum target, | 50 WGC3Denum target, |
| 51 WebKit::WGC3Dint level, | 51 blink::WGC3Dint level, |
| 52 WebKit::WGC3Dint xoffset, | 52 blink::WGC3Dint xoffset, |
| 53 WebKit::WGC3Dint yoffset, | 53 blink::WGC3Dint yoffset, |
| 54 WebKit::WGC3Dsizei width, | 54 blink::WGC3Dsizei width, |
| 55 WebKit::WGC3Dsizei height, | 55 blink::WGC3Dsizei height, |
| 56 WGC3Denum format, | 56 WGC3Denum format, |
| 57 WGC3Denum type, | 57 WGC3Denum type, |
| 58 WGC3Denum access) { | 58 WGC3Denum access) { |
| 59 return 0; | 59 return 0; |
| 60 } | 60 } |
| 61 | 61 |
| 62 WebKit::WebString FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() { | 62 blink::WebString FakeWebGraphicsContext3D::getRequestableExtensionsCHROMIUM() { |
| 63 return WebKit::WebString(); | 63 return blink::WebString(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 WGC3Denum FakeWebGraphicsContext3D::checkFramebufferStatus( | 66 WGC3Denum FakeWebGraphicsContext3D::checkFramebufferStatus( |
| 67 WGC3Denum target) { | 67 WGC3Denum target) { |
| 68 return GL_FRAMEBUFFER_COMPLETE; | 68 return GL_FRAMEBUFFER_COMPLETE; |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool FakeWebGraphicsContext3D::getActiveAttrib( | 71 bool FakeWebGraphicsContext3D::getActiveAttrib( |
| 72 WebGLId program, | 72 WebGLId program, |
| 73 WebKit::WGC3Duint index, | 73 blink::WGC3Duint index, |
| 74 ActiveInfo&) { | 74 ActiveInfo&) { |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool FakeWebGraphicsContext3D::getActiveUniform( | 78 bool FakeWebGraphicsContext3D::getActiveUniform( |
| 79 WebGLId program, | 79 WebGLId program, |
| 80 WebKit::WGC3Duint index, | 80 blink::WGC3Duint index, |
| 81 ActiveInfo&) { | 81 ActiveInfo&) { |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 WebKit::WGC3Dint FakeWebGraphicsContext3D::getAttribLocation( | 85 blink::WGC3Dint FakeWebGraphicsContext3D::getAttribLocation( |
| 86 WebGLId program, | 86 WebGLId program, |
| 87 const WebKit::WGC3Dchar* name) { | 87 const blink::WGC3Dchar* name) { |
| 88 return 0; | 88 return 0; |
| 89 } | 89 } |
| 90 | 90 |
| 91 WebGraphicsContext3D::Attributes | 91 WebGraphicsContext3D::Attributes |
| 92 FakeWebGraphicsContext3D::getContextAttributes() { | 92 FakeWebGraphicsContext3D::getContextAttributes() { |
| 93 return WebGraphicsContext3D::Attributes(); | 93 return WebGraphicsContext3D::Attributes(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 WGC3Denum FakeWebGraphicsContext3D::getError() { | 96 WGC3Denum FakeWebGraphicsContext3D::getError() { |
| 97 return 0; | 97 return 0; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void FakeWebGraphicsContext3D::getIntegerv( | 100 void FakeWebGraphicsContext3D::getIntegerv( |
| 101 WGC3Denum pname, | 101 WGC3Denum pname, |
| 102 WebKit::WGC3Dint* value) { | 102 blink::WGC3Dint* value) { |
| 103 if (pname == GL_MAX_TEXTURE_SIZE) | 103 if (pname == GL_MAX_TEXTURE_SIZE) |
| 104 *value = 1024; | 104 *value = 1024; |
| 105 else if (pname == GL_ACTIVE_TEXTURE) | 105 else if (pname == GL_ACTIVE_TEXTURE) |
| 106 *value = GL_TEXTURE0; | 106 *value = GL_TEXTURE0; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void FakeWebGraphicsContext3D::getProgramiv( | 109 void FakeWebGraphicsContext3D::getProgramiv( |
| 110 WebGLId program, | 110 WebGLId program, |
| 111 WGC3Denum pname, | 111 WGC3Denum pname, |
| 112 WebKit::WGC3Dint* value) { | 112 blink::WGC3Dint* value) { |
| 113 if (pname == GL_LINK_STATUS) | 113 if (pname == GL_LINK_STATUS) |
| 114 *value = 1; | 114 *value = 1; |
| 115 } | 115 } |
| 116 | 116 |
| 117 WebKit::WebString FakeWebGraphicsContext3D::getProgramInfoLog( | 117 blink::WebString FakeWebGraphicsContext3D::getProgramInfoLog( |
| 118 WebGLId program) { | 118 WebGLId program) { |
| 119 return WebKit::WebString(); | 119 return blink::WebString(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void FakeWebGraphicsContext3D::getShaderiv( | 122 void FakeWebGraphicsContext3D::getShaderiv( |
| 123 WebGLId shader, | 123 WebGLId shader, |
| 124 WGC3Denum pname, | 124 WGC3Denum pname, |
| 125 WebKit::WGC3Dint* value) { | 125 blink::WGC3Dint* value) { |
| 126 if (pname == GL_COMPILE_STATUS) | 126 if (pname == GL_COMPILE_STATUS) |
| 127 *value = 1; | 127 *value = 1; |
| 128 } | 128 } |
| 129 | 129 |
| 130 WebKit::WebString FakeWebGraphicsContext3D::getShaderInfoLog( | 130 blink::WebString FakeWebGraphicsContext3D::getShaderInfoLog( |
| 131 WebGLId shader) { | 131 WebGLId shader) { |
| 132 return WebKit::WebString(); | 132 return blink::WebString(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void FakeWebGraphicsContext3D::getShaderPrecisionFormat( | 135 void FakeWebGraphicsContext3D::getShaderPrecisionFormat( |
| 136 WebKit::WGC3Denum shadertype, | 136 blink::WGC3Denum shadertype, |
| 137 WebKit::WGC3Denum precisiontype, | 137 blink::WGC3Denum precisiontype, |
| 138 WebKit::WGC3Dint* range, | 138 blink::WGC3Dint* range, |
| 139 WebKit::WGC3Dint* precision) { | 139 blink::WGC3Dint* precision) { |
| 140 // Return the minimum precision requirements of the GLES specificatin. | 140 // Return the minimum precision requirements of the GLES specificatin. |
| 141 switch (precisiontype) { | 141 switch (precisiontype) { |
| 142 case GL_LOW_INT: | 142 case GL_LOW_INT: |
| 143 range[0] = 8; | 143 range[0] = 8; |
| 144 range[1] = 8; | 144 range[1] = 8; |
| 145 *precision = 0; | 145 *precision = 0; |
| 146 break; | 146 break; |
| 147 case GL_MEDIUM_INT: | 147 case GL_MEDIUM_INT: |
| 148 range[0] = 10; | 148 range[0] = 10; |
| 149 range[1] = 10; | 149 range[1] = 10; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 168 range[0] = 62; | 168 range[0] = 62; |
| 169 range[1] = 62; | 169 range[1] = 62; |
| 170 *precision = 16; | 170 *precision = 16; |
| 171 break; | 171 break; |
| 172 default: | 172 default: |
| 173 NOTREACHED(); | 173 NOTREACHED(); |
| 174 break; | 174 break; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 WebKit::WebString FakeWebGraphicsContext3D::getShaderSource( | 178 blink::WebString FakeWebGraphicsContext3D::getShaderSource( |
| 179 WebGLId shader) { | 179 WebGLId shader) { |
| 180 return WebKit::WebString(); | 180 return blink::WebString(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 WebKit::WebString FakeWebGraphicsContext3D::getString(WGC3Denum name) { | 183 blink::WebString FakeWebGraphicsContext3D::getString(WGC3Denum name) { |
| 184 return WebKit::WebString(); | 184 return blink::WebString(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 WebKit::WGC3Dint FakeWebGraphicsContext3D::getUniformLocation( | 187 blink::WGC3Dint FakeWebGraphicsContext3D::getUniformLocation( |
| 188 WebGLId program, | 188 WebGLId program, |
| 189 const WebKit::WGC3Dchar* name) { | 189 const blink::WGC3Dchar* name) { |
| 190 return 0; | 190 return 0; |
| 191 } | 191 } |
| 192 | 192 |
| 193 WebKit::WGC3Dsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset( | 193 blink::WGC3Dsizeiptr FakeWebGraphicsContext3D::getVertexAttribOffset( |
| 194 WebKit::WGC3Duint index, | 194 blink::WGC3Duint index, |
| 195 WGC3Denum pname) { | 195 WGC3Denum pname) { |
| 196 return 0; | 196 return 0; |
| 197 } | 197 } |
| 198 | 198 |
| 199 WGC3Dboolean FakeWebGraphicsContext3D::isBuffer( | 199 WGC3Dboolean FakeWebGraphicsContext3D::isBuffer( |
| 200 WebGLId buffer) { | 200 WebGLId buffer) { |
| 201 return false; | 201 return false; |
| 202 } | 202 } |
| 203 | 203 |
| 204 WGC3Dboolean FakeWebGraphicsContext3D::isEnabled( | 204 WGC3Dboolean FakeWebGraphicsContext3D::isEnabled( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } | 276 } |
| 277 | 277 |
| 278 WebGLId FakeWebGraphicsContext3D::createRenderbuffer() { | 278 WebGLId FakeWebGraphicsContext3D::createRenderbuffer() { |
| 279 return 1; | 279 return 1; |
| 280 } | 280 } |
| 281 | 281 |
| 282 WebGLId FakeWebGraphicsContext3D::createTexture() { | 282 WebGLId FakeWebGraphicsContext3D::createTexture() { |
| 283 return 1; | 283 return 1; |
| 284 } | 284 } |
| 285 | 285 |
| 286 void FakeWebGraphicsContext3D::deleteBuffer(WebKit::WebGLId id) { | 286 void FakeWebGraphicsContext3D::deleteBuffer(blink::WebGLId id) { |
| 287 } | 287 } |
| 288 | 288 |
| 289 void FakeWebGraphicsContext3D::deleteFramebuffer(WebKit::WebGLId id) { | 289 void FakeWebGraphicsContext3D::deleteFramebuffer(blink::WebGLId id) { |
| 290 } | 290 } |
| 291 | 291 |
| 292 void FakeWebGraphicsContext3D::deleteRenderbuffer(WebKit::WebGLId id) { | 292 void FakeWebGraphicsContext3D::deleteRenderbuffer(blink::WebGLId id) { |
| 293 } | 293 } |
| 294 | 294 |
| 295 void FakeWebGraphicsContext3D::deleteTexture(WebGLId texture_id) { | 295 void FakeWebGraphicsContext3D::deleteTexture(WebGLId texture_id) { |
| 296 } | 296 } |
| 297 | 297 |
| 298 WebGLId FakeWebGraphicsContext3D::createProgram() { | 298 WebGLId FakeWebGraphicsContext3D::createProgram() { |
| 299 return 1; | 299 return 1; |
| 300 } | 300 } |
| 301 | 301 |
| 302 WebGLId FakeWebGraphicsContext3D::createShader(WGC3Denum) { | 302 WebGLId FakeWebGraphicsContext3D::createShader(WGC3Denum) { |
| 303 return 1; | 303 return 1; |
| 304 } | 304 } |
| 305 | 305 |
| 306 void FakeWebGraphicsContext3D::deleteProgram(WebKit::WebGLId id) { | 306 void FakeWebGraphicsContext3D::deleteProgram(blink::WebGLId id) { |
| 307 } | 307 } |
| 308 | 308 |
| 309 void FakeWebGraphicsContext3D::deleteShader(WebKit::WebGLId id) { | 309 void FakeWebGraphicsContext3D::deleteShader(blink::WebGLId id) { |
| 310 } | 310 } |
| 311 | 311 |
| 312 void FakeWebGraphicsContext3D::attachShader(WebGLId program, WebGLId shader) { | 312 void FakeWebGraphicsContext3D::attachShader(WebGLId program, WebGLId shader) { |
| 313 } | 313 } |
| 314 | 314 |
| 315 void FakeWebGraphicsContext3D::useProgram(WebGLId program) { | 315 void FakeWebGraphicsContext3D::useProgram(WebGLId program) { |
| 316 } | 316 } |
| 317 | 317 |
| 318 void FakeWebGraphicsContext3D::bindBuffer(WGC3Denum target, WebGLId buffer) { | 318 void FakeWebGraphicsContext3D::bindBuffer(WGC3Denum target, WebGLId buffer) { |
| 319 } | 319 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 331 } | 331 } |
| 332 | 332 |
| 333 WebGLId FakeWebGraphicsContext3D::createQueryEXT() { | 333 WebGLId FakeWebGraphicsContext3D::createQueryEXT() { |
| 334 return 1; | 334 return 1; |
| 335 } | 335 } |
| 336 | 336 |
| 337 WGC3Dboolean FakeWebGraphicsContext3D::isQueryEXT(WebGLId query) { | 337 WGC3Dboolean FakeWebGraphicsContext3D::isQueryEXT(WebGLId query) { |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 | 340 |
| 341 void FakeWebGraphicsContext3D::endQueryEXT(WebKit::WGC3Denum target) { | 341 void FakeWebGraphicsContext3D::endQueryEXT(blink::WGC3Denum target) { |
| 342 } | 342 } |
| 343 | 343 |
| 344 void FakeWebGraphicsContext3D::getQueryObjectuivEXT( | 344 void FakeWebGraphicsContext3D::getQueryObjectuivEXT( |
| 345 WebKit::WebGLId query, | 345 blink::WebGLId query, |
| 346 WebKit::WGC3Denum pname, | 346 blink::WGC3Denum pname, |
| 347 WebKit::WGC3Duint* params) { | 347 blink::WGC3Duint* params) { |
| 348 } | 348 } |
| 349 | 349 |
| 350 void FakeWebGraphicsContext3D::setContextLostCallback( | 350 void FakeWebGraphicsContext3D::setContextLostCallback( |
| 351 WebGraphicsContextLostCallback* callback) { | 351 WebGraphicsContextLostCallback* callback) { |
| 352 } | 352 } |
| 353 | 353 |
| 354 void FakeWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current, | 354 void FakeWebGraphicsContext3D::loseContextCHROMIUM(WGC3Denum current, |
| 355 WGC3Denum other) { | 355 WGC3Denum other) { |
| 356 } | 356 } |
| 357 | 357 |
| 358 WebKit::WGC3Duint FakeWebGraphicsContext3D::createImageCHROMIUM( | 358 blink::WGC3Duint FakeWebGraphicsContext3D::createImageCHROMIUM( |
| 359 WebKit::WGC3Dsizei width, WebKit::WGC3Dsizei height, | 359 blink::WGC3Dsizei width, blink::WGC3Dsizei height, |
| 360 WebKit::WGC3Denum internalformat) { | 360 blink::WGC3Denum internalformat) { |
| 361 return 0; | 361 return 0; |
| 362 } | 362 } |
| 363 | 363 |
| 364 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id, | 364 void* FakeWebGraphicsContext3D::mapImageCHROMIUM(blink::WGC3Duint image_id, |
| 365 WebKit::WGC3Denum access) { | 365 blink::WGC3Denum access) { |
| 366 return 0; | 366 return 0; |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace cc | 369 } // namespace cc |
| OLD | NEW |