Ethan Nicholas | 9504614 | 2021-01-07 10:57:27 -0500 | [diff] [blame] | 1 | /* |
| 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 | |
| 16 | using namespace SkSL::dsl; |
| 17 | |
| 18 | class AutoDSLContext { |
| 19 | public: |
| 20 | AutoDSLContext(GrGpu* gpu) { |
| 21 | Start(gpu->shaderCompiler()); |
| 22 | } |
| 23 | |
| 24 | ~AutoDSLContext() { |
| 25 | End(); |
| 26 | } |
| 27 | }; |
| 28 | |
| 29 | DEF_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 | } |