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 1319 - (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 :     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 : lamonts 1271 DIDEROT_STABLE //!< a stable strand
21 :     } 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 1272 /* OpenCL version 1.00 does not support 3-element vectors */
45 :     #if __OPENCL_VERSION__ < 110
46 : jhr 1319 // NOTE: Apple has float3 defined internally, which causes the OpenCL
47 :     // compiler to complain
48 :     #ifdef float3
49 :     # undef int3
50 :     # undef float3
51 :     #endif
52 : jhr 1272 typedef int4 int3;
53 :     typedef float4 float3;
54 : jhr 1284 typedef union4f_t union3f_t;
55 :     typedef union4i_t union3i_t;
56 : jhr 1273 #define VEC3(a, b, c) (float3)(a, b, c, 0)
57 :     #else
58 : jhr 1284 typedef union { float r[3]; float3 v; } union3f_t;
59 :     typedef union { int i[3]; int3 v; } union3i_t;
60 : jhr 1273 #define VEC3(a, b, c) (float3)(a, b, c)
61 : jhr 1272 #endif
62 : lamonts 1271
63 : jhr 1272 #if defined(DIDEROT_SINGLE_PRECISION)
64 :     typedef int Diderot_int_t;
65 :     typedef float Diderot_real_t;
66 :     typedef float2 Diderot_vec2_t;
67 :     typedef float3 Diderot_vec3_t;
68 :     typedef float4 Diderot_vec4_t;
69 :     #else
70 :     # error double precision not yet supported
71 :     #endif
72 : lamonts 1271
73 : jhr 1272 typedef Diderot_vec2_t Diderot_Mat2x2_t[2]; // represented as row vectors
74 :     typedef Diderot_vec3_t Diderot_Mat3x3_t[3]; // represented as row vectors
75 :     typedef Diderot_vec4_t Diderot_Mat4x4_t[4]; // represented as row vectors
76 : lamonts 1271
77 :    
78 :     typedef struct { // wrapper for 1D image data
79 : jhr 1272 uint dim; // dimension (== 1)
80 :     uint size[1];
81 : lamonts 1271 void *data;
82 :     Diderot_real_t s; // scaling from world-space to image-space
83 :     Diderot_real_t t; // translation from world-space to image-space
84 :     } Diderot_image1D_t;
85 :    
86 :     typedef struct { // wrapper for 2D image data
87 : jhr 1272 uint dim; // dimension (== 2)
88 :     uint size[2]; // sizes (fast to slow)
89 : lamonts 1271 void *data;
90 :     Diderot_Mat2x2_t w2i; // affine tranform from world space to index space. This is the
91 :     // inverse of the index to world-space transform that is loaded from
92 :     // the Nrrd file.
93 :     Diderot_vec2_t tVec; // translation part of world to index transform
94 :     Diderot_Mat2x2_t w2iT; // transpose w3i
95 :     } Diderot_image2D_t;
96 :    
97 :     typedef struct { // wrapper for 3D image data
98 : jhr 1272 uint dim; // dimension (== 3)
99 :     uint size[3]; // sizes (fast to slow)
100 : lamonts 1271 void *data;
101 :     Diderot_Mat3x3_t w2i; // affine tranform from world space to index space. This is the
102 :     // inverse of the index to world-space transform that is loaded from
103 :     // the Nrrd file.
104 :     Diderot_vec3_t tVec; // translation part of world to index transform
105 :     Diderot_Mat3x3_t w2iT; // transpose w3i
106 :     } Diderot_image3D_t;
107 :    
108 : jhr 1272 #endif /* !_DIDEROT_CL_TYPES_H_ */
109 : lamonts 1271

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