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 (plane) \
282 (points) \
283 (sphere) \
284 (volume) \
285 (model)
286
287// XXX Unfortunately, we export a function of the name HdLightPrimTypeTokens.
288// Omit 'Prim' from the name.
289#define HD_LIGHT_TYPE_TOKENS \
290 (cylinderLight) \
291 (diskLight) \
292 (distantLight) \
293 (domeLight) \
294 (light) \
295 (meshLight) \
296 (pluginLight) \
297 (rectLight) \
298 (simpleLight) \
299 (sphereLight)
300
301#define HD_LIGHT_FILTER_TYPE_TOKENS \
302 (lightFilter)
303
304#define HD_SPRIMTYPE_TOKENS \
305 /* Sprims */ \
306 (camera) \
307 (drawTarget) \
308 (material) \
309 (coordSys) \
310 (instancer) \
311 (instance) \
312 (integrator) \
313 (sampleFilter) \
314 (displayFilter) \
315 (imageShader) \
316 \
317 HD_LIGHT_TYPE_TOKENS \
318 HD_LIGHT_FILTER_TYPE_TOKENS \
319 \
320 /* Sprims ExtComputations */ \
321 (extComputation) \
322
323#define HD_BPRIMTYPE_TOKENS \
324 /* Bprims */ \
325 (renderBuffer) \
326 (renderSettings)
327
328#define HD_PRIMTYPE_TOKENS \
329 HD_RPRIMTYPE_TOKENS \
330 HD_SPRIMTYPE_TOKENS \
331 HD_BPRIMTYPE_TOKENS \
332 /* Scene-index-only prim types */ \
333 (renderPass) \
334 (task)
335
336HD_API
337bool HdPrimTypeIsGprim(TfToken const& primType);
338
339HD_API
340bool HdPrimTypeIsLight(TfToken const& primType);
341
342HD_API
343bool HdPrimTypeSupportsGeomSubsets(const TfToken& primType);
344
345HD_API
346const TfTokenVector &HdLightPrimTypeTokens();
347
348#define HD_PRIMVAR_ROLE_TOKENS \
349 ((none, "")) \
350 (color) \
351 (vector) \
352 (normal) \
353 (point) \
354 (textureCoordinate)
355
356/* Schema for "Alternate Output Values" rendering,
357 * describing which values a renderpass should
358 * compute and write at render time.
359 */
360#define HD_AOV_TOKENS \
361 /* Standard rendering outputs */ \
362 \
363 /* HdAovTokens->color represents the final
364 * fragment RGBA color. For correct compositing
365 * using Hydra, it should have pre-multiplied alpha.
366 */ \
367 (color) \
368 /* HdAovTokens->depth represents the clip-space
369 * depth of the final fragment.
370 */ \
371 (depth) \
372 /* HdAovTokens->depthStencil represents the clip-space
373 * depth of the final fragment w/ 8-bit stencil.
374 */ \
375 (depthStencil) \
376 /* HdAovTokens->cameraDepth represents the camera-space
377 * depth of the final fragment.
378 */ \
379 (cameraDepth) \
380 /* ID rendering - these tokens represent the
381 * prim, instance, and subprim ids of the final
382 * fragment.
383 */ \
384 (primId) \
385 (instanceId) \
386 (elementId) \
387 (edgeId) \
388 (pointId) \
389 /* Geometric data */ \
390 (Peye) \
391 (Neye) \
392 (patchCoord) \
393 (primitiveParam) \
394 (normal) \
395 /* Others we might want to add:
396 * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
397 * - curvature
398 * - tangent
399 * - velocity
400 */ \
401 /* Primvars:
402 * The tokens don't try to enumerate primvars,
403 * but instead provide an identifying namespace.
404 * The "color" primvar is addressable as "primvars:color".
405 */ \
406 ((primvars, "primvars:")) \
407 /* Light path expressions:
408 * Applicable only to raytracers, these tell
409 * the renderer to output specific shading
410 * components for specific classes of lightpath.
411 *
412 * Lightpath syntax is defined here:
413 * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
414 * ... so for example, you could specify
415 * "lpe:CD[<L.>O]"
416 */ \
417 ((lpe, "lpe:")) \
418 /* Shader signals:
419 * This tells the renderer to output a partial shading signal,
420 * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
421 * shading node (e.g. fractal.rgb).
422 * XXX: The exact format is TBD.
423 */ \
424 ((shader, "shader:"))
425
426HD_API
427TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
428
429HD_API
430TfToken HdAovTokensMakeLpe(TfToken const& lpe);
431
432HD_API
433TfToken HdAovTokensMakeShader(TfToken const& shader);
434
435/* Schema for application-configurable render settings. */
436#define HD_RENDER_SETTINGS_TOKENS \
437 /* General graphical options */ \
438 (enableShadows) \
439 (enableSceneMaterials) \
440 (enableSceneLights) \
441 (enableExposureCompensation) \
442 (domeLightCameraVisibility) \
443 /* Raytracer sampling settings */ \
444 (convergedVariance) \
445 (convergedSamplesPerPixel) \
446 /* thread limit settings */ \
447 (threadLimit) \
448 /* interactive vs offline */ \
449 (enableInteractive)
450
451#define HD_RENDER_SETTINGS_PRIM_TOKENS \
452 (active) \
453 (namespacedSettings) \
454 (renderProducts) \
455 (includedPurposes) \
456 (materialBindingPurposes) \
457 (renderingColorSpace) \
458 (shutterInterval)
459
460/* Aspect Ratio Conform Policy Tokens used on render settings prims
461 * Note that these mirror the conform policy tokens in UsdRenderTokens */
462#define HD_ASPECT_RATIO_CONFORM_POLICY \
463 (adjustApertureWidth) \
464 (adjustApertureHeight) \
465 (expandAperture) \
466 (cropAperture) \
467 (adjustPixelAspectRatio) \
468
469#define HD_RESOURCE_TYPE_TOKENS \
470 (texture) \
471 (shaderFile)
472
473#define HD_SCENE_INDEX_EMULATION_TOKENS \
474 (sceneDelegate) \
475
476/* Tokens used to emulate collections for light linking. The collection names
477 match the UsdLuxLightAPI. Hydra 1.0 uses lightFilterLink instead of
478 filterLink.
479*/
480#define HD_COLLECTION_EMULATION_TOKENS \
481 ((lightLinkCollection, "lightLink")) \
482 ((shadowLinkCollection, "shadowLink")) \
483 ((filterLinkCollection, "filterLink")) \
484 (lightLinkCollectionMembershipExpression) \
485 (shadowLinkCollectionMembershipExpression) \
486 (filterLinkCollectionMembershipExpression)
487
488TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
489TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
490TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
491TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
492TF_DECLARE_PUBLIC_TOKENS(HdModelDrawModeTokens, HD_API,
493 HD_MODEL_DRAWMODE_TOKENS);
494TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
495TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
496TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
497TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
498 HD_MATERIAL_TERMINAL_TOKENS);
499TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
500TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
501TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
502TF_DECLARE_PUBLIC_TOKENS(HdLightTypeTokens, HD_API, HD_LIGHT_TYPE_TOKENS);
503TF_DECLARE_PUBLIC_TOKENS(HdLightFilterTypeTokens, HD_API,
504 HD_LIGHT_FILTER_TYPE_TOKENS);
505TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
506TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
507TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
508TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
509TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
510TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
511TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
512TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
513 HD_RENDER_SETTINGS_PRIM_TOKENS);
514TF_DECLARE_PUBLIC_TOKENS(HdAspectRatioConformPolicyTokens, HD_API,
515 HD_ASPECT_RATIO_CONFORM_POLICY);
516TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
517TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
518 HD_SCENE_INDEX_EMULATION_TOKENS);
519TF_DECLARE_PUBLIC_TOKENS(HdCollectionEmulationTokens, HD_API,
520 HD_COLLECTION_EMULATION_TOKENS);
521
522PXR_NAMESPACE_CLOSE_SCOPE
523
524#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