diff options
author | Brian Osman <brianosman@google.com> | 2017-06-01 16:18:09 +0000 |
---|---|---|
committer | Brian Osman <brianosman@google.com> | 2017-06-01 16:22:44 +0000 |
commit | c674e2695090723a24fb24c5cec32138f05aa03f (patch) | |
tree | 290a743ad0963e9dbf6e4113d2835b2a546ba258 | |
parent | 69270fbb2b42e2ea6985a83006f40ae9921f1eb3 (diff) |
Revert "Expand texturability testing to cover mip-mapped textures, and fix iOS"
This reverts commit 9f6f41b01bdc8144808e78128676087bfb310a27.
Reason for revert: Command Buffer and ANGLE failures.
Original change's description:
> Expand texturability testing to cover mip-mapped textures, and fix iOS
>
> Don't allow creation of mip-mapped textures when caps says we don't
> support mip-mapping.
>
> Skip testing of mip-mapped resources in the resource size test,
> when creation will fail.
>
> For iOS devices with ES2, the APPLE BGRA8888 extension is more
> trouble than it's worth. Even though it lets the internal and
> external formats not match, it appears that the driver remembers
> the first external format, so subsequent attempts to upload with
> the other swizzle will fail. Up until now, creation of these
> textures was failing anyway, so now just make it more explicit
> that we don't support BGRA in this situation.
>
> BUG=skia:
>
> Change-Id: Ic2e3ba1673398d542edd46a555ef47b5d0979c01
> Reviewed-on: https://skia-review.googlesource.com/18261
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG=skia:
Change-Id: I68f6bb3be9fbafa7366ef5611a12e372274aa648
Reviewed-on: https://skia-review.googlesource.com/18380
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 18 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 23 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 2 |
4 files changed, 10 insertions, 35 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index c75f298807..53b9b46d87 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -65,7 +65,7 @@ bool validate_desc(const GrSurfaceDesc& desc, const GrCaps& caps, int levelCount return false; } } - if (levelCount > 1 && (GrPixelConfigIsSint(desc.fConfig) || !caps.mipMapSupport())) { + if (levelCount > 1 && GrPixelConfigIsSint(desc.fConfig)) { return false; } return true; diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index cb675bdb85..521e2553f0 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -1571,16 +1571,14 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_BGRA; fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_BGRA8; if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { - // This APPLE extension introduces complexity on ES2. It leaves the internal format - // as RGBA, but allows BGRA as the external format. From testing, it appears that the - // driver remembers the external format when the texture is created (with TexImage). - // If you then try to upload data in the other swizzle (with TexSubImage), it fails. - // We could work around this, but it adds even more state tracking to code that is - // already too tricky. Instead, we opt not to support BGRA on ES2 with this extension. - // This also side-steps some ambiguous interactions with the texture storage extension. - if (version >= GR_GL_VER(3,0)) { - // The APPLE extension doesn't make this renderable. - fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; + // The APPLE extension doesn't make this renderable. + fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; + if (version < GR_GL_VER(3,0) && !ctxInfo.hasExtension("GL_EXT_texture_storage")) { + // On ES2 the internal format of a BGRA texture is RGBA with the APPLE extension. + // Though, that seems to not be the case if the texture storage extension is + // present. The specs don't exactly make that clear. + fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA; + fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA8; } } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag | diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 4a20f50089..8c596d915b 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -17,7 +17,6 @@ #include "GrTest.h" #include "GrTexture.h" #include "GrSurfacePriv.h" -#include "SkMipMap.h" #include "Test.h" // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture @@ -100,16 +99,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { desc.fWidth = 64; desc.fHeight = 64; - // Enough space for the first mip of our largest pixel config - const size_t pixelBufferSize = desc.fWidth * desc.fHeight * - GrBytesPerPixel(kRGBA_float_GrPixelConfig); - std::unique_ptr<char[]> pixelData(new char[pixelBufferSize]); - memset(pixelData.get(), 0, pixelBufferSize); - - // We re-use the same mip level objects (with updated pointers and rowBytes) for each config - const int levelCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight); - std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[levelCount]); - for (GrPixelConfig config : configs) { for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { desc.fFlags = kNone_GrSurfaceFlags; @@ -120,18 +109,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigTexturable(desc.fConfig)); - size_t rowBytes = desc.fWidth * GrBytesPerPixel(desc.fConfig); - for (int i = 0; i < levelCount; ++i) { - texels[i].fPixels = pixelData.get(); - texels[i].fRowBytes = rowBytes >> i; - } - sk_sp<GrTextureProxy> proxy = resourceProvider->createMipMappedTexture( - desc, SkBudgeted::kNo, texels.get(), levelCount); - REPORTER_ASSERT(reporter, SkToBool(proxy.get()) == - (caps->isConfigTexturable(desc.fConfig) && - caps->mipMapSupport() && - !GrPixelConfigIsSint(desc.fConfig))); - desc.fFlags = kRenderTarget_GrSurfaceFlag; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigRenderable(config, false)); diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 460d4ee096..08f60ea1c5 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -1714,7 +1714,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { // Mipmapped versions - if (context->caps()->mipMapSupport()) { + { sk_sp<GrTextureProxy> proxy; proxy = make_mipmap_proxy(provider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0); |