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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 602 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
603 DCHECK_EQ(target, buffers[bound_buffer_]->target); | 603 DCHECK_EQ(target, buffers[bound_buffer_]->target); |
604 buffers[bound_buffer_]->pixels = nullptr; | 604 buffers[bound_buffer_]->pixels = nullptr; |
605 return true; | 605 return true; |
606 } | 606 } |
607 | 607 |
608 GLuint TestWebGraphicsContext3D::createImageCHROMIUM(ClientBuffer buffer, | 608 GLuint TestWebGraphicsContext3D::createImageCHROMIUM(ClientBuffer buffer, |
609 GLsizei width, | 609 GLsizei width, |
610 GLsizei height, | 610 GLsizei height, |
611 GLenum internalformat) { | 611 GLenum internalformat) { |
612 DCHECK_EQ(GL_RGBA, static_cast<int>(internalformat)); | 612 DCHECK(internalformat == GL_RGB || internalformat == GL_RGBA); |
613 GLuint image_id = NextImageId(); | 613 GLuint image_id = NextImageId(); |
614 base::AutoLock lock(namespace_->lock); | 614 base::AutoLock lock(namespace_->lock); |
615 std::unordered_set<unsigned>& images = namespace_->images; | 615 std::unordered_set<unsigned>& images = namespace_->images; |
616 images.insert(image_id); | 616 images.insert(image_id); |
617 return image_id; | 617 return image_id; |
618 } | 618 } |
619 | 619 |
620 void TestWebGraphicsContext3D::destroyImageCHROMIUM( | 620 void TestWebGraphicsContext3D::destroyImageCHROMIUM( |
621 GLuint id) { | 621 GLuint id) { |
622 RetireImageId(id); | 622 RetireImageId(id); |
623 base::AutoLock lock(namespace_->lock); | 623 base::AutoLock lock(namespace_->lock); |
624 std::unordered_set<unsigned>& images = namespace_->images; | 624 std::unordered_set<unsigned>& images = namespace_->images; |
625 if (!images.count(id)) | 625 if (!images.count(id)) |
626 ADD_FAILURE() << "destroyImageCHROMIUM called on unknown image " << id; | 626 ADD_FAILURE() << "destroyImageCHROMIUM called on unknown image " << id; |
627 images.erase(id); | 627 images.erase(id); |
628 } | 628 } |
629 | 629 |
630 GLuint TestWebGraphicsContext3D::createGpuMemoryBufferImageCHROMIUM( | 630 GLuint TestWebGraphicsContext3D::createGpuMemoryBufferImageCHROMIUM( |
631 GLsizei width, | 631 GLsizei width, |
632 GLsizei height, | 632 GLsizei height, |
633 GLenum internalformat, | 633 GLenum internalformat, |
634 GLenum usage) { | 634 GLenum usage) { |
635 DCHECK_EQ(GL_RGBA, static_cast<int>(internalformat)); | 635 DCHECK(internalformat == GL_RGB || internalformat == GL_RGBA); |
636 GLuint image_id = NextImageId(); | 636 GLuint image_id = NextImageId(); |
637 base::AutoLock lock(namespace_->lock); | 637 base::AutoLock lock(namespace_->lock); |
638 std::unordered_set<unsigned>& images = namespace_->images; | 638 std::unordered_set<unsigned>& images = namespace_->images; |
639 images.insert(image_id); | 639 images.insert(image_id); |
640 return image_id; | 640 return image_id; |
641 } | 641 } |
642 | 642 |
643 GLuint64 TestWebGraphicsContext3D::insertFenceSync() { | 643 GLuint64 TestWebGraphicsContext3D::insertFenceSync() { |
644 return next_insert_fence_sync_++; | 644 return next_insert_fence_sync_++; |
645 } | 645 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 826 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
827 | 827 |
828 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 828 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
829 | 829 |
830 TestWebGraphicsContext3D::Image::Image() {} | 830 TestWebGraphicsContext3D::Image::Image() {} |
831 | 831 |
832 TestWebGraphicsContext3D::Image::~Image() {} | 832 TestWebGraphicsContext3D::Image::~Image() {} |
833 | 833 |
834 } // namespace cc | 834 } // namespace cc |
OLD | NEW |