Loading...
Searching...
No Matches
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 (refinedSolidWireOnSurf) \
138 (wire) \
139 (wireOnSurf) \
140 (solidWireOnSurf)
141
142#define HD_CULLSTYLE_TOKENS \
143 (dontCare) \
144 (nothing) \
145 (back) \
146 (front) \
147 (backUnlessDoubleSided) \
148 (frontUnlessDoubleSided)
149
150#define HD_MODEL_DRAWMODE_TOKENS \
151 (inherited) \
152 (origin) \
153 (bounds) \
154 (cards) \
155 ((default_, "default")) \
156 (cross) \
157 (box) \
158 (fromTexture)
159
160#define HD_PERF_TOKENS \
161 (adjacencyBufSize) \
162 (basisCurvesTopology) \
163 (bufferSourcesResolved) \
164 (bufferArrayRangeMigrated) \
165 (bufferArrayRangeContainerResized) \
166 (committed) \
167 (computationsCommitted) \
168 (drawBatches) \
169 (drawCalls) \
170 (dirtyLists) \
171 (dirtyListsRebuilt) \
172 (garbageCollected) \
173 (garbageCollectedSsbo) \
174 (garbageCollectedUbo) \
175 (garbageCollectedVbo) \
176 (gpuMemoryUsed) \
177 (instBasisCurvesTopology) \
178 (instBasisCurvesTopologyRange) \
179 (instImplicitPrimsTopologyRange) \
180 (instExtComputationDataRange) \
181 (instGlslProgram) \
182 (instMeshTopology) \
183 (instMeshTopologyRange) \
184 (instPrimvarRange) \
185 (instVertexAdjacency) \
186 (meshTopology) \
187 (nonUniformSize) \
188 (numCompletedSamples) \
189 (quadrangulateCPU) \
190 (quadrangulateGPU) \
191 (quadrangulateFaceVarying) \
192 (quadrangulatedVerts) \
193 (rebuildBatches) \
194 (singleBufferSize) \
195 (ssboSize) \
196 (skipInvisibleRprimSync) \
197 (sourcesCommitted) \
198 (subdivisionRefineCPU) \
199 (subdivisionRefineGPU) \
200 (stats) \
201 (textureAllocations) \
202 (textureMemory) \
203 (triangulateFaceVarying) \
204 (uboSize) \
205 (vboRelocated)
206
207// XXX Move to hdSt.
208#define HD_SHADER_TOKENS \
209 (alphaThreshold) \
210 (clipPlanes) \
211 (commonShaderSource) \
212 (computeShader) \
213 (cullStyle) \
214 (drawRange) \
215 (environmentMap) \
216 (linearExposure) \
217 (displacementShader) \
218 (fragmentShader) \
219 (geometryShader) \
220 (imageToWorldMatrix) \
221 (imageToHorizontallyNormalizedFilmback) \
222 (indicatorColor) \
223 (lightingBlendAmount) \
224 (overrideColor) \
225 (maskColor) \
226 (projectionMatrix) \
227 (projectionInverseMatrix) \
228 (pointColor) \
229 (pointSize) \
230 (pointSelectedSize) \
231 (materialTag) \
232 (numClipPlanes) \
233 (tessControlShader) \
234 (tessEvalShader) \
235 (postTessControlShader) \
236 (postTessVertexShader) \
237 (tessLevel) \
238 (viewport) \
239 (vertexShader) \
240 (wireframeColor) \
241 (worldToViewMatrix) \
242 (worldToViewInverseMatrix) \
243 (stepSize) \
244 (stepSizeLighting) \
245 (multisampleCount)
246
247// Deprecated. Use: HdStMaterialTagTokens
248#define HD_MATERIALTAG_TOKENS \
249 (defaultMaterialTag)
250
251/* Terminal keys used in material networks.
252 */
253#define HD_MATERIAL_TERMINAL_TOKENS \
254 (surface) \
255 (displacement) \
256 (volume) \
257 (volumeFilter) \
258 (light) \
259 (lightFilter) \
260 (imageShader)
261
262#define HD_RENDERTAG_TOKENS \
263 (geometry) \
264 (guide) \
265 (hidden) \
266 (proxy) \
267 (render)
268
269#define HD_RENDER_CONTEXT_TOKENS \
270 ((universal, ""))
271
272#define HD_OPTION_TOKENS \
273 (parallelRprimSync)
274
275#define HD_RPRIMTYPE_TOKENS \
276 /* Rprims */ \
277 (capsule) \
278 (cone) \
279 (cube) \
280 (cylinder) \
281 (geomSubset) \
282 (mesh) \
283 (tetMesh) \
284 (nurbsPatch) \
285 (basisCurves) \
286 (nurbsCurves) \
287 (particleField) \
288 (plane) \
289 (points) \
290 (sphere) \
291 (volume) \
292 (model)
293
294// XXX Unfortunately, we export a function of the name HdLightPrimTypeTokens.
295// Omit 'Prim' from the name.
296#define HD_LIGHT_TYPE_TOKENS \
297 (cylinderLight) \
298 (diskLight) \
299 (distantLight) \
300 (domeLight) \
301 (light) \
302 (meshLight) \
303 (pluginLight) \
304 (rectLight) \
305 (simpleLight) \
306 (sphereLight)
307
308#define HD_LIGHT_FILTER_TYPE_TOKENS \
309 (lightFilter)
310
311#define HD_SPRIMTYPE_TOKENS \
312 /* Sprims */ \
313 (camera) \
314 (drawTarget) \
315 (material) \
316 (coordSys) \
317 (instancer) \
318 (instance) \
319 (integrator) \
320 (sampleFilter) \
321 (displayFilter) \
322 (energyFilter) \
323 (imageShader) \
324 \
325 HD_LIGHT_TYPE_TOKENS \
326 HD_LIGHT_FILTER_TYPE_TOKENS \
327 \
328 /* Sprims ExtComputations */ \
329 (extComputation) \
330
331#define HD_BPRIMTYPE_TOKENS \
332 /* Bprims */ \
333 (renderBuffer) \
334 (renderSettings)
335
336#define HD_PRIMTYPE_TOKENS \
337 HD_RPRIMTYPE_TOKENS \
338 HD_SPRIMTYPE_TOKENS \
339 HD_BPRIMTYPE_TOKENS \
340 /* Scene-index-only prim types */ \
341 (renderPass) \
342 (task)
343
344HD_API
345bool HdPrimTypeIsGprim(TfToken const& primType);
346
347HD_API
348bool HdPrimTypeIsLight(TfToken const& primType);
349
350HD_API
351bool HdPrimTypeSupportsGeomSubsets(const TfToken& primType);
352
353HD_API
354const TfTokenVector &HdLightPrimTypeTokens();
355
356#define HD_PRIMVAR_ROLE_TOKENS \
357 ((none, "")) \
358 (color) \
359 (vector) \
360 (normal) \
361 (point) \
362 (textureCoordinate)
363
364/* Schema for "Alternate Output Values" rendering,
365 * describing which values a renderpass should
366 * compute and write at render time.
367 */
368#define HD_AOV_TOKENS \
369 /* Standard rendering outputs */ \
370 \
371 /* HdAovTokens->color represents the final
372 * fragment RGBA color. For correct compositing
373 * using Hydra, it should have pre-multiplied alpha.
374 */ \
375 (color) \
376 /* HdAovTokens->depth represents the clip-space
377 * depth of the final fragment.
378 */ \
379 (depth) \
380 /* HdAovTokens->depthStencil represents the clip-space
381 * depth of the final fragment w/ 8-bit stencil.
382 */ \
383 (depthStencil) \
384 /* HdAovTokens->cameraDepth represents the camera-space
385 * depth of the final fragment.
386 */ \
387 (cameraDepth) \
388 /* ID rendering - these tokens represent the
389 * prim, instance, and subprim ids of the final
390 * fragment.
391 */ \
392 (primId) \
393 (instanceId) \
394 (elementId) \
395 (edgeId) \
396 (pointId) \
397 /* Geometric data */ \
398 (Peye) \
399 (Neye) \
400 (patchCoord) \
401 (primitiveParam) \
402 (normal) \
403 /* Others we might want to add:
404 * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
405 * - curvature
406 * - tangent
407 * - velocity
408 */ \
409 /* Primvars:
410 * The tokens don't try to enumerate primvars,
411 * but instead provide an identifying namespace.
412 * The "color" primvar is addressable as "primvars:color".
413 */ \
414 ((primvars, "primvars:")) \
415 /* Light path expressions:
416 * Applicable only to raytracers, these tell
417 * the renderer to output specific shading
418 * components for specific classes of lightpath.
419 *
420 * Lightpath syntax is defined here:
421 * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
422 * ... so for example, you could specify
423 * "lpe:CD[<L.>O]"
424 */ \
425 ((lpe, "lpe:")) \
426 /* Shader signals:
427 * This tells the renderer to output a partial shading signal,
428 * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
429 * shading node (e.g. fractal.rgb).
430 * XXX: The exact format is TBD.
431 */ \
432 ((shader, "shader:"))
433
434HD_API
435TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
436
437HD_API
438TfToken HdAovTokensMakeLpe(TfToken const& lpe);
439
440HD_API
441TfToken HdAovTokensMakeShader(TfToken const& shader);
442
443/* Schema for application-configurable render settings. */
444#define HD_RENDER_SETTINGS_TOKENS \
445 /* General graphical options */ \
446 (enableShadows) \
447 (enableSceneMaterials) \
448 (enableSceneLights) \
449 (enableExposureCompensation) \
450 (domeLightCameraVisibility) \
451 /* Raytracer sampling settings */ \
452 (convergedVariance) \
453 (convergedSamplesPerPixel) \
454 /* thread limit settings */ \
455 (threadLimit) \
456 /* interactive vs offline */ \
457 (enableInteractive) \
458
459#define HD_RENDER_SETTINGS_PRIM_TOKENS \
460 (active) \
461 (namespacedSettings) \
462 (renderProducts) \
463 (includedPurposes) \
464 (materialBindingPurposes) \
465 (renderingColorSpace) \
466 (unionedSamplingInterval) \
467 (camera) \
468 (disableDepthOfField) \
469 (disableMotionBlur)
470
471/* Aspect Ratio Conform Policy Tokens used on render settings prims
472 * Note that these mirror the conform policy tokens in UsdRenderTokens */
473#define HD_ASPECT_RATIO_CONFORM_POLICY \
474 (adjustApertureWidth) \
475 (adjustApertureHeight) \
476 (expandAperture) \
477 (cropAperture) \
478 (adjustPixelAspectRatio) \
479
480#define HD_RESOURCE_TYPE_TOKENS \
481 (texture) \
482 (shaderFile)
483
484#define HD_SCENE_INDEX_EMULATION_TOKENS \
485 (sceneDelegate) \
486
487/* Tokens used to emulate collections for light linking. The collection names
488 match the UsdLuxLightAPI. Hydra 1.0 uses lightFilterLink instead of
489 filterLink.
490*/
491#define HD_COLLECTION_EMULATION_TOKENS \
492 ((lightLinkCollection, "lightLink")) \
493 ((shadowLinkCollection, "shadowLink")) \
494 ((filterLinkCollection, "filterLink")) \
495 (lightLinkCollectionMembershipExpression) \
496 (shadowLinkCollectionMembershipExpression) \
497 (filterLinkCollectionMembershipExpression)
498
499/* Inputs required for UsdSkel skinning. */
500#define HD_SKINNING_INPUT_TOKENS \
501 ((skinningXforms, "hydra:skinningXforms")) \
502 ((skinningDualQuats, "hydra:skinningDualQuats")) \
503 ((skinningScaleXforms, "hydra:skinningScaleXforms")) \
504 ((blendShapeWeights, "hydra:blendShapeWeights")) \
505 ((skelLocalToCommonSpace, "hydra:skelLocalToWorld")) \
506 ((commonSpaceToPrimLocal, "hydra:primWorldToLocal")) \
507 ((blendShapeOffsets, "hydra:blendShapeOffsets")) \
508 ((blendShapeOffsetRanges, "hydra:blendShapeOffsetRanges")) \
509 ((numBlendShapeOffsetRanges, "hydra:numBlendShapeOffsetRanges")) \
510 \
511 ((hasConstantInfluences, "hydra:hasConstantInfluences")) \
512 ((numInfluencesPerComponent, "hydra:numInfluencesPerComponent")) \
513 ((influences, "hydra:influences")) \
514 /* skinningMethod primvar on the skel schema is a token, we provide a
515 * numeric alternative to pass to storm's vertex shader.
516 */ \
517 ((numSkinningMethod, "hydra:numSkinningMethod")) \
518 /* Extra primvars for computing instance/vertex offsets to index into
519 * concatenated skinningXForms/blendShapeWeights constant primvars.
520 */ \
521 ((numJoints, "hydra:numJoints")) \
522 ((numBlendShapeWeights, "hydra:numBlendShapeWeights"))
523
524/* Skinning inputs that already exist on skel binding. */
525#define HD_SKINNING_SKEL_INPUT_TOKENS \
526 /* HYD-3510
527 * these two already exist and they are the source of influences and
528 * numInfluencesPerComponent above. but currently hydra doesn't handle
529 * tensor valued vertex primvar correctly. once that's addressed, we
530 * can access these two in the vertex shader directly and remove the
531 * two above. see imaging/hdSt/mesh.cpp _PopulateVertexPrimvars()#1417
532 * buffer source array size is currently hardcoded to 1.
533 *
534 *((jointIndices, "skel:jointIndices"))
535 *((jointWeights, "skel:jointWeights"))
536 */ \
537 ((geomBindTransform, "skel:geomBindTransform"))
538
539
540TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
541TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
542TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
543TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
544TF_DECLARE_PUBLIC_TOKENS(HdModelDrawModeTokens, HD_API,
545 HD_MODEL_DRAWMODE_TOKENS);
546TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
547TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
548TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
549TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
550 HD_MATERIAL_TERMINAL_TOKENS);
551TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
552TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
553TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
554TF_DECLARE_PUBLIC_TOKENS(HdLightTypeTokens, HD_API, HD_LIGHT_TYPE_TOKENS);
555TF_DECLARE_PUBLIC_TOKENS(HdLightFilterTypeTokens, HD_API,
556 HD_LIGHT_FILTER_TYPE_TOKENS);
557TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
558TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
559TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
560TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
561TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
562TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
563TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
564TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
565 HD_RENDER_SETTINGS_PRIM_TOKENS);
566TF_DECLARE_PUBLIC_TOKENS(HdAspectRatioConformPolicyTokens, HD_API,
567 HD_ASPECT_RATIO_CONFORM_POLICY);
568TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
569TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
570 HD_SCENE_INDEX_EMULATION_TOKENS);
571TF_DECLARE_PUBLIC_TOKENS(HdCollectionEmulationTokens, HD_API,
572 HD_COLLECTION_EMULATION_TOKENS);
573TF_DECLARE_PUBLIC_TOKENS(HdSkinningInputTokens, HD_API,
574 HD_SKINNING_INPUT_TOKENS);
575TF_DECLARE_PUBLIC_TOKENS(HdSkinningSkelInputTokens, HD_API,
576 HD_SKINNING_SKEL_INPUT_TOKENS);
577
578PXR_NAMESPACE_CLOSE_SCOPE
579
580#endif //PXR_IMAGING_HD_TOKENS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:81
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.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:489