shithub: gpufs

ref: 5781e4d2a29054abc5d659e9ca867604cba4513f
dir: /objects.h/

View raw version
typedef struct Buffer Buffer;
struct Buffer {
	char *buffer;
	long len;
};

typedef struct Variable Variable;
struct Variable {
	long type;
};

typedef struct Type Type;
struct Type {
	u32int len;
	u32int optype;
};

typedef struct Function Function;
struct Function {
	long rettype;
	long label;
};

typedef struct Label Label;
struct Label {
	u32int *ptr;
};

enum {
	TTYPE,
	TVARIABLE,
	TFUNCTION,
	TLABEL,
};

typedef struct Item Item;
struct Item {
	short type;
	union {
		Variable v;
		Type t;
		Function f;
		Label l;
	};
};

typedef struct EntryPoint EntryPoint;
struct EntryPoint {
	char *name;
	long func;
	EntryPoint *next;
};

typedef struct Shader Shader;
struct Shader {
	u32int *buffer;
	long len;
	int descpool;
	int compiled; // is the shader compiled?
	
	Item *items;
	long nitems;
	long maxitems;
	EntryPoint *entrypoints;
	
	long lastfunction;
};

typedef struct DescSet DescSet;
struct DescSet {
	vlong *bindings; // id of buffer
	int numbindings;
};

typedef struct DescPool DescPool;
struct DescPool {
	DescSet *sets;
	int numsets;
};