diff options
author | Robert Phillips <robertphillips@google.com> | 2017-07-28 11:56:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-31 16:02:42 +0000 |
commit | df0e09feacb29290fe94d37f921731b18f2edae0 (patch) | |
tree | 8059c31deb493e101b616578f6db0d4bc4d05438 /tests | |
parent | f57c0d67611186ba74179b53b421e64b63a579c7 (diff) |
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>
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, 30 insertions, 59 deletions
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 5c665d13af..abf2973db7 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, kTopLeft_GrSurfaceOrigin, 0, kBorrow_GrWrapOwnership); + backendTex, 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 78465f989f..9f5801cd47 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, desc.fOrigin)); + sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT)); SkASSERT(!defaultFBO->asTexture()); return GrSurfaceProxy::MakeWrapped(std::move(defaultFBO), desc.fOrigin); diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 547d3b2ce3..87072dd25b 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -63,7 +63,6 @@ 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()); @@ -98,7 +97,6 @@ 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()); @@ -234,7 +232,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { config, fboInfo); sk_sp<GrRenderTarget> defaultFBO( - provider->wrapBackendRenderTarget(backendRT, origin)); + provider->wrapBackendRenderTarget(backendRT)); sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO, origin)); diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index 4c40619c4e..ffe7e35861 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, p.fOrigin, + sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin); } @@ -169,9 +169,8 @@ 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 not share - // TODO: rm this test case - { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kDontShare }, + // Two non-overlapping intervals w/ different origins should share + { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kShare }, }; for (auto test : gNonOverlappingTests) { diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 48f50a0c48..c10d581288 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -96,9 +96,10 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl GrContext* context = ctxInfo.grContext(); GrSurfaceDesc smallDesc; smallDesc.fFlags = kRenderTarget_GrSurfaceFlag; - smallDesc.fConfig = kRGBA_8888_GrPixelConfig; + smallDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; smallDesc.fWidth = 4; smallDesc.fHeight = 4; + smallDesc.fConfig = kRGBA_8888_GrPixelConfig; smallDesc.fSampleCnt = 0; if (context->caps()->avoidStencilBuffers()) { @@ -136,9 +137,10 @@ 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.fConfig = kRGBA_8888_GrPixelConfig; + bigDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; 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()) { @@ -228,7 +230,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI kRGBA_8888_GrPixelConfig, texHandles[0]); sk_sp<GrTexture> borrowed(context->resourceProvider()->wrapBackendTexture( - backendTex1, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership)); + backendTex1, kBorrow_GrWrapOwnership)); GrBackendTexture backendTex2 = GrTest::CreateBackendTexture(context->contextPriv().getBackend(), kW, @@ -236,7 +238,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxI kRGBA_8888_GrPixelConfig, texHandles[1]); sk_sp<GrTexture> adopted(context->resourceProvider()->wrapBackendTexture( - backendTex2, kTopLeft_GrSurfaceOrigin, kAdopt_GrWrapOwnership)); + backendTex2, kAdopt_GrWrapOwnership)); REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr); if (!borrowed || !adopted) { @@ -1636,6 +1638,7 @@ 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 daeaadad08..722707ae9b 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(), 0, 0, kTextureWidth, kTextureHeight, + result = context->getGpu()->readPixels(tex.get(), origin, 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(), 0, 0, kTextureWidth, kTextureHeight, + result = context->getGpu()->readPixels(tex.get(), origin, 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 f64043df62..4f4c83362f 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -37,42 +37,30 @@ 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, - kTopLeft_GrSurfaceOrigin, - kBorrow_GrWrapOwnership); + sk_sp<GrTexture> tex = gpu->wrapBackendTexture(backendTex, 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, - kTopLeft_GrSurfaceOrigin, - kBorrow_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, 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, - kTopLeft_GrSurfaceOrigin, - kBorrow_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // check adopt creation backendCopy.fAlloc = imageInfo->fAlloc; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - kAdopt_GrWrapOwnership); + tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); @@ -88,14 +76,14 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrBackendRenderTarget backendRT(kW, kH, 0, 0, *backendTex); - sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT, kTopLeft_GrSurfaceOrigin); + sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(backendRT); 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, kTopLeft_GrSurfaceOrigin); + rt = gpu->wrapBackendRenderTarget(backendRT2); REPORTER_ASSERT(reporter, !rt); // alloc is null @@ -103,7 +91,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, kTopLeft_GrSurfaceOrigin); + rt = gpu->wrapBackendRenderTarget(backendRT3); REPORTER_ASSERT(reporter, rt); // When we wrapBackendRenderTarget it is always borrowed, so we must make sure to free the @@ -119,9 +107,7 @@ 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, - kTopLeft_GrSurfaceOrigin, - 0, + sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); @@ -129,39 +115,24 @@ 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, - kTopLeft_GrSurfaceOrigin, - 0, - kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - 0, - kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 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, - kTopLeft_GrSurfaceOrigin, - 0, - kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - 0, - kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); // check adopt creation backendCopy.fAlloc = imageInfo->fAlloc; backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, - kTopLeft_GrSurfaceOrigin, - 0, - kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); gpu->deleteTestingOnlyBackendTexture(backendObj, true); |