1 // Copyright 2009-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 
4 // This header is shared with ISPC
5 
6 #pragma once
7 
8 // Log levels which can be set on a device via "logLevel" parameter
9 typedef enum
10 #if __cplusplus >= 201103L
11     : uint32_t
12 #endif
13 {
14   OSP_LOG_DEBUG = 1,
15   OSP_LOG_INFO = 2,
16   OSP_LOG_WARNING = 3,
17   OSP_LOG_ERROR = 4,
18   OSP_LOG_NONE = 5
19 } OSPLogLevel;
20 
21 typedef enum
22 #if __cplusplus >= 201103L
23     : uint32_t
24 #endif
25 {
26   OSP_DEVICE_VERSION = 0,
27   OSP_DEVICE_VERSION_MAJOR = 1,
28   OSP_DEVICE_VERSION_MINOR = 2,
29   OSP_DEVICE_VERSION_PATCH = 3,
30   OSP_DEVICE_SO_VERSION = 4
31 } OSPDeviceProperty;
32 
33 // An enum type that represensts the different data types represented in OSPRay
34 typedef enum
35 #if __cplusplus >= 201103L
36     : uint32_t
37 #endif
38 {
39   // Object reference type.
40   OSP_DEVICE = 100,
41 
42   // Void pointer type.
43   OSP_VOID_PTR = 200,
44 
45   // Booleans, same size as OSP_INT.
46   OSP_BOOL = 250,
47 
48   // highest bit to represent objects/handles
49   OSP_OBJECT = 0x8000000,
50 
51   // object subtypes
52   OSP_DATA = 0x8000000 + 100,
53   OSP_CAMERA,
54   OSP_FRAMEBUFFER,
55   OSP_FUTURE,
56   OSP_GEOMETRIC_MODEL,
57   OSP_GEOMETRY,
58   OSP_GROUP,
59   OSP_IMAGE_OPERATION,
60   OSP_INSTANCE,
61   OSP_LIGHT,
62   OSP_MATERIAL,
63   OSP_RENDERER,
64   OSP_TEXTURE,
65   OSP_TRANSFER_FUNCTION,
66   OSP_VOLUME,
67   OSP_VOLUMETRIC_MODEL,
68   OSP_WORLD,
69 
70   // Pointer to a C-style NULL-terminated character string.
71   OSP_STRING = 1500,
72 
73   // Character scalar type.
74   OSP_CHAR = 2000,
75   OSP_VEC2C,
76   OSP_VEC3C,
77   OSP_VEC4C,
78 
79   // Unsigned character scalar and vector types.
80   OSP_UCHAR = 2500,
81   OSP_VEC2UC,
82   OSP_VEC3UC,
83   OSP_VEC4UC,
84   OSP_BYTE = 2500, // XXX OSP_UCHAR, ISPC issue #1246
85   OSP_RAW = 2500, // XXX OSP_UCHAR, ISPC issue #1246
86 
87   // Signed 16-bit integer scalar.
88   OSP_SHORT = 3000,
89   OSP_VEC2S,
90   OSP_VEC3S,
91   OSP_VEC4S,
92 
93   // Unsigned 16-bit integer scalar.
94   OSP_USHORT = 3500,
95   OSP_VEC2US,
96   OSP_VEC3US,
97   OSP_VEC4US,
98 
99   // Signed 32-bit integer scalar and vector types.
100   OSP_INT = 4000,
101   OSP_VEC2I,
102   OSP_VEC3I,
103   OSP_VEC4I,
104 
105   // Unsigned 32-bit integer scalar and vector types.
106   OSP_UINT = 4500,
107   OSP_VEC2UI,
108   OSP_VEC3UI,
109   OSP_VEC4UI,
110 
111   // Signed 64-bit integer scalar and vector types.
112   OSP_LONG = 5000,
113   OSP_VEC2L,
114   OSP_VEC3L,
115   OSP_VEC4L,
116 
117   // Unsigned 64-bit integer scalar and vector types.
118   OSP_ULONG = 5550,
119   OSP_VEC2UL,
120   OSP_VEC3UL,
121   OSP_VEC4UL,
122 
123   // Half precision floating point scalar and vector types (IEEE 754
124   // `binary16`).
125   OSP_HALF = 5800,
126   OSP_VEC2H,
127   OSP_VEC3H,
128   OSP_VEC4H,
129 
130   // Single precision floating point scalar and vector types.
131   OSP_FLOAT = 6000,
132   OSP_VEC2F,
133   OSP_VEC3F,
134   OSP_VEC4F,
135 
136   // Double precision floating point scalar type.
137   OSP_DOUBLE = 7000,
138   OSP_VEC2D,
139   OSP_VEC3D,
140   OSP_VEC4D,
141 
142   // Signed 32-bit integer N-dimensional box types
143   OSP_BOX1I = 8000,
144   OSP_BOX2I,
145   OSP_BOX3I,
146   OSP_BOX4I,
147 
148   // Single precision floating point N-dimensional box types
149   OSP_BOX1F = 10000,
150   OSP_BOX2F,
151   OSP_BOX3F,
152   OSP_BOX4F,
153 
154   // Transformation types
155   OSP_LINEAR2F = 12000,
156   OSP_LINEAR3F,
157   OSP_AFFINE2F,
158   OSP_AFFINE3F,
159 
160   OSP_QUATF,
161 
162   // Guard value.
163   OSP_UNKNOWN = 9999999
164 } OSPDataType;
165 
166 // OSPRay format constants for Texture creation
167 typedef enum
168 #if __cplusplus >= 201103L
169     : uint32_t
170 #endif
171 {
172   OSP_TEXTURE_RGBA8,
173   OSP_TEXTURE_SRGBA,
174   OSP_TEXTURE_RGBA32F,
175   OSP_TEXTURE_RGB8,
176   OSP_TEXTURE_SRGB,
177   OSP_TEXTURE_RGB32F,
178   OSP_TEXTURE_R8,
179   OSP_TEXTURE_R32F,
180   OSP_TEXTURE_L8,
181   OSP_TEXTURE_RA8,
182   OSP_TEXTURE_LA8,
183   OSP_TEXTURE_RGBA16,
184   OSP_TEXTURE_RGB16,
185   OSP_TEXTURE_RA16,
186   OSP_TEXTURE_R16,
187   // Denotes an unknown texture format, so we can properly initialize parameters
188   OSP_TEXTURE_FORMAT_INVALID = 255,
189 } OSPTextureFormat;
190 
191 // Filter modes that can be set on 'texture2d' type OSPTexture
192 typedef enum
193 #if __cplusplus >= 201103L
194     : uint32_t
195 #endif
196 {
197   OSP_TEXTURE_FILTER_BILINEAR = 0, // default bilinear interpolation
198   OSP_TEXTURE_FILTER_NEAREST // use nearest-neighbor interpolation
199 } OSPTextureFilter;
200 
201 // Error codes returned by various API and callback functions
202 typedef enum
203 #if __cplusplus >= 201103L
204     : uint32_t
205 #endif
206 {
207   OSP_NO_ERROR = 0, // No error has been recorded
208   OSP_UNKNOWN_ERROR = 1, // An unknown error has occurred
209   OSP_INVALID_ARGUMENT = 2, // An invalid argument is specified
210   OSP_INVALID_OPERATION =
211       3, // The operation is not allowed for the specified object
212   OSP_OUT_OF_MEMORY =
213       4, // There is not enough memory left to execute the command
214   OSP_UNSUPPORTED_CPU =
215       5, // The CPU is not supported as it does not support SSE4.1
216   OSP_VERSION_MISMATCH =
217       6, // A module could not be loaded due to mismatching version
218 } OSPError;
219 
220 // OSPRay format constants for Frame Buffer creation
221 typedef enum
222 #if __cplusplus >= 201103L
223     : uint32_t
224 #endif
225 {
226   OSP_FB_NONE, // framebuffer will not be mapped by application
227   OSP_FB_RGBA8, // one dword per pixel: rgb+alpha, each one byte
228   OSP_FB_SRGBA, // one dword per pixel: rgb (in sRGB space) + alpha, each one
229                 // byte
230   OSP_FB_RGBA32F, // one float4 per pixel: rgb+alpha, each one float
231 } OSPFrameBufferFormat;
232 
233 // OSPRay channel constants for Frame Buffer (can be OR'ed together)
234 typedef enum
235 #if __cplusplus >= 201103L
236     : uint32_t
237 #endif
238 {
239   OSP_FB_COLOR = (1 << 0),
240   OSP_FB_DEPTH = (1 << 1),
241   OSP_FB_ACCUM = (1 << 2),
242   OSP_FB_VARIANCE = (1 << 3),
243   OSP_FB_NORMAL = (1 << 4), // in world-space
244   OSP_FB_ALBEDO = (1 << 5)
245 } OSPFrameBufferChannel;
246 
247 // OSPRay events which can be waited on via ospWait()
248 typedef enum
249 #if __cplusplus >= 201103L
250     : uint32_t
251 #endif
252 {
253   OSP_NONE_FINISHED = 0,
254   OSP_WORLD_RENDERED = 10,
255   OSP_WORLD_COMMITTED = 20,
256   OSP_FRAME_FINISHED = 30,
257   OSP_TASK_FINISHED = 100000
258 } OSPSyncEvent;
259 
260 // OSPRay cell types definition for unstructured volumes, values are set to
261 // match VTK
262 typedef enum
263 #if __cplusplus >= 201103L
264     : uint8_t
265 #endif
266 {
267   OSP_TETRAHEDRON = 10,
268   OSP_HEXAHEDRON = 12,
269   OSP_WEDGE = 13,
270   OSP_PYRAMID = 14,
271   OSP_UNKNOWN_CELL_TYPE = 255
272 } OSPUnstructuredCellType;
273 
274 // OSPRay camera stereo image modes
275 typedef enum
276 #if __cplusplus >= 201103L
277     : uint8_t
278 #endif
279 {
280   OSP_STEREO_NONE,
281   OSP_STEREO_LEFT,
282   OSP_STEREO_RIGHT,
283   OSP_STEREO_SIDE_BY_SIDE,
284   OSP_STEREO_TOP_BOTTOM,
285   OSP_STEREO_UNKNOWN = 255
286 } OSPStereoMode;
287 
288 typedef enum
289 #if __cplusplus >= 201103L
290     : uint8_t
291 #endif
292 {
293   OSP_SHUTTER_GLOBAL,
294   OSP_SHUTTER_ROLLING_RIGHT,
295   OSP_SHUTTER_ROLLING_LEFT,
296   OSP_SHUTTER_ROLLING_DOWN,
297   OSP_SHUTTER_ROLLING_UP,
298   OSP_SHUTTER_UNKNOWN = 255
299 } OSPShutterType;
300 
301 typedef enum
302 #if __cplusplus >= 201103L
303     : uint8_t
304 #endif
305 {
306   OSP_ROUND,
307   OSP_FLAT,
308   OSP_RIBBON,
309   OSP_DISJOINT,
310   OSP_UNKNOWN_CURVE_TYPE = 255
311 } OSPCurveType;
312 
313 typedef enum
314 #if __cplusplus >= 201103L
315     : uint8_t
316 #endif
317 {
318   OSP_LINEAR,
319   OSP_BEZIER,
320   OSP_BSPLINE,
321   OSP_HERMITE,
322   OSP_CATMULL_ROM,
323   OSP_UNKNOWN_CURVE_BASIS = 255
324 } OSPCurveBasis;
325 
326 typedef enum
327 #if __cplusplus >= 201103L
328     : uint8_t
329 #endif
330 {
331   OSP_SUBDIVISION_NO_BOUNDARY,
332   OSP_SUBDIVISION_SMOOTH_BOUNDARY,
333   OSP_SUBDIVISION_PIN_CORNERS,
334   OSP_SUBDIVISION_PIN_BOUNDARY,
335   OSP_SUBDIVISION_PIN_ALL
336 } OSPSubdivisionMode;
337 
338 // AMR Volume rendering methods
339 typedef enum
340 #if __cplusplus >= 201103L
341     : uint8_t
342 #endif
343 {
344   OSP_AMR_CURRENT,
345   OSP_AMR_FINEST,
346   OSP_AMR_OCTANT
347 } OSPAMRMethod;
348 
349 // Filter modes that can be set on 'VDB' type OSPVolume, compatible with VKL
350 typedef enum
351 #if __cplusplus >= 201103L
352     : uint32_t
353 #endif
354 {
355   OSP_VOLUME_FILTER_NEAREST = 0, // treating voxel cell as constant
356   OSP_VOLUME_FILTER_TRILINEAR = 100, // default trilinear interpolation
357   OSP_VOLUME_FILTER_TRICUBIC = 200 // tricubic interpolation
358 } OSPVolumeFilter;
359 
360 // OSPRay pixel filter types
361 typedef enum
362 #if __cplusplus >= 201103L
363     : uint8_t
364 #endif
365 {
366   OSP_PIXELFILTER_POINT,
367   OSP_PIXELFILTER_BOX,
368   OSP_PIXELFILTER_GAUSS,
369   OSP_PIXELFILTER_MITCHELL,
370   OSP_PIXELFILTER_BLACKMAN_HARRIS
371 } OSPPixelFilterTypes;
372 
373 // OSPRay light quantity types
374 typedef enum
375 #if __cplusplus >= 201103L
376     : uint8_t
377 #endif
378 {
379   OSP_INTENSITY_QUANTITY_RADIANCE, // unit W/sr/m^2
380   OSP_INTENSITY_QUANTITY_IRRADIANCE, // unit W/m^2
381   OSP_INTENSITY_QUANTITY_INTENSITY, // radiant intensity, unit W/sr
382   OSP_INTENSITY_QUANTITY_POWER, // radiant flux, unit W
383   OSP_INTENSITY_QUANTITY_SCALE, // linear scaling factor for the built-in type
384   OSP_INTENSITY_QUANTITY_UNKNOWN
385 } OSPIntensityQuantity;
386