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