#ifndef video_hpp #define video_hpp #include struct App; struct Arena; struct Heap; typedef uint32_t Texture_Id; typedef uint32_t Buffer_Id; struct Pipeline { }; struct Colour { uint8_t r, g, b, a; }; struct Render_Pass { Texture_Id target; Colour clear; bool operator==(const Render_Pass& other) const { int size = sizeof *this, i; uint8_t* bba = (uint8_t*)this; uint8_t* bbb = (uint8_t*)&other; for (i = 0; i < size; i++) if (*bba != *bbb) return false; return true; } }; struct Draw { }; struct Pipeline_Builder { Arena* arena; Render_Pass* pass; Pipeline_Builder(Arena* arena); void begin_rp(); void rp_target(Texture_Id id, Colour clear_colour); Render_Pass& build_rp(); void validate_rp(); }; struct Texture { int w, h; bool alias; }; struct Context; struct Shader; struct Device { Arena* arena; Heap* heap; App* app; static Device* create(Arena* a, App* ap); void init(Arena* a, App* ap); void destroy(); void on_resize(); void begin_frame(); void submit(Context& ctx); void present(); Context& acquire(); Context& get_ctx(); Texture_Id get_backbuffer(); Texture& get_texture(Texture_Id id); void destroy_texture(Texture_Id id); Shader* load_shader(const char* fname); }; struct Context { void wait(Device& d); void submit( Device& d, const Draw& draw, const Pipeline& p, const Render_Pass& rp ); void submit( Device& d, const Draw* draws, int count, const Pipeline& p, const Render_Pass& rp ); void submit(Device& d, const Render_Pass& rp); }; struct Shader { void destroy(Device* dev); }; #endif