|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
gpu_sokol.h — GPU compositing inside a host-owned sokol render pass. More...
Data Structures | |
| struct | rmgui_gpu_desc_t |
| Must equal the host's consuming pass attachments; sample_count is positive. More... | |
| struct | rmgui_gpu_src_t |
| Picture texel bounds; fractional edges permit caller-specified half-texel insets. More... | |
| struct | rmgui_gpu_texture_t |
| Borrowed VALID texture view of a single-sample 2D RGBA8 image's base mip. More... | |
| struct | rmgui_gpu_frame_t |
| Target dimensions in device pixels; all dst/clip coordinates are top-left, y down. More... | |
Typedefs | |
| typedef struct rmgui_gpu | rmgui_gpu_t |
| One compositor per host sg instance and target attachment configuration. | |
| typedef struct rmgui_gpu_surface | rmgui_gpu_surface_t |
| Retained straight-alpha RGBA8 UI pixels; initially unwritten. | |
Enumerations | |
| enum | rmgui_gpu_result_t { RMGUI_GPU_OK = 0 , RMGUI_GPU_E_ARGS = -1 , RMGUI_GPU_E_VIEW = -2 , RMGUI_GPU_E_STATE = -3 , RMGUI_GPU_E_LIMIT = -4 , RMGUI_GPU_E_BACKEND = -5 } |
| Results leave outputs unchanged and submit no draw on failure. More... | |
| enum | rmgui_gpu_alpha_t { RMGUI_GPU_ALPHA_STRAIGHT , RMGUI_GPU_ALPHA_PREMULTIPLIED } |
| RGB blend factors; alpha always uses ONE, ONE_MINUS_SRC_ALPHA. More... | |
Functions | |
| rmgui_gpu_result_t | rmgui_gpu_create (rmgui_gpu_t **out, const rmgui_gpu_desc_t *d) |
| Allocate outside a pass; returns E_STATE without valid sg, E_BACKEND on failure. | |
| void | rmgui_gpu_destroy (rmgui_gpu_t *g) |
| Release outside a pass, after all surfaces; NULL is a no-op. | |
| rmgui_gpu_result_t | rmgui_gpu_surface_create (rmgui_gpu_t *g, rmgui_gpu_surface_t **out, int w, int h) |
| Allocate outside a pass; positive dimensions must fit max_image_size_2d. | |
| void | rmgui_gpu_surface_destroy (rmgui_gpu_surface_t *s) |
| Release outside a pass; NULL is a no-op. | |
| rmgui_gpu_result_t | rmgui_gpu_surface_write (rmgui_gpu_surface_t *s, const rmgui_fb_t *fb, rmgui_rect_t dirty) |
| Upload dirty clipped to the surface, outside a pass, at most once per host frame per surface. | |
| void | rmgui_gpu_begin (rmgui_gpu_t *g, const rmgui_gpu_frame_t *f) |
| Begin a compositing region INSIDE a host render pass. | |
| rmgui_gpu_result_t | rmgui_gpu_draw_surface (rmgui_gpu_t *g, const rmgui_gpu_surface_t *s, rmgui_rect_t dst, rmgui_rect_t clip) |
| Draw a written owned surface straight-over with nearest sampling; 1:1 at its size. | |
| rmgui_gpu_result_t | rmgui_gpu_draw_texture (rmgui_gpu_t *g, const rmgui_gpu_texture_t *t, rmgui_rect_t dst, rmgui_rect_t clip, rmgui_color_t tint) |
| Draw a borrowed texture, tint multiplying all four sampled channels, using its alpha blend mode. | |
| void | rmgui_gpu_end (rmgui_gpu_t *g) |
| End the region without ending the host pass or restoring host state. | |
gpu_sokol.h — GPU compositing inside a host-owned sokol render pass.
The consumer must use sokol_gfx.h commit ba938930bd77e7ebcbe3871740a3e0c9d00c96c0: sokol structs cross this ABI by value. The host owns one sokol_gfx implementation and its backend selection, sg_setup/shutdown, devices, contexts, swapchains, passes and commits. All calls run on that host's sg thread. Creation, destruction and uploads run outside passes. Destroy surfaces before their compositor, and destroy the compositor before sg_shutdown. No call takes ownership of host data.
| typedef struct rmgui_gpu rmgui_gpu_t |
One compositor per host sg instance and target attachment configuration.
| typedef struct rmgui_gpu_surface rmgui_gpu_surface_t |
Retained straight-alpha RGBA8 UI pixels; initially unwritten.
| enum rmgui_gpu_result_t |
Results leave outputs unchanged and submit no draw on failure.
| enum rmgui_gpu_alpha_t |
| rmgui_gpu_result_t rmgui_gpu_create | ( | rmgui_gpu_t ** | out, |
| const rmgui_gpu_desc_t * | d ) |
Allocate outside a pass; returns E_STATE without valid sg, E_BACKEND on failure.
| void rmgui_gpu_destroy | ( | rmgui_gpu_t * | g | ) |
Release outside a pass, after all surfaces; NULL is a no-op.
| rmgui_gpu_result_t rmgui_gpu_surface_create | ( | rmgui_gpu_t * | g, |
| rmgui_gpu_surface_t ** | out, | ||
| int | w, | ||
| int | h ) |
Allocate outside a pass; positive dimensions must fit max_image_size_2d.
| void rmgui_gpu_surface_destroy | ( | rmgui_gpu_surface_t * | s | ) |
Release outside a pass; NULL is a no-op.
| rmgui_gpu_result_t rmgui_gpu_surface_write | ( | rmgui_gpu_surface_t * | s, |
| const rmgui_fb_t * | fb, | ||
| rmgui_rect_t | dirty ) |
Upload dirty clipped to the surface, outside a pass, at most once per host frame per surface.
fb is borrowed, nonempty and exactly the surface size. Empty clipped dirty returns E_ARGS. Subsequent writes preserve other pixels.
| void rmgui_gpu_begin | ( | rmgui_gpu_t * | g, |
| const rmgui_gpu_frame_t * | f ) |
Begin a compositing region INSIDE a host render pass.
Until end, calls clobber pipeline, bindings, uniforms, viewport and scissor; the host must reapply its own state afterwards. Invalid inputs leave the region inactive.
| rmgui_gpu_result_t rmgui_gpu_draw_surface | ( | rmgui_gpu_t * | g, |
| const rmgui_gpu_surface_t * | s, | ||
| rmgui_rect_t | dst, | ||
| rmgui_rect_t | clip ) |
Draw a written owned surface straight-over with nearest sampling; 1:1 at its size.
| rmgui_gpu_result_t rmgui_gpu_draw_texture | ( | rmgui_gpu_t * | g, |
| const rmgui_gpu_texture_t * | t, | ||
| rmgui_rect_t | dst, | ||
| rmgui_rect_t | clip, | ||
| rmgui_color_t | tint ) |
Draw a borrowed texture, tint multiplying all four sampled channels, using its alpha blend mode.
dst and clip must be nonempty; clip is intersected with the pass rect. Draws allocate no heap memory. Invalid input draws nothing.
| void rmgui_gpu_end | ( | rmgui_gpu_t * | g | ) |
End the region without ending the host pass or restoring host state.