blob: 9ba1a00444c69a36da5bbdbe4388dc043938cb53 [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
61 void (*renderTriangleMesh)(void *con, RsTriangleMesh);
62 void (*renderTriangleMeshRange)(void *con, RsTriangleMesh, uint32_t start, uint32_t count);
63
64 void (*programFragmentBindTexture)(void *con, RsProgramFragment, uint32_t slot, RsAllocation);
65 void (*programFragmentBindSampler)(void *con, RsProgramFragment, uint32_t slot, RsAllocation);
66
67 void (*materialDiffuse)(void *con, float r, float g, float b, float a);
68 void (*materialSpecular)(void *con, float r, float g, float b, float a);
69 void (*lightPosition)(void *con, float x, float y, float z, float w);
70 void (*materialShininess)(void *con, float s);
71
72 void (*uploadToTexture)(void *con, RsAllocation va, uint32_t baseMipLevel);
73
74 void (*enable)(void *con, uint32_t);
75 void (*disable)(void *con, uint32_t);
76
77 uint32_t (*rand)(void *con, uint32_t max);
78
79 // Assumes (GL_FIXED) x,y,z (GL_UNSIGNED_BYTE)r,g,b,a
80 void (*drawTriangleArray)(void *con, RsAllocation alloc, uint32_t count);
81
82 void (*contextBindProgramFragment)(void *con, RsProgramFragment pf);
83 void (*contextBindProgramFragmentStore)(void *con, RsProgramFragmentStore pfs);
84} rsc_FunctionTable;
85
86typedef void (*rsc_RunScript)(void *con, const rsc_FunctionTable *, uint32_t launchID);
87
88
89/* EnableCap */
90#define GL_LIGHTING 0x0B50
91
92/* LightName */
93#define GL_LIGHT0 0x4000