/src/skia/src/sksl/ir/SkSLVariableReference.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2018 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/sksl/ir/SkSLVariableReference.h" |
9 | | |
10 | | #include "src/sksl/SkSLIRGenerator.h" |
11 | | #include "src/sksl/ir/SkSLConstructor.h" |
12 | | #include "src/sksl/ir/SkSLFloatLiteral.h" |
13 | | #include "src/sksl/ir/SkSLSetting.h" |
14 | | |
15 | | namespace SkSL { |
16 | | |
17 | | VariableReference::VariableReference(int offset, const Variable* variable, RefKind refKind) |
18 | | : INHERITED(offset, kExpressionKind, &variable->type()) |
19 | | , fVariable(variable) |
20 | 18.0M | , fRefKind(refKind) { |
21 | 18.0M | SkASSERT(this->variable()); |
22 | 18.0M | } SkSL::VariableReference::VariableReference(int, SkSL::Variable const*, SkSL::VariableRefKind) Line | Count | Source | 20 | 884 | , fRefKind(refKind) { | 21 | 884 | SkASSERT(this->variable()); | 22 | 884 | } |
SkSL::VariableReference::VariableReference(int, SkSL::Variable const*, SkSL::VariableRefKind) Line | Count | Source | 20 | 18.0M | , fRefKind(refKind) { | 21 | 18.0M | SkASSERT(this->variable()); | 22 | 18.0M | } |
|
23 | | |
24 | 1.76M | bool VariableReference::hasProperty(Property property) const { |
25 | 1.76M | switch (property) { |
26 | 1.76M | case Property::kSideEffects: return false; |
27 | 0 | case Property::kContainsRTAdjust: return this->variable()->name() == "sk_RTAdjust"; |
28 | 0 | default: |
29 | 0 | SkASSERT(false); |
30 | 0 | return false; |
31 | 1.76M | } |
32 | 1.76M | } |
33 | | |
34 | 1.91k | bool VariableReference::isConstantOrUniform() const { |
35 | 1.91k | return (this->variable()->modifiers().fFlags & Modifiers::kUniform_Flag) != 0; |
36 | 1.91k | } |
37 | | |
38 | 0 | String VariableReference::description() const { |
39 | 0 | return String(this->variable()->name()); |
40 | 0 | } |
41 | | |
42 | 2.63M | void VariableReference::setRefKind(RefKind refKind) { |
43 | 2.63M | fRefKind = refKind; |
44 | 2.63M | } |
45 | | |
46 | 0 | void VariableReference::setVariable(const Variable* variable) { |
47 | 0 | fVariable = variable; |
48 | 0 | } |
49 | | |
50 | | } // namespace SkSL |