blob: 1bf5f22d35ee358c2061ca32098cafd98096f920 [file] [log] [blame]
Jason Sams326e0dd2009-05-22 14:03:28 -07001#include <stdint.h>
2
3
4typedef void * RsAdapter1D;
5typedef void * RsAdapter2D;
6typedef void * RsAllocation;
7typedef void * RsContext;
8typedef void * RsDevice;
9typedef void * RsElement;
10typedef void * RsSampler;
11typedef void * RsScript;
12typedef void * RsScriptBasicTemp;
13typedef void * RsTriangleMesh;
14typedef void * RsType;
15typedef void * RsProgramFragment;
16typedef void * RsProgramFragmentStore;
17
18
19typedef struct {
20 float m[16];
21} rsc_Matrix;
22
23
24typedef struct {
25 float v[4];
26} rsc_Vector4;
27
28#define RS_PROGRAM_VERTEX_MODELVIEW_OFFSET 0
29#define RS_PROGRAM_VERTEX_PROJECTION_OFFSET 16
30#define RS_PROGRAM_VERTEX_TEXTURE_OFFSET 32
31
32typedef struct {
33 const void * (*loadEnvVp)(void *con, uint32_t bank, uint32_t offset);
34
35 float (*loadEnvF)(void *con, uint32_t bank, uint32_t offset);
36 int32_t (*loadEnvI32)(void *con, uint32_t bank, uint32_t offset);
37 uint32_t (*loadEnvU32)(void *con, uint32_t bank, uint32_t offset);
38 void (*loadEnvVec4)(void *con, uint32_t bank, uint32_t offset, rsc_Vector4 *);
39 void (*loadEnvMatrix)(void *con, uint32_t bank, uint32_t offset, rsc_Matrix *);
40
41 void (*storeEnvF)(void *con, uint32_t bank, uint32_t offset, float);
42 void (*storeEnvI32)(void *con, uint32_t bank, uint32_t offset, int32_t);
43 void (*storeEnvU32)(void *con, uint32_t bank, uint32_t offset, uint32_t);
44 void (*storeEnvVec4)(void *con, uint32_t bank, uint32_t offset, const rsc_Vector4 *);
45 void (*storeEnvMatrix)(void *con, uint32_t bank, uint32_t offset, const rsc_Matrix *);
46
47 void (*matrixLoadIdentity)(void *con, rsc_Matrix *);
48 void (*matrixLoadFloat)(void *con, rsc_Matrix *, const float *);
49 void (*matrixLoadMat)(void *con, rsc_Matrix *, const rsc_Matrix *);
50 void (*matrixLoadRotate)(void *con, rsc_Matrix *, float rot, float x, float y, float z);
51 void (*matrixLoadScale)(void *con, rsc_Matrix *, float x, float y, float z);
52 void (*matrixLoadTranslate)(void *con, rsc_Matrix *, float x, float y, float z);
53 void (*matrixLoadMultiply)(void *con, rsc_Matrix *, const rsc_Matrix *lhs, const rsc_Matrix *rhs);
54 void (*matrixMultiply)(void *con, rsc_Matrix *, const rsc_Matrix *rhs);
55 void (*matrixRotate)(void *con, rsc_Matrix *, float rot, float x, float y, float z);
56 void (*matrixScale)(void *con, rsc_Matrix *, float x, float y, float z);
57 void (*matrixTranslate)(void *con, rsc_Matrix *, float x, float y, float z);
58
59 void (*color)(void *con, float r, float g, float b, float a);
60
Jason Sams326e0dd2009-05-22 14:03:28 -070061 void (*programFragmentBindTexture)(void *con, RsProgramFragment, uint32_t slot, RsAllocation);
62 void (*programFragmentBindSampler)(void *con, RsProgramFragment, uint32_t slot, RsAllocation);
Jason Sams6678e9b2009-05-27 14:45:32 -070063
Jason Sams326e0dd2009-05-22 14:03:28 -070064 void (*materialDiffuse)(void *con, float r, float g, float b, float a);
65 void (*materialSpecular)(void *con, float r, float g, float b, float a);
66 void (*lightPosition)(void *con, float x, float y, float z, float w);
67 void (*materialShininess)(void *con, float s);
68
69 void (*uploadToTexture)(void *con, RsAllocation va, uint32_t baseMipLevel);
70
71 void (*enable)(void *con, uint32_t);
72 void (*disable)(void *con, uint32_t);
73
74 uint32_t (*rand)(void *con, uint32_t max);
75
Jason Sams6678e9b2009-05-27 14:45:32 -070076 void (*contextBindProgramFragment)(void *con, RsProgramFragment pf);
77 void (*contextBindProgramFragmentStore)(void *con, RsProgramFragmentStore pfs);
78
79
80 // Drawing funcs
81 void (*renderTriangleMesh)(void *con, RsTriangleMesh);
82 void (*renderTriangleMeshRange)(void *con, RsTriangleMesh, uint32_t start, uint32_t count);
83
Jason Sams326e0dd2009-05-22 14:03:28 -070084 // Assumes (GL_FIXED) x,y,z (GL_UNSIGNED_BYTE)r,g,b,a
85 void (*drawTriangleArray)(void *con, RsAllocation alloc, uint32_t count);
86
Jason Sams6678e9b2009-05-27 14:45:32 -070087 void (*drawRect)(void *con, int32_t x1, int32_t x2, int32_t y1, int32_t y2);
Jason Sams326e0dd2009-05-22 14:03:28 -070088} rsc_FunctionTable;
89
Jason Samsa44cb292009-06-04 17:58:03 -070090typedef int (*rsc_RunScript)(void *con, const rsc_FunctionTable *, uint32_t launchID);
Jason Sams326e0dd2009-05-22 14:03:28 -070091
92
93/* EnableCap */
94#define GL_LIGHTING 0x0B50
95
96/* LightName */
97#define GL_LIGHT0 0x4000