Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: cc/resources/resource_provider.cc

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 15 matching lines...) Expand all
26 #include "gpu/GLES2/gl2extchromium.h" 26 #include "gpu/GLES2/gl2extchromium.h"
27 #include "gpu/command_buffer/client/gles2_interface.h" 27 #include "gpu/command_buffer/client/gles2_interface.h"
28 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 28 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
29 #include "third_party/khronos/GLES2/gl2.h" 29 #include "third_party/khronos/GLES2/gl2.h"
30 #include "third_party/khronos/GLES2/gl2ext.h" 30 #include "third_party/khronos/GLES2/gl2ext.h"
31 #include "third_party/skia/include/core/SkSurface.h" 31 #include "third_party/skia/include/core/SkSurface.h"
32 #include "third_party/skia/include/gpu/GrContext.h" 32 #include "third_party/skia/include/gpu/GrContext.h"
33 #include "third_party/skia/include/gpu/GrTextureProvider.h" 33 #include "third_party/skia/include/gpu/GrTextureProvider.h"
34 #include "ui/gfx/geometry/rect.h" 34 #include "ui/gfx/geometry/rect.h"
35 #include "ui/gfx/geometry/vector2d.h" 35 #include "ui/gfx/geometry/vector2d.h"
36 #include "ui/gfx/gpu_memory_buffer.h"
37 #include "ui/gl/trace_util.h" 36 #include "ui/gl/trace_util.h"
38 37
39 using gpu::gles2::GLES2Interface; 38 using gpu::gles2::GLES2Interface;
40 39
41 namespace cc { 40 namespace cc {
42 41
43 class IdAllocator { 42 class IdAllocator {
44 public: 43 public:
45 virtual ~IdAllocator() {} 44 virtual ~IdAllocator() {}
46 45
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return kBGRA_8888_GrPixelConfig; 110 return kBGRA_8888_GrPixelConfig;
112 case RGBA_4444: 111 case RGBA_4444:
113 return kRGBA_4444_GrPixelConfig; 112 return kRGBA_4444_GrPixelConfig;
114 default: 113 default:
115 break; 114 break;
116 } 115 }
117 DCHECK(false) << "Unsupported resource format."; 116 DCHECK(false) << "Unsupported resource format.";
118 return kSkia8888_GrPixelConfig; 117 return kSkia8888_GrPixelConfig;
119 } 118 }
120 119
121 gfx::BufferFormat ToGpuMemoryBufferFormat(ResourceFormat format) {
122 switch (format) {
123 case RGBA_8888:
124 return gfx::BufferFormat::RGBA_8888;
125 case BGRA_8888:
126 return gfx::BufferFormat::BGRA_8888;
127 case RGBA_4444:
128 return gfx::BufferFormat::RGBA_4444;
129 case ALPHA_8:
130 case LUMINANCE_8:
131 case RGB_565:
132 case ETC1:
133 case RED_8:
134 break;
135 }
136 NOTREACHED();
137 return gfx::BufferFormat::RGBA_8888;
138 }
139
140 class ScopedSetActiveTexture { 120 class ScopedSetActiveTexture {
141 public: 121 public:
142 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) 122 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit)
143 : gl_(gl), unit_(unit) { 123 : gl_(gl), unit_(unit) {
144 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_)); 124 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
145 125
146 if (unit_ != GL_TEXTURE0) 126 if (unit_ != GL_TEXTURE0)
147 gl_->ActiveTexture(unit_); 127 gl_->ActiveTexture(unit_);
148 } 128 }
149 129
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 next_id_index_ = 0; 180 next_id_index_ = 0;
201 } 181 }
202 182
203 return ids_[next_id_index_++]; 183 return ids_[next_id_index_++];
204 } 184 }
205 185
206 private: 186 private:
207 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator); 187 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator);
208 }; 188 };
209 189
210 // Query object based fence implementation used to detect completion of copy
211 // texture operations. Fence has passed when query result is available.
212 class CopyTextureFence : public ResourceProvider::Fence {
213 public:
214 CopyTextureFence(gpu::gles2::GLES2Interface* gl, unsigned query_id)
215 : gl_(gl), query_id_(query_id) {}
216
217 // Overridden from ResourceProvider::Fence:
218 void Set() override {}
219 bool HasPassed() override {
220 unsigned available = 1;
221 gl_->GetQueryObjectuivEXT(
222 query_id_, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
223 if (!available)
224 return false;
225
226 ProcessResult();
227 return true;
228 }
229 void Wait() override {
230 // ProcessResult() will wait for result to become available.
231 ProcessResult();
232 }
233
234 private:
235 ~CopyTextureFence() override {}
236
237 void ProcessResult() {
238 unsigned time_elapsed_us = 0;
239 gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &time_elapsed_us);
240 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.CopyTextureLatency", time_elapsed_us,
241 0, 256000, 50);
242 }
243
244 gpu::gles2::GLES2Interface* gl_;
245 unsigned query_id_;
246
247 DISALLOW_COPY_AND_ASSIGN(CopyTextureFence);
248 };
249
250 // Generates process-unique IDs to use for tracing a ResourceProvider's 190 // Generates process-unique IDs to use for tracing a ResourceProvider's
251 // resources. 191 // resources.
252 base::StaticAtomicSequenceNumber g_next_resource_provider_tracing_id; 192 base::StaticAtomicSequenceNumber g_next_resource_provider_tracing_id;
253 193
254 } // namespace 194 } // namespace
255 195
256 ResourceProvider::Resource::~Resource() {} 196 ResourceProvider::Resource::~Resource() {}
257 197
258 ResourceProvider::Resource::Resource(GLuint texture_id, 198 ResourceProvider::Resource::Resource(GLuint texture_id,
259 const gfx::Size& size, 199 const gfx::Size& size,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 ResourceProvider::Child::~Child() {} 335 ResourceProvider::Child::~Child() {}
396 336
397 scoped_ptr<ResourceProvider> ResourceProvider::Create( 337 scoped_ptr<ResourceProvider> ResourceProvider::Create(
398 OutputSurface* output_surface, 338 OutputSurface* output_surface,
399 SharedBitmapManager* shared_bitmap_manager, 339 SharedBitmapManager* shared_bitmap_manager,
400 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 340 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
401 BlockingTaskRunner* blocking_main_thread_task_runner, 341 BlockingTaskRunner* blocking_main_thread_task_runner,
402 int highp_threshold_min, 342 int highp_threshold_min,
403 bool use_rgba_4444_texture_format, 343 bool use_rgba_4444_texture_format,
404 size_t id_allocation_chunk_size, 344 size_t id_allocation_chunk_size,
405 bool use_persistent_map_for_gpu_memory_buffers,
406 const std::vector<unsigned>& use_image_texture_targets) { 345 const std::vector<unsigned>& use_image_texture_targets) {
407 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider( 346 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider(
408 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, 347 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager,
409 blocking_main_thread_task_runner, highp_threshold_min, 348 blocking_main_thread_task_runner, highp_threshold_min,
410 use_rgba_4444_texture_format, id_allocation_chunk_size, 349 use_rgba_4444_texture_format, id_allocation_chunk_size,
411 use_persistent_map_for_gpu_memory_buffers, use_image_texture_targets)); 350 use_image_texture_targets));
412 resource_provider->Initialize(); 351 resource_provider->Initialize();
413 return resource_provider; 352 return resource_provider;
414 } 353 }
415 354
416 ResourceProvider::~ResourceProvider() { 355 ResourceProvider::~ResourceProvider() {
417 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 356 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
418 this); 357 this);
419 358
420 while (!children_.empty()) 359 while (!children_.empty())
421 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN); 360 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 // GpuMemoryBuffer provides direct access to the memory used by the GPU. 931 // GpuMemoryBuffer provides direct access to the memory used by the GPU.
993 // Read lock fences are required to ensure that we're not trying to map a 932 // Read lock fences are required to ensure that we're not trying to map a
994 // buffer that is currently in-use by the GPU. 933 // buffer that is currently in-use by the GPU.
995 resource_->read_lock_fences_enabled = true; 934 resource_->read_lock_fences_enabled = true;
996 } 935 }
997 936
998 gfx::GpuMemoryBuffer* 937 gfx::GpuMemoryBuffer*
999 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() { 938 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() {
1000 if (gpu_memory_buffer_) 939 if (gpu_memory_buffer_)
1001 return gpu_memory_buffer_; 940 return gpu_memory_buffer_;
1002 gfx::BufferUsage usage =
1003 resource_provider_->use_persistent_map_for_gpu_memory_buffers()
1004 ? gfx::BufferUsage::PERSISTENT_MAP
1005 : gfx::BufferUsage::MAP;
1006 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 941 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
1007 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( 942 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
1008 size_, ToGpuMemoryBufferFormat(format_), usage); 943 size_, BufferFormat(format_), gfx::BufferUsage::MAP);
1009 gpu_memory_buffer_ = gpu_memory_buffer.release(); 944 gpu_memory_buffer_ = gpu_memory_buffer.release();
1010 return gpu_memory_buffer_; 945 return gpu_memory_buffer_;
1011 } 946 }
1012 947
1013 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( 948 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr(
1014 ResourceProvider* resource_provider, 949 ResourceProvider* resource_provider,
1015 ResourceId resource_id) 950 ResourceId resource_id)
1016 : resource_provider_(resource_provider), 951 : resource_provider_(resource_provider),
1017 resource_(resource_provider->LockForWrite(resource_id)) { 952 resource_(resource_provider->LockForWrite(resource_id)) {
1018 DCHECK(thread_checker_.CalledOnValidThread()); 953 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1025 }
1091 1026
1092 ResourceProvider::ResourceProvider( 1027 ResourceProvider::ResourceProvider(
1093 OutputSurface* output_surface, 1028 OutputSurface* output_surface,
1094 SharedBitmapManager* shared_bitmap_manager, 1029 SharedBitmapManager* shared_bitmap_manager,
1095 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 1030 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
1096 BlockingTaskRunner* blocking_main_thread_task_runner, 1031 BlockingTaskRunner* blocking_main_thread_task_runner,
1097 int highp_threshold_min, 1032 int highp_threshold_min,
1098 bool use_rgba_4444_texture_format, 1033 bool use_rgba_4444_texture_format,
1099 size_t id_allocation_chunk_size, 1034 size_t id_allocation_chunk_size,
1100 bool use_persistent_map_for_gpu_memory_buffers,
1101 const std::vector<unsigned>& use_image_texture_targets) 1035 const std::vector<unsigned>& use_image_texture_targets)
1102 : output_surface_(output_surface), 1036 : output_surface_(output_surface),
1103 shared_bitmap_manager_(shared_bitmap_manager), 1037 shared_bitmap_manager_(shared_bitmap_manager),
1104 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 1038 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
1105 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), 1039 blocking_main_thread_task_runner_(blocking_main_thread_task_runner),
1106 lost_output_surface_(false), 1040 lost_output_surface_(false),
1107 highp_threshold_min_(highp_threshold_min), 1041 highp_threshold_min_(highp_threshold_min),
1108 next_id_(1), 1042 next_id_(1),
1109 next_child_(1), 1043 next_child_(1),
1110 default_resource_type_(RESOURCE_TYPE_BITMAP), 1044 default_resource_type_(RESOURCE_TYPE_BITMAP),
1111 use_texture_storage_ext_(false), 1045 use_texture_storage_ext_(false),
1112 use_texture_format_bgra_(false), 1046 use_texture_format_bgra_(false),
1113 use_texture_usage_hint_(false), 1047 use_texture_usage_hint_(false),
1114 use_compressed_texture_etc1_(false), 1048 use_compressed_texture_etc1_(false),
1115 yuv_resource_format_(LUMINANCE_8), 1049 yuv_resource_format_(LUMINANCE_8),
1116 max_texture_size_(0), 1050 max_texture_size_(0),
1117 best_texture_format_(RGBA_8888), 1051 best_texture_format_(RGBA_8888),
1118 best_render_buffer_format_(RGBA_8888), 1052 best_render_buffer_format_(RGBA_8888),
1119 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), 1053 use_rgba_4444_texture_format_(use_rgba_4444_texture_format),
1120 id_allocation_chunk_size_(id_allocation_chunk_size), 1054 id_allocation_chunk_size_(id_allocation_chunk_size),
1121 use_sync_query_(false), 1055 use_sync_query_(false),
1122 use_persistent_map_for_gpu_memory_buffers_(
1123 use_persistent_map_for_gpu_memory_buffers),
1124 use_image_texture_targets_(use_image_texture_targets), 1056 use_image_texture_targets_(use_image_texture_targets),
1125 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) { 1057 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) {
1126 DCHECK(output_surface_->HasClient()); 1058 DCHECK(output_surface_->HasClient());
1127 DCHECK(id_allocation_chunk_size_); 1059 DCHECK(id_allocation_chunk_size_);
1128 } 1060 }
1129 1061
1130 void ResourceProvider::Initialize() { 1062 void ResourceProvider::Initialize() {
1131 DCHECK(thread_checker_.CalledOnValidThread()); 1063 DCHECK(thread_checker_.CalledOnValidThread());
1132 1064
1133 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). 1065 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 DCHECK(resource->image_id); 1781 DCHECK(resource->image_id);
1850 1782
1851 // Release image currently bound to texture. 1783 // Release image currently bound to texture.
1852 if (resource->bound_image_id) 1784 if (resource->bound_image_id)
1853 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id); 1785 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id);
1854 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id); 1786 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id);
1855 resource->bound_image_id = resource->image_id; 1787 resource->bound_image_id = resource->image_id;
1856 resource->dirty_image = false; 1788 resource->dirty_image = false;
1857 } 1789 }
1858 1790
1859 void ResourceProvider::CopyResource(ResourceId source_id,
1860 ResourceId dest_id,
1861 const gfx::Rect& rect) {
1862 TRACE_EVENT0("cc", "ResourceProvider::CopyResource");
1863
1864 Resource* source_resource = GetResource(source_id);
1865 DCHECK(!source_resource->lock_for_read_count);
1866 DCHECK(source_resource->origin == Resource::INTERNAL);
1867 DCHECK_EQ(source_resource->exported_count, 0);
1868 DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, source_resource->type);
1869 LazyAllocate(source_resource);
1870
1871 Resource* dest_resource = GetResource(dest_id);
1872 DCHECK(!dest_resource->locked_for_write);
1873 DCHECK(!dest_resource->lock_for_read_count);
1874 DCHECK(dest_resource->origin == Resource::INTERNAL);
1875 DCHECK_EQ(dest_resource->exported_count, 0);
1876 DCHECK_EQ(RESOURCE_TYPE_GL_TEXTURE, dest_resource->type);
1877 LazyAllocate(dest_resource);
1878
1879 DCHECK_EQ(source_resource->type, dest_resource->type);
1880 DCHECK_EQ(source_resource->format, dest_resource->format);
1881 DCHECK(source_resource->size == dest_resource->size);
1882 DCHECK(gfx::Rect(dest_resource->size).Contains(rect));
1883
1884 GLES2Interface* gl = ContextGL();
1885 DCHECK(gl);
1886 if (source_resource->image_id && source_resource->dirty_image) {
1887 gl->BindTexture(source_resource->target, source_resource->gl_id);
1888 BindImageForSampling(source_resource);
1889 }
1890 if (use_sync_query_) {
1891 if (!source_resource->gl_read_lock_query_id)
1892 gl->GenQueriesEXT(1, &source_resource->gl_read_lock_query_id);
1893 #if defined(OS_CHROMEOS)
1894 // TODO(reveman): This avoids a performance problem on some ChromeOS
1895 // devices. This needs to be removed to support native GpuMemoryBuffer
1896 // implementations. crbug.com/436314
1897 gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM,
1898 source_resource->gl_read_lock_query_id);
1899 #else
1900 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM,
1901 source_resource->gl_read_lock_query_id);
1902 #endif
1903 }
1904 DCHECK(!dest_resource->image_id);
1905 dest_resource->allocated = true;
1906 gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id,
1907 dest_resource->gl_id, rect.x(), rect.y(), rect.x(),
1908 rect.y(), rect.width(), rect.height(),
1909 false, false, false);
1910 if (source_resource->gl_read_lock_query_id) {
1911 // End query and create a read lock fence that will prevent access to
1912 // source resource until CopySubTextureCHROMIUM command has completed.
1913 #if defined(OS_CHROMEOS)
1914 gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
1915 #else
1916 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
1917 #endif
1918 source_resource->read_lock_fence = make_scoped_refptr(
1919 new CopyTextureFence(gl, source_resource->gl_read_lock_query_id));
1920 } else {
1921 // Create a SynchronousFence when CHROMIUM_sync_query extension is missing.
1922 // Try to use one synchronous fence for as many CopyResource operations as
1923 // possible as that reduce the number of times we have to synchronize with
1924 // the GL.
1925 if (!synchronous_fence_.get() || synchronous_fence_->has_synchronized())
1926 synchronous_fence_ = make_scoped_refptr(new SynchronousFence(gl));
1927 source_resource->read_lock_fence = synchronous_fence_;
1928 source_resource->read_lock_fence->Set();
1929 }
1930 }
1931
1932 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) { 1791 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) {
1933 Resource* resource = GetResource(id); 1792 Resource* resource = GetResource(id);
1934 DCHECK_EQ(resource->exported_count, 0); 1793 DCHECK_EQ(resource->exported_count, 0);
1935 DCHECK(resource->allocated); 1794 DCHECK(resource->allocated);
1936 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id) 1795 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
1937 return; 1796 return;
1938 if (!resource->mailbox.sync_point()) 1797 if (!resource->mailbox.sync_point())
1939 return; 1798 return;
1940 DCHECK(resource->mailbox.IsValid()); 1799 DCHECK(resource->mailbox.IsValid());
1941 GLES2Interface* gl = ContextGL(); 1800 GLES2Interface* gl = ContextGL();
1942 DCHECK(gl); 1801 DCHECK(gl);
1943 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point()); 1802 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point());
1944 resource->mailbox.set_sync_point(0); 1803 resource->mailbox.set_sync_point(0);
1945 } 1804 }
1946 1805
1947 void ResourceProvider::WaitReadLockIfNeeded(ResourceId id) {
1948 Resource* resource = GetResource(id);
1949 DCHECK_EQ(resource->exported_count, 0);
1950 if (!resource->read_lock_fence.get())
1951 return;
1952
1953 resource->read_lock_fence->Wait();
1954 }
1955
1956 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { 1806 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {
1957 GLint active_unit = 0; 1807 GLint active_unit = 0;
1958 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 1808 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
1959 return active_unit; 1809 return active_unit;
1960 } 1810 }
1961 1811
1962 GLenum ResourceProvider::GetImageTextureTarget(ResourceFormat format) { 1812 GLenum ResourceProvider::GetImageTextureTarget(ResourceFormat format) {
1963 gfx::BufferFormat buffer_format = ToGpuMemoryBufferFormat(format); 1813 gfx::BufferFormat buffer_format = BufferFormat(format);
1964 DCHECK_GT(use_image_texture_targets_.size(), 1814 DCHECK_GT(use_image_texture_targets_.size(),
1965 static_cast<size_t>(buffer_format)); 1815 static_cast<size_t>(buffer_format));
1966 return use_image_texture_targets_[static_cast<size_t>(buffer_format)]; 1816 return use_image_texture_targets_[static_cast<size_t>(buffer_format)];
1967 } 1817 }
1968 1818
1969 void ResourceProvider::ValidateResource(ResourceId id) const { 1819 void ResourceProvider::ValidateResource(ResourceId id) const {
1970 DCHECK(thread_checker_.CalledOnValidThread()); 1820 DCHECK(thread_checker_.CalledOnValidThread());
1971 DCHECK(id); 1821 DCHECK(id);
1972 DCHECK(resources_.find(id) != resources_.end()); 1822 DCHECK(resources_.find(id) != resources_.end());
1973 } 1823 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 const int kImportance = 2; 1878 const int kImportance = 2;
2029 pmd->CreateSharedGlobalAllocatorDump(guid); 1879 pmd->CreateSharedGlobalAllocatorDump(guid);
2030 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1880 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2031 } 1881 }
2032 } 1882 }
2033 1883
2034 return true; 1884 return true;
2035 } 1885 }
2036 1886
2037 } // namespace cc 1887 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698