aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-10-14 08:13:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-14 08:13:48 -0700
commit11abd8d6cb2887bf66711863fb2dfe47da86d979 (patch)
tree6f828174fe46c7b694345a9cf46288f1c2e88996 /tests
parent777b5633f599f2a99e2035fdb7ab600779ab95ac (diff)
Explicit control in tools of ANGLE frontend and backend
Update the ANGLE test GL context, GrContextFactory, and config parsing to allow explicit control of ANGLE front/backend. This will allow us to explicitly test ES2 vs ES3 interfaces to ANGLE as well as D3D9, D3D11, and OpenGL backends. Also makes the angle api types valid in all builds (but will just fail when SK_ANGLE=1 or not on windows for the d3d backends). BUG=skia:5804 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2381033002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-ShuttleC-GPU-GTX960-x86_64-Debug-ANGLE-Trybot Review-Url: https://codereview.chromium.org/2381033002
Diffstat (limited to 'tests')
-rw-r--r--tests/FloatingPointTextureTest.cpp17
-rw-r--r--tests/ResourceCacheTest.cpp12
-rw-r--r--tests/Test.h1
-rw-r--r--tests/TestConfigParsing.cpp63
4 files changed, 49 insertions, 44 deletions
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 9f543667f1..2e79c35d10 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -69,7 +69,18 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo)
static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only*/;
static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2 ^ 11
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) {
+// The half float tests currently fail on ES3 ANGLE.
+static bool is_rendering_and_not_angle_es3(sk_gpu_test::GrContextFactory::ContextType type) {
+ if (type == sk_gpu_test::GrContextFactory::kANGLE_D3D11_ES3_ContextType ||
+ type == sk_gpu_test::GrContextFactory::kANGLE_GL_ES3_ContextType) {
+ return false;
+ }
+ return sk_gpu_test::GrContextFactory::IsRenderingContext(type);
+}
+
+DEF_GPUTEST_FOR_CONTEXTS(HalfFloatAlphaTextureTest,
+ &is_rendering_and_not_angle_es3,
+ reporter, ctxInfo) {
runFPTest<SkHalf>(reporter, ctxInfo.grContext(), SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint,
HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig);
@@ -77,7 +88,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo)
static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/;
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_CONTEXTS(HalfFloatRGBATextureTest,
+ &is_rendering_and_not_angle_es3,
+ reporter, ctxInfo) {
runFPTest<SkHalf>(reporter, ctxInfo.grContext(), SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint,
HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig);
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index d73ad641e7..b6f13e69bb 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -80,7 +80,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
context->setResourceCacheLimits(oldMaxNum, oldMaxBytes);
}
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) {
+static bool is_rendering_and_not_angle_es3(sk_gpu_test::GrContextFactory::ContextType type) {
+ if (type == sk_gpu_test::GrContextFactory::kANGLE_D3D11_ES3_ContextType ||
+ type == sk_gpu_test::GrContextFactory::kANGLE_GL_ES3_ContextType) {
+ return false;
+ }
+ return sk_gpu_test::GrContextFactory::IsRenderingContext(type);
+}
+
+// This currently fails on ES3 ANGLE contexts
+DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter,
+ ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrSurfaceDesc smallDesc;
smallDesc.fFlags = kRenderTarget_GrSurfaceFlag;
diff --git a/tests/Test.h b/tests/Test.h
index 5a3339dad1..ea10cdf7e3 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -92,7 +92,6 @@ extern bool IsGLContextType(GrContextFactoryContextType);
extern bool IsVulkanContextType(GrContextFactoryContextType);
extern bool IsRenderingGLContextType(GrContextFactoryContextType);
extern bool IsNullGLContextType(GrContextFactoryContextType);
-
void RunWithGPUTestContexts(GrContextTestFn*, GrContextTypeFilterFn*,
Reporter*, sk_gpu_test::GrContextFactory*);
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index 8435b99ce5..4d7e5cad0e 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -77,9 +77,9 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16", "msaa4",
"nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvprdit4", "pdf", "skp",
- "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui", "gpuf16", "gpusrgb",
- "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk", "glinst", "glinst4", "glinstdit4",
- "glinst16", "glinstdit16", "esinst", "esinst4", "esinstdit4", "glwide"
+ "svg", "xps", "angle_d3d11_es2", "angle_gl_es2", "commandbuffer", "mesa", "hwui", "gpuf16",
+ "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk", "glinst", "glinst4",
+ "glinstdit4", "glinst16", "glinstdit16", "esinst", "esinst4", "esinstdit4", "glwide"
});
SkCommandLineConfigArray configs;
@@ -167,18 +167,8 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseInstanced());
REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getSamples() == 4);
-
-#if SK_ANGLE
-#ifdef SK_BUILD_FOR_WIN
REPORTER_ASSERT(reporter, configs[20]->asConfigGpu());
-#else
- REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu());
-#endif
REPORTER_ASSERT(reporter, configs[21]->asConfigGpu());
-#else
- REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu());
-#endif
REPORTER_ASSERT(reporter, configs[22]->asConfigGpu());
#if SK_MESA
REPORTER_ASSERT(reporter, configs[23]->asConfigGpu());
@@ -207,8 +197,8 @@ DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"gpu[nvpr=true,dit=false]",
- "gpu[api=angle]",
- "gpu[api=angle-gl]",
+ "gpu[api=angle_d3d9_es2]",
+ "gpu[api=angle_gl_es3]",
"gpu[api=mesa,samples=77]",
"gpu[dit=true,api=commandbuffer]",
"gpu[]",
@@ -229,19 +219,12 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
-#if SK_ANGLE
-#ifdef SK_BUILD_FOR_WIN
REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() ==
- GrContextFactory::kANGLE_ContextType);
-#else
- REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
-#endif
+ GrContextFactory::kANGLE_D3D9_ES2_ContextType);
+ REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() ==
- GrContextFactory::kANGLE_GL_ContextType);
-#else
- REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
-#endif
+ GrContextFactory::kANGLE_GL_ES3_ContextType);
+ REPORTER_ASSERT(reporter, configs[2]->asConfigGpu());
#if SK_MESA
REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()->getContextType() ==
GrContextFactory::kMESA_ContextType);
@@ -280,7 +263,7 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"gpu[nvpr=1]", // Number as bool.
"gpu[api=gl,]", // Trailing in comma.
- "gpu[api=angle-glu]", // Unknown api.
+ "gpu[api=angle_glu]", // Unknown api.
"gpu[api=,samples=0]", // Empty api.
"gpu[samples=true]", // Value true as a number.
"gpu[samples=0,samples=0]", // Duplicate option key.
@@ -329,7 +312,7 @@ DEF_TEST(ParseConfigs_ViaParsing, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"a-b-c-8888",
"zz-qq-gpu",
- "a-angle-gl"
+ "a-angle_gl_es2"
});
SkCommandLineConfigArray configs;
@@ -340,12 +323,7 @@ DEF_TEST(ParseConfigs_ViaParsing, reporter) {
} expectedConfigs[] = {
{"8888", {"a", "b", "c"}},
{"gpu", {"zz", "qq", nullptr}},
-#if SK_ANGLE
- { "gpu",{ "a", nullptr, nullptr } } // With SK_ANGLE, angle-gl becomes gpu(api=angle-gl)
-#else
- { "angle-gl",{ "a", nullptr, nullptr } } // The angle-gl tag is only tag that contains
- // hyphen.
-#endif
+ {"gpu", { "a", nullptr, nullptr }}
};
for (int i = 0; i < config1.count(); ++i) {
REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
@@ -364,8 +342,9 @@ DEF_TEST(ParseConfigs_ViaParsing, reporter) {
DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
SkCommandLineFlags::StringArray config1 = make_string_array({
"zz-qq-gpu[api=gles]",
+ "abc-nbc-cbs-gpu[api=angle_d3d9_es2,samples=1]",
"a-gpu[samples=1",
- "abc-def-angle-gl[samples=1]",
+ "abc-def-angle_gl_es2[samples=1]",
});
SkCommandLineConfigArray configs;
@@ -376,13 +355,16 @@ DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
} expectedConfigs[] = {
#if SK_SUPPORT_GPU
{"gpu", {"zz", "qq", nullptr}},
+ {"gpu", {"abc", "nbc", "cbs"}},
#else
{"gpu[api=gles]", {"zz", "qq", nullptr}},
+ {"gpu[api=angle_d3d9_es2,samples=1]", {"abc", "nbc", "cbs"}},
#endif
- {"gpu[samples=1", {"a", nullptr, nullptr}}, // This is not extended form, but via still
- // works as expected.
- {"gl[samples=1]", {"abc", "def", "angle"}} // This is not extended form. Also
- // angle-gl is not a "backend" in this case.
+ {"gpu[samples=1", {"a", nullptr, nullptr}}, // Missing bracket makes this is not extended
+ // form but via still works as expected.
+ {"angle_gl_es2[samples=1]", {"abc", "def", nullptr}} // This is not extended form.
+ // angle_gl_es2 is an api type not a
+ // backend.
};
for (int i = 0; i < config1.count(); ++i) {
REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
@@ -399,7 +381,8 @@ DEF_TEST(ParseConfigs_ViaParsingExtendedForm, reporter) {
}
#if SK_SUPPORT_GPU
REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
- REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
+ REPORTER_ASSERT(reporter, configs[1]->asConfigGpu());
REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
+ REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
#endif
}