Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
SkSLTest.cpp File Reference
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkShader.h"
#include "include/core/SkSpan.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "include/private/base/SkTArray.h"
#include "include/sksl/SkSLVersion.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkEnumBitMask.h"
#include "src/base/SkStringView.h"
#include "src/core/SkRasterPipeline.h"
#include "src/core/SkRasterPipelineOpContexts.h"
#include "src/core/SkRasterPipelineOpList.h"
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramKind.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/analysis/SkSLProgramVisitor.h"
#include "src/sksl/codegen/SkSLRasterPipelineBuilder.h"
#include "src/sksl/codegen/SkSLRasterPipelineCodeGenerator.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLModifierFlags.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLProgramElement.h"
#include "src/sksl/ir/SkSLStatement.h"
#include "src/sksl/ir/SkSLType.h"
#include "src/sksl/ir/SkSLVarDeclarations.h"
#include "src/sksl/ir/SkSLVariable.h"
#include "src/sksl/tracing/SkSLDebugTracePriv.h"
#include "tests/CtsEnforcement.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <regex>
#include <string>
#include <string_view>
#include <vector>

Go to the source code of this file.

Classes

struct  UniformData
 

Namespaces

namespace  SkSL
 

Macros

#define ADRENO   "Adreno \\‍(TM\\) "
 
#define NVIDIA   "(Tegra|Quadro|RTX|GTX) "
 
#define DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path)   /* Ganesh is disabled */
 
#define DEF_GRAPHITE_SKSL_TEST(flags, ctsEnforcement, name, path)   /* Graphite is disabled */
 
#define SKSL_TEST(flags, ctsEnforcement, name, path)
 

Typedefs

using SkSLTestFlags = SkEnumBitMask< SkSLTestFlag >
 

Enumerations

enum class  SkSLTestFlag : int {
  CPU = 1 << 0 , ES3 = 1 << 1 , GPU = 1 << 2 , GPU_ES3 = 1 << 3 ,
  UsesNaN = 1 << 4
}
 

Functions

static constexpr bool is_cpu (SkSLTestFlags flags)
 
static constexpr bool is_gpu (SkSLTestFlags flags)
 
static constexpr bool is_strict_es2 (SkSLTestFlags flags)
 
static SkBitmap bitmap_from_shader (skiatest::Reporter *r, SkSurface *surface, sk_sp< SkRuntimeEffect > effect)
 
static bool gpu_generates_nan (skiatest::Reporter *r, GrDirectContext *ctx)
 
static SkString load_source (skiatest::Reporter *r, const char *testFile, const char *permutationSuffix)
 
static bool failure_is_expected (std::string_view deviceName, std::string_view backendAPI, std::string_view name, skiatest::TestType testType)
 
static void test_one_permutation (skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, const char *permutationSuffix, const SkRuntimeEffect::Options &options)
 
static void test_permutations (skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, bool strictES2)
 
static void test_cpu (skiatest::Reporter *r, const char *name, const char *testFile, SkSLTestFlags flags)
 
