From: robertphillips@google.com Date: Thu, 9 Aug 2012 10:49:39 +0000 (+0000) Subject: Added resource domain to GrTextureDesc X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~15238 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5091b7094ba4708451ea73b4fdd8020d8aaa7d23;p=platform%2Fupstream%2FlibSkiaSharp.git Added resource domain to GrTextureDesc https://codereview.appspot.com/6459062/ git-svn-id: http://skia.googlecode.com/svn/trunk@5028 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/include/gpu/GrCacheID.h b/include/gpu/GrCacheID.h index 972ce10..231304d 100644 --- a/include/gpu/GrCacheID.h +++ b/include/gpu/GrCacheID.h @@ -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(); diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 8a3d738..a3f0059 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -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; }; /** diff --git a/src/gpu/GrStencilBuffer.cpp b/src/gpu/GrStencilBuffer.cpp index bacbe78..07ee661 100644 --- a/src/gpu/GrStencilBuffer.cpp +++ b/src/gpu/GrStencilBuffer.cpp @@ -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; diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index ac17a10..208bd2e 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -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