fix: some file didn't have the svn:eol-style native yet
This commit is contained in:
@@ -1,265 +1,265 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library, Copyright (c) 2007 Erwin Coumans
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "LinearMath/btScalar.h"
|
||||
|
||||
#include "MiniCL/cl.h"
|
||||
|
||||
|
||||
#define __kernel
|
||||
#define __global
|
||||
#define __local
|
||||
#define get_global_id(a) __guid_arg
|
||||
#define get_local_id(a) ((__guid_arg) % gMiniCLNumOutstandingTasks)
|
||||
#define get_local_size(a) (gMiniCLNumOutstandingTasks)
|
||||
#define get_group_id(a) ((__guid_arg) / gMiniCLNumOutstandingTasks)
|
||||
|
||||
#define CLK_LOCAL_MEM_FENCE 0x01
|
||||
#define CLK_GLOBAL_MEM_FENCE 0x02
|
||||
|
||||
static void barrier(unsigned int a)
|
||||
{
|
||||
// TODO : implement
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) float8
|
||||
{
|
||||
float s0;
|
||||
float s1;
|
||||
float s2;
|
||||
float s3;
|
||||
float s4;
|
||||
float s5;
|
||||
float s6;
|
||||
float s7;
|
||||
|
||||
float8(float scalar)
|
||||
{
|
||||
s0=s1=s2=s3=s4=s5=s6=s7=scalar;
|
||||
}
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) float4
|
||||
{
|
||||
float x,y,z,w;
|
||||
float4() {}
|
||||
float4(float v)
|
||||
{
|
||||
x = y = z = w = v;
|
||||
}
|
||||
float4 operator*(const float4& other)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = x*other.x;
|
||||
tmp.y = y*other.y;
|
||||
tmp.z = z*other.z;
|
||||
tmp.w = w*other.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
float4 operator*(const float& other)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = x*other;
|
||||
tmp.y = y*other;
|
||||
tmp.z = z*other;
|
||||
tmp.w = w*other;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float4& operator+=(const float4& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
z += other.z;
|
||||
w += other.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float4& operator-=(const float4& other)
|
||||
{
|
||||
x -= other.x;
|
||||
y -= other.y;
|
||||
z -= other.z;
|
||||
w -= other.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float4& operator *=(float scalar)
|
||||
{
|
||||
x *= scalar;
|
||||
y *= scalar;
|
||||
z *= scalar;
|
||||
w *= scalar;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
static float4 fabs(const float4& a)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x < 0.f ? 0.f : a.x;
|
||||
tmp.y = a.y < 0.f ? 0.f : a.y;
|
||||
tmp.z = a.z < 0.f ? 0.f : a.z;
|
||||
tmp.w = a.w < 0.f ? 0.f : a.w;
|
||||
return tmp;
|
||||
}
|
||||
static float4 operator+(const float4& a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x + b.x;
|
||||
tmp.y = a.y + b.y;
|
||||
tmp.z = a.z + b.z;
|
||||
tmp.w = a.w + b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static float4 operator-(const float4& a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x - b.x;
|
||||
tmp.y = a.y - b.y;
|
||||
tmp.z = a.z - b.z;
|
||||
tmp.w = a.w - b.w;
|
||||
return tmp;
|
||||
}
|
||||
static float4 operator*(float a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a * b.x;
|
||||
tmp.y = a * b.y;
|
||||
tmp.z = a * b.z;
|
||||
tmp.w = a * b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
static float dot(const float4&a ,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x*b.x;
|
||||
tmp.y = a.y*b.y;
|
||||
tmp.z = a.z*b.z;
|
||||
tmp.w = a.w*b.w;
|
||||
return tmp.x+tmp.y+tmp.z+tmp.w;
|
||||
}
|
||||
|
||||
static float4 cross(const float4&a ,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.y*b.z - a.z*b.y;
|
||||
tmp.y = -a.x*b.z + a.z*b.x;
|
||||
tmp.z = a.x*b.y - a.y*b.x;
|
||||
tmp.w = 0.f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static float max(float a, float b)
|
||||
{
|
||||
return (a >= b) ? a : b;
|
||||
}
|
||||
|
||||
|
||||
static float min(float a, float b)
|
||||
{
|
||||
return (a <= b) ? a : b;
|
||||
}
|
||||
|
||||
static float fmax(float a, float b)
|
||||
{
|
||||
return (a >= b) ? a : b;
|
||||
}
|
||||
|
||||
static float fmin(float a, float b)
|
||||
{
|
||||
return (a <= b) ? a : b;
|
||||
}
|
||||
|
||||
struct int2
|
||||
{
|
||||
int x,y;
|
||||
};
|
||||
|
||||
struct uint2
|
||||
{
|
||||
unsigned int x,y;
|
||||
};
|
||||
|
||||
//typedef int2 uint2;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
struct int4
|
||||
{
|
||||
int x,y,z,w;
|
||||
};
|
||||
|
||||
struct uint4
|
||||
{
|
||||
unsigned int x,y,z,w;
|
||||
uint4() {}
|
||||
uint4(uint val) { x = y = z = w = val; }
|
||||
uint4& operator+=(const uint4& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
z += other.z;
|
||||
w += other.w;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
static uint4 operator+(const uint4& a,const uint4& b)
|
||||
{
|
||||
uint4 tmp;
|
||||
tmp.x = a.x + b.x;
|
||||
tmp.y = a.y + b.y;
|
||||
tmp.z = a.z + b.z;
|
||||
tmp.w = a.w + b.w;
|
||||
return tmp;
|
||||
}
|
||||
static uint4 operator-(const uint4& a,const uint4& b)
|
||||
{
|
||||
uint4 tmp;
|
||||
tmp.x = a.x - b.x;
|
||||
tmp.y = a.y - b.y;
|
||||
tmp.z = a.z - b.z;
|
||||
tmp.w = a.w - b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#define native_sqrt sqrtf
|
||||
#define native_sin sinf
|
||||
#define native_cos cosf
|
||||
#define native_powr powf
|
||||
|
||||
#define GUID_ARG ,int __guid_arg
|
||||
#define GUID_ARG_VAL ,__guid_arg
|
||||
|
||||
|
||||
#define as_int(a) (*((int*)&(a)))
|
||||
|
||||
extern "C" int gMiniCLNumOutstandingTasks;
|
||||
// extern "C" void __kernel_func();
|
||||
|
||||
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library, Copyright (c) 2007 Erwin Coumans
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include "LinearMath/btScalar.h"
|
||||
|
||||
#include "MiniCL/cl.h"
|
||||
|
||||
|
||||
#define __kernel
|
||||
#define __global
|
||||
#define __local
|
||||
#define get_global_id(a) __guid_arg
|
||||
#define get_local_id(a) ((__guid_arg) % gMiniCLNumOutstandingTasks)
|
||||
#define get_local_size(a) (gMiniCLNumOutstandingTasks)
|
||||
#define get_group_id(a) ((__guid_arg) / gMiniCLNumOutstandingTasks)
|
||||
|
||||
#define CLK_LOCAL_MEM_FENCE 0x01
|
||||
#define CLK_GLOBAL_MEM_FENCE 0x02
|
||||
|
||||
static void barrier(unsigned int a)
|
||||
{
|
||||
// TODO : implement
|
||||
}
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) float8
|
||||
{
|
||||
float s0;
|
||||
float s1;
|
||||
float s2;
|
||||
float s3;
|
||||
float s4;
|
||||
float s5;
|
||||
float s6;
|
||||
float s7;
|
||||
|
||||
float8(float scalar)
|
||||
{
|
||||
s0=s1=s2=s3=s4=s5=s6=s7=scalar;
|
||||
}
|
||||
};
|
||||
|
||||
ATTRIBUTE_ALIGNED16(struct) float4
|
||||
{
|
||||
float x,y,z,w;
|
||||
float4() {}
|
||||
float4(float v)
|
||||
{
|
||||
x = y = z = w = v;
|
||||
}
|
||||
float4 operator*(const float4& other)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = x*other.x;
|
||||
tmp.y = y*other.y;
|
||||
tmp.z = z*other.z;
|
||||
tmp.w = w*other.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
float4 operator*(const float& other)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = x*other;
|
||||
tmp.y = y*other;
|
||||
tmp.z = z*other;
|
||||
tmp.w = w*other;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float4& operator+=(const float4& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
z += other.z;
|
||||
w += other.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float4& operator-=(const float4& other)
|
||||
{
|
||||
x -= other.x;
|
||||
y -= other.y;
|
||||
z -= other.z;
|
||||
w -= other.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float4& operator *=(float scalar)
|
||||
{
|
||||
x *= scalar;
|
||||
y *= scalar;
|
||||
z *= scalar;
|
||||
w *= scalar;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
static float4 fabs(const float4& a)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x < 0.f ? 0.f : a.x;
|
||||
tmp.y = a.y < 0.f ? 0.f : a.y;
|
||||
tmp.z = a.z < 0.f ? 0.f : a.z;
|
||||
tmp.w = a.w < 0.f ? 0.f : a.w;
|
||||
return tmp;
|
||||
}
|
||||
static float4 operator+(const float4& a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x + b.x;
|
||||
tmp.y = a.y + b.y;
|
||||
tmp.z = a.z + b.z;
|
||||
tmp.w = a.w + b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static float4 operator-(const float4& a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x - b.x;
|
||||
tmp.y = a.y - b.y;
|
||||
tmp.z = a.z - b.z;
|
||||
tmp.w = a.w - b.w;
|
||||
return tmp;
|
||||
}
|
||||
static float4 operator*(float a,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a * b.x;
|
||||
tmp.y = a * b.y;
|
||||
tmp.z = a * b.z;
|
||||
tmp.w = a * b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
static float dot(const float4&a ,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.x*b.x;
|
||||
tmp.y = a.y*b.y;
|
||||
tmp.z = a.z*b.z;
|
||||
tmp.w = a.w*b.w;
|
||||
return tmp.x+tmp.y+tmp.z+tmp.w;
|
||||
}
|
||||
|
||||
static float4 cross(const float4&a ,const float4& b)
|
||||
{
|
||||
float4 tmp;
|
||||
tmp.x = a.y*b.z - a.z*b.y;
|
||||
tmp.y = -a.x*b.z + a.z*b.x;
|
||||
tmp.z = a.x*b.y - a.y*b.x;
|
||||
tmp.w = 0.f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static float max(float a, float b)
|
||||
{
|
||||
return (a >= b) ? a : b;
|
||||
}
|
||||
|
||||
|
||||
static float min(float a, float b)
|
||||
{
|
||||
return (a <= b) ? a : b;
|
||||
}
|
||||
|
||||
static float fmax(float a, float b)
|
||||
{
|
||||
return (a >= b) ? a : b;
|
||||
}
|
||||
|
||||
static float fmin(float a, float b)
|
||||
{
|
||||
return (a <= b) ? a : b;
|
||||
}
|
||||
|
||||
struct int2
|
||||
{
|
||||
int x,y;
|
||||
};
|
||||
|
||||
struct uint2
|
||||
{
|
||||
unsigned int x,y;
|
||||
};
|
||||
|
||||
//typedef int2 uint2;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
struct int4
|
||||
{
|
||||
int x,y,z,w;
|
||||
};
|
||||
|
||||
struct uint4
|
||||
{
|
||||
unsigned int x,y,z,w;
|
||||
uint4() {}
|
||||
uint4(uint val) { x = y = z = w = val; }
|
||||
uint4& operator+=(const uint4& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
z += other.z;
|
||||
w += other.w;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
static uint4 operator+(const uint4& a,const uint4& b)
|
||||
{
|
||||
uint4 tmp;
|
||||
tmp.x = a.x + b.x;
|
||||
tmp.y = a.y + b.y;
|
||||
tmp.z = a.z + b.z;
|
||||
tmp.w = a.w + b.w;
|
||||
return tmp;
|
||||
}
|
||||
static uint4 operator-(const uint4& a,const uint4& b)
|
||||
{
|
||||
uint4 tmp;
|
||||
tmp.x = a.x - b.x;
|
||||
tmp.y = a.y - b.y;
|
||||
tmp.z = a.z - b.z;
|
||||
tmp.w = a.w - b.w;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#define native_sqrt sqrtf
|
||||
#define native_sin sinf
|
||||
#define native_cos cosf
|
||||
#define native_powr powf
|
||||
|
||||
#define GUID_ARG ,int __guid_arg
|
||||
#define GUID_ARG_VAL ,__guid_arg
|
||||
|
||||
|
||||
#define as_int(a) (*((int*)&(a)))
|
||||
|
||||
extern "C" int gMiniCLNumOutstandingTasks;
|
||||
// extern "C" void __kernel_func();
|
||||
|
||||
|
||||
|
||||
@@ -1,254 +1,254 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __CL_PLATFORM_H
|
||||
#define __CL_PLATFORM_H
|
||||
|
||||
#define CL_PLATFORM_MINI_CL 0x12345
|
||||
|
||||
struct MiniCLKernelDesc
|
||||
{
|
||||
MiniCLKernelDesc(void* pCode, char* pName);
|
||||
};
|
||||
|
||||
#define MINICL_REGISTER(__kernel_func) static MiniCLKernelDesc __kernel_func##Desc((void*)__kernel_func, #__kernel_func);
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CL_API_ENTRY
|
||||
#define CL_API_CALL
|
||||
#ifdef __APPLE__
|
||||
#define CL_API_SUFFIX__VERSION_1_0 // AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
|
||||
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
|
||||
#else
|
||||
#define CL_API_SUFFIX__VERSION_1_0
|
||||
#define CL_EXTENSION_WEAK_LINK
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32) && ! defined (__MINGW32__)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
typedef int8_t cl_char;
|
||||
typedef uint8_t cl_uchar;
|
||||
typedef int16_t cl_short ;
|
||||
typedef uint16_t cl_ushort ;
|
||||
typedef int32_t cl_int ;
|
||||
typedef uint32_t cl_uint ;
|
||||
typedef int64_t cl_long ;
|
||||
typedef uint64_t cl_ulong ;
|
||||
|
||||
typedef uint16_t cl_half ;
|
||||
typedef float cl_float ;
|
||||
typedef double cl_double ;
|
||||
|
||||
|
||||
typedef int8_t cl_char2[2] ;
|
||||
typedef int8_t cl_char4[4] ;
|
||||
typedef int8_t cl_char8[8] ;
|
||||
typedef int8_t cl_char16[16] ;
|
||||
typedef uint8_t cl_uchar2[2] ;
|
||||
typedef uint8_t cl_uchar4[4] ;
|
||||
typedef uint8_t cl_uchar8[8] ;
|
||||
typedef uint8_t cl_uchar16[16] ;
|
||||
|
||||
typedef int16_t cl_short2[2] ;
|
||||
typedef int16_t cl_short4[4] ;
|
||||
typedef int16_t cl_short8[8] ;
|
||||
typedef int16_t cl_short16[16] ;
|
||||
typedef uint16_t cl_ushort2[2] ;
|
||||
typedef uint16_t cl_ushort4[4] ;
|
||||
typedef uint16_t cl_ushort8[8] ;
|
||||
typedef uint16_t cl_ushort16[16] ;
|
||||
|
||||
typedef int32_t cl_int2[2] ;
|
||||
typedef int32_t cl_int4[4] ;
|
||||
typedef int32_t cl_int8[8] ;
|
||||
typedef int32_t cl_int16[16] ;
|
||||
typedef uint32_t cl_uint2[2] ;
|
||||
typedef uint32_t cl_uint4[4] ;
|
||||
typedef uint32_t cl_uint8[8] ;
|
||||
typedef uint32_t cl_uint16[16] ;
|
||||
|
||||
typedef int64_t cl_long2[2] ;
|
||||
typedef int64_t cl_long4[4] ;
|
||||
typedef int64_t cl_long8[8] ;
|
||||
typedef int64_t cl_long16[16] ;
|
||||
typedef uint64_t cl_ulong2[2] ;
|
||||
typedef uint64_t cl_ulong4[4] ;
|
||||
typedef uint64_t cl_ulong8[8] ;
|
||||
typedef uint64_t cl_ulong16[16] ;
|
||||
|
||||
typedef float cl_float2[2] ;
|
||||
typedef float cl_float4[4] ;
|
||||
typedef float cl_float8[8] ;
|
||||
typedef float cl_float16[16] ;
|
||||
|
||||
typedef double cl_double2[2] ;
|
||||
typedef double cl_double4[4] ;
|
||||
typedef double cl_double8[8] ;
|
||||
typedef double cl_double16[16] ;
|
||||
|
||||
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
/* scalar types */
|
||||
typedef int8_t cl_char;
|
||||
typedef uint8_t cl_uchar;
|
||||
typedef int16_t cl_short __attribute__((aligned(2)));
|
||||
typedef uint16_t cl_ushort __attribute__((aligned(2)));
|
||||
typedef int32_t cl_int __attribute__((aligned(4)));
|
||||
typedef uint32_t cl_uint __attribute__((aligned(4)));
|
||||
typedef int64_t cl_long __attribute__((aligned(8)));
|
||||
typedef uint64_t cl_ulong __attribute__((aligned(8)));
|
||||
|
||||
typedef uint16_t cl_half __attribute__((aligned(2)));
|
||||
typedef float cl_float __attribute__((aligned(4)));
|
||||
typedef double cl_double __attribute__((aligned(8)));
|
||||
|
||||
|
||||
/*
|
||||
* Vector types
|
||||
*
|
||||
* Note: OpenCL requires that all types be naturally aligned.
|
||||
* This means that vector types must be naturally aligned.
|
||||
* For example, a vector of four floats must be aligned to
|
||||
* a 16 byte boundary (calculated as 4 * the natural 4-byte
|
||||
* alignment of the float). The alignment qualifiers here
|
||||
* will only function properly if your compiler supports them
|
||||
* and if you don't actively work to defeat them. For example,
|
||||
* in order for a cl_float4 to be 16 byte aligned in a struct,
|
||||
* the start of the struct must itself be 16-byte aligned.
|
||||
*
|
||||
* Maintaining proper alignment is the user's responsibility.
|
||||
*/
|
||||
typedef int8_t cl_char2[2] __attribute__((aligned(2)));
|
||||
typedef int8_t cl_char4[4] __attribute__((aligned(4)));
|
||||
typedef int8_t cl_char8[8] __attribute__((aligned(8)));
|
||||
typedef int8_t cl_char16[16] __attribute__((aligned(16)));
|
||||
typedef uint8_t cl_uchar2[2] __attribute__((aligned(2)));
|
||||
typedef uint8_t cl_uchar4[4] __attribute__((aligned(4)));
|
||||
typedef uint8_t cl_uchar8[8] __attribute__((aligned(8)));
|
||||
typedef uint8_t cl_uchar16[16] __attribute__((aligned(16)));
|
||||
|
||||
typedef int16_t cl_short2[2] __attribute__((aligned(4)));
|
||||
typedef int16_t cl_short4[4] __attribute__((aligned(8)));
|
||||
typedef int16_t cl_short8[8] __attribute__((aligned(16)));
|
||||
typedef int16_t cl_short16[16] __attribute__((aligned(32)));
|
||||
typedef uint16_t cl_ushort2[2] __attribute__((aligned(4)));
|
||||
typedef uint16_t cl_ushort4[4] __attribute__((aligned(8)));
|
||||
typedef uint16_t cl_ushort8[8] __attribute__((aligned(16)));
|
||||
typedef uint16_t cl_ushort16[16] __attribute__((aligned(32)));
|
||||
|
||||
typedef int32_t cl_int2[2] __attribute__((aligned(8)));
|
||||
typedef int32_t cl_int4[4] __attribute__((aligned(16)));
|
||||
typedef int32_t cl_int8[8] __attribute__((aligned(32)));
|
||||
typedef int32_t cl_int16[16] __attribute__((aligned(64)));
|
||||
typedef uint32_t cl_uint2[2] __attribute__((aligned(8)));
|
||||
typedef uint32_t cl_uint4[4] __attribute__((aligned(16)));
|
||||
typedef uint32_t cl_uint8[8] __attribute__((aligned(32)));
|
||||
typedef uint32_t cl_uint16[16] __attribute__((aligned(64)));
|
||||
|
||||
typedef int64_t cl_long2[2] __attribute__((aligned(16)));
|
||||
typedef int64_t cl_long4[4] __attribute__((aligned(32)));
|
||||
typedef int64_t cl_long8[8] __attribute__((aligned(64)));
|
||||
typedef int64_t cl_long16[16] __attribute__((aligned(128)));
|
||||
typedef uint64_t cl_ulong2[2] __attribute__((aligned(16)));
|
||||
typedef uint64_t cl_ulong4[4] __attribute__((aligned(32)));
|
||||
typedef uint64_t cl_ulong8[8] __attribute__((aligned(64)));
|
||||
typedef uint64_t cl_ulong16[16] __attribute__((aligned(128)));
|
||||
|
||||
typedef float cl_float2[2] __attribute__((aligned(8)));
|
||||
typedef float cl_float4[4] __attribute__((aligned(16)));
|
||||
typedef float cl_float8[8] __attribute__((aligned(32)));
|
||||
typedef float cl_float16[16] __attribute__((aligned(64)));
|
||||
|
||||
typedef double cl_double2[2] __attribute__((aligned(16)));
|
||||
typedef double cl_double4[4] __attribute__((aligned(32)));
|
||||
typedef double cl_double8[8] __attribute__((aligned(64)));
|
||||
typedef double cl_double16[16] __attribute__((aligned(128)));
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* and a few goodies to go with them */
|
||||
#define CL_CHAR_BIT 8
|
||||
#define CL_SCHAR_MAX 127
|
||||
#define CL_SCHAR_MIN (-127-1)
|
||||
#define CL_CHAR_MAX CL_SCHAR_MAX
|
||||
#define CL_CHAR_MIN CL_SCHAR_MIN
|
||||
#define CL_UCHAR_MAX 255
|
||||
#define CL_SHRT_MAX 32767
|
||||
#define CL_SHRT_MIN (-32767-1)
|
||||
#define CL_USHRT_MAX 65535
|
||||
#define CL_INT_MAX 2147483647
|
||||
#define CL_INT_MIN (-2147483647-1)
|
||||
#define CL_UINT_MAX 0xffffffffU
|
||||
#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
|
||||
#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
|
||||
#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
#define CL_FLT_DIG 6
|
||||
#define CL_FLT_MANT_DIG 24
|
||||
#define CL_FLT_MAX_10_EXP +38
|
||||
#define CL_FLT_MAX_EXP +128
|
||||
#define CL_FLT_MIN_10_EXP -37
|
||||
#define CL_FLT_MIN_EXP -125
|
||||
#define CL_FLT_RADIX 2
|
||||
#define CL_FLT_MAX 0x1.fffffep127f
|
||||
#define CL_FLT_MIN 0x1.0p-126f
|
||||
#define CL_FLT_EPSILON 0x1.0p-23f
|
||||
|
||||
#define CL_DBL_DIG 15
|
||||
#define CL_DBL_MANT_DIG 53
|
||||
#define CL_DBL_MAX_10_EXP +308
|
||||
#define CL_DBL_MAX_EXP +1024
|
||||
#define CL_DBL_MIN_10_EXP -307
|
||||
#define CL_DBL_MIN_EXP -1021
|
||||
#define CL_DBL_RADIX 2
|
||||
#define CL_DBL_MAX 0x1.fffffffffffffp1023
|
||||
#define CL_DBL_MIN 0x1.0p-1022
|
||||
#define CL_DBL_EPSILON 0x1.0p-52
|
||||
|
||||
/* There are no vector types for half */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __CL_PLATFORM_H
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __CL_PLATFORM_H
|
||||
#define __CL_PLATFORM_H
|
||||
|
||||
#define CL_PLATFORM_MINI_CL 0x12345
|
||||
|
||||
struct MiniCLKernelDesc
|
||||
{
|
||||
MiniCLKernelDesc(void* pCode, char* pName);
|
||||
};
|
||||
|
||||
#define MINICL_REGISTER(__kernel_func) static MiniCLKernelDesc __kernel_func##Desc((void*)__kernel_func, #__kernel_func);
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CL_API_ENTRY
|
||||
#define CL_API_CALL
|
||||
#ifdef __APPLE__
|
||||
#define CL_API_SUFFIX__VERSION_1_0 // AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
|
||||
#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
|
||||
#else
|
||||
#define CL_API_SUFFIX__VERSION_1_0
|
||||
#define CL_EXTENSION_WEAK_LINK
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32) && ! defined (__MINGW32__)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
typedef int8_t cl_char;
|
||||
typedef uint8_t cl_uchar;
|
||||
typedef int16_t cl_short ;
|
||||
typedef uint16_t cl_ushort ;
|
||||
typedef int32_t cl_int ;
|
||||
typedef uint32_t cl_uint ;
|
||||
typedef int64_t cl_long ;
|
||||
typedef uint64_t cl_ulong ;
|
||||
|
||||
typedef uint16_t cl_half ;
|
||||
typedef float cl_float ;
|
||||
typedef double cl_double ;
|
||||
|
||||
|
||||
typedef int8_t cl_char2[2] ;
|
||||
typedef int8_t cl_char4[4] ;
|
||||
typedef int8_t cl_char8[8] ;
|
||||
typedef int8_t cl_char16[16] ;
|
||||
typedef uint8_t cl_uchar2[2] ;
|
||||
typedef uint8_t cl_uchar4[4] ;
|
||||
typedef uint8_t cl_uchar8[8] ;
|
||||
typedef uint8_t cl_uchar16[16] ;
|
||||
|
||||
typedef int16_t cl_short2[2] ;
|
||||
typedef int16_t cl_short4[4] ;
|
||||
typedef int16_t cl_short8[8] ;
|
||||
typedef int16_t cl_short16[16] ;
|
||||
typedef uint16_t cl_ushort2[2] ;
|
||||
typedef uint16_t cl_ushort4[4] ;
|
||||
typedef uint16_t cl_ushort8[8] ;
|
||||
typedef uint16_t cl_ushort16[16] ;
|
||||
|
||||
typedef int32_t cl_int2[2] ;
|
||||
typedef int32_t cl_int4[4] ;
|
||||
typedef int32_t cl_int8[8] ;
|
||||
typedef int32_t cl_int16[16] ;
|
||||
typedef uint32_t cl_uint2[2] ;
|
||||
typedef uint32_t cl_uint4[4] ;
|
||||
typedef uint32_t cl_uint8[8] ;
|
||||
typedef uint32_t cl_uint16[16] ;
|
||||
|
||||
typedef int64_t cl_long2[2] ;
|
||||
typedef int64_t cl_long4[4] ;
|
||||
typedef int64_t cl_long8[8] ;
|
||||
typedef int64_t cl_long16[16] ;
|
||||
typedef uint64_t cl_ulong2[2] ;
|
||||
typedef uint64_t cl_ulong4[4] ;
|
||||
typedef uint64_t cl_ulong8[8] ;
|
||||
typedef uint64_t cl_ulong16[16] ;
|
||||
|
||||
typedef float cl_float2[2] ;
|
||||
typedef float cl_float4[4] ;
|
||||
typedef float cl_float8[8] ;
|
||||
typedef float cl_float16[16] ;
|
||||
|
||||
typedef double cl_double2[2] ;
|
||||
typedef double cl_double4[4] ;
|
||||
typedef double cl_double8[8] ;
|
||||
typedef double cl_double16[16] ;
|
||||
|
||||
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
/* scalar types */
|
||||
typedef int8_t cl_char;
|
||||
typedef uint8_t cl_uchar;
|
||||
typedef int16_t cl_short __attribute__((aligned(2)));
|
||||
typedef uint16_t cl_ushort __attribute__((aligned(2)));
|
||||
typedef int32_t cl_int __attribute__((aligned(4)));
|
||||
typedef uint32_t cl_uint __attribute__((aligned(4)));
|
||||
typedef int64_t cl_long __attribute__((aligned(8)));
|
||||
typedef uint64_t cl_ulong __attribute__((aligned(8)));
|
||||
|
||||
typedef uint16_t cl_half __attribute__((aligned(2)));
|
||||
typedef float cl_float __attribute__((aligned(4)));
|
||||
typedef double cl_double __attribute__((aligned(8)));
|
||||
|
||||
|
||||
/*
|
||||
* Vector types
|
||||
*
|
||||
* Note: OpenCL requires that all types be naturally aligned.
|
||||
* This means that vector types must be naturally aligned.
|
||||
* For example, a vector of four floats must be aligned to
|
||||
* a 16 byte boundary (calculated as 4 * the natural 4-byte
|
||||
* alignment of the float). The alignment qualifiers here
|
||||
* will only function properly if your compiler supports them
|
||||
* and if you don't actively work to defeat them. For example,
|
||||
* in order for a cl_float4 to be 16 byte aligned in a struct,
|
||||
* the start of the struct must itself be 16-byte aligned.
|
||||
*
|
||||
* Maintaining proper alignment is the user's responsibility.
|
||||
*/
|
||||
typedef int8_t cl_char2[2] __attribute__((aligned(2)));
|
||||
typedef int8_t cl_char4[4] __attribute__((aligned(4)));
|
||||
typedef int8_t cl_char8[8] __attribute__((aligned(8)));
|
||||
typedef int8_t cl_char16[16] __attribute__((aligned(16)));
|
||||
typedef uint8_t cl_uchar2[2] __attribute__((aligned(2)));
|
||||
typedef uint8_t cl_uchar4[4] __attribute__((aligned(4)));
|
||||
typedef uint8_t cl_uchar8[8] __attribute__((aligned(8)));
|
||||
typedef uint8_t cl_uchar16[16] __attribute__((aligned(16)));
|
||||
|
||||
typedef int16_t cl_short2[2] __attribute__((aligned(4)));
|
||||
typedef int16_t cl_short4[4] __attribute__((aligned(8)));
|
||||
typedef int16_t cl_short8[8] __attribute__((aligned(16)));
|
||||
typedef int16_t cl_short16[16] __attribute__((aligned(32)));
|
||||
typedef uint16_t cl_ushort2[2] __attribute__((aligned(4)));
|
||||
typedef uint16_t cl_ushort4[4] __attribute__((aligned(8)));
|
||||
typedef uint16_t cl_ushort8[8] __attribute__((aligned(16)));
|
||||
typedef uint16_t cl_ushort16[16] __attribute__((aligned(32)));
|
||||
|
||||
typedef int32_t cl_int2[2] __attribute__((aligned(8)));
|
||||
typedef int32_t cl_int4[4] __attribute__((aligned(16)));
|
||||
typedef int32_t cl_int8[8] __attribute__((aligned(32)));
|
||||
typedef int32_t cl_int16[16] __attribute__((aligned(64)));
|
||||
typedef uint32_t cl_uint2[2] __attribute__((aligned(8)));
|
||||
typedef uint32_t cl_uint4[4] __attribute__((aligned(16)));
|
||||
typedef uint32_t cl_uint8[8] __attribute__((aligned(32)));
|
||||
typedef uint32_t cl_uint16[16] __attribute__((aligned(64)));
|
||||
|
||||
typedef int64_t cl_long2[2] __attribute__((aligned(16)));
|
||||
typedef int64_t cl_long4[4] __attribute__((aligned(32)));
|
||||
typedef int64_t cl_long8[8] __attribute__((aligned(64)));
|
||||
typedef int64_t cl_long16[16] __attribute__((aligned(128)));
|
||||
typedef uint64_t cl_ulong2[2] __attribute__((aligned(16)));
|
||||
typedef uint64_t cl_ulong4[4] __attribute__((aligned(32)));
|
||||
typedef uint64_t cl_ulong8[8] __attribute__((aligned(64)));
|
||||
typedef uint64_t cl_ulong16[16] __attribute__((aligned(128)));
|
||||
|
||||
typedef float cl_float2[2] __attribute__((aligned(8)));
|
||||
typedef float cl_float4[4] __attribute__((aligned(16)));
|
||||
typedef float cl_float8[8] __attribute__((aligned(32)));
|
||||
typedef float cl_float16[16] __attribute__((aligned(64)));
|
||||
|
||||
typedef double cl_double2[2] __attribute__((aligned(16)));
|
||||
typedef double cl_double4[4] __attribute__((aligned(32)));
|
||||
typedef double cl_double8[8] __attribute__((aligned(64)));
|
||||
typedef double cl_double16[16] __attribute__((aligned(128)));
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* and a few goodies to go with them */
|
||||
#define CL_CHAR_BIT 8
|
||||
#define CL_SCHAR_MAX 127
|
||||
#define CL_SCHAR_MIN (-127-1)
|
||||
#define CL_CHAR_MAX CL_SCHAR_MAX
|
||||
#define CL_CHAR_MIN CL_SCHAR_MIN
|
||||
#define CL_UCHAR_MAX 255
|
||||
#define CL_SHRT_MAX 32767
|
||||
#define CL_SHRT_MIN (-32767-1)
|
||||
#define CL_USHRT_MAX 65535
|
||||
#define CL_INT_MAX 2147483647
|
||||
#define CL_INT_MIN (-2147483647-1)
|
||||
#define CL_UINT_MAX 0xffffffffU
|
||||
#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
|
||||
#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
|
||||
#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
#define CL_FLT_DIG 6
|
||||
#define CL_FLT_MANT_DIG 24
|
||||
#define CL_FLT_MAX_10_EXP +38
|
||||
#define CL_FLT_MAX_EXP +128
|
||||
#define CL_FLT_MIN_10_EXP -37
|
||||
#define CL_FLT_MIN_EXP -125
|
||||
#define CL_FLT_RADIX 2
|
||||
#define CL_FLT_MAX 0x1.fffffep127f
|
||||
#define CL_FLT_MIN 0x1.0p-126f
|
||||
#define CL_FLT_EPSILON 0x1.0p-23f
|
||||
|
||||
#define CL_DBL_DIG 15
|
||||
#define CL_DBL_MANT_DIG 53
|
||||
#define CL_DBL_MAX_10_EXP +308
|
||||
#define CL_DBL_MAX_EXP +1024
|
||||
#define CL_DBL_MIN_10_EXP -307
|
||||
#define CL_DBL_MIN_EXP -1021
|
||||
#define CL_DBL_RADIX 2
|
||||
#define CL_DBL_MAX 0x1.fffffffffffffp1023
|
||||
#define CL_DBL_MIN 0x1.0p-1022
|
||||
#define CL_DBL_EPSILON 0x1.0p-52
|
||||
|
||||
/* There are no vector types for half */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __CL_PLATFORM_H
|
||||
|
||||
Reference in New Issue
Block a user