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 (textureMemory) \
201 (triangulateFaceVarying) \
202 (uboSize) \
203 (vboRelocated)
204
205// XXX Move to hdSt.
206#define HD_SHADER_TOKENS \
207 (alphaThreshold) \
208 (clipPlanes) \
209 (commonShaderSource) \
210 (computeShader) \
211 (cullStyle) \
212 (drawRange) \
213 (environmentMap) \
214 (linearExposure) \
215 (displacementShader) \
216 (fragmentShader) \
217 (geometryShader) \
218 (imageToWorldMatrix) \
219 (imageToHorizontallyNormalizedFilmback) \
220 (indicatorColor) \
221 (lightingBlendAmount) \
222 (overrideColor) \
223 (maskColor) \
224 (projectionMatrix) \
225 (projectionInverseMatrix) \
226 (pointColor) \
227 (pointSize) \
228 (pointSelectedSize) \
229 (materialTag) \
230 (numClipPlanes) \
231 (tessControlShader) \
232 (tessEvalShader) \
233 (postTessControlShader) \
234 (postTessVertexShader) \
235 (tessLevel) \
236 (viewport) \
237 (vertexShader) \
238 (wireframeColor) \
239 (worldToViewMatrix) \
240 (worldToViewInverseMatrix) \
241 (stepSize) \
242 (stepSizeLighting) \
243 (multisampleCount)
244
245// Deprecated. Use: HdStMaterialTagTokens
246#define HD_MATERIALTAG_TOKENS \
247 (defaultMaterialTag)
248
249/* Terminal keys used in material networks.
250 */
251#define HD_MATERIAL_TERMINAL_TOKENS \
252 (surface) \
253 (displacement) \
254 (volume) \
255 (volumeFilter) \
256 (light) \
257 (lightFilter) \
258 (imageShader)
259
260#define HD_RENDERTAG_TOKENS \
261 (geometry) \
262 (guide) \
263 (hidden) \
264 (proxy) \
265 (render)
266
267#define HD_RENDER_CONTEXT_TOKENS \
268 ((universal, ""))
269
270#define HD_OPTION_TOKENS \
271 (parallelRprimSync)
272
273#define HD_RPRIMTYPE_TOKENS \
274 /* Rprims */ \
275 (capsule) \
276 (cone) \
277 (cube) \
278 (cylinder) \
279 (geomSubset) \
280 (mesh) \
281 (tetMesh) \
282 (nurbsPatch) \
283 (basisCurves) \
284 (nurbsCurves) \
285 (particleField) \
286 (plane) \
287 (points) \
288 (sphere) \
289 (volume) \
290 (model)
291
292// XXX Unfortunately, we export a function of the name HdLightPrimTypeTokens.
293// Omit 'Prim' from the name.
294#define HD_LIGHT_TYPE_TOKENS \
295 (cylinderLight) \
296 (diskLight) \
297 (distantLight) \
298 (domeLight) \
299 (light) \
300 (meshLight) \
301 (pluginLight) \
302 (rectLight) \
303 (simpleLight) \
304 (sphereLight)
305
306#define HD_LIGHT_FILTER_TYPE_TOKENS \
307 (lightFilter)
308
309#define HD_SPRIMTYPE_TOKENS \
310 /* Sprims */ \
311 (camera) \
312 (drawTarget) \
313 (material) \
314 (coordSys) \
315 (instancer) \
316 (instance) \
317 (integrator) \
318 (sampleFilter) \
319 (displayFilter) \
320 (energyFilter) \
321 (imageShader) \
322 \
323 HD_LIGHT_TYPE_TOKENS \
324 HD_LIGHT_FILTER_TYPE_TOKENS \
325 \
326 /* Sprims ExtComputations */ \
327 (extComputation) \
328
329#define HD_BPRIMTYPE_TOKENS \
330 /* Bprims */ \
331 (renderBuffer) \
332 (renderSettings)
333
334#define HD_PRIMTYPE_TOKENS \
335 HD_RPRIMTYPE_TOKENS \
336 HD_SPRIMTYPE_TOKENS \
337 HD_BPRIMTYPE_TOKENS \
338 /* Scene-index-only prim types */ \
339 (renderPass) \
340 (task)
341
342HD_API
343bool HdPrimTypeIsGprim(TfToken const& primType);
344
345HD_API
346bool HdPrimTypeIsLight(TfToken const& primType);
347
348HD_API
349bool HdPrimTypeSupportsGeomSubsets(const TfToken& primType);
350
351HD_API
352const TfTokenVector &HdLightPrimTypeTokens();
353
354#define HD_PRIMVAR_ROLE_TOKENS \
355 ((none, "")) \
356 (color) \
357 (vector) \
358 (normal) \
359 (point) \
360 (textureCoordinate)
361
362/* Schema for "Alternate Output Values" rendering,
363 * describing which values a renderpass should
364 * compute and write at render time.
365 */
366#define HD_AOV_TOKENS \
367 /* Standard rendering outputs */ \
368 \
369 /* HdAovTokens->color represents the final
370 * fragment RGBA color. For correct compositing
371 * using Hydra, it should have pre-multiplied alpha.
372 */ \
373 (color) \
374 /* HdAovTokens->depth represents the clip-space
375 * depth of the final fragment.
376 */ \
377 (depth) \
378 /* HdAovTokens->depthStencil represents the clip-space
379 * depth of the final fragment w/ 8-bit stencil.
380 */ \
381 (depthStencil) \
382 /* HdAovTokens->cameraDepth represents the camera-space
383 * depth of the final fragment.
384 */ \
385 (cameraDepth) \
386 /* ID rendering - these tokens represent the
387 * prim, instance, and subprim ids of the final
388 * fragment.
389 */ \
390 (primId) \
391 (instanceId) \
392 (elementId) \
393 (edgeId) \
394 (pointId) \
395 /* Geometric data */ \
396 (Peye) \
397 (Neye) \
398 (patchCoord) \
399 (primitiveParam) \
400 (normal) \
401 /* Others we might want to add:
402 * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
403 * - curvature
404 * - tangent
405 * - velocity
406 */ \
407 /* Primvars:
408 * The tokens don't try to enumerate primvars,
409 * but instead provide an identifying namespace.
410 * The "color" primvar is addressable as "primvars:color".
411 */ \
412 ((primvars, "primvars:")) \
413 /* Light path expressions:
414 * Applicable only to raytracers, these tell
415 * the renderer to output specific shading
416 * components for specific classes of lightpath.
417 *
418 * Lightpath syntax is defined here:
419 * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
420 * ... so for example, you could specify
421 * "lpe:CD[<L.>O]"
422 */ \
423 ((lpe, "lpe:")) \
424 /* Shader signals:
425 * This tells the renderer to output a partial shading signal,
426 * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
427 * shading node (e.g. fractal.rgb).
428 * XXX: The exact format is TBD.
429 */ \
430 ((shader, "shader:"))
431
432HD_API
433TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
434
435HD_API
436TfToken HdAovTokensMakeLpe(TfToken const& lpe);
437
438HD_API
439TfToken HdAovTokensMakeShader(TfToken const& shader);
440
441/* Schema for application-configurable render settings. */
442#define HD_RENDER_SETTINGS_TOKENS \
443 /* General graphical options */ \
444 (enableShadows) \
445 (enableSceneMaterials) \
446 (enableSceneLights) \
447 (enableExposureCompensation) \
448 (domeLightCameraVisibility) \
449 /* Raytracer sampling settings */ \
450 (convergedVariance) \
451 (convergedSamplesPerPixel) \
452 /* thread limit settings */ \
453 (threadLimit) \
454 /* interactive vs offline */ \
455 (enableInteractive) \
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