aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-07-13 19:19:36 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-13 19:19:45 +0000
commita80a012456a95a6996a8901268ec34ed0cc3aecb (patch)
tree6c46e5bf7f8ec1a915b367742512cddf65d91681 /tests
parent1e04b3659cd35dfb47a9843fd42123bb6bdcaa5d (diff)
Revert "implemented metal gpu backend texture upload testing"
This reverts commit 36848f6b30ddaca461c98e13b9976b2c449ca547. Reason for revert: Test-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_CCPR failing. Original change's description: > implemented metal gpu backend texture upload testing > > Bug: skia: > Change-Id: Ia3af58a0710f7f9792b37682a3cc45dd14282b71 > Reviewed-on: https://skia-review.googlesource.com/140248 > Commit-Queue: Timothy Liang <timliang@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,ethannicholas@google.com,timliang@google.com Change-Id: Idf40fc78b82aec1efbcc64221b6d2bbf63353960 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/141182 Reviewed-by: Timothy Liang <timliang@google.com> Commit-Queue: Timothy Liang <timliang@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GrTestingBackendTextureUploadTest.cpp81
-rw-r--r--tests/Test.h4
-rw-r--r--tests/TestUtils.cpp29
-rw-r--r--tests/TestUtils.h8
-rw-r--r--tests/VkUploadPixelsTests.cpp31
5 files changed, 30 insertions, 123 deletions
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
deleted file mode 100644
index 1bdd455d67..0000000000
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypes.h"
-
-#include "GrGpu.h"
-#include "GrContextPriv.h"
-#include "GrTexture.h"
-#include "SkConvertPixels.h"
-#include "Test.h"
-#include "TestUtils.h"
-
-void testing_only_texture_test(skiatest::Reporter* reporter, GrContext* context, GrColorType ct,
- bool renderTarget, bool doDataUpload, GrMipMapped mipMapped) {
- const int kWidth = 16;
- const int kHeight = 16;
- SkAutoTMalloc<GrColor> srcBuffer;
- if (doDataUpload) {
- srcBuffer.reset(kWidth * kHeight);
- fill_pixel_data(kWidth, kHeight, srcBuffer.get());
- }
- SkAutoTMalloc<GrColor> dstBuffer(kWidth * kHeight);
-
- GrGpu* gpu = context->contextPriv().getGpu();
-
- GrPixelConfig config = GrColorTypeToPixelConfig(ct, GrSRGBEncoded::kNo);
- if (!gpu->caps()->isConfigTexturable(config)) {
- return;
- }
-
- GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(srcBuffer,
- kWidth,
- kHeight,
- config,
- renderTarget,
- mipMapped);
- sk_sp<GrTexture> wrappedTex;
- if (renderTarget) {
- wrappedTex = gpu->wrapRenderableBackendTexture(backendTex, 1,
- GrWrapOwnership::kAdopt_GrWrapOwnership);
- } else {
- wrappedTex = gpu->wrapBackendTexture(backendTex,
- GrWrapOwnership::kAdopt_GrWrapOwnership);
- }
- REPORTER_ASSERT(reporter, wrappedTex);
-
- int rowBytes = GrColorTypeBytesPerPixel(ct) * kWidth;
- bool result = gpu->readPixels(wrappedTex.get(), 0, 0, kWidth,
- kHeight, ct, dstBuffer, rowBytes);
-
- if (!doDataUpload) {
- // createTestingOnlyBackendTexture will fill the texture with 0's if no data is provided, so
- // we set the expected result likewise.
- srcBuffer.reset(kWidth * kHeight);
- memset(srcBuffer, 0, kWidth * kHeight * sizeof(GrColor));
- }
- REPORTER_ASSERT(reporter, result);
- REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuffer, dstBuffer,
- kWidth, kHeight));
-}
-
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrTestingBackendTextureUploadTest, reporter, ctxInfo) {
- for (auto colorType: {GrColorType::kRGBA_8888, GrColorType::kBGRA_8888}) {
- for (bool renderable: {true, false}) {
- for (bool doDataUpload: {true, false}) {
- testing_only_texture_test(reporter, ctxInfo.grContext(), colorType,
- renderable, doDataUpload, GrMipMapped::kNo);
-
- if (!doDataUpload) {
- testing_only_texture_test(reporter, ctxInfo.grContext(), colorType,
- renderable, doDataUpload, GrMipMapped::kYes);
- }
- }
- }
- }
-}
-
diff --git a/tests/Test.h b/tests/Test.h
index a4c931b330..97604a2c72 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -129,7 +129,6 @@ typedef bool GrContextTypeFilterFn(GrContextFactoryContextType);
extern bool IsGLContextType(GrContextFactoryContextType);
extern bool IsVulkanContextType(GrContextFactoryContextType);
-extern bool IsMetalContextType(GrContextFactoryContextType);
extern bool IsRenderingGLContextType(GrContextFactoryContextType);
extern bool IsNullGLContextType(GrContextFactoryContextType);
void RunWithGPUTestContexts(GrContextTestFn*, GrContextTypeFilterFn*, Reporter*,
@@ -214,9 +213,6 @@ private:
#define DEF_GPUTEST_FOR_VULKAN_CONTEXT(name, reporter, context_info) \
DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsVulkanContextType, \
reporter, context_info, nullptr)
-#define DEF_GPUTEST_FOR_METAL_CONTEXT(name, reporter, context_info) \
- DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsMetalContextType, \
- reporter, context_info, nullptr)
#define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \
do { \
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index 8b611c2064..44a78c51fb 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -113,32 +113,3 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyPr
}
}
}
-
-void fill_pixel_data(int width, int height, GrColor* data) {
- for (int j = 0; j < height; ++j) {
- for (int i = 0; i < width; ++i) {
- unsigned int red = (unsigned int)(256.f * (i / (float)width));
- unsigned int green = (unsigned int)(256.f * (j / (float)height));
- data[i + j * width] = GrColorPackRGBA(red - (red >> 8), green - (green >> 8),
- 0xff, 0xff);
- }
- }
-}
-
-bool does_full_buffer_contain_correct_color(GrColor* srcBuffer,
- GrColor* dstBuffer,
- int width,
- int height) {
- GrColor* srcPtr = srcBuffer;
- GrColor* dstPtr = dstBuffer;
- for (int j = 0; j < height; ++j) {
- for (int i = 0; i < width; ++i) {
- if (srcPtr[i] != dstPtr[i]) {
- return false;
- }
- }
- srcPtr += width;
- dstPtr += width;
- }
- return true;
-}
diff --git a/tests/TestUtils.h b/tests/TestUtils.h
index e89193195b..1fe96bff7c 100644
--- a/tests/TestUtils.h
+++ b/tests/TestUtils.h
@@ -9,7 +9,6 @@
class GrSurfaceContext;
class GrSurfaceProxy;
-typedef uint32_t GrColor;
// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
void test_read_pixels(skiatest::Reporter*,
@@ -30,10 +29,3 @@ void test_copy_from_surface(skiatest::Reporter*, GrContext*,
// Ensure that RGBA 8888 pixels can be copied into 'dstContext'
void test_copy_to_surface(skiatest::Reporter*, GrProxyProvider*,
GrSurfaceContext* dstContext, const char* testName);
-
-// Fills data with a red-green gradient
-void fill_pixel_data(int width, int height, GrColor* data);
-
-// Checks srcBuffer and dstBuffer contain the same colors
-bool does_full_buffer_contain_correct_color(GrColor* srcBuffer, GrColor* dstBuffer, int width,
- int height);
diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp
index b13de41571..bd87d19cd1 100644
--- a/tests/VkUploadPixelsTests.cpp
+++ b/tests/VkUploadPixelsTests.cpp
@@ -18,11 +18,40 @@
#include "ProxyUtils.h"
#include "SkGr.h"
#include "Test.h"
-#include "TestUtils.h"
#include "vk/GrVkGpu.h"
using sk_gpu_test::GrContextFactory;
+void fill_pixel_data(int width, int height, GrColor* data) {
+
+ // build red-green gradient
+ for (int j = 0; j < height; ++j) {
+ for (int i = 0; i < width; ++i) {
+ unsigned int red = (unsigned int)(256.f*(i / (float)width));
+ unsigned int green = (unsigned int)(256.f*(j / (float)height));
+ data[i + j*width] = GrColorPackRGBA(red - (red>>8), green - (green>>8), 0xff, 0xff);
+ }
+ }
+}
+
+bool does_full_buffer_contain_correct_color(GrColor* srcBuffer,
+ GrColor* dstBuffer,
+ int width,
+ int height) {
+ GrColor* srcPtr = srcBuffer;
+ GrColor* dstPtr = dstBuffer;
+ for (int j = 0; j < height; ++j) {
+ for (int i = 0; i < width; ++i) {
+ if (srcPtr[i] != dstPtr[i]) {
+ return false;
+ }
+ }
+ srcPtr += width;
+ dstPtr += width;
+ }
+ return true;
+}
+
void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, SkColorType ct,
bool renderTarget) {
const int kWidth = 16;