45#include <initializer_list>
51 return fUniquelyKeyedProxies.
count();
64 using namespace skgpu;
90 using namespace skgpu;
114 using namespace skgpu;
119 kSize,
kColorType, GrRenderable::kNo, 1, fit, Budgeted::kYes, isProtected);
129 using namespace skgpu;
134 static int kUniqueKeyData = 0;
139 builder[0] = kUniqueKeyData++;
144 kSize,
kColorType, GrRenderable::kNo, 1, fit, Budgeted::kYes, isProtected);
151 using namespace skgpu;
155 auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithoutData(
171 mbet->refCountedCallback());
179 int cacheEntriesPerProxy) {
186 int startCacheCount = cache->getResourceCount();
189 if (proxy->getUniqueKey().isValid()) {
190 key = proxy->getUniqueKey();
210 int expectedCacheCount = startCacheCount + (proxy->isInstantiated() ? 0 : cacheEntriesPerProxy);
220 bool expectResourceToOutliveProxy = proxy->peekSurface()->resourcePriv().budgetedType() ==
225 bool expectDeletingProxyToDeleteResource =
226 proxy->peekSurface()->resourcePriv().budgetedType() ==
231 if (expectDeletingProxyToDeleteResource) {
232 expectedCacheCount -= cacheEntriesPerProxy;
246 if (!expectResourceToOutliveProxy) {
247 expectedCacheCount -= cacheEntriesPerProxy;
257 if (expectResourceToOutliveProxy) {
261 cache->purgeAsNeeded();
262 expectedCacheCount -= cacheEntriesPerProxy;
275 int cacheEntriesPerProxy) {
296 int bufferResources = 0;
316 textureImg =
nullptr;
331 int cacheEntriesPerProxy) {
376 auto direct = ctxInfo.directContext();
386 int cacheEntriesPerProxy = 1;
389 cacheEntriesPerProxy++;
398 cacheEntriesPerProxy);
@ kBorrow_GrWrapOwnership
static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct)
skgpu::Protected Protected
@ kOpaque_SkAlphaType
pixel is opaque
#define SkAssertResult(cond)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void GrMakeKeyFromImageID(skgpu::UniqueKey *key, uint32_t imageID, const SkIRect &imageBounds)
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info, ctsEnforcement)
static sk_sp< GrTextureProxy > wrapped_with_key(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
static sk_sp< GrTextureProxy > create_wrapped_backend(GrDirectContext *dContext)
static void invalidation_and_instantiation_test(GrDirectContext *dContext, skiatest::Reporter *reporter, int cacheEntriesPerProxy)
static void basic_test(GrDirectContext *dContext, skiatest::Reporter *reporter, sk_sp< GrTextureProxy > proxy, int cacheEntriesPerProxy)
static constexpr auto kColorType
static constexpr auto kSize
static sk_sp< GrTextureProxy > deferred_tex(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
static sk_sp< GrTextureProxy > deferred_texRT(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
static void invalidation_test(GrDirectContext *dContext, skiatest::Reporter *reporter, int cacheEntriesPerProxy)
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
uint32_t contextID() const
const GrCaps * caps() const
bool supportsProtectedContent() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
SK_API GrBackendApi backend() const
GrResourceProvider * resourceProvider()
GrResourceCache * getResourceCache()
bool submit(GrSyncCpu sync=GrSyncCpu::kNo)
size_t getResourceCacheLimit() const
GrDirectContextPriv priv()
void setResourceCacheLimit(size_t maxResourceBytes)
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
int numUniqueKeyProxies_TestOnly() const
sk_sp< GrTextureProxy > createProxy(const GrBackendFormat &, SkISize dimensions, GrRenderable, int renderTargetSampleCnt, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted, GrProtected, std::string_view label, GrInternalSurfaceFlags=GrInternalSurfaceFlags::kNone, UseAllocator useAllocator=UseAllocator::kYes)
bool assignUniqueKeyToProxy(const skgpu::UniqueKey &, GrTextureProxy *)
sk_sp< GrTextureProxy > findOrCreateProxyByUniqueKey(const skgpu::UniqueKey &, UseAllocator=UseAllocator::kYes)
GrProxyProvider * proxyProvider()
GrRecordingContextPriv priv()
void purgeUnlockedResources(GrPurgeResourceOptions opts)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
sk_sp< SkImage > asImage() const
static void Post(Message m)
void reset(T *ptr=nullptr)
static Domain GenerateDomain()
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
uint32_t uint32_t * format
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)