tokens.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_TOKENS_H
25 #define PXR_IMAGING_HD_TOKENS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 #define HD_TOKENS \
35  (accelerations) \
36  (adjacency) \
37  (bboxLocalMin) \
38  (bboxLocalMax) \
39  (bbox) \
40  (bezier) \
41  (bSpline) \
42  (blurScale) \
43  (camera) \
44  (catmullRom) \
45  (collection) \
46  (computeShader) \
47  (coordSysBindings) \
48  (cubic) \
49  (cullStyle) \
50  (doubleSided) \
51  (dispatchCount) \
52  (displayColor) \
53  (displayOpacity) \
54  (displayStyle) \
55  (drawDispatch) \
56  (drawingShader) \
57  (drawingCoord0) \
58  (drawingCoord1) \
59  (drawingCoord2) \
60  (drawingCoordI) \
61  (drivers) \
62  (edgeIndices) \
63  (elementCount) \
64  (elementsVisibility) \
65  (extent) \
66  (faceColors) \
67  (filters) \
68  (full) \
69  (geometry) \
70  (hermite) \
71  (hullIndices) \
72  (indices) \
73  (isFlipped) \
74  (itemsDrawn) \
75  (layout) \
76  (leftHanded) \
77  (linear) \
78  (lightLink) \
79  (lightFilterLink) \
80  (meshLight) \
81  (materialParams) \
82  (nonlinearSampleCount) \
83  (nonperiodic) \
84  (normals) \
85  (params) \
86  (patchParam) \
87  (periodic) \
88  (pinned) \
89  (points) \
90  (pointsIndices) \
91  (power) \
92  (preview) \
93  (pointsVisibility) \
94  (primvar) \
95  (primID) \
96  (primitiveParam) \
97  (tessFactors) \
98  (quadInfo) \
99  (renderTags) \
100  (rightHanded) \
101  (segmented) \
102  (shadowLink) \
103  (subdivTags) \
104  (taskState) \
105  (taskParams) \
106  (topology) \
107  (topologyVisibility) \
108  (totalItemCount) \
109  (transform) \
110  (transformInverse) \
111  (velocities) \
112  (visibility) \
113  (widths) \
114  (isLight)
115 
116 #define HD_INSTANCER_TOKENS \
117  (culledInstanceIndices) \
118  (instancer) \
119  (instancerTransform) \
120  (instancerTransformInverse) \
121  (instanceIndices) \
122  (instanceIndexBase) \
123  (instanceTransform) \
124  (rotate) \
125  (scale) \
126  (translate)
127 
128 #define HD_REPR_TOKENS \
129  (disabled) \
130  (hull) \
131  (points) \
132  (smoothHull) \
133  (refined) \
134  (refinedWire) \
135  (refinedWireOnSurf) \
136  (wire) \
137  (wireOnSurf)
138 
139 #define HD_CULLSTYLE_TOKENS \
140  (dontCare) \
141  (nothing) \
142  (back) \
143  (front) \
144  (backUnlessDoubleSided) \
145  (frontUnlessDoubleSided)
146 
147 #define HD_PERF_TOKENS \
148  (adjacencyBufSize) \
149  (basisCurvesTopology) \
150  (bufferSourcesResolved) \
151  (bufferArrayRangeMigrated) \
152  (bufferArrayRangeContainerResized) \
153  (computationsCommited) \
154  (drawBatches) \
155  (drawCalls) \
156  (dirtyLists) \
157  (dirtyListsRebuilt) \
158  (garbageCollected) \
159  (garbageCollectedSsbo) \
160  (garbageCollectedUbo) \
161  (garbageCollectedVbo) \
162  (gpuMemoryUsed) \
163  (instBasisCurvesTopology) \
164  (instBasisCurvesTopologyRange) \
165  (instExtComputationDataRange) \
166  (instMeshTopology) \
167  (instMeshTopologyRange) \
168  (instPrimvarRange) \
169  (instVertexAdjacency) \
170  (meshTopology) \
171  (nonUniformSize) \
172  (numCompletedSamples) \
173  (quadrangulateCPU) \
174  (quadrangulateGPU) \
175  (quadrangulateFaceVarying) \
176  (quadrangulatedVerts) \
177  (rebuildBatches) \
178  (singleBufferSize) \
179  (ssboSize) \
180  (skipInvisibleRprimSync) \
181  (subdivisionRefineCPU) \
182  (subdivisionRefineGPU) \
183  (textureMemory) \
184  (triangulateFaceVarying) \
185  (uboSize) \
186  (vboRelocated)
187 
188 #define HD_SHADER_TOKENS \
189  (alphaThreshold) \
190  (clipPlanes) \
191  (commonShaderSource) \
192  (computeShader) \
193  (cullStyle) \
194  (drawRange) \
195  (environmentMap) \
196  (displacementShader) \
197  (fragmentShader) \
198  (geometryShader) \
199  (imageToWorldMatrix) \
200  (imageToHorizontallyNormalizedFilmback) \
201  (indicatorColor) \
202  (lightingBlendAmount) \
203  (overrideColor) \
204  (maskColor) \
205  (projectionMatrix) \
206  (pointColor) \
207  (pointSize) \
208  (pointSelectedSize) \
209  (materialTag) \
210  (tessControlShader) \
211  (tessEvalShader) \
212  (postTessControlShader) \
213  (postTessVertexShader) \
214  (tessLevel) \
215  (viewport) \
216  (vertexShader) \
217  (wireframeColor) \
218  (worldToViewMatrix) \
219  (worldToViewInverseMatrix) \
220  (stepSize) \
221  (stepSizeLighting)
222 
223 // Deprecated. Use: HdStMaterialTagTokens
224 #define HD_MATERIALTAG_TOKENS \
225  (defaultMaterialTag)
226 
227 /* Terminal keys used in material networks.
228  */
229 #define HD_MATERIAL_TERMINAL_TOKENS \
230  (surface) \
231  (displacement) \
232  (volume) \
233  (light) \
234  (lightFilter)
235 
236 #define HD_RENDERTAG_TOKENS \
237  (geometry) \
238  (guide) \
239  (hidden) \
240  (proxy) \
241  (render) \
242  (widget)
243 
244 #define HD_RENDER_CONTEXT_TOKENS \
245  ((universal, ""))
246 
247 #define HD_OPTION_TOKENS \
248  (parallelRprimSync)
249 
250 #define HD_RPRIMTYPE_TOKENS \
251  /* Rprims */ \
252  (capsule) \
253  (cone) \
254  (cube) \
255  (cylinder) \
256  (mesh) \
257  (basisCurves) \
258  (points) \
259  (sphere) \
260  (volume) \
261 
262 #define HD_SPRIMTYPE_TOKENS \
263  /* Sprims */ \
264  (camera) \
265  (drawTarget) \
266  (material) \
267  (coordSys) \
268  (instancer) \
269  (instance) \
270  (sampleFilter) \
271  (displayFilter) \
272  /* Sprims Lights */ \
273  (simpleLight) \
274  (cylinderLight) \
275  (diskLight) \
276  (distantLight) \
277  (domeLight) \
278  (light) \
279  (lightFilter) \
280  (meshLight) \
281  (pluginLight) \
282  (rectLight) \
283  (sphereLight) \
284  /* Sprims ExtComputations */ \
285  (extComputation) \
286 
287 #define HD_BPRIMTYPE_TOKENS \
288  /* Bprims */ \
289  (renderBuffer) \
290  (renderSettings)
291 
292 #define HD_PRIMTYPE_TOKENS \
293  HD_RPRIMTYPE_TOKENS \
294  HD_SPRIMTYPE_TOKENS \
295  HD_BPRIMTYPE_TOKENS \
296 
297 HD_API
298 bool HdPrimTypeIsGprim(TfToken const& primType);
299 
300 HD_API
301 bool HdPrimTypeIsLight(TfToken const& primType);
302 
303 #define HD_PRIMVAR_ROLE_TOKENS \
304  ((none, "")) \
305  (color) \
306  (vector) \
307  (normal) \
308  (point) \
309  (textureCoordinate)
310 
311 /* Schema for "Alternate Output Values" rendering,
312  * describing which values a renderpass should
313  * compute and write at render time.
314  */
315 #define HD_AOV_TOKENS \
316  /* Standard rendering outputs */ \
317  \
318  /* HdAovTokens->color represents the final
319  * fragment RGBA color. For correct compositing
320  * using Hydra, it should have pre-multiplied alpha.
321  */ \
322  (color) \
323  /* HdAovTokens->depth represents the clip-space
324  * depth of the final fragment.
325  */ \
326  (depth) \
327  /* HdAovTokens->depthStencil represents the clip-space
328  * depth of the final fragment w/ 8-bit stencil.
329  */ \
330  (depthStencil) \
331  /* HdAovTokens->cameraDepth represents the camera-space
332  * depth of the final fragment.
333  */ \
334  (cameraDepth) \
335  /* ID rendering - these tokens represent the
336  * prim, instance, and subprim ids of the final
337  * fragment.
338  */ \
339  (primId) \
340  (instanceId) \
341  (elementId) \
342  (edgeId) \
343  (pointId) \
344  /* Geometric data */ \
345  (Peye) \
346  (Neye) \
347  (patchCoord) \
348  (primitiveParam) \
349  (normal) \
350  /* Others we might want to add:
351  * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
352  * - curvature
353  * - tangent
354  * - velocity
355  */ \
356  /* Primvars:
357  * The tokens don't try to enumerate primvars,
358  * but instead provide an identifying namespace.
359  * The "color" primvar is addressable as "primvars:color".
360  */ \
361  ((primvars, "primvars:")) \
362  /* Light path expressions:
363  * Applicable only to raytracers, these tell
364  * the renderer to output specific shading
365  * components for specific classes of lightpath.
366  *
367  * Lightpath syntax is defined here:
368  * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
369  * ... so for example, you could specify
370  * "lpe:CD[<L.>O]"
371  */ \
372  ((lpe, "lpe:")) \
373  /* Shader signals:
374  * This tells the renderer to output a partial shading signal,
375  * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
376  * shading node (e.g. fractal.rgb).
377  * XXX: The exact format is TBD.
378  */ \
379  ((shader, "shader:"))
380 
381 HD_API
382 TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
383 
384 HD_API
385 TfToken HdAovTokensMakeLpe(TfToken const& lpe);
386 
387 HD_API
388 TfToken HdAovTokensMakeShader(TfToken const& shader);
389 
390 /* Schema for application-configurable render settings. */
391 #define HD_RENDER_SETTINGS_TOKENS \
392  /* General graphical options */ \
393  (enableShadows) \
394  (enableSceneMaterials) \
395  (enableSceneLights) \
396  (domeLightCameraVisibility) \
397  /* Raytracer sampling settings */ \
398  (convergedVariance) \
399  (convergedSamplesPerPixel) \
400  /* thread limit settings */ \
401  (threadLimit) \
402  /* interactive vs offline */ \
403  (enableInteractive)
404 
405 #define HD_RENDER_SETTINGS_PRIM_TOKENS \
406  (active) \
407  (namespacedSettings) \
408  (renderProducts) \
409  (includedPurposes) \
410  (materialBindingPurposes) \
411  (renderingColorSpace)
412 
413 #define HD_RESOURCE_TYPE_TOKENS \
414  (texture) \
415  (shaderFile)
416 
417 #define HD_SCENE_INDEX_EMULATION_TOKENS \
418  (sceneDelegate) \
419 
420 TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
421 TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
422 TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
423 TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
424 TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
425 TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
426 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
427 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
428  HD_MATERIAL_TERMINAL_TOKENS);
429 TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
430 TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
431 TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
432 TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
433 TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
434 TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
435 TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
436 TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
437 TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
438 TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
439 TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
440  HD_RENDER_SETTINGS_PRIM_TOKENS);
441 TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
442 TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
443  HD_SCENE_INDEX_EMULATION_TOKENS);
444 
445 PXR_NAMESPACE_CLOSE_SCOPE
446 
447 #endif //PXR_IMAGING_HD_TOKENS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
This file defines some macros that are useful for declaring and using static TfTokens.