| 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/test/test_gles2_interface.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "cc/test/test_web_graphics_context_3d.h" | |
| 9 | |
| 10 namespace cc { | |
| 11 | |
| 12 TestGLES2Interface::TestGLES2Interface(TestWebGraphicsContext3D* test_context) | |
| 13 : test_context_(test_context) { | |
| 14 DCHECK(test_context_); | |
| 15 } | |
| 16 | |
| 17 TestGLES2Interface::~TestGLES2Interface() {} | |
| 18 | |
| 19 void TestGLES2Interface::GenTextures(GLsizei n, GLuint* textures) { | |
| 20 for (GLsizei i = 0; i < n; ++i) { | |
| 21 textures[i] = test_context_->createTexture(); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 void TestGLES2Interface::GenBuffers(GLsizei n, GLuint* buffers) { | |
| 26 for (GLsizei i = 0; i < n; ++i) { | |
| 27 buffers[i] = test_context_->createBuffer(); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 void TestGLES2Interface::GenFramebuffers(GLsizei n, GLuint* framebuffers) { | |
| 32 for (GLsizei i = 0; i < n; ++i) { | |
| 33 framebuffers[i] = test_context_->createFramebuffer(); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 void TestGLES2Interface::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { | |
| 38 for (GLsizei i = 0; i < n; ++i) { | |
| 39 renderbuffers[i] = test_context_->createRenderbuffer(); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 void TestGLES2Interface::GenQueriesEXT(GLsizei n, GLuint* queries) { | |
| 44 for (GLsizei i = 0; i < n; ++i) { | |
| 45 queries[i] = test_context_->createQueryEXT(); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 void TestGLES2Interface::DeleteTextures(GLsizei n, const GLuint* textures) { | |
| 50 for (GLsizei i = 0; i < n; ++i) { | |
| 51 test_context_->deleteTexture(textures[i]); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 void TestGLES2Interface::DeleteBuffers(GLsizei n, const GLuint* buffers) { | |
| 56 for (GLsizei i = 0; i < n; ++i) { | |
| 57 test_context_->deleteBuffer(buffers[i]); | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 void TestGLES2Interface::DeleteFramebuffers(GLsizei n, | |
| 62 const GLuint* framebuffers) { | |
| 63 for (GLsizei i = 0; i < n; ++i) { | |
| 64 test_context_->deleteFramebuffer(framebuffers[i]); | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 void TestGLES2Interface::DeleteQueriesEXT(GLsizei n, const GLuint* queries) { | |
| 69 for (GLsizei i = 0; i < n; ++i) { | |
| 70 test_context_->deleteQueryEXT(queries[i]); | |
| 71 } | |
| 72 } | |
| 73 | |
| 74 GLuint TestGLES2Interface::CreateShader(GLenum type) { | |
| 75 return test_context_->createShader(type); | |
| 76 } | |
| 77 | |
| 78 GLuint TestGLES2Interface::CreateProgram() { | |
| 79 return test_context_->createProgram(); | |
| 80 } | |
| 81 | |
| 82 void TestGLES2Interface::BindTexture(GLenum target, GLuint texture) { | |
| 83 test_context_->bindTexture(target, texture); | |
| 84 } | |
| 85 | |
| 86 void TestGLES2Interface::GetIntegerv(GLenum pname, GLint* params) { | |
| 87 test_context_->getIntegerv(pname, params); | |
| 88 } | |
| 89 | |
| 90 void TestGLES2Interface::GetShaderiv(GLuint shader, | |
| 91 GLenum pname, | |
| 92 GLint* params) { | |
| 93 test_context_->getShaderiv(shader, pname, params); | |
| 94 } | |
| 95 | |
| 96 void TestGLES2Interface::GetProgramiv(GLuint program, | |
| 97 GLenum pname, | |
| 98 GLint* params) { | |
| 99 test_context_->getProgramiv(program, pname, params); | |
| 100 } | |
| 101 | |
| 102 void TestGLES2Interface::GetShaderPrecisionFormat(GLenum shadertype, | |
| 103 GLenum precisiontype, | |
| 104 GLint* range, | |
| 105 GLint* precision) { | |
| 106 test_context_->getShaderPrecisionFormat( | |
| 107 shadertype, precisiontype, range, precision); | |
| 108 } | |
| 109 | |
| 110 void TestGLES2Interface::Viewport(GLint x, | |
| 111 GLint y, | |
| 112 GLsizei width, | |
| 113 GLsizei height) { | |
| 114 test_context_->viewport(x, y, width, height); | |
| 115 } | |
| 116 | |
| 117 void TestGLES2Interface::ActiveTexture(GLenum target) { | |
| 118 test_context_->activeTexture(target); | |
| 119 } | |
| 120 | |
| 121 void TestGLES2Interface::UseProgram(GLuint program) { | |
| 122 test_context_->useProgram(program); | |
| 123 } | |
| 124 | |
| 125 GLenum TestGLES2Interface::CheckFramebufferStatus(GLenum target) { | |
| 126 return test_context_->checkFramebufferStatus(target); | |
| 127 } | |
| 128 | |
| 129 void TestGLES2Interface::Scissor(GLint x, | |
| 130 GLint y, | |
| 131 GLsizei width, | |
| 132 GLsizei height) { | |
| 133 test_context_->scissor(x, y, width, height); | |
| 134 } | |
| 135 | |
| 136 void TestGLES2Interface::DrawElements(GLenum mode, | |
| 137 GLsizei count, | |
| 138 GLenum type, | |
| 139 const void* indices) { | |
| 140 test_context_->drawElements( | |
| 141 mode, count, type, reinterpret_cast<intptr_t>(indices)); | |
| 142 } | |
| 143 | |
| 144 void TestGLES2Interface::ClearColor(GLclampf red, | |
| 145 GLclampf green, | |
| 146 GLclampf blue, | |
| 147 GLclampf alpha) { | |
| 148 test_context_->clearColor(red, green, blue, alpha); | |
| 149 } | |
| 150 | |
| 151 void TestGLES2Interface::ClearStencil(GLint s) { | |
| 152 test_context_->clearStencil(s); | |
| 153 } | |
| 154 | |
| 155 void TestGLES2Interface::Clear(GLbitfield mask) { test_context_->clear(mask); } | |
| 156 | |
| 157 void TestGLES2Interface::Flush() { test_context_->flush(); } | |
| 158 | |
| 159 void TestGLES2Interface::Finish() { test_context_->finish(); } | |
| 160 | |
| 161 void TestGLES2Interface::ShallowFlushCHROMIUM() { | |
| 162 test_context_->shallowFlushCHROMIUM(); | |
| 163 } | |
| 164 | |
| 165 void TestGLES2Interface::Enable(GLenum cap) { test_context_->enable(cap); } | |
| 166 | |
| 167 void TestGLES2Interface::Disable(GLenum cap) { test_context_->disable(cap); } | |
| 168 | |
| 169 void TestGLES2Interface::BindRenderbuffer(GLenum target, GLuint buffer) { | |
| 170 test_context_->bindRenderbuffer(target, buffer); | |
| 171 } | |
| 172 | |
| 173 void TestGLES2Interface::BindFramebuffer(GLenum target, GLuint buffer) { | |
| 174 test_context_->bindFramebuffer(target, buffer); | |
| 175 } | |
| 176 | |
| 177 void TestGLES2Interface::BindBuffer(GLenum target, GLuint buffer) { | |
| 178 test_context_->bindBuffer(target, buffer); | |
| 179 } | |
| 180 | |
| 181 void TestGLES2Interface::PixelStorei(GLenum pname, GLint param) { | |
| 182 test_context_->pixelStorei(pname, param); | |
| 183 } | |
| 184 | |
| 185 void TestGLES2Interface::TexImage2D(GLenum target, | |
| 186 GLint level, | |
| 187 GLint internalformat, | |
| 188 GLsizei width, | |
| 189 GLsizei height, | |
| 190 GLint border, | |
| 191 GLenum format, | |
| 192 GLenum type, | |
| 193 const void* pixels) { | |
| 194 test_context_->texImage2D(target, | |
| 195 level, | |
| 196 internalformat, | |
| 197 width, | |
| 198 height, | |
| 199 border, | |
| 200 format, | |
| 201 type, | |
| 202 pixels); | |
| 203 } | |
| 204 | |
| 205 void TestGLES2Interface::TexSubImage2D(GLenum target, | |
| 206 GLint level, | |
| 207 GLint xoffset, | |
| 208 GLint yoffset, | |
| 209 GLsizei width, | |
| 210 GLsizei height, | |
| 211 GLenum format, | |
| 212 GLenum type, | |
| 213 const void* pixels) { | |
| 214 test_context_->texSubImage2D( | |
| 215 target, level, xoffset, yoffset, width, height, format, type, pixels); | |
| 216 } | |
| 217 | |
| 218 void TestGLES2Interface::TexStorage2DEXT(GLenum target, | |
| 219 GLsizei levels, | |
| 220 GLenum internalformat, | |
| 221 GLsizei width, | |
| 222 GLsizei height) { | |
| 223 test_context_->texStorage2DEXT(target, levels, internalformat, width, height); | |
| 224 } | |
| 225 | |
| 226 void TestGLES2Interface::TexImageIOSurface2DCHROMIUM(GLenum target, | |
| 227 GLsizei width, | |
| 228 GLsizei height, | |
| 229 GLuint io_surface_id, | |
| 230 GLuint plane) { | |
| 231 test_context_->texImageIOSurface2DCHROMIUM( | |
| 232 target, width, height, io_surface_id, plane); | |
| 233 } | |
| 234 | |
| 235 void TestGLES2Interface::TexParameteri(GLenum target, | |
| 236 GLenum pname, | |
| 237 GLint param) { | |
| 238 test_context_->texParameteri(target, pname, param); | |
| 239 } | |
| 240 | |
| 241 void TestGLES2Interface::FramebufferRenderbuffer(GLenum target, | |
| 242 GLenum attachment, | |
| 243 GLenum renderbuffertarget, | |
| 244 GLuint renderbuffer) { | |
| 245 test_context_->framebufferRenderbuffer( | |
| 246 target, attachment, renderbuffertarget, renderbuffer); | |
| 247 } | |
| 248 void TestGLES2Interface::FramebufferTexture2D(GLenum target, | |
| 249 GLenum attachment, | |
| 250 GLenum textarget, | |
| 251 GLuint texture, | |
| 252 GLint level) { | |
| 253 test_context_->framebufferTexture2D( | |
| 254 target, attachment, textarget, texture, level); | |
| 255 } | |
| 256 | |
| 257 void TestGLES2Interface::RenderbufferStorage(GLenum target, | |
| 258 GLenum internalformat, | |
| 259 GLsizei width, | |
| 260 GLsizei height) { | |
| 261 test_context_->renderbufferStorage(target, internalformat, width, height); | |
| 262 } | |
| 263 | |
| 264 void TestGLES2Interface::AsyncTexImage2DCHROMIUM(GLenum target, | |
| 265 GLint level, | |
| 266 GLenum internalformat, | |
| 267 GLsizei width, | |
| 268 GLsizei height, | |
| 269 GLint border, | |
| 270 GLenum format, | |
| 271 GLenum type, | |
| 272 const void* pixels) { | |
| 273 test_context_->asyncTexImage2DCHROMIUM(target, | |
| 274 level, | |
| 275 internalformat, | |
| 276 width, | |
| 277 height, | |
| 278 border, | |
| 279 format, | |
| 280 type, | |
| 281 pixels); | |
| 282 } | |
| 283 | |
| 284 void TestGLES2Interface::AsyncTexSubImage2DCHROMIUM(GLenum target, | |
| 285 GLint level, | |
| 286 GLint xoffset, | |
| 287 GLint yoffset, | |
| 288 GLsizei width, | |
| 289 GLsizei height, | |
| 290 GLenum format, | |
| 291 GLenum type, | |
| 292 const void* pixels) { | |
| 293 test_context_->asyncTexSubImage2DCHROMIUM( | |
| 294 target, level, xoffset, yoffset, width, height, format, type, pixels); | |
| 295 } | |
| 296 | |
| 297 void TestGLES2Interface::CompressedTexImage2D(GLenum target, | |
| 298 GLint level, | |
| 299 GLenum internalformat, | |
| 300 GLsizei width, | |
| 301 GLsizei height, | |
| 302 GLint border, | |
| 303 GLsizei image_size, | |
| 304 const void* data) { | |
| 305 test_context_->compressedTexImage2D( | |
| 306 target, level, internalformat, width, height, border, image_size, data); | |
| 307 } | |
| 308 | |
| 309 void TestGLES2Interface::WaitAsyncTexImage2DCHROMIUM(GLenum target) { | |
| 310 test_context_->waitAsyncTexImage2DCHROMIUM(target); | |
| 311 } | |
| 312 | |
| 313 GLuint TestGLES2Interface::CreateImageCHROMIUM(ClientBuffer buffer, | |
| 314 GLsizei width, | |
| 315 GLsizei height, | |
| 316 GLenum internalformat) { | |
| 317 return test_context_->createImageCHROMIUM( | |
| 318 buffer, width, height, internalformat); | |
| 319 } | |
| 320 | |
| 321 void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) { | |
| 322 test_context_->destroyImageCHROMIUM(image_id); | |
| 323 } | |
| 324 | |
| 325 GLuint TestGLES2Interface::CreateGpuMemoryBufferImageCHROMIUM( | |
| 326 GLsizei width, | |
| 327 GLsizei height, | |
| 328 GLenum internalformat, | |
| 329 GLenum usage) { | |
| 330 return test_context_->createGpuMemoryBufferImageCHROMIUM( | |
| 331 width, height, internalformat, usage); | |
| 332 } | |
| 333 | |
| 334 void TestGLES2Interface::BindTexImage2DCHROMIUM(GLenum target, GLint image_id) { | |
| 335 test_context_->bindTexImage2DCHROMIUM(target, image_id); | |
| 336 } | |
| 337 | |
| 338 void TestGLES2Interface::ReleaseTexImage2DCHROMIUM(GLenum target, | |
| 339 GLint image_id) { | |
| 340 test_context_->releaseTexImage2DCHROMIUM(target, image_id); | |
| 341 } | |
| 342 | |
| 343 void* TestGLES2Interface::MapBufferCHROMIUM(GLuint target, GLenum access) { | |
| 344 return test_context_->mapBufferCHROMIUM(target, access); | |
| 345 } | |
| 346 | |
| 347 GLboolean TestGLES2Interface::UnmapBufferCHROMIUM(GLuint target) { | |
| 348 return test_context_->unmapBufferCHROMIUM(target); | |
| 349 } | |
| 350 | |
| 351 void TestGLES2Interface::BufferData(GLenum target, | |
| 352 GLsizeiptr size, | |
| 353 const void* data, | |
| 354 GLenum usage) { | |
| 355 test_context_->bufferData(target, size, data, usage); | |
| 356 } | |
| 357 | |
| 358 void TestGLES2Interface::WaitSyncPointCHROMIUM(GLuint sync_point) { | |
| 359 test_context_->waitSyncPoint(sync_point); | |
| 360 } | |
| 361 | |
| 362 GLuint TestGLES2Interface::InsertSyncPointCHROMIUM() { | |
| 363 return test_context_->insertSyncPoint(); | |
| 364 } | |
| 365 | |
| 366 void TestGLES2Interface::BeginQueryEXT(GLenum target, GLuint id) { | |
| 367 test_context_->beginQueryEXT(target, id); | |
| 368 } | |
| 369 | |
| 370 void TestGLES2Interface::EndQueryEXT(GLenum target) { | |
| 371 test_context_->endQueryEXT(target); | |
| 372 } | |
| 373 | |
| 374 void TestGLES2Interface::GetQueryObjectuivEXT(GLuint id, | |
| 375 GLenum pname, | |
| 376 GLuint* params) { | |
| 377 test_context_->getQueryObjectuivEXT(id, pname, params); | |
| 378 } | |
| 379 | |
| 380 void TestGLES2Interface::DiscardFramebufferEXT(GLenum target, | |
| 381 GLsizei count, | |
| 382 const GLenum* attachments) { | |
| 383 test_context_->discardFramebufferEXT(target, count, attachments); | |
| 384 } | |
| 385 | |
| 386 void TestGLES2Interface::GenMailboxCHROMIUM(GLbyte* mailbox) { | |
| 387 test_context_->genMailboxCHROMIUM(mailbox); | |
| 388 } | |
| 389 | |
| 390 void TestGLES2Interface::ProduceTextureCHROMIUM(GLenum target, | |
| 391 const GLbyte* mailbox) { | |
| 392 test_context_->produceTextureCHROMIUM(target, mailbox); | |
| 393 } | |
| 394 | |
| 395 void TestGLES2Interface::ProduceTextureDirectCHROMIUM(GLuint texture, | |
| 396 GLenum target, | |
| 397 const GLbyte* mailbox) { | |
| 398 test_context_->produceTextureDirectCHROMIUM(texture, target, mailbox); | |
| 399 } | |
| 400 | |
| 401 void TestGLES2Interface::ConsumeTextureCHROMIUM(GLenum target, | |
| 402 const GLbyte* mailbox) { | |
| 403 test_context_->consumeTextureCHROMIUM(target, mailbox); | |
| 404 } | |
| 405 | |
| 406 GLuint TestGLES2Interface::CreateAndConsumeTextureCHROMIUM( | |
| 407 GLenum target, | |
| 408 const GLbyte* mailbox) { | |
| 409 return test_context_->createAndConsumeTextureCHROMIUM(target, mailbox); | |
| 410 } | |
| 411 | |
| 412 void TestGLES2Interface::ResizeCHROMIUM(GLuint width, | |
| 413 GLuint height, | |
| 414 float device_scale) { | |
| 415 test_context_->reshapeWithScaleFactor(width, height, device_scale); | |
| 416 } | |
| 417 | |
| 418 void TestGLES2Interface::LoseContextCHROMIUM(GLenum current, GLenum other) { | |
| 419 test_context_->loseContextCHROMIUM(current, other); | |
| 420 } | |
| 421 | |
| 422 } // namespace cc | |
| OLD | NEW |