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

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

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review comments Created 7 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
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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 45 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
46 enum TextureUsageHint { 46 enum TextureUsageHint {
47 TextureUsageAny, 47 TextureUsageAny,
48 TextureUsageFramebuffer, 48 TextureUsageFramebuffer,
49 }; 49 };
50 enum ResourceType { 50 enum ResourceType {
51 InvalidType = 0, 51 InvalidType = 0,
52 GLTexture = 1, 52 GLTexture = 1,
53 Bitmap, 53 Bitmap,
54 }; 54 };
55 enum TextureType {
epennerAtGoogle 2013/09/06 03:24:44 I'm interested in what others think here, but I wa
reveman 2013/09/06 03:47:15 Maybe OK to just use the internal formats defined
56 RGBA_8888,
57 RGBA_4444,
epennerAtGoogle 2013/09/06 03:24:44 Do we need BGRA_8888 also? The idea to use this en
58 };
55 59
56 static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface, 60 static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface,
57 int highp_threshold_min); 61 int highp_threshold_min,
62 bool use_rgba_4444_textures);
epennerAtGoogle 2013/09/06 03:24:44 How about TextureType best_texture_type, and no bo
58 63
59 virtual ~ResourceProvider(); 64 virtual ~ResourceProvider();
60 65
61 void InitializeSoftware(); 66 void InitializeSoftware();
62 bool InitializeGL(); 67 bool InitializeGL();
63 68
64 void DidLoseOutputSurface() { lost_output_surface_ = true; } 69 void DidLoseOutputSurface() { lost_output_surface_ = true; }
65 70
66 int max_texture_size() const { return max_texture_size_; } 71 int max_texture_size() const { return max_texture_size_; }
67 GLenum best_texture_format() const { return best_texture_format_; } 72 GLenum best_texture_format() const { return best_texture_format_; }
epennerAtGoogle 2013/09/06 03:24:44 I was hoping we could get rid of the GLenum comple
73 TextureType best_texture_type() const { return best_texture_type_; }
68 size_t num_resources() const { return resources_.size(); } 74 size_t num_resources() const { return resources_.size(); }
69 75
70 // Checks whether a resource is in use by a consumer. 76 // Checks whether a resource is in use by a consumer.
71 bool InUseByConsumer(ResourceId id); 77 bool InUseByConsumer(ResourceId id);
72 78
73 79
74 // Producer interface. 80 // Producer interface.
75 81
76 ResourceType default_resource_type() const { return default_resource_type_; } 82 ResourceType default_resource_type() const { return default_resource_type_; }
77 ResourceType GetResourceType(ResourceId id); 83 ResourceType GetResourceType(ResourceId id);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 ResourceIdMap child_to_parent_map; 380 ResourceIdMap child_to_parent_map;
375 ResourceIdMap parent_to_child_map; 381 ResourceIdMap parent_to_child_map;
376 }; 382 };
377 typedef base::hash_map<int, Child> ChildMap; 383 typedef base::hash_map<int, Child> ChildMap;
378 384
379 bool ReadLockFenceHasPassed(Resource* resource) { 385 bool ReadLockFenceHasPassed(Resource* resource) {
380 return !resource->read_lock_fence.get() || 386 return !resource->read_lock_fence.get() ||
381 resource->read_lock_fence->HasPassed(); 387 resource->read_lock_fence->HasPassed();
382 } 388 }
383 389
384 explicit ResourceProvider(OutputSurface* output_surface, 390 ResourceProvider(OutputSurface* output_surface,
385 int highp_threshold_min); 391 int highp_threshold_min,
392 bool use_rgba_4444_textures);
386 393
387 void CleanUpGLIfNeeded(); 394 void CleanUpGLIfNeeded();
388 395
389 Resource* GetResource(ResourceId id); 396 Resource* GetResource(ResourceId id);
390 const Resource* LockForRead(ResourceId id); 397 const Resource* LockForRead(ResourceId id);
391 void UnlockForRead(ResourceId id); 398 void UnlockForRead(ResourceId id);
392 const Resource* LockForWrite(ResourceId id); 399 const Resource* LockForWrite(ResourceId id);
393 void UnlockForWrite(ResourceId id); 400 void UnlockForWrite(ResourceId id);
394 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, 401 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap,
395 const Resource* resource); 402 const Resource* resource);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 int next_child_; 434 int next_child_;
428 ChildMap children_; 435 ChildMap children_;
429 436
430 ResourceType default_resource_type_; 437 ResourceType default_resource_type_;
431 bool use_texture_storage_ext_; 438 bool use_texture_storage_ext_;
432 bool use_texture_usage_hint_; 439 bool use_texture_usage_hint_;
433 bool use_shallow_flush_; 440 bool use_shallow_flush_;
434 scoped_ptr<TextureUploader> texture_uploader_; 441 scoped_ptr<TextureUploader> texture_uploader_;
435 int max_texture_size_; 442 int max_texture_size_;
436 GLenum best_texture_format_; 443 GLenum best_texture_format_;
444 TextureType best_texture_type_;
437 445
438 base::ThreadChecker thread_checker_; 446 base::ThreadChecker thread_checker_;
439 447
440 scoped_refptr<Fence> current_read_lock_fence_; 448 scoped_refptr<Fence> current_read_lock_fence_;
441 449
442 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 450 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
443 }; 451 };
444 452
445 } // namespace cc 453 } // namespace cc
446 454
447 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 455 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698