2 * Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
4 * Please refer to the NVIDIA end user license agreement (EULA) associated
5 * with this source code for terms and conditions that govern your use of
6 * this software. Any use, reproduction, disclosure, or distribution of
7 * this software and related documentation outside the terms of the EULA
8 * is strictly prohibited.
15 #include <cuda_runtime.h>
17 typedef unsigned char VolumeType;
25 cudaChannelFormatDesc channelDesc;
28 void Volume_init(Volume *vol, cudaExtent size, void *data, int allowStore);
29 void Volume_deinit(Volume *vol);
33 //////////////////////////////////////////////////////////////////////////
37 /* Helper class to do popular integer storage to float conversions if required */
39 template< typename T >
44 struct VolumeTypeInfo<unsigned char>
46 static const cudaTextureReadMode readMode = cudaReadModeNormalizedFloat;
47 static __inline__ __device__ unsigned char convert(float sampled)
49 return (unsigned char)(saturate(sampled) * 255.0);
54 struct VolumeTypeInfo<unsigned short>
56 static const cudaTextureReadMode readMode = cudaReadModeNormalizedFloat;
57 static __inline__ __device__ unsigned short convert(float sampled)
59 return (unsigned short)(saturate(sampled) * 65535.0);
64 struct VolumeTypeInfo<float>
66 static const cudaTextureReadMode readMode = cudaReadModeElementType;
67 static __inline__ __device__ float convert(float sampled)