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