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 
115 #define HD_INSTANCER_TOKENS \
116  (culledInstanceIndices) \
117  (instancer) \
118  (instancerTransform) \
119  (instancerTransformInverse) \
120  (instanceIndices) \
121  (instanceIndexBase) \
122  (instanceTransform) \
123  (rotate) \
124  (scale) \
125  (translate)
126 
127 #define HD_REPR_TOKENS \
128  (disabled) \
129  (hull) \
130  (points) \
131  (smoothHull) \
132  (refined) \
133  (refinedWire) \
134  (refinedWireOnSurf) \
135  (wire) \
136  (wireOnSurf)
137 
138 #define HD_CULLSTYLE_TOKENS \
139  (dontCare) \
140  (nothing) \
141  (back) \
142  (front) \
143  (backUnlessDoubleSided) \
144  (frontUnlessDoubleSided)
145 
146 #define HD_PERF_TOKENS \
147  (adjacencyBufSize) \
148  (basisCurvesTopology) \
149  (bufferSourcesResolved) \
150  (bufferArrayRangeMigrated) \
151  (bufferArrayRangeContainerResized) \
152  (computationsCommited) \
153  (drawBatches) \
154  (drawCalls) \
155  (dirtyLists) \
156  (dirtyListsRebuilt) \
157  (garbageCollected) \
158  (garbageCollectedSsbo) \
159  (garbageCollectedUbo) \
160  (garbageCollectedVbo) \
161  (gpuMemoryUsed) \
162  (instBasisCurvesTopology) \
163  (instBasisCurvesTopologyRange) \
164  (instExtComputationDataRange) \
165  (instMeshTopology) \
166  (instMeshTopologyRange) \
167  (instPrimvarRange) \
168  (instVertexAdjacency) \
169  (meshTopology) \
170  (nonUniformSize) \
171  (numCompletedSamples) \
172  (quadrangulateCPU) \
173  (quadrangulateGPU) \
174  (quadrangulateFaceVarying) \
175  (quadrangulatedVerts) \
176  (rebuildBatches) \
177  (singleBufferSize) \
178  (ssboSize) \
179  (skipInvisibleRprimSync) \
180  (subdivisionRefineCPU) \
181  (subdivisionRefineGPU) \
182  (textureMemory) \
183  (triangulateFaceVarying) \
184  (uboSize) \
185  (vboRelocated)
186 
187 #define HD_SHADER_TOKENS \
188  (alphaThreshold) \
189  (clipPlanes) \
190  (commonShaderSource) \
191  (computeShader) \
192  (cullStyle) \
193  (drawRange) \
194  (environmentMap) \
195  (displacementShader) \
196  (fragmentShader) \
197  (geometryShader) \
198  (imageToWorldMatrix) \
199  (indicatorColor) \
200  (lightingBlendAmount) \
201  (overrideColor) \
202  (maskColor) \
203  (projectionMatrix) \
204  (pointColor) \
205  (pointSize) \
206  (pointSelectedSize) \
207  (materialTag) \
208  (tessControlShader) \
209  (tessEvalShader) \
210  (postTessControlShader) \
211  (postTessVertexShader) \
212  (tessLevel) \
213  (viewport) \
214  (vertexShader) \
215  (wireframeColor) \
216  (worldToViewMatrix) \
217  (worldToViewInverseMatrix) \
218  (stepSize) \
219  (stepSizeLighting)
220 
221 // Deprecated. Use: HdStMaterialTagTokens
222 #define HD_MATERIALTAG_TOKENS \
223  (defaultMaterialTag)
224 
225 /* Terminal keys used in material networks.
226  */
227 #define HD_MATERIAL_TERMINAL_TOKENS \
228  (surface) \
229  (displacement) \
230  (volume) \
231  (light) \
232  (lightFilter)
233 
234 #define HD_RENDERTAG_TOKENS \
235  (geometry) \
236  (guide) \
237  (hidden) \
238  (proxy) \
239  (render) \
240  (widget)
241 
242 #define HD_RENDER_CONTEXT_TOKENS \
243  ((universal, ""))
244 
245 #define HD_OPTION_TOKENS \
246  (parallelRprimSync)
247 
248 #define HD_PRIMTYPE_TOKENS \
249  /* Rprims */ \
250  (capsule) \
251  (cone) \
252  (cube) \
253  (cylinder) \
254  (mesh) \
255  (basisCurves) \
256  (points) \
257  (sphere) \
258  (volume) \
259  \
260  /* Sprims */ \
261  (camera) \
262  (drawTarget) \
263  (material) \
264  (coordSys) \
265  (instancer) \
266  (instance) \
267  (sampleFilter) \
268  /* Sprims Lights */ \
269  (simpleLight) \
270  (cylinderLight) \
271  (diskLight) \
272  (distantLight) \
273  (domeLight) \
274  (light) \
275  (lightFilter) \
276  (meshLight) \
277  (pluginLight) \
278  (rectLight) \
279  (sphereLight) \
280  /* Sprims ExtComputations */ \
281  (extComputation) \
282  \
283  /* Bprims */ \
284  (renderBuffer) \
285  (renderSettings)
286 
287 HD_API
288 bool HdPrimTypeIsGprim(TfToken const& primType);
289 
290 HD_API
291 bool HdPrimTypeIsLight(TfToken const& primType);
292 
293 #define HD_PRIMVAR_ROLE_TOKENS \
294  ((none, "")) \
295  (color) \
296  (vector) \
297  (normal) \
298  (point) \
299  (textureCoordinate)
300 
301 /* Schema for "Alternate Output Values" rendering,
302  * describing which values a renderpass should
303  * compute and write at render time.
304  */
305 #define HD_AOV_TOKENS \
306  /* Standard rendering outputs */ \
307  \
308  /* HdAovTokens->color represents the final
309  * fragment RGBA color. For correct compositing
310  * using Hydra, it should have pre-multiplied alpha.
311  */ \
312  (color) \
313  /* HdAovTokens->depth represents the clip-space
314  * depth of the final fragment.
315  */ \
316  (depth) \
317  /* HdAovTokens->depthStencil represents the clip-space
318  * depth of the final fragment w/ 8-bit stencil.
319  */ \
320  (depthStencil) \
321  /* HdAovTokens->cameraDepth represents the camera-space
322  * depth of the final fragment.
323  */ \
324  (cameraDepth) \
325  /* ID rendering - these tokens represent the
326  * prim, instance, and subprim ids of the final
327  * fragment.
328  */ \
329  (primId) \
330  (instanceId) \
331  (elementId) \
332  (edgeId) \
333  (pointId) \
334  /* Geometric data */ \
335  (Peye) \
336  (Neye) \
337  (patchCoord) \
338  (primitiveParam) \
339  (normal) \
340  /* Others we might want to add:
341  * https://rmanwiki.pixar.com/display/REN/Arbitrary+Output+Variables
342  * - curvature
343  * - tangent
344  * - velocity
345  */ \
346  /* Primvars:
347  * The tokens don't try to enumerate primvars,
348  * but instead provide an identifying namespace.
349  * The "color" primvar is addressable as "primvars:color".
350  */ \
351  ((primvars, "primvars:")) \
352  /* Light path expressions:
353  * Applicable only to raytracers, these tell
354  * the renderer to output specific shading
355  * components for specific classes of lightpath.
356  *
357  * Lightpath syntax is defined here:
358  * https://rmanwiki.pixar.com/display/REN/Light+Path+Expressions
359  * ... so for example, you could specify
360  * "lpe:CD[<L.>O]"
361  */ \
362  ((lpe, "lpe:")) \
363  /* Shader signals:
364  * This tells the renderer to output a partial shading signal,
365  * whether from the BXDF (e.g. bxdf.diffuse) or from an intermediate
366  * shading node (e.g. fractal.rgb).
367  * XXX: The exact format is TBD.
368  */ \
369  ((shader, "shader:"))
370 
371 HD_API
372 TfToken HdAovTokensMakePrimvar(TfToken const& primvar);
373 
374 HD_API
375 TfToken HdAovTokensMakeLpe(TfToken const& lpe);
376 
377 HD_API
378 TfToken HdAovTokensMakeShader(TfToken const& shader);
379 
380 /* Schema for application-configurable render settings. */
381 #define HD_RENDER_SETTINGS_TOKENS \
382  /* General graphical options */ \
383  (enableShadows) \
384  (enableSceneMaterials) \
385  (enableSceneLights) \
386  (domeLightCameraVisibility) \
387  /* Raytracer sampling settings */ \
388  (convergedVariance) \
389  (convergedSamplesPerPixel) \
390  /* thread limit settings */ \
391  (threadLimit) \
392  /* interactive vs offline */ \
393  (enableInteractive)
394 
395 #define HD_RESOURCE_TYPE_TOKENS \
396  (texture) \
397  (shaderFile)
398 
399 #define HD_SCENE_INDEX_EMULATION_TOKENS \
400  (sceneDelegate) \
401 
402 TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
403 TF_DECLARE_PUBLIC_TOKENS(HdInstancerTokens, HD_API, HD_INSTANCER_TOKENS);
404 TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
405 TF_DECLARE_PUBLIC_TOKENS(HdCullStyleTokens, HD_API, HD_CULLSTYLE_TOKENS);
406 TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
407 TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
408 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
409 TF_DECLARE_PUBLIC_TOKENS(HdMaterialTerminalTokens, HD_API,
410  HD_MATERIAL_TERMINAL_TOKENS);
411 TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
412 TF_DECLARE_PUBLIC_TOKENS(HdRenderContextTokens, HD_API, HD_RENDER_CONTEXT_TOKENS);
413 TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
414 TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
415 TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
416 TF_DECLARE_PUBLIC_TOKENS(HdAovTokens, HD_API, HD_AOV_TOKENS);
417 TF_DECLARE_PUBLIC_TOKENS(HdRenderSettingsTokens, HD_API, HD_RENDER_SETTINGS_TOKENS);
418 TF_DECLARE_PUBLIC_TOKENS(HdResourceTypeTokens, HD_API, HD_RESOURCE_TYPE_TOKENS);
419 TF_DECLARE_PUBLIC_TOKENS(HdSceneIndexEmulationTokens, HD_API,
420  HD_SCENE_INDEX_EMULATION_TOKENS);
421 
422 PXR_NAMESPACE_CLOSE_SCOPE
423 
424 #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.