HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
33  VEX_MAX_TYPES // Sentinel
34 
35 };
36 
38 {
39  VEX_SURFACE_CONTEXT_ENUM, // Surface shading context
40  VEX_DISPLACE_CONTEXT_ENUM, // Displacement shading context
41  VEX_LIGHT_CONTEXT_ENUM, // Light shading context
42  VEX_SHADOW_CONTEXT_ENUM, // Shadow shading context
43  VEX_FOG_CONTEXT_ENUM, // Fog shading context
44  VEX_CHOP_CONTEXT_ENUM, // CHOP operator context
45  VEX_POP_CONTEXT_ENUM, // POP 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_POP_CONTEXT),
70  ENUM_TO_MASK(VEX_SOP_CONTEXT),
71  ENUM_TO_MASK(VEX_COP2_CONTEXT),
72  ENUM_TO_MASK(VEX_I3D_CONTEXT),
73  ENUM_TO_MASK(VEX_CVEX_CONTEXT)
74 };
75 #undef CONTEXT_MASK
76 
78 
79 /// @def VEX_SHADING_CONTEXT Shading Contexts for mantra
80 #define VEX_SHADING_CONTEXT (VEX_SURFACE_CONTEXT | \
81  VEX_DISPLACE_CONTEXT | \
82  VEX_LIGHT_CONTEXT | \
83  VEX_SHADOW_CONTEXT | \
84  VEX_FOG_CONTEXT)
85 
86 /// @def VEX_OP_CONTEXT OP Contexts
87 #define VEX_OP_CONTEXT (VEX_CHOP_CONTEXT | \
88  VEX_POP_CONTEXT | \
89  VEX_SOP_CONTEXT | \
90  VEX_COP2_CONTEXT)
91 
92 /// @def VEX_ALL_CONTEXT All contexts (shading, operator, i3d and CVEX)
93 #define VEX_ALL_CONTEXT (VEX_SHADING_CONTEXT | \
94  VEX_OP_CONTEXT | \
95  VEX_I3D_CONTEXT | \
96  VEX_CVEX_CONTEXT)
97 
99 {
100  /// Don't write out #pragmas
102 
103  /// Add line hints for determining the generator node of each code section.
105 
106  /// Don't add extra comments to the code (header, origin markers, etc.)
108 
109  /// Generate shader calls for encapsulated shaders. The encapsulated shaders
110  /// are not a part of the resulting code from VEX_VexResolver::getVflCode.
111  /// Instead, call VEX_VexResolver::getDependencies to get the list of
112  /// shaders that will be called.
113  /// If this flag is not used, the encapsulated code will be embedded in
114  /// the resulting code and a direct function call used instead.
116 
117  /// Don't output empty boilerplate code if the real code generation failed.
119 
120  /// Don't add any header comment to the code.
122 
123  /// Don't add any shader #defines to the code.
125 
126  /// Ignore any errors in the VOP network when generating the code.
128 
129  /// Don't check if the imported shader actually exists.
131 
133 };
135 
136 /// VEX code generation flags when calling VEX_VexResolver::getVflCode
138 {
140 
141  ENUM_TO_MASK(VEX_CG_OMIT_PRAGMAS),
142  ENUM_TO_MASK(VEX_CG_ADD_NODE_LINE_HINTS),
143  ENUM_TO_MASK(VEX_CG_OMIT_COMMENTS),
144  ENUM_TO_MASK(VEX_CG_CALL_ENCAPSULATED_SHADERS),
145  ENUM_TO_MASK(VEX_CG_NO_EMPTY_CODE),
146  ENUM_TO_MASK(VEX_CG_OMIT_HEADER_COMMENT),
147  ENUM_TO_MASK(VEX_CG_OMIT_SHADER_DEFINES),
148  ENUM_TO_MASK(VEX_CG_IGNORE_ERRORS),
149  ENUM_TO_MASK(VEX_CG_NO_SHADER_IMPORT_CHECK),
150 };
151 
152 /// Convenience operator to merge two VEX_CodeGenFlags enum values into one.
153 static inline VEX_CodeGenFlags
155 {
156  return VEX_CodeGenFlags(uint(a)|uint(b));
157 }
158 
160 {
161  VEX_SPECIALIZE_SPECIALIZING_ENUM, // Specializing code
162  VEX_SPECIALIZE_SHADOW_ENUM, // Specialize for shadow shader
165  VEX_SPECIALIZE_ENABLE_LOOP_UNSWITCH_ENUM, // Enable loop unswitching
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 };
180 /// Convenience operator to merge two VEX_SpecializeFlags enum values into one.
181 static inline VEX_SpecializeFlags
183 {
184  return VEX_SpecializeFlags(uint(a)|uint(b));
185 }
186 
187 
188 #undef ENUM_TO_MASK
189 
190 #endif
191 
VEX_Type
VEX variable types.
Definition: VEX_VexTypes.h:18
VEX_CodeGenFlagsEnum
Definition: VEX_VexTypes.h:98
VEX_SpecializeFlags
Definition: VEX_VexTypes.h:171
Ignore any errors in the VOP network when generating the code.
Definition: VEX_VexTypes.h:127
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
Don't add any header comment to the code.
Definition: VEX_VexTypes.h:121
Don't add extra comments to the code (header, origin markers, etc.)
Definition: VEX_VexTypes.h:107
SYS_STATIC_ASSERT(VEX_MAX_CONTEXT_ENUM<=32)
Add line hints for determining the generator node of each code section.
Definition: VEX_VexTypes.h:104
VEX_SpecializeFlagsEnum
Definition: VEX_VexTypes.h:159
const TypeMask operator|(const TypeMask &m1, const TypeMask &m2)
Definition: GA_PrimCompat.h:79
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
unsigned int uint
Definition: SYS_Types.h:39
VEX_ContextTypeEnum
Definition: VEX_VexTypes.h:37
VEX_CodeGenFlags
VEX code generation flags when calling VEX_VexResolver::getVflCode.
Definition: VEX_VexTypes.h:137
Don't check if the imported shader actually exists.
Definition: VEX_VexTypes.h:130
Don't output empty boilerplate code if the real code generation failed.
Definition: VEX_VexTypes.h:118
Don't write out #pragmas.
Definition: VEX_VexTypes.h:101
VEX_ContextType
Definition: VEX_VexTypes.h:60
Don't add any shader #defines to the code.
Definition: VEX_VexTypes.h:124
#define ENUM_TO_MASK(TOKEN)
Definition: VEX_VexTypes.h:59