• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "include/sksl/DSL.h"
9 #include "tests/Test.h"
10 
11 #include <string_view>
12 
13 struct GrContextOptions;
14 
15 // This file verifies that DSL code compiles with only a DSL.h import. We don't bother with any
16 // 'real' tests here, as those are all in SkSLDSLTest.cpp.
17 // IWYU pragma: no_include "include/sksl/DSLCore.h"
18 // IWYU pragma: no_include "include/sksl/DSLExpression.h"
19 // IWYU pragma: no_include "include/sksl/DSLStatement.h"
20 // IWYU pragma: no_include "include/sksl/DSLType.h"
21 
22 using namespace SkSL::dsl;
23 
24 // Defined in SkSLDSLUtil.cpp (so that we don't have to put the required extra includes here)
25 void StartDSL(const sk_gpu_test::ContextInfo ctxInfo);
26 
DEF_GANESH_TEST_FOR_MOCK_CONTEXT(DSLImportOnly,r,ctxInfo)27 DEF_GANESH_TEST_FOR_MOCK_CONTEXT(DSLImportOnly, r, ctxInfo) {
28     StartDSL(ctxInfo);
29     Parameter x(kInt_Type, "x");
30     Function(kInt_Type, "test", x).define(
31         If(x >= 0,
32             Block(Return(x)),
33             Block(Return(-x)))
34     );
35     End();
36 }
37