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