diff options
author | John Stiles <johnstiles@google.com> | 2022-03-09 16:26:32 -0500 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2022-03-22 17:56:43 +0000 |
commit | 81a6da59a0a0f9422d96aaed318d0533733f5ecb (patch) | |
tree | fbb1f1c19fdecd3f936e14486b774b6cdb682a50 | |
parent | d432e5640f11b315f72901f17d30a4aaf7db9cf6 (diff) | |
download | skia-81a6da59a0a0f9422d96aaed318d0533733f5ecb.tar.gz |
Honor SkQP flag when running SkSL tests.
The Android builds of SkQP will conditionally exclude any tests that are
not flagged with `SkQP`.
Note that local builds of the C++ skqp binary do not actually set
SK_BUILD_FOR_SKQP. This flag is set by gn_to_bp. So local skqp binaries
will continue to run these tests. A possible fix for this limitation
has been written in the followup CL: http://review.skia.org/518939
Bug: skia:13037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/518936
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Change-Id: Ic339c86722c1a54f0b798d557f2355494de165a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522993
Reviewed-by: John Stiles <johnstiles@google.com>
-rw-r--r-- | platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt | 49 | ||||
-rw-r--r-- | tests/SkSLTest.cpp | 31 |
2 files changed, 21 insertions, 59 deletions
diff --git a/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt b/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt index 63c4b33331..8b8a2a0ab0 100644 --- a/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt +++ b/platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt @@ -31,55 +31,6 @@ MorphologyFilterRadiusWithMirrorCTM_Gpu # Android doesn't use promise images PromiseImage* -SkSLArrayCast_GPU -SkSLArrayComparison_GPU -SkSLArrayConstructors_GPU -SkSLArrayFollowedByScalar_GPU -SkSLArrayNarrowingConversions_GPU -SkSLConstArray_GPU -SkSLDeadLoopVariable_GPU -SkSLDoWhileBodyMustBeInlinedIntoAScope_GPU -SkSLDoWhileControlFlow_GPU -SkSLDoWhileTestCannotBeInlined_GPU -SkSLEmptyBlocksES3_GPU -SkSLForInitializerExpressionsCanBeInlined_GPU -SkSLHexUnsigned_GPU -SkSLIntFoldingES3_GPU -SkSLIntrinsicAbsInt_GPU -SkSLIntrinsicClampInt_GPU -SkSLIntrinsicClampUInt_GPU -SkSLIntrinsicDFdx_GPU -SkSLIntrinsicDFdy_GPU -SkSLIntrinsicDeterminant_GPU -SkSLIntrinsicFloatBitsToInt_GPU -SkSLIntrinsicFloatBitsToUint_GPU -SkSLIntrinsicFwidth_GPU -SkSLIntrinsicIntBitsToFloat_GPU -SkSLIntrinsicIsInf_GPU -SkSLIntrinsicMatrixCompMultES3_GPU -SkSLIntrinsicMaxInt_GPU -SkSLIntrinsicMinInt_GPU -SkSLIntrinsicModf_GPU -SkSLIntrinsicOuterProduct_GPU -SkSLIntrinsicRoundEven_GPU -SkSLIntrinsicRound_GPU -SkSLIntrinsicSignInt_GPU -SkSLIntrinsicTranspose_GPU -SkSLIntrinsicTrunc_GPU -SkSLIntrinsicUintBitsToFloat_GPU -SkSLMatricesNonsquare_GPU -SkSLMatrixFoldingES3_GPU -SkSLOperatorsES3_GPU -SkSLResizeMatrixNonsquare_GPU -SkSLReturnsValueOnEveryPathES3_GPU -SkSLScalarConversionConstructorsES3_GPU -SkSLStaticSwitchInline_GPU -SkSLStaticSwitch_GPU -SkSLSwizzleByIndex_GPU -SkSLWhileBodyMustBeInlinedIntoAScope_GPU -SkSLWhileLoopControlFlow_GPU -SkSLWhileTestCannotBeInlined_GPU - SkipCopyTaskTest SkipOpsTaskTest SmallBoxBlurBug diff --git a/tests/SkSLTest.cpp b/tests/SkSLTest.cpp index 80370fb1fa..f8d1852d16 100644 --- a/tests/SkSLTest.cpp +++ b/tests/SkSLTest.cpp @@ -48,7 +48,7 @@ namespace SkSLTestFlags { static constexpr int GPU_ES3 = 1 << 3; /** SkQP tests will be run in Android/Fuchsia conformance tests with no driver workarounds. */ - static constexpr int SkQP = 1 << 4; // TODO(skia:13037): implement SkQP flag + static constexpr int SkQP = 1 << 4; } static constexpr bool is_cpu(int flags) { @@ -63,6 +63,16 @@ static constexpr bool is_strict_es2(int flags) { return !(flags & (SkSLTestFlags::CPU_ES3 | SkSLTestFlags::GPU_ES3)); } +static constexpr bool should_run_in_skqp(int flags) { +#if defined(SK_BUILD_FOR_SKQP) + // Official SkQP builds should only run tests marked with the SkQP flag. + return flags & (SkSLTestFlags::SkQP); +#else + // Other test binaries (dm/fm) should run every test, regardless of the SkQP flag. + return true; +#endif +} + template <typename T> static void set_uniform(SkRuntimeShaderBuilder* builder, const char* name, const T& value) { SkRuntimeShaderBuilder::BuilderUniform uniform = builder->uniform(name); @@ -288,14 +298,15 @@ static void test_rehydrate(skiatest::Reporter* r, const char* testFile, int flag rehydrated->description().c_str()); } -#define SKSL_TEST(flags, name, path) \ - DEF_CONDITIONAL_TEST(SkSL##name##_CPU, r, is_cpu(flags)) { \ - test_cpu(r, path, flags); \ - } \ - DEF_CONDITIONAL_GPUTEST_FOR_RENDERING_CONTEXTS(SkSL##name##_GPU, r, ctxInfo, is_gpu(flags)) { \ - test_gpu(r, ctxInfo.directContext(), path, flags); \ - } \ - DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \ +#define SKSL_TEST(flags, name, path) \ + DEF_CONDITIONAL_TEST(SkSL##name##_CPU, r, is_cpu(flags) && should_run_in_skqp(flags)) { \ + test_cpu(r, path, flags); \ + } \ + DEF_CONDITIONAL_GPUTEST_FOR_RENDERING_CONTEXTS( \ + SkSL##name##_GPU, r, ctxInfo, is_gpu(flags) && should_run_in_skqp(flags)) { \ + test_gpu(r, ctxInfo.directContext(), path, flags); \ + } \ + DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \ DEF_TEST(SkSL##name##_Rehydrate, r) { test_rehydrate(r, path, flags); } /** @@ -304,7 +315,7 @@ static void test_rehydrate(skiatest::Reporter* r, const char* testFile, int flag * - CPU_ES3: this test should pass on the CPU backend when "enforce ES2 restrictions" is off * - GPU: this test should pass on the GPU backends * - GPU_ES3: this test should pass on an ES3-compatible GPU when "enforce ES2 restrictions" is off - * - SkQP: TODO(skia:13037): Android CTS (go/wtf/cts) enforces that devices must pass this test + * - SkQP: Android CTS (go/wtf/cts) enforces that devices must pass this test */ // clang-format off |