| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/blink/webgraphicscontext3d_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 return blink::WebString::fromUTF8( | 362 return blink::WebString::fromUTF8( |
| 363 reinterpret_cast<const char*>(gl_->GetString(name))); | 363 reinterpret_cast<const char*>(gl_->GetString(name))); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void WebGraphicsContext3DImpl::shaderSource( | 366 void WebGraphicsContext3DImpl::shaderSource( |
| 367 WebGLId shader, const WGC3Dchar* string) { | 367 WebGLId shader, const WGC3Dchar* string) { |
| 368 GLint length = strlen(string); | 368 GLint length = strlen(string); |
| 369 gl_->ShaderSource(shader, 1, &string, &length); | 369 gl_->ShaderSource(shader, 1, &string, &length); |
| 370 } | 370 } |
| 371 | 371 |
| 372 WebGLId WebGraphicsContext3DImpl::createBuffer() { | |
| 373 GLuint o; | |
| 374 gl_->GenBuffers(1, &o); | |
| 375 return o; | |
| 376 } | |
| 377 | |
| 378 WebGLId WebGraphicsContext3DImpl::createFramebuffer() { | |
| 379 GLuint o = 0; | |
| 380 gl_->GenFramebuffers(1, &o); | |
| 381 return o; | |
| 382 } | |
| 383 | |
| 384 WebGLId WebGraphicsContext3DImpl::createRenderbuffer() { | |
| 385 GLuint o; | |
| 386 gl_->GenRenderbuffers(1, &o); | |
| 387 return o; | |
| 388 } | |
| 389 | |
| 390 WebGLId WebGraphicsContext3DImpl::createTexture() { | |
| 391 GLuint o; | |
| 392 gl_->GenTextures(1, &o); | |
| 393 return o; | |
| 394 } | |
| 395 | |
| 396 void WebGraphicsContext3DImpl::deleteBuffer(WebGLId buffer) { | |
| 397 gl_->DeleteBuffers(1, &buffer); | |
| 398 } | |
| 399 | |
| 400 void WebGraphicsContext3DImpl::deleteFramebuffer( | |
| 401 WebGLId framebuffer) { | |
| 402 gl_->DeleteFramebuffers(1, &framebuffer); | |
| 403 } | |
| 404 | |
| 405 void WebGraphicsContext3DImpl::deleteRenderbuffer( | |
| 406 WebGLId renderbuffer) { | |
| 407 gl_->DeleteRenderbuffers(1, &renderbuffer); | |
| 408 } | |
| 409 | |
| 410 void WebGraphicsContext3DImpl::deleteTexture(WebGLId texture) { | |
| 411 gl_->DeleteTextures(1, &texture); | |
| 412 } | |
| 413 | |
| 414 void WebGraphicsContext3DImpl::setErrorMessageCallback( | 372 void WebGraphicsContext3DImpl::setErrorMessageCallback( |
| 415 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) { | 373 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* cb) { |
| 416 error_message_callback_ = cb; | 374 error_message_callback_ = cb; |
| 417 } | 375 } |
| 418 | 376 |
| 419 void WebGraphicsContext3DImpl::setContextLostCallback( | 377 void WebGraphicsContext3DImpl::setContextLostCallback( |
| 420 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { | 378 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) { |
| 421 context_lost_callback_ = cb; | 379 context_lost_callback_ = cb; |
| 422 } | 380 } |
| 423 | 381 |
| 424 WebGLId WebGraphicsContext3DImpl::createQueryEXT() { | |
| 425 GLuint o; | |
| 426 gl_->GenQueriesEXT(1, &o); | |
| 427 return o; | |
| 428 } | |
| 429 | |
| 430 void WebGraphicsContext3DImpl::deleteQueryEXT( | |
| 431 WebGLId query) { | |
| 432 gl_->DeleteQueriesEXT(1, &query); | |
| 433 } | |
| 434 | |
| 435 WebGLId WebGraphicsContext3DImpl::createValuebufferCHROMIUM() { | |
| 436 GLuint o; | |
| 437 gl_->GenValuebuffersCHROMIUM(1, &o); | |
| 438 return o; | |
| 439 } | |
| 440 | |
| 441 void WebGraphicsContext3DImpl::deleteValuebufferCHROMIUM(WebGLId valuebuffer) { | |
| 442 gl_->DeleteValuebuffersCHROMIUM(1, &valuebuffer); | |
| 443 } | |
| 444 | |
| 445 void WebGraphicsContext3DImpl::pushGroupMarkerEXT( | 382 void WebGraphicsContext3DImpl::pushGroupMarkerEXT( |
| 446 const WGC3Dchar* marker) { | 383 const WGC3Dchar* marker) { |
| 447 gl_->PushGroupMarkerEXT(0, marker); | 384 gl_->PushGroupMarkerEXT(0, marker); |
| 448 } | 385 } |
| 449 | 386 |
| 450 WebGLId WebGraphicsContext3DImpl::createVertexArrayOES() { | |
| 451 GLuint array; | |
| 452 gl_->GenVertexArraysOES(1, &array); | |
| 453 return array; | |
| 454 } | |
| 455 | |
| 456 void WebGraphicsContext3DImpl::deleteVertexArrayOES( | |
| 457 WebGLId array) { | |
| 458 gl_->DeleteVertexArraysOES(1, &array); | |
| 459 } | |
| 460 | |
| 461 DELEGATE_TO_GL_1(beginTransformFeedback, BeginTransformFeedback, WGC3Denum) | 387 DELEGATE_TO_GL_1(beginTransformFeedback, BeginTransformFeedback, WGC3Denum) |
| 462 DELEGATE_TO_GL_3(bindBufferBase, BindBufferBase, WGC3Denum, WGC3Duint, | 388 DELEGATE_TO_GL_3(bindBufferBase, BindBufferBase, WGC3Denum, WGC3Duint, |
| 463 WGC3Duint) | 389 WGC3Duint) |
| 464 DELEGATE_TO_GL_5(bindBufferRange, BindBufferRange, WGC3Denum, WGC3Duint, | 390 DELEGATE_TO_GL_5(bindBufferRange, BindBufferRange, WGC3Denum, WGC3Duint, |
| 465 WGC3Duint, WGC3Dintptr, WGC3Dsizeiptr) | 391 WGC3Duint, WGC3Dintptr, WGC3Dsizeiptr) |
| 466 DELEGATE_TO_GL_2(bindSampler, BindSampler, WGC3Duint, WebGLId) | 392 DELEGATE_TO_GL_2(bindSampler, BindSampler, WGC3Duint, WebGLId) |
| 467 DELEGATE_TO_GL_2(bindTransformFeedback, BindTransformFeedback, WGC3Denum, | 393 DELEGATE_TO_GL_2(bindTransformFeedback, BindTransformFeedback, WGC3Denum, |
| 468 WebGLId) | 394 WebGLId) |
| 469 DELEGATE_TO_GL_4(clearBufferfi, ClearBufferfi, WGC3Denum, WGC3Dint, WGC3Dfloat, | 395 DELEGATE_TO_GL_4(clearBufferfi, ClearBufferfi, WGC3Denum, WGC3Dint, WGC3Dfloat, |
| 470 WGC3Dint) | 396 WGC3Dint) |
| 471 DELEGATE_TO_GL_3(clearBufferfv, ClearBufferfv, WGC3Denum, WGC3Dint, | 397 DELEGATE_TO_GL_3(clearBufferfv, ClearBufferfv, WGC3Denum, WGC3Dint, |
| 472 const WGC3Dfloat *) | 398 const WGC3Dfloat *) |
| 473 DELEGATE_TO_GL_3(clearBufferiv, ClearBufferiv, WGC3Denum, WGC3Dint, | 399 DELEGATE_TO_GL_3(clearBufferiv, ClearBufferiv, WGC3Denum, WGC3Dint, |
| 474 const WGC3Dint *) | 400 const WGC3Dint *) |
| 475 DELEGATE_TO_GL_3(clearBufferuiv, ClearBufferuiv, WGC3Denum, WGC3Dint, | 401 DELEGATE_TO_GL_3(clearBufferuiv, ClearBufferuiv, WGC3Denum, WGC3Dint, |
| 476 const WGC3Duint *) | 402 const WGC3Duint *) |
| 477 DELEGATE_TO_GL_9(compressedTexImage3D, CompressedTexImage3D, WGC3Denum, | 403 DELEGATE_TO_GL_9(compressedTexImage3D, CompressedTexImage3D, WGC3Denum, |
| 478 WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, WGC3Dsizei, | 404 WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, WGC3Dsizei, |
| 479 WGC3Dint, WGC3Dsizei, const void *) | 405 WGC3Dint, WGC3Dsizei, const void *) |
| 480 DELEGATE_TO_GL_11(compressedTexSubImage3D, CompressedTexSubImage3D, WGC3Denum, | 406 DELEGATE_TO_GL_11(compressedTexSubImage3D, CompressedTexSubImage3D, WGC3Denum, |
| 481 WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, | 407 WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, |
| 482 WGC3Dsizei, WGC3Dsizei, WGC3Denum, WGC3Dsizei, const void *) | 408 WGC3Dsizei, WGC3Dsizei, WGC3Denum, WGC3Dsizei, const void *) |
| 483 DELEGATE_TO_GL_5(copyBufferSubData, CopyBufferSubData, WGC3Denum, WGC3Denum, | 409 DELEGATE_TO_GL_5(copyBufferSubData, CopyBufferSubData, WGC3Denum, WGC3Denum, |
| 484 WGC3Dintptr, WGC3Dintptr, WGC3Dsizeiptr) | 410 WGC3Dintptr, WGC3Dintptr, WGC3Dsizeiptr) |
| 485 DELEGATE_TO_GL_9(copyTexSubImage3D, CopyTexSubImage3D, WGC3Denum, WGC3Dint, | 411 DELEGATE_TO_GL_9(copyTexSubImage3D, CopyTexSubImage3D, WGC3Denum, WGC3Dint, |
| 486 WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, | 412 WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, |
| 487 WGC3Dsizei) | 413 WGC3Dsizei) |
| 488 WebGLId WebGraphicsContext3DImpl::createSampler() { | |
| 489 GLuint sampler; | |
| 490 gl_->GenSamplers(1, &sampler); | |
| 491 return sampler; | |
| 492 } | |
| 493 WebGLId WebGraphicsContext3DImpl::createTransformFeedback() { | |
| 494 GLuint tf; | |
| 495 gl_->GenTransformFeedbacks(1, &tf); | |
| 496 return tf; | |
| 497 } | |
| 498 void WebGraphicsContext3DImpl::deleteSampler(WebGLId sampler) { | |
| 499 gl_->DeleteSamplers(1, &sampler); | |
| 500 } | |
| 501 void WebGraphicsContext3DImpl::deleteTransformFeedback(WebGLId tf) { | |
| 502 gl_->DeleteTransformFeedbacks(1, &tf); | |
| 503 } | |
| 504 DELEGATE_TO_GL(endTransformFeedback, EndTransformFeedback) | 414 DELEGATE_TO_GL(endTransformFeedback, EndTransformFeedback) |
| 505 DELEGATE_TO_GL_5(getActiveUniformBlockName, GetActiveUniformBlockName, | 415 DELEGATE_TO_GL_5(getActiveUniformBlockName, GetActiveUniformBlockName, |
| 506 WGC3Duint, WGC3Duint, WGC3Dsizei, WGC3Dsizei *, WGC3Dchar *) | 416 WGC3Duint, WGC3Duint, WGC3Dsizei, WGC3Dsizei *, WGC3Dchar *) |
| 507 DELEGATE_TO_GL_4(getActiveUniformBlockiv, GetActiveUniformBlockiv, WGC3Duint, | 417 DELEGATE_TO_GL_4(getActiveUniformBlockiv, GetActiveUniformBlockiv, WGC3Duint, |
| 508 WGC3Duint, WGC3Denum, WGC3Dint *) | 418 WGC3Duint, WGC3Denum, WGC3Dint *) |
| 509 DELEGATE_TO_GL_5(getActiveUniformsiv, GetActiveUniformsiv, WGC3Duint, | 419 DELEGATE_TO_GL_5(getActiveUniformsiv, GetActiveUniformsiv, WGC3Duint, |
| 510 WGC3Dsizei, const WGC3Duint *, WGC3Denum, WGC3Dint *) | 420 WGC3Dsizei, const WGC3Duint *, WGC3Denum, WGC3Dint *) |
| 511 DELEGATE_TO_GL_2R(getFragDataLocation, GetFragDataLocation, WGC3Duint, | 421 DELEGATE_TO_GL_2R(getFragDataLocation, GetFragDataLocation, WGC3Duint, |
| 512 const WGC3Dchar *, WGC3Dint) | 422 const WGC3Dchar *, WGC3Dint) |
| 513 DELEGATE_TO_GL_5(getInternalformativ, GetInternalformativ, WGC3Denum, WGC3Denum, | 423 DELEGATE_TO_GL_5(getInternalformativ, GetInternalformativ, WGC3Denum, WGC3Denum, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; | 520 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 611 break; | 521 break; |
| 612 default: | 522 default: |
| 613 NOTREACHED(); | 523 NOTREACHED(); |
| 614 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; | 524 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; |
| 615 break; | 525 break; |
| 616 } | 526 } |
| 617 } | 527 } |
| 618 | 528 |
| 619 } // namespace gpu_blink | 529 } // namespace gpu_blink |
| OLD | NEW |