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