diff options
author | Greg Daniel <egdaniel@google.com> | 2018-07-02 16:47:38 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-03 13:41:13 +0000 |
commit | ff2181e62e79ffd2ce628fc8c05b5457d4f54163 (patch) | |
tree | 5185ca093986d1ee49dd3abfa93a00991c77ac7a | |
parent | 94d57c477fe122c146a034c625cebb6c44ef21b0 (diff) |
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>
-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, 63 insertions, 176 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 7f05bb50ee..dc13795435 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -128,23 +128,6 @@ 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, @@ -209,7 +192,12 @@ public: bool isValid() const { return fIsValid; } #if GR_TEST_UTILS - GrPixelConfig testingOnly_getPixelConfig() const; + // 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; } + static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&); #endif @@ -218,6 +206,7 @@ private: friend class SkImage; friend class SkImage_Gpu; friend class SkSurface; + friend class GrAHardwareBufferImageGenerator; friend class GrBackendTextureImageGenerator; friend class GrProxyProvider; friend class GrGpu; @@ -266,17 +255,6 @@ 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, @@ -348,7 +326,12 @@ public: #if GR_TEST_UTILS - GrPixelConfig testingOnly_getPixelConfig() const; + // 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; } + static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&); #endif diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp index e3ae782d9a..40be392230 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -213,12 +213,14 @@ sk_sp<GrTextureProxy> GrAHardwareBufferImageGenerator::makeProxy(GrContext* cont return nullptr; } - GrBackendTexture backendTex(getInfo().width(), getInfo().height(), pixelConfig, textureInfo); + GrBackendTexture backendTex(getInfo().width(), getInfo().height(), GrMipMapped::kNo, + 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 9977555093..7e10cb20a2 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(GrVkFormatToPixelConfig(vkInfo.fFormat)) + , fConfig(kUnknown_GrPixelConfig) , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1)) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo, layout.release()) { @@ -117,28 +117,6 @@ 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, @@ -146,7 +124,7 @@ GrBackendTexture::GrBackendTexture(int width, : fIsValid(true) , fWidth(width) , fHeight(height) - , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat)) + , fConfig(kUnknown_GrPixelConfig) , fMipMapped(mipMapped) , fBackend(kOpenGL_GrBackend) , fGLInfo(glInfo) {} @@ -334,7 +312,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(0) // We always create stencil buffers internally for vulkan - , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat)) + , fConfig(kUnknown_GrPixelConfig) , fBackend(kVulkan_GrBackend) , fVkInfo(vkInfo, layout.release()) {} #endif @@ -354,24 +332,6 @@ 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, @@ -382,7 +342,7 @@ GrBackendRenderTarget::GrBackendRenderTarget(int width, , fHeight(height) , fSampleCnt(SkTMax(1, sampleCnt)) , fStencilBits(stencilBits) - , fConfig(GrGLSizedFormatToPixelConfig(glInfo.fFormat)) + , fConfig(kUnknown_GrPixelConfig) , fBackend(kOpenGL_GrBackend) , fGLInfo(glInfo) {} diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index d5c3cc3de2..58aad4d18e 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3975,7 +3975,11 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in // unbind the texture from the texture unit to avoid asserts GL_CALL(BindTexture(info.fTarget, 0)); - return GrBackendTexture(w, h, mipMapped, info); + 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; } bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -4069,7 +4073,11 @@ GrBackendRenderTarget GrGLGpu::createTestingOnlyBackendRenderTarget(int w, int h return {}; } auto stencilBits = SkToInt(this->glCaps().stencilFormats()[sFormatIdx].fStencilBits); - return {w, h, 1, stencilBits, config, info}; + 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; } void GrGLGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& backendRT) { diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index e785c1e2f6..3732b481a9 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -532,40 +532,3 @@ 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 039c1eea78..909c8fd7d5 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -256,6 +256,4 @@ 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 ba1f7caf2d..ed45c55758 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -1359,7 +1359,11 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(const void* srcData, i &info)) { return {}; } - return GrBackendTexture(w, h, info); + 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; } bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -1409,7 +1413,11 @@ GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h &info)) { return {}; } - return {w, h, 1, 0, info}; + 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; } void GrVkGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& rt) { diff --git a/src/gpu/vk/GrVkUtil.cpp b/src/gpu/vk/GrVkUtil.cpp index 2b0bba732d..b0aa3d4c14 100644 --- a/src/gpu/vk/GrVkUtil.cpp +++ b/src/gpu/vk/GrVkUtil.cpp @@ -75,40 +75,6 @@ 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 71cc5d4e6a..7c56c6941f 100644 --- a/src/gpu/vk/GrVkUtil.h +++ b/src/gpu/vk/GrVkUtil.h @@ -33,11 +33,6 @@ 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 94cbaf9c17..51da718953 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -153,7 +153,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { } // Wrap this texture ID in a GrTexture - GrBackendTexture backendTex(kSize, kSize, kRGBA_8888_GrPixelConfig, externalTexture); + GrBackendTexture backendTex(kSize, kSize, GrMipMapped::kNo, externalTexture); + backendTex.setPixelConfig(kRGBA_8888_GrPixelConfig); // 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 2edf8b5706..14df879174 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -854,6 +854,7 @@ 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 a1f8b8b234..406d1d1fad 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.testingOnly_getPixelConfig(), SkBudgeted::kNo); + backendRT.pixelConfig(), SkBudgeted::kNo); static constexpr int kExpectedNumSamples = 1; check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), kExpectedNumSamples, SkBackingFit::kExact, @@ -238,12 +238,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { fboInfo.fFBOID = 0; static constexpr int kStencilBits = 8; GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, - kStencilBits, config, fboInfo); + kStencilBits, fboInfo); + backendRT.setPixelConfig(config); sk_sp<GrSurfaceProxy> sProxy( proxyProvider->wrapBackendRenderTarget(backendRT, origin)); check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo); + backendRT.pixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, 0); @@ -264,7 +265,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); + backendTex.pixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, @@ -289,7 +290,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); + backendTex.pixelConfig(), SkBudgeted::kNo); check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(), supportedNumSamples, SkBackingFit::kExact, @@ -315,7 +316,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, - backendTex.testingOnly_getPixelConfig(), SkBudgeted::kNo); + backendTex.pixelConfig(), SkBudgeted::kNo); check_texture(reporter, resourceProvider, sProxy->asTextureProxy(), SkBackingFit::kExact); diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index e473ed86f3..b3846a1bcb 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -119,7 +119,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { rectangleInfo.fID = rectTexID; rectangleInfo.fTarget = GR_GL_TEXTURE_RECTANGLE; - GrBackendTexture rectangleTex(kWidth, kHeight, kRGBA_8888_GrPixelConfig, rectangleInfo); + GrBackendTexture rectangleTex(kWidth, kHeight, GrMipMapped::kNo, rectangleInfo); + rectangleTex.setPixelConfig(kRGBA_8888_GrPixelConfig); GrColor refPixels[kWidth * kHeight]; for (int y = 0; y < kHeight; ++y) { diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index 0225f14cbc..15e3ef6d9f 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -106,6 +106,7 @@ 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 2bfcd4abd6..312cc01b6c 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -47,6 +47,7 @@ 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); @@ -58,6 +59,7 @@ 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); @@ -68,6 +70,7 @@ 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); @@ -80,10 +83,12 @@ 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); @@ -93,6 +98,7 @@ 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); } @@ -103,6 +109,7 @@ 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); } @@ -130,6 +137,7 @@ 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); @@ -141,6 +149,7 @@ 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); @@ -151,6 +160,7 @@ 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 7ec66bbd68..890d26a2ab 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -294,17 +294,6 @@ 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. |