Shih-wei Liao | 708e04f | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 1 | #ifndef __RS_TYPES_RSH__ |
| 2 | #define __RS_TYPES_RSH__ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 3 | |
Shih-wei Liao | 1ad9612 | 2011-01-19 02:18:45 -0800 | [diff] [blame] | 4 | #define M_PI 3.14159265358979323846264338327950288f /* pi */ |
| 5 | |
Shih-wei Liao | cbcced2 | 2011-01-19 12:17:54 -0800 | [diff] [blame] | 6 | #include "stdbool.h" |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 7 | typedef char int8_t; |
| 8 | typedef short int16_t; |
| 9 | typedef int int32_t; |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 10 | typedef long long int64_t; |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 11 | |
| 12 | typedef unsigned char uint8_t; |
| 13 | typedef unsigned short uint16_t; |
| 14 | typedef unsigned int uint32_t; |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 15 | typedef unsigned long long uint64_t; |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 16 | |
| 17 | typedef uint8_t uchar; |
| 18 | typedef uint16_t ushort; |
| 19 | typedef uint32_t uint; |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 20 | typedef uint64_t ulong; |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 21 | |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 22 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element; |
| 23 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type; |
| 24 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation; |
| 25 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler; |
| 26 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script; |
| 27 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh; |
| 28 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment; |
| 29 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex; |
| 30 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster; |
| 31 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store; |
| 32 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font; |
| 33 | |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 34 | |
| 35 | typedef float float2 __attribute__((ext_vector_type(2))); |
| 36 | typedef float float3 __attribute__((ext_vector_type(3))); |
| 37 | typedef float float4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 38 | |
| 39 | typedef uchar uchar2 __attribute__((ext_vector_type(2))); |
| 40 | typedef uchar uchar3 __attribute__((ext_vector_type(3))); |
| 41 | typedef uchar uchar4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 42 | |
| 43 | typedef ushort ushort2 __attribute__((ext_vector_type(2))); |
| 44 | typedef ushort ushort3 __attribute__((ext_vector_type(3))); |
| 45 | typedef ushort ushort4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 46 | |
| 47 | typedef uint uint2 __attribute__((ext_vector_type(2))); |
| 48 | typedef uint uint3 __attribute__((ext_vector_type(3))); |
| 49 | typedef uint uint4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 50 | |
| 51 | typedef char char2 __attribute__((ext_vector_type(2))); |
| 52 | typedef char char3 __attribute__((ext_vector_type(3))); |
| 53 | typedef char char4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 54 | |
| 55 | typedef short short2 __attribute__((ext_vector_type(2))); |
| 56 | typedef short short3 __attribute__((ext_vector_type(3))); |
| 57 | typedef short short4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 58 | |
| 59 | typedef int int2 __attribute__((ext_vector_type(2))); |
| 60 | typedef int int3 __attribute__((ext_vector_type(3))); |
| 61 | typedef int int4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 62 | |
| 63 | |
Alex Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 64 | typedef struct { |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 65 | float m[16]; |
| 66 | } rs_matrix4x4; |
| 67 | |
Alex Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 68 | typedef struct { |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 69 | float m[9]; |
| 70 | } rs_matrix3x3; |
| 71 | |
Alex Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 72 | typedef struct { |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 73 | float m[4]; |
| 74 | } rs_matrix2x2; |
| 75 | |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 76 | typedef float4 rs_quaternion; |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 77 | |
Jason Sams | 020bb7b | 2010-06-17 15:55:00 -0700 | [diff] [blame] | 78 | #define RS_PACKED __attribute__((packed, aligned(4))) |
| 79 | |
Shih-wei Liao | 708e04f | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 80 | #endif |