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