diff options
author | 2017-08-01 13:51:44 +0000 | |
---|---|---|
committer | 2017-08-01 13:51:54 +0000 | |
commit | 7294b851d277d8e703b23657e1a990f1ae24ead6 (patch) | |
tree | b042db82a0b5bf61d0f453d404dbdeab2f8e3a47 /tests | |
parent | ac32662d128484eae3230653e3794a6f33dd9f5b (diff) |
Revert "Remove origin field from GrSurface"
This reverts commit df0e09feacb29290fe94d37f921731b18f2edae0.
Reason for revert: Experimental revert to see if this is blocking the roll
Original change's description:
> Remove origin field from GrSurface
>
> This mainly consists of rm origin from GrSurface and the wrapBackEnd*
> methods and then re-adding an explicit origin parameter to all the
> GrGpu methods that need it.
>
> Change-Id: Iabd79ae98b227b5b9409f3ab5bbcc48af9613c18
> Reviewed-on: https://skia-review.googlesource.com/26363
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Id606aa01e84e2b83be71d833eefca477c1ad0d01
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/29220
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GrSurfaceTest.cpp | 2 | ||||
-rw-r--r-- | tests/ProxyConversionTest.cpp | 2 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 4 | ||||
-rw-r--r-- | tests/ResourceAllocatorTest.cpp | 7 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 11 | ||||
-rwxr-xr-x | tests/TransferPixelsTest.cpp | 4 | ||||
-rw-r--r-- | tests/VkWrapTests.cpp | 59 |
7 files changed, 59 insertions, 30 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index abf2973db7..5c665d13af 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -58,7 +58,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { backendTexHandle); sk_sp<GrSurface> texRT2 = context->resourceProvider()->wrapRenderableBackendTexture( - backendTex, 0, kBorrow_GrWrapOwnership); + backendTex, kTopLeft_GrSurfaceOrigin, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget()); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture()); diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp index 9f5801cd47..78465f989f 100644 --- a/tests/ProxyConversionTest.cpp +++ b/tests/ProxyConversionTest.cpp @@ -27,7 +27,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider, desc.fConfig, fboInfo); SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin); - sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT)); + sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin)); SkASSERT(!defaultFBO->asTexture()); return GrSurfaceProxy::MakeWrapped(std::move(defaultFBO), desc.fOrigin); diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 87072dd25b..547d3b2ce3 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -63,6 +63,7 @@ static void check_rendertarget(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() != rt->uniqueID().asUInt()); } + REPORTER_ASSERT(reporter, rt->origin() == rtProxy->origin()); if (SkBackingFit::kExact == fit) { REPORTER_ASSERT(reporter, rt->width() == rtProxy->width()); REPORTER_ASSERT(reporter, rt->height() == rtProxy->height()); @@ -97,6 +98,7 @@ static void check_texture(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, texProxy->uniqueID().asUInt() != tex->uniqueID().asUInt()); } + REPORTER_ASSERT(reporter, tex->origin() == texProxy->origin()); if (SkBackingFit::kExact == fit) { REPORTER_ASSERT(reporter, tex->width() == texProxy->width()); REPORTER_ASSERT(reporter, tex->height() == texProxy->height()); @@ -232,7 +234,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { config, fboInfo); sk_sp<GrRenderTarget> defaultFBO( - provider->wrapBackendRenderTarget(backendRT)); + provider->wrapBackendRenderTarget(backendRT, origin)); sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO, origin)); diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index ffe7e35861..4c40619c4e 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -54,7 +54,7 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& *backendTexHandle); SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin); - sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, + sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, p.fOrigin, kBorrow_GrWrapOwnership); return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin); } @@ -169,8 +169,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) { // Two non-overlapping intervals w/ different RT classifications should never share { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kNotRT, kRGBA, kA, 0, kTL }, kDontShare }, { { 64, kNotRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kTL }, kDontShare }, - // Two non-overlapping intervals w/ different origins should share - { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kShare }, + // Two non-overlapping intervals w/ different origins should not share + // TODO: rm this test case + { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kDontShare }, }; for (auto test : gNonOverlappingTests) { diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index c10d581288..48f50a0c48 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -96,10 +96,9 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl GrContext* context = ctxInfo.grContext(); GrSurfaceDesc smallDesc; smallDesc.fFlags = kRenderTarget_GrSurfaceFlag; - smallDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; + smallDesc.fConfig = kRGBA_8888_GrPixelConfig; smallDesc.fWidth = 4; smallDesc.fHeight = 4; - smallDesc.fConfig = kRGBA_8888_GrPixelConfig; smallDesc.fSampleCnt = 0; if (context->caps()->avoidStencilBuffers()) { @@ -137,10 +136,9 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl // An RT with a much larger size should not share. GrSurfaceDesc bigDesc; bigDesc.fFlags = kRenderTarget_GrSurfaceFlag; - bigDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; + bigDesc.fConfig = kRGBA_8888_GrPixelConfig; bigDesc.fWidth = 400; bigDesc.fHeight = 200; - bigDesc.fConfig = kRGBA_8888_GrPixelConfig; bigDesc.fSampleCnt = 0; sk_sp<GrTexture> bigRT(resourceProvider->createTexture(bigDesc, SkBudgeted::kNo)); if (bigRT && bigRT->asRenderTarget()) { @@ -230,7 +228,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI kRGBA_8888_GrPixelConfig, texHandles[0]); sk_sp<GrTexture> borrowed(context->resourceProvider()->wrapBackendTexture( - backendTex1, kBorrow_GrWrapOwnership)); + backendTex1, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership)); GrBackendTexture backendTex2 = GrTest::CreateBackendTexture(context->contextPriv().getBackend(), kW, @@ -238,7 +236,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI kRGBA_8888_GrPixelConfig, texHandles[1]); sk_sp<GrTexture> adopted(context->resourceProvider()->wrapBackendTexture( - backendTex2, kAdopt_GrWrapOwnership)); + backendTex2, kTopLeft_GrSurfaceOrigin, kAdopt_GrWrapOwnership)); REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr); if (!borrowed || !adopted) { @@ -1638,7 +1636,6 @@ static sk_sp<GrTexture> make_normal_texture(GrResourceProvider* provider, int sampleCnt) { GrSurfaceDesc desc; desc.fFlags = flags; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; desc.fWidth = width; desc.fHeight = height; desc.fConfig = kRGBA_8888_GrPixelConfig; diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index 722707ae9b..daeaadad08 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -109,7 +109,7 @@ 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(), origin, 0, 0, kTextureWidth, kTextureHeight, + 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, @@ -141,7 +141,7 @@ 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(), origin, 0, 0, kTextureWidth, kTextureHeight, + 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, diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 4f4c83362f..f64043df62 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -37,30 +37,42 @@ void wrap_tex_test(skiatest::Reporter* reporter, GrContext* context) { const GrVkImageInfo* imageInfo = reinterpret_cast<const GrVkImageInfo*>(backendObj); GrBackendTexture backendTex = GrBackendTexture(kW, kH, *imageInfo); - sk_sp<GrTexture> tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); + sk_sp<GrTexture> tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); // image is null GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // alloc is null backendCopy.fImage = imageInfo->fImage; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // check adopt creation backendCopy.fAlloc = imageInfo->fAlloc; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); @@ -76,14 +88,14 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrBackendRenderTarget backendRT(kW, kH, 0, 0, *backendTex); - sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT); + sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT, kTopLeft_GrSurfaceOrigin); REPORTER_ASSERT(reporter, rt); // image is null GrVkImageInfo backendCopy = *backendTex; backendCopy.fImage = VK_NULL_HANDLE; GrBackendRenderTarget backendRT2(kW, kH, 0, 0, backendCopy); - rt = gpu->wrapBackendRenderTarget(backendRT2); + rt = gpu->wrapBackendRenderTarget(backendRT2, kTopLeft_GrSurfaceOrigin); REPORTER_ASSERT(reporter, !rt); // alloc is null @@ -91,7 +103,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; // can wrap null alloc GrBackendRenderTarget backendRT3(kW, kH, 0, 0, backendCopy); - rt = gpu->wrapBackendRenderTarget(backendRT3); + rt = gpu->wrapBackendRenderTarget(backendRT3, kTopLeft_GrSurfaceOrigin); REPORTER_ASSERT(reporter, rt); // When we wrapBackendRenderTarget it is always borrowed, so we must make sure to free the @@ -107,7 +119,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { const GrVkImageInfo* imageInfo = reinterpret_cast<const GrVkImageInfo*>(backendObj); GrBackendTexture backendTex = GrBackendTexture(kW, kH, *imageInfo); - sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(backendTex, 0, + sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); @@ -115,24 +129,39 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, + kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // alloc is null backendCopy.fImage = imageInfo->fImage; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, + kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // check adopt creation backendCopy.fAlloc = imageInfo->fAlloc; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, + kTopLeft_GrSurfaceOrigin, + 0, + kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); gpu->deleteTestingOnlyBackendTexture(backendObj, true); |