36#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(fImageContext->priv().singleOwner())
76 fUniquelyKeyedProxies.
add(proxy);
86 fUniquelyKeyedProxies.
add(proxy);
117#if defined(GR_TEST_UTILS)
122 int renderTargetSampleCnt,
135 if (this->
caps()->isFormatCompressed(
format)) {
150 renderTargetSampleCnt,
152 "InstantiatedProxyViaApproxTexture_Test");
158 renderTargetSampleCnt,
162 "InstantiatedProxyViaTexture_Test");
175 int renderTargetSampleCnt,
184 return this->testingOnly_createInstantiatedProxy(dimensions,
187 renderTargetSampleCnt,
199 UseAllocator useAllocator) {
243 result = this->createWrapped(std::move(
texture), useAllocator);
262 if (proxy->asRenderTargetProxy()) {
265 SkASSERT(expectedFormat == proxy->backendFormat());
268 return {std::move(proxy), origin, swizzle};
304 if (copyBitmap.fMips) {
309 src.fPixmap.readPixels(
dst.fPixmap);
319 proxy = this->createNonMippedProxyFromBitmap(copyBitmap, fit, budgeted);
321 proxy = this->createMippedProxyFromBitmap(copyBitmap, budgeted);
344 auto dims =
bitmap.dimensions();
378 "ProxyProvider_CreateNonMippedProxyFromBitmap");
405 auto dims =
bitmap.dimensions();
409 const int mipLevelCount = mipmaps->
countLevels() + 1;
410 std::unique_ptr<GrMipLevel[]> texels(
new GrMipLevel[mipLevelCount]);
413 texels[0].fPixels =
bitmap.getPixels();
414 texels[0].fRowBytes =
bitmap.rowBytes();
416 for (
int i = 1;
i < mipLevelCount; ++
i) {
418 mipmaps->
getLevel(
i - 1, &generatedMipLevel);
445 "ProxyProvider_CreateMippedProxyFromBitmap");
459 int renderTargetSampleCnt,
464 std::string_view label,
490 renderTargetSampleCnt,
507 renderTargetSampleCnt,
513 surfaceFlags | extraFlags,
574 "ProxyProvider_CreateCompressedTextureProxy");
689 backendTex, sampleCnt, ownership, cacheable);
736 rt->setRelease(std::move(releaseHelper));
740 SkASSERT(!rt->getUniqueKey().isValid());
800 std::string_view label) {
812 if (dimensions.
fWidth > this->caps()->maxTextureSize() ||
813 dimensions.
fHeight > this->caps()->maxTextureSize()) {
842 bool wrapsVkSecondaryCB,
851 if (dimensions.
fWidth > this->caps()->maxRenderTargetSize() ||
852 dimensions.
fHeight > this->caps()->maxRenderTargetSize()) {
873 this->isDDLProvider(),
874 "TextureRenderTarget_LazyRenderTargetProxy"));
892 "RenderTargetProxy_LazyRenderTargetProxy"));
898 int renderTargetSampleCnt,
914 static constexpr SkISize kLazyDims = {-1, -1};
921 renderTargetSampleCnt,
930 "TextureRenderTarget_FullyLazyProxy"));
943 "Texture_FullyLazyProxy"));
950 this->processInvalidUniqueKeyImpl(
key, proxy, invalidateGPUResource, RemoveTableEntry::kYes);
955 InvalidateGPUResource invalidateGPUResource,
956 RemoveTableEntry removeTableEntry) {
960 proxy = fUniquelyKeyedProxies.
find(
key);
979 if (removeTableEntry == RemoveTableEntry::kYes) {
985 if (invalidGpuResource) {
999 return fImageContext->
priv().
caps();
1012 proxy->fProxyProvider =
nullptr;
1020 this->processInvalidUniqueKeyImpl(proxy->
getUniqueKey(), proxy,
1022 RemoveTableEntry::kNo);
1025 fUniquelyKeyedProxies.
reset();
#define ASSERT_SINGLE_OWNER
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static bool SkImageInfoIsValid(const SkImageInfo &info)
static SkString resource(SkPDFResourceType type, int index)
sk_sp< T > sk_ref_sp(T *obj)
#define ATRACE_ANDROID_FRAMEWORK(fmt,...)
GrBackendFormat getBackendFormat() const
sk_sp< const GrCaps > refCaps() const
uint32_t contextID() const
const GrCaps * caps() const
std::tuple< GrColorType, GrBackendFormat > getFallbackColorTypeAndFormat(GrColorType, int sampleCount) const
virtual GrInternalSurfaceFlags getExtraSurfaceFlagsForDeferredRT() const
virtual bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const =0
int maxTextureSize() const
virtual GrBackendFormat getBackendFormatFromCompressionType(SkTextureCompressionType) const =0
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
bool isFormatCompressed(const GrBackendFormat &format) const
bool validateSurfaceParams(const SkISize &, const GrBackendFormat &, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped, GrTextureType) const
virtual int getRenderTargetSampleCount(int requestedCount, const GrBackendFormat &) const =0
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
const GrCaps * caps() const
GrContextThreadSafeProxyPriv priv()
virtual GrDirectContext * asDirectContext()
SK_API GrBackendApi backend() const
GrResourceProvider * resourceProvider()
GrDirectContextPriv priv()
GrBudgetedType budgetedType() const
const skgpu::UniqueKey & getUniqueKey() const
ResourcePriv resourcePriv()
GrImageContextPriv priv()
void orphanAllUniqueKeys()
uint32_t contextID() const
void removeUniqueKeyFromProxy(GrTextureProxy *)
sk_sp< GrRenderTargetProxy > createLazyRenderTargetProxy(LazyInstantiateCallback &&, const GrBackendFormat &, SkISize dimensions, int renderTargetSampleCnt, GrInternalSurfaceFlags, const TextureInfo *, GrMipmapStatus, SkBackingFit, skgpu::Budgeted, GrProtected, bool wrapsVkSecondaryCB, UseAllocator useAllocator)
GrSurfaceProxyView findCachedProxyWithColorTypeFallback(const skgpu::UniqueKey &, GrSurfaceOrigin, GrColorType, int sampleCnt)
GrResourceProvider * resourceProvider() const
sk_sp< const GrCaps > refCaps() const
GrProxyProvider(GrImageContext *)
sk_sp< GrTextureProxy > findProxyByUniqueKey(const skgpu::UniqueKey &)
sk_sp< GrTextureProxy > createLazyProxy(LazyInstantiateCallback &&, const GrBackendFormat &, SkISize dimensions, skgpu::Mipmapped, GrMipmapStatus, GrInternalSurfaceFlags, SkBackingFit, skgpu::Budgeted, GrProtected, UseAllocator, std::string_view label)
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
GrSurfaceProxy::LazyCallbackResult LazyCallbackResult
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)
GrDDLProvider isDDLProvider() const
sk_sp< GrTextureProxy > wrapCompressedBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, sk_sp< skgpu::RefCntedCallback >)
static sk_sp< GrTextureProxy > CreatePromiseProxy(GrContextThreadSafeProxy *, LazyInstantiateCallback &&, const GrBackendFormat &, SkISize dimensions, skgpu::Mipmapped)
bool assignUniqueKeyToProxy(const skgpu::UniqueKey &, GrTextureProxy *)
sk_sp< GrTextureProxy > findOrCreateProxyByUniqueKey(const skgpu::UniqueKey &, UseAllocator=UseAllocator::kYes)
void processInvalidUniqueKey(const skgpu::UniqueKey &, GrTextureProxy *, InvalidateGPUResource)
sk_sp< GrTextureProxy > wrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable, sk_sp< skgpu::RefCntedCallback > releaseHelper)
void adoptUniqueKeyFromSurface(GrTextureProxy *proxy, const GrSurface *)
sk_sp< GrSurfaceProxy > wrapBackendRenderTarget(const GrBackendRenderTarget &, sk_sp< skgpu::RefCntedCallback > releaseHelper)
static sk_sp< GrTextureProxy > MakeFullyLazyProxy(LazyInstantiateCallback &&, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, GrProtected, const GrCaps &, UseAllocator)
void removeAllUniqueKeys()
bool renderingDirectly() const
sk_sp< GrTextureProxy > createProxyFromBitmap(const SkBitmap &, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted)
GrSurfaceProxy::LazySurfaceDesc LazySurfaceDesc
GrSurfaceProxy::LazyInstantiateCallback LazyInstantiateCallback
sk_sp< GrTextureProxy > createCompressedTextureProxy(SkISize dimensions, skgpu::Budgeted, skgpu::Mipmapped, GrProtected, SkTextureCompressionType, sk_sp< SkData > data)
const GrCaps * caps() const
GrGpuResource * findAndRefUniqueResource(const skgpu::UniqueKey &key)
sk_sp< GrRenderTarget > wrapBackendRenderTarget(const GrBackendRenderTarget &)
std::enable_if< std::is_base_of< GrGpuResource, T >::value, sk_sp< T > >::type findByUniqueKey(const skgpu::UniqueKey &key)
sk_sp< GrTexture > createApproxTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Protected isProtected, std::string_view label)
sk_sp< GrTexture > wrapBackendTexture(const GrBackendTexture &tex, GrWrapOwnership, GrWrapCacheable, GrIOType)
GrResourceProviderPriv priv()
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, skgpu::Protected isProtected, std::string_view label)
sk_sp< GrTexture > createCompressedTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Budgeted, skgpu::Mipmapped, skgpu::Protected, SkData *data, std::string_view label)
sk_sp< GrTexture > wrapCompressedBackendTexture(const GrBackendTexture &tex, GrWrapOwnership, GrWrapCacheable)
sk_sp< GrTexture > wrapRenderableBackendTexture(const GrBackendTexture &tex, int sampleCnt, GrWrapOwnership, GrWrapCacheable)
bool doLazyInstantiation(GrResourceProvider *)
GrSurfaceProxyPriv priv()
SkISize dimensions() const
void setRelease(sk_sp< skgpu::RefCntedCallback > releaseHelper)
virtual GrRenderTarget * asRenderTarget()
const skgpu::UniqueKey & getUniqueKey() const override
CacheAccess cacheAccess()
void allocPixels(const SkImageInfo &info, size_t rowBytes)
SkISize dimensions() const
const SkPixmap & pixmap() const
const SkImageInfo & info() const
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
bool getLevel(int index, Level *) const
static int ComputeLevelCount(int baseWidth, int baseHeight)
SkColorType colorType() const
const void * addr() const
T * find(const Key &key) const
void remove(const Key &key)
void reset(T *ptr=nullptr)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t uint32_t * format
skgpu::Mipmapped fMipmapped
std::shared_ptr< const fml::Mapping > data