vxKernel/include/vhex/display/stack.h

67 lines
1.6 KiB
C

#ifndef __VHEX_DISPLAY_STACK__
# define __VHEX_DISPLAY_STACK__
#include <vhex/display/shader.h>
#include <vhex/display/types.h>
/* dstack_call - dstack indirect call (same as dshader) */
struct dstack_call {
void (*routine)(dsurface_t *surface, uint32_t *draw_args);
uint32_t args[12];
};
typedef struct dstack_call dstack_call_t;
/* dstack_action - dstack drawing action information */
struct dstack_action {
struct dstack_call call;
struct {
dshader_call_t *table;
int number;
int idx;
} shader;
void (*quit)(uint32_t *arg);
};
/* DSTACK_CALL - display indirect call */
#define DSTACK_CALL(fct, ...) (dstack_call_t){ \
.routine = fct, \
.args = { __VA_ARGS__ } \
}
//---
// Display stack API
//---
/* dstack_init() : Initialise the draw stack (should not be involved) */
extern int dstack_init(void);
/* dstack_add_action() : add a new action in the draw stack */
extern did_t dstack_add_action(
dstack_call_t *call,
dshader_call_t *shaders,
void (*quit)(uint32_t *args)
);
/* dstack_get_action() : get display stack action using its ID */
extern struct dstack_action *dstack_get_action(did_t did);
/* dstack_render(): render a frame */
extern void dstack_render(void);
/* dstack_invalidate() : Invalidate the draw stack (reset) */
extern int dstack_invalidate(void);
/* dstack_display_width() : return the display width */
extern size_t dstack_display_width(void);
/* dstack_display_height() : return the display height */
extern size_t dstack_display_height(void);
/* dstack_quit() : Uninit the draw stack */
extern int dstack_quit(void);
#endif /* __VHEX_DISPLAY_STACK__ */