aboutsummaryrefslogtreecommitdiff
path: root/src/builtins/pocl_types.h
blob: 3f280cf1c2164f9a6b5a3e785ac5bff475e303d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Scalar type definitions

//#include "pocl_features.h"

#if 0 // GP: ???
#if defined cl_khr_fp64 && !defined cl_khr_int64
#  error "cl_khr_fp64 requires cl_khr_int64"
#endif
#endif


/* Disable undefined datatypes */

/* The definitions below intentionally lead to errors if these types
   are used when they are not available in the language. This prevents
   accidentally using them if the compiler does not disable these
   types, but only e.g. defines them with an incorrect size.*/

#ifndef cl_khr_int64
typedef struct error_undefined_type_long error_undefined_type_long;
#  define long error_undefined_type_long
typedef struct error_undefined_type_ulong error_undefined_type_ulong;
#  define ulong error_undefined_type_ulong
#endif

#ifndef cl_khr_fp16
typedef struct error_undefined_type_half error_undefined_type_half;
#  define half error_undefined_type_half
#endif

#ifndef cl_khr_fp64
typedef struct error_undefined_type_double error_undefined_type_double;
#  define double error_undefined_type_double
#endif


/* Define unsigned datatypes */

typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
#ifdef cl_khr_int64
typedef unsigned long ulong;
#endif

/* Define pointer helper types */

typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef ptrdiff_t intptr_t;
typedef size_t uintptr_t;


/* Image types.
 * Note: there is a duplicate definition in
 * lib/CL/devices/dev_image.h - keep in sync?
 */
typedef int dev_sampler_t;

typedef struct dev_image_t {
  void* data;
  int width;
  int height;
  int depth;
  int image_array_size;
  int row_pitch;
  int slice_pitch;
  int num_mip_levels; /* maybe not needed */
  int num_samples; /* maybe not needed */
  int order;
  int data_type;
  int num_channels;
  int elem_size;
} dev_image_t;