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