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/shadow-types.h
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1354 - (download) (as text) (annotate)
Tue Jun 21 01:01:36 2011 UTC (8 years, 3 months ago) by jhr
File size: 3124 byte(s)
  Added shadow types for shadowing globals that are to be copied to the client.
/*! \file shadow-types.h
 *
 * \author John Reppy
 *
 * Type definitions for the shadow globals.
 */

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

#ifndef _SHADOW_TYPES_H_
#define _SHADOW_TYPES_H_

#if defined(CL_VERSION_1_1)
#  define HAS_VEC3_TYPE
#endif

#if defined(DIDEROT_SINGLE_PRECISION)
typedef cl_float Shadow_real_t;
typedef cl_float2 Shadow_vec2_t;
#ifdef HAS_VEC3_TYPE
typedef cl_float3 Shadow_vec3_t;
#else
typedef cl_float4 Shadow_vec3_t;
#endif
typedef cl_float4 Shadow_vec4_t;
#else
typedef cl_double Shadow_real_t;
typedef cl_double2 Shadow_vec2_t;
#ifdef HAS_VEC3_TYPE
typedef cl_double3 Shadow_vec3_t;
#else
typedef cl_double4 Shadow_vec3_t;
#endif
typedef cl_double4 Shadow_vec4_t;
#endif
typedef Shadow_vec2_t Shadow_Mat2x2_t[2];
typedef Shadow_vec3_t Shadow_Mat3x3_t[3];
typedef Shadow_vec4_t Shadow_Mat4x4_t[4];

//! shadow wrapper for 1D image data
typedef struct {
    cl_mem		data;           //!< GPU-side memory object for data.
    cl_int		size[1];
    Shadow_real_t	s;		//!< scaling from world-space to image-space
    Shadow_real_t	t;		//!< translation from world-space to image-space
} Shadow_image1D_t;

//! shadow wrapper for 2D image data
typedef struct {
    cl_mem		data;           //!< GPU-side memory object for data.
    cl_int		size[2];	//!< sizes (fast to slow)
    Shadow_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.
    Shadow_vec2_t	tVec;		//!< translation part of world to index transform
    Shadow_Mat2x2_t	w2iT;		//!< transpose w3i
} Shadow_image2D_t;

//! shadow wrapper for 3D image data
typedef struct {
    cl_mem		data;           //!< GPU-side memory object for data.
    cl_int		size[3];	//!< sizes (fast to slow)
    Shadow_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.
    Shadow_vec3_t	tVec;		//!< translation part of world to index transform
    Shadow_Mat3x3_t	w2iT;		//!< transpose w3i
} Shadow_image3D_t;

/*! \brief initialize a shadow for a 1D image
 *  \param cxt the OpenCL context used to allocate the shadow buffer
 *  \param dst the pointer to the shadow image
 *  \param src the source image to shadow
 */
void ShadowImage1D (cl_context cxt, Shadow_image1D_t *dst, Diderot_image1D_t *img);

/*! \brief initialize a shadow for a 2D image
 *  \param cxt the OpenCL context used to allocate the shadow buffer
 *  \param dst the pointer to the shadow image
 *  \param src the source image to shadow
 */
void ShadowImage2D (cl_context cxt, Shadow_image2D_t *dst, Diderot_image2D_t *img);

/*! \brief initialize a shadow for a 3D image
 *  \param cxt the OpenCL context used to allocate the shadow buffer
 *  \param dst the pointer to the shadow image
 *  \param src the source image to shadow
 */
void ShadowImage3D (cl_context cxt, Shadow_image3D_t *dst, Diderot_image3D_t *img);

#endif /* !_SHADOW_TYPES_H_ */

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