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