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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3118 - (download) (as text) (annotate)
Mon Mar 23 18:05:45 2015 UTC (4 years, 1 month ago) by jhr
File size: 3927 byte(s)
  working on OpenCL issues
/*! \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_
 
#define BLK_SZ  DIDEROT_CU_WIDTH

typedef uchar StrandStatus_t;

#define DIDEROT_ACTIVE          0       //!< a currently running strand
#define DIDEROT_NEW             1       //!< a newly created, but not yet active, strand
#define DIDEROT_DYING           2       //!< a strand that will be dead at the end of the
                                        //!< current step
#define DIDEROT_DEAD            3       //!< a dead strand
#define DIDEROT_STABILIZE       4       //!< a strand that will be stable at the end of
                                        //!< the current step
#define DIDEROT_STABLE          5       //!< a stable strand
#define DIDEROT_IDLE            6       //!< signals an idle lane

/* OpenCL version 1.00 does not support 3-element vectors, but later versions do.
 * We use DIDEROT_CL_VERSION, instead of __OPENCL_VERSION__, because some OpenCL
 * compilers are buggy in the way that they define the latter symbol.
 */
#if (DIDEROT_CL_VERSION < 101)
// 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;
#define _V3(a, b, c)   (a, b, c, 0)
#define convert_int3    convert_int4
#define convert_float3  convert_float4
#else
#define _V3(a, b, c)   (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;
#define VEC2(a,b)               (float2)((a), (b))
#define VEC3(a,b,c)             (float3)_V3((a), (b), (c))
#define VEC4(a,b,c,d)           (float4)((a), (b), (c), (d))
#define VEC8(a,b,c,d,e,f,g,h)   (float8)((a), (b), (c), (d), (e), (f), (g), (h))
#define EPSILON                 1.0E-12
#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
    __global void	*data;
} 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
    __global void	*data;
} 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
    __global void	*data;
} Diderot_image3D_t;

#endif /* !_DIDEROT_CL_TYPES_H_ */
 

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