HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VEX_VexTypes.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: VEX_VexTypes.h ( VEX Library, C++)
7  *
8  * COMMENTS: Data types for VEX variables
9  */
10 
11 #ifndef __VEX_VexTypes__
12 #define __VEX_VexTypes__
13 
14 #include "VEX_API.h"
15 #include <UT/UT_Array.h>
16 
17 /// VEX variable types.
19 {
20  VEX_TYPE_UNDEF, // Unknown type
21 
22  VEX_TYPE_VECTOR4, // Four scalars
23  VEX_TYPE_VECTOR, // Three scalars
24  VEX_TYPE_FLOAT, // A single scalar value
25  VEX_TYPE_INTEGER, // A single integer value
26  VEX_TYPE_STRING, // A character string
27  VEX_TYPE_MATRIX3, // A 3x3 (rotation) matrix
28  VEX_TYPE_MATRIX4, // A 4x4 (transform) matrix
29  VEX_TYPE_BSDF, // A BSDF
30  VEX_TYPE_VECTOR2, // Two scalars
31  VEX_TYPE_MATRIX2, // A 2x2 matrix.
32  VEX_TYPE_DICT, // An untyped dictionary
33 
34  VEX_MAX_TYPES // Sentinel
35 
36 };
37 
39 {
40  VEX_SURFACE_CONTEXT_ENUM, // Surface shading context
41  VEX_DISPLACE_CONTEXT_ENUM, // Displacement shading context
42  VEX_LIGHT_CONTEXT_ENUM, // Light shading context
43  VEX_SHADOW_CONTEXT_ENUM, // Shadow shading context
44  VEX_FOG_CONTEXT_ENUM, // Fog shading context
45  VEX_CHOP_CONTEXT_ENUM, // CHOP operator context
46  VEX_SOP_CONTEXT_ENUM, // SOP operator context
47  VEX_COP2_CONTEXT_ENUM, // COP operator context
48  VEX_I3D_CONTEXT_ENUM, // Image3D context
49  VEX_CVEX_CONTEXT_ENUM, // CVEX context
50 
52 };
54 
55 /// VEX is used in various contexts. Each context has its own set of functions
56 /// and variables available. The enum::VEX_ContextType can be used to limit
57 /// the VEX operator to a specific set of contexts. Contexts can be or'ed
58 /// together.
59 #define ENUM_TO_MASK(TOKEN) TOKEN = (1 << TOKEN##_ENUM)
61 {
63  ENUM_TO_MASK(VEX_SURFACE_CONTEXT),
64  ENUM_TO_MASK(VEX_DISPLACE_CONTEXT),
65  ENUM_TO_MASK(VEX_LIGHT_CONTEXT),
66  ENUM_TO_MASK(VEX_SHADOW_CONTEXT),
67  ENUM_TO_MASK(VEX_FOG_CONTEXT),
68  ENUM_TO_MASK(VEX_CHOP_CONTEXT),
69  ENUM_TO_MASK(VEX_SOP_CONTEXT),
70  ENUM_TO_MASK(VEX_COP2_CONTEXT),
71  ENUM_TO_MASK(VEX_I3D_CONTEXT),
72  ENUM_TO_MASK(VEX_CVEX_CONTEXT)
73 };
74 #undef CONTEXT_MASK
75 
77 
78 /// @def VEX_SHADING_CONTEXT Shading Contexts for mantra
79 #define VEX_SHADING_CONTEXT (VEX_SURFACE_CONTEXT | \
80  VEX_DISPLACE_CONTEXT | \
81  VEX_LIGHT_CONTEXT | \
82  VEX_SHADOW_CONTEXT | \
83  VEX_FOG_CONTEXT)
84 
85 /// @def VEX_OP_CONTEXT OP Contexts
86 #define VEX_OP_CONTEXT (VEX_CHOP_CONTEXT | \
87  VEX_SOP_CONTEXT | \
88  VEX_COP2_CONTEXT)
89 
90 /// @def VEX_ALL_CONTEXT All contexts (shading, operator, i3d and CVEX)
91 #define VEX_ALL_CONTEXT (VEX_SHADING_CONTEXT | \
92  VEX_OP_CONTEXT | \
93  VEX_I3D_CONTEXT | \
94  VEX_CVEX_CONTEXT)
95 
97 {
98  /// Don't write out #pragmas
100 
101  /// Add line hints for determining the generator node of each code section.
103 
104  /// Don't add extra comments to the code (header, origin markers, etc.)
106 
107  /// Generate shader calls for encapsulated shaders. The encapsulated shaders
108  /// are not a part of the resulting code from VEX_VexResolver::getVflCode.
109  /// Instead, call VEX_VexResolver::getDependencies to get the list of
110  /// shaders that will be called.
111  /// If this flag is not used, the encapsulated code will be embedded in
112  /// the resulting code and a direct function call used instead.
114 
115  /// Don't output empty boilerplate code if the real code generation failed.
117 
118  /// Don't add any header comment to the code.
120 
121  /// Don't add any shader #defines to the code.
123 
124  /// Ignore any errors in the VOP network when generating the code.
126 
127  /// Don't check if the imported shader actually exists.
129 
131 };
133 
134 /// VEX code generation flags when calling VEX_VexResolver::getVflCode
136 {
138 
139  ENUM_TO_MASK(VEX_CG_OMIT_PRAGMAS),
140  ENUM_TO_MASK(VEX_CG_ADD_NODE_LINE_HINTS),
141  ENUM_TO_MASK(VEX_CG_OMIT_COMMENTS),
142  ENUM_TO_MASK(VEX_CG_CALL_ENCAPSULATED_SHADERS),
143  ENUM_TO_MASK(VEX_CG_NO_EMPTY_CODE),
144  ENUM_TO_MASK(VEX_CG_OMIT_HEADER_COMMENT),
145  ENUM_TO_MASK(VEX_CG_OMIT_SHADER_DEFINES),
146  ENUM_TO_MASK(VEX_CG_IGNORE_ERRORS),
147  ENUM_TO_MASK(VEX_CG_NO_SHADER_IMPORT_CHECK),
148 };
149 
150 /// Convenience operator to merge two VEX_CodeGenFlags enum values into one.
151 static inline VEX_CodeGenFlags
153 {
154  return VEX_CodeGenFlags(uint(a)|uint(b));
155 }
156 
158 {
159  VEX_SPECIALIZE_SPECIALIZING_ENUM, // Specializing code
160  VEX_SPECIALIZE_SHADOW_ENUM, // Specialize for shadow shader
163  VEX_SPECIALIZE_ENABLE_LOOP_UNSWITCH_ENUM, // Enable loop unswitching
164  VEX_SPECIALIZE_LPE_ENUM, // Specialize for LPE
165  VEX_SPECIALIZE_KARMA_ENUM, // Specialize shading for karma
166 
168 };
170 
172 {
174  ENUM_TO_MASK(VEX_SPECIALIZE_SPECIALIZING),
175  ENUM_TO_MASK(VEX_SPECIALIZE_SHADOW),
176  ENUM_TO_MASK(VEX_SPECIALIZE_DISABLE_JIT),
177  ENUM_TO_MASK(VEX_SPECIALIZE_DISABLE_JUMP_THREADING),
178  ENUM_TO_MASK(VEX_SPECIALIZE_ENABLE_LOOP_UNSWITCH),
179  ENUM_TO_MASK(VEX_SPECIALIZE_LPE),
180  ENUM_TO_MASK(VEX_SPECIALIZE_KARMA),
181 };
182 /// Convenience operator to merge two VEX_SpecializeFlags enum values into one.
183 static inline VEX_SpecializeFlags
185 {
186  return VEX_SpecializeFlags(uint(a)|uint(b));
187 }
188 
189 
190 #undef ENUM_TO_MASK
191 
192 #endif
193 
VEX_Type
VEX variable types.
Definition: VEX_VexTypes.h:18
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
VEX_CodeGenFlagsEnum
Definition: VEX_VexTypes.h:96
VEX_SpecializeFlags
Definition: VEX_VexTypes.h:171
Ignore any errors in the VOP network when generating the code.
Definition: VEX_VexTypes.h:125
Don't add any header comment to the code.
Definition: VEX_VexTypes.h:119
Don't add extra comments to the code (header, origin markers, etc.)
Definition: VEX_VexTypes.h:105
SYS_STATIC_ASSERT(VEX_MAX_CONTEXT_ENUM<=32)
Add line hints for determining the generator node of each code section.
Definition: VEX_VexTypes.h:102
VEX_SpecializeFlagsEnum
Definition: VEX_VexTypes.h:157
const TypeMask operator|(const TypeMask &m1, const TypeMask &m2)
Definition: GA_PrimCompat.h:79
VEX_ContextTypeEnum
Definition: VEX_VexTypes.h:38
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
VEX_CodeGenFlags
VEX code generation flags when calling VEX_VexResolver::getVflCode.
Definition: VEX_VexTypes.h:135
Don't check if the imported shader actually exists.
Definition: VEX_VexTypes.h:128
Don't output empty boilerplate code if the real code generation failed.
Definition: VEX_VexTypes.h:116
Don't write out #pragmas.
Definition: VEX_VexTypes.h:99
VEX_ContextType
Definition: VEX_VexTypes.h:60
Don't add any shader #defines to the code.
Definition: VEX_VexTypes.h:122
unsigned int uint
Definition: SYS_Types.h:45
#define ENUM_TO_MASK(TOKEN)
Definition: VEX_VexTypes.h:59