All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tokens.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_TOKENS_H
8#define PXR_IMAGING_HD_TOKENS_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
15
16PXR_NAMESPACE_OPEN_SCOPE
17
18#define HD_TOKENS \
19 (accelerations) \
20 (adjacency) \
21 (angularVelocities) \
22 (bboxLocalMin) \
23 (bboxLocalMax) \
24 (bbox) \
25 (bezier) \
26 (bspline) \
27 (blurScale) \
28 (camera) \
29 (catmullRom) \
30 (centripetalCatmullRom) \
31 (collection) \
32 (computeShader) \
33 (coordSysBindings) \
34 (cubic) \
35 (cullStyle) \
36 (doubleSided) \
37 (dispatchCount) \
38 (displayColor) \
39 (displayOpacity) \
40 (displayStyle) \
41 (drawDispatch) \
42 (drawingShader) \
43 (drawingCoord0) \
44 (drawingCoord1) \
45 (drawingCoord2) \
46 (drawingCoordI) \
47 (drivers) \
48 (edgeIndices) \
49 (elementCount) \
50 (elementsVisibility) \
51 (extent) \
52 (faceColors) \
53 (filters) \
54 (full) \
55 (geometry) \
56 (hermite) \
57 (hullIndices) \
58 (indices) \
59 (isFlipped) \
60 (itemsDrawn) \
61 (layout) \
62 (leftHanded) \
63 (linear) \
64 (lightLink) \
65 (filterLink) \
66 (lightFilterLink) \
67 (lightFilterType) \
68 (meshLight) \
69 (materialParams) \
70 (materialSyncMode) \
71 (nonlinearSampleCount) \
72 (nonperiodic) \
73 (normals) \
74 (params) \
75 (patchParam) \
76 (periodic) \
77 (pinned) \
78 (points) \
79 (pointsIndices) \
80 (portals) \
81 (power) \
82 (preview) \
83 (pointsVisibility) \
84 (primvar) \
85 (primID) \
86 (primitiveParam) \
87 (tessFactors) \
88 (quadInfo) \
89 (renderTags) \
90 (rightHanded) \
91 (segmented) \
92 (shadowLink) \
93 (subdivTags) \
94 (taskState) \
95 (taskParams) \
96 (topology) \
97 (topologyVisibility) \
98 (totalItemCount) \
99 (transform) \
100 (transformInverse) \
101 (velocities) \
102 (visibility) \
103 (widths) \
104 (isLight) \
105 \
106 /* Legacy tokens. */ \
107 \
108 /* bSpline is a legacy alias so that */ \
109 /* render delegates can compile without */ \
110 /* code change. The new token for */ \
111 /* bspline follows USD and has no */ \
112 /* capital letters. */ \
113 ((bSpline, "bspline"))
114
115#define HD_INSTANCER_TOKENS \
116 (culledInstanceIndices) \
117 (instancer) \
118 (instancerTransform) \
119 (instancerTransformInverse) \
120 (instanceIndices) \
121 (instanceIndexBase) \
122 \
123 /* New instance xform tokens */ \
124 ((instanceTransforms, "hydra:instanceTransforms")) \
125 ((instanceRotations, "hydra:instanceRotations")) \
126 ((instanceScales, "hydra:instanceScales")) \
127 ((instanceTranslations, "hydra:instanceTranslations"))
128
129#define HD_REPR_TOKENS \
130 (disabled) \
131 (hull) \
132 (points) \
133 (smoothHull) \
134 (refined) \
135 (refinedWire) \
136 (refinedWireOnSurf) \
137 (wire) \
138 (wireOnSurf)
139
140#define HD_CULLSTYLE_TOKENS \
141 (dontCare) \
142 (nothing) \
143 (back) \
144 (front) \
145 (backUnlessDoubleSided) \
146 (frontUnlessDoubleSided)
147
148#define HD_MODEL_DRAWMODE_TOKENS \
149 (inherited) \
150 (origin) \
151 (bounds) \
152 (cards) \
153 ((default_, "default")) \
154 (cross) \
155 (box) \
156 (fromTexture)
157
158#define HD_PERF_TOKENS \
159 (adjacencyBufSize) \
160 (basisCurvesTopology) \
161 (bufferSourcesResolved) \
162 (bufferArrayRangeMigrated) \
163 (bufferArrayRangeContainerResized) \
164 (computationsCommited) \
165 (drawBatches) \
166 (drawCalls) \
167 (dirtyLists) \
168 (dirtyListsRebuilt) \
169 (garbageCollected) \
170 (garbageCollectedSsbo) \
171 (garbageCollectedUbo) \
172 (garbageCollectedVbo) \
173 (gpuMemoryUsed) \
174 (instBasisCurvesTopology) \
175 (instBasisCurvesTopologyRange) \
176 (instExtComputationDataRange) \
177 (instMeshTopology) \
178 (instMeshTopologyRange) \
179 (instPrimvarRange) \
180 (instVertexAdjacency) \
181 (meshTopology) \
182 (nonUniformSize) \
183 (numCompletedSamples) \
184 (quadrangulateCPU) \
185 (quadrangulateGPU) \
186 (quadrangulateFaceVarying) \
187 (quadrangulatedVerts) \
188 (rebuildBatches) \
189 (singleBufferSize) \
190 (ssboSize) \
191 (skipInvisibleRprimSync) \
192 (subdivisionRefineCPU) \
193 (subdivisionRefineGPU) \
194 (textureMemory) \
195 (triangulateFaceVarying) \
196 (uboSize) \
197 (vboRelocated)
198
199// XXX Move to hdSt.
200#define HD_SHADER_TOKENS \
201 (alphaThreshold) \
202 (clipPlanes) \
203 (commonShaderSource) \
204 (computeShader) \
205 (cullStyle) \
206 (drawRange) \
207 (environmentMap) \
208 (displacementShader) \
209 (fragmentShader) \
210 (geometryShader) \
211 (imageToWorldMatrix) \
212 (imageToHorizontallyNormalizedFilmback) \
213 (indicatorColor) \
214 (lightingBlendAmount) \
215 (overrideColor) \
216 (maskColor) \
217 (projectionMatrix) \
218 (pointColor) \
219 (pointSize) \
220 (pointSelectedSize) \
221 (materialTag) \
222 (numClipPlanes) \
223 (tessControlShader) \
224 (tessEvalShader) \
225 (postTessControlShader) \
226 (postTessVertexShader) \
227 (tessLevel) \
228 (viewport) \
229 (vertexShader) \
230 (wireframeColor) \
231 (worldToViewMatrix) \
232 (worldToViewInverseMatrix) \
233 (stepSize) \
234 (stepSizeLighting)
235
236// Deprecated. Use: HdStMaterialTagTokens
237#define HD_MATERIALTAG_TOKENS \
238 (defaultMaterialTag)
239
240/* Terminal keys used in material networks.
241 */
242#define HD_MATERIAL_TERMINAL_TOKENS \
243 (surface) \
244 (displacement) \
245 (volume) \
246 (light) \
247 (lightFilter) \
248 (imageShader)
249
250#define HD_RENDERTAG_TOKENS \
251 (geometry) \
252 (guide) \
253 (hidden) \
254 (proxy) \
255 (render) \
256 (widget)
257
258#define HD_RENDER_CONTEXT_TOKENS \
259 ((universal, ""))
260
261#define HD_OPTION_TOKENS \
262 (parallelRprimSync)
263
264#define HD_RPRIMTYPE_TOKENS \
265 /* Rprims */ \
266 (capsule) \
267 (capsule_1) \
268 (cone) \
269 (cube) \
270 (cylinder) \
271 (cylinder_1) \
272 (geomSubset) \
273 (mesh) \
274 (tetMesh) \
275 (nurbsPatch) \
276 (basisCurves) \
277 (nurbsCurves) \
278 (plane) \
279 (points) \
280 (sphere) \
281 (volume) \
282 (model)
283
284// XXX Unfortunately, we export a function of the name HdLightPrimTypeTokens.
285// Omit 'Prim' from the name.
286#define HD_LIGHT_TYPE_TOKENS \
287 (cylinderLight) \
288 (diskLight) \
289 (distantLight) \
290 (domeLight) \
291 (light) \
292 (meshLight) \
293 (pluginLight) \
294 (rectLight) \
295 (simpleLight) \
296 (sphereLight)
297
298#define HD_LIGHT_FILTER_TYPE_TOKENS \
299 (lightFilter)
300
301#define HD_SPRIMTYPE_TOKENS \
302 /* Sprims */ \
303 (camera) \
304 (drawTarget) \
305 (material) \
306 (coordSys) \
307 (instancer) \
308 (instance) \
309 (integrator) \
310 (sampleFilter) \
311 (displayFilter) \
312 (imageShader) \
313 \
314 HD_LIGHT_TYPE_TOKENS \
315 HD_LIGHT_FILTER_TYPE_TOKENS \
316 \
317 /* Sprims ExtComputations */ \
318 (extComputation) \
319
320#define HD_BPRIMTYPE_TOKENS \
321 /* Bprims */ \
322 (renderBuffer) \
323 (renderSettings)
324
325#define HD_PRIMTYPE_TOKENS \
326 HD_RPRIMTYPE_TOKENS \
327 HD_SPRIMTYPE_TOKENS \
328 HD_BPRIMTYPE_TOKENS \
329 /* Scene-index-only prim types */ \
330 (renderPass)
331
332HD_API
333bool HdPrimTypeIsGprim(TfToken const& primType);
334
335HD_API
336bool HdPrimTypeIsLight(TfToken const& primType);
337
338HD_API
339bool HdPrimTypeSupportsGeomSubsets(const TfToken& primType);
340
341HD_API
342const TfTokenVector &HdLightPrimTypeTokens();
343
344#define HD_PRIMVAR_ROLE_TOKENS \
345 ((none, "")) \
346 (color) \
347 (vector) \
348 (normal) \
349 (point) \
350 (textureCoordinate)
351
352/* Schema for "Alternate Output Values" rendering,
353 * describing which values a renderpass should
354 * compute and write at render time.
355 */
356#define HD_AOV_TOKENS \
357 /* Standard rendering outputs */ \
358 \
359 /* HdAovTokens->color represents the final
360 * fragment RGBA color. For correct compositing
361 * using Hydra, it should have pre-multiplied alpha.
362 */ \
363 (color) \
364 /* HdAovTokens->depth represents the clip-space
365 * depth of the final fragment.
366 */ \
367 (depth) \
368 /* HdAovTokens->depthStencil represents the clip-space
369 * depth of the final fragment w/ 8-bit stencil.
370 */ \
371 (depthStencil) \
372 /* HdAovTokens->cameraDepth represents the camera-space
373 * depth of the final fragment.
374 */ \
375 (cameraDepth) \
376 /* ID rendering - these tokens represent the
377 * prim, instance, and subprim ids of the final
378 * fragment.
379 */ \
380 (primId) \
381 (instanceId) \
382 (elementId) \
383 (edgeId) \
384 (pointId) \
385 /* Geometric data */ \
386 (Peye) \
387 (Neye) \
388 (patchCoord) \
389 (primitiveParam) \
390 (normal) \
391 /* Others we might want to add:
392 * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
393 * - curvature
394 * - tangent
395 * - velocity
396 */ \
397 /* Primvars:
398 * The tokens don't try to enumerate primvars,
399 * but instead provide an identifying namespace.
400 * The "color" primvar is addressable as "primvars:color".
401 */ \
402 ((primvars, "primvars:")) \
403 /* Light path expressions:
404 * Applicable only to raytracers, these tell
405 * the renderer to output specific shading
406 * components for specific classes of lightpath.
407 *
408 * Lightpath syntax is defined here:
409 * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
410 * ... so for example, you could specify
411 * "lpe:CD[<L.>O]"
412 */ \
413 ((lpe, "lpe:")) \
414 /* Shader signals:
415 * This tells the renderer to output a partial shading signal,
416 * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
417 * shading node (e.g. fractal.rgb).
418 * XXX: The exact format is TBD.
419 */ \
420 ((shader, "shader:"))
421
422HD_API
423TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
424
425HD_API
426TfToken HdAovTokensMakeLpe(TfToken const& lpe);
427
428HD_API
429TfToken HdAovTokensMakeShader(TfToken const& shader);
430
431/* Schema for application-configurable render settings. */
432#define HD_RENDER_SETTINGS_TOKENS \
433 /* General graphical options */ \
434 (enableShadows) \
435 (enableSceneMaterials) \
436 (enableSceneLights) \
437 (domeLightCameraVisibility) \
438 /* Raytracer sampling settings */ \
439 (convergedVariance) \
440 (convergedSamplesPerPixel) \
441 /* thread limit settings */ \
442 (threadLimit) \
443 /* interactive vs offline */ \
444 (enableInteractive)
445
446#define HD_RENDER_SETTINGS_PRIM_TOKENS \
447 (active) \
448 (namespacedSettings) \
449 (renderProducts) \
450 (includedPurposes) \
451 (materialBindingPurposes) \
452 (renderingColorSpace) \
453 (shutterInterval)
454
455/* Aspect Ratio Conform Policy Tokens used on render settings prims
456 * Note that these mirror the conform policy tokens in UsdRenderTokens */
457#define HD_ASPECT_RATIO_CONFORM_POLICY \
458 (adjustApertureWidth) \
459 (adjustApertureHeight) \
460 (expandAperture) \
461 (cropAperture) \
462 (adjustPixelAspectRatio) \
463
464#define HD_RESOURCE_TYPE_TOKENS \
465 (texture) \
466 (shaderFile)
467
468#define HD_SCENE_INDEX_EMULATION_TOKENS \
469 (sceneDelegate) \
470
471/* Tokens used to emulate collections for light linking. The collection names
472 match the UsdLuxLightAPI. Hydra 1.0 uses lightFilterLink instead of
473 filterLink.
474*/
475#define HD_COLLECTION_EMULATION_TOKENS \
476 ((lightLinkCollection, "lightLink")) \
477 ((shadowLinkCollection, "shadowLink")) \
478 ((filterLinkCollection, "filterLink")) \
479 (lightLinkCollectionMembershipExpression) \
480 (shadowLinkCollectionMembershipExpression) \
481 (filterLinkCollectionMembershipExpression)
482
483TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
484TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
485TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
486TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
487TF_DECLARE_PUBLIC_TOKENS(HdModelDrawModeTokens, HD_API,
488 HD_MODEL_DRAWMODE_TOKENS);
489TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
490TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
491TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
492TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
493 HD_MATERIAL_TERMINAL_TOKENS);
494TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
495TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
496TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
497TF_DECLARE_PUBLIC_TOKENS(HdLightTypeTokens, HD_API, HD_LIGHT_TYPE_TOKENS);
498TF_DECLARE_PUBLIC_TOKENS(HdLightFilterTypeTokens, HD_API,
499 HD_LIGHT_FILTER_TYPE_TOKENS);
500TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
501TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
502TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
503TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
504TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
505TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
506TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
507TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
508 HD_RENDER_SETTINGS_PRIM_TOKENS);
509TF_DECLARE_PUBLIC_TOKENS(HdAspectRatioConformPolicyTokens, HD_API,
510 HD_ASPECT_RATIO_CONFORM_POLICY);
511TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
512TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
513 HD_SCENE_INDEX_EMULATION_TOKENS);
514TF_DECLARE_PUBLIC_TOKENS(HdCollectionEmulationTokens, HD_API,
515 HD_COLLECTION_EMULATION_TOKENS);
516
517PXR_NAMESPACE_CLOSE_SCOPE
518
519#endif //PXR_IMAGING_HD_TOKENS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Environment setting variable.
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:81
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440