blob: fae9afaf68c45f8789c83512547f13a3c1fc4b55 [file] [log] [blame]
Ethan Nicholas95046142021-01-07 10:57:27 -05001/*
2 * Copyright 2020 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 "src/gpu/GrDirectContextPriv.h"
9#include "src/gpu/GrGpu.h"
10#include "src/sksl/SkSLIRGenerator.h"
11#include "src/sksl/dsl/DSL.h"
12#include "src/sksl/dsl/priv/DSLWriter.h"
13
14#include "tests/Test.h"
15
16using namespace SkSL::dsl;
17
18class AutoDSLContext {
19public:
20 AutoDSLContext(GrGpu* gpu) {
21 Start(gpu->shaderCompiler());
22 }
23
24 ~AutoDSLContext() {
25 End();
26 }
27};
28
29DEF_GPUTEST_FOR_ALL_CONTEXTS(DSLStartup, r, ctxInfo) {
30 AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
31 Expression e1 = 1;
32 REPORTER_ASSERT(r, e1.release()->description() == "1");
33 Expression e2 = 1.0;
34 REPORTER_ASSERT(r, e2.release()->description() == "1.0");
35 Expression e3 = true;
36 REPORTER_ASSERT(r, e3.release()->description() == "true");
37}