Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1413)

Unified Diff: src/sksl/ir/SkSLFieldAccess.h

Issue 2185393003: added initial GLSL support to skslc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed gn build Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/ir/SkSLBoolLiteral.h ('k') | src/sksl/ir/SkSLFloatLiteral.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « src/sksl/ir/SkSLBoolLiteral.h ('k') | src/sksl/ir/SkSLFloatLiteral.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698