xref: /third_party/skia/tests/SkSLDSLOnlyTest.cpp (revision cb93a386)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/tests/
1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2021 Google LLC.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "include/sksl/DSL.h"
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci#include "tests/Test.h"
11cb93a386Sopenharmony_ci
12cb93a386Sopenharmony_ci// This file verifies that DSL code compiles with only a DSL.h import. We don't bother with any
13cb93a386Sopenharmony_ci// 'real' tests here, as those are all in SkSLDSLTest.cpp.
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_ciusing namespace SkSL::dsl;
16cb93a386Sopenharmony_ci
17cb93a386Sopenharmony_ci// Defined in SkSLDSLTest.cpp (so that we don't have to put the required extra includes here)
18cb93a386Sopenharmony_civoid StartDSL(const sk_gpu_test::ContextInfo ctxInfo);
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ciDEF_GPUTEST_FOR_MOCK_CONTEXT(DSLImportOnly, r, ctxInfo) {
21cb93a386Sopenharmony_ci    StartDSL(ctxInfo);
22cb93a386Sopenharmony_ci    Parameter x(kInt_Type);
23cb93a386Sopenharmony_ci    Function(kInt_Type, "test", x).define(
24cb93a386Sopenharmony_ci        If(x >= 0,
25cb93a386Sopenharmony_ci            Block(Return(x)),
26cb93a386Sopenharmony_ci            Block(Return(-x)))
27cb93a386Sopenharmony_ci    );
28cb93a386Sopenharmony_ci    End();
29cb93a386Sopenharmony_ci}
30

Indexes created Thu Nov 07 10:32:03 CST 2024