64#include <initializer_list>
70#if defined(SK_DIRECT3D)
96 using namespace skgpu;
98 auto dContext = ctxInfo.directContext();
99 if (!dContext->priv().caps()->mipmapSupport()) {
103 Protected isProtected =
Protected(dContext->priv().caps()->supportsProtectedContent());
134 sk_gpu_test::ManagedBackendTexture::ReleaseProc,
135 mbet->releaseContext());
138 proxy =
device->readSurfaceView().asTextureProxyRef();
146 sk_gpu_test::ManagedBackendTexture::ReleaseProc,
147 mbet->releaseContext());
184 using namespace skgpu;
186 auto dContext = ctxInfo.directContext();
187 if (!dContext->priv().caps()->mipmapSupport()) {
191 Protected isProtected =
Protected(dContext->priv().caps()->supportsProtectedContent());
240 genProxy->
instantiate(dContext->priv().resourceProvider());
291 GrMtlTextureInfo genImageInfo;
292 GrMtlTextureInfo origImageInfo;
309 if (genBackendTex.getD3DTextureResourceInfo(&genImageInfo) &&
310 backendTex.getD3DTextureResourceInfo(&origImageInfo)) {
336 auto dContext = ctxInfo.directContext();
337 if (!dContext->priv().caps()->mipmapSupport()) {
343 auto resourceProvider = dContext->priv().resourceProvider();
345 for (
auto willUseMips : {
false,
true}) {
346 for (
auto isWrapped : {
false,
true}) {
396 auto dContext = ctxInfo.directContext();
397 if (!dContext->priv().caps()->mipmapSupport()) {
414 surface->getCanvas()->scale(0.5f, 0.5f);
417 surface->getCanvas()->drawImage(bmpImage, 0, 0);
444 "DrawMipMapViewTest");
448 std::move(renderTarget),
453 sdc->drawTexture(
nullptr,
454 std::move(mipmapView),
477 for (
auto enableSortingAndReduction : {Enable::kYes, Enable::kNo}) {
485 ERRORF(
reporter,
"could not create mock dContext with fReduceOpsTaskSplitting %s.",
486 (Enable::kYes == enableSortingAndReduction) ?
"enabled" :
"disabled");
510 "ManyDependentsMipMappedTest");
527 mipmapSDC->testingOnly_PeekLastOpsTask() ==
539 auto sdc1Task =
sk_ref_sp(sdc1->testingOnly_PeekLastOpsTask());
548 initialMipmapRegenTask != mipmapSDC->testingOnly_PeekLastOpsTask());
554 auto sdc2Task =
sk_ref_sp(sdc2->testingOnly_PeekLastOpsTask());
570 auto mipmapRTCTask =
sk_ref_sp(mipmapSDC->testingOnly_PeekLastOpsTask());
596 sdc2Task =
sk_ref_sp(sdc2->testingOnly_PeekLastOpsTask());
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr int kSize
DEF_GANESH_TEST(GrManyDependentsMipMappedTest, reporter,, CtsEnforcement::kApiLevel_T)
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContext > draw_mipmap_into_new_render_target(GrRecordingContext *rContext, GrColorType colorType, SkAlphaType alphaType, GrSurfaceProxyView mipmapView, GrSamplerState::MipmapMode mm)
skgpu::Protected GrProtected
@ kTopLeft_GrSurfaceOrigin
skgpu::Protected Protected
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kSrcOver
r = s + (1-sa)*d
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
sk_sp< T > sk_ref_sp(T *obj)
#define REPORTER_ASSERT(r, cond,...)
static std::unique_ptr< GrTextureGenerator > Make(const sk_sp< GrTexture > &, GrSurfaceOrigin, std::unique_ptr< GrSemaphore >, SkColorType, SkAlphaType, sk_sp< SkColorSpace >)
GrBackendApi backend() const
const GrCaps * caps() const
bool mipmapSupport() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
SK_API GrBackendFormat defaultBackendFormat(SkColorType, GrRenderable) const
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
GrDirectContextPriv priv()
GrRenderTask * getLastRenderTask(const GrSurfaceProxy *) 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)
GrDrawingManager * drawingManager()
GrProxyProvider * proxyProvider()
GrRecordingContextPriv priv()
bool doLazyInstantiation(GrResourceProvider *)
GrSurfaceProxy * proxy() const
const GrBackendFormat & backendFormat() const
virtual bool instantiate(GrResourceProvider *)=0
GrSurfaceProxyPriv priv()
GrTexture * peekTexture() const
bool isInstantiated() const
skgpu::Mipmapped mipmapped() const
bool mipmapsAreDirty() const
bool instantiate(GrResourceProvider *) override
virtual GrBackendTexture getBackendTexture() const =0
sk_sp< SkImage > asImage() const
void allocN32Pixels(int width, int height, bool isOpaque=false)
@ kFast_SrcRectConstraint
sample outside bounds; faster
static const SkMatrix & I()
static std::unique_ptr< SurfaceDrawContext > Make(GrRecordingContext *, GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &)
uint32_t uint32_t * format
SK_API bool GetMtlTextureInfo(const GrBackendTexture &, GrMtlTextureInfo *)
SK_API bool GetVkImageInfo(const GrBackendTexture &, GrVkImageInfo *)
SK_API bool GetGLTextureInfo(const GrBackendTexture &, GrGLTextureInfo *)
constexpr SkColor4f kTransparent
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
SK_API sk_sp< SkPixelRef > MakeWithData(const SkImageInfo &, size_t rowBytes, sk_sp< SkData > data)
sk_sp< const SkImage > image
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_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
GrTextureProxy * GetTextureImageProxy(SkImage *image, GrRecordingContext *rContext)
sk_sp< SkSurface > MakeBackendTextureSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, const SkSurfaceProps *props)
SkSamplingOptions(SkFilterMode::kLinear))
Enable fReduceOpsTaskSplitting
gr_cp< ID3D12Resource > fResource
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeWH(float w, float h)