summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/texture_manager.h
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 10:32:54 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 10:32:54 +0000
commit91c94eb3888f6cbfb61f72b5755ca535b1e89263 (patch)
tree865cbf359f3df594b20b7f9ecd9f5fc6c5cfe816 /gpu/command_buffer/service/texture_manager.h
parentce2753f418b559ab13409a3402e109b606e7ff2c (diff)
downloadchromium_src-91c94eb3888f6cbfb61f72b5755ca535b1e89263.zip
chromium_src-91c94eb3888f6cbfb61f72b5755ca535b1e89263.tar.gz
chromium_src-91c94eb3888f6cbfb61f72b5755ca535b1e89263.tar.bz2
Re-land: gpu: Add Will/DidUseTexImage to GLImage API.
WillUseTexImage/DidUseTexImage is called before/after the image is used for sampling. The result is that the client only has to call bind/releaseTexImage2D when contents have changed, which allows for more efficient GLImage implementations as work required before use can be separated from work required when contents have changed. BUG=261649 TEST=gpu_unittests --gtest_filter=SharedTextureTest.Images && gpu_unittests --gtest_filter=GLES2DecoderWithShaderTest.UseTexImage && cc_unittests --gtest_filter=ResourceProviderTests/ResourceProviderTest.Image_GLTexture* && gl_tests --gtest_filter=MockGpuMemoryBufferTest.Lifecycle Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=229532 Review URL: https://codereview.chromium.org/23129010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/texture_manager.h')
-rw-r--r--gpu/command_buffer/service/texture_manager.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index 0a6e776..3dabf6d 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -114,6 +114,10 @@ class GPU_EXPORT Texture {
// does not exist.
gfx::GLImage* GetLevelImage(GLint target, GLint level) const;
+ bool HasImages() const {
+ return has_images_;
+ }
+
// Returns true of the given dimensions are inside the dimensions of the
// level and if the format and type match the level.
bool ValidForTexture(
@@ -317,6 +321,10 @@ class GPU_EXPORT Texture {
// texture.
void UpdateCanRenderCondition();
+ // Updates the images count in all the managers referencing this
+ // texture.
+ void UpdateHasImages();
+
// Increment the framebuffer state change count in all the managers
// referencing this texture.
void IncAllFramebufferStateChangeCount();
@@ -378,6 +386,9 @@ class GPU_EXPORT Texture {
// or dimensions of the texture object can be made.
bool immutable_;
+ // Whether or not this texture has images.
+ bool has_images_;
+
// Size in bytes this texture is assumed to take in memory.
uint32 estimated_size_;
@@ -656,6 +667,10 @@ class GPU_EXPORT TextureManager {
return num_uncleared_mips_ > 0;
}
+ bool HaveImages() const {
+ return num_images_ > 0;
+ }
+
GLuint black_texture_id(GLenum target) const {
switch (target) {
case GL_SAMPLER_2D:
@@ -758,6 +773,7 @@ class GPU_EXPORT TextureManager {
void UpdateUnclearedMips(int delta);
void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition,
Texture::CanRenderCondition new_condition);
+ void UpdateNumImages(int delta);
void IncFramebufferStateChangeCount();
MemoryTypeTracker* GetMemTracker(GLenum texture_pool);
@@ -781,6 +797,7 @@ class GPU_EXPORT TextureManager {
int num_unrenderable_textures_;
int num_unsafe_textures_;
int num_uncleared_mips_;
+ int num_images_;
// Counts the number of Textures allocated with 'this' as its manager.
// Allows to check no Texture will outlive this.