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>
This commit is contained in:
parent
94d57c477f
commit
ff2181e62e
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +256,4 @@ void GrGLClearErr(const GrGLInterface* gl);
|
||||
|
||||
GrGLenum GrToGLStencilFunc(GrStencilTest test);
|
||||
|
||||
GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat);
|
||||
|
||||
#endif
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
||||
/**
|
||||
|
@ -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?
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user