diff options
author | Brian Salomon <bsalomon@google.com> | 2018-03-07 13:01:25 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-07 18:22:40 +0000 |
commit | 58389b90cd387533021c109eb28da40c08e0ead5 (patch) | |
tree | 7744ee9c23c74c61aa00a3cc01eff74cedb8f541 /src | |
parent | ab6fd7ef91aeca8a3fbbc6c6670cb89a5a7b6d53 (diff) |
Initial texture data is never flipped when uploaded.
The first bytes of the data always refer to the pixel accessed by texture coord (0, 0).
Change-Id: I708702d90f35b3bc896a48c3c3fd6a0be73f505a
Reviewed-on: https://skia-review.googlesource.com/112261
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
26 files changed, 84 insertions, 101 deletions
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index c7745402db..b345f27998 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -226,8 +226,8 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrProxyProvider* proxyProvid create_circle_profile(sigma * scale, circleR * scale, kProfileTextureWidth)); } - blurProfile = proxyProvider->createTextureProxy(texDesc, kTopLeft_GrSurfaceOrigin, - SkBudgeted::kYes, profile.get(), 0); + blurProfile = + proxyProvider->createTextureProxy(texDesc, SkBudgeted::kYes, profile.get(), 0); if (!blurProfile) { return nullptr; } diff --git a/src/effects/GrCircleBlurFragmentProcessor.fp b/src/effects/GrCircleBlurFragmentProcessor.fp index 2294e0f3ad..ef4c2890f3 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.fp +++ b/src/effects/GrCircleBlurFragmentProcessor.fp @@ -249,7 +249,7 @@ uniform half4 circleData; } blurProfile = proxyProvider->createTextureProxy( - texDesc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes, profile.get(), 0); + texDesc, SkBudgeted::kYes, profile.get(), 0); if (!blurProfile) { return nullptr; } diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 5e15472338..9a9c2d509a 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -72,8 +72,7 @@ bool GrGpu::isACopyNeededForTextureParams(int width, int height, } sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) { + const GrMipLevel texels[], int mipLevelCount) { GR_CREATE_TRACE_MARKER_CONTEXT("GrGpu", "createTexture", fContext); GrSurfaceDesc desc = origDesc; @@ -94,8 +93,7 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted } this->handleDirtyContext(); - sk_sp<GrTexture> tex = - this->onCreateTexture(desc, budgeted, texelsOrigin, texels, mipLevelCount); + sk_sp<GrTexture> tex = this->onCreateTexture(desc, budgeted, texels, mipLevelCount); if (tex) { if (!this->caps()->reuseScratchTextures() && !isRT) { tex->resourcePriv().removeScratchKey(); @@ -111,7 +109,7 @@ sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted } sk_sp<GrTexture> GrGpu::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { - return this->createTexture(desc, budgeted, kTopLeft_GrSurfaceOrigin, nullptr, 0); + return this->createTexture(desc, budgeted, nullptr, 0); } sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex, diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index e7e4ac087f..786fb31107 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -93,20 +93,18 @@ public: * pixel configs can be used as render targets. Support for configs as textures * or render targets can be checked using GrCaps. * - * @param desc describes the texture to be created. - * @param budgeted does this texture count against the resource cache budget? - * @param texelsOrigin origin of the texel data to be uploaded. Ignored if there is - * no initial texel data. - * @param texels array of mipmap levels containing texel data to load. - * Each level begins with full-size palette data for paletted textures. - * It contains width*height texels. If there is only one - * element and it contains nullptr fPixels, texture data is - * uninitialized. - * @param mipLevelCount the number of levels in 'texels' - * @return The texture object if successful, otherwise nullptr. + * @param desc describes the texture to be created. + * @param budgeted does this texture count against the resource cache budget? + * @param texels array of mipmap levels containing texel data to load. + * Each level begins with full-size palette data for paletted textures. + * It contains width*height texels. If there is only one + * element and it contains nullptr fPixels, texture data is + * uninitialized. + * @param mipLevelCount the number of levels in 'texels' + * @return The texture object if successful, otherwise nullptr. */ - sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, GrSurfaceOrigin texelsOrigin, - const GrMipLevel texels[], int mipLevelCount); + sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel texels[], + int mipLevelCount); /** * Simplified createTexture() interface for when there is no initial texel data to upload. @@ -546,7 +544,6 @@ private: // Texture size and sample size will have already been validated in base class before // onCreateTexture is called. virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], int mipLevelCount) = 0; virtual sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) = 0; diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 5b91dd1a0b..536cd137bd 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -176,7 +176,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::createInstantiatedProxy(const GrSurfaceDe } sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(const GrSurfaceDesc& desc, - GrSurfaceOrigin origin, SkBudgeted budgeted, const void* srcData, size_t rowBytes) { ASSERT_SINGLE_OWNER @@ -188,21 +187,20 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(const GrSurfaceDesc& d if (srcData) { GrMipLevel mipLevel = { srcData, rowBytes }; - sk_sp<GrTexture> tex = fResourceProvider->createTexture( - desc, budgeted, SkBackingFit::kExact, origin, mipLevel); + sk_sp<GrTexture> tex = + fResourceProvider->createTexture(desc, budgeted, SkBackingFit::kExact, mipLevel); if (!tex) { return nullptr; } - return this->createWrapped(std::move(tex), origin); + return this->createWrapped(std::move(tex), kTopLeft_GrSurfaceOrigin); } - return this->createProxy(desc, origin, SkBackingFit::kExact, budgeted); + return this->createProxy(desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, budgeted); } sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImage, GrSurfaceFlags flags, - GrSurfaceOrigin origin, int sampleCnt, SkBudgeted budgeted, SkBackingFit fit) { @@ -245,7 +243,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag desc.fConfig = config; sk_sp<GrTextureProxy> proxy = this->createLazyProxy( - [desc, origin, budgeted, srcImage, fit](GrResourceProvider* resourceProvider) { + [desc, budgeted, srcImage, fit](GrResourceProvider* resourceProvider) { if (!resourceProvider) { // Nothing to clean up here. Once the proxy (and thus lambda) is deleted the ref // on srcImage will be released. @@ -255,9 +253,9 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag SkAssertResult(srcImage->peekPixels(&pixMap)); GrMipLevel mipLevel = { pixMap.addr(), pixMap.rowBytes() }; - return resourceProvider->createTexture(desc, budgeted, fit, origin, mipLevel); + return resourceProvider->createTexture(desc, budgeted, fit, mipLevel); }, - desc, origin, GrMipMapped::kNo, renderTargetFlags, fit, budgeted); + desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, renderTargetFlags, fit, budgeted); if (fResourceProvider) { // In order to reuse code we always create a lazy proxy. When we aren't in DDL mode however @@ -320,9 +318,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitma GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *this->caps()); if (0 == mipmaps->countLevels()) { - return this->createTextureProxy(baseLevel, kNone_GrSurfaceFlags, kTopLeft_GrSurfaceOrigin, - 1, SkBudgeted::kYes, SkBackingFit::kExact); - + return this->createTextureProxy(baseLevel, kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, + SkBackingFit::kExact); } sk_sp<GrTextureProxy> proxy = this->createLazyProxy( @@ -350,8 +347,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitma SkASSERT(texels[i].fPixels); } - return resourceProvider->createTexture(desc, SkBudgeted::kYes, - kTopLeft_GrSurfaceOrigin, texels.get(), + return resourceProvider->createTexture(desc, SkBudgeted::kYes, texels.get(), mipLevelCount, mipColorMode); }, desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kYes, SkBackingFit::kExact, @@ -400,7 +396,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc, } return sk_sp<GrTextureProxy>( - new GrTextureProxy(copyDesc, origin, mipMapped, fit, budgeted, nullptr, 0, flags)); + new GrTextureProxy(copyDesc, origin, mipMapped, fit, budgeted, flags)); } sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy( diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 20d546fbab..12ff10c005 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -73,8 +73,8 @@ public: * DDL TODO: need to refine ownership semantics of 'srcData' if we're in completely * deferred mode */ - sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, GrSurfaceOrigin, SkBudgeted, - const void* srcData, size_t rowBytes); + sk_sp<GrTextureProxy> createTextureProxy(const GrSurfaceDesc&, SkBudgeted, const void* srcData, + size_t rowBytes); /* * Create an un-mipmapped texture proxy with data. The SkImage must be a raster backend image. @@ -83,7 +83,6 @@ public: */ sk_sp<GrTextureProxy> createTextureProxy(sk_sp<SkImage> srcImage, GrSurfaceFlags flags, - GrSurfaceOrigin origin, int sampleCnt, SkBudgeted budgeted, SkBackingFit fit); diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index f81eea3884..df848e8d3c 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -62,7 +62,6 @@ GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSin } sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], int mipLevelCount, SkDestinationSurfaceColorMode mipColorMode) { ASSERT_SINGLE_OWNER @@ -78,7 +77,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk return nullptr; } - sk_sp<GrTexture> tex(fGpu->createTexture(desc, budgeted, texelsOrigin, texels, mipLevelCount)); + sk_sp<GrTexture> tex(fGpu->createTexture(desc, budgeted, texels, mipLevelCount)); if (tex) { tex->texturePriv().setMipColorMode(mipColorMode); } @@ -109,7 +108,6 @@ static bool make_info(int w, int h, GrPixelConfig config, SkImageInfo* ii) { sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, SkBackingFit fit, - GrSurfaceOrigin mipLevelOrigin, const GrMipLevel& mipLevel) { ASSERT_SINGLE_OWNER @@ -133,8 +131,8 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) { // DDL TODO: remove this use of createInstantiatedProxy and convert it to a testing-only // method. - sk_sp<GrTextureProxy> proxy = - proxyProvider->createInstantiatedProxy(desc, mipLevelOrigin, fit, budgeted); + sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy( + desc, kTopLeft_GrSurfaceOrigin, fit, budgeted); if (proxy) { // We use an ephemeral surface context to do the write pixels. Here it isn't clear what // color space to tag it with. That's ok because GrSurfaceContext::writePixels doesn't @@ -155,7 +153,7 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, } } - return fGpu->createTexture(desc, budgeted, mipLevelOrigin, &mipLevel, 1); + return fGpu->createTexture(desc, budgeted, &mipLevel, 1); } sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h index 083f5a90f6..68bcf45ef7 100644 --- a/src/gpu/GrResourceProvider.h +++ b/src/gpu/GrResourceProvider.h @@ -68,13 +68,12 @@ public: */ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, uint32_t flags = 0); - sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, GrSurfaceOrigin texelsOrigin, - const GrMipLevel texels[], int mipLevelCount, - SkDestinationSurfaceColorMode mipColorMode); + sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel texels[], + int mipLevelCount, SkDestinationSurfaceColorMode mipColorMode); // Create a potentially loose fit texture with the provided data sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted, SkBackingFit, - GrSurfaceOrigin mipLevelOrigin, const GrMipLevel&); + const GrMipLevel&); /////////////////////////////////////////////////////////////////////////// // Wrapped Backend Surfaces diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index b8132e8a89..c78e9989df 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -144,7 +144,7 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl( texels[i].fRowBytes = 0; } - surface = resourceProvider->createTexture(desc, fBudgeted, fOrigin, texels.get(), mipCount, + surface = resourceProvider->createTexture(desc, fBudgeted, texels.get(), mipCount, SkDestinationSurfaceColorMode::kLegacy); if (surface) { SkASSERT(surface->asTexture()); diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index cfeb34cb26..a19a803c33 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -14,17 +14,26 @@ #include "GrProxyProvider.h" #include "GrTexturePriv.h" -// Deferred version -GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, GrSurfaceOrigin origin, - GrMipMapped mipMapped, SkBackingFit fit, SkBudgeted budgeted, - const void* srcData, size_t /*rowBytes*/, uint32_t flags) - : INHERITED(srcDesc, origin, fit, budgeted, flags) +// Deferred version - with data +GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, GrMipMapped mipMapped, + SkBackingFit fit, SkBudgeted budgeted, const void* srcData, + size_t /*rowBytes*/, uint32_t flags) + : INHERITED(srcDesc, kTopLeft_GrSurfaceOrigin, fit, budgeted, flags) , fMipMapped(mipMapped) , fProxyProvider(nullptr) , fDeferredUploader(nullptr) { SkASSERT(!srcData); // currently handled in Make() } +// Deferred version - no data +GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, GrSurfaceOrigin origin, + GrMipMapped mipMapped, SkBackingFit fit, SkBudgeted budgeted, + uint32_t flags) + : INHERITED(srcDesc, origin, fit, budgeted, flags) + , fMipMapped(mipMapped) + , fProxyProvider(nullptr) + , fDeferredUploader(nullptr) {} + // Lazy-callback version GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback, LazyInstantiationType lazyType, const GrSurfaceDesc& desc, GrSurfaceOrigin origin, diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp index c36867daa7..e753b8ddb0 100644 --- a/src/gpu/GrTextureRenderTargetProxy.cpp +++ b/src/gpu/GrTextureRenderTargetProxy.cpp @@ -26,7 +26,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps, uint32_t flags) : GrSurfaceProxy(desc, origin, fit, budgeted, flags) // for now textures w/ data are always wrapped - , GrTextureProxy(desc, origin, mipMapped, fit, budgeted, nullptr, 0, flags) + , GrTextureProxy(desc, origin, mipMapped, fit, budgeted, flags) , GrRenderTargetProxy(caps, desc, origin, fit, budgeted, flags) {} // Lazy-callback version diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index bd66dba62d..b79d4a7eb7 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -105,7 +105,6 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx, const GrS auto proxyProvider = ctx->contextPriv().proxyProvider(); yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, kNone_GrSurfaceFlags, - kTopLeft_GrSurfaceOrigin, 1, SkBudgeted::kYes, fit); } diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 58df7c511a..4701483af5 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -88,9 +88,8 @@ sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrProxyProvider* proxyProvide : kNever_SkCopyPixelsMode; sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, cpyMode); - return proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, - kTopLeft_GrSurfaceOrigin, 1, SkBudgeted::kYes, - SkBackingFit::kExact); + return proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1, + SkBudgeted::kYes, SkBackingFit::kExact); } //////////////////////////////////////////////////////////////////////////////// @@ -200,9 +199,8 @@ sk_sp<GrTextureProxy> GrMakeCachedImageProxy(GrProxyProvider* proxyProvider, proxy = proxyProvider->findOrCreateProxyByUniqueKey(originalKey, kTopLeft_GrSurfaceOrigin); } if (!proxy) { - proxy = proxyProvider->createTextureProxy(std::move(srcImage), kNone_GrSurfaceFlags, - kTopLeft_GrSurfaceOrigin, 1, SkBudgeted::kYes, - fit); + proxy = proxyProvider->createTextureProxy(std::move(srcImage), kNone_GrSurfaceFlags, 1, + SkBudgeted::kYes, fit); if (proxy && originalKey.isValid()) { proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get()); } diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp index d5e9eae827..762093ef15 100644 --- a/src/gpu/effects/GrConfigConversionEffect.fp +++ b/src/gpu/effects/GrConfigConversionEffect.fp @@ -61,7 +61,7 @@ GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy( - desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes, data, 0); + desc, SkBudgeted::kYes, data, 0); if (!dataProxy) { return false; } diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index 0b5a205e1c..ca3cd85200 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -64,8 +64,8 @@ public: GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy( - desc, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes, data, 0); + sk_sp<GrTextureProxy> dataProxy = + proxyProvider->createTextureProxy(desc, SkBudgeted::kYes, data, 0); if (!dataProxy) { return false; } diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp index 7057a8e173..3f5501795f 100644 --- a/src/gpu/effects/GrRectBlurEffect.fp +++ b/src/gpu/effects/GrRectBlurEffect.fp @@ -68,8 +68,8 @@ uniform half profileSize; } blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, - kTopLeft_GrSurfaceOrigin, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!blurProfile) { return nullptr; } diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h index b6b8a029f1..44f54bba95 100644 --- a/src/gpu/effects/GrRectBlurEffect.h +++ b/src/gpu/effects/GrRectBlurEffect.h @@ -47,9 +47,9 @@ public: return nullptr; } - blurProfile = proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, - kTopLeft_GrSurfaceOrigin, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + blurProfile = + proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1, + SkBudgeted::kYes, SkBackingFit::kExact); if (!blurProfile) { return nullptr; } diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index ea7be0ef93..2a1d403cea 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1413,7 +1413,6 @@ static void set_initial_texture_params(const GrGLInterface* interface, sk_sp<GrTexture> GrGLGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], int mipLevelCount) { // We fail if the MSAA was requested and is not available. @@ -1445,8 +1444,8 @@ sk_sp<GrTexture> GrGLGpu::onCreateTexture(const GrSurfaceDesc& desc, idDesc.fOwnership = GrBackendObjectOwnership::kOwned; GrMipMapsStatus mipMapsStatus; GrGLTexture::TexParams initialTexParams; - if (!this->createTextureImpl(desc, &idDesc.fInfo, isRenderTarget, &initialTexParams, - texelsOrigin, texels, mipLevelCount, &mipMapsStatus)) { + if (!this->createTextureImpl(desc, &idDesc.fInfo, isRenderTarget, &initialTexParams, texels, + mipLevelCount, &mipMapsStatus)) { return return_null_texture(); } @@ -1632,8 +1631,7 @@ int GrGLGpu::getCompatibleStencilIndex(GrPixelConfig config) { } bool GrGLGpu::createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, bool renderTarget, - GrGLTexture::TexParams* initialTexParams, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], + GrGLTexture::TexParams* initialTexParams, const GrMipLevel texels[], int mipLevelCount, GrMipMapsStatus* mipMapsStatus) { info->fID = 0; info->fTarget = GR_GL_TEXTURE_2D; @@ -1657,9 +1655,9 @@ bool GrGLGpu::createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info set_initial_texture_params(this->glInterface(), *info, initialTexParams); } - if (!this->uploadTexData(desc.fConfig, desc.fWidth, desc.fHeight, texelsOrigin, info->fTarget, - kNewTexture_UploadType, 0, 0, desc.fWidth, desc.fHeight, desc.fConfig, - texels, mipLevelCount, mipMapsStatus)) { + if (!this->uploadTexData(desc.fConfig, desc.fWidth, desc.fHeight, kTopLeft_GrSurfaceOrigin, + info->fTarget, kNewTexture_UploadType, 0, 0, desc.fWidth, desc.fHeight, + desc.fConfig, texels, mipLevelCount, mipMapsStatus)) { GL_CALL(DeleteTextures(1, &(info->fID))); return false; } diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index 6b193993bc..81c15f0c54 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -184,8 +184,7 @@ private: void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) override; + const GrMipLevel texels[], int mipLevelCount) override; GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPattern, const void* data) override; @@ -208,9 +207,8 @@ private: // The texture is populated with |texels|, if it exists. // The texture parameters are cached in |initialTexParams|. bool createTextureImpl(const GrSurfaceDesc& desc, GrGLTextureInfo* info, bool renderTarget, - GrGLTexture::TexParams* initialTexParams, GrSurfaceOrigin texelsOrigin, - const GrMipLevel texels[], int mipLevelCount, - GrMipMapsStatus* mipMapsStatus); + GrGLTexture::TexParams* initialTexParams, const GrMipLevel texels[], + int mipLevelCount, GrMipMapsStatus* mipMapsStatus); bool onIsACopyNeededForTextureParams(GrTextureProxy*, const GrSamplerState&, GrTextureProducer::CopyParams*, diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp index 05371b42e6..9341472090 100644 --- a/src/gpu/mock/GrMockGpu.cpp +++ b/src/gpu/mock/GrMockGpu.cpp @@ -65,8 +65,7 @@ GrMockGpu::GrMockGpu(GrContext* context, const GrMockOptions& options, } sk_sp<GrTexture> GrMockGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) { + const GrMipLevel texels[], int mipLevelCount) { GrMipMapsStatus mipMapsStatus = mipLevelCount > 1 ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated; GrMockTextureInfo info; diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h index 14cbd7979f..e44cc36922 100644 --- a/src/gpu/mock/GrMockGpu.h +++ b/src/gpu/mock/GrMockGpu.h @@ -55,8 +55,8 @@ private: void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} - sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, GrSurfaceOrigin texelsOrigin, - const GrMipLevel texels[], int mipLevelCount) override; + sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel[], + int mipLevelCount) override; sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override { return nullptr; diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h index fd190e28fa..5bc9c0636c 100644 --- a/src/gpu/mtl/GrMtlGpu.h +++ b/src/gpu/mtl/GrMtlGpu.h @@ -82,8 +82,7 @@ private: void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) override; + const GrMipLevel texels[], int mipLevelCount) override; sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override { return nullptr; diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm index c8952e0172..149e56220e 100644 --- a/src/gpu/mtl/GrMtlGpu.mm +++ b/src/gpu/mtl/GrMtlGpu.mm @@ -107,8 +107,7 @@ GrMtlGpu::GrMtlGpu(GrContext* context, const GrContextOptions& options, } sk_sp<GrTexture> GrMtlGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) { + const GrMipLevel texels[], int mipLevelCount) { int mipLevels = !mipLevelCount ? 1 : mipLevelCount; if (!fMtlCaps->isConfigTexturable(desc.fConfig)) { diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index 3a81eed350..1af5a3fff1 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -763,8 +763,7 @@ bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, GrSurfaceOrigin texOrigin, //////////////////////////////////////////////////////////////////////////////// sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], - int mipLevelCount) { + const GrMipLevel texels[], int mipLevelCount) { bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); VkFormat pixelFormat; @@ -825,8 +824,8 @@ sk_sp<GrTexture> GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted auto colorType = GrPixelConfigToColorType(desc.fConfig); if (mipLevelCount) { - if (!this->uploadTexDataOptimal(tex.get(), texelsOrigin, 0, 0, desc.fWidth, desc.fHeight, - colorType, texels, mipLevelCount)) { + if (!this->uploadTexDataOptimal(tex.get(), kTopLeft_GrSurfaceOrigin, 0, 0, desc.fWidth, + desc.fHeight, colorType, texels, mipLevelCount)) { tex->unref(); return nullptr; } diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 7616fccefe..e622d573de 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -164,8 +164,7 @@ private: void destroyResources(); - sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - GrSurfaceOrigin texelsOrigin, const GrMipLevel texels[], + sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel[], int mipLevelCount) override; sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrWrapOwnership) override; diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 0ba3f03d37..86f89db813 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -648,8 +648,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, const SkP if (SkImageInfoIsValid(pixmap.info(), colorMode)) { ATRACE_ANDROID_FRAMEWORK("Upload Texture [%ux%u]", pixmap.width(), pixmap.height()); GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *proxyProvider->caps()); - proxy = proxyProvider->createTextureProxy(desc, kTopLeft_GrSurfaceOrigin, - SkBudgeted::kYes, pixmap.addr(), + proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kYes, pixmap.addr(), pixmap.rowBytes()); } } |