GrTexture can now create its own cache key
http://codereview.appspot.com/6269047/
git-svn-id: http://skia.googlecode.com/svn/trunk@4148 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index e5c67d6..c3e2946 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -14,11 +14,20 @@
#include "GrResource.h"
class GrRenderTarget;
+class GrResourceKey;
+class GrSamplerState;
class GrTexture : public GrResource {
public:
/**
+ * Key generated by client. Should be a unique key on the texture data.
+ * Does not need to consider that width and height of the texture. Two
+ * textures with the same TextureKey but different bounds will not collide.
+ */
+ typedef uint64_t TextureKey;
+
+ /**
* Retrieves the width of the texture.
*
* @return the width in texels
@@ -130,6 +139,16 @@
void validate() const {}
#endif
+ static GrResourceKey ComputeKey(const GrGpu* gpu,
+ const GrSamplerState* sampler,
+ TextureKey clientKey,
+ const GrTextureDesc& desc,
+ bool scratch);
+
+ static bool NeedsResizing(const GrResourceKey& key);
+ static bool IsScratchTexture(const GrResourceKey& key);
+ static bool NeedsFiltering(const GrResourceKey& key);
+
protected:
GrRenderTarget* fRenderTarget; // texture refs its rt representation
// base class cons sets to NULL