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"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 #define HD_TOKENS \
35  (accelerations) \
36  (adjacency) \
37  (bboxLocalMin) \
38  (bboxLocalMax) \
39  (bbox) \
40  (bezier) \
41  (bSpline) \
42  (blurScale) \
43  (camera) \
44  (catmullRom) \
45  (collection) \
46  (computeShader) \
47  (coordSysBindings) \
48  (cubic) \
49  (cullStyle) \
50  (doubleSided) \
51  (dispatchCount) \
52  (displayColor) \
53  (displayOpacity) \
54  (displayStyle) \
55  (drawDispatch) \
56  (drawingShader) \
57  (drawingCoord0) \
58  (drawingCoord1) \
59  (drawingCoord2) \
60  (drawingCoordI) \
61  (drivers) \
62  (edgeIndices) \
63  (elementCount) \
64  (elementsVisibility) \
65  (extent) \
66  (faceColors) \
67  (filters) \
68  (full) \
69  (geometry) \
70  (hermite) \
71  (hullIndices) \
72  (indices) \
73  (isFlipped) \
74  (itemsDrawn) \
75  (layout) \
76  (leftHanded) \
77  (linear) \
78  (lightLink) \
79  (lightFilterLink) \
80  (meshLight) \
81  (materialParams) \
82  (nonlinearSampleCount) \
83  (nonperiodic) \
84  (normals) \
85  (params) \
86  (patchParam) \
87  (periodic) \
88  (pinned) \
89  (points) \
90  (pointsIndices) \
91  (power) \
92  (preview) \
93  (pointsVisibility) \
94  (primvar) \
95  (primID) \
96  (primitiveParam) \
97  (tessFactors) \
98  (quadInfo) \
99  (renderTags) \
100  (rightHanded) \
101  (segmented) \
102  (shadowLink) \
103  (subdivTags) \
104  (taskState) \
105  (taskParams) \
106  (topology) \
107  (topologyVisibility) \
108  (totalItemCount) \
109  (transform) \
110  (transformInverse) \
111  (velocities) \
112  (visibility) \
113  (widths) \
114  (isLight)
115 
116 #define HD_INSTANCER_TOKENS \
117  (culledInstanceIndices) \
118  (instancer) \
119  (instancerTransform) \
120  (instancerTransformInverse) \
121  (instanceIndices) \
122  (instanceIndexBase) \
123  (instanceTransform) \
124  (rotate) \
125  (scale) \
126  (translate)
127 
128 #define HD_REPR_TOKENS \
129  (disabled) \
130  (hull) \
131  (points) \
132  (smoothHull) \
133  (refined) \
134  (refinedWire) \
135  (refinedWireOnSurf) \
136  (wire) \
137  (wireOnSurf)
138 
139 #define HD_CULLSTYLE_TOKENS \
140  (dontCare) \
141  (nothing) \
142  (back) \
143  (front) \
144  (backUnlessDoubleSided) \
145  (frontUnlessDoubleSided)
146 
147 #define HD_PERF_TOKENS \
148  (adjacencyBufSize) \
149  (basisCurvesTopology) \
150  (bufferSourcesResolved) \
151  (bufferArrayRangeMigrated) \
152  (bufferArrayRangeContainerResized) \
153  (computationsCommited) \
154  (drawBatches) \
155  (drawCalls) \
156  (dirtyLists) \
157  (dirtyListsRebuilt) \
158  (garbageCollected) \
159  (garbageCollectedSsbo) \
160  (garbageCollectedUbo) \
161  (garbageCollectedVbo) \
162  (gpuMemoryUsed) \
163  (instBasisCurvesTopology) \
164  (instBasisCurvesTopologyRange) \
165  (instExtComputationDataRange) \
166  (instMeshTopology) \
167  (instMeshTopologyRange) \
168  (instPrimvarRange) \
169  (instVertexAdjacency) \
170  (meshTopology) \
171  (nonUniformSize) \
172  (numCompletedSamples) \
173  (quadrangulateCPU) \
174  (quadrangulateGPU) \
175  (quadrangulateFaceVarying) \
176  (quadrangulatedVerts) \
177  (rebuildBatches) \
178  (singleBufferSize) \
179  (ssboSize) \
180  (skipInvisibleRprimSync) \
181  (subdivisionRefineCPU) \
182  (subdivisionRefineGPU) \
183  (textureMemory) \
184  (triangulateFaceVarying) \
185  (uboSize) \
186  (vboRelocated)
187 
188 #define HD_SHADER_TOKENS \
189  (alphaThreshold) \
190  (clipPlanes) \
191  (commonShaderSource) \
192  (computeShader) \
193  (cullStyle) \
194  (drawRange) \
195  (environmentMap) \
196  (displacementShader) \
197  (fragmentShader) \
198  (geometryShader) \
199  (imageToWorldMatrix) \
200  (indicatorColor) \
201  (lightingBlendAmount) \
202  (overrideColor) \
203  (maskColor) \
204  (projectionMatrix) \
205  (pointColor) \
206  (pointSize) \
207  (pointSelectedSize) \
208  (materialTag) \
209  (tessControlShader) \
210  (tessEvalShader) \
211  (postTessControlShader) \
212  (postTessVertexShader) \
213  (tessLevel) \
214  (viewport) \
215  (vertexShader) \
216  (wireframeColor) \
217  (worldToViewMatrix) \
218  (worldToViewInverseMatrix) \
219  (stepSize) \
220  (stepSizeLighting)
221 
222 // Deprecated. Use: HdStMaterialTagTokens
223 #define HD_MATERIALTAG_TOKENS \
224  (defaultMaterialTag)
225 
226 /* Terminal keys used in material networks.
227  */
228 #define HD_MATERIAL_TERMINAL_TOKENS \
229  (surface) \
230  (displacement) \
231  (volume) \
232  (light) \
233  (lightFilter)
234 
235 #define HD_RENDERTAG_TOKENS \
236  (geometry) \
237  (guide) \
238  (hidden) \
239  (proxy) \
240  (render) \
241  (widget)
242 
243 #define HD_RENDER_CONTEXT_TOKENS \
244  ((universal, ""))
245 
246 #define HD_OPTION_TOKENS \
247  (parallelRprimSync)
248 
249 #define HD_RPRIMTYPE_TOKENS \
250  /* Rprims */ \
251  (capsule) \
252  (cone) \
253  (cube) \
254  (cylinder) \
255  (mesh) \
256  (basisCurves) \
257  (points) \
258  (sphere) \
259  (volume) \
260 
261 #define HD_SPRIMTYPE_TOKENS \
262  /* Sprims */ \
263  (camera) \
264  (drawTarget) \
265  (material) \
266  (coordSys) \
267  (instancer) \
268  (instance) \
269  (sampleFilter) \
270  (displayFilter) \
271  /* Sprims Lights */ \
272  (simpleLight) \
273  (cylinderLight) \
274  (diskLight) \
275  (distantLight) \
276  (domeLight) \
277  (light) \
278  (lightFilter) \
279  (meshLight) \
280  (pluginLight) \
281  (rectLight) \
282  (sphereLight) \
283  /* Sprims ExtComputations */ \
284  (extComputation) \
285 
286 #define HD_BPRIMTYPE_TOKENS \
287  /* Bprims */ \
288  (renderBuffer) \
289  (renderSettings)
290 
291 #define HD_PRIMTYPE_TOKENS \
292  HD_RPRIMTYPE_TOKENS \
293  HD_SPRIMTYPE_TOKENS \
294  HD_BPRIMTYPE_TOKENS \
295 
296 HD_API
297 bool HdPrimTypeIsGprim(TfToken const& primType);
298 
299 HD_API
300 bool HdPrimTypeIsLight(TfToken const& primType);
301 
302 #define HD_PRIMVAR_ROLE_TOKENS \
303  ((none, "")) \
304  (color) \
305  (vector) \
306  (normal) \
307  (point) \
308  (textureCoordinate)
309 
310 /* Schema for "Alternate Output Values" rendering,
311  * describing which values a renderpass should
312  * compute and write at render time.
313  */
314 #define HD_AOV_TOKENS \
315  /* Standard rendering outputs */ \
316  \
317  /* HdAovTokens->color represents the final
318  * fragment RGBA color. For correct compositing
319  * using Hydra, it should have pre-multiplied alpha.
320  */ \
321  (color) \
322  /* HdAovTokens->depth represents the clip-space
323  * depth of the final fragment.
324  */ \
325  (depth) \
326  /* HdAovTokens->depthStencil represents the clip-space
327  * depth of the final fragment w/ 8-bit stencil.
328  */ \
329  (depthStencil) \
330  /* HdAovTokens->cameraDepth represents the camera-space
331  * depth of the final fragment.
332  */ \
333  (cameraDepth) \
334  /* ID rendering - these tokens represent the
335  * prim, instance, and subprim ids of the final
336  * fragment.
337  */ \
338  (primId) \
339  (instanceId) \
340  (elementId) \
341  (edgeId) \
342  (pointId) \
343  /* Geometric data */ \
344  (Peye) \
345  (Neye) \
346  (patchCoord) \
347  (primitiveParam) \
348  (normal) \
349  /* Others we might want to add:
350  * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
351  * - curvature
352  * - tangent
353  * - velocity
354  */ \
355  /* Primvars:
356  * The tokens don't try to enumerate primvars,
357  * but instead provide an identifying namespace.
358  * The "color" primvar is addressable as "primvars:color".
359  */ \
360  ((primvars, "primvars:")) \
361  /* Light path expressions:
362  * Applicable only to raytracers, these tell
363  * the renderer to output specific shading
364  * components for specific classes of lightpath.
365  *
366  * Lightpath syntax is defined here:
367  * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
368  * ... so for example, you could specify
369  * "lpe:CD[<L.>O]"
370  */ \
371  ((lpe, "lpe:")) \
372  /* Shader signals:
373  * This tells the renderer to output a partial shading signal,
374  * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
375  * shading node (e.g. fractal.rgb).
376  * XXX: The exact format is TBD.
377  */ \
378  ((shader, "shader:"))
379 
380 HD_API
381 TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
382 
383 HD_API
384 TfToken HdAovTokensMakeLpe(TfToken const& lpe);
385 
386 HD_API
387 TfToken HdAovTokensMakeShader(TfToken const& shader);
388 
389 /* Schema for application-configurable render settings. */
390 #define HD_RENDER_SETTINGS_TOKENS \
391  /* General graphical options */ \
392  (enableShadows) \
393  (enableSceneMaterials) \
394  (enableSceneLights) \
395  (domeLightCameraVisibility) \
396  /* Raytracer sampling settings */ \
397  (convergedVariance) \
398  (convergedSamplesPerPixel) \
399  /* thread limit settings */ \
400  (threadLimit) \
401  /* interactive vs offline */ \
402  (enableInteractive)
403 
404 #define HD_RENDER_SETTINGS_PRIM_TOKENS \
405  (active) \
406  (params)
407 
408 #define HD_RESOURCE_TYPE_TOKENS \
409  (texture) \
410  (shaderFile)
411 
412 #define HD_SCENE_INDEX_EMULATION_TOKENS \
413  (sceneDelegate) \
414 
415 TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
416 TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
417 TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
418 TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
419 TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
420 TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
421 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
422 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
423  HD_MATERIAL_TERMINAL_TOKENS);
424 TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
425 TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
426 TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
427 TF_DECLARE_PUBLIC_TOKENS(HdRprimTypeTokens, HD_API, HD_RPRIMTYPE_TOKENS);
428 TF_DECLARE_PUBLIC_TOKENS(HdSprimTypeTokens, HD_API, HD_SPRIMTYPE_TOKENS);
429 TF_DECLARE_PUBLIC_TOKENS(HdBprimTypeTokens, HD_API, HD_BPRIMTYPE_TOKENS);
430 TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
431 TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
432 TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
433 TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
434 TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsPrimTokens, HD_API,
435  HD_RENDER_SETTINGS_PRIM_TOKENS);
436 TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
437 TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
438  HD_SCENE_INDEX_EMULATION_TOKENS);
439 
440 PXR_NAMESPACE_CLOSE_SCOPE
441 
442 #endif //PXR_IMAGING_HD_TOKENS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
This file defines some macros that are useful for declaring and using static TfTokens.