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 3349 - (view) (download) (as text)

1 : jhr 1272 /*! \file cl-types.h
2 : lamonts 1271 *
3 :     * \author Lamont Samuels
4 :     */
5 :    
6 :     /*
7 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     *
9 :     * COPYRIGHT (c) 2015 The University of Chicago
10 : lamonts 1271 * All rights reserved.
11 :     */
12 : jhr 1272
13 :     #ifndef _DIDEROT_CL_TYPES_H_
14 :     #define _DIDEROT_CL_TYPES_H_
15 : lamonts 1271
16 : lamonts 1488 #define BLK_SZ DIDEROT_CU_WIDTH
17 :    
18 : lamonts 1271 typedef enum {
19 : jhr 1342 DIDEROT_ACTIVE = 0, //!< a currently running strand
20 :     DIDEROT_NEW = 1, //!< a newly created, but not yet active, strand
21 :     DIDEROT_DIE, //!< a dead strand
22 :     DIDEROT_STABILIZE, //!< a strand that will be stable at the end of
23 : jhr 1272 //!< the current step
24 : jhr 1342 DIDEROT_STABLE //!< a stable strand
25 : lamonts 1271 } StrandStatus_t;
26 :    
27 : jhr 1420 /* OpenCL version 1.00 does not support 3-element vectors, but later versions do.
28 :     * We use DIDEROT_CL_VERSION, instead of __OPENCL_VERSION__, because some OpenCL
29 :     * compilers are buggy in the way that they define the latter symbol.
30 :     */
31 : lamonts 1642 #if (DIDEROT_CL_VERSION < 101)
32 : jhr 1319 // NOTE: Apple has float3 defined internally, which causes the OpenCL
33 :     // compiler to complain
34 :     #ifdef float3
35 :     # undef int3
36 :     # undef float3
37 :     #endif
38 : jhr 1272 typedef int4 int3;
39 :     typedef float4 float3;
40 : jhr 1659 #define _V3(a, b, c) (a, b, c, 0)
41 : jhr 1666 #define convert_int3 convert_int4
42 :     #define convert_float3 convert_float4
43 : jhr 1273 #else
44 : jhr 1659 #define _V3(a, b, c) (a, b, c)
45 : jhr 1272 #endif
46 : lamonts 1271
47 : jhr 1272 #if defined(DIDEROT_SINGLE_PRECISION)
48 :     typedef int Diderot_int_t;
49 :     typedef float Diderot_real_t;
50 :     typedef float2 Diderot_vec2_t;
51 :     typedef float3 Diderot_vec3_t;
52 :     typedef float4 Diderot_vec4_t;
53 : jhr 1659 #define VEC2(a,b) (float2)((a), (b))
54 :     #define VEC3(a,b,c) (float3)_V3((a), (b), (c))
55 :     #define VEC4(a,b,c,d) (float4)((a), (b), (c), (d))
56 :     #define VEC8(a,b,c,d,e,f,g,h) (float8)((a), (b), (c), (d), (e), (f), (g), (h))
57 :     #define EPSILON 1.0E-12
58 : jhr 1272 #else
59 :     # error double precision not yet supported
60 :     #endif
61 : lamonts 1271
62 : jhr 1342 typedef Diderot_vec2_t Diderot_Mat2x2_t[2]; // represented as row vectors
63 :     typedef Diderot_vec3_t Diderot_Mat3x3_t[3]; // represented as row vectors
64 : jhr 1272 typedef Diderot_vec4_t Diderot_Mat4x4_t[4]; // represented as row vectors
65 : lamonts 1271
66 : jhr 1357 // GPU-side image types. Note that these should have the same organization as
67 :     // the Shadow_image[123]D_t types defined in shadow-types.h
68 : lamonts 1271
69 : lamonts 1398 typedef struct {
70 : jhr 1342 uint size[1];
71 :     Diderot_real_t s; // scaling from world-space to image-space
72 :     Diderot_real_t t; // translation from world-space to image-space
73 : lamonts 1271 } Diderot_image1D_t;
74 :    
75 : lamonts 1398 typedef struct {
76 : jhr 1342 uint size[2]; // sizes (fast to slow)
77 :     Diderot_Mat2x2_t w2i; // affine tranform from world space to index space. This is the
78 : jhr 1357 // inverse of the index to world-space transform that is loaded from
79 :     // the Nrrd file.
80 : jhr 1342 Diderot_vec2_t tVec; // translation part of world to index transform
81 :     Diderot_Mat2x2_t w2iT; // transpose w3i
82 : lamonts 1271 } Diderot_image2D_t;
83 :    
84 : lamonts 1398 typedef struct {
85 : jhr 1342 uint size[3]; // sizes (fast to slow)
86 :     Diderot_Mat3x3_t w2i; // affine tranform from world space to index space. This is the
87 : jhr 1357 // inverse of the index to world-space transform that is loaded from
88 :     // the Nrrd file.
89 : jhr 1342 Diderot_vec3_t tVec; // translation part of world to index transform
90 :     Diderot_Mat3x3_t w2iT; // transpose w3i
91 : lamonts 1271 } Diderot_image3D_t;
92 :    
93 : jhr 1272 #endif /* !_DIDEROT_CL_TYPES_H_ */
94 : jhr 1411

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