Documentation

rend_quit

extern void rend_quit(void)
Will free ALL resources created by the library such as RendRenderer, RendPipeline, RendBuffer and RendTexture.

rend_renderer_create

extern RendRenderer rend_renderer_create(PeakWindow*, RendBackendType backend, void* device, bool vsync, RendBindingInfo *bind_info)
Create Renderer that renders to a target window with

rend_renderer_destroy

extern void rend_renderer_destroy(RendRenderer renderer)
Destroy renderer. Unless you need to freely create and destroy renderers, you can rely on rend_quit to clean up.

rend_renderer_frame_begin

extern bool rend_renderer_frame_begin(RendRenderer renderer)
May fail. Acquires backbuffer and starts recording commands!

rend_renderer_frame_end

extern void rend_renderer_frame_end(RendRenderer renderer, float *delta)
Stops recording commands and presents the contents to the screen.

rend_descriptor_write_ubo

extern void rend_descriptor_write_ubo(RendRenderer, RendBuffer ubo, uint32_t binding, uint32_t slot)

rend_descriptor_write_texture

extern void rend_descriptor_write_texture(RendRenderer, RendTexture *texture, uint32_t binding, uint32_t slot)
Writes texture to a slot in the texture array. Does not need to be in the main render loop.

rend_buffer_create

extern RendBuffer rend_buffer_create(RendRenderer renderer, size_t size, RendBufferType type, bool gpu)
Create a buffer. The type flags define what usage is passed to the backend. Setting gpu to true will make the memory static, otherwise memory will be dynamic.

rend_buffer_destroy

extern void rend_buffer_destroy(RendBuffer *buffer)
Destroy a buffer. Does not deallocate it's memory.

rend_buffer_write

extern void rend_buffer_write(RendRenderer renderer, RendBuffer *buffer, const void *data, size_t size, size_t offset)
Write to buffer. Works for dynamically and statically allocated buffers.

rend_buffer_address

extern uint64_t rend_buffer_address(RendBuffer *buffer)
Returns 64 bit address to buffer memory.

rend_texture_create

extern RendTexture rend_texture_create(RendRenderer renderer, uint32_t width, uint32_t height, uint32_t depth, uint32_t mip_levels, uint32_t layers, RendFormat format)
Create a texture.

rend_texture_create_from_data

extern RendTexture rend_texture_create_from_data(RendRenderer renderer, const void *data, uint32_t width, uint32_t height, RendFormat format)
Create texture and copy data to it immediately.

rend_texture_destroy

extern void rend_texture_destroy(RendRenderer renderer, RendTexture *texture)
Destroy texture. Does not deallocate it's memory from the bump allocator.

rend_texture_copy_data

extern void rend_texture_copy_data(RendRenderer renderer, RendTexture *texture, const void *data, size_t size)
Copy data to texture. MUST be the same size as the format expects (width x height x sizeof format).

rend_texture_copy_buffer

extern void rend_texture_copy_buffer(RendRenderer renderer, RendTexture *texture, RendBuffer *buffer)
Copy buffer to texture.

rend_pipeline_create_graphics_spirv

extern RendPipeline rend_pipeline_create_graphics_spirv(RendRenderer renderer, uint8_t *vertex_bytes, size_t vertex_size, uint8_t *frag_bytes, size_t frag_size, const RendVertexBinding *vertex_bindings, uint32_t vertex_binding_count, const RendVertexAttri
Create a pipeline for a renderer using a configuration handle.

rend_pipeline_create_graphics_bindless_spirv

extern RendPipeline rend_pipeline_create_graphics_bindless_spirv(RendRenderer renderer, uint8_t *vertex_bytes, size_t vertex_size, uint8_t *frag_bytes, size_t frag_size, const RendPushConstantInfo *push_constants, uint32_t push_constant_count, RendPolygo
Create a pipeline for a renderer using a configuration handle.

rend_pipeline_create_meshlet_spirv

extern RendPipeline rend_pipeline_create_meshlet_spirv(RendRenderer renderer, uint8_t *meshlet_bytes, size_t meshlet_size, uint8_t *frag_bytes, size_t frag_size, const RendPushConstantInfo *push_constants, uint32_t push_constant_count, RendPolygonMode pol
Creates a meshlet rendering pipeline.

rend_pipeline_create_compute_spirv

extern RendPipeline rend_pipeline_create_compute_spirv(RendRenderer renderer, const uint8_t *compute_bytes, size_t compute_size, const RendPushConstantInfo *push_constants, uint32_t push_constant_count)
Create a compute pipeline.

rend_cmd_render_begin

extern void rend_cmd_render_begin(RendRenderer renderer, float r, float g, float b, float a)
Begin render pass to default target the window.

rend_cmd_render_begin_texture

extern void rend_cmd_render_begin_texture(RendRenderer renderer, RendTexture *texture)
Begin render pass with a texture as the target.

rend_cmd_render_end

extern void rend_cmd_render_end(RendRenderer renderer)
End render pass.

rend_cmd_render_end_texture

extern void rend_cmd_render_end_texture(RendRenderer renderer, RendTexture *texture)
End render pass that targets texture. Transition texture to read optimal format.

rend_cmd_bind_pipeline

extern void rend_cmd_bind_pipeline(RendPipeline pipeline)
Bind the pipeline to this frame.

rend_cmd_bind_vertex_buffer

extern void rend_cmd_bind_vertex_buffer(RendPipeline pipeline, uint32_t binding, RendBuffer buffer, size_t offset)
Bind vertex buffer to this graphics pipeline.

rend_cmd_bind_index_buffer

extern void rend_cmd_bind_index_buffer(RendPipeline pipeline, RendBuffer buffer, size_t offset, RendIndexType index_type)
Bind index buffer to this graphics pipeline.

rend_cmd_push_constants

extern void rend_cmd_push_constants(RendPipeline pipeline, void *push_data, size_t size)
Send push constants to this pipeline / command buffer.

rend_cmd_dispatch

extern void rend_cmd_dispatch(RendPipeline pipeline, uint32_t x, uint32_t y, uint32_t z)
Dispatch compute commands to group with dimensions x, y, z!

rend_cmd_draw

extern void rend_cmd_draw(RendPipeline pipeline, size_t count, uint32_t instance_count)
Calls draw command on the pipeline.

rend_cmd_draw_indexed

extern void rend_cmd_draw_indexed(RendPipeline pipeline, uint32_t index_count, uint32_t first_index, int32_t vertex_offset, uint32_t instance_count)
Draw the pipeline using indexed rendering.

rend_cmd_blit

extern void rend_cmd_blit(RendRenderer renderer, RendTexture *src, RendTexture *dst, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h, uint32_t dst_x, uint32_t dst_y, uint32_t dst_w, uint32_t dst_h)
Blit a section of one texture onto another texture.