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

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

Issue 22529002: [cc] Allow resources and ui resources to specify wrap mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo and add asserts Created 7 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Creates a resource which is tagged as being managed for GPU memory 85 // Creates a resource which is tagged as being managed for GPU memory
86 // accounting purposes. 86 // accounting purposes.
87 ResourceId CreateManagedResource(gfx::Size size, 87 ResourceId CreateManagedResource(gfx::Size size,
88 GLenum format, 88 GLenum format,
89 TextureUsageHint hint); 89 TextureUsageHint hint);
90 90
91 // You can also explicitly create a specific resource type. 91 // You can also explicitly create a specific resource type.
92 ResourceId CreateGLTexture(gfx::Size size, 92 ResourceId CreateGLTexture(gfx::Size size,
93 GLenum format, 93 GLenum format,
94 GLenum texture_pool, 94 GLenum texture_pool,
95 GLint wrap_mode,
95 TextureUsageHint hint); 96 TextureUsageHint hint);
96 97
97 ResourceId CreateBitmap(gfx::Size size); 98 ResourceId CreateBitmap(gfx::Size size);
98 // Wraps an external texture into a GL resource. 99 // Wraps an external texture into a GL resource.
99 ResourceId CreateResourceFromExternalTexture( 100 ResourceId CreateResourceFromExternalTexture(
100 unsigned texture_target, 101 unsigned texture_target,
101 unsigned texture_id); 102 unsigned texture_id);
102 103
103 // Wraps an external texture mailbox into a GL resource. 104 // Wraps an external texture mailbox into a GL resource.
104 ResourceId CreateResourceFromTextureMailbox(const TextureMailbox& mailbox); 105 ResourceId CreateResourceFromTextureMailbox(const TextureMailbox& mailbox);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 336
336 private: 337 private:
337 struct Resource { 338 struct Resource {
338 Resource(); 339 Resource();
339 ~Resource(); 340 ~Resource();
340 Resource(unsigned texture_id, 341 Resource(unsigned texture_id,
341 gfx::Size size, 342 gfx::Size size,
342 GLenum format, 343 GLenum format,
343 GLenum filter, 344 GLenum filter,
344 GLenum texture_pool, 345 GLenum texture_pool,
346 GLint wrap_mode,
345 TextureUsageHint hint); 347 TextureUsageHint hint);
346 Resource(uint8_t* pixels, gfx::Size size, GLenum format, GLenum filter); 348 Resource(uint8_t* pixels,
349 gfx::Size size,
350 GLenum format,
351 GLenum filter,
352 GLint wrap_mode);
347 353
348 unsigned gl_id; 354 unsigned gl_id;
349 // Pixel buffer used for set pixels without unnecessary copying. 355 // Pixel buffer used for set pixels without unnecessary copying.
350 unsigned gl_pixel_buffer_id; 356 unsigned gl_pixel_buffer_id;
351 // Query used to determine when asynchronous set pixels complete. 357 // Query used to determine when asynchronous set pixels complete.
352 unsigned gl_upload_query_id; 358 unsigned gl_upload_query_id;
353 TextureMailbox mailbox; 359 TextureMailbox mailbox;
354 uint8_t* pixels; 360 uint8_t* pixels;
355 uint8_t* pixel_buffer; 361 uint8_t* pixel_buffer;
356 int lock_for_read_count; 362 int lock_for_read_count;
357 bool locked_for_write; 363 bool locked_for_write;
358 bool external; 364 bool external;
359 bool exported; 365 bool exported;
360 bool marked_for_deletion; 366 bool marked_for_deletion;
361 bool pending_set_pixels; 367 bool pending_set_pixels;
362 bool set_pixels_completion_forced; 368 bool set_pixels_completion_forced;
363 bool allocated; 369 bool allocated;
364 bool enable_read_lock_fences; 370 bool enable_read_lock_fences;
365 scoped_refptr<Fence> read_lock_fence; 371 scoped_refptr<Fence> read_lock_fence;
366 gfx::Size size; 372 gfx::Size size;
367 GLenum format; 373 GLenum format;
368 // TODO(skyostil): Use a separate sampler object for filter state. 374 // TODO(skyostil): Use a separate sampler object for filter state.
369 GLenum filter; 375 GLenum filter;
370 unsigned image_id; 376 unsigned image_id;
371 GLenum texture_pool; 377 GLenum texture_pool;
378 GLint wrap_mode;
372 TextureUsageHint hint; 379 TextureUsageHint hint;
373 ResourceType type; 380 ResourceType type;
374 }; 381 };
375 typedef base::hash_map<ResourceId, Resource> ResourceMap; 382 typedef base::hash_map<ResourceId, Resource> ResourceMap;
376 struct Child { 383 struct Child {
377 Child(); 384 Child();
378 ~Child(); 385 ~Child();
379 386
380 ResourceIdMap child_to_parent_map; 387 ResourceIdMap child_to_parent_map;
381 ResourceIdMap parent_to_child_map; 388 ResourceIdMap parent_to_child_map;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 base::ThreadChecker thread_checker_; 449 base::ThreadChecker thread_checker_;
443 450
444 scoped_refptr<Fence> current_read_lock_fence_; 451 scoped_refptr<Fence> current_read_lock_fence_;
445 452
446 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 453 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
447 }; 454 };
448 455
449 } // namespace cc 456 } // namespace cc
450 457
451 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 458 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698