skia2/tests/SkSLDSLOnlyTest.cpp
John Stiles a6178be7d1 Require DSL variables to have names.
The DSLVar class hierarchy had many constructor variations to support
the idea of creating DSL variables without explicitly assigning a name
to them. Instead, name-mangling would automatically assign them a name
like `_123_var`. This was designed to make it easlier to write a
complete shader in DSL.

We no longer have DSL name-mangling, or intend to create complete
programs in pure DSL. In the absence of name-mangling, these
constructors aren't useful (every variable would be named `var`).
They have been removed.

Change-Id: If533e479cc04c5a6ced9a7e880dcc56063f29374
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542138
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-05-19 16:57:29 +00:00

35 lines
893 B
C++

/*
* 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"
#include "include/sksl/DSLBlock.h"
#include "tests/Test.h"
#include <utility>
namespace sk_gpu_test { class ContextInfo; }
// 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);
Parameter x(kInt_Type, "x");
Function(kInt_Type, "test", x).define(
If(x >= 0,
Block(Return(x)),
Block(Return(-x)))
);
End();
}