blob: a010096507b189a797864c771908d171198609fd [file] [log] [blame]
Shih-wei Liao708e04f2010-10-07 18:21:32 -07001#ifndef __RS_TYPES_RSH__
2#define __RS_TYPES_RSH__
Jason Sams33bcfa22010-03-16 15:35:57 -07003
Shih-wei Liao1ad96122011-01-19 02:18:45 -08004#define M_PI 3.14159265358979323846264338327950288f /* pi */
5
Shih-wei Liaocbcced22011-01-19 12:17:54 -08006#include "stdbool.h"
Jason Sams33bcfa22010-03-16 15:35:57 -07007typedef char int8_t;
8typedef short int16_t;
9typedef int int32_t;
Jason Samsd79b2e92010-05-19 17:22:57 -070010typedef long long int64_t;
Jason Sams33bcfa22010-03-16 15:35:57 -070011
12typedef unsigned char uint8_t;
13typedef unsigned short uint16_t;
14typedef unsigned int uint32_t;
Jason Samsd79b2e92010-05-19 17:22:57 -070015typedef unsigned long long uint64_t;
Jason Sams33bcfa22010-03-16 15:35:57 -070016
17typedef uint8_t uchar;
18typedef uint16_t ushort;
19typedef uint32_t uint;
Jason Samsd79b2e92010-05-19 17:22:57 -070020typedef uint64_t ulong;
Jason Sams33bcfa22010-03-16 15:35:57 -070021
Jason Sams02f62aa2010-08-16 12:41:48 -070022typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element;
23typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type;
24typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation;
25typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler;
26typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script;
27typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh;
28typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment;
29typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex;
30typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster;
31typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store;
32typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font;
33
Jason Sams33bcfa22010-03-16 15:35:57 -070034
35typedef float float2 __attribute__((ext_vector_type(2)));
36typedef float float3 __attribute__((ext_vector_type(3)));
37typedef float float4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070038
39typedef uchar uchar2 __attribute__((ext_vector_type(2)));
40typedef uchar uchar3 __attribute__((ext_vector_type(3)));
41typedef uchar uchar4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070042
43typedef ushort ushort2 __attribute__((ext_vector_type(2)));
44typedef ushort ushort3 __attribute__((ext_vector_type(3)));
45typedef ushort ushort4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070046
47typedef uint uint2 __attribute__((ext_vector_type(2)));
48typedef uint uint3 __attribute__((ext_vector_type(3)));
49typedef uint uint4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070050
51typedef char char2 __attribute__((ext_vector_type(2)));
52typedef char char3 __attribute__((ext_vector_type(3)));
53typedef char char4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070054
55typedef short short2 __attribute__((ext_vector_type(2)));
56typedef short short3 __attribute__((ext_vector_type(3)));
57typedef short short4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070058
59typedef int int2 __attribute__((ext_vector_type(2)));
60typedef int int3 __attribute__((ext_vector_type(3)));
61typedef int int4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -070062
63
Alex Sakhartchouka9191122010-08-11 10:04:21 -070064typedef struct {
Jason Samsd79b2e92010-05-19 17:22:57 -070065 float m[16];
66} rs_matrix4x4;
67
Alex Sakhartchouka9191122010-08-11 10:04:21 -070068typedef struct {
Jason Samsfae3f6b2010-06-24 13:54:11 -070069 float m[9];
70} rs_matrix3x3;
71
Alex Sakhartchouka9191122010-08-11 10:04:21 -070072typedef struct {
Jason Samsfae3f6b2010-06-24 13:54:11 -070073 float m[4];
74} rs_matrix2x2;
75
Alex Sakhartchouk0de94442010-08-11 14:41:28 -070076typedef float4 rs_quaternion;
Jason Samsfae3f6b2010-06-24 13:54:11 -070077
Jason Sams020bb7b2010-06-17 15:55:00 -070078#define RS_PACKED __attribute__((packed, aligned(4)))
79
Shih-wei Liao708e04f2010-10-07 18:21:32 -070080#endif