HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MslSyntax.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_MSL_SYNTAX_H
7 #define MATERIALX_MSL_SYNTAX_H
8 
9 /// @file
10 /// MSL syntax class
11 
12 #include <MaterialXGenMsl/Export.h>
13 
15 
17 
18 /// Syntax class for MSL (OpenGL Shading Language)
20 {
21  public:
22  MslSyntax();
23 
24  static SyntaxPtr create() { return std::make_shared<MslSyntax>(); }
25 
26  const string& getInputQualifier() const override { return INPUT_QUALIFIER; }
27  const string& getOutputQualifier() const override { return OUTPUT_QUALIFIER; }
28  const string& getConstantQualifier() const override { return CONSTANT_QUALIFIER; };
29  const string& getUniformQualifier() const override { return UNIFORM_QUALIFIER; };
30  const string& getSourceFileExtension() const override { return SOURCE_FILE_EXTENSION; };
31  const string& getStructKeyword() const { return STRUCT_KEYWORD; }
32 
33  string getOutputTypeName(const TypeDesc* type) const override;
34 
35  bool typeSupported(const TypeDesc* type) const override;
36 
37  /// Given an input specification attempt to remap this to an enumeration which is accepted by
38  /// the shader generator. The enumeration may be converted to a different type than the input.
39  bool remapEnumeration(const string& value, const TypeDesc* type, const string& enumNames, std::pair<const TypeDesc*, ValuePtr>& result) const override;
40 
41  static const string INPUT_QUALIFIER;
42  static const string OUTPUT_QUALIFIER;
43  static const string UNIFORM_QUALIFIER;
44  static const string CONSTANT_QUALIFIER;
45  static const string FLAT_QUALIFIER;
46  static const string SOURCE_FILE_EXTENSION;
47  static const string STRUCT_KEYWORD;
48 
49  static const StringVec VEC2_MEMBERS;
50  static const StringVec VEC3_MEMBERS;
51  static const StringVec VEC4_MEMBERS;
52 };
53 
55 
56 #endif
const string & getOutputQualifier() const override
Definition: MslSyntax.h:27
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
const string & getConstantQualifier() const override
Definition: MslSyntax.h:28
vector< string > StringVec
A vector of strings.
Definition: Library.h:57
static const string INPUT_QUALIFIER
Definition: MslSyntax.h:41
virtual bool typeSupported(const TypeDesc *type) const
virtual string getOutputTypeName(const TypeDesc *type) const
Returns the type name in an output context.
static const string UNIFORM_QUALIFIER
Definition: MslSyntax.h:43
shared_ptr< Syntax > SyntaxPtr
Shared pointer to a Syntax.
Definition: Syntax.h:26
static SyntaxPtr create()
Definition: MslSyntax.h:24
Syntax class for MSL (OpenGL Shading Language)
Definition: MslSyntax.h:19
**But if you need a result
Definition: thread.h:613
static const StringVec VEC3_MEMBERS
Definition: MslSyntax.h:50
const string & getInputQualifier() const override
Definition: MslSyntax.h:26
static const string OUTPUT_QUALIFIER
Definition: MslSyntax.h:42
static const string SOURCE_FILE_EXTENSION
Definition: MslSyntax.h:46
static const string STRUCT_KEYWORD
Definition: MslSyntax.h:47
const string & getStructKeyword() const
Definition: MslSyntax.h:31
#define MX_GENMSL_API
Definition: Export.h:18
virtual bool remapEnumeration(const string &value, const TypeDesc *type, const string &enumNames, std::pair< const TypeDesc *, ValuePtr > &result) const
const string & getUniformQualifier() const override
Definition: MslSyntax.h:29
static const StringVec VEC4_MEMBERS
Definition: MslSyntax.h:51
static const StringVec VEC2_MEMBERS
Definition: MslSyntax.h:49
const string & getSourceFileExtension() const override
Return the file extension used for source code files in this language.
Definition: MslSyntax.h:30
Definition: core.h:1131
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
static const string CONSTANT_QUALIFIER
Definition: MslSyntax.h:44
Definition: Syntax.h:39
type
Definition: core.h:1059
static const string FLAT_QUALIFIER
Definition: MslSyntax.h:45