diff options
-rw-r--r-- | gm/rectangletexture.cpp | 6 | ||||
-rw-r--r-- | include/core/SkImage.h | 66 | ||||
-rw-r--r-- | include/gpu/GrBackendSurface.h | 6 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 10 | ||||
-rw-r--r-- | src/gpu/GrCaps.cpp | 11 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 55 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 4 | ||||
-rw-r--r-- | src/gpu/mock/GrMockCaps.h | 4 | ||||
-rw-r--r-- | src/gpu/mtl/GrMtlCaps.h | 4 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 54 | ||||
-rw-r--r-- | src/gpu/vk/GrVkCaps.h | 2 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 1 | ||||
-rw-r--r-- | src/image/SkImage.cpp | 14 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 34 | ||||
-rw-r--r-- | tests/GrMipMappedTest.cpp | 8 | ||||
-rw-r--r-- | tests/ImageFilterCacheTest.cpp | 4 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 3 | ||||
-rw-r--r-- | tests/SurfaceSemaphoreTest.cpp | 3 | ||||
-rw-r--r-- | tools/gpu/GrTest.cpp | 3 |
20 files changed, 286 insertions, 8 deletions
diff --git a/gm/rectangletexture.cpp b/gm/rectangletexture.cpp index c71a51c6b6..2fb64be90e 100644 --- a/gm/rectangletexture.cpp +++ b/gm/rectangletexture.cpp @@ -108,11 +108,13 @@ protected: GrGLTextureInfo info; info.fID = id; info.fTarget = TARGET; + info.fFormat = GR_GL_RGBA8; - GrBackendTexture rectangleTex(width, height, kRGBA_8888_GrPixelConfig, info); + GrBackendTexture rectangleTex(width, height, GrMipMapped::kNo, info); if (sk_sp<SkImage> image = SkImage::MakeFromAdoptedTexture(context, rectangleTex, - kTopLeft_GrSurfaceOrigin)) { + kTopLeft_GrSurfaceOrigin, + kRGBA_8888_SkColorType)) { return image; } GR_GL_CALL(gl, DeleteTextures(1, &id)); diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 03d463d098..2a196aac41 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -96,6 +96,9 @@ public: * managing the lifetime of the underlying platform texture. * * Will return NULL if the specified backend texture is unsupported. + * + * DEPRECATED: This factory is deprecated and clients should use the factory below which takes + * an SkColorType. */ static sk_sp<SkImage> MakeFromTexture(GrContext* context, const GrBackendTexture& backendTexture, @@ -112,10 +115,53 @@ public: * no longer is holding a reference to it. * * Will return NULL if the specified backend texture is unsupported. + * + * DEPRECATED: This factory is deprecated and clients should use the factory below which takes + * an SkColorType. + */ + static sk_sp<SkImage> MakeFromTexture(GrContext* context, + const GrBackendTexture& backendTexture, + GrSurfaceOrigin origin, + SkAlphaType alphaType, + sk_sp<SkColorSpace> colorSpace, + TextureReleaseProc textureReleaseProc, + ReleaseContext releaseContext); + + /** + * Create a new image from the specified descriptor. Note - the caller is responsible for + * managing the lifetime of the underlying platform texture. + * + * The GrBackendTexture mush have a valid backed format supplied (GrGLTextureInfo::fFormat, + * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should + * interpret the backend format supplied by the GrBackendTexture. If the format in the + * GrBackendTexture is not compitable with the SkColorType, SkAlphaType, and SkColorSpace we + * will return nullptr. + */ + static sk_sp<SkImage> MakeFromTexture(GrContext* context, + const GrBackendTexture& backendTexture, + GrSurfaceOrigin origin, + SkColorType colorType, + SkAlphaType alphaType, + sk_sp<SkColorSpace> colorSpace) { + return MakeFromTexture(context, backendTexture, origin, colorType, alphaType, colorSpace, + nullptr, nullptr); + } + + /** + * Create a new image from the GrBackendTexture. The underlying platform texture must stay + * valid and unaltered until the specified release-proc is invoked, indicating that Skia + * no longer is holding a reference to it. + * + * The GrBackendTexture mush have a valid backed format supplied (GrGLTextureInfo::fFormat, + * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should + * interpret the backend format supplied by the GrBackendTexture. If the format in the + * GrBackendTexture is not compitable with the SkColorType, SkAlphaType, and SkColorSpace we + * will return nullptr. */ static sk_sp<SkImage> MakeFromTexture(GrContext* context, const GrBackendTexture& backendTexture, GrSurfaceOrigin origin, + SkColorType colorType, SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace, TextureReleaseProc textureReleaseProc, @@ -158,10 +204,30 @@ public: * texture when the image is released. * * Will return NULL if the specified backend texture is unsupported. + * + * DEPRECATED: This factory is deprecated and clients should use the factory below which takes + * an SkColorType. + */ + static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context, + const GrBackendTexture& backendTexture, + GrSurfaceOrigin surfaceOrigin, + SkAlphaType alphaType = kPremul_SkAlphaType, + sk_sp<SkColorSpace> colorSpace = nullptr); + + /** + * Create a new image from the specified descriptor. Note - Skia will delete or recycle the + * texture when the image is released. + * + * The GrBackendTexture mush have a valid backed format supplied (GrGLTextureInfo::fFormat, + * GrVkImageInfo::fFormat, etc.) in it. The passed in SkColorType informs skia how it should + * interpret the backend format supplied by the GrBackendTexture. If the format in the + * GrBackendTexture is not compitable with the SkColorType, SkAlphaType, and SkColorSpace we + * will return nullptr. */ static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context, const GrBackendTexture& backendTexture, GrSurfaceOrigin surfaceOrigin, + SkColorType colorType, SkAlphaType alphaType = kPremul_SkAlphaType, sk_sp<SkColorSpace> colorSpace = nullptr); diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 1eab3577b1..9f77155e39 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -84,8 +84,11 @@ public: private: // Friending for access to the GrPixelConfig friend class SkSurface; + friend class GrCaps; friend class GrGpu; + friend class GrGLCaps; friend class GrGLGpu; + friend class GrVkCaps; friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } @@ -146,8 +149,11 @@ public: private: // Friending for access to the GrPixelConfig friend class SkSurface; + friend class GrCaps; friend class GrGpu; + friend class GrGLCaps; friend class GrGLGpu; + friend class GrVkCaps; friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 6cdc0e3ff6..59e0528a23 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -11,9 +11,11 @@ #include "../private/GrTypesPriv.h" #include "GrBlend.h" #include "GrShaderCaps.h" +#include "SkImageInfo.h" #include "SkRefCnt.h" #include "SkString.h" +class GrBackendTexture; struct GrContextOptions; class GrRenderTargetProxy; class SkJSONWriter; @@ -170,6 +172,13 @@ public: virtual bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, bool* rectsMustMatch, bool* disallowSubrect) const = 0; + /** + * Returns true if the GrBackendTexutre can we used with the supplied SkColorType. If it is + * compatible, the GrPixelConfig on the GrBackendTexture will be set to a config that matches + * the backend format and requested SkColorType. + */ + bool validateBackendTexture(GrBackendTexture* tex, SkColorType ct) const; + protected: /** Subclasses must call this at the end of their constructors in order to apply caps overrides requested by the client. Note that overrides will only reduce the caps never @@ -229,6 +238,7 @@ protected: int fMaxClipAnalyticFPs; private: + virtual bool onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const = 0; virtual void onApplyOptionsOverrides(const GrContextOptions&) {} virtual void onDumpJSON(SkJSONWriter*) const {} diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 2c83cc3bd1..8f6d27dcf2 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -6,6 +6,8 @@ */ #include "GrCaps.h" + +#include "GrBackendSurface.h" #include "GrContextOptions.h" #include "GrWindowRectangles.h" #include "SkJSONWriter.h" @@ -212,3 +214,12 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const { writer->endObject(); } + +bool GrCaps::validateBackendTexture(GrBackendTexture* tex, SkColorType ct) const { + if (!this->onValidateBackendTexture(tex, ct)) { + return false; + } + return this->isConfigTexturable(tex->fConfig); +} + + diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index efc6628266..05e3268dc9 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -2361,3 +2361,58 @@ int GrGLCaps::getSampleCount(int requestedCount, GrPixelConfig config) const { return fConfigTable[config].fColorSampleCounts[count-1]; } +bool GrGLCaps::onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const { + const GrGLTextureInfo* texInfo = tex->getGLTextureInfo(); + if (!texInfo) { + return false; + } + GrGLenum format = texInfo->fFormat; + tex->fConfig = kUnknown_GrPixelConfig; + + switch (ct) { + case kUnknown_SkColorType: + return false; + case kAlpha_8_SkColorType: + if (GR_GL_ALPHA8 == format) { + tex->fConfig = kAlpha_8_as_Alpha_GrPixelConfig; + } else if (GR_GL_R8 == format) { + tex->fConfig = kAlpha_8_as_Red_GrPixelConfig; + } + break; + case kRGB_565_SkColorType: + if (GR_GL_RGB565 == format) { + tex->fConfig = kRGB_565_GrPixelConfig; + } + break; + case kARGB_4444_SkColorType: + if (GR_GL_RGBA4 == format) { + tex->fConfig = kRGBA_4444_GrPixelConfig; + } + break; + case kRGBA_8888_SkColorType: + if (GR_GL_RGBA8 == format) { + tex->fConfig = kRGBA_8888_GrPixelConfig; + } + break; + case kBGRA_8888_SkColorType: + if (GR_GL_BGRA8 == format) { + tex->fConfig = kBGRA_8888_GrPixelConfig; + } + break; + case kGray_8_SkColorType: + if (GR_GL_LUMINANCE8 == format) { + tex->fConfig = kGray_8_as_Lum_GrPixelConfig; + } else if (GR_GL_R8 == format) { + tex->fConfig = kGray_8_as_Red_GrPixelConfig; + } + break; + case kRGBA_F16_SkColorType: + if (GR_GL_RGBA16F == format) { + tex->fConfig = kRGBA_half_GrPixelConfig; + } + break; + } + + return kUnknown_GrPixelConfig != tex->fConfig; +} + diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 3a50e8a393..38cbfe8747 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -416,6 +416,8 @@ public: } private: + bool onValidateBackendTexture(GrBackendTexture*, SkColorType) const override; + enum ExternalFormatUsage { kTexImage_ExternalFormatUsage, kOther_ExternalFormatUsage, diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 95eb339db8..7b66bcc8a1 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -4421,6 +4421,8 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, i return GrBackendTexture(); // invalid } + info.fFormat = this->glCaps().configSizedInternalFormat(config); + this->unbindCpuToGpuXferBuffer(); // Figure out the number of mip levels. @@ -4447,7 +4449,7 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, i height = SkTMax(1, height / 2); } - return GrBackendTexture(w, h, config, mipMapped, info); + return GrBackendTexture(w, h, mipMapped, info); } bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 47a5002f96..37bde8201c 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -52,6 +52,10 @@ public: } private: + bool onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const override { + return SkToBool(tex->getMockTextureInfo()); + } + GrMockOptions fOptions; typedef GrCaps INHERITED; }; diff --git a/src/gpu/mtl/GrMtlCaps.h b/src/gpu/mtl/GrMtlCaps.h index 3f2adf8f7d..bc8aac9f8e 100644 --- a/src/gpu/mtl/GrMtlCaps.h +++ b/src/gpu/mtl/GrMtlCaps.h @@ -57,6 +57,10 @@ public: } private: + bool onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const override { + return false; + } + void initFeatureSet(MTLFeatureSet featureSet); void initGrCaps(const id<MTLDevice> device); diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 9e48983884..17253a0e04 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -6,6 +6,8 @@ */ #include "GrVkCaps.h" + +#include "GrBackendSurface.h" #include "GrRenderTargetProxy.h" #include "GrShaderCaps.h" #include "GrVkUtil.h" @@ -413,3 +415,55 @@ int GrVkCaps::getSampleCount(int requestedCount, GrPixelConfig config) const { return fConfigTable[config].fColorSampleCounts[count-1]; } +bool GrVkCaps::onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const { + const GrVkImageInfo* imageInfo = tex->getVkImageInfo(); + if (!imageInfo) { + return false; + } + VkFormat format = imageInfo->fFormat; + tex->fConfig = kUnknown_GrPixelConfig; + + switch (ct) { + case kUnknown_SkColorType: + return false; + case kAlpha_8_SkColorType: + if (VK_FORMAT_R8_UNORM == format) { + tex->fConfig = kAlpha_8_as_Red_GrPixelConfig; + } + break; + case kRGB_565_SkColorType: + if (VK_FORMAT_R5G6B5_UNORM_PACK16 == format) { + tex->fConfig = kRGB_565_GrPixelConfig; + } + break; + case kARGB_4444_SkColorType: + if (VK_FORMAT_B4G4R4A4_UNORM_PACK16 == format) { + tex->fConfig = kRGBA_4444_GrPixelConfig; + } + break; + case kRGBA_8888_SkColorType: + if (VK_FORMAT_R8G8B8A8_UNORM == format) { + tex->fConfig = kRGBA_8888_GrPixelConfig; + } + break; + case kBGRA_8888_SkColorType: + if (VK_FORMAT_B8G8R8A8_UNORM == format) { + tex->fConfig = kBGRA_8888_GrPixelConfig; + } + break; + case kGray_8_SkColorType: + if (VK_FORMAT_R8_UNORM == format) { + tex->fConfig = kGray_8_as_Red_GrPixelConfig; + } + break; + case kRGBA_F16_SkColorType: + if (VK_FORMAT_R16G16B16A16_SFLOAT == format) { + tex->fConfig = kRGBA_half_GrPixelConfig; + } + break; + } + + return kUnknown_GrPixelConfig != tex->fConfig; +} + + diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h index 1a6e1bd32a..8d0ab5dd8a 100644 --- a/src/gpu/vk/GrVkCaps.h +++ b/src/gpu/vk/GrVkCaps.h @@ -112,6 +112,8 @@ public: bool* rectsMustMatch, bool* disallowSubrect) const override; private: + bool onValidateBackendTexture(GrBackendTexture*, SkColorType) const override; + enum VkVendor { kAMD_VkVendor = 4098, kImagination_VkVendor = 4112, diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 5fdf58e406..baf022185f 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -2200,3 +2200,4 @@ sk_sp<GrSemaphore> GrVkGpu::prepareTextureForCrossContextUsage(GrTexture* textur // The image layout change serves as a barrier, so no semaphore is needed return nullptr; } + diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 09796cdd34..6b35a12ff0 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -364,6 +364,13 @@ sk_sp<SkImage> SkImage::MakeFromDeferredTextureImageData(GrContext* context, con return nullptr; } +sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs, + TextureReleaseProc releaseP, ReleaseContext releaseC) { + return nullptr; +} + bool SkImage::MakeBackendTextureFromSkImage(GrContext*, sk_sp<SkImage>, GrBackendTexture*, @@ -377,6 +384,13 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, return nullptr; } +sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkColorType ct, SkAlphaType at, + sk_sp<SkColorSpace> cs) { + return nullptr; +} + sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace space, const GrBackendObject yuvTextureHandles[3], const SkISize yuvSizes[3], diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 8766dadeab..bf80ac0743 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -301,6 +301,29 @@ sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, releaseP, releaseC); } +bool validate_backend_texture(GrContext* ctx, GrBackendTexture* tex, + SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs) { + // TODO: Create a SkImageColorInfo struct for color, alpha, and color space so we don't need to + // create a fake image info here. + SkImageInfo info = SkImageInfo::Make(1, 1, ct, at, cs); + if (!SkImageInfoIsValidAllowNumericalCS(info)) { + return false; + } + + return ctx->caps()->validateBackendTexture(tex, ct); +} + +sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs, + TextureReleaseProc releaseP, ReleaseContext releaseC) { + GrBackendTexture texCopy = tex; + if (!validate_backend_texture(ctx, &texCopy, ct, at, cs)) { + return nullptr; + } + return MakeFromTexture(ctx, texCopy, origin, at, cs, releaseP, releaseC); +} + sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, const GrBackendTexture& tex, GrSurfaceOrigin origin, SkAlphaType at, sk_sp<SkColorSpace> cs) { @@ -308,6 +331,17 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, nullptr, nullptr); } +sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx, + const GrBackendTexture& tex, GrSurfaceOrigin origin, + SkColorType ct, SkAlphaType at, + sk_sp<SkColorSpace> cs) { + GrBackendTexture texCopy = tex; + if (!validate_backend_texture(ctx, &texCopy, ct, at, cs)) { + return nullptr; + } + return MakeFromAdoptedTexture(ctx, texCopy, origin, at, cs); +} + static GrBackendTexture make_backend_texture_from_handle(GrBackend backend, int width, int height, GrPixelConfig config, diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index 58faec4f8b..91fba5f919 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -61,7 +61,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { } else { image = SkImage::MakeFromTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, - kPremul_SkAlphaType, nullptr); + kRGBA_8888_SkColorType, + kPremul_SkAlphaType, nullptr, + nullptr, nullptr); proxy = as_IB(image)->asTextureProxyRef(); } REPORTER_ASSERT(reporter, proxy); @@ -108,7 +110,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, - kPremul_SkAlphaType, nullptr); + kRGBA_8888_SkColorType, + kPremul_SkAlphaType, nullptr, + nullptr, nullptr); GrTextureProxy* proxy = as_IB(image)->peekProxy(); REPORTER_ASSERT(reporter, proxy); diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index bcd451127b..fb9d04b01d 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -221,7 +221,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context, backendTex, texOrigin, - kPremul_SkAlphaType, nullptr)); + kRGBA_8888_SkColorType, + kPremul_SkAlphaType, nullptr, + nullptr, nullptr)); if (!srcImage) { return; } diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 1415bcb67d..ff058f2ec7 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -730,7 +730,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTextureRelease, reporter, c TextureReleaseChecker releaseChecker; GrSurfaceOrigin texOrigin = kBottomLeft_GrSurfaceOrigin; sk_sp<SkImage> refImg( - SkImage::MakeFromTexture(ctx, backendTex, texOrigin, kPremul_SkAlphaType, nullptr, + SkImage::MakeFromTexture(ctx, backendTex, texOrigin, kRGBA_8888_SkColorType, + kPremul_SkAlphaType, nullptr, TextureReleaseChecker::Release, &releaseChecker)); GrSurfaceOrigin readBackOrigin; diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp index 8ae0953d88..b4f63fec41 100644 --- a/tests/SurfaceSemaphoreTest.cpp +++ b/tests/SurfaceSemaphoreTest.cpp @@ -83,7 +83,10 @@ void draw_child(skiatest::Reporter* reporter, sk_sp<SkImage> childImage = SkImage::MakeFromTexture(childCtx, backendTexture, kTopLeft_GrSurfaceOrigin, + kRGBA_8888_SkColorType, kPremul_SkAlphaType, + nullptr, + nullptr, nullptr); SkCanvas* childCanvas = childSurface->getCanvas(); diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 552dd8a67e..f511574726 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -67,7 +67,8 @@ GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height, #endif case kOpenGL_GrBackend: { GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle); - return GrBackendTexture(width, height, config, mipMapped, *glInfo); + SkASSERT(glInfo->fFormat); + return GrBackendTexture(width, height, mipMapped, *glInfo); } case kMock_GrBackend: { GrMockTextureInfo* mockInfo = (GrMockTextureInfo*)(handle); |