Ethan Nicholas | 24c1772 | 2021-03-09 13:10:59 -0500 | [diff] [blame] | 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 | |
| 10 | #include "tests/Test.h" |
| 11 | |
| 12 | // This file verifies that DSL code compiles with only a DSL.h import. We don't bother with any |
| 13 | // 'real' tests here, as those are all in SkSLDSLTest.cpp. |
| 14 | |
| 15 | using namespace SkSL::dsl; |
| 16 | |
| 17 | // Defined in SkSLDSLTest.cpp (so that we don't have to put the required extra includes here) |
| 18 | void StartDSL(const sk_gpu_test::ContextInfo ctxInfo); |
| 19 | |
| 20 | DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLImportOnly, r, ctxInfo) { |
| 21 | StartDSL(ctxInfo); |
Ethan Nicholas | a2d22b2 | 2021-07-15 10:35:54 -0400 | [diff] [blame^] | 22 | Parameter x(kInt_Type); |
Ethan Nicholas | b14e6b9 | 2021-04-08 16:56:05 -0400 | [diff] [blame] | 23 | Function(kInt_Type, "test", x).define( |
Ethan Nicholas | 24c1772 | 2021-03-09 13:10:59 -0500 | [diff] [blame] | 24 | If(x >= 0, |
| 25 | Block(Return(x)), |
| 26 | Block(Return(-x))) |
| 27 | ); |
| 28 | End(); |
| 29 | } |