Fix DDL tests when MIP map support not available
Change-Id: I6f6b7d7401967aff1ab7444d0f4a594f530a7a6e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212990 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
e246b13a1d
commit
4687bddcea
@ -3990,6 +3990,9 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in
|
|||||||
return GrBackendTexture(); // invalid
|
return GrBackendTexture(); // invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mipMapped == GrMipMapped::kYes && !this->caps()->mipMapSupport()) {
|
||||||
|
return GrBackendTexture();
|
||||||
|
}
|
||||||
int bpp = GrColorTypeBytesPerPixel(colorType);
|
int bpp = GrColorTypeBytesPerPixel(colorType);
|
||||||
const size_t trimRowBytes = w * bpp;
|
const size_t trimRowBytes = w * bpp;
|
||||||
if (!rowBytes) {
|
if (!rowBytes) {
|
||||||
|
@ -72,6 +72,9 @@ public:
|
|||||||
void setColorType(SkColorType ct) { fColorType = ct; }
|
void setColorType(SkColorType ct) { fColorType = ct; }
|
||||||
void setColorSpace(sk_sp<SkColorSpace> cs) { fColorSpace = std::move(cs); }
|
void setColorSpace(sk_sp<SkColorSpace> cs) { fColorSpace = std::move(cs); }
|
||||||
void setTextureable(bool isTextureable) { fIsTextureable = isTextureable; }
|
void setTextureable(bool isTextureable) { fIsTextureable = isTextureable; }
|
||||||
|
void setShouldCreateMipMaps(bool shouldCreateMipMaps) {
|
||||||
|
fShouldCreateMipMaps = shouldCreateMipMaps;
|
||||||
|
}
|
||||||
|
|
||||||
// Modify the SurfaceParameters in just one way
|
// Modify the SurfaceParameters in just one way
|
||||||
void modify(int i) {
|
void modify(int i) {
|
||||||
@ -535,6 +538,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMakeRenderTargetTest, reporter, ctxInfo) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!context->priv().caps()->mipMapSupport()) {
|
||||||
|
params.setShouldCreateMipMaps(false);
|
||||||
|
}
|
||||||
sk_sp<SkSurface> s = params.make(context, &backend);
|
sk_sp<SkSurface> s = params.make(context, &backend);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
REPORTER_ASSERT(reporter, !c.isValid());
|
REPORTER_ASSERT(reporter, !c.isValid());
|
||||||
@ -927,6 +933,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLCompatibilityTest, reporter, ctxInfo) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!context->priv().caps()->mipMapSupport()) {
|
||||||
|
params.setShouldCreateMipMaps(false);
|
||||||
|
}
|
||||||
sk_sp<SkSurface> s = params.make(context, &backend);
|
sk_sp<SkSurface> s = params.make(context, &backend);
|
||||||
REPORTER_ASSERT(reporter, s);
|
REPORTER_ASSERT(reporter, s);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
@ -262,6 +262,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
|||||||
sk_sp<GrTextureProxy> proxies[2];
|
sk_sp<GrTextureProxy> proxies[2];
|
||||||
|
|
||||||
// setup dummy textures
|
// setup dummy textures
|
||||||
|
GrMipMapped mipMapped = GrMipMapped(context->priv().caps()->mipMapSupport());
|
||||||
{
|
{
|
||||||
GrSurfaceDesc dummyDesc;
|
GrSurfaceDesc dummyDesc;
|
||||||
dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
|
dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
|
||||||
@ -271,8 +272,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
|||||||
const GrBackendFormat format =
|
const GrBackendFormat format =
|
||||||
context->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
|
context->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
|
||||||
proxies[0] = proxyProvider->createProxy(format, dummyDesc, kBottomLeft_GrSurfaceOrigin,
|
proxies[0] = proxyProvider->createProxy(format, dummyDesc, kBottomLeft_GrSurfaceOrigin,
|
||||||
GrMipMapped::kYes, SkBackingFit::kExact,
|
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||||
SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
|
GrInternalSurfaceFlags::kNone);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
GrSurfaceDesc dummyDesc;
|
GrSurfaceDesc dummyDesc;
|
||||||
@ -283,8 +284,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
|||||||
const GrBackendFormat format =
|
const GrBackendFormat format =
|
||||||
context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
|
context->priv().caps()->getBackendFormatFromColorType(kAlpha_8_SkColorType);
|
||||||
proxies[1] = proxyProvider->createProxy(format, dummyDesc, kTopLeft_GrSurfaceOrigin,
|
proxies[1] = proxyProvider->createProxy(format, dummyDesc, kTopLeft_GrSurfaceOrigin,
|
||||||
GrMipMapped::kYes, SkBackingFit::kExact,
|
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||||
SkBudgeted::kNo, GrInternalSurfaceFlags::kNone);
|
GrInternalSurfaceFlags::kNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!proxies[0] || !proxies[1]) {
|
if (!proxies[0] || !proxies[1]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user