diff options
Diffstat (limited to 'src/sksl/SkSLMetalCodeGenerator.h')
-rw-r--r-- | src/sksl/SkSLMetalCodeGenerator.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/sksl/SkSLMetalCodeGenerator.h b/src/sksl/SkSLMetalCodeGenerator.h index a0a0cae986..517f9f655b 100644 --- a/src/sksl/SkSLMetalCodeGenerator.h +++ b/src/sksl/SkSLMetalCodeGenerator.h @@ -52,6 +52,8 @@ namespace SkSL { */ class MetalCodeGenerator : public CodeGenerator { public: + static constexpr const char* SAMPLER_SUFFIX = "Smplr"; + enum Precedence { kParentheses_Precedence = 1, kPostfix_Precedence = 2, @@ -85,7 +87,6 @@ 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; @@ -93,16 +94,22 @@ protected: static constexpr Requirements kGlobals_Requirement = 1 << 3; enum IntrinsicKind { - kSpecial_IntrinsicKind + kSpecial_IntrinsicKind, + kMetal_IntrinsicKind, }; enum SpecialIntrinsic { kTexture_SpecialIntrinsic, }; - void setupIntrinsics(); + enum MetalIntrinsic { + kLessThan_MetalIntrinsic, + kLessThanEqual_MetalIntrinsic, + kGreaterThan_MetalIntrinsic, + kGreaterThanEqual_MetalIntrinsic, + }; - TextureId nextTextureId(); + void setupIntrinsics(); void write(const char* s); @@ -217,8 +224,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; + std::vector<const Variable*> fTextures; + std::unordered_map<const Type::Field*, const InterfaceBlock*> fInterfaceBlockMap; + std::unordered_map<const InterfaceBlock*, String> fInterfaceBlockNameMap; + int fAnonInterfaceCount = 0; bool fNeedsGlobalStructInit = false; const char* fLineEnding; const Context& fContext; |