aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RenderTargetContextTest.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2016-11-07 21:26:31 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-07 21:26:46 +0000
commit7d7d7d19462b75f5470492dc4820a02c1eba4af2 (patch)
tree5afc268cac425ef6e5b07c07af0293864e7ac2d7 /tests/RenderTargetContextTest.cpp
parent6749af40739fab375d87951c5b0fb51a195e1f8c (diff)
Revert "Add GrRenderTargetContext instantiate & asTextureProxy"
This reverts commit 9113edfff89e657dabc0ba095c54f7720550196c. Reason for revert: Looks to be causing EXCEPTION_ACCESS_VIOLATION: https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-NUC-GPU-IntelIris6100-x86_64-Debug/builds/121/steps/test_skia%20on%20Windows/logs/stdio https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-GCE-CPU-AVX2-x86-Debug/builds/2384/steps/test_skia%20on%20Windows-2008ServerR2-SP1/logs/stdio https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-ShuttleC-GPU-iHD530-x86_64-Debug/builds/785/steps/test_skia%20on%20Windows/logs/stdio Original change's description: > Add GrRenderTargetContext instantiate & asTextureProxy > > This CL also centralizes the instantiation code in GrSurfaceProxy and adds a test. > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4494 > > Change-Id: I0081d9a216dc0af293179f23bcb88acf6a822324 > Reviewed-on: https://skia-review.googlesource.com/4494 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I225ce7867ebd445067e5ea55ebbfd587f7fe782a Reviewed-on: https://skia-review.googlesource.com/4528 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests/RenderTargetContextTest.cpp')
-rw-r--r--tests/RenderTargetContextTest.cpp100
1 files changed, 0 insertions, 100 deletions
diff --git a/tests/RenderTargetContextTest.cpp b/tests/RenderTargetContextTest.cpp
deleted file mode 100644
index 9a4b8747da..0000000000
--- a/tests/RenderTargetContextTest.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// This is a GPU-backend specific test.
-
-#include "Test.h"
-
-#if SK_SUPPORT_GPU
-#include "GrTextureProxy.h"
-#include "GrRenderTargetContext.h"
-
-static const int kSize = 64;
-
-static sk_sp<GrRenderTargetContext> get_rtc(GrContext* ctx, bool wrapped) {
-
- if (wrapped) {
- return ctx->makeRenderTargetContext(SkBackingFit::kExact,
- kSize, kSize,
- kRGBA_8888_GrPixelConfig, nullptr);
- } else {
- return ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact,
- kSize, kSize,
- kRGBA_8888_GrPixelConfig, nullptr);
- }
-}
-
-static void check_is_wrapped_status(skiatest::Reporter* reporter,
- GrRenderTargetContext* rtCtx,
- bool wrappedExpectation) {
- REPORTER_ASSERT(reporter, rtCtx->isWrapped_ForTesting() == wrappedExpectation);
-
- GrTextureProxy* tProxy = rtCtx->asDeferredTexture();
- REPORTER_ASSERT(reporter, tProxy);
-
- REPORTER_ASSERT(reporter, tProxy->isWrapped_ForTesting() == wrappedExpectation);
-}
-
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
-
- // A wrapped rtCtx's textureProxy is also wrapped
- {
- sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, true));
- check_is_wrapped_status(reporter, rtCtx.get(), true);
- }
-
- // A deferred rtCtx's textureProxy is also deferred and GrRenderTargetContext::instantiate()
- // swaps both from deferred to wrapped
- {
- sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
-
- check_is_wrapped_status(reporter, rtCtx.get(), false);
-
- GrRenderTarget* rt = rtCtx->instantiate();
- REPORTER_ASSERT(reporter, rt);
-
- check_is_wrapped_status(reporter, rtCtx.get(), true);
- }
-
- // Calling instantiate on a GrRenderTargetContext's textureProxy also instantiates the
- // GrRenderTargetContext
- {
- sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
-
- check_is_wrapped_status(reporter, rtCtx.get(), false);
-
- GrTextureProxy* tProxy = rtCtx->asDeferredTexture();
- REPORTER_ASSERT(reporter, tProxy);
-
- GrTexture* tex = tProxy->instantiate(ctx->textureProvider());
- REPORTER_ASSERT(reporter, tex);
-
- check_is_wrapped_status(reporter, rtCtx.get(), true);
- }
-
- // readPixels switches a deferred rtCtx to wrapped
- {
- sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
-
- check_is_wrapped_status(reporter, rtCtx.get(), false);
-
- SkImageInfo dstInfo = SkImageInfo::MakeN32Premul(kSize, kSize);
- SkAutoTMalloc<uint32_t> dstBuffer(kSize * kSize);
- static const size_t kRowBytes = sizeof(uint32_t) * kSize;
-
- bool result = rtCtx->readPixels(dstInfo, dstBuffer.get(), kRowBytes, 0, 0);
- REPORTER_ASSERT(reporter, result);
-
- check_is_wrapped_status(reporter, rtCtx.get(), true);
- }
-
- // TODO: in a future world we should be able to add a test that the majority of
- // GrRenderTargetContext calls do not force the instantiation of a deferred
- // GrRenderTargetContext
-}
-#endif