OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 image_size.width(), image_size.height(), 0, | 746 image_size.width(), image_size.height(), 0, |
747 image_bytes, image); | 747 image_bytes, image); |
748 } else { | 748 } else { |
749 gl->TexSubImage2D(resource->target, 0, 0, 0, image_size.width(), | 749 gl->TexSubImage2D(resource->target, 0, 0, 0, image_size.width(), |
750 image_size.height(), GLDataFormat(resource->format), | 750 image_size.height(), GLDataFormat(resource->format), |
751 GLDataType(resource->format), image); | 751 GLDataType(resource->format), image); |
752 } | 752 } |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 void ResourceProvider::GenerateSyncTokenForResource(ResourceId resource_id) { | |
David Yen
2016/02/17 21:53:28
From piman@ (originally inside CopyToResource wher
David Yen
2016/02/17 21:54:36
Done. There are probably other places CopyToResour
| |
757 Resource* resource = GetResource(resource_id); | |
758 if (!resource->needs_sync_token()) | |
759 return; | |
760 | |
761 gpu::SyncToken sync_token; | |
762 GLES2Interface* gl = ContextGL(); | |
763 DCHECK(gl); | |
764 | |
765 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | |
766 gl->OrderingBarrierCHROMIUM(); | |
767 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | |
768 | |
769 resource->UpdateSyncToken(sync_token); | |
770 } | |
771 | |
772 void ResourceProvider::GenerateSyncTokenForResources( | |
773 const ResourceIdArray& resource_ids) { | |
774 gpu::SyncToken sync_token; | |
775 bool created_sync_token = false; | |
776 for (ResourceId id : resource_ids) { | |
777 Resource* resource = GetResource(id); | |
778 if (resource->needs_sync_token()) { | |
779 if (!created_sync_token) { | |
780 GLES2Interface* gl = ContextGL(); | |
781 DCHECK(gl); | |
782 | |
783 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | |
784 gl->OrderingBarrierCHROMIUM(); | |
785 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | |
786 created_sync_token = true; | |
787 } | |
788 | |
789 resource->UpdateSyncToken(sync_token); | |
790 } | |
791 } | |
792 } | |
793 | |
756 ResourceProvider::Resource* ResourceProvider::InsertResource( | 794 ResourceProvider::Resource* ResourceProvider::InsertResource( |
757 ResourceId id, | 795 ResourceId id, |
758 const Resource& resource) { | 796 const Resource& resource) { |
759 std::pair<ResourceMap::iterator, bool> result = | 797 std::pair<ResourceMap::iterator, bool> result = |
760 resources_.insert(ResourceMap::value_type(id, resource)); | 798 resources_.insert(ResourceMap::value_type(id, resource)); |
761 DCHECK(result.second); | 799 DCHECK(result.second); |
762 return &result.first->second; | 800 return &result.first->second; |
763 } | 801 } |
764 | 802 |
765 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { | 803 ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) { |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1856 | 1894 |
1857 const int kImportance = 2; | 1895 const int kImportance = 2; |
1858 pmd->CreateSharedGlobalAllocatorDump(guid); | 1896 pmd->CreateSharedGlobalAllocatorDump(guid); |
1859 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1897 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1860 } | 1898 } |
1861 | 1899 |
1862 return true; | 1900 return true; |
1863 } | 1901 } |
1864 | 1902 |
1865 } // namespace cc | 1903 } // namespace cc |
OLD | NEW |