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

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

Issue 1336703002: Revert of Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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"
36 #include "ui/gl/trace_util.h" 37 #include "ui/gl/trace_util.h"
37 38
38 using gpu::gles2::GLES2Interface; 39 using gpu::gles2::GLES2Interface;
39 40
40 namespace cc { 41 namespace cc {
41 42
42 class IdAllocator { 43 class IdAllocator {
43 public: 44 public:
44 virtual ~IdAllocator() {} 45 virtual ~IdAllocator() {}
45 46
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return kBGRA_8888_GrPixelConfig; 111 return kBGRA_8888_GrPixelConfig;
111 case RGBA_4444: 112 case RGBA_4444:
112 return kRGBA_4444_GrPixelConfig; 113 return kRGBA_4444_GrPixelConfig;
113 default: 114 default:
114 break; 115 break;
115 } 116 }
116 DCHECK(false) << "Unsupported resource format."; 117 DCHECK(false) << "Unsupported resource format.";
117 return kSkia8888_GrPixelConfig; 118 return kSkia8888_GrPixelConfig;
118 } 119 }
119 120
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
120 class ScopedSetActiveTexture { 140 class ScopedSetActiveTexture {
121 public: 141 public:
122 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) 142 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit)
123 : gl_(gl), unit_(unit) { 143 : gl_(gl), unit_(unit) {
124 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_)); 144 DCHECK_EQ(GL_TEXTURE0, ResourceProvider::GetActiveTextureUnit(gl_));
125 145
126 if (unit_ != GL_TEXTURE0) 146 if (unit_ != GL_TEXTURE0)
127 gl_->ActiveTexture(unit_); 147 gl_->ActiveTexture(unit_);
128 } 148 }
129 149
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 next_id_index_ = 0; 200 next_id_index_ = 0;
181 } 201 }
182 202
183 return ids_[next_id_index_++]; 203 return ids_[next_id_index_++];
184 } 204 }
185 205
186 private: 206 private:
187 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator); 207 DISALLOW_COPY_AND_ASSIGN(BufferIdAllocator);
188 }; 208 };
189 209
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
190 // Generates process-unique IDs to use for tracing a ResourceProvider's 250 // Generates process-unique IDs to use for tracing a ResourceProvider's
191 // resources. 251 // resources.
192 base::StaticAtomicSequenceNumber g_next_resource_provider_tracing_id; 252 base::StaticAtomicSequenceNumber g_next_resource_provider_tracing_id;
193 253
194 } // namespace 254 } // namespace
195 255
196 ResourceProvider::Resource::~Resource() {} 256 ResourceProvider::Resource::~Resource() {}
197 257
198 ResourceProvider::Resource::Resource(GLuint texture_id, 258 ResourceProvider::Resource::Resource(GLuint texture_id,
199 const gfx::Size& size, 259 const gfx::Size& size,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 ResourceProvider::Child::~Child() {} 395 ResourceProvider::Child::~Child() {}
336 396
337 scoped_ptr<ResourceProvider> ResourceProvider::Create( 397 scoped_ptr<ResourceProvider> ResourceProvider::Create(
338 OutputSurface* output_surface, 398 OutputSurface* output_surface,
339 SharedBitmapManager* shared_bitmap_manager, 399 SharedBitmapManager* shared_bitmap_manager,
340 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 400 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
341 BlockingTaskRunner* blocking_main_thread_task_runner, 401 BlockingTaskRunner* blocking_main_thread_task_runner,
342 int highp_threshold_min, 402 int highp_threshold_min,
343 bool use_rgba_4444_texture_format, 403 bool use_rgba_4444_texture_format,
344 size_t id_allocation_chunk_size, 404 size_t id_allocation_chunk_size,
405 bool use_persistent_map_for_gpu_memory_buffers,
345 const std::vector<unsigned>& use_image_texture_targets) { 406 const std::vector<unsigned>& use_image_texture_targets) {
346 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider( 407 scoped_ptr<ResourceProvider> resource_provider(new ResourceProvider(
347 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager, 408 output_surface, shared_bitmap_manager, gpu_memory_buffer_manager,
348 blocking_main_thread_task_runner, highp_threshold_min, 409 blocking_main_thread_task_runner, highp_threshold_min,
349 use_rgba_4444_texture_format, id_allocation_chunk_size, 410 use_rgba_4444_texture_format, id_allocation_chunk_size,
350 use_image_texture_targets)); 411 use_persistent_map_for_gpu_memory_buffers, use_image_texture_targets));
351 resource_provider->Initialize(); 412 resource_provider->Initialize();
352 return resource_provider; 413 return resource_provider;
353 } 414 }
354 415
355 ResourceProvider::~ResourceProvider() { 416 ResourceProvider::~ResourceProvider() {
356 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 417 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
357 this); 418 this);
358 419
359 while (!children_.empty()) 420 while (!children_.empty())
360 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN); 421 DestroyChildInternal(children_.begin(), FOR_SHUTDOWN);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 // GpuMemoryBuffer provides direct access to the memory used by the GPU. 992 // GpuMemoryBuffer provides direct access to the memory used by the GPU.
932 // Read lock fences are required to ensure that we're not trying to map a 993 // Read lock fences are required to ensure that we're not trying to map a
933 // buffer that is currently in-use by the GPU. 994 // buffer that is currently in-use by the GPU.
934 resource_->read_lock_fences_enabled = true; 995 resource_->read_lock_fences_enabled = true;
935 } 996 }
936 997
937 gfx::GpuMemoryBuffer* 998 gfx::GpuMemoryBuffer*
938 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() { 999 ResourceProvider::ScopedWriteLockGpuMemoryBuffer::GetGpuMemoryBuffer() {
939 if (gpu_memory_buffer_) 1000 if (gpu_memory_buffer_)
940 return gpu_memory_buffer_; 1001 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;
941 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 1006 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
942 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( 1007 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
943 size_, BufferFormat(format_), gfx::BufferUsage::MAP); 1008 size_, ToGpuMemoryBufferFormat(format_), usage);
944 gpu_memory_buffer_ = gpu_memory_buffer.release(); 1009 gpu_memory_buffer_ = gpu_memory_buffer.release();
945 return gpu_memory_buffer_; 1010 return gpu_memory_buffer_;
946 } 1011 }
947 1012
948 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( 1013 ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr(
949 ResourceProvider* resource_provider, 1014 ResourceProvider* resource_provider,
950 ResourceId resource_id) 1015 ResourceId resource_id)
951 : resource_provider_(resource_provider), 1016 : resource_provider_(resource_provider),
952 resource_(resource_provider->LockForWrite(resource_id)) { 1017 resource_(resource_provider->LockForWrite(resource_id)) {
953 DCHECK(thread_checker_.CalledOnValidThread()); 1018 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 } 1090 }
1026 1091
1027 ResourceProvider::ResourceProvider( 1092 ResourceProvider::ResourceProvider(
1028 OutputSurface* output_surface, 1093 OutputSurface* output_surface,
1029 SharedBitmapManager* shared_bitmap_manager, 1094 SharedBitmapManager* shared_bitmap_manager,
1030 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 1095 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
1031 BlockingTaskRunner* blocking_main_thread_task_runner, 1096 BlockingTaskRunner* blocking_main_thread_task_runner,
1032 int highp_threshold_min, 1097 int highp_threshold_min,
1033 bool use_rgba_4444_texture_format, 1098 bool use_rgba_4444_texture_format,
1034 size_t id_allocation_chunk_size, 1099 size_t id_allocation_chunk_size,
1100 bool use_persistent_map_for_gpu_memory_buffers,
1035 const std::vector<unsigned>& use_image_texture_targets) 1101 const std::vector<unsigned>& use_image_texture_targets)
1036 : output_surface_(output_surface), 1102 : output_surface_(output_surface),
1037 shared_bitmap_manager_(shared_bitmap_manager), 1103 shared_bitmap_manager_(shared_bitmap_manager),
1038 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 1104 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
1039 blocking_main_thread_task_runner_(blocking_main_thread_task_runner), 1105 blocking_main_thread_task_runner_(blocking_main_thread_task_runner),
1040 lost_output_surface_(false), 1106 lost_output_surface_(false),
1041 highp_threshold_min_(highp_threshold_min), 1107 highp_threshold_min_(highp_threshold_min),
1042 next_id_(1), 1108 next_id_(1),
1043 next_child_(1), 1109 next_child_(1),
1044 default_resource_type_(RESOURCE_TYPE_BITMAP), 1110 default_resource_type_(RESOURCE_TYPE_BITMAP),
1045 use_texture_storage_ext_(false), 1111 use_texture_storage_ext_(false),
1046 use_texture_format_bgra_(false), 1112 use_texture_format_bgra_(false),
1047 use_texture_usage_hint_(false), 1113 use_texture_usage_hint_(false),
1048 use_compressed_texture_etc1_(false), 1114 use_compressed_texture_etc1_(false),
1049 yuv_resource_format_(LUMINANCE_8), 1115 yuv_resource_format_(LUMINANCE_8),
1050 max_texture_size_(0), 1116 max_texture_size_(0),
1051 best_texture_format_(RGBA_8888), 1117 best_texture_format_(RGBA_8888),
1052 best_render_buffer_format_(RGBA_8888), 1118 best_render_buffer_format_(RGBA_8888),
1053 use_rgba_4444_texture_format_(use_rgba_4444_texture_format), 1119 use_rgba_4444_texture_format_(use_rgba_4444_texture_format),
1054 id_allocation_chunk_size_(id_allocation_chunk_size), 1120 id_allocation_chunk_size_(id_allocation_chunk_size),
1055 use_sync_query_(false), 1121 use_sync_query_(false),
1122 use_persistent_map_for_gpu_memory_buffers_(
1123 use_persistent_map_for_gpu_memory_buffers),
1056 use_image_texture_targets_(use_image_texture_targets), 1124 use_image_texture_targets_(use_image_texture_targets),
1057 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) { 1125 tracing_id_(g_next_resource_provider_tracing_id.GetNext()) {
1058 DCHECK(output_surface_->HasClient()); 1126 DCHECK(output_surface_->HasClient());
1059 DCHECK(id_allocation_chunk_size_); 1127 DCHECK(id_allocation_chunk_size_);
1060 } 1128 }
1061 1129
1062 void ResourceProvider::Initialize() { 1130 void ResourceProvider::Initialize() {
1063 DCHECK(thread_checker_.CalledOnValidThread()); 1131 DCHECK(thread_checker_.CalledOnValidThread());
1064 1132
1065 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). 1133 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 DCHECK(resource->image_id); 1849 DCHECK(resource->image_id);
1782 1850
1783 // Release image currently bound to texture. 1851 // Release image currently bound to texture.
1784 if (resource->bound_image_id) 1852 if (resource->bound_image_id)
1785 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id); 1853 gl->ReleaseTexImage2DCHROMIUM(resource->target, resource->bound_image_id);
1786 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id); 1854 gl->BindTexImage2DCHROMIUM(resource->target, resource->image_id);
1787 resource->bound_image_id = resource->image_id; 1855 resource->bound_image_id = resource->image_id;
1788 resource->dirty_image = false; 1856 resource->dirty_image = false;
1789 } 1857 }
1790 1858
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
1791 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) { 1932 void ResourceProvider::WaitSyncPointIfNeeded(ResourceId id) {
1792 Resource* resource = GetResource(id); 1933 Resource* resource = GetResource(id);
1793 DCHECK_EQ(resource->exported_count, 0); 1934 DCHECK_EQ(resource->exported_count, 0);
1794 DCHECK(resource->allocated); 1935 DCHECK(resource->allocated);
1795 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id) 1936 if (resource->type != RESOURCE_TYPE_GL_TEXTURE || resource->gl_id)
1796 return; 1937 return;
1797 if (!resource->mailbox.sync_point()) 1938 if (!resource->mailbox.sync_point())
1798 return; 1939 return;
1799 DCHECK(resource->mailbox.IsValid()); 1940 DCHECK(resource->mailbox.IsValid());
1800 GLES2Interface* gl = ContextGL(); 1941 GLES2Interface* gl = ContextGL();
1801 DCHECK(gl); 1942 DCHECK(gl);
1802 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point()); 1943 gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point());
1803 resource->mailbox.set_sync_point(0); 1944 resource->mailbox.set_sync_point(0);
1804 } 1945 }
1805 1946
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
1806 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) { 1956 GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {
1807 GLint active_unit = 0; 1957 GLint active_unit = 0;
1808 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 1958 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
1809 return active_unit; 1959 return active_unit;
1810 } 1960 }
1811 1961
1812 GLenum ResourceProvider::GetImageTextureTarget(ResourceFormat format) { 1962 GLenum ResourceProvider::GetImageTextureTarget(ResourceFormat format) {
1813 gfx::BufferFormat buffer_format = BufferFormat(format); 1963 gfx::BufferFormat buffer_format = ToGpuMemoryBufferFormat(format);
1814 DCHECK_GT(use_image_texture_targets_.size(), 1964 DCHECK_GT(use_image_texture_targets_.size(),
1815 static_cast<size_t>(buffer_format)); 1965 static_cast<size_t>(buffer_format));
1816 return use_image_texture_targets_[static_cast<size_t>(buffer_format)]; 1966 return use_image_texture_targets_[static_cast<size_t>(buffer_format)];
1817 } 1967 }
1818 1968
1819 void ResourceProvider::ValidateResource(ResourceId id) const { 1969 void ResourceProvider::ValidateResource(ResourceId id) const {
1820 DCHECK(thread_checker_.CalledOnValidThread()); 1970 DCHECK(thread_checker_.CalledOnValidThread());
1821 DCHECK(id); 1971 DCHECK(id);
1822 DCHECK(resources_.find(id) != resources_.end()); 1972 DCHECK(resources_.find(id) != resources_.end());
1823 } 1973 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 const int kImportance = 2; 2028 const int kImportance = 2;
1879 pmd->CreateSharedGlobalAllocatorDump(guid); 2029 pmd->CreateSharedGlobalAllocatorDump(guid);
1880 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2030 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1881 } 2031 }
1882 } 2032 }
1883 2033
1884 return true; 2034 return true;
1885 } 2035 }
1886 2036
1887 } // namespace cc 2037 } // 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