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/test_web_graphics_context_3d.h" | 5 #include "cc/test/test_web_graphics_context_3d.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "cc/test/test_context_support.h" | 14 #include "cc/test/test_context_support.h" |
15 #include "gpu/GLES2/gl2extchromium.h" | 15 #include "gpu/GLES2/gl2extchromium.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/khronos/GLES2/gl2ext.h" | 17 #include "third_party/khronos/GLES2/gl2ext.h" |
18 | 18 |
19 using WebKit::WGC3Dboolean; | 19 using blink::WGC3Dboolean; |
20 using WebKit::WGC3Dchar; | 20 using blink::WGC3Dchar; |
21 using WebKit::WGC3Denum; | 21 using blink::WGC3Denum; |
22 using WebKit::WGC3Dint; | 22 using blink::WGC3Dint; |
23 using WebKit::WGC3Dsizei; | 23 using blink::WGC3Dsizei; |
24 using WebKit::WGC3Dsizeiptr; | 24 using blink::WGC3Dsizeiptr; |
25 using WebKit::WGC3Duint; | 25 using blink::WGC3Duint; |
26 using WebKit::WebGLId; | 26 using blink::WebGLId; |
27 using WebKit::WebGraphicsContext3D; | 27 using blink::WebGraphicsContext3D; |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | 30 |
31 static const WebGLId kFramebufferId = 1; | 31 static const WebGLId kFramebufferId = 1; |
32 static const WebGLId kRenderbufferId = 2; | 32 static const WebGLId kRenderbufferId = 2; |
33 | 33 |
34 static unsigned s_context_id = 1; | 34 static unsigned s_context_id = 1; |
35 | 35 |
36 const WebGLId TestWebGraphicsContext3D::kExternalTextureId = 1337; | 36 const WebGLId TestWebGraphicsContext3D::kExternalTextureId = 1337; |
37 | 37 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (context_lost_) | 132 if (context_lost_) |
133 return GL_FRAMEBUFFER_UNDEFINED_OES; | 133 return GL_FRAMEBUFFER_UNDEFINED_OES; |
134 return GL_FRAMEBUFFER_COMPLETE; | 134 return GL_FRAMEBUFFER_COMPLETE; |
135 } | 135 } |
136 | 136 |
137 WebGraphicsContext3D::Attributes | 137 WebGraphicsContext3D::Attributes |
138 TestWebGraphicsContext3D::getContextAttributes() { | 138 TestWebGraphicsContext3D::getContextAttributes() { |
139 return attributes_; | 139 return attributes_; |
140 } | 140 } |
141 | 141 |
142 WebKit::WebString TestWebGraphicsContext3D::getString(WGC3Denum name) { | 142 blink::WebString TestWebGraphicsContext3D::getString(WGC3Denum name) { |
143 return WebKit::WebString(); | 143 return blink::WebString(); |
144 } | 144 } |
145 | 145 |
146 WGC3Dint TestWebGraphicsContext3D::getUniformLocation( | 146 WGC3Dint TestWebGraphicsContext3D::getUniformLocation( |
147 WebGLId program, | 147 WebGLId program, |
148 const WGC3Dchar* name) { | 148 const WGC3Dchar* name) { |
149 return 0; | 149 return 0; |
150 } | 150 } |
151 | 151 |
152 WGC3Dsizeiptr TestWebGraphicsContext3D::getVertexAttribOffset( | 152 WGC3Dsizeiptr TestWebGraphicsContext3D::getVertexAttribOffset( |
153 WGC3Duint index, | 153 WGC3Duint index, |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 | 354 |
355 if (!texture_id) | 355 if (!texture_id) |
356 return; | 356 return; |
357 base::AutoLock lock(namespace_->lock); | 357 base::AutoLock lock(namespace_->lock); |
358 DCHECK(namespace_->textures.ContainsId(texture_id)); | 358 DCHECK(namespace_->textures.ContainsId(texture_id)); |
359 texture_targets_.BindTexture(target, texture_id); | 359 texture_targets_.BindTexture(target, texture_id); |
360 used_textures_.insert(texture_id); | 360 used_textures_.insert(texture_id); |
361 } | 361 } |
362 | 362 |
363 WebKit::WebGLId TestWebGraphicsContext3D::BoundTextureId( | 363 blink::WebGLId TestWebGraphicsContext3D::BoundTextureId( |
364 WebKit::WGC3Denum target) { | 364 blink::WGC3Denum target) { |
365 return texture_targets_.BoundTexture(target); | 365 return texture_targets_.BoundTexture(target); |
366 } | 366 } |
367 | 367 |
368 void TestWebGraphicsContext3D::endQueryEXT(WGC3Denum target) { | 368 void TestWebGraphicsContext3D::endQueryEXT(WGC3Denum target) { |
369 if (times_end_query_succeeds_ >= 0) { | 369 if (times_end_query_succeeds_ >= 0) { |
370 if (!times_end_query_succeeds_) { | 370 if (!times_end_query_succeeds_) { |
371 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 371 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
372 GL_INNOCENT_CONTEXT_RESET_ARB); | 372 GL_INNOCENT_CONTEXT_RESET_ARB); |
373 } | 373 } |
374 --times_end_query_succeeds_; | 374 --times_end_query_succeeds_; |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 void TestWebGraphicsContext3D::getQueryObjectuivEXT( | 378 void TestWebGraphicsContext3D::getQueryObjectuivEXT( |
379 WebGLId query, | 379 WebGLId query, |
380 WGC3Denum pname, | 380 WGC3Denum pname, |
381 WGC3Duint* params) { | 381 WGC3Duint* params) { |
382 // If the context is lost, behave as if result is available. | 382 // If the context is lost, behave as if result is available. |
383 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) | 383 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) |
384 *params = 1; | 384 *params = 1; |
385 } | 385 } |
386 | 386 |
387 void TestWebGraphicsContext3D::getIntegerv( | 387 void TestWebGraphicsContext3D::getIntegerv( |
388 WGC3Denum pname, | 388 WGC3Denum pname, |
389 WebKit::WGC3Dint* value) { | 389 blink::WGC3Dint* value) { |
390 if (pname == GL_MAX_TEXTURE_SIZE) | 390 if (pname == GL_MAX_TEXTURE_SIZE) |
391 *value = max_texture_size_; | 391 *value = max_texture_size_; |
392 else if (pname == GL_ACTIVE_TEXTURE) | 392 else if (pname == GL_ACTIVE_TEXTURE) |
393 *value = GL_TEXTURE0; | 393 *value = GL_TEXTURE0; |
394 } | 394 } |
395 | 395 |
396 void TestWebGraphicsContext3D::genMailboxCHROMIUM(WebKit::WGC3Dbyte* mailbox) { | 396 void TestWebGraphicsContext3D::genMailboxCHROMIUM(blink::WGC3Dbyte* mailbox) { |
397 if (times_gen_mailbox_succeeds_ >= 0) { | 397 if (times_gen_mailbox_succeeds_ >= 0) { |
398 if (!times_gen_mailbox_succeeds_) { | 398 if (!times_gen_mailbox_succeeds_) { |
399 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 399 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
400 GL_INNOCENT_CONTEXT_RESET_ARB); | 400 GL_INNOCENT_CONTEXT_RESET_ARB); |
401 } | 401 } |
402 --times_gen_mailbox_succeeds_; | 402 --times_gen_mailbox_succeeds_; |
403 } | 403 } |
404 if (context_lost_) { | 404 if (context_lost_) { |
405 memset(mailbox, 0, 64); | 405 memset(mailbox, 0, 64); |
406 return; | 406 return; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 void TestWebGraphicsContext3D::flush() { | 467 void TestWebGraphicsContext3D::flush() { |
468 test_support_->CallAllSyncPointCallbacks(); | 468 test_support_->CallAllSyncPointCallbacks(); |
469 } | 469 } |
470 | 470 |
471 void TestWebGraphicsContext3D::SwapBuffersComplete() { | 471 void TestWebGraphicsContext3D::SwapBuffersComplete() { |
472 if (swap_buffers_callback_) | 472 if (swap_buffers_callback_) |
473 swap_buffers_callback_->onSwapBuffersComplete(); | 473 swap_buffers_callback_->onSwapBuffersComplete(); |
474 } | 474 } |
475 | 475 |
476 void TestWebGraphicsContext3D::bindBuffer(WebKit::WGC3Denum target, | 476 void TestWebGraphicsContext3D::bindBuffer(blink::WGC3Denum target, |
477 WebKit::WebGLId buffer) { | 477 blink::WebGLId buffer) { |
478 bound_buffer_ = buffer; | 478 bound_buffer_ = buffer; |
479 if (!bound_buffer_) | 479 if (!bound_buffer_) |
480 return; | 480 return; |
481 unsigned context_id = buffer >> 16; | 481 unsigned context_id = buffer >> 16; |
482 unsigned buffer_id = buffer & 0xffff; | 482 unsigned buffer_id = buffer & 0xffff; |
483 base::AutoLock lock(namespace_->lock); | 483 base::AutoLock lock(namespace_->lock); |
484 DCHECK(buffer_id); | 484 DCHECK(buffer_id); |
485 DCHECK_LT(buffer_id, namespace_->next_buffer_id); | 485 DCHECK_LT(buffer_id, namespace_->next_buffer_id); |
486 DCHECK_EQ(context_id, context_id_); | 486 DCHECK_EQ(context_id, context_id_); |
487 | 487 |
488 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 488 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
489 if (buffers.count(bound_buffer_) == 0) | 489 if (buffers.count(bound_buffer_) == 0) |
490 buffers.set(bound_buffer_, make_scoped_ptr(new Buffer).Pass()); | 490 buffers.set(bound_buffer_, make_scoped_ptr(new Buffer).Pass()); |
491 | 491 |
492 buffers.get(bound_buffer_)->target = target; | 492 buffers.get(bound_buffer_)->target = target; |
493 } | 493 } |
494 | 494 |
495 void TestWebGraphicsContext3D::bufferData(WebKit::WGC3Denum target, | 495 void TestWebGraphicsContext3D::bufferData(blink::WGC3Denum target, |
496 WebKit::WGC3Dsizeiptr size, | 496 blink::WGC3Dsizeiptr size, |
497 const void* data, | 497 const void* data, |
498 WebKit::WGC3Denum usage) { | 498 blink::WGC3Denum usage) { |
499 base::AutoLock lock(namespace_->lock); | 499 base::AutoLock lock(namespace_->lock); |
500 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 500 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
501 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 501 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
502 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 502 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
503 Buffer* buffer = buffers.get(bound_buffer_); | 503 Buffer* buffer = buffers.get(bound_buffer_); |
504 if (context_lost_) { | 504 if (context_lost_) { |
505 buffer->pixels.reset(); | 505 buffer->pixels.reset(); |
506 return; | 506 return; |
507 } | 507 } |
508 | 508 |
509 buffer->pixels.reset(new uint8[size]); | 509 buffer->pixels.reset(new uint8[size]); |
510 buffer->size = size; | 510 buffer->size = size; |
511 if (data != NULL) | 511 if (data != NULL) |
512 memcpy(buffer->pixels.get(), data, size); | 512 memcpy(buffer->pixels.get(), data, size); |
513 } | 513 } |
514 | 514 |
515 void* TestWebGraphicsContext3D::mapBufferCHROMIUM(WebKit::WGC3Denum target, | 515 void* TestWebGraphicsContext3D::mapBufferCHROMIUM(blink::WGC3Denum target, |
516 WebKit::WGC3Denum access) { | 516 blink::WGC3Denum access) { |
517 base::AutoLock lock(namespace_->lock); | 517 base::AutoLock lock(namespace_->lock); |
518 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 518 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
519 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 519 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
520 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 520 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
521 if (times_map_buffer_chromium_succeeds_ >= 0) { | 521 if (times_map_buffer_chromium_succeeds_ >= 0) { |
522 if (!times_map_buffer_chromium_succeeds_) { | 522 if (!times_map_buffer_chromium_succeeds_) { |
523 return NULL; | 523 return NULL; |
524 } | 524 } |
525 --times_map_buffer_chromium_succeeds_; | 525 --times_map_buffer_chromium_succeeds_; |
526 } | 526 } |
527 return buffers.get(bound_buffer_)->pixels.get(); | 527 return buffers.get(bound_buffer_)->pixels.get(); |
528 } | 528 } |
529 | 529 |
530 WebKit::WGC3Dboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( | 530 blink::WGC3Dboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( |
531 WebKit::WGC3Denum target) { | 531 blink::WGC3Denum target) { |
532 base::AutoLock lock(namespace_->lock); | 532 base::AutoLock lock(namespace_->lock); |
533 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 533 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
534 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 534 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
535 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 535 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
536 buffers.get(bound_buffer_)->pixels.reset(); | 536 buffers.get(bound_buffer_)->pixels.reset(); |
537 return true; | 537 return true; |
538 } | 538 } |
539 | 539 |
540 WebKit::WGC3Duint TestWebGraphicsContext3D::createImageCHROMIUM( | 540 blink::WGC3Duint TestWebGraphicsContext3D::createImageCHROMIUM( |
541 WebKit::WGC3Dsizei width, WebKit::WGC3Dsizei height, | 541 blink::WGC3Dsizei width, blink::WGC3Dsizei height, |
542 WebKit::WGC3Denum internalformat) { | 542 blink::WGC3Denum internalformat) { |
543 DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); | 543 DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); |
544 WebKit::WGC3Duint image_id = NextImageId(); | 544 blink::WGC3Duint image_id = NextImageId(); |
545 base::AutoLock lock(namespace_->lock); | 545 base::AutoLock lock(namespace_->lock); |
546 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; | 546 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; |
547 images.set(image_id, make_scoped_ptr(new Image).Pass()); | 547 images.set(image_id, make_scoped_ptr(new Image).Pass()); |
548 images.get(image_id)->pixels.reset(new uint8[width * height * 4]); | 548 images.get(image_id)->pixels.reset(new uint8[width * height * 4]); |
549 return image_id; | 549 return image_id; |
550 } | 550 } |
551 | 551 |
552 void TestWebGraphicsContext3D::destroyImageCHROMIUM( | 552 void TestWebGraphicsContext3D::destroyImageCHROMIUM( |
553 WebKit::WGC3Duint id) { | 553 blink::WGC3Duint id) { |
554 RetireImageId(id); | 554 RetireImageId(id); |
555 } | 555 } |
556 | 556 |
557 void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( | 557 void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( |
558 WebKit::WGC3Duint image_id, | 558 blink::WGC3Duint image_id, |
559 WebKit::WGC3Denum pname, | 559 blink::WGC3Denum pname, |
560 WebKit::WGC3Dint* params) { | 560 blink::WGC3Dint* params) { |
561 base::AutoLock lock(namespace_->lock); | 561 base::AutoLock lock(namespace_->lock); |
562 DCHECK_GT(namespace_->images.count(image_id), 0u); | 562 DCHECK_GT(namespace_->images.count(image_id), 0u); |
563 DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname)); | 563 DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname)); |
564 *params = 0; | 564 *params = 0; |
565 } | 565 } |
566 | 566 |
567 void* TestWebGraphicsContext3D::mapImageCHROMIUM(WebKit::WGC3Duint image_id, | 567 void* TestWebGraphicsContext3D::mapImageCHROMIUM(blink::WGC3Duint image_id, |
568 WebKit::WGC3Denum access) { | 568 blink::WGC3Denum access) { |
569 base::AutoLock lock(namespace_->lock); | 569 base::AutoLock lock(namespace_->lock); |
570 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; | 570 base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; |
571 DCHECK_GT(images.count(image_id), 0u); | 571 DCHECK_GT(images.count(image_id), 0u); |
572 if (times_map_image_chromium_succeeds_ >= 0) { | 572 if (times_map_image_chromium_succeeds_ >= 0) { |
573 if (!times_map_image_chromium_succeeds_) { | 573 if (!times_map_image_chromium_succeeds_) { |
574 return NULL; | 574 return NULL; |
575 } | 575 } |
576 --times_map_image_chromium_succeeds_; | 576 --times_map_image_chromium_succeeds_; |
577 } | 577 } |
578 return images.get(image_id)->pixels.get(); | 578 return images.get(image_id)->pixels.get(); |
579 } | 579 } |
580 | 580 |
581 void TestWebGraphicsContext3D::unmapImageCHROMIUM( | 581 void TestWebGraphicsContext3D::unmapImageCHROMIUM( |
582 WebKit::WGC3Duint image_id) { | 582 blink::WGC3Duint image_id) { |
583 base::AutoLock lock(namespace_->lock); | 583 base::AutoLock lock(namespace_->lock); |
584 DCHECK_GT(namespace_->images.count(image_id), 0u); | 584 DCHECK_GT(namespace_->images.count(image_id), 0u); |
585 } | 585 } |
586 | 586 |
587 size_t TestWebGraphicsContext3D::NumTextures() const { | 587 size_t TestWebGraphicsContext3D::NumTextures() const { |
588 base::AutoLock lock(namespace_->lock); | 588 base::AutoLock lock(namespace_->lock); |
589 return namespace_->textures.Size(); | 589 return namespace_->textures.Size(); |
590 } | 590 } |
591 | 591 |
592 WebKit::WebGLId TestWebGraphicsContext3D::TextureAt(int i) const { | 592 blink::WebGLId TestWebGraphicsContext3D::TextureAt(int i) const { |
593 base::AutoLock lock(namespace_->lock); | 593 base::AutoLock lock(namespace_->lock); |
594 return namespace_->textures.IdAt(i); | 594 return namespace_->textures.IdAt(i); |
595 } | 595 } |
596 | 596 |
597 WebGLId TestWebGraphicsContext3D::NextTextureId() { | 597 WebGLId TestWebGraphicsContext3D::NextTextureId() { |
598 base::AutoLock lock(namespace_->lock); | 598 base::AutoLock lock(namespace_->lock); |
599 WebGLId texture_id = namespace_->next_texture_id++; | 599 WebGLId texture_id = namespace_->next_texture_id++; |
600 DCHECK(texture_id < (1 << 16)); | 600 DCHECK(texture_id < (1 << 16)); |
601 texture_id |= context_id_ << 16; | 601 texture_id |= context_id_ << 16; |
602 return texture_id; | 602 return texture_id; |
(...skipping 18 matching lines...) Expand all Loading... |
621 | 621 |
622 void TestWebGraphicsContext3D::RetireBufferId(WebGLId id) { | 622 void TestWebGraphicsContext3D::RetireBufferId(WebGLId id) { |
623 base::AutoLock lock(namespace_->lock); | 623 base::AutoLock lock(namespace_->lock); |
624 unsigned context_id = id >> 16; | 624 unsigned context_id = id >> 16; |
625 unsigned buffer_id = id & 0xffff; | 625 unsigned buffer_id = id & 0xffff; |
626 DCHECK(buffer_id); | 626 DCHECK(buffer_id); |
627 DCHECK_LT(buffer_id, namespace_->next_buffer_id); | 627 DCHECK_LT(buffer_id, namespace_->next_buffer_id); |
628 DCHECK_EQ(context_id, context_id_); | 628 DCHECK_EQ(context_id, context_id_); |
629 } | 629 } |
630 | 630 |
631 WebKit::WGC3Duint TestWebGraphicsContext3D::NextImageId() { | 631 blink::WGC3Duint TestWebGraphicsContext3D::NextImageId() { |
632 base::AutoLock lock(namespace_->lock); | 632 base::AutoLock lock(namespace_->lock); |
633 WGC3Duint image_id = namespace_->next_image_id++; | 633 WGC3Duint image_id = namespace_->next_image_id++; |
634 DCHECK(image_id < (1 << 16)); | 634 DCHECK(image_id < (1 << 16)); |
635 image_id |= context_id_ << 16; | 635 image_id |= context_id_ << 16; |
636 return image_id; | 636 return image_id; |
637 } | 637 } |
638 | 638 |
639 void TestWebGraphicsContext3D::RetireImageId(WebGLId id) { | 639 void TestWebGraphicsContext3D::RetireImageId(WebGLId id) { |
640 base::AutoLock lock(namespace_->lock); | 640 base::AutoLock lock(namespace_->lock); |
641 unsigned context_id = id >> 16; | 641 unsigned context_id = id >> 16; |
(...skipping 24 matching lines...) Expand all Loading... |
666 TestWebGraphicsContext3D::TextureTargets::TextureTargets() { | 666 TestWebGraphicsContext3D::TextureTargets::TextureTargets() { |
667 // Initialize default bindings. | 667 // Initialize default bindings. |
668 bound_textures_[GL_TEXTURE_2D] = 0; | 668 bound_textures_[GL_TEXTURE_2D] = 0; |
669 bound_textures_[GL_TEXTURE_EXTERNAL_OES] = 0; | 669 bound_textures_[GL_TEXTURE_EXTERNAL_OES] = 0; |
670 bound_textures_[GL_TEXTURE_RECTANGLE_ARB] = 0; | 670 bound_textures_[GL_TEXTURE_RECTANGLE_ARB] = 0; |
671 } | 671 } |
672 | 672 |
673 TestWebGraphicsContext3D::TextureTargets::~TextureTargets() {} | 673 TestWebGraphicsContext3D::TextureTargets::~TextureTargets() {} |
674 | 674 |
675 void TestWebGraphicsContext3D::TextureTargets::BindTexture( | 675 void TestWebGraphicsContext3D::TextureTargets::BindTexture( |
676 WebKit::WGC3Denum target, | 676 blink::WGC3Denum target, |
677 WebKit::WebGLId id) { | 677 blink::WebGLId id) { |
678 // Make sure this is a supported target by seeing if it was bound to before. | 678 // Make sure this is a supported target by seeing if it was bound to before. |
679 DCHECK(bound_textures_.find(target) != bound_textures_.end()); | 679 DCHECK(bound_textures_.find(target) != bound_textures_.end()); |
680 bound_textures_[target] = id; | 680 bound_textures_[target] = id; |
681 } | 681 } |
682 | 682 |
683 void TestWebGraphicsContext3D::TextureTargets::UnbindTexture( | 683 void TestWebGraphicsContext3D::TextureTargets::UnbindTexture( |
684 WebKit::WebGLId id) { | 684 blink::WebGLId id) { |
685 // Bind zero to any targets that the id is bound to. | 685 // Bind zero to any targets that the id is bound to. |
686 for (TargetTextureMap::iterator it = bound_textures_.begin(); | 686 for (TargetTextureMap::iterator it = bound_textures_.begin(); |
687 it != bound_textures_.end(); | 687 it != bound_textures_.end(); |
688 it++) { | 688 it++) { |
689 if (it->second == id) | 689 if (it->second == id) |
690 it->second = 0; | 690 it->second = 0; |
691 } | 691 } |
692 } | 692 } |
693 | 693 |
694 WebKit::WebGLId TestWebGraphicsContext3D::TextureTargets::BoundTexture( | 694 blink::WebGLId TestWebGraphicsContext3D::TextureTargets::BoundTexture( |
695 WebKit::WGC3Denum target) { | 695 blink::WGC3Denum target) { |
696 DCHECK(bound_textures_.find(target) != bound_textures_.end()); | 696 DCHECK(bound_textures_.find(target) != bound_textures_.end()); |
697 return bound_textures_[target]; | 697 return bound_textures_[target]; |
698 } | 698 } |
699 | 699 |
700 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 700 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
701 | 701 |
702 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 702 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
703 | 703 |
704 TestWebGraphicsContext3D::Image::Image() {} | 704 TestWebGraphicsContext3D::Image::Image() {} |
705 | 705 |
706 TestWebGraphicsContext3D::Image::~Image() {} | 706 TestWebGraphicsContext3D::Image::~Image() {} |
707 | 707 |
708 } // namespace cc | 708 } // namespace cc |
OLD | NEW |