diff options
28 files changed, 94 insertions, 105 deletions
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index 7b8adf1d45..c4bb8130bb 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -180,10 +180,10 @@ protected: // need to copy the subset into a new texture GrSurfaceDesc desc; - desc.fConfig = fProxy->config(); + desc.fOrigin = fProxy->origin(); desc.fWidth = info.width(); desc.fHeight = info.height(); - desc.fOrigin = fProxy->origin(); + desc.fConfig = fProxy->config(); sk_sp<GrSurfaceContext> dstContext(fCtx->contextPriv().makeDeferredSurfaceContext( desc, diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index a343f03817..572aa52b74 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -591,13 +591,13 @@ struct GrMipLevel { */ struct GrSurfaceDesc { GrSurfaceDesc() - : fFlags(kNone_GrSurfaceFlags) - , fOrigin(kDefault_GrSurfaceOrigin) - , fWidth(0) - , fHeight(0) - , fConfig(kUnknown_GrPixelConfig) - , fSampleCnt(0) - , fIsMipMapped(false) { + : fFlags(kNone_GrSurfaceFlags) + , fOrigin(kDefault_GrSurfaceOrigin) + , fWidth(0) + , fHeight(0) + , fConfig(kUnknown_GrPixelConfig) + , fSampleCnt(0) + , fIsMipMapped(false) { } GrSurfaceFlags fFlags; //!< bitfield of TextureFlags diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp index 3de6fec85c..ac4fee37ac 100644 --- a/src/gpu/GrBackendTextureImageGenerator.cpp +++ b/src/gpu/GrBackendTextureImageGenerator.cpp @@ -175,12 +175,12 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture( // Otherwise, make a copy of the requested subset. Make sure our temporary is renderable, // because Vulkan will want to do the copy as a draw. GrSurfaceDesc desc; - desc.fConfig = proxy->config(); + desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = proxy->origin(); desc.fWidth = info.width(); desc.fHeight = info.height(); - desc.fOrigin = proxy->origin(); + desc.fConfig = proxy->config(); desc.fIsMipMapped = proxy->isMipMapped(); - desc.fFlags = kRenderTarget_GrSurfaceFlag; sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeDeferredSurfaceContext( desc, SkBackingFit::kExact, SkBudgeted::kYes)); diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 25408fbde7..347f0b5153 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -401,11 +401,12 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, return false; } - GrSurface* dstSurface = dst->asSurfaceProxy()->priv().peekSurface(); + GrSurfaceProxy* dstProxy = dst->asSurfaceProxy(); + GrSurface* dstSurface = dstProxy->priv().peekSurface(); // The src is unpremul but the dst is premul -> premul the src before or as part of the write const bool premul = SkToBool(kUnpremul_PixelOpsFlag & pixelOpsFlags); - if (!valid_pixel_conversion(srcConfig, dstSurface->config(), premul)) { + if (!valid_pixel_conversion(srcConfig, dstProxy->config(), premul)) { return false; } @@ -414,7 +415,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, bool useConfigConversionEffect = premul && pm_upm_must_round_trip(srcConfig, srcColorSpace) && - pm_upm_must_round_trip(dstSurface->config(), dst->getColorSpace()); + pm_upm_must_round_trip(dstProxy->config(), dst->getColorSpace()); // Are we going to try to premul as part of a draw? For the non-legacy case, we always allow // this. GrConfigConversionEffect fails on some GPUs, so only allow this if it works perfectly. @@ -432,8 +433,8 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, GrGpu::DrawPreference drawPreference = premulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference : GrGpu::kNoDraw_DrawPreference; GrGpu::WritePixelTempDrawInfo tempDrawInfo; - if (!fContext->fGpu->getWritePixelsInfo(dstSurface, width, height, srcConfig, - &drawPreference, &tempDrawInfo)) { + if (!fContext->fGpu->getWritePixelsInfo(dstSurface, width, height, + srcConfig, &drawPreference, &tempDrawInfo)) { return false; } @@ -531,11 +532,12 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, return false; } - GrSurface* srcSurface = src->asSurfaceProxy()->priv().peekSurface(); + GrSurfaceProxy* srcProxy = src->asSurfaceProxy(); + GrSurface* srcSurface = srcProxy->priv().peekSurface(); // The src is premul but the dst is unpremul -> unpremul the src after or as part of the read bool unpremul = SkToBool(kUnpremul_PixelOpsFlag & flags); - if (!valid_pixel_conversion(srcSurface->config(), dstConfig, unpremul)) { + if (!valid_pixel_conversion(srcProxy->config(), dstConfig, unpremul)) { return false; } @@ -543,7 +545,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, // without any color spaces attached, and the caller wants us to unpremul. bool useConfigConversionEffect = unpremul && - pm_upm_must_round_trip(srcSurface->config(), src->getColorSpace()) && + pm_upm_must_round_trip(srcProxy->config(), src->getColorSpace()) && pm_upm_must_round_trip(dstConfig, dstColorSpace); // Are we going to try to unpremul as part of a draw? For the non-legacy case, we always allow @@ -562,8 +564,8 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, GrGpu::DrawPreference drawPreference = unpremulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference : GrGpu::kNoDraw_DrawPreference; GrGpu::ReadPixelTempDrawInfo tempDrawInfo; - if (!fContext->fGpu->getReadPixelsInfo(srcSurface, width, height, rowBytes, dstConfig, - &drawPreference, &tempDrawInfo)) { + if (!fContext->fGpu->getReadPixelsInfo(srcSurface, width, height, rowBytes, + dstConfig, &drawPreference, &tempDrawInfo)) { return false; } @@ -639,8 +641,8 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, this->flushSurfaceWrites(proxyToRead.get()); configToRead = tempDrawInfo.fReadConfig; } - if (!fContext->fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead, - buffer, rowBytes)) { + if (!fContext->fGpu->readPixels(surfaceToRead, + left, top, width, height, configToRead, buffer, rowBytes)) { return false; } diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp index 8bc0521ccc..897622ac28 100644 --- a/src/gpu/GrDrawOpAtlas.cpp +++ b/src/gpu/GrDrawOpAtlas.cpp @@ -21,6 +21,7 @@ std::unique_ptr<GrDrawOpAtlas> GrDrawOpAtlas::Make(GrContext* ctx, GrPixelConfig void* data) { GrSurfaceDesc desc; desc.fFlags = kNone_GrSurfaceFlags; + desc.fOrigin = kTopLeft_GrSurfaceOrigin; desc.fWidth = width; desc.fHeight = height; desc.fConfig = config; diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index c6684ac4fa..27a2d7958e 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -107,13 +107,13 @@ public: * @param mipLevelCount the number of levels in 'texels' * @return The texture object if successful, otherwise nullptr. */ - sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, + 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. */ - sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted); + sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted); /** * Implements GrResourceProvider::wrapBackendTexture @@ -544,8 +544,7 @@ private: // overridden by backend-specific derived class to create objects. // Texture size and sample size will have already been validated in base class before // onCreateTexture is called. - virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, - SkBudgeted budgeted, + virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted, const GrMipLevel texels[], int mipLevelCount) = 0; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index c9898c7480..4ec14bccf6 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1806,8 +1806,8 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr } bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const GrClip& clip, - const SkRect& opBounds, - GrXferProcessor::DstProxy* dstProxy) { + const SkRect& opBounds, + GrXferProcessor::DstProxy* dstProxy) { if (this->caps()->textureBarrierSupport()) { if (GrTextureProxy* texProxy = rtProxy->asTextureProxy()) { // The render target is a texture, so we can read from it directly in the shader. The XP @@ -1839,8 +1839,8 @@ bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const Gr bool rectsMustMatch = false; bool disallowSubrect = false; if (!this->caps()->initDescForDstCopy(rtProxy, &desc, &rectsMustMatch, &disallowSubrect)) { - desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fConfig = rtProxy->config(); } diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 804cabbacd..f8639406d6 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -48,16 +48,16 @@ sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl( GrSurfaceFlags flags, bool isMipMapped, SkDestinationSurfaceColorMode mipColorMode) const { GrSurfaceDesc desc; - desc.fConfig = fConfig; - desc.fWidth = fWidth; - desc.fHeight = fHeight; - desc.fOrigin = fOrigin; - desc.fSampleCnt = sampleCnt; - desc.fIsMipMapped = isMipMapped; desc.fFlags = flags; if (fNeedsClear) { desc.fFlags |= kPerformInitialClear_GrSurfaceFlag; } + desc.fOrigin = fOrigin; + desc.fWidth = fWidth; + desc.fHeight = fHeight; + desc.fConfig = fConfig; + desc.fSampleCnt = sampleCnt; + desc.fIsMipMapped = isMipMapped; sk_sp<GrSurface> surface; if (SkBackingFit::kApprox == fFit) { @@ -300,10 +300,10 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::Copy(GrContext* context, } GrSurfaceDesc dstDesc; - dstDesc.fConfig = src->config(); + dstDesc.fOrigin = src->origin(); dstDesc.fWidth = srcRect.width(); dstDesc.fHeight = srcRect.height(); - dstDesc.fOrigin = src->origin(); + dstDesc.fConfig = src->config(); sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext( dstDesc, diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 412f3c57cb..3c35def752 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1742,12 +1742,7 @@ void GrGLGpu::flushScissor(const GrScissorState& scissorState, GrSurfaceOrigin rtOrigin) { if (scissorState.enabled()) { GrGLIRect scissor; - scissor.setRelativeTo(rtViewport, - scissorState.rect().fLeft, - scissorState.rect().fTop, - scissorState.rect().width(), - scissorState.rect().height(), - rtOrigin); + scissor.setRelativeTo(rtViewport, scissorState.rect(), rtOrigin); // if the scissor fully contains the viewport then we fall through and // disable the scissor test. if (!scissor.contains(rtViewport)) { @@ -1860,7 +1855,7 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso glRT->renderTargetPriv().numStencilBits()); } this->flushStencil(stencil); - this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->origin()); + this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), pipeline.proxy()->origin()); this->flushWindowRectangles(pipeline.getWindowRectsState(), glRT); this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !stencil.isDisabled()); @@ -2123,11 +2118,12 @@ bool GrGLGpu::readPixelsSupported(GrRenderTarget* target, GrPixelConfig readConf bool GrGLGpu::readPixelsSupported(GrPixelConfig rtConfig, GrPixelConfig readConfig) { sk_sp<GrTexture> temp; auto bindRenderTarget = [this, rtConfig, &temp]() -> bool { - GrTextureDesc desc; + GrSurfaceDesc desc; desc.fConfig = rtConfig; desc.fWidth = desc.fHeight = 16; if (this->glCaps().isConfigRenderable(rtConfig, false)) { desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; temp = this->createTexture(desc, SkBudgeted::kNo); if (!temp) { return false; @@ -2136,6 +2132,7 @@ bool GrGLGpu::readPixelsSupported(GrPixelConfig rtConfig, GrPixelConfig readConf this->flushRenderTarget(glrt, &SkIRect::EmptyIRect()); return true; } else if (this->glCaps().canConfigBeFBOColorAttachment(rtConfig)) { + desc.fOrigin = kTopLeft_GrSurfaceOrigin; temp = this->createTexture(desc, SkBudgeted::kNo); if (!temp) { return false; @@ -2553,7 +2550,7 @@ void GrGLGpu::draw(const GrPipeline& pipeline, if (pipeline.getScissorState().enabled()) { GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.renderTarget()); this->flushScissor(dynamicStates[i].fScissorRect, - glRT->getViewport(), glRT->origin()); + glRT->getViewport(), pipeline.proxy()->origin()); } } if (this->glCaps().requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines() && @@ -2694,8 +2691,7 @@ void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) { t = target->height(); } else { GrGLIRect rect; - rect.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, - dirtyRect.width(), dirtyRect.height(), target->origin()); + rect.setRelativeTo(vp, dirtyRect, target->origin()); l = rect.fLeft; b = rect.fBottom; r = rect.fLeft + rect.fWidth; @@ -3951,12 +3947,7 @@ void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst, // We modified the bound FBO fHWBoundRenderTargetUniqueID.makeInvalid(); GrGLIRect srcGLRect; - srcGLRect.setRelativeTo(srcVP, - srcRect.fLeft, - srcRect.fTop, - srcRect.width(), - srcRect.height(), - src->origin()); + srcGLRect.setRelativeTo(srcVP, srcRect, src->origin()); this->setScratchTextureUnit(); GL_CALL(BindTexture(dstTex->target(), dstTex->textureID())); @@ -3997,18 +3988,8 @@ bool GrGLGpu::copySurfaceAsBlitFramebuffer(GrSurface* dst, fHWBoundRenderTargetUniqueID.makeInvalid(); GrGLIRect srcGLRect; GrGLIRect dstGLRect; - srcGLRect.setRelativeTo(srcVP, - srcRect.fLeft, - srcRect.fTop, - srcRect.width(), - srcRect.height(), - src->origin()); - dstGLRect.setRelativeTo(dstVP, - dstRect.fLeft, - dstRect.fTop, - dstRect.width(), - dstRect.height(), - dst->origin()); + srcGLRect.setRelativeTo(srcVP, srcRect, src->origin()); + dstGLRect.setRelativeTo(dstVP, dstRect, dst->origin()); // BlitFrameBuffer respects the scissor, so disable it. this->disableScissor(); diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index 0d87c4f5a2..5c78c07fc2 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -231,7 +231,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const SkString& colorIn, dstTextureSamplerHandle = this->emitSampler(dstTexture->texturePriv().samplerType(), dstTexture->config(), "DstTextureSampler", kFragment_GrShaderFlag); - dstTextureOrigin = dstTexture->origin(); + dstTextureOrigin = fPipeline.dstTextureProxy()->origin(); SkASSERT(kTextureExternalSampler_GrSLType != dstTexture->texturePriv().samplerType()); } diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index d1e535ea6a..31e55de46a 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -933,15 +933,14 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTa } GrSurfaceDesc desc; - desc.fConfig = backendRT.config(); desc.fFlags = kRenderTarget_GrSurfaceFlag; + SkASSERT(kDefault_GrSurfaceOrigin != origin); + desc.fOrigin = origin; desc.fWidth = backendRT.width(); desc.fHeight = backendRT.height(); + desc.fConfig = backendRT.config(); desc.fSampleCnt = 0; - SkASSERT(kDefault_GrSurfaceOrigin != origin); - desc.fOrigin = origin; - sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, info); if (tgt && backendRT.stencilBits()) { if (!createStencilAttachmentForRenderTarget(tgt.get(), desc.fWidth, desc.fHeight)) { @@ -965,13 +964,12 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBacken GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; - desc.fConfig = tex.config(); + desc.fOrigin = resolve_origin(origin); desc.fWidth = tex.width(); desc.fHeight = tex.height(); + desc.fConfig = tex.config(); desc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, tex.config()); - desc.fOrigin = resolve_origin(origin); - sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, info); return tgt; } diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 3bed9e8298..a19556b653 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -230,10 +230,10 @@ bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size sk_sp<SkImage> SkImage_Gpu::onMakeSubset(const SkIRect& subset) const { GrSurfaceDesc desc; - desc.fConfig = fProxy->config(); + desc.fOrigin = fProxy->origin(); desc.fWidth = subset.width(); desc.fHeight = subset.height(); - desc.fOrigin = fProxy->origin(); + desc.fConfig = fProxy->config(); sk_sp<GrSurfaceContext> sContext(fContext->contextPriv().makeDeferredSurfaceContext( desc, @@ -491,8 +491,8 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk sk_sp<GrSemaphore> sema = context->getGpu()->prepareTextureForCrossContextUsage(texture.get()); - auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), std::move(sema), - codecImage->alphaType(), + auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), + std::move(sema), codecImage->alphaType(), std::move(texColorSpace)); return SkImage::MakeFromGenerator(std::move(gen)); } diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp index add746fec5..ee9a694f19 100644 --- a/tests/DetermineDomainModeTest.cpp +++ b/tests/DetermineDomainModeTest.cpp @@ -137,9 +137,10 @@ static sk_sp<GrTextureProxy> create_proxy(GrResourceProvider* resourceProvider, SkBackingFit fit = isExact ? SkBackingFit::kExact : SkBackingFit::kApprox; GrSurfaceDesc desc; - desc.fConfig = kRGBA_8888_GrPixelConfig; + desc.fOrigin = kTopLeft_GrSurfaceOrigin; desc.fWidth = size; desc.fHeight = size; + desc.fConfig = kRGBA_8888_GrPixelConfig; static const char* name = "proxy"; diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp index 06a99a5f1c..816b0d37d8 100644 --- a/tests/FloatingPointTextureTest.cpp +++ b/tests/FloatingPointTextureTest.cpp @@ -48,10 +48,10 @@ void runFPTest(skiatest::Reporter* reporter, GrContext* context, for (int origin = 0; origin < 2; ++origin) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = 0 == origin ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; desc.fWidth = DEV_W; desc.fHeight = DEV_H; desc.fConfig = config; - desc.fOrigin = 0 == origin ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; sk_sp<GrTextureProxy> fpProxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(), desc, SkBudgeted::kNo, controlPixelData.begin(), 0); diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index dd98a6e00e..8b07568fdc 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -262,16 +262,16 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma GrSurfaceDesc dummyDesc; dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; dummyDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; - dummyDesc.fConfig = kRGBA_8888_GrPixelConfig; dummyDesc.fWidth = 34; dummyDesc.fHeight = 18; + dummyDesc.fConfig = kRGBA_8888_GrPixelConfig; proxies[0] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(), dummyDesc, SkBudgeted::kNo, nullptr, 0); dummyDesc.fFlags = kNone_GrSurfaceFlags; dummyDesc.fOrigin = kTopLeft_GrSurfaceOrigin; - dummyDesc.fConfig = kAlpha_8_GrPixelConfig; dummyDesc.fWidth = 16; dummyDesc.fHeight = 22; + dummyDesc.fConfig = kAlpha_8_GrPixelConfig; proxies[1] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(), dummyDesc, SkBudgeted::kNo, nullptr, 0); diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp index b11c0f2beb..399f4310d6 100644 --- a/tests/GpuSampleLocationsTest.cpp +++ b/tests/GpuSampleLocationsTest.cpp @@ -138,7 +138,7 @@ void test_sampleLocations(skiatest::Reporter* reporter, TestSampleLocationsInter GrRenderTarget* rt = rtc->accessRenderTarget(); assert_equal(reporter, kTestPatterns[i], rt->renderTargetPriv().getMultisampleSpecs(dummyPipeline), - kBottomLeft_GrSurfaceOrigin == rt->origin()); + kBottomLeft_GrSurfaceOrigin == rtc->asSurfaceProxy()->origin()); } } } diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 71575c74f9..5c665d13af 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -25,10 +25,11 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); GrSurfaceDesc desc; - desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fWidth = 256; desc.fHeight = 256; + desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fSampleCnt = 0; sk_sp<GrSurface> texRT1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo); @@ -42,6 +43,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { static_cast<GrSurface*>(texRT1->asTexture())); desc.fFlags = kNone_GrSurfaceFlags; + desc.fOrigin = kTopLeft_GrSurfaceOrigin; sk_sp<GrTexture> tex1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget()); REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture()); @@ -113,8 +115,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = origin; - desc.fSampleCnt = 0; desc.fConfig = config; + desc.fSampleCnt = 0; sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigTexturable(desc.fConfig)); diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index 86ecb15f6e..4e6df3b57e 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -192,9 +192,9 @@ static sk_sp<GrTextureProxy> create_proxy(GrResourceProvider* resourceProvider) GrSurfaceDesc desc; desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fWidth = kFullSize; desc.fHeight = kFullSize; + desc.fConfig = kRGBA_8888_GrPixelConfig; return GrSurfaceProxy::MakeDeferred(resourceProvider, desc, SkBudgeted::kYes, diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index c7503bcaad..e5dc4cc32f 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -496,10 +496,10 @@ sk_sp<GrTextureProxy> pre_create_atlas(GrContext* context) { sk_sp<GrTextureProxy> pre_create_atlas(GrContext* context) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; - desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fWidth = 32; desc.fHeight = 16; + desc.fConfig = kSkia8888_GrPixelConfig; sk_sp<GrSurfaceProxy> atlasDest = GrSurfaceProxy::MakeDeferred( context->resourceProvider(), desc, SkBackingFit::kExact, diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index e2840cef5f..ec157f9003 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -145,10 +145,11 @@ void testingOnly_getIORefCnts(GrTextureProxy* proxy, int* refCnt, int* readCnt, DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - GrTextureDesc desc; - desc.fConfig = kRGBA_8888_GrPixelConfig; + GrSurfaceDesc desc; + desc.fOrigin = kTopLeft_GrSurfaceOrigin; desc.fWidth = 10; desc.fHeight = 10; + desc.fConfig = kRGBA_8888_GrPixelConfig; for (int parentCnt = 0; parentCnt < 2; parentCnt++) { sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext( diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp index 23ca695d42..78465f989f 100644 --- a/tests/ProxyConversionTest.cpp +++ b/tests/ProxyConversionTest.cpp @@ -26,6 +26,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider, GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8, desc.fConfig, fboInfo); + SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin); sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin)); SkASSERT(!defaultFBO->asTexture()); @@ -122,6 +123,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fWidth = 64; desc.fHeight = 64; desc.fConfig = kRGBA_8888_GrPixelConfig; @@ -156,6 +158,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn { desc.fFlags = kNone_GrSurfaceFlags; // force no-RT + desc.fOrigin = kTopLeft_GrSurfaceOrigin; sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, desc, SkBackingFit::kApprox, diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp index 3648122652..e605716c39 100644 --- a/tests/ProxyRefTest.cpp +++ b/tests/ProxyRefTest.cpp @@ -68,6 +68,7 @@ static void check_refs(skiatest::Reporter* reporter, static sk_sp<GrTextureProxy> make_deferred(GrContext* context) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fWidth = kWidthHeight; desc.fHeight = kWidthHeight; desc.fConfig = kRGBA_8888_GrPixelConfig; diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index 4aa055d431..4c40619c4e 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -53,9 +53,9 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p.fConfig, *backendTexHandle); - sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture( - backendTex, p.fOrigin, - kBorrow_GrWrapOwnership); + SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin); + sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, p.fOrigin, + kBorrow_GrWrapOwnership); return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin); } diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp index 07332e4282..11fedcaeef 100644 --- a/tests/SRGBMipMapTest.cpp +++ b/tests/SRGBMipMapTest.cpp @@ -125,9 +125,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) { GrSurfaceDesc desc; desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fConfig = kSRGBA_8888_GrPixelConfig; desc.fWidth = texS; desc.fHeight = texS; + desc.fConfig = kSRGBA_8888_GrPixelConfig; GrResourceProvider* resourceProvider = context->resourceProvider(); sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(resourceProvider, diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 8280e143a7..24d1b9cc3a 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -437,7 +437,7 @@ void TestResult::testOne() { } SkCanvas skCanvas(bitmap); drawPict(pic, &skCanvas, fScaleOversized ? scale : 1); - GrTextureDesc desc; + GrSurfaceDesc desc; desc.fConfig = kRGBA_8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrTextureFlagBit; desc.fWidth = dim.fX; diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index 3574f38129..2ac80d6321 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -303,9 +303,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo) GrSurfaceDesc desc; desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fConfig = kSkia8888_GrPixelConfig; desc.fWidth = kFullSize; desc.fHeight = kFullSize; + desc.fConfig = kSkia8888_GrPixelConfig; sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(), desc, SkBudgeted::kNo, diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index aca7509748..f60841384c 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -70,9 +70,9 @@ void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context, GrSurfaceProxy* proxy, uint32_t expectedPixelValues[], bool onlyTestRTConfig, const char* testName) { GrSurfaceDesc copyDstDesc; - copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig; copyDstDesc.fWidth = proxy->width(); copyDstDesc.fHeight = proxy->height(); + copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig; for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) { if (kNone_GrSurfaceFlags == flags && onlyTestRTConfig) { @@ -102,9 +102,9 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrResourceProvider* reso } GrSurfaceDesc copySrcDesc; - copySrcDesc.fConfig = kRGBA_8888_GrPixelConfig; copySrcDesc.fWidth = dstContext->width(); copySrcDesc.fHeight = dstContext->height(); + copySrcDesc.fConfig = kRGBA_8888_GrPixelConfig; for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) { copySrcDesc.fFlags = flags; diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index 5da292f11e..daeaadad08 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -92,11 +92,11 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix // create texture GrSurfaceDesc desc; - desc.fConfig = config; desc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; desc.fOrigin = origin; desc.fWidth = kTextureWidth; desc.fHeight = kTextureHeight; + desc.fConfig = config; desc.fSampleCnt = 0; sk_sp<GrTexture> tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo); @@ -109,8 +109,8 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix REPORTER_ASSERT(reporter, result); memset(dstBuffer.get(), 0xCDCD, size); - result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, config, - dstBuffer.get(), rowBytes); + result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, + config, dstBuffer.get(), rowBytes); if (result) { REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer, dstBuffer, @@ -120,7 +120,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix kBufferHeight, origin)); } - + ////////////////////////// // transfer partial data @@ -141,8 +141,8 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix REPORTER_ASSERT(reporter, result); memset(dstBuffer.get(), 0xCDCD, size); - result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, config, - dstBuffer.get(), rowBytes); + result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, + config, dstBuffer.get(), rowBytes); if (result) { REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer, dstBuffer, |