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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1398 - (download) (as text) (annotate)
Wed Jun 29 17:20:05 2011 UTC (8 years ago) by lamonts
File size: 4073 byte(s)
Removed embedded pointers on both the host and gpu side
/*! \file cl-types.h
 *
 * \author Lamont Samuels
 */

/*
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */

#ifndef _DIDEROT_CL_TYPES_H_
#define _DIDEROT_CL_TYPES_H_
 
typedef enum {
    DIDEROT_ACTIVE = 0,         //!< a currently running strand
    DIDEROT_NEW = 1,            //!< a newly created, but not yet active, strand
    DIDEROT_DIE,                //!< a dead strand
    DIDEROT_STABILIZE,          //!< a strand that will be stable at the end of
                                //!< the current step
    DIDEROT_STABLE              //!< a stable strand
} StrandStatus_t;

/* we need these union types to support subscripting vectors */
typedef union { float r[2]; float2 v; } union2f_t;
typedef union { float r[4]; float4 v; } union4f_t;
typedef union { float r[8]; float8 v; } union8f_t;
typedef union { float r[16]; float16 v; } union16f_t;

typedef union { int i[2]; int2 v; } union2i_t;
typedef union { int i[4]; int4 v; } union4i_t;
typedef union { int i[8]; int8 v; } union8i_t;
typedef union { int i[16]; int16 v; } union16i_t;

//typedef union { double r[2]; double2 v; } union2d_t;
//typedef union { double r[4]; double4 v; } union4d_t;
//typedef union { double r[8]; double8 v; } union8d_t;
//typedef union { double r[16]; double16 v; } union16d_t;

typedef union { long r[2]; long2 v; } union2l_t;
typedef union { long r[4]; long4 v; } union4l_t;
typedef union { long r[8]; long8 v; } union8l_t;
typedef union { long r[16]; long16 v; } union16l_t;

/* OpenCL version 1.00 does not support 3-element vectors */
#if __OPENCL_VERSION__ < 110
// NOTE: Apple has float3 defined internally, which causes the OpenCL
// compiler to complain
#ifdef float3
#  undef int3
#  undef float3
#endif
typedef int4 int3;
typedef float4 float3;
typedef union4f_t union3f_t;
typedef union4i_t union3i_t;
#define VEC3(a, b, c)   (float3)(a, b, c, 0)
#else
typedef union { float r[3]; float3 v; } union3f_t;
typedef union { int i[3]; int3 v; } union3i_t;
#define VEC3(a, b, c)   (float3)(a, b, c)
#endif

#if defined(DIDEROT_SINGLE_PRECISION)
typedef int Diderot_int_t;
typedef float Diderot_real_t;
typedef float2 Diderot_vec2_t;
typedef float3 Diderot_vec3_t;
typedef float4 Diderot_vec4_t;
#else
# error double precision not yet supported
#endif

typedef Diderot_vec2_t Diderot_Mat2x2_t[2];     // represented as row vectors
typedef Diderot_vec3_t Diderot_Mat3x3_t[3];     // represented as row vectors
typedef Diderot_vec4_t Diderot_Mat4x4_t[4];     // represented as row vectors

// GPU-side image types.  Note that these should have the same organization as
// the Shadow_image[123]D_t types defined in shadow-types.h

typedef struct {                       
    uint                size[1];
    Diderot_real_t      s;              // scaling from world-space to image-space
    Diderot_real_t      t;              // translation from world-space to image-space
} Diderot_image1D_t;

typedef struct {                     
    uint                size[2];        // sizes (fast to slow)
    Diderot_Mat2x2_t    w2i;            // affine tranform from world space to index space.  This is the
                                        // inverse of the index to world-space transform that is loaded from
                                        // the Nrrd file.
    Diderot_vec2_t      tVec;           // translation part of world to index transform
    Diderot_Mat2x2_t    w2iT;           // transpose w3i
} Diderot_image2D_t;

typedef struct {                     
    uint                size[3];        // sizes (fast to slow)
    Diderot_Mat3x3_t    w2i;            // affine tranform from world space to index space.  This is the
                                        // inverse of the index to world-space transform that is loaded from
                                        // the Nrrd file.
    Diderot_vec3_t      tVec;           // translation part of world to index transform
    Diderot_Mat3x3_t    w2iT;           // transpose w3i
} Diderot_image3D_t;

#endif /* !_DIDEROT_CL_TYPES_H_ */
 

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