Added resource domain to GrTextureDesc
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 9 Aug 2012 10:49:39 +0000 (10:49 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 9 Aug 2012 10:49:39 +0000 (10:49 +0000)
https://codereview.appspot.com/6459062/

git-svn-id: http://skia.googlecode.com/svn/trunk@5028 2bbb7eff-a529-9590-31e7-b0007b416f81

include/gpu/GrCacheID.h
include/gpu/GrTypes.h
src/gpu/GrStencilBuffer.cpp
src/gpu/GrTexture.cpp

index 972ce10..231304d 100644 (file)
@@ -89,11 +89,6 @@ public:
     static const uint64_t kDefaultPublicCacheID = 0;
 
     static const uint8_t kInvalid_ResourceType = 0;
-    /**
-     * All scratch resources should be Unrestricted so they can be used 
-     * by any domain.
-     */
-    static const uint8_t kUnrestricted_ResourceDomain = 0;
 
     static uint8_t    GetNextDomain();
     static uint8_t    GetNextResourceType();
index 8a3d738..a3f0059 100644 (file)
@@ -474,6 +474,13 @@ enum {
 static const uint64_t kDefault_CacheID = 0;
 
 /**
+  * All scratch resources should be Unrestricted so they can be used 
+  * by any domain.
+  */
+static const uint8_t kUnrestricted_ResourceDomain = 0;
+
+
+/**
  * Describes a texture to be created.
  */
 struct GrTextureDesc {
@@ -483,7 +490,8 @@ struct GrTextureDesc {
     , fHeight(0)
     , fConfig(kUnknown_GrPixelConfig)
     , fSampleCnt(0)
-    , fClientCacheID(kDefault_CacheID) {
+    , fClientCacheID(kDefault_CacheID)
+    , fResourceDomain(kUnrestricted_ResourceDomain) {
     }
 
     GrTextureFlags         fFlags;  //!< bitfield of TextureFlags
@@ -512,6 +520,12 @@ struct GrTextureDesc {
      * is only relevant for textures that will be cached.
      */
     uint64_t               fClientCacheID;
+
+    /**
+     * Allows cache clients to cluster their textures inside domains (e.g.,
+     * alpha clip masks). Only relevant for cached textures.
+     */
+    uint8_t                fResourceDomain;
 };
 
 /**
index bacbe78..07ee661 100644 (file)
@@ -66,7 +66,7 @@ void gen_stencil_key_values(int width,
                             GrCacheID* cacheID) {
     cacheID->fPublicID = GrCacheID::kDefaultPublicCacheID;
     cacheID->fResourceSpecific32 = width | (height << 16);
-    cacheID->fDomain = GrCacheID::kUnrestricted_ResourceDomain;
+    cacheID->fDomain = kUnrestricted_ResourceDomain;
 
     GrAssert(sampleCnt >= 0 && sampleCnt < 256);
     cacheID->fResourceSpecific16 = sampleCnt << 8;
index ac17a10..208bd2e 100644 (file)
@@ -151,7 +151,7 @@ void gen_texture_key_values(const GrGpu* gpu,
     }
 
     cacheID->fPublicID = clientKey;
-    cacheID->fDomain = GrCacheID::kUnrestricted_ResourceDomain;
+    cacheID->fDomain = desc.fResourceDomain;
 
     // we assume we only need 16 bits of width and height
     // assert that texture creation will fail anyway if this assumption