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());
105 for (
auto mipmapped : { Mipmapped::kNo, Mipmapped::kYes }) {
106 for (
auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
110 auto mbet = sk_gpu_test::ManagedBackendTexture::MakeWithData(dContext,
125 if (renderable == GrRenderable::kYes) {
134 sk_gpu_test::ManagedBackendTexture::ReleaseProc,
135 mbet->releaseContext());
138 proxy =
device->readSurfaceView().asTextureProxyRef();
146 sk_gpu_test::ManagedBackendTexture::ReleaseProc,
147 mbet->releaseContext());
164 if (mipmapped == Mipmapped::kYes) {
166 if (GrRenderable::kYes == renderable) {
184 using namespace skgpu;
186 auto dContext = ctxInfo.directContext();
187 if (!dContext->priv().caps()->mipmapSupport()) {
191 Protected isProtected =
Protected(dContext->priv().caps()->supportsProtectedContent());
193 for (
auto betMipmapped : { Mipmapped::kNo, Mipmapped::kYes }) {
194 for (
auto requestMipmapped : { Mipmapped::kNo, Mipmapped::kYes }) {
240 genProxy->
instantiate(dContext->priv().resourceProvider());
263 if (requestMipmapped == Mipmapped::kYes && betMipmapped == Mipmapped::kNo) {
279 if (requestMipmapped == Mipmapped::kYes && betMipmapped == Mipmapped::kNo) {
291 GrMtlTextureInfo genImageInfo;
292 GrMtlTextureInfo origImageInfo;
295 if (requestMipmapped == Mipmapped::kYes && betMipmapped == Mipmapped::kNo) {
309 if (genBackendTex.getD3DTextureResourceInfo(&genImageInfo) &&
310 backendTex.getD3DTextureResourceInfo(&origImageInfo)) {
311 if (requestMipmapped == Mipmapped::kYes && betMipmapped == Mipmapped::kNo) {
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}) {
348 willUseMips ? skgpu::Mipmapped::kYes : skgpu::Mipmapped::kNo;
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);
440 skgpu::Mipmapped::kNo,
444 "DrawMipMapViewTest");
448 std::move(renderTarget),
453 sdc->drawTexture(
nullptr,
454 std::move(mipmapView),
456 GrSamplerState::Filter::kLinear,
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");
490 SkASSERT(dContext->priv().caps()->mipmapSupport());
506 skgpu::Mipmapped::kYes,
510 "ManyDependentsMipMappedTest");
514 mipmapProxy->markMipmapsClean();
527 mipmapSDC->testingOnly_PeekLastOpsTask() ==
538 mipmapView, MipmapMode::kLinear);
539 auto sdc1Task =
sk_ref_sp(sdc1->testingOnly_PeekLastOpsTask());
548 initialMipmapRegenTask != mipmapSDC->testingOnly_PeekLastOpsTask());
553 mipmapView, MipmapMode::kLinear);
554 auto sdc2Task =
sk_ref_sp(sdc2->testingOnly_PeekLastOpsTask());
559 SkASSERT(!mipmapProxy->mipmapsAreDirty());
562 dContext->flushAndSubmit();
570 auto mipmapRTCTask =
sk_ref_sp(mipmapSDC->testingOnly_PeekLastOpsTask());
582 mipmapView, MipmapMode::kNone);
595 std::move(mipmapView), MipmapMode::kLinear);
596 sdc2Task =
sk_ref_sp(sdc2->testingOnly_PeekLastOpsTask());
603 SkASSERT(!mipmapProxy->mipmapsAreDirty());
606 dContext->flushAndSubmit();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr int kSize
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 DEF_GANESH_TEST(name, reporter, options, ctsEnforcement)
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info, ctsEnforcement)
static std::unique_ptr< GrTextureGenerator > Make(const sk_sp< GrTexture > &, GrSurfaceOrigin, std::unique_ptr< GrSemaphore >, SkColorType, SkAlphaType, sk_sp< SkColorSpace >)
GrBackendApi backend() const
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
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)
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 instantiate(GrResourceProvider *) override
GrTextureProxy * asTextureProxy() 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< 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)
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)