Index: src/sksl/ir/SkSLFieldAccess.h |
diff --git a/src/sksl/ir/SkSLFieldAccess.h b/src/sksl/ir/SkSLFieldAccess.h |
index f09c3a344709e3a4f2ceb922c2c531055c8e0d93..bcdd7eea4fbebbf83e3d773623abd00a1e4c9c9a 100644 |
--- a/src/sksl/ir/SkSLFieldAccess.h |
+++ b/src/sksl/ir/SkSLFieldAccess.h |
@@ -17,10 +17,19 @@ namespace SkSL { |
* An expression which extracts a field from a struct, as in 'foo.bar'. |
*/ |
struct FieldAccess : public Expression { |
- FieldAccess(std::unique_ptr<Expression> base, int fieldIndex) |
+ enum OwnerKind { |
+ kDefault_OwnerKind, |
+ // this field access is to a field of an anonymous interface block (and thus, the field name |
+ // is actually in global scope, so only the field name needs to be written in GLSL) |
+ kAnonymousInterfaceBlock_OwnerKind |
+ }; |
+ |
+ FieldAccess(std::unique_ptr<Expression> base, int fieldIndex, |
+ OwnerKind ownerKind = kDefault_OwnerKind) |
: INHERITED(base->fPosition, kFieldAccess_Kind, base->fType.fields()[fieldIndex].fType) |
, fBase(std::move(base)) |
- , fFieldIndex(fieldIndex) {} |
+ , fFieldIndex(fieldIndex) |
+ , fOwnerKind(ownerKind) {} |
virtual std::string description() const override { |
return fBase->description() + "." + fBase->fType.fields()[fFieldIndex].fName; |
@@ -28,6 +37,7 @@ struct FieldAccess : public Expression { |
const std::unique_ptr<Expression> fBase; |
const int fFieldIndex; |
+ const OwnerKind fOwnerKind; |
typedef Expression INHERITED; |
}; |