shithub: gpufs

ref: 5781e4d2a29054abc5d659e9ca867604cba4513f
dir: /ops.h/

View raw version
typedef struct Frame Frame;

typedef struct CompileTimeContext CompileTimeContext;
struct CompileTimeContext {
	Shader *shader;
};

typedef struct RunTimeContext RunTimeContext;
struct RunTimeContext {
	Shader *shader;
	Frame **frameptr;
};

enum {
	COMPILE,
	RUNTIME,
};

typedef struct FrameContext FrameContext;
struct FrameContext {
	short type;
	union {
		CompileTimeContext c;
		RunTimeContext r;
	};
};

struct Frame {
	u32int *pc;
	FrameContext ctxt;
	Frame *next;
};

typedef struct Op Op;
struct Op {
	u32int opcode;
	void (*f)(Frame*,u32int);
};

int oplookup(u32int code, void (**f)(Frame*,u32int));