| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| #if !defined(__CHANNEL_DESCRIPTOR_H__)
|
| #define __CHANNEL_DESCRIPTOR_H__
|
|
|
| #if defined(__cplusplus)
|
|
|
| |
| |
| |
| |
|
|
|
|
| #include "cuda_runtime_api.h"
|
|
|
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| template<class T> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
|
| {
|
| return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone);
|
| }
|
|
|
| static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf1(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf2(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf4(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char>(void)
|
| {
|
| int e = (int)sizeof(char) * 8;
|
|
|
| #if defined(_CHAR_UNSIGNED) || defined(__CHAR_UNSIGNED__)
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| #else
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| #endif
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<signed char>(void)
|
| {
|
| int e = (int)sizeof(signed char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned char>(void)
|
| {
|
| int e = (int)sizeof(unsigned char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char1>(void)
|
| {
|
| int e = (int)sizeof(signed char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar1>(void)
|
| {
|
| int e = (int)sizeof(unsigned char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char2>(void)
|
| {
|
| int e = (int)sizeof(signed char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar2>(void)
|
| {
|
| int e = (int)sizeof(unsigned char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char4>(void)
|
| {
|
| int e = (int)sizeof(signed char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar4>(void)
|
| {
|
| int e = (int)sizeof(unsigned char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short>(void)
|
| {
|
| int e = (int)sizeof(short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned short>(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short1>(void)
|
| {
|
| int e = (int)sizeof(short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort1>(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short2>(void)
|
| {
|
| int e = (int)sizeof(short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort2>(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short4>(void)
|
| {
|
| int e = (int)sizeof(short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort4>(void)
|
| {
|
| int e = (int)sizeof(unsigned short) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int>(void)
|
| {
|
| int e = (int)sizeof(int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned int>(void)
|
| {
|
| int e = (int)sizeof(unsigned int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int1>(void)
|
| {
|
| int e = (int)sizeof(int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint1>(void)
|
| {
|
| int e = (int)sizeof(unsigned int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int2>(void)
|
| {
|
| int e = (int)sizeof(int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint2>(void)
|
| {
|
| int e = (int)sizeof(unsigned int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int4>(void)
|
| {
|
| int e = (int)sizeof(int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint4>(void)
|
| {
|
| int e = (int)sizeof(unsigned int) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| #if !defined(__LP64__)
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long>(void)
|
| {
|
| int e = (int)sizeof(long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned long>(void)
|
| {
|
| int e = (int)sizeof(unsigned long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long1>(void)
|
| {
|
| int e = (int)sizeof(long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong1>(void)
|
| {
|
| int e = (int)sizeof(unsigned long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long2>(void)
|
| {
|
| int e = (int)sizeof(long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong2>(void)
|
| {
|
| int e = (int)sizeof(unsigned long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long4>(void)
|
| {
|
| int e = (int)sizeof(long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong4>(void)
|
| {
|
| int e = (int)sizeof(unsigned long) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| }
|
|
|
| #endif
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float>(void)
|
| {
|
| int e = (int)sizeof(float) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float1>(void)
|
| {
|
| int e = (int)sizeof(float) * 8;
|
|
|
| return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float2>(void)
|
| {
|
| int e = (int)sizeof(float) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float4>(void)
|
| {
|
| int e = (int)sizeof(float) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
|
| }
|
|
|
| static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescNV12(void)
|
| {
|
| int e = (int)sizeof(char) * 8;
|
|
|
| return cudaCreateChannelDesc(e, e, e, 0, cudaChannelFormatKindNV12);
|
| }
|
|
|
| template<cudaChannelFormatKind> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
|
| {
|
| return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X1>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedNormalized8X1);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X2>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedNormalized8X2);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X4>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindSignedNormalized8X4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X1>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized8X1);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X2>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedNormalized8X2);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X4>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedNormalized8X4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X1>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindSignedNormalized16X1);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X2>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindSignedNormalized16X2);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X4>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindSignedNormalized16X4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X1>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized16X1);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X2>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindUnsignedNormalized16X2);
|
| }
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X4>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindUnsignedNormalized16X4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindNV12>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 0, cudaChannelFormatKindNV12);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed1>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed1SRGB>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1SRGB);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed2>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed2SRGB>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2SRGB);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed3>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed3SRGB>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3SRGB);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed4>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed4>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedBlockCompressed4);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed5>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed5);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed5>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedBlockCompressed5);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed6H>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindUnsignedBlockCompressed6H);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed6H>(void)
|
| {
|
| return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindSignedBlockCompressed6H);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed7>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7);
|
| }
|
|
|
|
|
| template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed7SRGB>(void)
|
| {
|
| return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7SRGB);
|
| }
|
|
|
| #endif
|
|
|
|
|
|
|
|
|
| #endif
|
|
|