static void test_clone (skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
 
static void report_rp_pass (skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
 
static void report_rp_fail (skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags, const char *reason)
 
static void test_raster_pipeline (skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
 

Variables

static constexpr int kWidth = 2
 
static constexpr int kHeight = 2
 
static constexpr float kUniformColorBlack [] = {0.0f, 0.0f, 0.0f, 1.0f}
 
static constexpr float kUniformColorRed [] = {1.0f, 0.0f, 0.0f, 1.0f}
 
static constexpr float kUniformColorGreen [] = {0.0f, 1.0f, 0.0f, 1.0f}
 
static constexpr float kUniformColorBlue [] = {0.0f, 0.0f, 1.0f, 1.0f}
 
static constexpr float kUniformColorWhite [] = {1.0f, 1.0f, 1.0f, 1.0f}
 
static constexpr float kUniformTestInputs [] = {-1.25f, 0.0f, 0.75f, 2.25f}
 
static constexpr float kUniformUnknownInput [] = {1.0f}
 
static constexpr float kUniformTestMatrix2x2 []
 
static constexpr float kUniformTestMatrix3x3 []
 
static constexpr float kUniformTestMatrix4x4 []
 
static constexpr float kUniformTestArray [] = {1, 2, 3, 4, 5}
 
static constexpr float kUniformTestArrayNegative [] = {-1, -2, -3, -4, -5}
 
static constexpr UniformData kUniformData []
 
constexpr SkSLTestFlags CPU = SkSLTestFlag::CPU
 
constexpr SkSLTestFlags ES3 = SkSLTestFlag::ES3
 
constexpr SkSLTestFlags GPU = SkSLTestFlag::GPU
 
constexpr SkSLTestFlags GPU_ES3 = SkSLTestFlag::GPU_ES3
 
constexpr SkSLTestFlags UsesNaN = SkSLTestFlag::UsesNaN
 
constexpr auto kApiLevel_T = CtsEnforcement::kApiLevel_T
 
constexpr auto kApiLevel_U = CtsEnforcement::kApiLevel_U
 
constexpr auto kApiLevel_V = CtsEnforcement::kApiLevel_V
 
constexpr auto kNever = CtsEnforcement::kNever
 
constexpr auto kNextRelease = CtsEnforcement::kNextRelease
 

Macro Definition Documentation

◆ ADRENO

#define ADRENO   "Adreno \\‍(TM\\) "

◆ DEF_GANESH_SKSL_TEST

#define DEF_GANESH_SKSL_TEST (   flags,
  ctsEnforcement,
  name,
  path 
)    /* Ganesh is disabled */

Definition at line 906 of file SkSLTest.cpp.

◆ DEF_GRAPHITE_SKSL_TEST

#define DEF_GRAPHITE_SKSL_TEST (   flags,
  ctsEnforcement,
  name,
  path 
)    /* Graphite is disabled */

Definition at line 926 of file SkSLTest.cpp.

◆ NVIDIA

#define NVIDIA   "(Tegra|Quadro|RTX|GTX) "

◆ SKSL_TEST

#define SKSL_TEST (   flags,
  ctsEnforcement,
  name,
  path 
)
Value:
DEF_CONDITIONAL_TEST(SkSL##name##_CPU, r, is_cpu(flags)) { test_cpu(r, #name, path, flags); } \
DEF_TEST(SkSL##name##_RP, r) { test_raster_pipeline(r, path, flags); } \
DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \
DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
DEF_GRAPHITE_SKSL_TEST(flags, std::max(kApiLevel_V, ctsEnforcement), name, path)
static void test_clone(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:735
static void test_cpu(skiatest::Reporter *r, const char *name, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:632
constexpr auto kApiLevel_V
Definition SkSLTest.cpp:957
static void test_raster_pipeline(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:790
static constexpr bool is_cpu(SkSLTestFlags flags)
Definition SkSLTest.cpp:112
#define DEF_CONDITIONAL_TEST(name, reporter, condition)
Definition Test.h:307
FlutterSemanticsFlag flags
const char * name
Definition fuchsia.cc:50

Definition at line 929 of file SkSLTest.cpp.

930 { test_cpu(r, #name, path, flags); } \
931 DEF_TEST(SkSL##name##_RP, r) { test_raster_pipeline(r, path, flags); } \
932 DEF_TEST(SkSL##name##_Clone, r) { test_clone(r, path, flags); } \
933 DEF_GANESH_SKSL_TEST(flags, ctsEnforcement, name, path) \
934 DEF_GRAPHITE_SKSL_TEST(flags, std::max(kApiLevel_V, ctsEnforcement), name, path)

Typedef Documentation

◆ SkSLTestFlags

Definition at line 110 of file SkSLTest.cpp.

Enumeration Type Documentation

◆ SkSLTestFlag

enum class SkSLTestFlag : int
strong
Enumerator
CPU 

CPU tests must pass when painted to a CPU-backed surface via SkRuntimeEffect.

ES3 

ES3 tests must pass when executed directly on the CPU via the SkRasterPipeline backend. They aren't compatible with SkRuntimeEffect, since they use non-ES2 features.

GPU 

GPU tests must pass when painted to a GPU-backed surface via SkRuntimeEffect.

GPU_ES3 

GPU_ES3 tests must pass on ES3-compatible GPUs when "enforce ES2 restrictions" is off.

UsesNaN 

UsesNaN tests rely on NaN values, so they are only expected to pass on GPUs that generate them (which is not a requirement, even with ES3).

Definition at line 87 of file SkSLTest.cpp.

87 : int {
88 /** `CPU` tests must pass when painted to a CPU-backed surface via SkRuntimeEffect. */
89 CPU = 1 << 0,
90
91 /**
92 * `ES3` tests must pass when executed directly on the CPU via the SkRasterPipeline backend.
93 * They aren't compatible with SkRuntimeEffect, since they use non-ES2 features.
94 */
95 ES3 = 1 << 1,
96
97 /** `GPU` tests must pass when painted to a GPU-backed surface via SkRuntimeEffect. */
98 GPU = 1 << 2,
99
100 /** `GPU_ES3` tests must pass on ES3-compatible GPUs when "enforce ES2 restrictions" is off. */
101 GPU_ES3 = 1 << 3,
102
103 /**
104 * `UsesNaN` tests rely on NaN values, so they are only expected to pass on GPUs that generate
105 * them (which is not a requirement, even with ES3).
106 */
107 UsesNaN = 1 << 4,
108};
constexpr SkSLTestFlags CPU
Definition SkSLTest.cpp:950
constexpr SkSLTestFlags ES3
Definition SkSLTest.cpp:951
constexpr SkSLTestFlags UsesNaN
Definition SkSLTest.cpp:954
constexpr SkSLTestFlags GPU
Definition SkSLTest.cpp:952
constexpr SkSLTestFlags GPU_ES3
Definition SkSLTest.cpp:953

Function Documentation

◆ bitmap_from_shader()

static SkBitmap bitmap_from_shader ( skiatest::Reporter r,
SkSurface surface,
sk_sp< SkRuntimeEffect effect 
)
static

Definition at line 163 of file SkSLTest.cpp.

165 {
166
168 for (const UniformData& data : kUniformData) {
170 if (uniform.fVar) {
171 uniform.set(data.span.data(), data.span.size());
172 }
173 }
174
175 sk_sp<SkShader> shader = builder.makeShader();
176 if (!shader) {
177 return SkBitmap{};
178 }
179
180 surface->getCanvas()->clear(SK_ColorBLACK);
181
182 SkPaint paintShader;
183 paintShader.setShader(shader);
184 surface->getCanvas()->drawRect(SkRect::MakeWH(kWidth, kHeight), paintShader);
185
187 REPORTER_ASSERT(r, bitmap.tryAllocPixels(surface->imageInfo()));
188 REPORTER_ASSERT(r, surface->readPixels(bitmap, /*srcX=*/0, /*srcY=*/0));
189 return bitmap;
190}
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
static constexpr int kWidth
Definition SkSLTest.cpp:84
static constexpr UniformData kUniformData[]
Definition SkSLTest.cpp:148
static constexpr int kHeight
Definition SkSLTest.cpp:85
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
void setShader(sk_sp< SkShader > shader)
VkSurfaceKHR surface
Definition main.cc:49
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609
const SkRuntimeEffect::Uniform * fVar
bool set(const T val[], const int count)

◆ failure_is_expected()

static bool failure_is_expected ( std::string_view  deviceName,
std::string_view  backendAPI,
std::string_view  name,
skiatest::TestType  testType 
)
static

Definition at line 238 of file SkSLTest.cpp.

241 { // skiatest::TestType::kGraphite
242 enum TestTypeMatcher { CPU, Ganesh, Graphite, GPU /* either Ganesh or Graphite */ };
243
244 struct TestDisable {
245 std::optional<std::regex> deviceName;
246 std::optional<std::string_view> backendAPI;
247 std::optional<TestTypeMatcher> testTypeMatcher;
248 std::optional<bool> platform;
249 };
250
252
253 // TODO(b/40044139): migrate test-disable list from dm_flags into this map
254 static SkNoDestructor<TestDisableMap> testDisableMap{[] {
255 #define ADRENO "Adreno \\(TM\\) "
256 #define NVIDIA "(Tegra|Quadro|RTX|GTX) "
257
258 TestDisableMap disables;
259 constexpr std::nullopt_t _ = std::nullopt;
260 using regex = std::regex;
261
262#if defined(SK_BUILD_FOR_UNIX)
263 constexpr bool kLinux = true;
264#else
265 constexpr bool kLinux = false;
266#endif
267#if defined(SK_BUILD_FOR_MAC)
268 constexpr bool kMac = true;
269#else
270 constexpr bool kMac = false;
271#endif
272#if defined(SK_BUILD_FOR_IOS)
273 constexpr bool kiOS = true;
274#else
275 constexpr bool kiOS = false;
276#endif
277#if defined(SK_BUILD_FOR_WIN)
278 constexpr bool kWindows = true;
279#else
280 constexpr bool kWindows = false;
281#endif
282#if defined(SK_BUILD_FOR_ANDROID)
283 constexpr bool kAndroid = true;
284#else
285 constexpr bool kAndroid = false;
286#endif
287
288 // - Apple --------------------------------------------------------------------------------
289 // MacOS/iOS do not handle short-circuit evaluation properly in OpenGL (chromium:307751)
290 for (const char* test : {"LogicalAndShortCircuit",
291 "LogicalOrShortCircuit"}) {
292 disables[test].push_back({_, "OpenGL", GPU, kMac || kiOS});
293 }
294
295 // ANGLE has a handful of Mac-specific bugs.
296 for (const char* test : {"MatrixScalarNoOpFolding", // anglebug.com/7525
297 "MatrixScalarMath", // anglebug.com/7525
298 "SwizzleIndexStore", // Apple bug FB12055941
299 "OutParamsAreDistinctFromGlobal", // anglebug.com/7145
300 "IntrinsicMixFloatES3"}) { // anglebug.com/7245
301 disables[test].push_back({_, "ANGLE", GPU, kMac});
302 }
303
304 // Switch fallthrough has some issues on iOS.
305 disables["SwitchWithFallthrough"].push_back({_, "OpenGL", GPU, kiOS});
306
307 // - ARM ----------------------------------------------------------------------------------
308 // Mali 400 is a very old driver its share of quirks, particularly in relation to matrices.
309 for (const char* test : {"Matrices", // b/40043539
310 "MatrixNoOpFolding",
311 "MatrixScalarMath", // b/40043764
312 "MatrixSwizzleStore",
313 "MatrixScalarNoOpFolding", // b/40044644
314 "UnaryPositiveNegative",
315 "Cross"}) {
316 disables[test].push_back({regex("Mali-400"), _, GPU, _});
317 }
318
319 // - Nvidia -------------------------------------------------------------------------------
320 // Tegra3 has several issues, but the inability to break from a for loop is a common theme.
321 for (const char* test : {"Switch", // b/40043561
322 "SwitchDefaultOnly", // " "
323 "SwitchWithFallthrough", // " "
324 "SwitchWithFallthroughAndVarDecls", // " "
325 "SwitchWithLoops", // " "
326 "SwitchCaseFolding", // " "
327 "LoopFloat", // " "
328 "LoopInt", // " "
329 "MatrixScalarNoOpFolding", // b/40044644
330 "MatrixScalarMath", // b/40043764
331 "MatrixFoldingES2", // b/40043017
332 "MatrixEquality", // b/40043017
333 "IntrinsicFract",
334 "ModifiedStructParametersCannotBeInlined"}) {
335 disables[test].push_back({regex("Tegra 3"), _, GPU, _});
336 }
337
338 // Various Nvidia GPUs generate errors when assembling weird matrices, and erroneously
339 // constant-fold expressions with side-effects in constructors when compiling GLSL.
340 for (const char* test : {"MatrixConstructorsES2", // b/40043524
341 "MatrixConstructorsES3", // b/40043524
342 "MatrixScalarNoOpFolding", // b/40044644
343 "PreserveSideEffects", // b/40044140
344 "StructFieldNoFolding"}) { // b/40044479
345 disables[test].push_back({regex(NVIDIA), "OpenGL", _, _});
346 disables[test].push_back({regex(NVIDIA), "ANGLE GL", _, _});
347 }
348
349 disables["IntrinsicMixFloatES3"].push_back({regex("RTX "), "Vulkan", _, kWindows});
350
351 // The Golo features P400s with older and buggier drivers than usual.
352 for (const char* test : {"PreserveSideEffects", // b/40044140
353 "CommaSideEffects"}) {
354 disables[test].push_back({regex("Quadro P400"), _, _, kLinux});
355 }
356
357 // b/318725123
358 for (const char* test : {"UniformArray",
359 "TemporaryIndexLookup",
360 "MatrixIndexLookup"}) {
361 disables[test].push_back({regex("Quadro P400"), "Dawn Vulkan", Graphite, kWindows});
362 }
363
364 // - PowerVR ------------------------------------------------------------------------------
365 for (const char* test : {"OutParamsAreDistinct", // b/40044222
366 "OutParamsAreDistinctFromGlobal"}) {
367 disables[test].push_back({regex("PowerVR Rogue GE8300"), _, GPU, _});
368 }
369
370 // - Radeon -------------------------------------------------------------------------------
371 for (const char* test : {"DeadReturnES3", // b/301326132
372 "IntrinsicAll", // b/40045114
373 "MatrixConstructorsES3", // b/40043524
374 "MatrixScalarNoOpFolding", // b/40044644
375 "StructIndexStore", // b/40045236
376 "SwizzleIndexLookup", // b/40045254
377 "SwizzleIndexStore"}) { // b/40045254
378 disables[test].push_back({regex("Radeon.*(R9|HD)"), "OpenGL", GPU, _});
379 disables[test].push_back({regex("Radeon.*(R9|HD)"), "ANGLE GL", GPU, _});
380 }
381
382 // The Radeon Vega 6 doesn't return zero for the derivative of a uniform.
383 for (const char* test : {"IntrinsicDFdy",
384 "IntrinsicDFdx",
385 "IntrinsicFwidth"}) {
386 disables[test].push_back({regex("AMD RADV RENOIR"), _, GPU, _});
387 }
388
389 // - Adreno -------------------------------------------------------------------------------
390 // Disable broken tests on Android with Adreno GPUs (b/40043413, b/40045254)
391 for (const char* test : {"ArrayCast",
392 "ArrayComparison",
393 "CommaSideEffects",
394 "IntrinsicMixFloatES2",
395 "IntrinsicClampFloat",
396 "SwitchWithFallthrough",
397 "SwizzleIndexLookup",
398 "SwizzleIndexStore"}) {
399 disables[test].push_back({regex(ADRENO "[3456]"), _, _, kAndroid});
400 }
401
402 // Older Adreno 5/6xx drivers report a pipeline error or silently fail when handling inouts.
403 for (const char* test : {"VoidInSequenceExpressions", // b/295217166
404 "InoutParameters", // b/40043966
405 "OutParams",
406 "OutParamsDoubleSwizzle",
407 "OutParamsNoInline",
408 "OutParamsFunctionCallInArgument"}) {
409 disables[test].push_back({regex(ADRENO "[56]"), "Vulkan", _, kAndroid});
410 }
411
412 for (const char* test : {"MatrixToVectorCast", // b/40043288
413 "StructsInFunctions"}) { // b/40043024
414 disables[test].push_back({regex(ADRENO "[345]"), "OpenGL", _, kAndroid});
415 }
416
417 // Constructing a matrix from vectors and scalars can be surprisingly finicky (b/40043539)
418 for (const char* test : {"Matrices",
419 "MatrixNoOpFolding"}) {
420 disables[test].push_back({regex(ADRENO "3"), "OpenGL", _, kAndroid});
421 }
422
423 // Adreno 600 doesn't handle isinf() in OpenGL correctly. (b/40043464)
424 disables["IntrinsicIsInf"].push_back({regex(ADRENO "6"), "OpenGL", _, kAndroid});
425
426 // Older Adreno drivers crash when presented with an empty block (b/40044390)
427 disables["EmptyBlocksES3"].push_back({regex(ADRENO "(540|630)"), _, _, kAndroid});
428
429 // Adrenos alias out-params to globals improperly (b/40044222)
430 disables["OutParamsAreDistinctFromGlobal"].push_back({regex(ADRENO "[3456]"), "OpenGL",
431 _, kAndroid});
432 // Adreno generates the wrong result for this test. (b/40044477)
433 disables["StructFieldFolding"].push_back({regex(ADRENO "[56]"), "OpenGL",
434 _, kAndroid});
435
436 // b/318726662
437 for (const char* test : {"PrefixExpressionsES2",
438 "MatrixToVectorCast",
439 "MatrixConstructorsES2"}) {
440 disables[test].push_back({regex(ADRENO "620"), "Vulkan", Graphite, kAndroid});
441 }
442
443 // - Intel --------------------------------------------------------------------------------
444 // Disable various tests on Intel.
445 // Intrinsic floor() on Intel + ANGLE + DirectX is broken (anglebug.com/5588)
446 disables["IntrinsicFloor"].push_back({regex("Intel.*(Iris|HD)"), "ANGLE D3D", _, _});
447
448 // Intrinsic not() and mix() are broken on Intel GPUs in Metal. (b/40045105)
449 for (const char* test : {"IntrinsicNot",
450 "IntrinsicMixFloatES3"}) {
451 disables[test].push_back({regex("Intel.*(Iris|6000)"), "Metal", _, kMac});
452 }
453
454 // Swizzled-index store is broken across many Intel GPUs. (b/40045254)
455 disables["SwizzleIndexStore"].push_back({regex("Intel"), "OpenGL", _, kMac});
456 disables["SwizzleIndexStore"].push_back({regex("Intel.*Iris"), _, _, kWindows});
457
458 // vec4(mat2) conversions can lead to a crash on Intel + ANGLE (b/40043275)
459 for (const char* test : {"VectorToMatrixCast",
460 "VectorScalarMath",
461 "TrivialArgumentsInlineDirectly"}) {
462 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
463 }
464
465 for (const char* test : {"MatrixFoldingES2",
466 "MatrixEquality",
467 "TemporaryIndexLookup", // b/40045228
468 "SwizzleIndexLookup"}) { // b/40045254
469 disables[test].push_back({regex("Intel.*(Iris|4400)"), "OpenGL", _, kWindows});
470 disables[test].push_back({regex("Intel.*(Iris|4400)"), "ANGLE", _, kWindows});
471 }
472
473 for (const char* test : {"ReturnsValueOnEveryPathES3", // b/40043548
474 "OutParamsAreDistinctFromGlobal", // b/40044222
475 "StructFieldFolding"}) { // b/40044477
476 disables[test].push_back({regex("Intel"), "OpenGL", _, kWindows});
477 disables[test].push_back({regex("Intel"), "ANGLE GL", _, kWindows});
478 }
479
480 for (const char* test : {"SwitchDefaultOnly", // b/40043548
481 "ReturnsValueOnEveryPathES3"}) { // b/40045205
482 disables[test].push_back({regex("Intel"), "Vulkan", _, kLinux});
483 }
484
485 for (const char* test : {"SwitchDefaultOnly"}) {
486 disables[test].push_back({regex("Intel"), "ANGLE", _, kWindows});
487 }
488
489 for (const char* test : {"SwizzleAsLValueES3"}) { // https://anglebug.com/8260
490 disables[test].push_back({regex("Intel"), _, _, kWindows});
491 disables[test].push_back({_, "ANGLE", _, kWindows});
492 }
493
494 // Some Intel GPUs don't return zero for the derivative of a uniform.
495 for (const char* test : {"IntrinsicDFdy",
496 "IntrinsicDFdx",
497 "IntrinsicFwidth"}) {
498 disables[test].push_back({regex("Intel"), _, GPU, _});
499 }
500
501 disables["LoopFloat"].push_back({regex("Intel.*(Iris|6000)"), _, _, kMac}); // b/40043507
502
503 #undef ADRENO
504 #undef NVIDIA
505
506 return disables;
507 }()};
508
509 if (const std::vector<TestDisable>* testDisables = testDisableMap->find(name)) {
510 for (const TestDisable& d : *testDisables) {
511 if (d.platform.has_value() && !*d.platform) {
512 continue; // disable applies to a different platform
513 }
514 if (d.backendAPI.has_value() && !skstd::contains(backendAPI, *d.backendAPI)) {
515 continue; // disable applies to a different backend API
516 }
517 if (d.deviceName.has_value() &&
518 !std::regex_search(deviceName.begin(), deviceName.end(), *d.deviceName)) {
519 continue; // disable applies to a different device
520 }
521 if (d.testTypeMatcher == CPU && testType != skiatest::TestType::kCPU) {
522 continue; // disable only applies to CPU
523 }
524 if (d.testTypeMatcher == Ganesh && testType != skiatest::TestType::kGanesh) {
525 continue; // disable only applies to Ganesh
526 }
527 if (d.testTypeMatcher == Graphite && testType != skiatest::TestType::kGraphite) {
528 continue; // disable only applies to Graphites
529 }
530 if (d.testTypeMatcher == GPU && testType == skiatest::TestType::kCPU) {
531 continue; // disable only applies to GPU
532 }
533 // This test was disabled.
534 return true;
535 }
536 }
537
538 // This test was not in our disable list.
539 return false;
540}
#define test(name)
#define ADRENO
#define NVIDIA
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
constexpr bool contains(std::string_view str, std::string_view needle)

◆ gpu_generates_nan()

static bool gpu_generates_nan ( skiatest::Reporter r,
GrDirectContext ctx 
)
static

Definition at line 192 of file SkSLTest.cpp.

192 {
193#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
194 // The Metal shader compiler (which is also used under-the-hood for some GL/GLES contexts on
195 // these platforms) enables fast-math by default. That prevents NaN-based tests from passing:
196 // https://developer.apple.com/documentation/metal/mtlcompileoptions/1515914-fastmathenabled
197 return false;
198#else
199 // If we don't have infinity support, we definitely won't generate NaNs
200 if (!ctx->priv().caps()->shaderCaps()->fInfinitySupport) {
201 return false;
202 }
203
205 #version 300
206 uniform half4 colorGreen, colorRed;
207
208 half4 main(float2 xy) {
209 return isnan(colorGreen.r / colorGreen.b) ? colorGreen : colorRed;
210 }
211 )")).effect;
212 REPORTER_ASSERT(r, effect);
213
216
217 SkBitmap bitmap = bitmap_from_shader(r, surface.get(), effect);
218 REPORTER_ASSERT(r, !bitmap.empty());
219
220 SkColor color = bitmap.getColor(0, 0);
222 return color == SK_ColorGREEN;
223#endif
224}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
SkColor4f color
uint32_t SkColor
Definition SkColor.h:37
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
static SkBitmap bitmap_from_shader(skiatest::Reporter *r, SkSurface *surface, sk_sp< SkRuntimeEffect > effect)
Definition SkSLTest.cpp:163
const GrCaps * caps() const
const GrShaderCaps * shaderCaps() const
Definition GrCaps.h:63
GrDirectContextPriv priv()
static Result MakeForShader(SkString sksl, const Options &)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static SkImageInfo MakeN32Premul(int width, int height)
sk_sp< SkRuntimeEffect > effect
bool fInfinitySupport
Definition SkSLUtil.h:103

◆ is_cpu()

static constexpr bool is_cpu ( SkSLTestFlags  flags)
staticconstexpr

Definition at line 112 of file SkSLTest.cpp.

112 {
114}
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35

◆ is_gpu()

static constexpr bool is_gpu ( SkSLTestFlags  flags)
staticconstexpr

Definition at line 116 of file SkSLTest.cpp.

◆ is_strict_es2()

static constexpr bool is_strict_es2 ( SkSLTestFlags  flags)
staticconstexpr

Definition at line 120 of file SkSLTest.cpp.

120 {
122}

◆ load_source()

static SkString load_source ( skiatest::Reporter r,
const char *  testFile,
const char *  permutationSuffix 
)
static

Definition at line 226 of file SkSLTest.cpp.

228 {
229 SkString resourcePath = SkStringPrintf("sksl/%s", testFile);
230 sk_sp<SkData> shaderData = GetResourceAsData(resourcePath.c_str());
231 if (!shaderData) {
232 ERRORF(r, "%s%s: Unable to load file", testFile, permutationSuffix);
233 return SkString("");
234 }
235 return SkString{reinterpret_cast<const char*>(shaderData->bytes()), shaderData->size()};
236}
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition Resources.cpp:42
SK_API SkString static SkString SkStringPrintf()
Definition SkString.h:287
#define ERRORF(r,...)
Definition Test.h:293
const char * c_str() const
Definition SkString.h:133

◆ report_rp_fail()

static void report_rp_fail ( skiatest::Reporter r,
const char *  testFile,
SkSLTestFlags  flags,
const char *  reason 
)
static

Definition at line 781 of file SkSLTest.cpp.

784 {
786 ERRORF(r, "%s: %s", testFile, reason);
787 }
788}

◆ report_rp_pass()

static void report_rp_pass ( skiatest::Reporter r,
const char *  testFile,
SkSLTestFlags  flags 
)
static

Definition at line 775 of file SkSLTest.cpp.

775 {
777 ERRORF(r, "NEW: %s", testFile);
778 }
779}

◆ test_clone()

static void test_clone ( skiatest::Reporter r,
const char *  testFile,
SkSLTestFlags  flags 
)
static

Definition at line 735 of file SkSLTest.cpp.

735 {
736 SkString shaderString = load_source(r, testFile, "");
737 if (shaderString.isEmpty()) {
738 return;
739 }
741 // TODO(skia:11209): Can we just put the correct #version in the source files that need this?
744 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
745 SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
746 if (!program) {
747 ERRORF(r, "%s", compiler.errorText().c_str());
748 return;
749 }
750
751 // Clone every expression in the program, and ensure that its clone generates the same
752 // description as the original.
753 class CloneVisitor : public SkSL::ProgramVisitor {
754 public:
755 CloneVisitor(skiatest::Reporter* r) : fReporter(r) {}
756
757 bool visitExpression(const SkSL::Expression& expr) override {
758 std::string original = expr.description();
759 std::string cloned = expr.clone()->description();
760 REPORTER_ASSERT(fReporter, original == cloned,
761 "Mismatch after clone!\nOriginal: %s\nCloned: %s\n",
762 original.c_str(), cloned.c_str());
763
764 return INHERITED::visitExpression(expr);
765 }
766
767 skiatest::Reporter* fReporter;
768
769 using INHERITED = ProgramVisitor;
770 };
771
772 CloneVisitor{r}.visit(*program);
773}
#define INHERITED(method,...)
static constexpr bool is_strict_es2(SkSLTestFlags flags)
Definition SkSLTest.cpp:120
static SkString load_source(skiatest::Reporter *r, const char *testFile, const char *permutationSuffix)
Definition SkSLTest.cpp:226
virtual std::unique_ptr< Expression > clone(Position pos) const =0
std::string description() const final
virtual bool visitExpression(typename T::Expression &expression)
bool isEmpty() const
Definition SkString.h:130

◆ test_cpu()

static void test_cpu ( skiatest::Reporter r,
const char *  name,
const char *  testFile,
SkSLTestFlags  flags 
)
static

Definition at line 632 of file SkSLTest.cpp.

635 {
637
638 // Create a raster-backed surface.
641
642 test_permutations(r, "CPU", "SkRP", surface.get(), name, testFile,
643 skiatest::TestType::kCPU, /*strictES2=*/true);
644}
#define SkASSERT(cond)
Definition SkAssert.h:116
static void test_permutations(skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, bool strictES2)
Definition SkSLTest.cpp:614
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)

◆ test_one_permutation()

static void test_one_permutation ( skiatest::Reporter r,
std::string_view  deviceName,
std::string_view  backendAPI,
SkSurface surface,
const char *  name,
const char *  testFile,
skiatest::TestType  testType,
const char *  permutationSuffix,
const SkRuntimeEffect::Options options 
)
static

Definition at line 542 of file SkSLTest.cpp.

550 {
551 SkString shaderString = load_source(r, testFile, permutationSuffix);
552 if (shaderString.isEmpty()) {
553 return;
554 }
556 if (!result.effect) {
557 ERRORF(r, "%s%s: %s", testFile, permutationSuffix, result.errorText.c_str());
558 return;
559 }
560 if (failure_is_expected(deviceName, backendAPI, name, testType)) {
561 // Some driver bugs can be catastrophic (e.g. crashing dm entirely), so we don't even try to
562 // run a shader if we expect that it might fail.
563 SkDebugf("%s: skipped %.*s%s\n", testFile, (int)backendAPI.size(), backendAPI.data(),
564 permutationSuffix);
565 return;
566 }
567
569 if (bitmap.empty()) {
570 ERRORF(r, "%s%s: Unable to build shader", testFile, permutationSuffix);
571 return;
572 }
573
574 bool success = true;
576 for (int y = 0; y < kHeight; ++y) {
577 for (int x = 0; x < kWidth; ++x) {
578 color[y][x] = bitmap.getColor(x, y);
579 if (color[y][x] != SK_ColorGREEN) {
580 success = false;
581 }
582 }
583 }
584
585 if (!success) {
586 static_assert(kWidth == 2);
587 static_assert(kHeight == 2);
588
589 SkString message = SkStringPrintf("Expected%s: solid green. Actual output from %.*s using "
590 "%.*s:\n"
591 "RRGGBBAA RRGGBBAA\n"
592 "%02X%02X%02X%02X %02X%02X%02X%02X\n"
593 "%02X%02X%02X%02X %02X%02X%02X%02X",
594 permutationSuffix,
595 (int)deviceName.size(), deviceName.data(),
596 (int)backendAPI.size(), backendAPI.data(),
597
598 SkColorGetR(color[0][0]), SkColorGetG(color[0][0]),
599 SkColorGetB(color[0][0]), SkColorGetA(color[0][0]),
600
601 SkColorGetR(color[0][1]), SkColorGetG(color[0][1]),
602 SkColorGetB(color[0][1]), SkColorGetA(color[0][1]),
603
604 SkColorGetR(color[1][0]), SkColorGetG(color[1][0]),
605 SkColorGetB(color[1][0]), SkColorGetA(color[1][0]),
606
607 SkColorGetR(color[1][1]), SkColorGetG(color[1][1]),
608 SkColorGetB(color[1][1]), SkColorGetA(color[1][1]));
609
610 ERRORF(r, "%s", message.c_str());
611 }
612}
const char * options
#define SkColorGetR(color)
Definition SkColor.h:65
#define SkColorGetG(color)
Definition SkColor.h:69
#define SkColorGetA(color)
Definition SkColor.h:61
#define SkColorGetB(color)
Definition SkColor.h:73
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool failure_is_expected(std::string_view deviceName, std::string_view backendAPI, std::string_view name, skiatest::TestType testType)
Definition SkSLTest.cpp:238
GAsyncResult * result
Win32Message message
double y
double x

◆ test_permutations()

static void test_permutations ( skiatest::Reporter r,
std::string_view  deviceName,
std::string_view  backendAPI,
SkSurface surface,
const char *  name,
const char *  testFile,
skiatest::TestType  testType,
bool  strictES2 
)
static

Definition at line 614 of file SkSLTest.cpp.

621 {
624 options.forceUnoptimized = false;
625 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType, "", options);
626
627 options.forceUnoptimized = true;
628 test_one_permutation(r, deviceName, backendAPI, surface, name, testFile, testType,
629 " (Unoptimized)", options);
630}
static void test_one_permutation(skiatest::Reporter *r, std::string_view deviceName, std::string_view backendAPI, SkSurface *surface, const char *name, const char *testFile, skiatest::TestType testType, const char *permutationSuffix, const SkRuntimeEffect::Options &options)
Definition SkSLTest.cpp:542
static SkRuntimeEffect::Options ES3Options()

◆ test_raster_pipeline()

static void test_raster_pipeline ( skiatest::Reporter r,
const char *  testFile,
SkSLTestFlags  flags 
)
static

Definition at line 790 of file SkSLTest.cpp.

792 {
793 SkString shaderString = load_source(r, testFile, "");
794 if (shaderString.isEmpty()) {
795 return;
796 }
797
798 // In Raster Pipeline, we can compile and run test shaders directly, without involving a surface
799 // at all.
802 settings.fMaxVersionAllowed = SkSL::Version::k300;
803 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(
804 SkSL::ProgramKind::kRuntimeShader, shaderString.c_str(), settings);
805 if (!program) {
806 ERRORF(r, "%s: Unexpected compilation error\n%s", testFile, compiler.errorText().c_str());
807 return;
808 }
809 const SkSL::FunctionDeclaration* main = program->getFunction("main");
810 if (!main) {
811 ERRORF(r, "%s: Program must have a 'main' function", testFile);
812 return;
813 }
814
815 // Match up uniforms from the program against our list of test uniforms, and build up a data
816 // buffer of uniform floats.
817 size_t offset = 0;
819 const SkSL::Context& ctx(compiler.context());
820
821 for (const SkSL::ProgramElement* elem : program->elements()) {
822 // Variables (uniform, etc.)
823 if (elem->is<SkSL::GlobalVarDeclaration>()) {
825 const SkSL::VarDeclaration& varDecl = global.declaration()->as<SkSL::VarDeclaration>();
826 const SkSL::Variable& var = *varDecl.var();
827
828 if (var.type().isEffectChild()) {
829 ERRORF(r, "%s: Test program cannot contain child effects", testFile);
830 return;
831 }
832 // 'uniform' variables
833 if (var.modifierFlags().isUniform()) {
835 }
836 }
837 }
838
839 TArray<float> uniformValues;
840 for (const SkRuntimeEffect::Uniform& programUniform : uniforms) {
841 bool foundMatch = false;
842 for (const UniformData& data : kUniformData) {
843 if (data.name == programUniform.name) {
844 SkASSERT(data.span.size() * sizeof(float) == programUniform.sizeInBytes());
845 foundMatch = true;
846 uniformValues.push_back_n(data.span.size(), data.span.data());
847 break;
848 }
849 }
850 if (!foundMatch) {
851 report_rp_fail(r, testFile, flags, "unsupported uniform");
852 return;
853 }
854 }
855
856 // Compile our program.
857 SkArenaAlloc alloc(/*firstHeapAllocation=*/1000);
858 SkRasterPipeline pipeline(&alloc);
859 SkSL::DebugTracePriv debugTrace;
860 std::unique_ptr<SkSL::RP::Program> rasterProg =
862 *main->definition(),
863 &debugTrace);
864 if (!rasterProg) {
865 report_rp_fail(r, testFile, flags, "code is not supported");
866 return;
867 }
868
869 // Append the SkSL program to the raster pipeline.
870 pipeline.appendConstantColor(&alloc, SkColors::kTransparent);
871 rasterProg->appendStages(&pipeline, &alloc, /*callbacks=*/nullptr, SkSpan(uniformValues));
872
873 // Move the float values from RGBA into an 8888 memory buffer.
876 pipeline.append(SkRasterPipelineOp::store_8888, &outCtx);
877 pipeline.run(0, 0, 1, 1);
878
879 // Make sure the first pixel (exclusively) of `out` is green. If the program compiled
880 // successfully, we expect it to run without error, and will assert if it doesn't.
881 uint32_t expected = 0xFF00FF00;
882 if (out[0] != expected) {
883 ERRORF(r, "%s: Raster Pipeline failed. Expected solid green, got ARGB:%02X%02X%02X%02X",
884 testFile,
885 (out[0] >> 24) & 0xFF,
886 (out[0] >> 16) & 0xFF,
887 (out[0] >> 8) & 0xFF,
888 out[0] & 0xFF);
889 return;
890 }
891
892 // Success!
893 report_rp_pass(r, testFile, flags);
894}
static constexpr int SkRasterPipeline_kMaxStride_highp
static void report_rp_pass(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags)
Definition SkSLTest.cpp:775
static void report_rp_fail(skiatest::Reporter *r, const char *testFile, SkSLTestFlags flags, const char *reason)
Definition SkSLTest.cpp:781
static SkRuntimeEffect::Uniform VarAsUniform(const SkSL::Variable &, const SkSL::Context &, size_t *offset)
std::unique_ptr< Statement > & declaration()
const T & as() const
Definition SkSLIRNode.h:133
T * push_back_n(int n)
Definition SkTArray.h:262
constexpr SkColor4f kTransparent
Definition SkColor.h:434
std::unique_ptr< RP::Program > MakeRasterPipelineProgram(const SkSL::Program &program, const FunctionDefinition &function, DebugTracePriv *debugTrace, bool writeTraceOps)
Definition main.py:1
Point offset

Variable Documentation

◆ CPU

constexpr SkSLTestFlags CPU = SkSLTestFlag::CPU
constexpr

Test flags:

  • CPU: this test should pass on the CPU backend
  • GPU: this test should pass on the Ganesh GPU backends
  • GPU_ES3: this test should pass on an ES3-compatible GPU when "enforce ES2 restrictions" is off

CtsEnforcement: Android CTS (go/wtf/cts) enforces that devices must pass this test at the given API level. CTS and Android SkQP builds should only run tests on devices greater than the provided API level, but other test binaries (dm/fm) should run every test, regardless of this value.

Definition at line 950 of file SkSLTest.cpp.

◆ ES3

constexpr SkSLTestFlags ES3 = SkSLTestFlag::ES3
constexpr

Definition at line 951 of file SkSLTest.cpp.

◆ GPU

constexpr SkSLTestFlags GPU = SkSLTestFlag::GPU
constexpr

Definition at line 952 of file SkSLTest.cpp.

◆ GPU_ES3

constexpr SkSLTestFlags GPU_ES3 = SkSLTestFlag::GPU_ES3
constexpr

Definition at line 953 of file SkSLTest.cpp.

◆ kApiLevel_T

constexpr auto kApiLevel_T = CtsEnforcement::kApiLevel_T
constexpr

Definition at line 955 of file SkSLTest.cpp.

◆ kApiLevel_U

constexpr auto kApiLevel_U = CtsEnforcement::kApiLevel_U
constexpr

Definition at line 956 of file SkSLTest.cpp.

◆ kApiLevel_V

constexpr auto kApiLevel_V = CtsEnforcement::kApiLevel_V
constexpr

Definition at line 957 of file SkSLTest.cpp.

◆ kHeight

constexpr int kHeight = 2
staticconstexpr

Definition at line 85 of file SkSLTest.cpp.

◆ kNever

constexpr auto kNever = CtsEnforcement::kNever
constexpr

Definition at line 958 of file SkSLTest.cpp.

◆ kNextRelease

constexpr auto kNextRelease = CtsEnforcement::kNextRelease
constexpr

Definition at line 959 of file SkSLTest.cpp.

◆ kUniformColorBlack

constexpr float kUniformColorBlack[] = {0.0f, 0.0f, 0.0f, 1.0f}
staticconstexpr

Definition at line 129 of file SkSLTest.cpp.

129{0.0f, 0.0f, 0.0f, 1.0f};

◆ kUniformColorBlue

constexpr float kUniformColorBlue[] = {0.0f, 0.0f, 1.0f, 1.0f}
staticconstexpr

Definition at line 132 of file SkSLTest.cpp.

132{0.0f, 0.0f, 1.0f, 1.0f};

◆ kUniformColorGreen

constexpr float kUniformColorGreen[] = {0.0f, 1.0f, 0.0f, 1.0f}
staticconstexpr

Definition at line 131 of file SkSLTest.cpp.

131{0.0f, 1.0f, 0.0f, 1.0f};

◆ kUniformColorRed

constexpr float kUniformColorRed[] = {1.0f, 0.0f, 0.0f, 1.0f}
staticconstexpr

Definition at line 130 of file SkSLTest.cpp.

130{1.0f, 0.0f, 0.0f, 1.0f};

◆ kUniformColorWhite

constexpr float kUniformColorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f}
staticconstexpr

Definition at line 133 of file SkSLTest.cpp.

133{1.0f, 1.0f, 1.0f, 1.0f};

◆ kUniformData

constexpr UniformData kUniformData[]
staticconstexpr
Initial value:
= {
{"colorBlack", kUniformColorBlack},
{"colorRed", kUniformColorRed},
{"colorGreen", kUniformColorGreen},
{"colorBlue", kUniformColorBlue},
{"colorWhite", kUniformColorWhite},
{"testInputs", kUniformTestInputs},
{"unknownInput", kUniformUnknownInput},
{"testMatrix2x2", kUniformTestMatrix2x2},
{"testMatrix3x3", kUniformTestMatrix3x3},
{"testMatrix4x4", kUniformTestMatrix4x4},
{"testArray", kUniformTestArray},
{"testArrayNegative", kUniformTestArrayNegative},
}
static constexpr float kUniformTestMatrix3x3[]
Definition SkSLTest.cpp:138
static constexpr float kUniformTestMatrix4x4[]
Definition SkSLTest.cpp:141
static constexpr float kUniformColorGreen[]
Definition SkSLTest.cpp:131
static constexpr float kUniformColorWhite[]
Definition SkSLTest.cpp:133
static constexpr float kUniformTestArrayNegative[]
Definition SkSLTest.cpp:146
static constexpr float kUniformColorBlack[]
Definition SkSLTest.cpp:129
static constexpr float kUniformTestMatrix2x2[]
Definition SkSLTest.cpp:136
static constexpr float kUniformTestInputs[]
Definition SkSLTest.cpp:134
static constexpr float kUniformColorRed[]
Definition SkSLTest.cpp:130
static constexpr float kUniformColorBlue[]
Definition SkSLTest.cpp:132
static constexpr float kUniformTestArray[]
Definition SkSLTest.cpp:145
static constexpr float kUniformUnknownInput[]
Definition SkSLTest.cpp:135

Definition at line 148 of file SkSLTest.cpp.

148 {
149 {"colorBlack", kUniformColorBlack},
150 {"colorRed", kUniformColorRed},
151 {"colorGreen", kUniformColorGreen},
152 {"colorBlue", kUniformColorBlue},
153 {"colorWhite", kUniformColorWhite},
154 {"testInputs", kUniformTestInputs},
155 {"unknownInput", kUniformUnknownInput},
156 {"testMatrix2x2", kUniformTestMatrix2x2},
157 {"testMatrix3x3", kUniformTestMatrix3x3},
158 {"testMatrix4x4", kUniformTestMatrix4x4},
159 {"testArray", kUniformTestArray},
160 {"testArrayNegative", kUniformTestArrayNegative},
161};

◆ kUniformTestArray

constexpr float kUniformTestArray[] = {1, 2, 3, 4, 5}
staticconstexpr

Definition at line 145 of file SkSLTest.cpp.

145{1, 2, 3, 4, 5};

◆ kUniformTestArrayNegative

constexpr float kUniformTestArrayNegative[] = {-1, -2, -3, -4, -5}
staticconstexpr

Definition at line 146 of file SkSLTest.cpp.

146{-1, -2, -3, -4, -5};

◆ kUniformTestInputs

constexpr float kUniformTestInputs[] = {-1.25f, 0.0f, 0.75f, 2.25f}
staticconstexpr

Definition at line 134 of file SkSLTest.cpp.

134{-1.25f, 0.0f, 0.75f, 2.25f};

◆ kUniformTestMatrix2x2

constexpr float kUniformTestMatrix2x2[]
staticconstexpr
Initial value:
= {1.0f, 2.0f,
3.0f, 4.0f}

Definition at line 136 of file SkSLTest.cpp.

136 {1.0f, 2.0f,
137 3.0f, 4.0f};

◆ kUniformTestMatrix3x3

constexpr float kUniformTestMatrix3x3[]
staticconstexpr
Initial value:
= {1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f,
7.0f, 8.0f, 9.0f}

Definition at line 138 of file SkSLTest.cpp.

138 {1.0f, 2.0f, 3.0f,
139 4.0f, 5.0f, 6.0f,
140 7.0f, 8.0f, 9.0f};

◆ kUniformTestMatrix4x4

constexpr float kUniformTestMatrix4x4[]
staticconstexpr
Initial value:
= {1.0f, 2.0f, 3.0f, 4.0f,
5.0f, 6.0f, 7.0f, 8.0f,
9.0f, 10.0f, 11.0f, 12.0f,
13.0f, 14.0f, 15.0f, 16.0f}

Definition at line 141 of file SkSLTest.cpp.

141 {1.0f, 2.0f, 3.0f, 4.0f,
142 5.0f, 6.0f, 7.0f, 8.0f,
143 9.0f, 10.0f, 11.0f, 12.0f,
144 13.0f, 14.0f, 15.0f, 16.0f};

◆ kUniformUnknownInput

constexpr float kUniformUnknownInput[] = {1.0f}
staticconstexpr

Definition at line 135 of file SkSLTest.cpp.

135{1.0f};

◆ kWidth

constexpr int kWidth = 2
staticconstexpr

Definition at line 84 of file SkSLTest.cpp.

◆ UsesNaN

constexpr SkSLTestFlags UsesNaN = SkSLTestFlag::UsesNaN
constexpr

Definition at line 954 of file SkSLTest.cpp.