diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-03 16:38:32 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-03 16:38:45 +0000 |
commit | 34aa059c1502d67c9a5f4db449667a8709b69fb9 (patch) | |
tree | 0fc7a5e33d505ae119b56cc58b4fd55f96654073 | |
parent | b6307340e8a6a9d3a7517def7f5eaaadffd07d14 (diff) |
Revert "Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors."
This reverts commit ff2181e62e79ffd2ce628fc8c05b5457d4f54163.
Reason for revert: suspect it's behind Chrome roll failure
Original change's description:
> Remove setting/use of GrPixelConfig in GrBackendTex/RT ctors.
>
> Bug: skia:
> Change-Id: I1466668e3502cd1e6e1f6aed4105e0f626d293dd
> Reviewed-on: https://skia-review.googlesource.com/138987
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I4cba44858aafffbadc45e18349b93c741d7cfc66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/139220
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
-rw-r--r-- | include/gpu/GrBackendSurface.h | 43 | ||||
-rw-r--r-- | src/gpu/GrAHardwareBufferImageGenerator.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrBackendSurface.cpp | 48 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 12 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.cpp | 37 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.h | 2 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 12 | ||||
-rw-r--r-- | src/gpu/vk/GrVkUtil.cpp | 34 | ||||
-rw-r--r-- | src/gpu/vk/GrVkUtil.h | 5 | ||||
-rw-r--r-- | tests/EGLImageTest.cpp | 3 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 1 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 13 | ||||
-rw-r--r-- | tests/RectangleTextureTest.cpp | 3 | ||||
-rw-r--r-- | tests/TextureProxyTest.cpp | 1 | ||||
-rw-r--r-- | tests/VkWrapTests.cpp | 10 | ||||
-rw-r--r-- | tools/gpu/GrTest.cpp | 11 |
16 files changed, 176 insertions, 63 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index dc13795435..7f05bb50ee 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -128,6 +128,23 @@ public: // Creates an invalid backend texture. GrBackendTexture() : fIsValid(false) {} +#if GR_TEST_UTILS + // GrGLTextureInfo::fFormat is ignored + // Deprecated: Should use version that does not take a GrPixelConfig instead + GrBackendTexture(int width, + int height, + GrPixelConfig config, + const GrGLTextureInfo& glInfo); + + // GrGLTextureInfo::fFormat is ignored + // Deprecated: Should use version that does not take a GrPixelConfig instead + GrBackendTexture(int width, + int height, + GrPixelConfig config, + GrMipMapped, + const GrGLTextureInfo& glInfo); +#endif + // The GrGLTextureInfo must have a valid fFormat. GrBackendTexture(int width, int height, @@ -192,12 +209,7 @@ public: bool isValid() const { return fIsValid; } #if GR_TEST_UTILS - // We can remove the pixelConfig getter and setter once we remove the GrPixelConfig from the - // GrBackendTexture and plumb the GrPixelconfig manually throughout our code (or remove all use - // of GrPixelConfig in general). - GrPixelConfig pixelConfig() const { return fConfig; } - void setPixelConfig(GrPixelConfig config) { fConfig = config; } - + GrPixelConfig testingOnly_getPixelConfig() const; static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&); #endif @@ -206,7 +218,6 @@ private: friend class SkImage; friend class SkImage_Gpu; friend class SkSurface; - friend class GrAHardwareBufferImageGenerator; friend class GrBackendTextureImageGenerator; friend class GrProxyProvider; friend class GrGpu; @@ -255,6 +266,17 @@ public: // Creates an invalid backend texture. GrBackendRenderTarget() : fIsValid(false) {} +#if GR_TEST_UTILS + // GrGLTextureInfo::fFormat is ignored + // Deprecated: Should use version that does not take a GrPixelConfig instead + GrBackendRenderTarget(int width, + int height, + int sampleCnt, + int stencilBits, + GrPixelConfig config, + const GrGLFramebufferInfo& glInfo); +#endif + // The GrGLTextureInfo must have a valid fFormat. GrBackendRenderTarget(int width, int height, @@ -326,12 +348,7 @@ public: #if GR_TEST_UTILS - // We can remove the pixelConfig getter and setter once we remove the pixel config from the - // GrBackendRenderTarget and plumb the pixel config manually throughout our code (or remove all - // use of GrPixelConfig in general). - GrPixelConfig pixelConfig() const { return fConfig; } - void setPixelConfig(GrPixelConfig config) { fConfig = config; } - + GrPixelConfig testingOnly_getPixelConfig() const; static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&); #endif diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp index 40be392230..e3ae782d9a 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -213,14 +213,12 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont return nullptr; } - GrBackendTexture backendTex(getInfo().width(), getInfo().height(), GrMipMapped::kNo, - textureInfo); + GrBackendTexture backendTex(getInfo().width(), getInfo().height(), pixelConfig, textureInfo); if (backendTex.width() <= 0 || backendTex.height() <= 0) { glDeleteTextures(1, &texID); eglDestroyImageKHR(display, image); return nullptr; } - backendTex.fConfig = pixelConfig; sk_sp<GrTexture> tex = context->contextPriv().resourceProvider()->wrapBackendTexture( backendTex, kAdopt_GrWrapOwnership); if (!tex) { diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp index 7e10cb20a2..9977555093 100644 --- a/src/gpu/GrBackendSurface.cpp +++ b/src/gpu/GrBackendSurface.cpp @@ -96,7 +96,7 @@ GrBackendTexture::GrBackendTexture(int width, : fIsValid(true) , fWidth(width) , fHeight(height) - , fConfig(kUnknown_GrPixelConfig) + , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1)) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo, layout.release()) { @@ -117,6 +117,28 @@ GrBackendTexture::GrBackendTexture(int width, , fMtlInfo(mtlInfo) {} #endif +#if GR_TEST_UTILS + +GrBackendTexture::GrBackendTexture(int width, + int height, + GrPixelConfig config, + const GrGLTextureInfo& glInfo) + : GrBackendTexture(width, height, config, GrMipMapped::kNo, glInfo) {} + +GrBackendTexture::GrBackendTexture(int width, + int height, + GrPixelConfig config, + GrMipMapped mipMapped, + const GrGLTextureInfo& glInfo) + : fIsValid(true) + , fWidth(width) + , fHeight(height) + , fConfig(config) + , fMipMapped(mipMapped) + , fBackend(kOpenGL_GrBackend) + , fGLInfo(glInfo) {} +#endif + GrBackendTexture::GrBackendTexture(int width, int height, GrMipMapped mipMapped, @@ -124,7 +146,7 @@ GrBackendTexture::GrBackendTexture(int width, : fIsValid(true) , fWidth(width) , fHeight(height) - , fConfig(kUnknown_GrPixelConfig) + , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat)) , fMipMapped(mipMapped) , fBackend(kOpenGL_GrBackend) , fGLInfo(glInfo) {} @@ -312,7 +334,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(0) // We always create stencil buffers internally for vulkan - , fConfig(kUnknown_GrPixelConfig) + , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo, layout.release()) {} #endif @@ -332,6 +354,24 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fMtlInfo(mtlInfo) {} #endif +#if GR_TEST_UTILS + +GrBackendRenderTarget::GrBackendRenderTarget(int width, + int height, + int sampleCnt, + int stencilBits, + GrPixelConfig config, + const GrGLFramebufferInfo& glInfo) + : fIsValid(true) + , fWidth(width) + , fHeight(height) + , fSampleCnt(SkTMax(1, sampleCnt)) + , fStencilBits(stencilBits) + , fConfig(config) + , fBackend(kOpenGL_GrBackend) + , fGLInfo(glInfo) {} +#endif + GrBackendRenderTarget::GrBackendRenderTarget(int width, int height, int sampleCnt, @@ -342,7 +382,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(stencilBits) - , fConfig(kUnknown_GrPixelConfig) + , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat)) , fBackend(kOpenGL_GrBackend) , fGLInfo(glInfo) {} diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 58aad4d18e..d5c3cc3de2 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3975,11 +3975,7 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in // unbind the texture from the texture unit to avoid asserts GL_CALL(BindTexture(info.fTarget, 0)); - GrBackendTexture beTex = GrBackendTexture(w, h, mipMapped, info); - // Lots of tests don't go through Skia's public interface which will set the config so for - // testing we make sure we set a config here. - beTex.setPixelConfig(config); - return beTex; + return GrBackendTexture(w, h, mipMapped, info); } bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -4073,11 +4069,7 @@ GrBackendRenderTarget GrGLGpu::createTestingOnlyBackendRenderTarget(int w, int h return {}; } auto stencilBits = SkToInt(this->glCaps().stencilFormats()[sFormatIdx].fStencilBits); - GrBackendRenderTarget beRT = GrBackendRenderTarget(w, h, 1, stencilBits, info); - // Lots of tests don't go through Skia's public interface which will set the config so for - // testing we make sure we set a config here. - beRT.setPixelConfig(config); - return beRT; + return {w, h, 1, stencilBits, config, info}; } void GrGLGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& backendRT) { diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index 3732b481a9..e785c1e2f6 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -532,3 +532,40 @@ GrGLenum GrToGLStencilFunc(GrStencilTest test) { return gTable[(int)test]; } +GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat) { + switch (sizedFormat) { + case GR_GL_R8: + return kAlpha_8_as_Red_GrPixelConfig; + case GR_GL_ALPHA8: + return kAlpha_8_as_Alpha_GrPixelConfig; + case GR_GL_RGBA8: + return kRGBA_8888_GrPixelConfig; + case GR_GL_RGB8: + return kRGB_888_GrPixelConfig; + case GR_GL_BGRA8: + return kBGRA_8888_GrPixelConfig; + case GR_GL_SRGB8_ALPHA8: + return kSRGBA_8888_GrPixelConfig; + case GR_GL_RGB565: + return kRGB_565_GrPixelConfig; + case GR_GL_RGB5: + return kRGB_565_GrPixelConfig; + case GR_GL_RGBA4: + return kRGBA_4444_GrPixelConfig; + case GR_GL_RGB10_A2: + return kRGBA_1010102_GrPixelConfig; + case GR_GL_LUMINANCE8: + return kGray_8_GrPixelConfig; + case GR_GL_RGBA32F: + return kRGBA_float_GrPixelConfig; + case GR_GL_RG32F: + return kRG_float_GrPixelConfig; + case GR_GL_R16F: + return kAlpha_half_as_Red_GrPixelConfig; + case GR_GL_RGBA16F: + return kRGBA_half_GrPixelConfig; + default: + return kUnknown_GrPixelConfig; + } +} + diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index 909c8fd7d5..039c1eea78 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -256,4 +256,6 @@ void GrGLClearErr(const GrGLInterface* gl); GrGLenum GrToGLStencilFunc(GrStencilTest test); +GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat); + #endif diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index ed45c55758..ba1f7caf2d 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1359,11 +1359,7 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(const void* srcData, i &info)) { return {}; } - GrBackendTexture beTex = GrBackendTexture(w, h, info); - // Lots of tests don't go through Skia's public interface which will set the config so for - // testing we make sure we set a config here. - beTex.setPixelConfig(config); - return beTex; + return GrBackendTexture(w, h, info); } bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -1413,11 +1409,7 @@ GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h &info)) { return {}; } - GrBackendRenderTarget beRT = GrBackendRenderTarget(w, h, 1, 0, info); - // Lots of tests don't go through Skia's public interface which will set the config so for - // testing we make sure we set a config here. - beRT.setPixelConfig(config); - return beRT; + return {w, h, 1, 0, info}; } void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) { diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp index b0aa3d4c14..2b0bba732d 100644 --- a/src/gpu/vk/GrVkUtil.cpp +++ b/src/gpu/vk/GrVkUtil.cpp @@ -75,6 +75,40 @@ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format) { return false; } +GrPixelConfig GrVkFormatToPixelConfig(VkFormat format) { + switch (format) { + case VK_FORMAT_R8G8B8A8_UNORM: + return kRGBA_8888_GrPixelConfig; + case VK_FORMAT_B8G8R8A8_UNORM: + return kBGRA_8888_GrPixelConfig; + case VK_FORMAT_R8G8B8A8_SRGB: + return kSRGBA_8888_GrPixelConfig; + case VK_FORMAT_B8G8R8A8_SRGB: + return kSBGRA_8888_GrPixelConfig; + case VK_FORMAT_A2B10G10R10_UNORM_PACK32: + return kRGBA_1010102_GrPixelConfig; + case VK_FORMAT_R5G6B5_UNORM_PACK16: + return kRGB_565_GrPixelConfig; + break; + case VK_FORMAT_B4G4R4A4_UNORM_PACK16: + // R4G4B4A4 is not required to be supported so we actually + // store RGBA_4444 data as B4G4R4A4. + return kRGBA_4444_GrPixelConfig; + case VK_FORMAT_R8_UNORM: + return kAlpha_8_GrPixelConfig; + case VK_FORMAT_R32G32B32A32_SFLOAT: + return kRGBA_float_GrPixelConfig; + case VK_FORMAT_R32G32_SFLOAT: + return kRG_float_GrPixelConfig; + case VK_FORMAT_R16G16B16A16_SFLOAT: + return kRGBA_half_GrPixelConfig; + case VK_FORMAT_R16_SFLOAT: + return kAlpha_half_GrPixelConfig; + default: + return kUnknown_GrPixelConfig; + } +} + bool GrVkFormatPixelConfigPairIsValid(VkFormat format, GrPixelConfig config) { switch (format) { case VK_FORMAT_R8G8B8A8_UNORM: diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h index 7c56c6941f..71cc5d4e6a 100644 --- a/src/gpu/vk/GrVkUtil.h +++ b/src/gpu/vk/GrVkUtil.h @@ -33,6 +33,11 @@ class GrVkGpu; */ bool GrPixelConfigToVkFormat(GrPixelConfig config, VkFormat* format); +/** +* Returns the GrPixelConfig for the given vulkan texture format +*/ +GrPixelConfig GrVkFormatToPixelConfig(VkFormat format); + bool GrVkFormatIsSupported(VkFormat); /** diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 51da718953..94cbaf9c17 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -153,8 +153,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { } // Wrap this texture ID in a GrTexture - GrBackendTexture backendTex(kSize, kSize, GrMipMapped::kNo, externalTexture); - backendTex.setPixelConfig(kRGBA_8888_GrPixelConfig); + GrBackendTexture backendTex(kSize, kSize, kRGBA_8888_GrPixelConfig, externalTexture); // TODO: If I make this TopLeft origin to match resolve_origin calls for kDefault, this test // fails on the Nexus5. Why? diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 14df879174..2edf8b5706 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -854,7 +854,6 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTextureRelease, reporter, c GrSurfaceOrigin readBackOrigin; GrBackendTexture readBackBackendTex = refImg->getBackendTexture(false, &readBackOrigin); - readBackBackendTex.setPixelConfig(kRGBA_8888_GrPixelConfig); if (!GrBackendTexture::TestingOnly_Equals(readBackBackendTex, backendTex)) { ERRORF(reporter, "backend mismatch\n"); } diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 406d1d1fad..a1f8b8b234 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -214,7 +214,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { sk_sp<GrSurfaceProxy> sProxy( proxyProvider->wrapBackendRenderTarget(backendRT, origin)); check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendRT.pixelConfig(), SkBudgeted::kNo); + backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo); static constexpr int kExpectedNumSamples = 1; check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), kExpectedNumSamples, SkBackingFit::kExact, @@ -238,13 +238,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { fboInfo.fFBOID = 0; static constexpr int kStencilBits = 8; GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, - kStencilBits, fboInfo); - backendRT.setPixelConfig(config); + kStencilBits, config, fboInfo); sk_sp<GrSurfaceProxy> sProxy( proxyProvider->wrapBackendRenderTarget(backendRT, origin)); check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendRT.pixelConfig(), SkBudgeted::kNo); + backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, 0); @@ -265,7 +264,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.pixelConfig(), SkBudgeted::kNo); + backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, @@ -290,7 +289,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.pixelConfig(), SkBudgeted::kNo); + backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, @@ -316,7 +315,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.pixelConfig(), SkBudgeted::kNo); + backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); check_texture(reporter, resourceProvider, sProxy->asTextureProxy(), SkBackingFit::kExact); diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index b3846a1bcb..e473ed86f3 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -119,8 +119,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { rectangleInfo.fID = rectTexID; rectangleInfo.fTarget = GR_GL_TEXTURE_RECTANGLE; - GrBackendTexture rectangleTex(kWidth, kHeight, GrMipMapped::kNo, rectangleInfo); - rectangleTex.setPixelConfig(kRGBA_8888_GrPixelConfig); + GrBackendTexture rectangleTex(kWidth, kHeight, kRGBA_8888_GrPixelConfig, rectangleInfo); GrColor refPixels[kWidth * kHeight]; for (int y = 0; y < kHeight; ++y) { diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index 15e3ef6d9f..0225f14cbc 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -106,7 +106,6 @@ static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackin } GrBackendTexture backendTex = (*backingSurface)->getBackendTexture(); - backendTex.setPixelConfig(desc.fConfig); return proxyProvider->wrapBackendTexture(backendTex, kBottomLeft_GrSurfaceOrigin); } diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 312cc01b6c..2bfcd4abd6 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -47,7 +47,6 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = imageInfo; backendCopy.fImage = VK_NULL_HANDLE; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); @@ -59,7 +58,6 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = imageInfo; backendCopy.fAlloc = GrVkAlloc(); GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); @@ -70,7 +68,6 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = imageInfo; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); @@ -83,12 +80,10 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrBackendTexture origBackendTex = gpu->createTestingOnlyBackendTexture(nullptr, kW, kH, kPixelConfig, true, GrMipMapped::kNo); - GrVkImageInfo imageInfo; SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo)); GrBackendRenderTarget origBackendRT(kW, kH, 1, 0, imageInfo); - origBackendRT.setPixelConfig(kPixelConfig); sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(origBackendRT); REPORTER_ASSERT(reporter, rt); @@ -98,7 +93,6 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = imageInfo; backendCopy.fImage = VK_NULL_HANDLE; GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); - backendRT.setPixelConfig(kPixelConfig); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, !rt); } @@ -109,7 +103,6 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { backendCopy.fAlloc = GrVkAlloc(); // can wrap null alloc GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); - backendRT.setPixelConfig(kPixelConfig); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, rt); } @@ -137,7 +130,6 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = imageInfo; backendCopy.fImage = VK_NULL_HANDLE; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); @@ -149,7 +141,6 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = imageInfo; backendCopy.fAlloc = GrVkAlloc(); GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); @@ -160,7 +151,6 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = imageInfo; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - backendTex.setPixelConfig(kPixelConfig); tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); } diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 890d26a2ab..7ec66bbd68 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -294,6 +294,17 @@ void GrDrawingManager::testingOnly_removeOnFlushCallbackObject(GrOnFlushCallback ////////////////////////////////////////////////////////////////////////////// +GrPixelConfig GrBackendTexture::testingOnly_getPixelConfig() const { + return fConfig; +} + +GrPixelConfig GrBackendRenderTarget::testingOnly_getPixelConfig() const { + return fConfig; +} + +////////////////////////////////////////////////////////////////////////////// + + void GrCoverageCountingPathRenderer::testingOnly_drawPathDirectly(const DrawPathArgs& args) { // Call onDrawPath() directly: We want to test paths that might fail onCanDrawPath() simply for // performance reasons, and GrPathRenderer::drawPath() assert that this call returns true. |