Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/include/Diderot/cl-types.h
ViewVC logotype

Annotation of /branches/pure-cfg/src/include/Diderot/cl-types.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1420 - (view) (download) (as text)

1 : jhr 1272 /*! \file cl-types.h
2 : lamonts 1271 *
3 :     * \author Lamont Samuels
4 :     */
5 :    
6 :     /*
7 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     * All rights reserved.
9 :     */
10 : jhr 1272
11 :     #ifndef _DIDEROT_CL_TYPES_H_
12 :     #define _DIDEROT_CL_TYPES_H_
13 : lamonts 1271
14 :     typedef enum {
15 : jhr 1342 DIDEROT_ACTIVE = 0, //!< a currently running strand
16 :     DIDEROT_NEW = 1, //!< a newly created, but not yet active, strand
17 :     DIDEROT_DIE, //!< a dead strand
18 :     DIDEROT_STABILIZE, //!< a strand that will be stable at the end of
19 : jhr 1272 //!< the current step
20 : jhr 1342 DIDEROT_STABLE //!< a stable strand
21 : lamonts 1271 } StrandStatus_t;
22 :    
23 : jhr 1284 /* we need these union types to support subscripting vectors */
24 :     typedef union { float r[2]; float2 v; } union2f_t;
25 :     typedef union { float r[4]; float4 v; } union4f_t;
26 :     typedef union { float r[8]; float8 v; } union8f_t;
27 :     typedef union { float r[16]; float16 v; } union16f_t;
28 :    
29 :     typedef union { int i[2]; int2 v; } union2i_t;
30 :     typedef union { int i[4]; int4 v; } union4i_t;
31 :     typedef union { int i[8]; int8 v; } union8i_t;
32 :     typedef union { int i[16]; int16 v; } union16i_t;
33 :    
34 :     //typedef union { double r[2]; double2 v; } union2d_t;
35 :     //typedef union { double r[4]; double4 v; } union4d_t;
36 :     //typedef union { double r[8]; double8 v; } union8d_t;
37 :     //typedef union { double r[16]; double16 v; } union16d_t;
38 :    
39 :     typedef union { long r[2]; long2 v; } union2l_t;
40 :     typedef union { long r[4]; long4 v; } union4l_t;
41 :     typedef union { long r[8]; long8 v; } union8l_t;
42 :     typedef union { long r[16]; long16 v; } union16l_t;
43 :    
44 : jhr 1420 /* OpenCL version 1.00 does not support 3-element vectors, but later versions do.
45 :     * We use DIDEROT_CL_VERSION, instead of __OPENCL_VERSION__, because some OpenCL
46 :     * compilers are buggy in the way that they define the latter symbol.
47 :     */
48 :     #if (DIDEROT_CL_VERSION < 110)
49 : jhr 1319 // NOTE: Apple has float3 defined internally, which causes the OpenCL
50 :     // compiler to complain
51 :     #ifdef float3
52 :     # undef int3
53 :     # undef float3
54 :     #endif
55 : jhr 1272 typedef int4 int3;
56 :     typedef float4 float3;
57 : jhr 1284 typedef union4f_t union3f_t;
58 :     typedef union4i_t union3i_t;
59 : jhr 1273 #define VEC3(a, b, c) (float3)(a, b, c, 0)
60 :     #else
61 : jhr 1284 typedef union { float r[3]; float3 v; } union3f_t;
62 :     typedef union { int i[3]; int3 v; } union3i_t;
63 : jhr 1273 #define VEC3(a, b, c) (float3)(a, b, c)
64 : jhr 1272 #endif
65 : lamonts 1271
66 : jhr 1272 #if defined(DIDEROT_SINGLE_PRECISION)
67 :     typedef int Diderot_int_t;
68 :     typedef float Diderot_real_t;
69 :     typedef float2 Diderot_vec2_t;
70 :     typedef float3 Diderot_vec3_t;
71 :     typedef float4 Diderot_vec4_t;
72 :     #else
73 :     # error double precision not yet supported
74 :     #endif
75 : lamonts 1271
76 : jhr 1342 typedef Diderot_vec2_t Diderot_Mat2x2_t[2]; // represented as row vectors
77 :     typedef Diderot_vec3_t Diderot_Mat3x3_t[3]; // represented as row vectors
78 : jhr 1272 typedef Diderot_vec4_t Diderot_Mat4x4_t[4]; // represented as row vectors
79 : lamonts 1271
80 : jhr 1357 // GPU-side image types. Note that these should have the same organization as
81 :     // the Shadow_image[123]D_t types defined in shadow-types.h
82 : lamonts 1271
83 : lamonts 1398 typedef struct {
84 : jhr 1342 uint size[1];
85 :     Diderot_real_t s; // scaling from world-space to image-space
86 :     Diderot_real_t t; // translation from world-space to image-space
87 : lamonts 1271 } Diderot_image1D_t;
88 :    
89 : lamonts 1398 typedef struct {
90 : jhr 1342 uint size[2]; // sizes (fast to slow)
91 :     Diderot_Mat2x2_t w2i; // affine tranform from world space to index space. This is the
92 : jhr 1357 // inverse of the index to world-space transform that is loaded from
93 :     // the Nrrd file.
94 : jhr 1342 Diderot_vec2_t tVec; // translation part of world to index transform
95 :     Diderot_Mat2x2_t w2iT; // transpose w3i
96 : lamonts 1271 } Diderot_image2D_t;
97 :    
98 : lamonts 1398 typedef struct {
99 : jhr 1342 uint size[3]; // sizes (fast to slow)
100 :     Diderot_Mat3x3_t w2i; // affine tranform from world space to index space. This is the
101 : jhr 1357 // inverse of the index to world-space transform that is loaded from
102 :     // the Nrrd file.
103 : jhr 1342 Diderot_vec3_t tVec; // translation part of world to index transform
104 :     Diderot_Mat3x3_t w2iT; // transpose w3i
105 : lamonts 1271 } Diderot_image3D_t;
106 :    
107 : jhr 1272 #endif /* !_DIDEROT_CL_TYPES_H_ */
108 : jhr 1411

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0