/src/skia/src/gpu/ganesh/GrShaderVar.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2016 Google Inc. |
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/core/SkSLTypeShared.h" |
9 | | #include "src/gpu/ganesh/GrShaderCaps.h" |
10 | | #include "src/gpu/ganesh/GrShaderVar.h" |
11 | | |
12 | 0 | static const char* type_modifier_string(GrShaderVar::TypeModifier t) { |
13 | 0 | switch (t) { |
14 | 0 | case GrShaderVar::TypeModifier::None: return ""; |
15 | 0 | case GrShaderVar::TypeModifier::In: return "in"; |
16 | 0 | case GrShaderVar::TypeModifier::InOut: return "inout"; |
17 | 0 | case GrShaderVar::TypeModifier::Out: return "out"; |
18 | 0 | case GrShaderVar::TypeModifier::Uniform: return "uniform"; |
19 | 0 | } |
20 | 0 | SK_ABORT("Unknown shader variable type modifier."); |
21 | 0 | } |
22 | | |
23 | 0 | void GrShaderVar::appendDecl(const GrShaderCaps* shaderCaps, SkString* out) const { |
24 | 0 | if (!fLayoutQualifier.isEmpty()) { |
25 | 0 | out->appendf("layout(%s) ", fLayoutQualifier.c_str()); |
26 | 0 | } |
27 | 0 | if (!fExtraModifiers.isEmpty()) { |
28 | 0 | out->appendf("%s ", fExtraModifiers.c_str()); |
29 | 0 | } |
30 | 0 | if (this->getTypeModifier() != TypeModifier::None) { |
31 | 0 | out->appendf("%s ", type_modifier_string(this->getTypeModifier())); |
32 | 0 | } |
33 | 0 | SkSLType effectiveType = this->getType(); |
34 | 0 | if (this->isArray()) { |
35 | 0 | SkASSERT(this->getArrayCount() > 0); |
36 | 0 | out->appendf("%s %s[%d]", |
37 | 0 | SkSLTypeString(effectiveType), |
38 | 0 | this->getName().c_str(), |
39 | 0 | this->getArrayCount()); |
40 | 0 | } else { |
41 | 0 | out->appendf("%s %s", SkSLTypeString(effectiveType), this->getName().c_str()); |
42 | 0 | } |
43 | 0 | } Unexecuted instantiation: GrShaderVar::appendDecl(GrShaderCaps const*, SkString*) const Unexecuted instantiation: GrShaderVar::appendDecl(GrShaderCaps const*, SkString*) const |