2021-03-09 18:10:59 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Google LLC.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "include/sksl/DSL.h"
|
2022-03-18 20:40:58 +00:00
|
|
|
#include "include/sksl/DSLBlock.h"
|
2021-03-09 18:10:59 +00:00
|
|
|
|
|
|
|
#include "tests/Test.h"
|
|
|
|
|
2022-03-18 20:40:58 +00:00
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace sk_gpu_test { class ContextInfo; }
|
|
|
|
|
2021-03-09 18:10:59 +00:00
|
|
|
// This file verifies that DSL code compiles with only a DSL.h import. We don't bother with any
|
|
|
|
// 'real' tests here, as those are all in SkSLDSLTest.cpp.
|
|
|
|
|
|
|
|
using namespace SkSL::dsl;
|
|
|
|
|
|
|
|
// Defined in SkSLDSLTest.cpp (so that we don't have to put the required extra includes here)
|
|
|
|
void StartDSL(const sk_gpu_test::ContextInfo ctxInfo);
|
|
|
|
|
|
|
|
DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLImportOnly, r, ctxInfo) {
|
|
|
|
StartDSL(ctxInfo);
|
2022-05-19 14:57:29 +00:00
|
|
|
Parameter x(kInt_Type, "x");
|
2021-04-08 20:56:05 +00:00
|
|
|
Function(kInt_Type, "test", x).define(
|
2021-03-09 18:10:59 +00:00
|
|
|
If(x >= 0,
|
|
|
|
Block(Return(x)),
|
|
|
|
Block(Return(-x)))
|
|
|
|
);
|
|
|
|
End();
|
|
|
|
}
|