Loading...
Searching...
No Matches
tokens.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_TOKENS_H
25#define PXR_IMAGING_HD_TOKENS_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/version.h"
32
33PXR_NAMESPACE_OPEN_SCOPE
34
35extern HD_API TfEnvSetting<bool> HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES;
36
37#define HD_TOKENS \
38 (accelerations) \
39 (adjacency) \
40 (bboxLocalMin) \
41 (bboxLocalMax) \
42 (bbox) \
43 (bezier) \
44 (bspline) \
45 (blurScale) \
46 (camera) \
47 (catmullRom) \
48 (centripetalCatmullRom) \
49 (collection) \
50 (computeShader) \
51 (coordSysBindings) \
52 (cubic) \
53 (cullStyle) \
54 (doubleSided) \
55 (dispatchCount) \
56 (displayColor) \
57 (displayOpacity) \
58 (displayStyle) \
59 (drawDispatch) \
60 (drawingShader) \
61 (drawingCoord0) \
62 (drawingCoord1) \
63 (drawingCoord2) \
64 (drawingCoordI) \
65 (drivers) \
66 (edgeIndices) \
67 (elementCount) \
68 (elementsVisibility) \
69 (extent) \
70 (faceColors) \
71 (filters) \
72 (full) \
73 (geometry) \
74 (hermite) \
75 (hullIndices) \
76 (indices) \
77 (isFlipped) \
78 (itemsDrawn) \
79 (layout) \
80 (leftHanded) \
81 (linear) \
82 (lightLink) \
83 (lightFilterLink) \
84 (lightFilterType) \
85 (meshLight) \
86 (materialParams) \
87 (materialSyncMode) \
88 (nonlinearSampleCount) \
89 (nonperiodic) \
90 (normals) \
91 (params) \
92 (patchParam) \
93 (periodic) \
94 (pinned) \
95 (points) \
96 (pointsIndices) \
97 (portals) \
98 (power) \
99 (preview) \
100 (pointsVisibility) \
101 (primvar) \
102 (primID) \
103 (primitiveParam) \
104 (tessFactors) \
105 (quadInfo) \
106 (renderTags) \
107 (rightHanded) \
108 (segmented) \
109 (shadowLink) \
110 (subdivTags) \
111 (taskState) \
112 (taskParams) \
113 (topology) \
114 (topologyVisibility) \
115 (totalItemCount) \
116 (transform) \
117 (transformInverse) \
118 (velocities) \
119 (visibility) \
120 (widths) \
121 (isLight) \
122 \
123 /* Legacy tokens. */ \
124 \
125 /* bSpline is a legacy alias so that */ \
126 /* render delegates can compile without */ \
127 /* code change. The new token for */ \
128 /* bspline follows USD and has no */ \
129 /* capital letters. */ \
130 ((bSpline, "bspline"))
131
132#define HD_INSTANCER_TOKENS \
133 (culledInstanceIndices) \
134 (instancer) \
135 (instancerTransform) \
136 (instancerTransformInverse) \
137 (instanceIndices) \
138 (instanceIndexBase) \
139 \
140 /* New instance xform tokens */ \
141 ((instanceTransforms, "hydra:instanceTransforms")) \
142 ((instanceRotations, "hydra:instanceRotations")) \
143 ((instanceScales, "hydra:instanceScales")) \
144 ((instanceTranslations, "hydra:instanceTranslations")) \
145 \
146 /* Deprecated versions of the above */ \
147 /* To be removed in 2024, along with the */ \
148 /* HD_USE_DEPRECATED_INSTANCER_PRIMVAR_NAMES env var*/ \
149 (instanceTransform) \
150 (rotate) \
151 (scale) \
152 (translate)
153
154#define HD_REPR_TOKENS \
155 (disabled) \
156 (hull) \
157 (points) \
158 (smoothHull) \
159 (refined) \
160 (refinedWire) \
161 (refinedWireOnSurf) \
162 (wire) \
163 (wireOnSurf)
164
165#define HD_CULLSTYLE_TOKENS \
166 (dontCare) \
167 (nothing) \
168 (back) \
169 (front) \
170 (backUnlessDoubleSided) \
171 (frontUnlessDoubleSided)
172
173#define HD_MODEL_DRAWMODE_TOKENS \
174 (inherited) \
175 (origin) \
176 (bounds) \
177 (cards) \
178 ((default_, "default")) \
179 (cross) \
180 (box) \
181 (fromTexture)
182
183#define HD_PERF_TOKENS \
184 (adjacencyBufSize) \
185 (basisCurvesTopology) \
186 (bufferSourcesResolved) \
187 (bufferArrayRangeMigrated) \
188 (bufferArrayRangeContainerResized) \
189 (computationsCommited) \
190 (drawBatches) \
191 (drawCalls) \
192 (dirtyLists) \
193 (dirtyListsRebuilt) \
194 (garbageCollected) \
195 (garbageCollectedSsbo) \
196 (garbageCollectedUbo) \
197 (garbageCollectedVbo) \
198 (gpuMemoryUsed) \
199 (instBasisCurvesTopology) \
200 (instBasisCurvesTopologyRange) \
201 (instExtComputationDataRange) \
202 (instMeshTopology) \
203 (instMeshTopologyRange) \
204 (instPrimvarRange) \
205 (instVertexAdjacency) \
206 (meshTopology) \
207 (nonUniformSize) \
208 (numCompletedSamples) \
209 (quadrangulateCPU) \
210 (quadrangulateGPU) \
211 (quadrangulateFaceVarying) \
212 (quadrangulatedVerts) \
213 (rebuildBatches) \
214 (singleBufferSize) \
215 (ssboSize) \
216 (skipInvisibleRprimSync) \
217 (subdivisionRefineCPU) \
218 (subdivisionRefineGPU) \
219 (textureMemory) \
220 (triangulateFaceVarying) \
221 (uboSize) \
222 (vboRelocated)
223
224// XXX Move to hdSt.
225#define HD_SHADER_TOKENS \
226 (alphaThreshold) \
227 (clipPlanes) \
228 (commonShaderSource) \
229 (computeShader) \
230 (cullStyle) \
231 (drawRange) \
232 (environmentMap) \
233 (displacementShader) \
234 (fragmentShader) \
235 (geometryShader) \
236 (imageToWorldMatrix) \
237 (imageToHorizontallyNormalizedFilmback) \
238 (indicatorColor) \
239 (lightingBlendAmount) \
240 (overrideColor) \
241 (maskColor) \
242 (projectionMatrix) \
243 (pointColor) \
244 (pointSize) \
245 (pointSelectedSize) \
246 (materialTag) \
247 (numClipPlanes) \
248 (tessControlShader) \
249 (tessEvalShader) \
250 (postTessControlShader) \
251 (postTessVertexShader) \
252 (tessLevel) \
253 (viewport) \
254 (vertexShader) \
255 (wireframeColor) \
256 (worldToViewMatrix) \
257 (worldToViewInverseMatrix) \
258 (stepSize) \
259 (stepSizeLighting)
260
261// Deprecated. Use: HdStMaterialTagTokens
262#define HD_MATERIALTAG_TOKENS \
263 (defaultMaterialTag)
264
265/* Terminal keys used in material networks.
266 */
267#define HD_MATERIAL_TERMINAL_TOKENS \
268 (surface) \
269 (displacement) \
270 (volume) \
271 (light) \
272 (lightFilter)
273
274#define HD_RENDERTAG_TOKENS \
275 (geometry) \
276 (guide) \
277 (hidden) \
278 (proxy) \
279 (render) \
280 (widget)
281
282#define HD_RENDER_CONTEXT_TOKENS \
283 ((universal, ""))
284
285#define HD_OPTION_TOKENS \
286 (parallelRprimSync)
287
288#define HD_RPRIMTYPE_TOKENS \
289 /* Rprims */ \
290 (capsule) \
291 (capsule_1) \
292 (cone) \
293 (cube) \
294 (cylinder) \
295 (cylinder_1) \
296 (mesh) \
297 (nurbsPatch) \
298 (basisCurves) \
299 (nurbsCurves) \
300 (points) \
301 (sphere) \
302 (volume) \
303 (model)
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 /* Sprims Lights */ \
318 (simpleLight) \
319 (cylinderLight) \
320 (diskLight) \
321 (distantLight) \
322 (domeLight) \
323 (light) \
324 (lightFilter) \
325 (meshLight) \
326 (pluginLight) \
327 (rectLight) \
328 (sphereLight) \
329 /* Sprims ExtComputations */ \
330 (extComputation) \
331
332#define HD_BPRIMTYPE_TOKENS \
333 /* Bprims */ \
334 (renderBuffer) \
335 (renderSettings)
336
337#define HD_PRIMTYPE_TOKENS \
338 HD_RPRIMTYPE_TOKENS \
339 HD_SPRIMTYPE_TOKENS \
340 HD_BPRIMTYPE_TOKENS \
341
342HD_API
343bool HdPrimTypeIsGprim(TfToken const& primType);
344
345HD_API
346bool HdPrimTypeIsLight(TfToken const& primType);
347
348HD_API
349const TfTokenVector &HdLightPrimTypeTokens();
350
351#define HD_PRIMVAR_ROLE_TOKENS \
352 ((none, "")) \
353 (color) \
354 (vector) \
355 (normal) \
356 (point) \
357 (textureCoordinate)
358
359/* Schema for "Alternate Output Values" rendering,
360 * describing which values a renderpass should
361 * compute and write at render time.
362 */
363#define HD_AOV_TOKENS \
364 /* Standard rendering outputs */ \
365 \
366 /* HdAovTokens->color represents the final
367 * fragment RGBA color. For correct compositing
368 * using Hydra, it should have pre-multiplied alpha.
369 */ \
370 (color) \
371 /* HdAovTokens->depth represents the clip-space
372 * depth of the final fragment.
373 */ \
374 (depth) \
375 /* HdAovTokens->depthStencil represents the clip-space
376 * depth of the final fragment w/ 8-bit stencil.
377 */ \
378 (depthStencil) \
379 /* HdAovTokens->cameraDepth represents the camera-space
380 * depth of the final fragment.
381 */ \
382 (cameraDepth) \
383 /* ID rendering - these tokens represent the
384 * prim, instance, and subprim ids of the final
385 * fragment.
386 */ \
387 (primId) \
388 (instanceId) \
389 (elementId) \
390 (edgeId) \
391 (pointId) \
392 /* Geometric data */ \
393 (Peye) \
394 (Neye) \
395 (patchCoord) \
396 (primitiveParam) \
397 (normal) \
398 /* Others we might want to add:
399 * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
400 * - curvature
401 * - tangent
402 * - velocity
403 */ \
404 /* Primvars:
405 * The tokens don't try to enumerate primvars,
406 * but instead provide an identifying namespace.
407 * The "color" primvar is addressable as "primvars:color".
408 */ \
409 ((primvars, "primvars:")) \
410 /* Light path expressions:
411 * Applicable only to raytracers, these tell
412 * the renderer to output specific shading
413 * components for specific classes of lightpath.
414 *
415 * Lightpath syntax is defined here:
416 * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
417 * ... so for example, you could specify
418 * "lpe:CD[<L.>O]"
419 */ \
420 ((lpe, "lpe:")) \
421 /* Shader signals:
422 * This tells the renderer to output a partial shading signal,
423 * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
424 * shading node (e.g. fractal.rgb).
425 * XXX: The exact format is TBD.
426 */ \
427 ((shader, "shader:"))
428
429HD_API
430TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
431
432HD_API
433TfToken HdAovTokensMakeLpe(TfToken const& lpe);
434
435HD_API
436TfToken HdAovTokensMakeShader(TfToken const& shader);
437
438/* Schema for application-configurable render settings. */
439#define HD_RENDER_SETTINGS_TOKENS \
440 /* General graphical options */ \
441 (enableShadows) \
442 (enableSceneMaterials) \
443 (enableSceneLights) \
444 (domeLightCameraVisibility) \
445 /* Raytracer sampling settings */ \
446 (convergedVariance) \
447 (convergedSamplesPerPixel) \
448 /* thread limit settings */ \
449 (threadLimit) \
450 /* interactive vs offline */ \
451 (enableInteractive)
452
453#define HD_RENDER_SETTINGS_PRIM_TOKENS \
454 (active) \
455 (namespacedSettings) \
456 (renderProducts) \
457 (includedPurposes) \
458 (materialBindingPurposes) \
459 (renderingColorSpace) \
460 (shutterInterval)
461
462/* Aspect Ratio Conform Policy Tokens used on render settings prims
463 * Note that these mirror the conform policy tokens in UsdRenderTokens */
464#define HD_ASPECT_RATIO_CONFORM_POLICY \
465 (adjustApertureWidth) \
466 (adjustApertureHeight) \
467 (expandAperture) \
468 (cropAperture) \
469 (adjustPixelAspectRatio) \
470
471#define HD_RESOURCE_TYPE_TOKENS \
472 (texture) \
473 (shaderFile)
474
475#define HD_SCENE_INDEX_EMULATION_TOKENS \
476 (sceneDelegate) \
477
478TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
479TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
480TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
481TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
482TF_DECLARE_PUBLIC_TOKENS(HdModelDrawModeTokens, HD_API,
483 HD_MODEL_DRAWMODE_TOKENS);
484TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
485TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
486TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
487TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
488 HD_MATERIAL_TERMINAL_TOKENS);
489TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
490TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
491TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
492TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
493TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
494TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
495TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
496TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
497TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
498TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
499TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
500 HD_RENDER_SETTINGS_PRIM_TOKENS);
501TF_DECLARE_PUBLIC_TOKENS(HdAspectRatioConformPolicyTokens, HD_API,
502 HD_ASPECT_RATIO_CONFORM_POLICY);
503TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
504TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
505 HD_SCENE_INDEX_EMULATION_TOKENS);
506
507PXR_NAMESPACE_CLOSE_SCOPE
508
509#endif //PXR_IMAGING_HD_TOKENS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
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:112
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442