20#include "webgpu/webgpu_cpp.h"
36 auto mbet = ManagedBackendTexture::MakeWithoutData(dContext,
53 ManagedBackendTexture::ReleaseProc,
54 mbet->releaseContext());
68 dContext, ii, origin, sampleCnt, mipmapped, isProtected, props);
81 struct ReleaseContext {
86 auto bert = dContext->
priv().
getGpu()->createTestingOnlyBackendRenderTarget(
88 auto rc =
new ReleaseContext{
sk_ref_sp(dContext), bert};
89 SkASSERT(!bert.isValid() || bert.sampleCnt() >= sampleCnt);
91 auto proc = [](
void* c) {
92 const auto* rc =
static_cast<ReleaseContext*
>(c);
93 if (
auto gpu = rc->fContext->priv().getGpu(); gpu && rc->fRenderTarget.isValid()) {
94 gpu->deleteTestingOnlyBackendRenderTarget(rc->fRenderTarget);
127 skgpu::Renderable::kYes,
137 ManagedGraphiteTexture::ReleaseProc,
138 mbet->releaseContext());
155 auto mbet = ManagedGraphiteTexture::MakeUnInit(recorder,
158 skgpu::Renderable::kYes,
164 wgpu::Texture
texture(mbet->texture().getDawnTexturePtr());
167 wgpu::TextureView view =
texture.CreateView();
171 textureInfo.
fAspect = wgpu::TextureAspect::All;
179 auto release = [](
void* ctx) {
static_cast<ManagedGraphiteTexture*
>(ctx)->unref(); };
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
@ kUnknown_SkAlphaType
uninitialized
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
GrDirectContextPriv priv()
BackendApi backend() const
SK_API sk_sp< SkSurface > WrapBackendRenderTarget(GrRecordingContext *context, const GrBackendRenderTarget &backendRenderTarget, GrSurfaceOrigin origin, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, RenderTargetReleaseProc releaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
sk_sp< SkSurface > MakeBackendRenderTargetSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, GrProtected isProtected, const SkSurfaceProps *props)
sk_sp< SkSurface > MakeBackendTextureSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, const SkSurfaceProps *props)
sk_sp< SkColorSpace > refColorSpace() const
SkISize dimensions() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkAlphaType alphaType() const
SkColorType colorType() const
wgpu::TextureFormat fFormat
wgpu::TextureAspect fAspect
wgpu::TextureUsage fUsage