diff options
author | Timothy Liang <timliang@google.com> | 2018-05-18 14:38:19 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-18 19:05:44 +0000 |
commit | ee84fe1e6484d8fb7b9b1549d9d68c9dbabe3737 (patch) | |
tree | d079e0f230c359fc3873b1e092b9e4873174b941 /src/sksl/SkSLMetalCodeGenerator.h | |
parent | ab0795c4dd2c138c3037a4f22d2b762b449ec460 (diff) |
added global variable and multi-texture support to metal sksl backend
Bug: skia:
Change-Id: If676774ec0a30c5b536ccffbff2220d180b7fa59
Reviewed-on: https://skia-review.googlesource.com/129187
Commit-Queue: Timothy Liang <timliang@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLMetalCodeGenerator.h')
-rw-r--r-- | src/sksl/SkSLMetalCodeGenerator.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sksl/SkSLMetalCodeGenerator.h b/src/sksl/SkSLMetalCodeGenerator.h index 6f8933c381..a0a0cae986 100644 --- a/src/sksl/SkSLMetalCodeGenerator.h +++ b/src/sksl/SkSLMetalCodeGenerator.h @@ -85,10 +85,12 @@ public: protected: typedef int Requirements; + typedef unsigned int TextureId; static constexpr Requirements kNo_Requirements = 0; static constexpr Requirements kInputs_Requirement = 1 << 0; static constexpr Requirements kOutputs_Requirement = 1 << 1; static constexpr Requirements kUniforms_Requirement = 1 << 2; + static constexpr Requirements kGlobals_Requirement = 1 << 3; enum IntrinsicKind { kSpecial_IntrinsicKind @@ -100,6 +102,8 @@ protected: void setupIntrinsics(); + TextureId nextTextureId(); + void write(const char* s); void writeLine(); @@ -118,6 +122,8 @@ protected: void writeOutputStruct(); + void writeGlobalStruct(); + void writePrecisionModifier(); void writeType(const Type& type); @@ -210,6 +216,10 @@ protected: typedef std::tuple<IntrinsicKind, int32_t, int32_t, int32_t, int32_t> Intrinsic; std::unordered_map<String, Intrinsic> fIntrinsicMap; + std::vector<const VarDeclaration*> fInitNonConstGlobalVars; + TextureId fCurrentTextureId = 0; + std::unordered_map<String, TextureId> fTextureMap; + bool fNeedsGlobalStructInit = false; const char* fLineEnding; const Context& fContext; StringStream fHeader; |