sokol/framebuffer

sokol_framebuffer

Types

14

Allocator

Allocator :: struct { alloc_fn: proc(a0: c.size_t, a1: rawptr) -> (rawptr), a0: c.size_t, size_t: rawptr, a1: rawptr, free_fn: proc(a0: rawptr, a1: rawptr), a0: rawptr, a1: rawptr, user_data: rawptr, }Source

sfb_allocator

Used in sfb_desc to provide custom memory-alloc and -free functions to sokol_framebuffer.h. If memory management should be overridden, both the alloc and free function must be provided (e.g. it's not valid to override one function but not the other).

Desc

Desc :: struct { framebuffer_pool_size: c.int, allocator: Allocator, logger: Logger, }Source

Initialization parameters passed into sfb_setup(). You should at least provide a logging function, otherwise you won't see any error logging.

Format

Format :: enum i32 { DEFAULT = 0, RGBA8 = 1, PALETTE8 = 2, }Source

sfb_format

The framebuffer pixel format. Either RGBA8 direct color where each pixel is an uint32_t, or paletted format with uint8_t pixels as index into a 256 entry color palette.

Framebuffer

Framebuffer :: struct { id: u32, }Source

sfb_framebuffer

A framebuffer handle, created with sfb_make_framebuffer(), destroyed with sfb_destroy_framebuffer()

Framebuffer_Info

Framebuffer_Info :: struct { update: Texture_Info, offscreen: Texture_Info, palette: Texture_Info, nearest_sampler: sg.Sampler, linear_sampler: sg.Sampler, }Source

sfb_framebuffer_info

Result of sfb_query_framebuffer_info(), returns handles to the internally managed images, texture views and samplers, image sizes and pixel formats. This is mostly useful when completely replacing the sfb_render_ex functions with a complete custom implementation (like a CRT shader which requires multiple render passes).

Rect

Rect :: struct { x: c.int, y: c.int, width: c.int, height: c.int, }Source

sfb_rect

Used as clipping rectangle in struct sfb_framebuffer_desc and sfb_resize_desc.

Render_Desc

Render_Desc :: struct { use_nearest_filter: bool, pip: sg.Pipeline, views: [32]sg.View, samplers: [12]sg.Sampler, uniforms: [8]sg.Range, }Source

sfb_render_overrides

Passed into sfb_render_ex() to override the default shader. Mainly useful to inject custom shaders (like CRT shaders).

TODO: add more details once sokol_crt.h is ready.

Render_Pass_Desc

Render_Pass_Desc :: struct { color_format: sg.Pixel_Format, depth_format: sg.Pixel_Format, sample_count: c.int, }Source

sfb_render_pass_desc

Describes render pass properties in an sfb_framebuffer_desc (color- and depth-pixel-format, sample count). This is used to create the sg_pipeline objects applied in the render functions. When rendering to a default swapchain all the values can remain at default (zero).

Resize_Desc

Resize_Desc :: struct { width: c.int, height: c.int, prescale: c.int, cliprect: Rect, }Source

sfb_resize_desc

Parameters for sfb_resize(). Needs to be called before sfb_update() in a frame if with potentially new framebuffer size parameters or clipping rectangle. Note that the sfb_resize() function can be called even when no resizing needs to happen, in that case the function will be a silent no-op and return false. When the function returns true this means that internal image objects had been recreated and need to be repopulated again via sfb_update()

Resizing is slightly cheaper than destroying and creating the frambuffer because only image objects needs to be re-created, but no pipeline objects.

Resource_State

Resource_State :: enum i32 { INITIAL = 0, ALLOC = 1, VALID = 2, FAILED = 3, INVALID = 4, }Source

sfb_resource_state

The state of a framebuffer object, obtainable via sfb_query_framebuffer_state(). Publicly visible values are only SFB_RESOURCESTATE_VALID and SFB_RESOURCESTATE_FAILED.

Update_Desc

Update_Desc :: struct { pixels: sg.Range, palette: sg.Range, }Source

sfb_update_desc

Passed into sfb_update() to update the pixel-date and/or color-palette-data The sfb_update() function should only be called when any of the above actually changes, at most once per frame, and outside any sokol-gfx pass.

Constants

5

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.