Skip to content

Instantly share code, notes, and snippets.

@genotrance
Last active June 29, 2020 16:35
Show Gist options
  • Save genotrance/a701445e045a467396a55ec7162c94c8 to your computer and use it in GitHub Desktop.
Save genotrance/a701445e045a467396a55ec7162c94c8 to your computer and use it in GitHub Desktop.
Nim wrapper for rizz using nimterop
# nim c -d:FLAGS rizz.nim
#
# FLAGS
# -d:rizzGit
# -d:rizzSetVer=v0.4
# -d:rizzStatic
import os
import nimterop/[build, cimport]
const
baseDir = getProjectCacheDir("nimrizz")
setDefines(@["rizzGit", "rizzStatic"])
getHeader(
header = "rizz.h",
giturl = "https://github.com/septag/rizz",
outdir = baseDir,
altNames = "sx"
)
static:
cDebug()
cOverride:
const
# nimterop bug
SX_NEAR_ZERO = 1.0 / (1 shl 28)
cIncludeDir(rizzPath.parentDir().parentDir())
cImport(rizzPath, recurse = true, flags = "-E_ -F_ -G__=_")
# Removing /home/gt/.cache/nim/nimterop/nimrizz
# Setting up Git repo: https://github.com/septag/rizz
# Pulling repository
# Running cmake .. -G 'Unix Makefiles' -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
# Path: /home/gt/.cache/nim/nimterop/nimrizz/buildcache
# Running make
# Path: /home/gt/.cache/nim/nimterop/nimrizz/buildcache
# Including library /home/gt/.cache/nim/nimterop/nimrizz/buildcache/src/sx/libsx.a
# Overriding SX_NEAR_ZERO
{.passC: "-I/home/gt/.cache/nim/nimterop/nimrizz/include".}
# Importing /home/gt/.cache/nim/nimterop/nimrizz/include/rizz/rizz.h
# Generated @ 2020-06-29T11:22:47-05:00
# Command line:
# /home/gt/nimterop/nimterop/toast --preprocess -m:c --recurse -E_ -F_ -G__=_ --includeDirs+=/home/gt/.cache/nim/nimterop/nimrizz/include --pnim --symOverride=SX_NEAR_ZERO --nim:/home/gt/nimdevel/bin/nim --pluginSourcePath=/home/gt/.cache/nim/nimterop/cPlugins/nimterop_1149019900.nim /home/gt/.cache/nim/nimterop/nimrizz/include/rizz/rizz.h
# const 'thread_local' has unsupported value '_Thread_local'
# const 'SX_COMPILER_GCC' has unsupported value '(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)'
# const 'SX_CPU_X86' is duplicate, skipped
# const 'SX_ARCH_64BIT' is duplicate, skipped
# const 'SX_CPU_ENDIAN_LITTLE' is duplicate, skipped
# const 'SX_PLATFORM_LINUX' is duplicate, skipped
# const 'SX_CRT_NONE' is duplicate, skipped
# const 'SX_COMPILER_NAME' has unsupported value '"GCC " sx_stringize(__GNUC__) "." sx_stringize(__GNUC_MINOR__) "." sx_stringize( __GNUC_PATCHLEVEL__)'
# const 'RIZZ_GRAPHICS_API_GL' is duplicate, skipped
# const 'RIZZ_GRAPHICS_SHADER_LANG' has unsupported value 'glsl'
# const 'RIZZ_APP_API_VARNAME' has unsupported value 'the_app'
# const 'RIZZ_CORE_API_VARNAME' has unsupported value 'the_core'
# const 'RIZZ_ASSET_API_VARNAME' has unsupported value 'the_asset'
# const 'RIZZ_CAMERA_API_VARNAME' has unsupported value 'the_camera'
# const 'RIZZ_GRAPHICS_API_VARNAME' has unsupported value 'the_gfx'
# const 'RIZZ_PLUGIN_API_VARNAME' has unsupported value 'the_plugin'
# const 'RIZZ_VFS_API_VARNAME' has unsupported value 'the_vfs'
# const 'RIZZ_REFLECT_API_VARNAME' has unsupported value 'the_refl'
# const 'SX_ALLOW_UNUSED' has unsupported value '__attribute__((unused))'
# const 'SX_FORCE_INLINE' has unsupported value 'static inline __attribute__((__always_inline__))'
# const 'SX_FUNCTION' has unsupported value '__PRETTY_FUNCTION__'
# const 'SX_NO_INLINE' has unsupported value '__attribute__((noinline))'
# const 'SX_NO_RETURN' has unsupported value '__attribute__((noreturn))'
# const 'SX_CONSTFN' has unsupported value '__attribute__((const))'
# const 'SX_RESTRICT' has unsupported value '__restrict__'
# const 'SX_FLATTEN' has unsupported value '__attribute__((flatten)) /* inline everything in the function body*/'
# const 'SX_PRAGMA_DIAGNOSTIC_PUSH' has unsupported value 'SX_PRAGMA_DIAGNOSTIC_PUSH_GCC_'
# const 'SX_PRAGMA_DIAGNOSTIC_POP' has unsupported value 'SX_PRAGMA_DIAGNOSTIC_POP_GCC_'
# const 'SX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC' has unsupported value 'SX_PRAGMA_DIAGNOSTIC_IGNORED_GCC'
# const '_SX_EXTERN' has unsupported value 'extern'
# const 'SX_API' has unsupported value '_SX_EXTERN _SX_API_DECL'
# type 'sx_alloc' is duplicate, skipped
# tree-sitter parse error: 'static inline void* sx__aligned_alloc(const sx_alloc* alloc, size_t size, uint32_t align,', skipped
# tree-sitter parse error: 'static inline void* sx__aligned_realloc(const sx_alloc* alloc, void* ptr, size_t size,', skipped
# var 'total' is duplicate, skipped
# var 'header' is duplicate, skipped
# type 'sx_alloc' is duplicate, skipped
# const 'SX_FIBER_INVALID' has unsupported value 'NULL'
# type 'sx_fiber_transfer' is duplicate, skipped
# type 'sx_fiber_stack' is duplicate, skipped
# type 'sx_alloc' is duplicate, skipped
# type 'sx_whence' is duplicate, skipped
# type 'sx_mem_block' is duplicate, skipped
# type 'sx_mem_writer' is duplicate, skipped
# type 'sx_mem_reader' is duplicate, skipped
# type 'sx_file' is duplicate, skipped
# type 'sx_file_open_flag' is duplicate, skipped
# type 'sx_iff_chunk' is duplicate, skipped
# type 'sx_iff_type' is duplicate, skipped
# type 'sx_iff_flag' is duplicate, skipped
# type 'sx_iff_file' is duplicate, skipped
# type 'sx_alloc' is duplicate, skipped
# type 'sx_job_priority' is duplicate, skipped
# type 'sx_job_context_desc' is duplicate, skipped
# type 'sx_vec4' is duplicate, skipped
# type 'sx_vec2' is duplicate, skipped
# type 'sx_vec3' is duplicate, skipped
# type 'sx_color' is duplicate, skipped
# type 'sx_ivec2' is duplicate, skipped
# type 'sx_quat' is duplicate, skipped
# type 'sx_mat3' is duplicate, skipped
# type 'sx_mat4' is duplicate, skipped
# type 'sx_rect' is duplicate, skipped
# type 'sx_irect' is duplicate, skipped
# type 'sx_aabb' is duplicate, skipped
# type 'sx_plane' is duplicate, skipped
# type 'sx_tx3d' is duplicate, skipped
# type 'sx_box' is duplicate, skipped
# tree-sitter parse error: 'static inline ', skipped
# tree-sitter parse error: 'static inline float sx_saturate(float _n)', skipped
# tree-sitter parse error: 'static inline float sx_smoothstep(float _a, float _edge1, float _edge2)', skipped
# tree-sitter parse error: 'static inline float sx_linearstep(float t, float _min, float _max)', skipped
# tree-sitter parse error: 'static inline float sx_normalize_time(float t, float _max)', skipped
# tree-sitter parse error: 'static inline sx_quat sx_quat_norm(const sx_quat _quat)', skipped
# tree-sitter parse error: 'static inline sx_vec3 sx_vec3_norm(const sx_vec3 _a)', skipped
# tree-sitter parse error: 'static inline sx_vec3 sx_vec3_norm_len(const sx_vec3 _a, float* _outlen)', skipped
# tree-sitter parse error: 'static inline sx_vec3 sx_vec3_min(const sx_vec3 _a, const sx_vec3 _b)', skipped
# tree-sitter parse error: 'static inline sx_vec3 sx_vec3_max(const sx_vec3 _a, const sx_vec3 _b)', skipped
# tree-sitter parse error: 'static inline sx_vec2 sx_vec2_norm(const sx_vec2 _a)', skipped
# tree-sitter parse error: 'static inline sx_vec2 sx_vec2_norm_len(const sx_vec2 _a, float* outlen)', skipped
# tree-sitter parse error: 'static inline sx_vec2 sx_vec2_min(const sx_vec2 _a, const sx_vec2 _b)', skipped
# tree-sitter parse error: 'static inline sx_vec2 sx_vec2_max(const sx_vec2 _a, const sx_vec2 _b)', skipped
# tree-sitter parse error: 'static inline sx_ivec2 sx_ivec2_min(const sx_ivec2 _a, const sx_ivec2 _b)', skipped
# tree-sitter parse error: 'static inline sx_ivec2 sx_ivec2_max(const sx_ivec2 _a, const sx_ivec2 _b)', skipped
# tree-sitter parse error: 'static inline sx_vec3 sx_aabb_corner(const sx_aabb* aabb, int index)', skipped
# const 'RIZZ_API' has unsupported value 'extern'
# type 'rizz_app_event_type' is duplicate, skipped
# type 'rizz_keycode' is duplicate, skipped
# type 'rizz_touch_point' is duplicate, skipped
# type 'rizz_mouse_btn' is duplicate, skipped
# type 'rizz_modifier_keys' is duplicate, skipped
# type 'rizz_app_event' is duplicate, skipped
# type 'rizz_api_app' is duplicate, skipped
# type 'rizz_vfs_flags' is duplicate, skipped
# type 'rizz_api_vfs' is duplicate, skipped
# type 'rizz_asset_load_flags' is duplicate, skipped
# type 'rizz_asset_load_params' is duplicate, skipped
# type 'rizz_asset_load_data' is duplicate, skipped
# type 'rizz_asset_state' is duplicate, skipped
# type 'rizz_asset_callbacks' is duplicate, skipped
# type 'rizz_api_asset' is duplicate, skipped
# type 'rizz_camera' is duplicate, skipped
# type 'rizz_camera_fps' is duplicate, skipped
# type 'rizz_api_camera' is duplicate, skipped
# type 'rizz_app_flags' is duplicate, skipped
# type 'rizz_core_flags' is duplicate, skipped
# type 'rizz_log_level' is duplicate, skipped
# type 'rizz_config' is duplicate, skipped
# type 'rizz_log_entry' is duplicate, skipped
# type 'rizz_mem_id' is duplicate, skipped
# type 'rizz_track_alloc_item' is duplicate, skipped
# type 'rizz_mem_info' is duplicate, skipped
# type 'rizz_version' is duplicate, skipped
# type 'rizz_profile_flag' is duplicate, skipped
# type 'rizz_api_core' is duplicate, skipped
# type 'sg_buffer' is duplicate, skipped
# type 'sg_image' is duplicate, skipped
# type 'sg_shader' is duplicate, skipped
# type 'sg_pipeline' is duplicate, skipped
# type 'sg_pass' is duplicate, skipped
# type 'sg_context' is duplicate, skipped
# type 'sg_backend' is duplicate, skipped
# type 'sg_pixel_format' is duplicate, skipped
# type 'sg_pixelformat_info' is duplicate, skipped
# type 'sg_features' is duplicate, skipped
# type 'sg_limits' is duplicate, skipped
# type 'sg_resource_state' is duplicate, skipped
# type 'sg_usage' is duplicate, skipped
# type 'sg_buffer_type' is duplicate, skipped
# type 'sg_index_type' is duplicate, skipped
# type 'sg_image_type' is duplicate, skipped
# type 'sg_sampler_type' is duplicate, skipped
# type 'sg_cube_face' is duplicate, skipped
# type 'sg_shader_stage' is duplicate, skipped
# type 'sg_primitive_type' is duplicate, skipped
# type 'sg_filter' is duplicate, skipped
# type 'sg_wrap' is duplicate, skipped
# type 'sg_border_color' is duplicate, skipped
# type 'sg_vertex_format' is duplicate, skipped
# type 'sg_vertex_step' is duplicate, skipped
# type 'sg_uniform_type' is duplicate, skipped
# type 'sg_cull_mode' is duplicate, skipped
# type 'sg_face_winding' is duplicate, skipped
# type 'sg_compare_func' is duplicate, skipped
# type 'sg_stencil_op' is duplicate, skipped
# type 'sg_blend_factor' is duplicate, skipped
# type 'sg_blend_op' is duplicate, skipped
# type 'sg_color_mask' is duplicate, skipped
# type 'sg_action' is duplicate, skipped
# type 'sg_color_attachment_action' is duplicate, skipped
# type 'sg_depth_attachment_action' is duplicate, skipped
# type 'sg_stencil_attachment_action' is duplicate, skipped
# type 'sg_pass_action' is duplicate, skipped
# type 'sg_bindings' is duplicate, skipped
# type 'sg_buffer_desc' is duplicate, skipped
# type 'sg_subimage_content' is duplicate, skipped
# type 'sg_image_content' is duplicate, skipped
# type 'sg_image_desc' is duplicate, skipped
# type 'sg_shader_attr_desc' is duplicate, skipped
# type 'sg_shader_uniform_desc' is duplicate, skipped
# type 'sg_shader_uniform_block_desc' is duplicate, skipped
# type 'sg_shader_image_desc' is duplicate, skipped
# type 'sg_shader_stage_desc' is duplicate, skipped
# type 'sg_shader_desc' is duplicate, skipped
# type 'sg_buffer_layout_desc' is duplicate, skipped
# type 'sg_vertex_attr_desc' is duplicate, skipped
# type 'sg_layout_desc' is duplicate, skipped
# type 'sg_stencil_state' is duplicate, skipped
# type 'sg_depth_stencil_state' is duplicate, skipped
# type 'sg_blend_state' is duplicate, skipped
# type 'sg_rasterizer_state' is duplicate, skipped
# type 'sg_pipeline_desc' is duplicate, skipped
# type 'sg_attachment_desc' is duplicate, skipped
# type 'sg_pass_desc' is duplicate, skipped
# type 'sg_trace_hooks' is duplicate, skipped
# type 'sg_slot_info' is duplicate, skipped
# type 'sg_buffer_info' is duplicate, skipped
# type 'sg_image_info' is duplicate, skipped
# type 'sg_shader_info' is duplicate, skipped
# type 'sg_pipeline_info' is duplicate, skipped
# type 'sg_pass_info' is duplicate, skipped
# type 'sg_gl_context_desc' is duplicate, skipped
# type 'sg_d3d11_context_desc' is duplicate, skipped
# type 'sg_wgpu_context_desc' is duplicate, skipped
# type 'sg_context_desc' is duplicate, skipped
# type 'sg_desc' is duplicate, skipped
# type 'rizz_gfx_backend' is duplicate, skipped
# type 'rizz_shader_lang' is duplicate, skipped
# type 'rizz_shader_stage' is duplicate, skipped
# type 'rizz_shader_code_type' is duplicate, skipped
# type 'rizz_shader_refl_input' is duplicate, skipped
# type 'rizz_shader_refl_uniform_buffer' is duplicate, skipped
# type 'rizz_shader_refl_buffer' is duplicate, skipped
# type 'rizz_shader_refl_texture' is duplicate, skipped
# type 'rizz_shader_refl' is duplicate, skipped
# type 'rizz_shader_info' is duplicate, skipped
# type 'rizz_vertex_attr' is duplicate, skipped
# type 'rizz_vertex_layout' is duplicate, skipped
# type 'rizz_shader' is duplicate, skipped
# type 'rizz_texture_load_params' is duplicate, skipped
# type 'rizz_texture_info' is duplicate, skipped
# type 'rizz_texture' is duplicate, skipped
# type 'rizz_gfx_perframe_trace_zone' is duplicate, skipped
# type 'rizz_gfx_perframe_trace_info' is duplicate, skipped
# type 'rizz_gfx_trace_info' is duplicate, skipped
# type 'rizz_api_gfx_draw' is duplicate, skipped
# type 'rizz_api_gfx' is duplicate, skipped
# const 'RIZZ_STATE' has unsupported value '__attribute__((section(".state")))'
# const 'RIZZ_PLUGIN_EXPORT' has unsupported value '__attribute__((visibility("default")))'
# type 'rizz_api_type' is duplicate, skipped
# type 'rizz_plugin_event' is duplicate, skipped
# type 'rizz_plugin_crash' is duplicate, skipped
# type 'rizz_plugin_info_flags' is duplicate, skipped
# type 'rizz_plugin_info' is duplicate, skipped
# type 'rizz_plugin_info' is duplicate, skipped
# type 'rizz_api_plugin' is duplicate, skipped
# type 'rizz_plugin' is duplicate, skipped
# type 'rizz_plugin' is duplicate, skipped
# type 'rizz_http_status' is duplicate, skipped
# type 'rizz_http_state' is duplicate, skipped
# type 'rizz_api_http' is duplicate, skipped
# type 'rizz_refl_type' is duplicate, skipped
# type 'rizz_refl_flags' is duplicate, skipped
# type 'rizz_refl_info' is duplicate, skipped
# type 'rizz__refl_field' is duplicate, skipped
# type 'rizz_api_refl' is duplicate, skipped
{.push hint[ConvFromXtoItselfNotNeeded]: off.}
import macros
macro defineEnum(typ: untyped): untyped =
# Create a `distinct cint` type for C enums since Nim enums
# need to be in order and cannot have duplicates.
result = newNimNode(nnkStmtList)
# Enum as distinct int
result.add quote do:
type
`typ`* = distinct cint
# Enum operations
for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "=="]:
let
ni = newIdentNode(i)
typout = if i in ["<", "<=", "=="]: newIdentNode("bool") else: typ
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.}
proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.}
proc `ni`*(x, y: `typ`): `typout` {.borrow.}
proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y)
# Ops which cannot be borrowed since templates in Nim
for i in [">", ">="]:
let
ni = newIdentNode(i)
op = if i == ">": "<" else: "<="
nop = newIdentNode(op)
result.add quote do:
proc `ni`*(x: `typ`, y: cint): bool = `nop`(y, x)
proc `ni`*(x: cint, y: `typ`): bool = `nop`(y, x)
proc `ni`*(x, y: `typ`): bool = `nop`(y, x)
proc `ni`*(x: `typ`, y: int): bool = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): bool = `ni`(x.cint, y)
# Division, to string
let
dop = newIdentNode("/")
str = newIdentNode("$")
result.add quote do:
proc `dop`*(x, y: `typ`): `typ` =
return `typ`((x.float / y.float).cint)
proc `dop`*(x: `typ`, y: cint): `typ` = `dop`(x, `typ`(y))
proc `dop`*(x: cint, y: `typ`): `typ` = `dop`(`typ`(x), y)
proc `str`*(x: `typ`): string {.borrow.}
{.pragma: imprizzHdr,
header: "/home/gt/.cache/nim/nimterop/nimrizz/include/rizz/rizz.h".}
{.experimental: "codeReordering".}
defineEnum(sx_whence)
defineEnum(sx_file_open_flag) ## ```
## for proper file buffering (SX_FILE_NOCACHE) alignment requirements under win32, visit:
## https:docs.microsoft.com/en-us/windows/win32/fileio/file-buffering
## as a general rule, if you use SX_FILE_NOCACHE flag, use page aligned memory buffers
## obtained from sx_os_pagesz(), or allocate memory with virtual memory (virtual-alloc.h)
## ```
defineEnum(sx_iff_type)
defineEnum(sx_iff_flag)
defineEnum(sx_job_priority)
defineEnum(Enum_rizzh1) ## ```
## @app
## ```
defineEnum(rizz_app_event_type)
defineEnum(rizz_keycode) ## ```
## key codes are the same names and values as GLFW
## ```
defineEnum(rizz_mouse_btn)
defineEnum(rizz_modifier_keys)
defineEnum(rizz_vfs_flags)
defineEnum(rizz_asset_load_flags) ## ```
## @asset
## ```
defineEnum(rizz_asset_state)
defineEnum(rizz_app_flags)
defineEnum(rizz_core_flags)
defineEnum(rizz_log_level) ## ```
## logging backend entry type
## ```
defineEnum(rizz_mem_id)
defineEnum(rizz_profile_flag)
defineEnum(Enum_rizzh2) ## ```
## various compile-time constants
##
## FIXME: it may make sense to convert some of those into defines so
## that the user code can override them.
## ```
defineEnum(sg_backend) ## ```
## sg_backend
##
## The active 3D-API backend, use the function sg_query_backend()
## to get the currently active backend.
##
## For returned value corresponds with the compile-time define to select
## a backend, with the only exception of SOKOL_GLES3: this may
## return SG_BACKEND_GLES2 if the backend has to fallback to GLES2 mode
## because GLES3 isn't supported.
## ```
defineEnum(sg_pixel_format) ## ```
## sg_pixel_format
##
## sokol_gfx.h basically uses the same pixel formats as WebGPU, since these
## are supported on most newer GPUs. GLES2 and WebGL has a much smaller
## subset of available pixel formats. Call sg_query_pixelformat() to check
## at runtime if a pixel format supports the desired features.
##
## A pixelformat name consist of three parts:
##
## - components (R, RG, RGB or RGBA)
## - bit width per component (8, 16 or 32)
## - component data type:
## - unsigned normalized (no postfix)
## - signed normalized (SN postfix)
## - unsigned integer (UI postfix)
## - signed integer (SI postfix)
## - float (F postfix)
##
## Not all pixel formats can be used for everything, call sg_query_pixelformat()
## to inspect the capabilities of a given pixelformat. The function returns
## an sg_pixelformat_info struct with the following bool members:
##
## - sample: the pixelformat can be sampled as texture at least with
## nearest filtering
## - filter: the pixelformat can be samples as texture with linear
## filtering
## - render: the pixelformat can be used for render targets
## - blend: blending is supported when using the pixelformat for
## render targets
## - msaa: multisample-antialiasing is supported when using the
## pixelformat for render targets
## - depth: the pixelformat can be used for depth-stencil attachments
##
## When targeting GLES2/WebGL, the only safe formats to use
## as texture are SG_PIXELFORMAT_R8 and SG_PIXELFORMAT_RGBA8. For rendering
## in GLES2/WebGL, only SG_PIXELFORMAT_RGBA8 is safe. All other formats
## must be checked via sg_query_pixelformats().
##
## The default pixel format for texture images is SG_PIXELFORMAT_RGBA8.
##
## The default pixel format for render target images is platform-dependent:
## - for Metal and D3D11 it is SG_PIXELFORMAT_BGRA8
## - for GL backends it is SG_PIXELFORMAT_RGBA8
##
## This is mainly because of the default framebuffer which is setup outside
## of sokol_gfx.h. On some backends, using BGRA for the default frame buffer
## allows more efficient frame flips. For your own offscreen-render-targets,
## use whatever renderable pixel format is convenient for you.
## ```
defineEnum(sg_resource_state) ## ```
## sg_resource_state
##
## The current state of a resource in its resource pool.
## Resources start in the INITIAL state, which means the
## pool slot is unoccupied and can be allocated. When a resource is
## created, first an id is allocated, and the resource pool slot
## is set to state ALLOC. After allocation, the resource is
## initialized, which may result in the VALID or FAILED state. The
## reason why allocation and initialization are separate is because
## some resource types (e.g. buffers and images) might be asynchronously
## initialized by the user application. If a resource which is not
## in the VALID state is attempted to be used for rendering, rendering
## operations will silently be dropped.
##
## The special INVALID state is returned in sg_query_xxx_state() if no
## resource object exists for the provided resource id.
## ```
defineEnum(sg_usage) ## ```
## sg_usage
##
## A resource usage hint describing the update strategy of
## buffers and images. This is used in the sg_buffer_desc.usage
## and sg_image_desc.usage members when creating buffers
## and images:
##
## SG_USAGE_IMMUTABLE: the resource will never be updated with
## new data, instead the content of the
## resource must be provided on creation
## SG_USAGE_DYNAMIC: the resource will be updated infrequently
## with new data (this could range from "once
## after creation", to "quite often but not
## every frame")
## SG_USAGE_STREAM: the resource will be updated each frame
## with new content
##
## The rendering backends use this hint to prevent that the
## CPU needs to wait for the GPU when attempting to update
## a resource that might be currently accessed by the GPU.
##
## Resource content is updated with the function sg_update_buffer() for
## buffer objects, and sg_update_image() for image objects. Only
## one update is allowed per frame and resource object. The
## application must update all data required for rendering (this
## means that the update data can be smaller than the resource size,
## if only a part of the overall resource size is used for rendering,
## you only need to make sure that the data thatis* used is valid).
##
## The default usage is SG_USAGE_IMMUTABLE.
## ```
defineEnum(sg_buffer_type) ## ```
## sg_buffer_type
##
## This indicates whether a buffer contains vertex- or index-data,
## used in the sg_buffer_desc.type member when creating a buffer.
##
## The default value is SG_BUFFERTYPE_VERTEXBUFFER.
## ```
defineEnum(sg_index_type) ## ```
## sg_index_type
##
## Indicates whether indexed rendering (fetching vertex-indices from an
## index buffer) is used, and if yes, the index data type (16- or 32-bits).
## This is used in the sg_pipeline_desc.index_type member when creating a
## pipeline object.
##
## The default index type is SG_INDEXTYPE_NONE.
## ```
defineEnum(sg_image_type) ## ```
## sg_image_type
##
## Indicates the basic type of an image object (2D-texture, cubemap,
## 3D-texture or 2D-array-texture). 3D- and array-textures are not supported
## on the GLES2/WebGL backend (use sg_query_features().imagetype_3d and
## sg_query_features().imagetype_array to check for support). The image type
## is used in the sg_image_desc.type member when creating an image, and
## in sg_shader_image_desc when describing a shader's texture sampler binding.
##
## The default image type when creating an image is SG_IMAGETYPE_2D.
## ```
defineEnum(sg_sampler_type) ## ```
## sg_sampler_type
##
## Indicates the basic data type of a shader's texture sampler which
## can be float , unsigned integer or signed integer. The sampler
## type is used in the sg_shader_image_desc to describe the
## sampler type of a shader's texture sampler binding.
##
## The default sampler type is SG_SAMPLERTYPE_FLOAT.
## ```
defineEnum(sg_cube_face) ## ```
## sg_cube_face
##
## The cubemap faces. Use these as indices in the sg_image_desc.content
## array.
## ```
defineEnum(sg_shader_stage) ## ```
## sg_shader_stage
##
## There are 2 shader stages: vertex- and fragment-shader-stage.
## Each shader stage consists of:
##
## - one slot for a shader function (provided as source- or byte-code)
## - SG_MAX_SHADERSTAGE_UBS slots for uniform blocks
## - SG_MAX_SHADERSTAGE_IMAGES slots for images used as textures by
## the shader function
## ```
defineEnum(sg_primitive_type) ## ```
## sg_primitive_type
##
## This is the common subset of 3D primitive types supported across all 3D
## APIs. This is used in the sg_pipeline_desc.primitive_type member when
## creating a pipeline object.
##
## The default primitive type is SG_PRIMITIVETYPE_TRIANGLES.
## ```
defineEnum(sg_filter) ## ```
## sg_filter
##
## The filtering mode when sampling a texture image. This is
## used in the sg_image_desc.min_filter and sg_image_desc.mag_filter
## members when creating an image object.
##
## The default filter mode is SG_FILTER_NEAREST.
## ```
defineEnum(sg_wrap) ## ```
## sg_wrap
##
## The texture coordinates wrapping mode when sampling a texture
## image. This is used in the sg_image_desc.wrap_u, .wrap_v
## and .wrap_w members when creating an image.
##
## The default wrap mode is SG_WRAP_REPEAT.
##
## NOTE: SG_WRAP_CLAMP_TO_BORDER is not supported on all backends
## and platforms. To check for support, call sg_query_features()
## and check the "clamp_to_border" boolean in the returned
## sg_features struct.
##
## Platforms which don't support SG_WRAP_CLAMP_TO_BORDER will silently fall back
## to SG_WRAP_CLAMP_TO_EDGE without a validation error.
##
## Platforms which support clamp-to-border are:
##
## - all desktop GL platforms
## - Metal on macOS
## - D3D11
##
## Platforms which do not support clamp-to-border:
##
## - GLES2/3 and WebGL/WebGL2
## - Metal on iOS
## ```
defineEnum(sg_border_color) ## ```
## sg_border_color
##
## The border color to use when sampling a texture, and the UV wrap
## mode is SG_WRAP_CLAMP_TO_BORDER.
##
## The default border color is SG_BORDERCOLOR_OPAQUE_BLACK
## ```
defineEnum(sg_vertex_format) ## ```
## sg_vertex_format
##
## The data type of a vertex component. This is used to describe
## the layout of vertex data when creating a pipeline object.
## ```
defineEnum(sg_vertex_step) ## ```
## sg_vertex_step
##
## Defines whether the input pointer of a vertex input stream is advanced
## 'per vertex' or 'per instance'. The default step-func is
## SG_VERTEXSTEP_PER_VERTEX. SG_VERTEXSTEP_PER_INSTANCE is used with
## instanced-rendering.
##
## The vertex-step is part of the vertex-layout definition
## when creating pipeline objects.
## ```
defineEnum(sg_uniform_type) ## ```
## sg_uniform_type
##
## The data type of a uniform block member. This is used to
## describe the internal layout of uniform blocks when creating
## a shader object.
## ```
defineEnum(sg_cull_mode) ## ```
## sg_cull_mode
##
## The face-culling mode, this is used in the
## sg_pipeline_desc.rasterizer.cull_mode member when creating a
## pipeline object.
##
## The default cull mode is SG_CULLMODE_NONE
## ```
defineEnum(sg_face_winding) ## ```
## sg_face_winding
##
## The vertex-winding rule that determines a front-facing primitive. This
## is used in the member sg_pipeline_desc.rasterizer.face_winding
## when creating a pipeline object.
##
## The default winding is SG_FACEWINDING_CW (clockwise)
## ```
defineEnum(sg_compare_func) ## ```
## sg_compare_func
##
## The compare-function for depth- and stencil-ref tests.
## This is used when creating pipeline objects in the members:
##
## sg_pipeline_desc
## .depth_stencil
## .depth_compare_func
## .stencil_front.compare_func
## .stencil_back.compare_func
##
## The default compare func for depth- and stencil-tests is
## SG_COMPAREFUNC_ALWAYS.
## ```
defineEnum(sg_stencil_op) ## ```
## sg_stencil_op
##
## The operation performed on a currently stored stencil-value when a
## comparison test passes or fails. This is used when creating a pipeline
## object in the members:
##
## sg_pipeline_desc
## .depth_stencil
## .stencil_front
## .fail_op
## .depth_fail_op
## .pass_op
## .stencil_back
## .fail_op
## .depth_fail_op
## .pass_op
##
## The default value is SG_STENCILOP_KEEP.
## ```
defineEnum(sg_blend_factor) ## ```
## sg_blend_factor
##
## The source and destination factors in blending operations.
## This is used in the following members when creating a pipeline object:
##
## sg_pipeline_desc
## .blend
## .src_factor_rgb
## .dst_factor_rgb
## .src_factor_alpha
## .dst_factor_alpha
##
## The default value is SG_BLENDFACTOR_ONE for source
## factors, and SG_BLENDFACTOR_ZERO for destination factors.
## ```
defineEnum(sg_blend_op) ## ```
## sg_blend_op
##
## Describes how the source and destination values are combined in the
## fragment blending operation. It is used in the following members when
## creating a pipeline object:
##
## sg_pipeline_desc
## .blend
## .op_rgb
## .op_alpha
##
## The default value is SG_BLENDOP_ADD.
## ```
defineEnum(sg_color_mask) ## ```
## sg_color_mask
##
## Selects the color channels when writing a fragment color to the
## framebuffer. This is used in the members
## sg_pipeline_desc.blend.color_write_mask when creating a pipeline object.
##
## The default colormask is SG_COLORMASK_RGBA (write all colors channels)
##
## NOTE: since the color mask value 0 is reserved for the default value
## (SG_COLORMASK_RGBA), use SG_COLORMASK_NONE if all color channels
## should be disabled.
## ```
defineEnum(sg_action) ## ```
## sg_action
##
## Defines what action should be performed at the start of a render pass:
##
## SG_ACTION_CLEAR: clear the render target image
## SG_ACTION_LOAD: load the previous content of the render target image
## SG_ACTION_DONTCARE: leave the render target image content undefined
##
## This is used in the sg_pass_action structure.
##
## The default action for all pass attachments is SG_ACTION_CLEAR, with the
## clear color rgba = {0.5f, 0.5f, 0.5f, 1.0f], depth=1.0 and stencil=0.
##
## If you want to override the default behaviour, it is important to not
## only set the clear color, but the 'action' field as well (as long as this
## is in its _SG_ACTION_DEFAULT, the value fields will be ignored).
## ```
defineEnum(rizz_gfx_backend)
defineEnum(rizz_shader_lang)
defineEnum(rizz_shader_stage)
defineEnum(rizz_shader_code_type)
defineEnum(rizz_gfx_perframe_trace_zone) ## ```
## per-frame stats
## ```
defineEnum(rizz_api_type)
defineEnum(rizz_plugin_event)
defineEnum(rizz_plugin_crash)
defineEnum(rizz_plugin_info_flags)
defineEnum(rizz_http_status) ## ```
## @http
## ```
defineEnum(rizz_refl_type) ## ```
## @reflect
## ```
defineEnum(rizz_refl_flags)
const
SX_ARCH_32BIT* = 0
SX_ARCH_64BIT* = 0
SX_COMPILER_CLANG* = 0
SX_COMPILER_CLANG_ANALYZER* = 0
SX_COMPILER_CLANG_CL* = 0
SX_COMPILER_GCC* = 0
SX_COMPILER_MSVC* = 0
SX_CPU_ENDIAN_BIG* = 0
SX_CPU_ENDIAN_LITTLE* = 0
SX_CPU_ARM* = 0
SX_CPU_JIT* = 0
SX_CPU_MIPS* = 0
SX_CPU_PPC* = 0
SX_CPU_RISCV* = 0
SX_CPU_X86* = 0
SX_CRT_BIONIC* = 0
SX_CRT_GLIBC* = 0
SX_CRT_LIBCXX* = 0
SX_CRT_MINGW* = 0
SX_CRT_MSVC* = 0
SX_CRT_NEWLIB* = 0
SX_CRT_MUSL* = 0
SX_CRT_NONE* = 0
SX_PLATFORM_ANDROID* = 0
SX_PLATFORM_BSD* = 0
SX_PLATFORM_EMSCRIPTEN* = 0
SX_PLATFORM_HURD* = 0
SX_PLATFORM_IOS* = 0
SX_PLATFORM_LINUX* = 0
SX_PLATFORM_NX* = 0
SX_PLATFORM_OSX* = 0
SX_PLATFORM_PS4* = 0
SX_PLATFORM_RPI* = 0
SX_PLATFORM_STEAMLINK* = 0
SX_PLATFORM_WINDOWS* = 0
SX_PLATFORM_WINRT* = 0
SX_PLATFORM_XBOXONE* = 0
SX_CACHE_LINE_SIZE* = 64
SX_PLATFORM_POSIX* = (0 or typeof(0)(SX_PLATFORM_ANDROID) or
typeof(0)(SX_PLATFORM_BSD) or
typeof(0)(SX_PLATFORM_EMSCRIPTEN) or
typeof(0)(SX_PLATFORM_HURD) or
typeof(0)(SX_PLATFORM_IOS) or
typeof(0)(SX_PLATFORM_LINUX) or
typeof(0)(SX_PLATFORM_NX) or
typeof(0)(SX_PLATFORM_OSX) or
typeof(0)(SX_PLATFORM_PS4) or
typeof(0)(SX_PLATFORM_RPI) or
typeof(0)(SX_PLATFORM_STEAMLINK))
SX_PLATFORM_NONE* = (not (0 or typeof(0)(SX_PLATFORM_ANDROID) or
typeof(0)(SX_PLATFORM_BSD) or
typeof(0)(SX_PLATFORM_EMSCRIPTEN) or
typeof(0)(SX_PLATFORM_HURD) or
typeof(0)(SX_PLATFORM_IOS) or
typeof(0)(SX_PLATFORM_LINUX) or
typeof(0)(SX_PLATFORM_NX) or
typeof(0)(SX_PLATFORM_OSX) or
typeof(0)(SX_PLATFORM_PS4) or
typeof(0)(SX_PLATFORM_RPI) or
typeof(0)(SX_PLATFORM_STEAMLINK) or
typeof(0)(SX_PLATFORM_WINDOWS) or
typeof(0)(SX_PLATFORM_WINRT) or
typeof(0)(SX_PLATFORM_XBOXONE)))
SX_PLATFORM_NAME* = "Linux"
SX_PLATFORM_APPLE* = (
0 or typeof(0)(SX_PLATFORM_IOS) or typeof(0)(SX_PLATFORM_OSX))
SX_CPU_NAME* = "x86"
SX_CRT_NAME* = "None"
SX_ARCH_NAME* = "64-bit"
RIZZ_GRAPHICS_API_D3D* = 0
RIZZ_GRAPHICS_API_METAL* = 0
RIZZ_GRAPHICS_API_GL* = 0
RIZZ_GRAPHICS_API_GLES* = 0
RIZZ_CONFIG_HOT_LOADING* = 1
RIZZ_CONFIG_PLUGIN_UPDATE_INTERVAL* = 1.0'f64
RIZZ_CONFIG_ASSET_POOL_SIZE* = 256
RIZZ_CONFIG_MAX_HTTP_REQUESTS* = 32
RIZZ_CONFIG_DEBUG_MEMORY* = 1
RIZZ_CONFIG_MAX_PLUGINS* = 64
RIZZ_CONFIG_EVENTQUEUE_MAX_EVENTS* = 4
RIZZ_MAX_PATH* = 256
SX_CONFIG_SHARED_LIB* = 0
SX_DEBUG* = 0
SX_CONFIG_DEBUG_ALLOCATOR* = 0
SX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT* = 8
SX_CONFIG_HASHTBL_DEBUG* = 1
SX_CONFIG_STDMATH* = 1
SX_CONFIG_HANDLE_GEN_BITS* = 14
SX_CONFIG_SIMD_DISABLE* = 0
SX_CONFIG_ARRAY_INIT_SIZE* = 8
SX_WHENCE_BEGIN* = (0).sx_whence
SX_WHENCE_CURRENT* = (SX_WHENCE_BEGIN + 1).sx_whence
SX_WHENCE_END* = (SX_WHENCE_CURRENT + 1).sx_whence
SX_FILE_READ* = (0x00000001).sx_file_open_flag ## ```
## open for reading
## ```
SX_FILE_WRITE* = (0x00000002).sx_file_open_flag ## ```
## open for writing
## ```
SX_FILE_APPEND* = (0x00000004).sx_file_open_flag ## ```
## append to the end of the file (write mode only)
## ```
SX_FILE_NOCACHE* = (0x00000008).sx_file_open_flag ## ```
## disable cache, suitable for large files, best bet is to align buffers to virtual memory pages
## ```
SX_FILE_WRITE_THROUGH* = (0x00000010).sx_file_open_flag ## ```
## write-through, write meta information to disk immediately
## ```
SX_FILE_SEQ_SCAN* = (0x00000020).sx_file_open_flag ## ```
## optimize cache for sequential scan (not used in NOCACHE)
## ```
SX_FILE_RANDOM_ACCESS* = (0x00000040).sx_file_open_flag ## ```
## optimize cache for random access (not used in NOCACHE)
## ```
SX_FILE_TEMP* = (0x00000080).sx_file_open_flag ## ```
## optimize cache for random access (not used in NOCACHE)
## ```
SX_IFFTYPE_MEM_READER* = (0).sx_iff_type
SX_IFFTYPE_MEM_WRITER* = (SX_IFFTYPE_MEM_READER + 1).sx_iff_type
SX_IFFTYPE_DISK_READER* = (SX_IFFTYPE_MEM_WRITER + 1).sx_iff_type
SX_IFFTYPE_DISK_WRITER* = (SX_IFFTYPE_DISK_READER + 1).sx_iff_type
SX_IFFFLAG_READ_ALL_CHUNKS* = (0x00000001).sx_iff_flag ## ```
## Read all chunks on initialize. This may be faster for
## searching through multiple chunks, but not recommended
## for sequntial reading of binary files
## ```
SX_IFFFLAG_APPEND* = (0x00000002).sx_iff_flag ## ```
## initialize IFF as writing and appending to the end
## ```
SX_JOB_PRIORITY_HIGH* = (0).sx_job_priority
SX_JOB_PRIORITY_NORMAL* = (SX_JOB_PRIORITY_HIGH + 1).sx_job_priority
SX_JOB_PRIORITY_LOW* = (SX_JOB_PRIORITY_NORMAL + 1).sx_job_priority
SX_JOB_PRIORITY_COUNT* = (SX_JOB_PRIORITY_LOW + 1).sx_job_priority
SX_PI* = 3.141592653589793'f64
SX_PI2* = 6.283185307179586'f64
SX_INVPI* = typeof(1.0'f64)(1.0'f64 / typeof(1.0'f64)(3.141592653589793'f64))
SX_PIHALF* = 1.570796326794897'f64
SX_PIQUARTER* = 0.7853981633974483'f64
SX_SQRT2* = 1.414213562373095'f64
SX_LOG_NAT10* = 2.302585092994046'f64
SX_INVLOG_NAT2* = 1.442695040888963'f64
SX_LOG_NAT2H* = 0.6931471805599453'f64
SX_LOG_NAT2L* = 1.908214929270588e-10'f64
SX_E* = 2.718281828459045'f64
SX_NEAR_ZERO = 1.0 / (1 shl 28)
SX_FLOAT_MIN* = 1.175494e-38'f64
SX_FLOAT_MAX* = 3.402823e+38'f64
RIZZ_APP_MAX_TOUCHPOINTS* = (8).Enum_rizzh1
RIZZ_APP_MAX_MOUSEBUTTONS* = (3).Enum_rizzh1
RIZZ_APP_MAX_KEYCODES* = (512).Enum_rizzh1
RIZZ_APP_EVENTTYPE_INVALID* = (0).rizz_app_event_type
RIZZ_APP_EVENTTYPE_KEY_DOWN* = (RIZZ_APP_EVENTTYPE_INVALID + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_KEY_UP* = (RIZZ_APP_EVENTTYPE_KEY_DOWN + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_CHAR* = (RIZZ_APP_EVENTTYPE_KEY_UP + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_DOWN* = (RIZZ_APP_EVENTTYPE_CHAR + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_UP* = (RIZZ_APP_EVENTTYPE_MOUSE_DOWN + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_SCROLL* = (RIZZ_APP_EVENTTYPE_MOUSE_UP + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_MOVE* = (RIZZ_APP_EVENTTYPE_MOUSE_SCROLL + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_ENTER* = (RIZZ_APP_EVENTTYPE_MOUSE_MOVE + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_MOUSE_LEAVE* = (RIZZ_APP_EVENTTYPE_MOUSE_ENTER + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_TOUCHES_BEGAN* = (RIZZ_APP_EVENTTYPE_MOUSE_LEAVE + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_TOUCHES_MOVED* = (RIZZ_APP_EVENTTYPE_TOUCHES_BEGAN + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_TOUCHES_ENDED* = (RIZZ_APP_EVENTTYPE_TOUCHES_MOVED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_TOUCHES_CANCELLED* = (RIZZ_APP_EVENTTYPE_TOUCHES_ENDED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_RESIZED* = (RIZZ_APP_EVENTTYPE_TOUCHES_CANCELLED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_ICONIFIED* = (RIZZ_APP_EVENTTYPE_RESIZED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_RESTORED* = (RIZZ_APP_EVENTTYPE_ICONIFIED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_SUSPENDED* = (RIZZ_APP_EVENTTYPE_RESTORED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_RESUMED* = (RIZZ_APP_EVENTTYPE_SUSPENDED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_UPDATE_CURSOR* = (RIZZ_APP_EVENTTYPE_RESUMED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_QUIT_REQUESTED* = (RIZZ_APP_EVENTTYPE_UPDATE_CURSOR + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_CLIPBOARD_PASTED* = (RIZZ_APP_EVENTTYPE_QUIT_REQUESTED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_NUM* = (RIZZ_APP_EVENTTYPE_CLIPBOARD_PASTED + 1).rizz_app_event_type
RIZZ_APP_EVENTTYPE_UPDATE_APIS* = (RIZZ_APP_EVENTTYPE_NUM + 1).rizz_app_event_type ## ```
## happens when a plugin updates it's API
## ```
RIZZ_APP_EVENTTYPE_FORCE_U32* = (0x07FFFFFF).rizz_app_event_type ## ```
## happens when a plugin updates it's API
## ```
RIZZ_APP_KEYCODE_INVALID* = (0).rizz_keycode
RIZZ_APP_KEYCODE_SPACE* = (32).rizz_keycode
RIZZ_APP_KEYCODE_APOSTROPHE* = (39).rizz_keycode ## ```
## '
## ```
RIZZ_APP_KEYCODE_COMMA* = (44).rizz_keycode ## ```
## ,
## ```
RIZZ_APP_KEYCODE_MINUS* = (45).rizz_keycode ## ```
## -
## ```
RIZZ_APP_KEYCODE_PERIOD* = (46).rizz_keycode ## ```
## .
## ```
RIZZ_APP_KEYCODE_SLASH* = (47).rizz_keycode ## ```
## /
## ```
RIZZ_APP_KEYCODE_0* = (48).rizz_keycode ## ```
## /
## ```
RIZZ_APP_KEYCODE_1* = (49).rizz_keycode
RIZZ_APP_KEYCODE_2* = (50).rizz_keycode
RIZZ_APP_KEYCODE_3* = (51).rizz_keycode
RIZZ_APP_KEYCODE_4* = (52).rizz_keycode
RIZZ_APP_KEYCODE_5* = (53).rizz_keycode
RIZZ_APP_KEYCODE_6* = (54).rizz_keycode
RIZZ_APP_KEYCODE_7* = (55).rizz_keycode
RIZZ_APP_KEYCODE_8* = (56).rizz_keycode
RIZZ_APP_KEYCODE_9* = (57).rizz_keycode
RIZZ_APP_KEYCODE_SEMICOLON* = (59).rizz_keycode ## ```
## ;
## ```
RIZZ_APP_KEYCODE_EQUAL* = (61).rizz_keycode ## ```
## =
## ```
RIZZ_APP_KEYCODE_A* = (65).rizz_keycode ## ```
## =
## ```
RIZZ_APP_KEYCODE_B* = (66).rizz_keycode
RIZZ_APP_KEYCODE_C* = (67).rizz_keycode
RIZZ_APP_KEYCODE_D* = (68).rizz_keycode
RIZZ_APP_KEYCODE_E* = (69).rizz_keycode
RIZZ_APP_KEYCODE_F* = (70).rizz_keycode
RIZZ_APP_KEYCODE_G* = (71).rizz_keycode
RIZZ_APP_KEYCODE_H* = (72).rizz_keycode
RIZZ_APP_KEYCODE_I* = (73).rizz_keycode
RIZZ_APP_KEYCODE_J* = (74).rizz_keycode
RIZZ_APP_KEYCODE_K* = (75).rizz_keycode
RIZZ_APP_KEYCODE_L* = (76).rizz_keycode
RIZZ_APP_KEYCODE_M* = (77).rizz_keycode
RIZZ_APP_KEYCODE_N* = (78).rizz_keycode
RIZZ_APP_KEYCODE_O* = (79).rizz_keycode
RIZZ_APP_KEYCODE_P* = (80).rizz_keycode
RIZZ_APP_KEYCODE_Q* = (81).rizz_keycode
RIZZ_APP_KEYCODE_R* = (82).rizz_keycode
RIZZ_APP_KEYCODE_S* = (83).rizz_keycode
RIZZ_APP_KEYCODE_T* = (84).rizz_keycode
RIZZ_APP_KEYCODE_U* = (85).rizz_keycode
RIZZ_APP_KEYCODE_V* = (86).rizz_keycode
RIZZ_APP_KEYCODE_W* = (87).rizz_keycode
RIZZ_APP_KEYCODE_X* = (88).rizz_keycode
RIZZ_APP_KEYCODE_Y* = (89).rizz_keycode
RIZZ_APP_KEYCODE_Z* = (90).rizz_keycode
RIZZ_APP_KEYCODE_LEFT_BRACKET* = (91).rizz_keycode ## ```
## [
## ```
RIZZ_APP_KEYCODE_BACKSLASH* = (92).rizz_keycode ## ```
## \
## ```
RIZZ_APP_KEYCODE_RIGHT_BRACKET* = (93).rizz_keycode ## ```
## ]
## ```
RIZZ_APP_KEYCODE_GRAVE_ACCENT* = (96).rizz_keycode ## ```
##
## ```
RIZZ_APP_KEYCODE_WORLD_1* = (161).rizz_keycode ## ```
## non-US #1
## ```
RIZZ_APP_KEYCODE_WORLD_2* = (162).rizz_keycode ## ```
## non-US #2
## ```
RIZZ_APP_KEYCODE_ESCAPE* = (256).rizz_keycode ## ```
## non-US #2
## ```
RIZZ_APP_KEYCODE_ENTER* = (257).rizz_keycode
RIZZ_APP_KEYCODE_TAB* = (258).rizz_keycode
RIZZ_APP_KEYCODE_BACKSPACE* = (259).rizz_keycode
RIZZ_APP_KEYCODE_INSERT* = (260).rizz_keycode
RIZZ_APP_KEYCODE_DELETE* = (261).rizz_keycode
RIZZ_APP_KEYCODE_RIGHT* = (262).rizz_keycode
RIZZ_APP_KEYCODE_LEFT* = (263).rizz_keycode
RIZZ_APP_KEYCODE_DOWN* = (264).rizz_keycode
RIZZ_APP_KEYCODE_UP* = (265).rizz_keycode
RIZZ_APP_KEYCODE_PAGE_UP* = (266).rizz_keycode
RIZZ_APP_KEYCODE_PAGE_DOWN* = (267).rizz_keycode
RIZZ_APP_KEYCODE_HOME* = (268).rizz_keycode
RIZZ_APP_KEYCODE_END* = (269).rizz_keycode
RIZZ_APP_KEYCODE_CAPS_LOCK* = (280).rizz_keycode
RIZZ_APP_KEYCODE_SCROLL_LOCK* = (281).rizz_keycode
RIZZ_APP_KEYCODE_NUM_LOCK* = (282).rizz_keycode
RIZZ_APP_KEYCODE_PRINT_SCREEN* = (283).rizz_keycode
RIZZ_APP_KEYCODE_PAUSE* = (284).rizz_keycode
RIZZ_APP_KEYCODE_F1* = (290).rizz_keycode
RIZZ_APP_KEYCODE_F2* = (291).rizz_keycode
RIZZ_APP_KEYCODE_F3* = (292).rizz_keycode
RIZZ_APP_KEYCODE_F4* = (293).rizz_keycode
RIZZ_APP_KEYCODE_F5* = (294).rizz_keycode
RIZZ_APP_KEYCODE_F6* = (295).rizz_keycode
RIZZ_APP_KEYCODE_F7* = (296).rizz_keycode
RIZZ_APP_KEYCODE_F8* = (297).rizz_keycode
RIZZ_APP_KEYCODE_F9* = (298).rizz_keycode
RIZZ_APP_KEYCODE_F10* = (299).rizz_keycode
RIZZ_APP_KEYCODE_F11* = (300).rizz_keycode
RIZZ_APP_KEYCODE_F12* = (301).rizz_keycode
RIZZ_APP_KEYCODE_F13* = (302).rizz_keycode
RIZZ_APP_KEYCODE_F14* = (303).rizz_keycode
RIZZ_APP_KEYCODE_F15* = (304).rizz_keycode
RIZZ_APP_KEYCODE_F16* = (305).rizz_keycode
RIZZ_APP_KEYCODE_F17* = (306).rizz_keycode
RIZZ_APP_KEYCODE_F18* = (307).rizz_keycode
RIZZ_APP_KEYCODE_F19* = (308).rizz_keycode
RIZZ_APP_KEYCODE_F20* = (309).rizz_keycode
RIZZ_APP_KEYCODE_F21* = (310).rizz_keycode
RIZZ_APP_KEYCODE_F22* = (311).rizz_keycode
RIZZ_APP_KEYCODE_F23* = (312).rizz_keycode
RIZZ_APP_KEYCODE_F24* = (313).rizz_keycode
RIZZ_APP_KEYCODE_F25* = (314).rizz_keycode
RIZZ_APP_KEYCODE_KP_0* = (320).rizz_keycode
RIZZ_APP_KEYCODE_KP_1* = (321).rizz_keycode
RIZZ_APP_KEYCODE_KP_2* = (322).rizz_keycode
RIZZ_APP_KEYCODE_KP_3* = (323).rizz_keycode
RIZZ_APP_KEYCODE_KP_4* = (324).rizz_keycode
RIZZ_APP_KEYCODE_KP_5* = (325).rizz_keycode
RIZZ_APP_KEYCODE_KP_6* = (326).rizz_keycode
RIZZ_APP_KEYCODE_KP_7* = (327).rizz_keycode
RIZZ_APP_KEYCODE_KP_8* = (328).rizz_keycode
RIZZ_APP_KEYCODE_KP_9* = (329).rizz_keycode
RIZZ_APP_KEYCODE_KP_DECIMAL* = (330).rizz_keycode
RIZZ_APP_KEYCODE_KP_DIVIDE* = (331).rizz_keycode
RIZZ_APP_KEYCODE_KP_MULTIPLY* = (332).rizz_keycode
RIZZ_APP_KEYCODE_KP_SUBTRACT* = (333).rizz_keycode
RIZZ_APP_KEYCODE_KP_ADD* = (334).rizz_keycode
RIZZ_APP_KEYCODE_KP_ENTER* = (335).rizz_keycode
RIZZ_APP_KEYCODE_KP_EQUAL* = (336).rizz_keycode
RIZZ_APP_KEYCODE_LEFT_SHIFT* = (340).rizz_keycode
RIZZ_APP_KEYCODE_LEFT_CONTROL* = (341).rizz_keycode
RIZZ_APP_KEYCODE_LEFT_ALT* = (342).rizz_keycode
RIZZ_APP_KEYCODE_LEFT_SUPER* = (343).rizz_keycode
RIZZ_APP_KEYCODE_RIGHT_SHIFT* = (344).rizz_keycode
RIZZ_APP_KEYCODE_RIGHT_CONTROL* = (345).rizz_keycode
RIZZ_APP_KEYCODE_RIGHT_ALT* = (346).rizz_keycode
RIZZ_APP_KEYCODE_RIGHT_SUPER* = (347).rizz_keycode
RIZZ_APP_KEYCODE_MENU* = (348).rizz_keycode
RIZZ_APP_MOUSEBUTTON_INVALID* = (-1).rizz_mouse_btn
RIZZ_APP_MOUSEBUTTON_LEFT* = (0).rizz_mouse_btn
RIZZ_APP_MOUSEBUTTON_RIGHT* = (1).rizz_mouse_btn
RIZZ_APP_MOUSEBUTTON_MIDDLE* = (2).rizz_mouse_btn
RIZZ_APP_MODIFIERKEY_SHIFT* = ((1 shl typeof(1)(0))).rizz_modifier_keys
RIZZ_APP_MODIFIERKEY_CTRL* = ((1 shl typeof(1)(1))).rizz_modifier_keys
RIZZ_APP_MODIFIERKEY_ALT* = ((1 shl typeof(1)(2))).rizz_modifier_keys
RIZZ_APP_MODIFIERKEY_SUPER* = ((1 shl typeof(1)(3))).rizz_modifier_keys
RIZZ_VFS_FLAG_NONE* = (0x00000001).rizz_vfs_flags
RIZZ_VFS_FLAG_ABSOLUTE_PATH* = (0x00000002).rizz_vfs_flags
RIZZ_VFS_FLAG_TEXT_FILE* = (0x00000004).rizz_vfs_flags
RIZZ_VFS_FLAG_APPEND* = (0x00000008).rizz_vfs_flags
RIZZ_ASSET_LOAD_FLAG_NONE* = (0x00000000).rizz_asset_load_flags
RIZZ_ASSET_LOAD_FLAG_ABSOLUTE_PATH* = (0x00000001).rizz_asset_load_flags
RIZZ_ASSET_LOAD_FLAG_WAIT_ON_LOAD* = (0x00000002).rizz_asset_load_flags
RIZZ_ASSET_LOAD_FLAG_RELOAD* = (0x00000004).rizz_asset_load_flags
RIZZ_ASSET_STATE_ZOMBIE* = (0).rizz_asset_state
RIZZ_ASSET_STATE_OK* = (RIZZ_ASSET_STATE_ZOMBIE + 1).rizz_asset_state
RIZZ_ASSET_STATE_FAILED* = (RIZZ_ASSET_STATE_OK + 1).rizz_asset_state
RIZZ_ASSET_STATE_LOADING* = (RIZZ_ASSET_STATE_FAILED + 1).rizz_asset_state
RIZZ_MAX_TEMP_ALLOCS* = 64
RIZZ_APP_FLAG_HIGHDPI* = (0x00000001).rizz_app_flags
RIZZ_APP_FLAG_FULLSCREEN* = (0x00000002).rizz_app_flags
RIZZ_APP_FLAG_ALPHA* = (0x00000004).rizz_app_flags
RIZZ_APP_FLAG_PREMULTIPLIED_ALPHA* = (0x00000008).rizz_app_flags
RIZZ_APP_FLAG_PRESERVE_DRAWING_BUFFER* = (0x00000010).rizz_app_flags
RIZZ_APP_FLAG_HTML5_CANVAS_RESIZE* = (0x00000020).rizz_app_flags
RIZZ_APP_FLAG_IOS_KEYBOARD_RESIZES_CANVAS* = (0x00000040).rizz_app_flags
RIZZ_APP_FLAG_USER_CURSOR* = (0x00000080).rizz_app_flags ## ```
## manage cursor image in RIZZ_APP_EVENTTYPE_UPDATE_CURSOR event
## ```
RIZZ_APP_FLAG_FORCE_GLES2* = (0x00000100).rizz_app_flags ## ```
## manage cursor image in RIZZ_APP_EVENTTYPE_UPDATE_CURSOR event
## ```
RIZZ_CORE_FLAG_LOG_TO_FILE* = (0x00000001).rizz_core_flags ## ```
## log to file defined by app_name.log
## ```
RIZZ_CORE_FLAG_LOG_TO_PROFILER* = (0x00000002).rizz_core_flags ## ```
## log to remote profiler
## ```
RIZZ_CORE_FLAG_PROFILE_GPU* = (0x00000004).rizz_core_flags ## ```
## enable GPU profiling
## ```
RIZZ_CORE_FLAG_DUMP_UNUSED_ASSETS* = (0x00000008).rizz_core_flags ## ```
## write unused-assets.json on exit
## ```
RIZZ_CORE_FLAG_DETECT_LEAKS* = (0x00000010).rizz_core_flags ## ```
## Detect memory leaks (default on in _DEBUG builds)
## ```
RIZZ_LOG_LEVEL_ERROR* = (0).rizz_log_level
RIZZ_LOG_LEVEL_WARNING* = (RIZZ_LOG_LEVEL_ERROR + 1).rizz_log_level
RIZZ_LOG_LEVEL_INFO* = (RIZZ_LOG_LEVEL_WARNING + 1).rizz_log_level
RIZZ_LOG_LEVEL_VERBOSE* = (RIZZ_LOG_LEVEL_INFO + 1).rizz_log_level
RIZZ_LOG_LEVEL_DEBUG* = (RIZZ_LOG_LEVEL_VERBOSE + 1).rizz_log_level
RIZZ_LOG_LEVEL_COUNT* = (RIZZ_LOG_LEVEL_DEBUG + 1).rizz_log_level
RIZZ_MEMID_CORE* = (0).rizz_mem_id
RIZZ_MEMID_GRAPHICS* = (RIZZ_MEMID_CORE + 1).rizz_mem_id
RIZZ_MEMID_AUDIO* = (RIZZ_MEMID_GRAPHICS + 1).rizz_mem_id
RIZZ_MEMID_VFS* = (RIZZ_MEMID_AUDIO + 1).rizz_mem_id
RIZZ_MEMID_REFLECT* = (RIZZ_MEMID_VFS + 1).rizz_mem_id
RIZZ_MEMID_OTHER* = (RIZZ_MEMID_REFLECT + 1).rizz_mem_id
RIZZ_MEMID_DEBUG* = (RIZZ_MEMID_OTHER + 1).rizz_mem_id
RIZZ_MEMID_TOOLSET* = (RIZZ_MEMID_DEBUG + 1).rizz_mem_id
RIZZ_MEMID_INPUT* = (RIZZ_MEMID_TOOLSET + 1).rizz_mem_id
RIZZ_MEMID_GAME* = (RIZZ_MEMID_INPUT + 1).rizz_mem_id
RIZZ_MEMID_COUNT* = (RIZZ_MEMID_GAME + 1).rizz_mem_id
RIZZ_PROFILE_FLAG_AGGREGATE* = (1).rizz_profile_flag ## ```
## Search parent for same-named samples and merge timing instead of adding a new sample
## ```
RIZZ_PROFILE_FLAG_RECURSIVE* = (2).rizz_profile_flag ## ```
## Merge sample with parent if it's the same sample
## ```
SG_INVALID_ID* = (0).Enum_rizzh2
SG_NUM_SHADER_STAGES* = (3).Enum_rizzh2
SG_NUM_INFLIGHT_FRAMES* = (2).Enum_rizzh2
SG_MAX_COLOR_ATTACHMENTS* = (4).Enum_rizzh2
SG_MAX_SHADERSTAGE_BUFFERS* = (8).Enum_rizzh2
SG_MAX_SHADERSTAGE_IMAGES* = (12).Enum_rizzh2
SG_MAX_SHADERSTAGE_UAVS* = (8).Enum_rizzh2
SG_MAX_SHADERSTAGE_UBS* = (4).Enum_rizzh2
SG_MAX_UB_MEMBERS* = (16).Enum_rizzh2
SG_MAX_VERTEX_ATTRIBUTES* = (16).Enum_rizzh2 ## ```
## NOTE: actual max vertex attrs can be less on GLES2, see sg_limits!
## ```
SG_MAX_MIPMAPS* = (16).Enum_rizzh2 ## ```
## NOTE: actual max vertex attrs can be less on GLES2, see sg_limits!
## ```
SG_MAX_TEXTUREARRAY_LAYERS* = (128).Enum_rizzh2
SG_BACKEND_GLCORE33* = (0).sg_backend
SG_BACKEND_GLES2* = (SG_BACKEND_GLCORE33 + 1).sg_backend
SG_BACKEND_GLES3* = (SG_BACKEND_GLES2 + 1).sg_backend
SG_BACKEND_D3D11* = (SG_BACKEND_GLES3 + 1).sg_backend
SG_BACKEND_METAL_IOS* = (SG_BACKEND_D3D11 + 1).sg_backend
SG_BACKEND_METAL_MACOS* = (SG_BACKEND_METAL_IOS + 1).sg_backend
SG_BACKEND_METAL_SIMULATOR* = (SG_BACKEND_METAL_MACOS + 1).sg_backend
SG_BACKEND_WGPU* = (SG_BACKEND_METAL_SIMULATOR + 1).sg_backend
SG_BACKEND_DUMMY* = (SG_BACKEND_WGPU + 1).sg_backend
SG_PIXELFORMAT_DEFAULT* = (0).sg_pixel_format ## ```
## value 0 reserved for default-init
## ```
SG_PIXELFORMAT_NONE* = (SG_PIXELFORMAT_DEFAULT + 1).sg_pixel_format ## ```
## value 0 reserved for default-init
## ```
SG_PIXELFORMAT_R8* = (SG_PIXELFORMAT_NONE + 1).sg_pixel_format
SG_PIXELFORMAT_R8SN* = (SG_PIXELFORMAT_R8 + 1).sg_pixel_format
SG_PIXELFORMAT_R8UI* = (SG_PIXELFORMAT_R8SN + 1).sg_pixel_format
SG_PIXELFORMAT_R8SI* = (SG_PIXELFORMAT_R8UI + 1).sg_pixel_format
SG_PIXELFORMAT_R16* = (SG_PIXELFORMAT_R8SI + 1).sg_pixel_format
SG_PIXELFORMAT_R16SN* = (SG_PIXELFORMAT_R16 + 1).sg_pixel_format
SG_PIXELFORMAT_R16UI* = (SG_PIXELFORMAT_R16SN + 1).sg_pixel_format
SG_PIXELFORMAT_R16SI* = (SG_PIXELFORMAT_R16UI + 1).sg_pixel_format
SG_PIXELFORMAT_R16F* = (SG_PIXELFORMAT_R16SI + 1).sg_pixel_format
SG_PIXELFORMAT_RG8* = (SG_PIXELFORMAT_R16F + 1).sg_pixel_format
SG_PIXELFORMAT_RG8SN* = (SG_PIXELFORMAT_RG8 + 1).sg_pixel_format
SG_PIXELFORMAT_RG8UI* = (SG_PIXELFORMAT_RG8SN + 1).sg_pixel_format
SG_PIXELFORMAT_RG8SI* = (SG_PIXELFORMAT_RG8UI + 1).sg_pixel_format
SG_PIXELFORMAT_R32UI* = (SG_PIXELFORMAT_RG8SI + 1).sg_pixel_format
SG_PIXELFORMAT_R32SI* = (SG_PIXELFORMAT_R32UI + 1).sg_pixel_format
SG_PIXELFORMAT_R32F* = (SG_PIXELFORMAT_R32SI + 1).sg_pixel_format
SG_PIXELFORMAT_RG16* = (SG_PIXELFORMAT_R32F + 1).sg_pixel_format
SG_PIXELFORMAT_RG16SN* = (SG_PIXELFORMAT_RG16 + 1).sg_pixel_format
SG_PIXELFORMAT_RG16UI* = (SG_PIXELFORMAT_RG16SN + 1).sg_pixel_format
SG_PIXELFORMAT_RG16SI* = (SG_PIXELFORMAT_RG16UI + 1).sg_pixel_format
SG_PIXELFORMAT_RG16F* = (SG_PIXELFORMAT_RG16SI + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA8* = (SG_PIXELFORMAT_RG16F + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA8SN* = (SG_PIXELFORMAT_RGBA8 + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA8UI* = (SG_PIXELFORMAT_RGBA8SN + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA8SI* = (SG_PIXELFORMAT_RGBA8UI + 1).sg_pixel_format
SG_PIXELFORMAT_BGRA8* = (SG_PIXELFORMAT_RGBA8SI + 1).sg_pixel_format
SG_PIXELFORMAT_RGB10A2* = (SG_PIXELFORMAT_BGRA8 + 1).sg_pixel_format
SG_PIXELFORMAT_RG11B10F* = (SG_PIXELFORMAT_RGB10A2 + 1).sg_pixel_format
SG_PIXELFORMAT_RG32UI* = (SG_PIXELFORMAT_RG11B10F + 1).sg_pixel_format
SG_PIXELFORMAT_RG32SI* = (SG_PIXELFORMAT_RG32UI + 1).sg_pixel_format
SG_PIXELFORMAT_RG32F* = (SG_PIXELFORMAT_RG32SI + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA16* = (SG_PIXELFORMAT_RG32F + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA16SN* = (SG_PIXELFORMAT_RGBA16 + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA16UI* = (SG_PIXELFORMAT_RGBA16SN + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA16SI* = (SG_PIXELFORMAT_RGBA16UI + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA16F* = (SG_PIXELFORMAT_RGBA16SI + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA32UI* = (SG_PIXELFORMAT_RGBA16F + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA32SI* = (SG_PIXELFORMAT_RGBA32UI + 1).sg_pixel_format
SG_PIXELFORMAT_RGBA32F* = (SG_PIXELFORMAT_RGBA32SI + 1).sg_pixel_format
SG_PIXELFORMAT_DEPTH* = (SG_PIXELFORMAT_RGBA32F + 1).sg_pixel_format
SG_PIXELFORMAT_DEPTH_STENCIL* = (SG_PIXELFORMAT_DEPTH + 1).sg_pixel_format
SG_PIXELFORMAT_BC1_RGBA* = (SG_PIXELFORMAT_DEPTH_STENCIL + 1).sg_pixel_format
SG_PIXELFORMAT_BC2_RGBA* = (SG_PIXELFORMAT_BC1_RGBA + 1).sg_pixel_format
SG_PIXELFORMAT_BC3_RGBA* = (SG_PIXELFORMAT_BC2_RGBA + 1).sg_pixel_format
SG_PIXELFORMAT_BC4_R* = (SG_PIXELFORMAT_BC3_RGBA + 1).sg_pixel_format
SG_PIXELFORMAT_BC4_RSN* = (SG_PIXELFORMAT_BC4_R + 1).sg_pixel_format
SG_PIXELFORMAT_BC5_RG* = (SG_PIXELFORMAT_BC4_RSN + 1).sg_pixel_format
SG_PIXELFORMAT_BC5_RGSN* = (SG_PIXELFORMAT_BC5_RG + 1).sg_pixel_format
SG_PIXELFORMAT_BC6H_RGBF* = (SG_PIXELFORMAT_BC5_RGSN + 1).sg_pixel_format
SG_PIXELFORMAT_BC6H_RGBUF* = (SG_PIXELFORMAT_BC6H_RGBF + 1).sg_pixel_format
SG_PIXELFORMAT_BC7_RGBA* = (SG_PIXELFORMAT_BC6H_RGBUF + 1).sg_pixel_format
SG_PIXELFORMAT_PVRTC_RGB_2BPP* = (SG_PIXELFORMAT_BC7_RGBA + 1).sg_pixel_format
SG_PIXELFORMAT_PVRTC_RGB_4BPP* = (SG_PIXELFORMAT_PVRTC_RGB_2BPP + 1).sg_pixel_format
SG_PIXELFORMAT_PVRTC_RGBA_2BPP* = (SG_PIXELFORMAT_PVRTC_RGB_4BPP + 1).sg_pixel_format
SG_PIXELFORMAT_PVRTC_RGBA_4BPP* = (SG_PIXELFORMAT_PVRTC_RGBA_2BPP + 1).sg_pixel_format
SG_PIXELFORMAT_ETC2_RGB8* = (SG_PIXELFORMAT_PVRTC_RGBA_4BPP + 1).sg_pixel_format
SG_PIXELFORMAT_ETC2_RGB8A1* = (SG_PIXELFORMAT_ETC2_RGB8 + 1).sg_pixel_format
SG_PIXELFORMAT_ETC2_RGBA8* = (SG_PIXELFORMAT_ETC2_RGB8A1 + 1).sg_pixel_format
SG_PIXELFORMAT_ETC2_RG11* = (SG_PIXELFORMAT_ETC2_RGBA8 + 1).sg_pixel_format
SG_PIXELFORMAT_ETC2_RG11SN* = (SG_PIXELFORMAT_ETC2_RG11 + 1).sg_pixel_format
SG_PIXELFORMAT_NUM* = (SG_PIXELFORMAT_ETC2_RG11SN + 1).sg_pixel_format
SG_PIXELFORMAT_FORCE_U32* = (0x7FFFFFFF).sg_pixel_format
SG_RESOURCESTATE_INITIAL* = (0).sg_resource_state
SG_RESOURCESTATE_ALLOC* = (SG_RESOURCESTATE_INITIAL + 1).sg_resource_state
SG_RESOURCESTATE_VALID* = (SG_RESOURCESTATE_ALLOC + 1).sg_resource_state
SG_RESOURCESTATE_FAILED* = (SG_RESOURCESTATE_VALID + 1).sg_resource_state
SG_RESOURCESTATE_INVALID* = (SG_RESOURCESTATE_FAILED + 1).sg_resource_state
SG_RESOURCESTATE_FORCE_U32* = (0x7FFFFFFF).sg_resource_state
SG_USAGE_DEFAULT* = (0).sg_usage ## ```
## value 0 reserved for default-init
## ```
SG_USAGE_IMMUTABLE* = (SG_USAGE_DEFAULT + 1).sg_usage ## ```
## value 0 reserved for default-init
## ```
SG_USAGE_DYNAMIC* = (SG_USAGE_IMMUTABLE + 1).sg_usage
SG_USAGE_STREAM* = (SG_USAGE_DYNAMIC + 1).sg_usage
SG_USAGE_NUM* = (SG_USAGE_STREAM + 1).sg_usage
SG_USAGE_FORCE_U32* = (0x7FFFFFFF).sg_usage
SG_BUFFERTYPE_DEFAULT* = (0).sg_buffer_type ## ```
## value 0 reserved for default-init
## ```
SG_BUFFERTYPE_VERTEXBUFFER* = (SG_BUFFERTYPE_DEFAULT + 1).sg_buffer_type ## ```
## value 0 reserved for default-init
## ```
SG_BUFFERTYPE_INDEXBUFFER* = (SG_BUFFERTYPE_VERTEXBUFFER + 1).sg_buffer_type
SG_BUFFERTYPE_RAW* = (SG_BUFFERTYPE_INDEXBUFFER + 1).sg_buffer_type
SG_BUFFERTYPE_NUM* = (SG_BUFFERTYPE_RAW + 1).sg_buffer_type
SG_BUFFERTYPE_FORCE_U32* = (0x7FFFFFFF).sg_buffer_type
SG_INDEXTYPE_DEFAULT* = (0).sg_index_type ## ```
## value 0 reserved for default-init
## ```
SG_INDEXTYPE_NONE* = (SG_INDEXTYPE_DEFAULT + 1).sg_index_type ## ```
## value 0 reserved for default-init
## ```
SG_INDEXTYPE_UINT16* = (SG_INDEXTYPE_NONE + 1).sg_index_type
SG_INDEXTYPE_UINT32* = (SG_INDEXTYPE_UINT16 + 1).sg_index_type
SG_INDEXTYPE_NUM* = (SG_INDEXTYPE_UINT32 + 1).sg_index_type
SG_INDEXTYPE_FORCE_U32* = (0x7FFFFFFF).sg_index_type
SG_IMAGETYPE_DEFAULT* = (0).sg_image_type ## ```
## value 0 reserved for default-init
## ```
SG_IMAGETYPE_2D* = (SG_IMAGETYPE_DEFAULT + 1).sg_image_type ## ```
## value 0 reserved for default-init
## ```
SG_IMAGETYPE_CUBE* = (SG_IMAGETYPE_2D + 1).sg_image_type
SG_IMAGETYPE_3D* = (SG_IMAGETYPE_CUBE + 1).sg_image_type
SG_IMAGETYPE_ARRAY* = (SG_IMAGETYPE_3D + 1).sg_image_type
SG_IMAGETYPE_NUM* = (SG_IMAGETYPE_ARRAY + 1).sg_image_type
SG_IMAGETYPE_FORCE_U32* = (0x7FFFFFFF).sg_image_type
SG_SAMPLERTYPE_DEFAULT* = (0).sg_sampler_type ## ```
## value 0 reserved for default-init
## ```
SG_SAMPLERTYPE_FLOAT* = (SG_SAMPLERTYPE_DEFAULT + 1).sg_sampler_type ## ```
## value 0 reserved for default-init
## ```
SG_SAMPLERTYPE_SINT* = (SG_SAMPLERTYPE_FLOAT + 1).sg_sampler_type
SG_SAMPLERTYPE_UINT* = (SG_SAMPLERTYPE_SINT + 1).sg_sampler_type
SG_CUBEFACE_POS_X* = (0).sg_cube_face
SG_CUBEFACE_NEG_X* = (SG_CUBEFACE_POS_X + 1).sg_cube_face
SG_CUBEFACE_POS_Y* = (SG_CUBEFACE_NEG_X + 1).sg_cube_face
SG_CUBEFACE_NEG_Y* = (SG_CUBEFACE_POS_Y + 1).sg_cube_face
SG_CUBEFACE_POS_Z* = (SG_CUBEFACE_NEG_Y + 1).sg_cube_face
SG_CUBEFACE_NEG_Z* = (SG_CUBEFACE_POS_Z + 1).sg_cube_face
SG_CUBEFACE_NUM* = (SG_CUBEFACE_NEG_Z + 1).sg_cube_face
SG_CUBEFACE_FORCE_U32* = (0x7FFFFFFF).sg_cube_face
SG_SHADERSTAGE_VS* = (0).sg_shader_stage
SG_SHADERSTAGE_FS* = (SG_SHADERSTAGE_VS + 1).sg_shader_stage
SG_SHADERSTAGE_CS* = (SG_SHADERSTAGE_FS + 1).sg_shader_stage
SG_SHADERSTAGE_FORCE_U32* = (0x7FFFFFFF).sg_shader_stage
SG_PRIMITIVETYPE_DEFAULT* = (0).sg_primitive_type ## ```
## value 0 reserved for default-init
## ```
SG_PRIMITIVETYPE_POINTS* = (SG_PRIMITIVETYPE_DEFAULT + 1).sg_primitive_type ## ```
## value 0 reserved for default-init
## ```
SG_PRIMITIVETYPE_LINES* = (SG_PRIMITIVETYPE_POINTS + 1).sg_primitive_type
SG_PRIMITIVETYPE_LINE_STRIP* = (SG_PRIMITIVETYPE_LINES + 1).sg_primitive_type
SG_PRIMITIVETYPE_TRIANGLES* = (SG_PRIMITIVETYPE_LINE_STRIP + 1).sg_primitive_type
SG_PRIMITIVETYPE_TRIANGLE_STRIP* = (SG_PRIMITIVETYPE_TRIANGLES + 1).sg_primitive_type
SG_PRIMITIVETYPE_NUM* = (SG_PRIMITIVETYPE_TRIANGLE_STRIP + 1).sg_primitive_type
SG_PRIMITIVETYPE_FORCE_U32* = (0x7FFFFFFF).sg_primitive_type
SG_FILTER_DEFAULT* = (0).sg_filter ## ```
## value 0 reserved for default-init
## ```
SG_FILTER_NEAREST* = (SG_FILTER_DEFAULT + 1).sg_filter ## ```
## value 0 reserved for default-init
## ```
SG_FILTER_LINEAR* = (SG_FILTER_NEAREST + 1).sg_filter
SG_FILTER_NEAREST_MIPMAP_NEAREST* = (SG_FILTER_LINEAR + 1).sg_filter
SG_FILTER_NEAREST_MIPMAP_LINEAR* = (SG_FILTER_NEAREST_MIPMAP_NEAREST + 1).sg_filter
SG_FILTER_LINEAR_MIPMAP_NEAREST* = (SG_FILTER_NEAREST_MIPMAP_LINEAR + 1).sg_filter
SG_FILTER_LINEAR_MIPMAP_LINEAR* = (SG_FILTER_LINEAR_MIPMAP_NEAREST + 1).sg_filter
SG_FILTER_NUM* = (SG_FILTER_LINEAR_MIPMAP_LINEAR + 1).sg_filter
SG_FILTER_FORCE_U32* = (0x7FFFFFFF).sg_filter
SG_WRAP_DEFAULT* = (0).sg_wrap ## ```
## value 0 reserved for default-init
## ```
SG_WRAP_REPEAT* = (SG_WRAP_DEFAULT + 1).sg_wrap ## ```
## value 0 reserved for default-init
## ```
SG_WRAP_CLAMP_TO_EDGE* = (SG_WRAP_REPEAT + 1).sg_wrap
SG_WRAP_CLAMP_TO_BORDER* = (SG_WRAP_CLAMP_TO_EDGE + 1).sg_wrap
SG_WRAP_MIRRORED_REPEAT* = (SG_WRAP_CLAMP_TO_BORDER + 1).sg_wrap
SG_WRAP_NUM* = (SG_WRAP_MIRRORED_REPEAT + 1).sg_wrap
SG_WRAP_FORCE_U32* = (0x7FFFFFFF).sg_wrap
SG_BORDERCOLOR_DEFAULT* = (0).sg_border_color ## ```
## value 0 reserved for default-init
## ```
SG_BORDERCOLOR_TRANSPARENT_BLACK* = (SG_BORDERCOLOR_DEFAULT + 1).sg_border_color ## ```
## value 0 reserved for default-init
## ```
SG_BORDERCOLOR_OPAQUE_BLACK* = (SG_BORDERCOLOR_TRANSPARENT_BLACK + 1).sg_border_color
SG_BORDERCOLOR_OPAQUE_WHITE* = (SG_BORDERCOLOR_OPAQUE_BLACK + 1).sg_border_color
SG_BORDERCOLOR_NUM* = (SG_BORDERCOLOR_OPAQUE_WHITE + 1).sg_border_color
SG_BORDERCOLOR_FORCE_U32* = (0x7FFFFFFF).sg_border_color
SG_VERTEXFORMAT_INVALID* = (0).sg_vertex_format
SG_VERTEXFORMAT_FLOAT* = (SG_VERTEXFORMAT_INVALID + 1).sg_vertex_format
SG_VERTEXFORMAT_FLOAT2* = (SG_VERTEXFORMAT_FLOAT + 1).sg_vertex_format
SG_VERTEXFORMAT_FLOAT3* = (SG_VERTEXFORMAT_FLOAT2 + 1).sg_vertex_format
SG_VERTEXFORMAT_FLOAT4* = (SG_VERTEXFORMAT_FLOAT3 + 1).sg_vertex_format
SG_VERTEXFORMAT_BYTE4* = (SG_VERTEXFORMAT_FLOAT4 + 1).sg_vertex_format
SG_VERTEXFORMAT_BYTE4N* = (SG_VERTEXFORMAT_BYTE4 + 1).sg_vertex_format
SG_VERTEXFORMAT_UBYTE4* = (SG_VERTEXFORMAT_BYTE4N + 1).sg_vertex_format
SG_VERTEXFORMAT_UBYTE4N* = (SG_VERTEXFORMAT_UBYTE4 + 1).sg_vertex_format
SG_VERTEXFORMAT_SHORT2* = (SG_VERTEXFORMAT_UBYTE4N + 1).sg_vertex_format
SG_VERTEXFORMAT_SHORT2N* = (SG_VERTEXFORMAT_SHORT2 + 1).sg_vertex_format
SG_VERTEXFORMAT_USHORT2N* = (SG_VERTEXFORMAT_SHORT2N + 1).sg_vertex_format
SG_VERTEXFORMAT_SHORT4* = (SG_VERTEXFORMAT_USHORT2N + 1).sg_vertex_format
SG_VERTEXFORMAT_SHORT4N* = (SG_VERTEXFORMAT_SHORT4 + 1).sg_vertex_format
SG_VERTEXFORMAT_USHORT4N* = (SG_VERTEXFORMAT_SHORT4N + 1).sg_vertex_format
SG_VERTEXFORMAT_UINT10_N2* = (SG_VERTEXFORMAT_USHORT4N + 1).sg_vertex_format
SG_VERTEXFORMAT_NUM* = (SG_VERTEXFORMAT_UINT10_N2 + 1).sg_vertex_format
SG_VERTEXFORMAT_FORCE_U32* = (0x7FFFFFFF).sg_vertex_format
SG_VERTEXSTEP_DEFAULT* = (0).sg_vertex_step ## ```
## value 0 reserved for default-init
## ```
SG_VERTEXSTEP_PER_VERTEX* = (SG_VERTEXSTEP_DEFAULT + 1).sg_vertex_step ## ```
## value 0 reserved for default-init
## ```
SG_VERTEXSTEP_PER_INSTANCE* = (SG_VERTEXSTEP_PER_VERTEX + 1).sg_vertex_step
SG_VERTEXSTEP_NUM* = (SG_VERTEXSTEP_PER_INSTANCE + 1).sg_vertex_step
SG_VERTEXSTEP_FORCE_U32* = (0x7FFFFFFF).sg_vertex_step
SG_UNIFORMTYPE_INVALID* = (0).sg_uniform_type
SG_UNIFORMTYPE_FLOAT* = (SG_UNIFORMTYPE_INVALID + 1).sg_uniform_type
SG_UNIFORMTYPE_FLOAT2* = (SG_UNIFORMTYPE_FLOAT + 1).sg_uniform_type
SG_UNIFORMTYPE_FLOAT3* = (SG_UNIFORMTYPE_FLOAT2 + 1).sg_uniform_type
SG_UNIFORMTYPE_FLOAT4* = (SG_UNIFORMTYPE_FLOAT3 + 1).sg_uniform_type
SG_UNIFORMTYPE_MAT4* = (SG_UNIFORMTYPE_FLOAT4 + 1).sg_uniform_type
SG_UNIFORMTYPE_INT* = (SG_UNIFORMTYPE_MAT4 + 1).sg_uniform_type
SG_UNIFORMTYPE_INT2* = (SG_UNIFORMTYPE_INT + 1).sg_uniform_type
SG_UNIFORMTYPE_INT3* = (SG_UNIFORMTYPE_INT2 + 1).sg_uniform_type
SG_UNIFORMTYPE_INT4* = (SG_UNIFORMTYPE_INT3 + 1).sg_uniform_type
SG_UNIFORMTYPE_NUM* = (SG_UNIFORMTYPE_INT4 + 1).sg_uniform_type
SG_UNIFORMTYPE_FORCE_U32* = (0x7FFFFFFF).sg_uniform_type
SG_CULLMODE_DEFAULT* = (0).sg_cull_mode ## ```
## value 0 reserved for default-init
## ```
SG_CULLMODE_NONE* = (SG_CULLMODE_DEFAULT + 1).sg_cull_mode ## ```
## value 0 reserved for default-init
## ```
SG_CULLMODE_FRONT* = (SG_CULLMODE_NONE + 1).sg_cull_mode
SG_CULLMODE_BACK* = (SG_CULLMODE_FRONT + 1).sg_cull_mode
SG_CULLMODE_NUM* = (SG_CULLMODE_BACK + 1).sg_cull_mode
SG_CULLMODE_FORCE_U32* = (0x7FFFFFFF).sg_cull_mode
SG_FACEWINDING_DEFAULT* = (0).sg_face_winding ## ```
## value 0 reserved for default-init
## ```
SG_FACEWINDING_CCW* = (SG_FACEWINDING_DEFAULT + 1).sg_face_winding ## ```
## value 0 reserved for default-init
## ```
SG_FACEWINDING_CW* = (SG_FACEWINDING_CCW + 1).sg_face_winding
SG_FACEWINDING_NUM* = (SG_FACEWINDING_CW + 1).sg_face_winding
SG_FACEWINDING_FORCE_U32* = (0x7FFFFFFF).sg_face_winding
SG_COMPAREFUNC_DEFAULT* = (0).sg_compare_func ## ```
## value 0 reserved for default-init
## ```
SG_COMPAREFUNC_NEVER* = (SG_COMPAREFUNC_DEFAULT + 1).sg_compare_func ## ```
## value 0 reserved for default-init
## ```
SG_COMPAREFUNC_LESS* = (SG_COMPAREFUNC_NEVER + 1).sg_compare_func
SG_COMPAREFUNC_EQUAL* = (SG_COMPAREFUNC_LESS + 1).sg_compare_func
SG_COMPAREFUNC_LESS_EQUAL* = (SG_COMPAREFUNC_EQUAL + 1).sg_compare_func
SG_COMPAREFUNC_GREATER* = (SG_COMPAREFUNC_LESS_EQUAL + 1).sg_compare_func
SG_COMPAREFUNC_NOT_EQUAL* = (SG_COMPAREFUNC_GREATER + 1).sg_compare_func
SG_COMPAREFUNC_GREATER_EQUAL* = (SG_COMPAREFUNC_NOT_EQUAL + 1).sg_compare_func
SG_COMPAREFUNC_ALWAYS* = (SG_COMPAREFUNC_GREATER_EQUAL + 1).sg_compare_func
SG_COMPAREFUNC_NUM* = (SG_COMPAREFUNC_ALWAYS + 1).sg_compare_func
SG_COMPAREFUNC_FORCE_U32* = (0x7FFFFFFF).sg_compare_func
SG_STENCILOP_DEFAULT* = (0).sg_stencil_op ## ```
## value 0 reserved for default-init
## ```
SG_STENCILOP_KEEP* = (SG_STENCILOP_DEFAULT + 1).sg_stencil_op ## ```
## value 0 reserved for default-init
## ```
SG_STENCILOP_ZERO* = (SG_STENCILOP_KEEP + 1).sg_stencil_op
SG_STENCILOP_REPLACE* = (SG_STENCILOP_ZERO + 1).sg_stencil_op
SG_STENCILOP_INCR_CLAMP* = (SG_STENCILOP_REPLACE + 1).sg_stencil_op
SG_STENCILOP_DECR_CLAMP* = (SG_STENCILOP_INCR_CLAMP + 1).sg_stencil_op
SG_STENCILOP_INVERT* = (SG_STENCILOP_DECR_CLAMP + 1).sg_stencil_op
SG_STENCILOP_INCR_WRAP* = (SG_STENCILOP_INVERT + 1).sg_stencil_op
SG_STENCILOP_DECR_WRAP* = (SG_STENCILOP_INCR_WRAP + 1).sg_stencil_op
SG_STENCILOP_NUM* = (SG_STENCILOP_DECR_WRAP + 1).sg_stencil_op
SG_STENCILOP_FORCE_U32* = (0x7FFFFFFF).sg_stencil_op
SG_BLENDFACTOR_DEFAULT* = (0).sg_blend_factor ## ```
## value 0 reserved for default-init
## ```
SG_BLENDFACTOR_ZERO* = (SG_BLENDFACTOR_DEFAULT + 1).sg_blend_factor ## ```
## value 0 reserved for default-init
## ```
SG_BLENDFACTOR_ONE* = (SG_BLENDFACTOR_ZERO + 1).sg_blend_factor
SG_BLENDFACTOR_SRC_COLOR* = (SG_BLENDFACTOR_ONE + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR* = (SG_BLENDFACTOR_SRC_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_SRC_ALPHA* = (SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA* = (SG_BLENDFACTOR_SRC_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_DST_COLOR* = (SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_DST_COLOR* = (SG_BLENDFACTOR_DST_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_DST_ALPHA* = (SG_BLENDFACTOR_ONE_MINUS_DST_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA* = (SG_BLENDFACTOR_DST_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_SRC_ALPHA_SATURATED* = (SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_BLEND_COLOR* = (SG_BLENDFACTOR_SRC_ALPHA_SATURATED + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR* = (SG_BLENDFACTOR_BLEND_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_BLEND_ALPHA* = (SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR + 1).sg_blend_factor
SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA* = (SG_BLENDFACTOR_BLEND_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_NUM* = (SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA + 1).sg_blend_factor
SG_BLENDFACTOR_FORCE_U32* = (0x7FFFFFFF).sg_blend_factor
SG_BLENDOP_DEFAULT* = (0).sg_blend_op ## ```
## value 0 reserved for default-init
## ```
SG_BLENDOP_ADD* = (SG_BLENDOP_DEFAULT + 1).sg_blend_op ## ```
## value 0 reserved for default-init
## ```
SG_BLENDOP_SUBTRACT* = (SG_BLENDOP_ADD + 1).sg_blend_op
SG_BLENDOP_REVERSE_SUBTRACT* = (SG_BLENDOP_SUBTRACT + 1).sg_blend_op
SG_BLENDOP_NUM* = (SG_BLENDOP_REVERSE_SUBTRACT + 1).sg_blend_op
SG_BLENDOP_FORCE_U32* = (0x7FFFFFFF).sg_blend_op
SG_COLORMASK_DEFAULT* = (0).sg_color_mask ## ```
## value 0 reserved for default-init
## ```
SG_COLORMASK_NONE* = ((0x00000010)).sg_color_mask ## ```
## special value for 'all channels disabled
## ```
SG_COLORMASK_R* = ((1 shl typeof(1)(0))).sg_color_mask ## ```
## special value for 'all channels disabled
## ```
SG_COLORMASK_G* = ((1 shl typeof(1)(1))).sg_color_mask
SG_COLORMASK_B* = ((1 shl typeof(1)(2))).sg_color_mask
SG_COLORMASK_A* = ((1 shl typeof(1)(3))).sg_color_mask
SG_COLORMASK_RGB* = (0x00000007).sg_color_mask
SG_COLORMASK_RGBA* = (0x0000000F).sg_color_mask
SG_COLORMASK_FORCE_U32* = (0x7FFFFFFF).sg_color_mask
SG_ACTION_DEFAULT* = (0).sg_action
SG_ACTION_CLEAR* = (SG_ACTION_DEFAULT + 1).sg_action
SG_ACTION_LOAD* = (SG_ACTION_CLEAR + 1).sg_action
SG_ACTION_DONTCARE* = (SG_ACTION_LOAD + 1).sg_action
SG_ACTION_NUM* = (SG_ACTION_DONTCARE + 1).sg_action
SG_ACTION_FORCE_U32* = (0x7FFFFFFF).sg_action
RIZZ_GFX_BACKEND_GLCORE33* = (0).rizz_gfx_backend
RIZZ_GFX_BACKEND_GLES2* = (RIZZ_GFX_BACKEND_GLCORE33 + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_GLES3* = (RIZZ_GFX_BACKEND_GLES2 + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_D3D11* = (RIZZ_GFX_BACKEND_GLES3 + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_METAL_IOS* = (RIZZ_GFX_BACKEND_D3D11 + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_METAL_MACOS* = (RIZZ_GFX_BACKEND_METAL_IOS + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_METAL_SIMULATOR* = (RIZZ_GFX_BACKEND_METAL_MACOS + 1).rizz_gfx_backend
RIZZ_GFX_BACKEND_DUMMY* = (RIZZ_GFX_BACKEND_METAL_SIMULATOR + 1).rizz_gfx_backend
RIZZ_SHADER_LANG_GLES* = (0).rizz_shader_lang
RIZZ_SHADER_LANG_HLSL* = (RIZZ_SHADER_LANG_GLES + 1).rizz_shader_lang
RIZZ_SHADER_LANG_MSL* = (RIZZ_SHADER_LANG_HLSL + 1).rizz_shader_lang
RIZZ_SHADER_LANG_GLSL* = (RIZZ_SHADER_LANG_MSL + 1).rizz_shader_lang
RIZZ_SHADER_LANG_COUNT* = (RIZZ_SHADER_LANG_GLSL + 1).rizz_shader_lang
RIZZ_SHADER_STAGE_VS* = (0).rizz_shader_stage
RIZZ_SHADER_STAGE_FS* = (RIZZ_SHADER_STAGE_VS + 1).rizz_shader_stage
RIZZ_SHADER_STAGE_CS* = (RIZZ_SHADER_STAGE_FS + 1).rizz_shader_stage
RIZZ_SHADER_STAGE_COUNT* = (RIZZ_SHADER_STAGE_CS + 1).rizz_shader_stage
RIZZ_SHADER_CODE_SOURCE* = (0).rizz_shader_code_type
RIZZ_SHADER_CODE_BYTECODE* = (RIZZ_SHADER_CODE_SOURCE + 1).rizz_shader_code_type
RIZZ_GFX_TRACE_COMMON* = (0).rizz_gfx_perframe_trace_zone
RIZZ_GFX_TRACE_IMGUI* = (RIZZ_GFX_TRACE_COMMON + 1).rizz_gfx_perframe_trace_zone
RIZZ_GFX_TRACE_COUNT* = (RIZZ_GFX_TRACE_IMGUI + 1).rizz_gfx_perframe_trace_zone
RIZZ_API_CORE* = (0).rizz_api_type
RIZZ_API_PLUGIN* = (RIZZ_API_CORE + 1).rizz_api_type
RIZZ_API_APP* = (RIZZ_API_PLUGIN + 1).rizz_api_type
RIZZ_API_GFX* = (RIZZ_API_APP + 1).rizz_api_type
RIZZ_API_REFLECT* = (RIZZ_API_GFX + 1).rizz_api_type
RIZZ_API_VFS* = (RIZZ_API_REFLECT + 1).rizz_api_type
RIZZ_API_ASSET* = (RIZZ_API_VFS + 1).rizz_api_type
RIZZ_API_CAMERA* = (RIZZ_API_ASSET + 1).rizz_api_type
RIZZ_API_HTTP* = (RIZZ_API_CAMERA + 1).rizz_api_type
RIZZ_API_COUNT* = (RIZZ_API_HTTP + 1).rizz_api_type
RIZZ_PLUGIN_EVENT_LOAD* = (0).rizz_plugin_event
RIZZ_PLUGIN_EVENT_STEP* = (1).rizz_plugin_event
RIZZ_PLUGIN_EVENT_UNLOAD* = (2).rizz_plugin_event
RIZZ_PLUGIN_EVENT_SHUTDOWN* = (3).rizz_plugin_event
RIZZ_PLUGIN_EVENT_INIT* = (4).rizz_plugin_event
RIZZ_PLUGIN_CRASH_NONE* = (0).rizz_plugin_crash ## ```
## No error
## ```
RIZZ_PLUGIN_CRASH_SEGFAULT* = (RIZZ_PLUGIN_CRASH_NONE + 1).rizz_plugin_crash ## ```
## SIGSEGV / EXCEPTION_ACCESS_VIOLATION
## ```
RIZZ_PLUGIN_CRASH_ILLEGAL* = (RIZZ_PLUGIN_CRASH_SEGFAULT + 1).rizz_plugin_crash ## ```
## illegal instruction (SIGILL) / EXCEPTION_ILLEGAL_INSTRUCTION
## ```
RIZZ_PLUGIN_CRASH_ABORT* = (RIZZ_PLUGIN_CRASH_ILLEGAL + 1).rizz_plugin_crash ## ```
## abort (SIGBRT)
## ```
RIZZ_PLUGIN_CRASH_MISALIGN* = (RIZZ_PLUGIN_CRASH_ABORT + 1).rizz_plugin_crash ## ```
## bus error (SIGBUS) / EXCEPTION_DATATYPE_MISALIGNMENT
## ```
RIZZ_PLUGIN_CRASH_BOUNDS* = (RIZZ_PLUGIN_CRASH_MISALIGN + 1).rizz_plugin_crash ## ```
## EXCEPTION_ARRAY_BOUNDS_EXCEEDED
## ```
RIZZ_PLUGIN_CRASH_STACKOVERFLOW* = (RIZZ_PLUGIN_CRASH_BOUNDS + 1).rizz_plugin_crash ## ```
## EXCEPTION_STACK_OVERFLOW
## ```
RIZZ_PLUGIN_CRASH_STATE_INVALIDATED* = (RIZZ_PLUGIN_CRASH_STACKOVERFLOW + 1).rizz_plugin_crash ## ```
## one or more global data sectio changed and does
## not safely match basically a failure of
## cr_plugin_validate_sections
## ```
RIZZ_PLUGIN_CRASH_BAD_IMAGE* = (RIZZ_PLUGIN_CRASH_STATE_INVALIDATED + 1).rizz_plugin_crash ## ```
## Binary is not valid
## ```
RIZZ_PLUGIN_CRASH_OTHER* = (RIZZ_PLUGIN_CRASH_BAD_IMAGE + 1).rizz_plugin_crash ## ```
## Unknown or other signal,
## ```
RIZZ_PLUGIN_CRASH_USER* = (0x00000100).rizz_plugin_crash ## ```
## Unknown or other signal,
## ```
RIZZ_PLUGIN_INFO_EVENT_HANDLER* = (0x00000001).rizz_plugin_info_flags
RIZZ_HTTP_PENDING* = (0).rizz_http_status
RIZZ_HTTP_COMPLETED* = (RIZZ_HTTP_PENDING + 1).rizz_http_status
RIZZ_HTTP_FAILED* = (RIZZ_HTTP_COMPLETED + 1).rizz_http_status
RIZZ_REFL_ENUM* = (0).rizz_refl_type ## ```
##
## ```
RIZZ_REFL_FUNC* = (RIZZ_REFL_ENUM + 1).rizz_refl_type ## ```
##
## ```
RIZZ_REFL_FIELD* = (RIZZ_REFL_FUNC + 1).rizz_refl_type ## ```
##
## ```
RIZZ_REFL_FLAG_IS_PTR* = (0x00000001).rizz_refl_flags ## ```
## field is pointer
## ```
RIZZ_REFL_FLAG_IS_STRUCT* = (0x00000002).rizz_refl_flags ## ```
## field is struct type
## ```
RIZZ_REFL_FLAG_IS_ARRAY* = (0x00000004).rizz_refl_flags ## ```
## field is array (only built-in types are supported)
## ```
RIZZ_REFL_FLAG_IS_ENUM* = (0x00000008).rizz_refl_flags ## ```
## field is enum
## ```
type
sx_alloc* {.bycopy, imprizzHdr, importc: "struct sx_alloc".} = object
alloc_cb*: proc (`ptr`: pointer; size: uint; align: uint32; file: cstring;
`func`: cstring; line: uint32; user_data: pointer): pointer {.cdecl.}
user_data*: pointer
sx_dump_leak_cb* {.importc, imprizzHdr.} = proc (formatted_msg: cstring;
file: cstring; `func`: cstring; line: cint; size: uint; `ptr`: pointer) {.cdecl.}
sx_fiber_t* {.importc, imprizzHdr.} = pointer
sx_fiber_transfer* {.bycopy, imprizzHdr, importc: "struct sx_fiber_transfer".} = object
`from`*: sx_fiber_t
user*: pointer
sx_fiber_stack* {.bycopy, imprizzHdr, importc: "struct sx_fiber_stack".} = object
sptr*: pointer
ssize*: cuint
sx_fiber_cb* {.importc, imprizzHdr.} = proc (transfer: sx_fiber_transfer) {.cdecl.}
sx_coro_context* {.importc, imprizzHdr, incompleteStruct.} = object
sx_mem_block* {.bycopy, imprizzHdr, importc: "struct sx_mem_block".} = object ## ```
## sx_mem_block
## ```
alloc*: ptr sx_alloc
data*: pointer
size*: int64
align*: cint
sx_mem_writer* {.bycopy, imprizzHdr, importc: "struct sx_mem_writer".} = object ## ```
## sx_mem_writer
## ```
mem*: ptr sx_mem_block
data*: ptr uint8
pos*: int64
top*: int64
size*: int64
sx_mem_reader* {.bycopy, imprizzHdr, importc: "struct sx_mem_reader".} = object ## ```
## sx_mem_reader
## ```
data*: ptr uint8
pos*: int64
top*: int64
sx_file* {.bycopy, imprizzHdr, importc: "struct sx_file".} = object
data*: array[32, uint8]
sx_file_open_flags* {.importc, imprizzHdr.} = uint32
sx_iff_chunk* {.bycopy, imprizzHdr, importc: "struct sx_iff_chunk".} = object
pos*: int64
size*: int64
uncompressed_size*: int64 ## ```
## optional: these fields can be used when we have compressed chunks
## ```
hash*: uint64 ## ```
## optional: hash value for chunks
## ```
fourcc*: uint32 ## ```
## optional: hash value for chunks
## ```
parent_id*: cint
reserved*: array[2, uint32]
sx_iff_flags* {.importc, imprizzHdr.} = uint32
Union_rizzh1* {.union, bycopy, imprizzHdr, importc: "union Union_rizzh1".} = object
mread*: ptr sx_mem_reader
mwrite*: ptr sx_mem_writer
disk*: ptr sx_file
sx_iff_file* {.bycopy, imprizzHdr, importc: "struct sx_iff_file".} = object
`type`*: sx_iff_type
chunks*: ptr sx_iff_chunk ## ```
## sx_array: chunk_id's are references to this array (chunks[chunk_id])
## ```
alloc*: ptr sx_alloc ## ```
## sx_array: chunk_id's are references to this array (chunks[chunk_id])
## ```
a5*: Union_rizzh1
read_all*: bool
sx_job_context* {.importc, imprizzHdr, incompleteStruct.} = object
sx_job_t* {.importc, imprizzHdr.} = ptr cint
sx_job_cb* {.importc, imprizzHdr.} = proc (range_start: cint; range_end: cint;
thread_index: cint; user: pointer) {.cdecl.}
sx_job_thread_init_cb* {.importc, imprizzHdr.} = proc (ctx: ptr sx_job_context;
thread_index: cint; thread_id: cuint; user: pointer) {.cdecl.}
sx_job_thread_shutdown_cb* {.importc, imprizzHdr.} = proc (ctx: ptr sx_job_context;
thread_index: cint; thread_id: cuint; user: pointer) {.cdecl.}
sx_job_context_desc* {.bycopy, imprizzHdr, importc: "struct sx_job_context_desc".} = object
num_threads*: cint ## ```
## number of worker threads to spawn,exclude main (default: num_cpu_cores-1)
## ```
max_fibers*: cint ## ```
## maximum fibers that are can be running at the same time (default: 64)
## ```
fiber_stack_sz*: cint ## ```
## fiber stack size (default: 1mb)
## ```
thread_init_cb*: ptr sx_job_thread_init_cb ## ```
## callback function that will be called on
## initiaslization of each worker thread
## ```
thread_shutdown_cb*: ptr sx_job_thread_shutdown_cb ## ```
## callback functions that will be called on
## the shutdown of each worker thread
## ```
thread_user_data*: pointer ## ```
## user-data to be passed to callback functions above
## ```
Type_rizzh1* {.bycopy, imprizzHdr, importc: "struct Type_rizzh1".} = object
x*: cfloat
y*: cfloat
z*: cfloat
w*: cfloat
sx_vec4* {.union, bycopy, imprizzHdr, importc: "union sx_vec4".} = object ## ```
## Types/Primitives
## ```
a1*: Type_rizzh1
f*: array[4, cfloat]
Type_rizzh2* {.bycopy, imprizzHdr, importc: "struct Type_rizzh2".} = object
x*: cfloat
y*: cfloat
sx_vec2* {.union, bycopy, imprizzHdr, importc: "union sx_vec2".} = object
a1*: Type_rizzh2
f*: array[2, cfloat]
Type_rizzh3* {.bycopy, imprizzHdr, importc: "struct Type_rizzh3".} = object
x*: cfloat
y*: cfloat
z*: cfloat
sx_vec3* {.union, bycopy, imprizzHdr, importc: "union sx_vec3".} = object
a1*: Type_rizzh3
f*: array[3, cfloat]
Type_rizzh4* {.bycopy, imprizzHdr, importc: "struct Type_rizzh4".} = object
r*: cuchar
g*: cuchar
b*: cuchar
a*: cuchar
sx_color* {.union, bycopy, imprizzHdr, importc: "union sx_color".} = object
a1*: Type_rizzh4
n*: cuint
Type_rizzh5* {.bycopy, imprizzHdr, importc: "struct Type_rizzh5".} = object
x*: cint
y*: cint
sx_ivec2* {.union, bycopy, imprizzHdr, importc: "union sx_ivec2".} = object
a1*: Type_rizzh5
n*: array[2, cint]
Type_rizzh6* {.bycopy, imprizzHdr, importc: "struct Type_rizzh6".} = object
x*: cfloat
y*: cfloat
z*: cfloat
w*: cfloat
sx_quat* {.union, bycopy, imprizzHdr, importc: "union sx_quat".} = object
a1*: Type_rizzh6
f*: array[4, cfloat]
Type_rizzh7* {.bycopy, imprizzHdr, importc: "struct Type_rizzh7".} = object
m11*: cfloat
m21*: cfloat
m31*: cfloat
m12*: cfloat
m22*: cfloat
m32*: cfloat
m13*: cfloat
m23*: cfloat
m33*: cfloat
Type_rizzh8* {.bycopy, imprizzHdr, importc: "struct Type_rizzh8".} = object
fc1*: array[3, cfloat]
fc2*: array[3, cfloat]
fc3*: array[3, cfloat]
Type_rizzh9* {.bycopy, imprizzHdr, importc: "struct Type_rizzh9".} = object
col1*: sx_vec3
col2*: sx_vec3
col3*: sx_vec3
sx_mat3* {.union, bycopy, imprizzHdr, importc: "union sx_mat3".} = object
a1*: Type_rizzh7
a2*: Type_rizzh8
a3*: Type_rizzh9
f*: array[9, cfloat]
Type_rizzh10* {.bycopy, imprizzHdr, importc: "struct Type_rizzh10".} = object
m11*: cfloat
m21*: cfloat
m31*: cfloat
m41*: cfloat
m12*: cfloat
m22*: cfloat
m32*: cfloat
m42*: cfloat
m13*: cfloat
m23*: cfloat
m33*: cfloat
m43*: cfloat
m14*: cfloat
m24*: cfloat
m34*: cfloat
m44*: cfloat
Type_rizzh11* {.bycopy, imprizzHdr, importc: "struct Type_rizzh11".} = object
rc1*: array[4, cfloat]
rc2*: array[4, cfloat]
rc3*: array[4, cfloat]
rc4*: array[4, cfloat]
Type_rizzh12* {.bycopy, imprizzHdr, importc: "struct Type_rizzh12".} = object
col1*: sx_vec4
col2*: sx_vec4
col3*: sx_vec4
col4*: sx_vec4
sx_mat4* {.union, bycopy, imprizzHdr, importc: "union sx_mat4".} = object
a1*: Type_rizzh10
a2*: Type_rizzh11
a3*: Type_rizzh12
f*: array[16, cfloat]
Type_rizzh13* {.bycopy, imprizzHdr, importc: "struct Type_rizzh13".} = object
xmin*: cfloat
ymin*: cfloat
xmax*: cfloat
ymax*: cfloat
Type_rizzh14* {.bycopy, imprizzHdr, importc: "struct Type_rizzh14".} = object
vmin*: sx_vec2
vmax*: sx_vec2
sx_rect* {.union, bycopy, imprizzHdr, importc: "union sx_rect".} = object
a1*: Type_rizzh13
a2*: Type_rizzh14
f*: array[4, cfloat]
Type_rizzh15* {.bycopy, imprizzHdr, importc: "struct Type_rizzh15".} = object
xmin*: cint
ymin*: cint
xmax*: cint
ymax*: cint
Type_rizzh16* {.bycopy, imprizzHdr, importc: "struct Type_rizzh16".} = object
vmin*: sx_ivec2
vmax*: sx_ivec2
sx_irect* {.union, bycopy, imprizzHdr, importc: "union sx_irect".} = object
a1*: Type_rizzh15
a2*: Type_rizzh16
f*: array[4, cint]
Type_rizzh17* {.bycopy, imprizzHdr, importc: "struct Type_rizzh17".} = object
xmin*: cfloat
ymin*: cfloat
zmin*: cfloat
xmax*: cfloat
ymax*: cfloat
zmax*: cfloat
Type_rizzh18* {.bycopy, imprizzHdr, importc: "struct Type_rizzh18".} = object
vmin*: sx_vec3
vmax*: sx_vec3
sx_aabb* {.union, bycopy, imprizzHdr, importc: "union sx_aabb".} = object
a1*: Type_rizzh17
a2*: Type_rizzh18
f*: array[6, cfloat]
Type_rizzh19* {.bycopy, imprizzHdr, importc: "struct Type_rizzh19".} = object
normal*: sx_vec3
dist*: cfloat
sx_plane* {.union, bycopy, imprizzHdr, importc: "union sx_plane".} = object ## ```
## 3d plane: a*nx + b*ny + c*nz + d = 0
## ```
p*: sx_vec4
a2*: Type_rizzh19
f*: array[4, cfloat]
sx_tx3d* {.bycopy, imprizzHdr, importc: "struct sx_tx3d".} = object ## ```
## Simplified 3D transform. by position and rotation
## ```
pos*: sx_vec3
rot*: sx_mat3
sx_box* {.bycopy, imprizzHdr, importc: "struct sx_box".} = object ## ```
## Box is a 3d primitive (cube), that extents in each X,Y,Z direction and has arbitary transform
## This is different from AABB (sx_aabb) where it is axis-aligned and defined by min/max points
## ```
tx*: sx_tx3d ## ```
## transform (pos = origin of the box, rot = rotation of the box)
## ```
he*: sx_vec3 ## ```
## half-extent from the origin (0.5*width, 0.5*height, 0.5f*depth)
## ```
rizz_asset_obj* {.union, bycopy, importc, imprizzHdr.} = object ## ```
## Global Ids
## clang-format off
## ```
id*: ptr uint
`ptr`*: pointer
rizz_asset* {.bycopy, importc, imprizzHdr.} = object
id*: uint32
rizz_asset_group* {.bycopy, importc, imprizzHdr.} = object
id*: uint32
rizz_http* {.bycopy, importc, imprizzHdr.} = object
id*: uint32
rizz_gfx_stage* {.bycopy, importc, imprizzHdr.} = object ## ```
## clang-format on
## Id conversion macros
## ```
id*: uint32
rizz_touch_point* {.bycopy, imprizzHdr, importc: "struct rizz_touch_point".} = object
identifier*: ptr uint
pos_x*: cfloat
pos_y*: cfloat
changed*: bool
rizz_app_event* {.bycopy, imprizzHdr, importc: "struct rizz_app_event".} = object
frame_count*: uint64
`type`*: rizz_app_event_type
key_code*: rizz_keycode
char_code*: uint32
key_repeat*: bool
modkeys*: rizz_modifier_keys
mouse_button*: rizz_mouse_btn
mouse_x*: cfloat
mouse_y*: cfloat
scroll_x*: cfloat
scroll_y*: cfloat
num_touches*: cint
touches*: array[RIZZ_APP_MAX_TOUCHPOINTS, rizz_touch_point]
window_width*: cint
window_height*: cint
framebuffer_width*: cint
framebuffer_height*: cint
native_event*: pointer
rizz_app_event_cb* {.importc, imprizzHdr.} = proc (a1: ptr rizz_app_event) {.cdecl.}
rizz_api_app* {.bycopy, imprizzHdr, importc: "struct rizz_api_app".} = object
width*: proc (): cint {.cdecl.}
height*: proc (): cint {.cdecl.}
sizef*: proc (): sx_vec2 {.cdecl.}
highdpi*: proc (): bool {.cdecl.}
dpiscale*: proc (): cfloat {.cdecl.}
show_keyboard*: proc (show: bool) {.cdecl.}
keyboard_shown*: proc (): bool {.cdecl.}
key_pressed*: proc (key: rizz_keycode): bool {.cdecl.}
quit*: proc () {.cdecl.}
request_quit*: proc () {.cdecl.}
cancel_quit*: proc () {.cdecl.}
name*: proc (): cstring {.cdecl.}
show_mouse*: proc (visible: bool) {.cdecl.}
mouse_shown*: proc (): bool {.cdecl.}
mouse_capture*: proc () {.cdecl.}
mouse_release*: proc () {.cdecl.}
rizz_vfs_async_read_cb* {.importc, imprizzHdr.} = proc (path: cstring;
mem: ptr sx_mem_block; user: pointer) {.cdecl.}
rizz_vfs_async_write_cb* {.importc, imprizzHdr.} = proc (path: cstring;
bytes_written: int64; mem: ptr sx_mem_block; user: pointer) {.cdecl.}
rizz_vfs_async_modify_cb* {.importc, imprizzHdr.} = proc (path: cstring) {.cdecl.}
rizz_api_vfs* {.bycopy, imprizzHdr, importc: "struct rizz_api_vfs".} = object
register_modify*: proc (modify_fn: ptr rizz_vfs_async_modify_cb) {.cdecl.}
mount*: proc (path: cstring; alias: cstring): bool {.cdecl.}
mount_mobile_assets*: proc (alias: cstring) {.cdecl.}
read_async*: proc (path: cstring; flags: rizz_vfs_flags; alloc: ptr sx_alloc;
read_fn: ptr rizz_vfs_async_read_cb; user: pointer) {.cdecl.}
write_async*: proc (path: cstring; mem: ptr sx_mem_block; flags: rizz_vfs_flags;
write_fn: ptr rizz_vfs_async_write_cb; user: pointer) {.cdecl.}
read*: proc (path: cstring; flags: rizz_vfs_flags; alloc: ptr sx_alloc): ptr sx_mem_block {.
cdecl.}
write*: proc (path: cstring; mem: ptr sx_mem_block; flags: rizz_vfs_flags): int64 {.
cdecl.}
mkdir*: proc (path: cstring): bool {.cdecl.}
is_dir*: proc (path: cstring): bool {.cdecl.}
is_file*: proc (path: cstring): bool {.cdecl.}
last_modified*: proc (path: cstring): uint64 {.cdecl.}
rizz_asset_load_params* {.bycopy, imprizzHdr,
importc: "struct rizz_asset_load_params".} = object
path*: cstring ## ```
## path to asset file
## ```
params*: pointer ## ```
## must cast to asset-specific implementation type
## ```
alloc*: ptr sx_alloc ## ```
## allocator that is user sends for loading asset data
## ```
tags*: uint32 ## ```
## user-defined tag bits
## ```
flags*: rizz_asset_load_flags ## ```
## flags that are used for loading
## ```
rizz_asset_load_data* {.bycopy, imprizzHdr,
importc: "struct rizz_asset_load_data".} = object
obj*: rizz_asset_obj ## ```
## valid internal object
## ```
user1*: pointer ## ```
## user-data can be allocated and filled with anything specific to asset loader
## ```
user2*: pointer ## ```
## same as user1
## ```
rizz_asset_callbacks* {.bycopy, imprizzHdr,
importc: "struct rizz_asset_callbacks".} = object
on_prepare*: proc (params: ptr rizz_asset_load_params; mem: ptr sx_mem_block): rizz_asset_load_data {.
cdecl.} ## ```
## Runs on main-thread
## Should create a valid device/subsystem object and any optional user-data.
## The reason that it is decoupled from on_load and runs on main thread is because we cannot
## garranty that object creation and custom memory allocation is thread-safe
## if rizz_asset_load_data.obj.id == 0, then the asset manager assumes that an error has occured
## ```
on_load*: proc (data: ptr rizz_asset_load_data;
params: ptr rizz_asset_load_params; mem: ptr sx_mem_block): bool {.
cdecl.}
on_finalize*: proc (data: ptr rizz_asset_load_data;
params: ptr rizz_asset_load_params; mem: ptr sx_mem_block) {.
cdecl.} ## ```
## Runs on main-thread
## Any optional finalization should happen in this function.
## This function should free any user-data allocated in 'on_prepare'
## ```
on_reload*: proc (handle: rizz_asset; prev_obj: rizz_asset_obj;
alloc: ptr sx_alloc) {.cdecl.} ## ```
## Runs on main-thread
## Reloading of object happens automatically within asset-lib.
## but this function can be used to sync any dependencies to entities or other assets
## prev_obj is the previous object that is about to be replaced by the new one (the one in
## handle)
## prev_obj is automatically released after this call by the asset manager
## ```
on_release*: proc (obj: rizz_asset_obj; alloc: ptr sx_alloc) {.cdecl.} ## ```
## Runs on main-thread
## asset-lib calls this if asset's refcount reaches zero.
## ```
rizz_api_asset* {.bycopy, imprizzHdr, importc: "struct rizz_api_asset".} = object ## ```
## clang-format off
## Threading rules:
## Internally, the asset system is offloading some work to worker threads, but the API is not
## thread-safe
## 1) Have to load all your assets on the main thread
## 2) You can only use rizz_api_asset.obj() in worker threads.
## So basically, you have to load the assets, and pass handles to threads,
## and they can only fetch the object pointer
## 3) Loading can be performed in the main thread while working threads are using the API
## (rule #2) but without RIZZ_ASSET_LOAD_FLAG_RELOAD flag
## 4) Unloading can NOT be performed while working threads are using the API
## 5) Never use asset objects across multiple frames inside worker-threads,
## because they may be invalidated
##
## So basically the multi-threading usage pattern is:
## - Always Load your stuff in main update (main-thread) before running tasks that use those
## assets
## - in game-update function: spawn jobs and use rizz_api_asset.obj() to access
## asset objects
## - always wait/end these tasks before game-update functions ends
## - unload assets only when the scene is not updated or no game-update tasks is running
## clang-format on
## ```
register_asset_type*: proc (name: cstring; callbacks: rizz_asset_callbacks;
params_type_name: cstring; params_size: cint;
failed_obj: rizz_asset_obj;
async_obj: rizz_asset_obj;
forced_flags: rizz_asset_load_flags) {.cdecl.}
unregister_asset_type*: proc (name: cstring) {.cdecl.}
update_asset_callbacks*: proc (name: cstring; callbacks: rizz_asset_callbacks) {.
cdecl.}
load*: proc (name: cstring; path: cstring; params: pointer;
flags: rizz_asset_load_flags; alloc: ptr sx_alloc; tags: uint32): rizz_asset {.
cdecl.}
load_from_mem*: proc (name: cstring; path_alias: cstring; mem: ptr sx_mem_block;
params: pointer; flags: rizz_asset_load_flags;
alloc: ptr sx_alloc; tags: uint32): rizz_asset {.cdecl.}
unload*: proc (handle: rizz_asset) {.cdecl.}
state*: proc (handle: rizz_asset): rizz_asset_state {.cdecl.}
path*: proc (handle: rizz_asset): cstring {.cdecl.}
type_name*: proc (handle: rizz_asset): cstring {.cdecl.}
params*: proc (handle: rizz_asset): pointer {.cdecl.}
tags*: proc (handle: rizz_asset): uint32 {.cdecl.}
obj*: proc (handle: rizz_asset): rizz_asset_obj {.cdecl.}
obj_unsafe*: proc (handle: rizz_asset): rizz_asset_obj {.cdecl.}
ref_add*: proc (handle: rizz_asset): cint {.cdecl.}
ref_count*: proc (handle: rizz_asset): cint {.cdecl.}
reload_by_type*: proc (name: cstring) {.cdecl.}
gather_by_type*: proc (name: cstring; out_handles: ptr rizz_asset;
max_handles: cint): cint {.cdecl.}
unload_by_type*: proc (name: cstring) {.cdecl.}
reload_by_tags*: proc (tags: uint32) {.cdecl.}
gather_by_tags*: proc (tags: uint32; out_handles: ptr rizz_asset; max_handles: cint): cint {.
cdecl.}
unload_by_tags*: proc (tags: uint32) {.cdecl.}
group_begin*: proc (group: rizz_asset_group): rizz_asset_group {.cdecl.}
group_end*: proc () {.cdecl.}
group_wait*: proc (group: rizz_asset_group) {.cdecl.}
group_loaded*: proc (group: rizz_asset_group): bool {.cdecl.}
group_delete*: proc (group: rizz_asset_group) {.cdecl.}
group_unload*: proc (group: rizz_asset_group) {.cdecl.}
group_gather*: proc (group: rizz_asset_group; out_handles: ptr rizz_asset;
max_handles: cint): cint {.cdecl.}
rizz_camera* {.bycopy, imprizzHdr, importc: "struct rizz_camera".} = object ## ```
## @camera
## ```
forward*: sx_vec3
right*: sx_vec3
up*: sx_vec3
pos*: sx_vec3
quat*: sx_quat
ffar*: cfloat
fnear*: cfloat
fov*: cfloat
viewport*: sx_rect
rizz_camera_fps* {.bycopy, imprizzHdr, importc: "struct rizz_camera_fps".} = object
cam*: rizz_camera
pitch*: cfloat
yaw*: cfloat
rizz_api_camera* {.bycopy, imprizzHdr, importc: "struct rizz_api_camera".} = object
init*: proc (cam: ptr rizz_camera; fov_deg: cfloat; viewport: sx_rect; fnear: cfloat;
ffar: cfloat) {.cdecl.}
lookat*: proc (cam: ptr rizz_camera; pos: sx_vec3; target: sx_vec3; up: sx_vec3) {.
cdecl.}
ortho_mat*: proc (cam: ptr rizz_camera): sx_mat4 {.cdecl.}
perspective_mat*: proc (cam: ptr rizz_camera): sx_mat4 {.cdecl.}
view_mat*: proc (cam: ptr rizz_camera): sx_mat4 {.cdecl.}
calc_frustum_points*: proc (cam: ptr rizz_camera; frustum: array[8, sx_vec3]) {.
cdecl.}
calc_frustum_points_range*: proc (cam: ptr rizz_camera;
frustum: array[8, sx_vec3]; fnear: cfloat;
ffar: cfloat) {.cdecl.}
fps_init*: proc (cam: ptr rizz_camera_fps; fov_deg: cfloat; viewport: sx_rect;
fnear: cfloat; ffar: cfloat) {.cdecl.}
fps_lookat*: proc (cam: ptr rizz_camera_fps; pos: sx_vec3; target: sx_vec3;
up: sx_vec3) {.cdecl.}
fps_pitch*: proc (cam: ptr rizz_camera_fps; pitch: cfloat) {.cdecl.}
fps_pitch_range*: proc (cam: ptr rizz_camera_fps; pitch: cfloat; min: cfloat;
max: cfloat) {.cdecl.}
fps_yaw*: proc (cam: ptr rizz_camera_fps; yaw: cfloat) {.cdecl.}
fps_forward*: proc (cam: ptr rizz_camera_fps; forward: cfloat) {.cdecl.}
fps_strafe*: proc (cam: ptr rizz_camera_fps; strafe: cfloat) {.cdecl.}
rizz_config* {.bycopy, imprizzHdr, importc: "struct rizz_config".} = object ## ```
## main app/game config
## ```
app_name*: cstring
app_title*: cstring
plugin_path*: cstring
cache_path*: cstring
cwd*: cstring
app_version*: uint32
app_flags*: rizz_app_flags
core_flags*: rizz_core_flags
log_level*: rizz_log_level ## ```
## default = RIZZ_LOG_LEVEL_INFO
## ```
plugins*: array[64, cstring]
dummy*: cstring ## ```
## this is always initialized to 0, so we can count plugins array
## ```
window_width*: cint
window_height*: cint
multisample_count*: cint
swap_interval*: cint
html5_canvas_name*: cstring
event_cb*: ptr rizz_app_event_cb
job_num_threads*: cint ## ```
## number of worker threads (default:-1, then it will be num_cores-1)
## ```
job_max_fibers*: cint ## ```
## maximum active jobs at a time (default = 64)
## ```
job_stack_size*: cint ## ```
## jobs stack size, in kbytes (default = 1mb)
## ```
coro_max_fibers*: cint ## ```
## maximum running (active) coroutines at a time. (default = 64)
## ```
coro_stack_size*: cint ## ```
## coroutine stack size (default = 2mb). in kbytes
## ```
tmp_mem_max*: cint ## ```
## per-frame temp memory size. in kbytes (defaut: 5mb per-thread)
## ```
profiler_listen_port*: cint ## ```
## default: 17815
## ```
profiler_update_interval_ms*: cint ## ```
## default: 10ms
## ```
rizz_game_config_cb* {.importc, imprizzHdr.} = proc (conf: ptr rizz_config;
argc: cint; argv: UncheckedArray[cstring]) {.cdecl.}
rizz_core_cmd_cb* {.importc, imprizzHdr.} = proc (argc: cint;
argv: UncheckedArray[cstring]): cint {.cdecl.}
rizz_log_entry* {.bycopy, imprizzHdr, importc: "struct rizz_log_entry".} = object
`type`*: rizz_log_level
channels*: uint32
text_len*: cint
source_file_len*: cint
text*: cstring
source_file*: cstring
line*: cint
rizz_track_alloc_item* {.bycopy, imprizzHdr,
importc: "struct rizz_track_alloc_item".} = object
file*: array[32, cchar]
`func`*: array[64, cchar]
`ptr`*: pointer
size*: int64
line*: cint
rizz_linalloc_info* {.bycopy, importc, imprizzHdr.} = object
offset*: int64
size*: int64
peak*: int64
rizz_trackalloc_info* {.bycopy, importc, imprizzHdr.} = object
name*: cstring
items*: ptr rizz_track_alloc_item
num_items*: cint
mem_id*: cint
size*: int64
peak*: int64
rizz_mem_info* {.bycopy, imprizzHdr, importc: "struct rizz_mem_info".} = object
trackers*: array[RIZZ_MEMID_COUNT, rizz_trackalloc_info]
temp_allocs*: array[64, rizz_linalloc_info]
num_trackers*: cint
num_temp_allocs*: cint
heap*: uint
heap_max*: uint
heap_count*: cint
rizz_version* {.bycopy, imprizzHdr, importc: "struct rizz_version".} = object
major*: cint
minor*: cint
git*: array[32, cchar]
rizz_profile_flags* {.importc, imprizzHdr.} = uint32
rizz_api_core* {.bycopy, imprizzHdr, importc: "struct rizz_api_core".} = object
heap_alloc*: proc (): ptr sx_alloc {.cdecl.} ## ```
## heap allocator: thread-safe, allocates dynamically from heap (libc->malloc)
## ```
tmp_alloc_push*: proc (): ptr sx_alloc {.cdecl.} ## ```
## temp stack allocator: fast and thread-safe (per job thread only).
## Temp allocators behave like stack, so they can push() and pop()
## NOTE: do not keep tmp_alloc memory between multiple frames,
## At the end of each frame, the tmp_allocs are reset
## ```
tmp_alloc_pop*: proc () {.cdecl.}
tls_register*: proc (name: cstring; user: pointer; init_cb: proc (thread_idx: cint;
thread_id: uint32; user: pointer): pointer {.cdecl.}) {.cdecl.} ## ```
## TLS functions are used for setting TLS variables to worker threads by an external source
## register: use name to identify the variable (Id). (not thread-safe)
## tls_var: gets pointer to variable, (thread-safe)
## init_cb will be called on the thread if it's the first time the variable is
## is fetched. you should initialize the variable and return it's pointer
## destroying tls variables are up to the user, after variable is destroyed, the return
## value of tls_var may be invalid
## ```
tls_var*: proc (name: cstring): pointer {.cdecl.}
alloc*: proc (id: rizz_mem_id): ptr sx_alloc {.cdecl.}
get_mem_info*: proc (info: ptr rizz_mem_info) {.cdecl.}
version*: proc (): rizz_version {.cdecl.}
rand*: proc (): uint32 {.cdecl.} ## ```
## 0..UNT32_MAX
## ```
randf*: proc (): cfloat {.cdecl.} ## ```
## 0..1
## ```
rand_range*: proc (min: cint; max: cint): cint {.cdecl.} ## ```
## _min.._max
## ```
delta_tick*: proc (): uint64 {.cdecl.}
elapsed_tick*: proc (): uint64 {.cdecl.}
fps*: proc (): cfloat {.cdecl.}
fps_mean*: proc (): cfloat {.cdecl.}
frame_index*: proc (): int64 {.cdecl.}
set_cache_dir*: proc (path: cstring) {.cdecl.}
cache_dir*: proc (): cstring {.cdecl.}
data_dir*: proc (): cstring {.cdecl.}
job_dispatch*: proc (count: cint; callback: proc (start: cint; `end`: cint;
thrd_index: cint; user: pointer) {.cdecl.}; user: pointer;
priority: sx_job_priority; tags: uint32): sx_job_t {.cdecl.} ## ```
## jobs
## ```
job_wait_and_del*: proc (job: sx_job_t) {.cdecl.}
job_test_and_del*: proc (job: sx_job_t): bool {.cdecl.}
job_num_threads*: proc (): cint {.cdecl.}
job_thread_index*: proc (): cint {.cdecl.}
coro_invoke*: proc (coro_cb: proc (a1: sx_fiber_transfer) {.cdecl.}; user: pointer) {.
cdecl.}
coro_end*: proc (pfrom: pointer) {.cdecl.}
coro_wait*: proc (pfrom: pointer; msecs: cint) {.cdecl.}
coro_yield*: proc (pfrom: pointer; nframes: cint) {.cdecl.}
register_log_backend*: proc (name: cstring; log_cb: proc (
entry: ptr rizz_log_entry; user: pointer) {.cdecl.}; user: pointer) {.cdecl.}
unregister_log_backend*: proc (name: cstring) {.cdecl.}
print_info*: proc (channels: uint32; source_file: cstring; line: cint; fmt: cstring) {.
cdecl, varargs.} ## ```
## use rizz_log_xxxx macros instead of these
## ```
print_debug*: proc (channels: uint32; source_file: cstring; line: cint; fmt: cstring) {.
cdecl, varargs.}
print_verbose*: proc (channels: uint32; source_file: cstring; line: cint;
fmt: cstring) {.cdecl, varargs.}
print_error*: proc (channels: uint32; source_file: cstring; line: cint; fmt: cstring) {.
cdecl, varargs.}
print_warning*: proc (channels: uint32; source_file: cstring; line: cint;
fmt: cstring) {.cdecl, varargs.}
set_log_level*: proc (level: rizz_log_level) {.cdecl.}
begin_profile_sample*: proc (name: cstring; flags: rizz_profile_flags;
hash_cache: ptr uint32) {.cdecl.}
end_profile_sample*: proc () {.cdecl.}
register_console_command*: proc (cmd: cstring; callback: ptr rizz_core_cmd_cb) {.
cdecl.}
show_graphics_debugger*: proc (p_open: ptr bool) {.cdecl.} ## ```
## debugging
## ```
show_memory_debugger*: proc (p_open: ptr bool) {.cdecl.}
show_log*: proc (p_open: ptr bool) {.cdecl.}
sg_buffer* {.bycopy, imprizzHdr, importc: "struct sg_buffer".} = object ## ```
## Copyright 2019 Sepehr Taghdisian (septag@github). All rights reserved.
## License: https:github.com/septag/rizz#license-bsd-2-clause
## clang-format off
##
## Resource id typedefs:
##
## sg_buffer: vertex- and index-buffers
## sg_image: textures and render targets
## sg_shader: vertex- and fragment-shaders, uniform blocks
## sg_pipeline: associated shader and vertex-layouts, and render states
## sg_pass: a bundle of render targets and actions on them
## sg_context: a 'context handle' for switching between 3D-API contexts
##
## Instead of pointers, resource creation functions return a 32-bit
## number which uniquely identifies the resource object.
##
## The 32-bit resource id is split into a 16-bit pool index in the lower bits,
## and a 16-bit 'unique counter' in the upper bits. The index allows fast
## pool lookups, and combined with the unique-mask it allows to detect
## 'dangling accesses' (trying to use an object which no longer exists, and
## its pool slot has been reused for a new object)
##
## The resource ids are wrapped into a struct so that the compiler
## can complain when the wrong resource type is used.
## ```
id*: uint32
sg_image* {.bycopy, imprizzHdr, importc: "struct sg_image".} = object
id*: uint32
sg_shader* {.bycopy, imprizzHdr, importc: "struct sg_shader".} = object
id*: uint32
sg_pipeline* {.bycopy, imprizzHdr, importc: "struct sg_pipeline".} = object
id*: uint32
sg_pass* {.bycopy, imprizzHdr, importc: "struct sg_pass".} = object
id*: uint32
sg_context* {.bycopy, imprizzHdr, importc: "struct sg_context".} = object
id*: uint32
sg_pixelformat_info* {.bycopy, imprizzHdr, importc: "struct sg_pixelformat_info".} = object ## ```
## Runtime information about a pixel format, returned
## by sg_query_pixelformat().
## ```
sample*: bool ## ```
## pixel format can be sampled in shaders
## ```
filter*: bool ## ```
## pixel format can be sampled with filtering
## ```
render*: bool ## ```
## pixel format can be used as render target
## ```
blend*: bool ## ```
## alpha-blending is supported
## ```
msaa*: bool ## ```
## pixel format can be used as MSAA render target
## ```
depth*: bool ## ```
## pixel format is a depth format
## ```
uav*: bool ## ```
## pixel format can be used as image store (compute-shaders)
## ```
sg_features* {.bycopy, imprizzHdr, importc: "struct sg_features".} = object ## ```
## Runtime information about available optional features,
## returned by sg_query_features()
## ```
instancing*: bool
origin_top_left*: bool
multiple_render_targets*: bool
msaa_render_targets*: bool
imagetype_3d*: bool ## ```
## creation of SG_IMAGETYPE_3D images is supported
## ```
imagetype_array*: bool ## ```
## creation of SG_IMAGETYPE_ARRAY images is supported
## ```
image_clamp_to_border*: bool ## ```
## border color and clamp-to-border UV-wrap mode is supported
## ```
compute_shaders*: bool ## ```
## compute-shader supported
## ```
sg_limits* {.bycopy, imprizzHdr, importc: "struct sg_limits".} = object ## ```
## Runtime information about resource limits, returned by sg_query_limit()
## ```
max_image_size_2d*: uint32 ## ```
## max width/height of SG_IMAGETYPE_2D images
## ```
max_image_size_cube*: uint32 ## ```
## max width/height of SG_IMAGETYPE_CUBE images
## ```
max_image_size_3d*: uint32 ## ```
## max width/height/depth of SG_IMAGETYPE_3D images
## ```
max_image_size_array*: uint32 ## ```
## max width/height pf SG_IMAGETYPE_ARRAY images
## ```
max_image_array_layers*: uint32 ## ```
## max number of layers in SG_IMAGETYPE_ARRAY images
## ```
max_vertex_attrs*: uint32 ## ```
## <= SG_MAX_VERTEX_ATTRIBUTES (only on some GLES2 impls)
## ```
sg_color_attachment_action* {.bycopy, imprizzHdr,
importc: "struct sg_color_attachment_action".} = object ## ```
## sg_pass_action
##
## The sg_pass_action struct defines the actions to be performed
## at the start of a rendering pass in the functions sg_begin_pass()
## and sg_begin_default_pass().
##
## A separate action and clear values can be defined for each
## color attachment, and for the depth-stencil attachment.
##
## The default clear values are defined by the macros:
##
## - SG_DEFAULT_CLEAR_RED: 0.5f
## - SG_DEFAULT_CLEAR_GREEN: 0.5f
## - SG_DEFAULT_CLEAR_BLUE: 0.5f
## - SG_DEFAULT_CLEAR_ALPHA: 1.0f
## - SG_DEFAULT_CLEAR_DEPTH: 1.0f
## - SG_DEFAULT_CLEAR_STENCIL: 0
## ```
action*: sg_action
val*: array[4, cfloat]
sg_depth_attachment_action* {.bycopy, imprizzHdr,
importc: "struct sg_depth_attachment_action".} = object
action*: sg_action
val*: cfloat
sg_stencil_attachment_action* {.bycopy, imprizzHdr,
importc: "struct sg_stencil_attachment_action".} = object
action*: sg_action
val*: uint8
sg_pass_action* {.bycopy, imprizzHdr, importc: "struct sg_pass_action".} = object
start_canary*: uint32
colors*: array[SG_MAX_COLOR_ATTACHMENTS, sg_color_attachment_action]
depth*: sg_depth_attachment_action
stencil*: sg_stencil_attachment_action
end_canary*: uint32
sg_bindings* {.bycopy, imprizzHdr, importc: "struct sg_bindings".} = object ## ```
## sg_bindings
##
## The sg_bindings structure defines the resource binding slots
## of the sokol_gfx render pipeline, used as argument to the
## sg_apply_bindings() function.
##
## A resource binding struct contains:
##
## - 1..N vertex buffers
## - 0..N vertex buffer offsets
## - 0..1 index buffers
## - 0..1 index buffer offsets
## - 0..N vertex shader stage images
## - 0..N fragment shader stage images
## - 0..N compute shader stage images
## - 0..N compute shader storage buffers
##
## The max number of vertex buffer and shader stage images
## are defined by the SG_MAX_SHADERSTAGE_BUFFERS and
## SG_MAX_SHADERSTAGE_IMAGES configuration constants.
##
## The optional buffer offsets can be used to put different unrelated
## chunks of vertex- and/or index-data into the same buffer objects.
## ```
start_canary*: uint32
vertex_buffers*: array[SG_MAX_SHADERSTAGE_BUFFERS, sg_buffer]
vertex_buffer_offsets*: array[SG_MAX_SHADERSTAGE_BUFFERS, cint]
index_buffer*: sg_buffer
index_buffer_offset*: cint
vs_images*: array[SG_MAX_SHADERSTAGE_IMAGES, sg_image]
vs_buffers*: array[SG_MAX_SHADERSTAGE_BUFFERS, sg_buffer]
fs_images*: array[SG_MAX_SHADERSTAGE_IMAGES, sg_image]
fs_buffers*: array[SG_MAX_SHADERSTAGE_BUFFERS, sg_buffer]
cs_images*: array[SG_MAX_SHADERSTAGE_IMAGES, sg_image]
cs_buffers*: array[SG_MAX_SHADERSTAGE_BUFFERS, sg_buffer]
cs_image_uavs*: array[SG_MAX_SHADERSTAGE_UAVS, sg_image]
cs_buffer_uavs*: array[SG_MAX_SHADERSTAGE_UAVS, sg_buffer]
end_canary*: uint32
sg_buffer_desc* {.bycopy, imprizzHdr, importc: "struct sg_buffer_desc".} = object ## ```
## sg_buffer_desc
##
## Creation parameters for sg_buffer objects, used in the
## sg_make_buffer() call.
##
## The default configuration is:
##
## .size: 0 (thismust* be set to a valid size in bytes)
## .type: SG_BUFFERTYPE_VERTEXBUFFER
## .usage: SG_USAGE_IMMUTABLE
## .shader_write false
## .content 0
## .label 0 (optional string label for trace hooks)
##
## The label will be ignored by sokol_gfx.h, it is only useful
## when hooking into sg_make_buffer() or sg_init_buffer() via
## the sg_install_trace_hooks() function.
##
## ADVANCED TOPIC: Injecting native 3D-API buffers:
##
## The following struct members allow to inject your own GL, Metal
## or D3D11 buffers into sokol_gfx:
##
## .gl_buffers[SG_NUM_INFLIGHT_FRAMES]
## .mtl_buffers[SG_NUM_INFLIGHT_FRAMES]
## .d3d11_buffer
##
## You must still provide all other members except the .content member, and
## these must match the creation parameters of the native buffers you
## provide. For SG_USAGE_IMMUTABLE, only provide a single native 3D-API
## buffer, otherwise you need to provide SG_NUM_INFLIGHT_FRAMES buffers
## (only for GL and Metal, not D3D11). Providing multiple buffers for GL and
## Metal is necessary because sokol_gfx will rotate through them when
## calling sg_update_buffer() to prevent lock-stalls.
##
## Note that it is expected that immutable injected buffer have already been
## initialized with content, and the .content member must be 0!
##
## Also you need to call sg_reset_state_cache() after calling native 3D-API
## functions, and before calling any sokol_gfx function.
## ```
start_canary*: uint32
size*: cint
`type`*: sg_buffer_type
usage*: sg_usage
shader_write*: bool
content*: pointer
label*: cstring ## ```
## GL specific
## ```
gl_buffers*: array[SG_NUM_INFLIGHT_FRAMES, uint32] ## ```
## GL specific
## ```
mtl_buffers*: array[SG_NUM_INFLIGHT_FRAMES, pointer] ## ```
## Metal specific
## ```
d3d11_buffer*: pointer ## ```
## D3D11 specific
## ```
wgpu_buffer*: pointer ## ```
## WebGPU specific
## ```
end_canary*: uint32
sg_subimage_content* {.bycopy, imprizzHdr, importc: "struct sg_subimage_content".} = object ## ```
## sg_subimage_content
##
## Pointer to and size of a subimage-surface data, this is
## used to describe the initial content of immutable-usage images,
## or for updating a dynamic- or stream-usage images.
##
## For 3D- or array-textures, one sg_subimage_content item
## describes an entire mipmap level consisting of all array- or
## 3D-slices of the mipmap level. It is only possible to update
## an entire mipmap level, not parts of it.
## ```
`ptr`*: pointer ## ```
## pointer to subimage data
## ```
size*: cint ## ```
## size in bytes of pointed-to subimage data
## ```
sg_image_content* {.bycopy, imprizzHdr, importc: "struct sg_image_content".} = object ## ```
## sg_image_content
##
## Defines the content of an image through a 2D array
## of sg_subimage_content structs. The first array dimension
## is the cubemap face, and the second array dimension the
## mipmap level.
## ```
subimage*: array[SG_CUBEFACE_NUM, array[SG_MAX_MIPMAPS, sg_subimage_content]]
Union_rizzh2* {.union, bycopy, imprizzHdr, importc: "union Union_rizzh2".} = object
depth*: cint
layers*: cint
sg_image_desc* {.bycopy, imprizzHdr, importc: "struct sg_image_desc".} = object ## ```
## sg_image_desc
##
## Creation parameters for sg_image objects, used in the
## sg_make_image() call.
##
## The default configuration is:
##
## .type: SG_IMAGETYPE_2D
## .render_target: false
## .shader_write false
## .width 0 (must be set to >0)
## .height 0 (must be set to >0)
## .depth/.layers: 1
## .num_mipmaps: 1
## .usage: SG_USAGE_IMMUTABLE
## .pixel_format: SG_PIXELFORMAT_RGBA8 for textures, or sg_desc.context.color_format for render targets
## .sample_count: 1 for textures, or sg_desc.context.sample_count for render target
## .min_filter: SG_FILTER_NEAREST
## .mag_filter: SG_FILTER_NEAREST
## .wrap_u: SG_WRAP_REPEAT
## .wrap_v: SG_WRAP_REPEAT
## .wrap_w: SG_WRAP_REPEAT (only SG_IMAGETYPE_3D)
## .border_color SG_BORDERCOLOR_OPAQUE_BLACK
## .max_anisotropy 1 (must be 1..16)
## .min_lod 0.0f
## .max_lod FLT_MAX
## .content an sg_image_content struct to define the initial content
## .label 0 (optional string label for trace hooks)
##
## Q: Why is the default sample_count for render targets identical with the
## "default sample count" from sg_desc.context.sample_count?
##
## A: So that it matches the default sample count in pipeline objects. Even
## though it is a bit strange/confusing that offscreen render targets by default
## get the same sample count as the default framebuffer, but it's better that
## an offscreen render target created with default parameters matches
## a pipeline object created with default parameters.
##
## NOTE:
##
## SG_IMAGETYPE_ARRAY and SG_IMAGETYPE_3D are not supported on
## WebGL/GLES2, use sg_query_features().imagetype_array and
## sg_query_features().imagetype_3d at runtime to check
## if array- and 3D-textures are supported.
##
## Images with usage SG_USAGE_IMMUTABLE must be fully initialized by
## providing a valid .content member which points to
## initialization data.
##
## ADVANCED TOPIC: Injecting native 3D-API textures:
##
## The following struct members allow to inject your own GL, Metal
## or D3D11 textures into sokol_gfx:
##
## .gl_textures[SG_NUM_INFLIGHT_FRAMES]
## .mtl_textures[SG_NUM_INFLIGHT_FRAMES]
## .d3d11_texture
##
## The same rules apply as for injecting native buffers
## (see sg_buffer_desc documentation for more details).
## ```
start_canary*: uint32
`type`*: sg_image_type
render_target*: bool
shader_write*: bool
width*: cint
height*: cint
a7*: Union_rizzh2
num_mipmaps*: cint
usage*: sg_usage
pixel_format*: sg_pixel_format
sample_count*: cint
min_filter*: sg_filter
mag_filter*: sg_filter
wrap_u*: sg_wrap
wrap_v*: sg_wrap
wrap_w*: sg_wrap
border_color*: sg_border_color
max_anisotropy*: uint32
min_lod*: cfloat
max_lod*: cfloat
content*: sg_image_content
label*: cstring ## ```
## GL specific
## ```
gl_textures*: array[SG_NUM_INFLIGHT_FRAMES, uint32] ## ```
## GL specific
## ```
mtl_textures*: array[SG_NUM_INFLIGHT_FRAMES, pointer] ## ```
## Metal specific
## ```
d3d11_texture*: pointer ## ```
## D3D11 specific
## ```
wgpu_texture*: pointer ## ```
## WebGPU specific
## ```
end_canary*: uint32
sg_shader_attr_desc* {.bycopy, imprizzHdr, importc: "struct sg_shader_attr_desc".} = object ## ```
## sg_shader_desc
##
## The structure sg_shader_desc defines all creation parameters
## for shader programs, used as input to the sg_make_shader() function:
##
## - reflection information for vertex attributes (vertex shader inputs):
## - vertex attribute name (required for GLES2, optional for GLES3 and GL)
## - a semantic name and index (required for D3D11)
## - for each vertex- and fragment-shader-stage:
## - the shader source or bytecode
## - an optional entry function name
## - reflection info for each uniform block used by the shader stage:
## - the size of the uniform block in bytes
## - reflection info for each uniform block member (only required for GL backends):
## - member name
## - member type (SG_UNIFORMTYPE_xxx)
## - if the member is an array, the number of array items
## - reflection info for the texture images used by the shader stage:
## - the image type (SG_IMAGETYPE_xxx)
## - the sampler type (SG_SAMPLERTYPE_xxx, default is SG_SAMPLERTYPE_FLOAT)
## - the name of the texture sampler (required for GLES2, optional everywhere else)
##
## For all GL backends, shader source-code must be provided. For D3D11 and Metal,
## either shader source-code or byte-code can be provided.
##
## For D3D11, if source code is provided, the d3dcompiler_47.dll will be loaded
## on demand. If this fails, shader creation will fail.
## ```
name*: cstring ## ```
## GLSL vertex attribute name (only required for GLES2)
## ```
sem_name*: cstring ## ```
## HLSL semantic name
## ```
sem_index*: cint ## ```
## HLSL semantic index
## ```
sg_shader_uniform_desc* {.bycopy, imprizzHdr,
importc: "struct sg_shader_uniform_desc".} = object
name*: cstring
`type`*: sg_uniform_type
array_count*: cint
sg_shader_uniform_block_desc* {.bycopy, imprizzHdr,
importc: "struct sg_shader_uniform_block_desc".} = object
size*: cint
uniforms*: array[SG_MAX_UB_MEMBERS, sg_shader_uniform_desc]
sg_shader_image_desc* {.bycopy, imprizzHdr,
importc: "struct sg_shader_image_desc".} = object
name*: cstring
`type`*: sg_image_type ## ```
## FIXME: should this be renamed to 'image_type'?
## ```
sampler_type*: sg_sampler_type ## ```
## FIXME: should this be renamed to 'image_type'?
## ```
sg_shader_stage_desc* {.bycopy, imprizzHdr,
importc: "struct sg_shader_stage_desc".} = object
source*: cstring
byte_code*: ptr uint8
byte_code_size*: cint
entry*: cstring
uniform_blocks*: array[SG_MAX_SHADERSTAGE_UBS, sg_shader_uniform_block_desc]
images*: array[SG_MAX_SHADERSTAGE_IMAGES, sg_shader_image_desc]
sg_shader_desc* {.bycopy, imprizzHdr, importc: "struct sg_shader_desc".} = object
start_canary*: uint32
attrs*: array[SG_MAX_VERTEX_ATTRIBUTES, sg_shader_attr_desc]
vs*: sg_shader_stage_desc
fs*: sg_shader_stage_desc
cs*: sg_shader_stage_desc
label*: cstring
end_canary*: uint32
sg_buffer_layout_desc* {.bycopy, imprizzHdr,
importc: "struct sg_buffer_layout_desc".} = object ## ```
## sg_pipeline_desc
##
## The sg_pipeline_desc struct defines all creation parameters
## for an sg_pipeline object, used as argument to the
## sg_make_pipeline() function:
##
## - the vertex layout for all input vertex buffers
## - a shader object
## - the 3D primitive type (points, lines, triangles, ...)
## - the index type (none, 16- or 32-bit)
## - depth-stencil state
## - alpha-blending state
## - rasterizer state
##
## If the vertex data has no gaps between vertex components, you can omit
## the .layout.buffers[].stride and layout.attrs[].offset items (leave them
## default-initialized to 0), sokol-gfx will then compute the offsets and strides
## from the vertex component formats (.layout.attrs[].format). Please note
## that ALL vertex attribute offsets must be 0 in order for the
## automatic offset computation to kick in.
##
## The default configuration is as follows:
##
## .layout:
## .buffers[]: vertex buffer layouts
## .stride: 0 (if no stride is given it will be computed)
## .step_func SG_VERTEXSTEP_PER_VERTEX
## .step_rate 1
## .attrs[]: vertex attribute declarations
## .buffer_index 0 the vertex buffer bind slot
## .offset 0 (offsets can be omitted if the vertex layout has no gaps)
## .format SG_VERTEXFORMAT_INVALID (must be initialized!)
## .shader: 0 (must be initialized with a valid sg_shader id!)
## .primitive_type: SG_PRIMITIVETYPE_TRIANGLES
## .index_type: SG_INDEXTYPE_NONE
## .depth_stencil:
## .stencil_front, .stencil_back:
## .fail_op: SG_STENCILOP_KEEP
## .depth_fail_op: SG_STENCILOP_KEEP
## .pass_op: SG_STENCILOP_KEEP
## .compare_func SG_COMPAREFUNC_ALWAYS
## .depth_compare_func: SG_COMPAREFUNC_ALWAYS
## .depth_write_enabled: false
## .stencil_enabled: false
## .stencil_read_mask: 0
## .stencil_write_mask: 0
## .stencil_ref: 0
## .blend:
## .enabled: false
## .src_factor_rgb: SG_BLENDFACTOR_ONE
## .dst_factor_rgb: SG_BLENDFACTOR_ZERO
## .op_rgb: SG_BLENDOP_ADD
## .src_factor_alpha: SG_BLENDFACTOR_ONE
## .dst_factor_alpha: SG_BLENDFACTOR_ZERO
## .op_alpha: SG_BLENDOP_ADD
## .color_write_mask: SG_COLORMASK_RGBA
## .color_attachment_count 1
## .color_format SG_PIXELFORMAT_RGBA8
## .depth_format SG_PIXELFORMAT_DEPTHSTENCIL
## .blend_color: { 0.0f, 0.0f, 0.0f, 0.0f }
## .rasterizer:
## .alpha_to_coverage_enabled: false
## .cull_mode: SG_CULLMODE_NONE
## .face_winding: SG_FACEWINDING_CW
## .sample_count: sg_desc.context.sample_count
## .depth_bias: 0.0f
## .depth_bias_slope_scale: 0.0f
## .depth_bias_clamp: 0.0f
## .label 0 (optional string label for trace hooks)
## ```
stride*: cint
step_func*: sg_vertex_step
step_rate*: cint
sg_vertex_attr_desc* {.bycopy, imprizzHdr, importc: "struct sg_vertex_attr_desc".} = object
buffer_index*: cint
offset*: cint
format*: sg_vertex_format
sg_layout_desc* {.bycopy, imprizzHdr, importc: "struct sg_layout_desc".} = object
buffers*: array[SG_MAX_SHADERSTAGE_BUFFERS, sg_buffer_layout_desc]
attrs*: array[SG_MAX_VERTEX_ATTRIBUTES, sg_vertex_attr_desc]
sg_stencil_state* {.bycopy, imprizzHdr, importc: "struct sg_stencil_state".} = object
fail_op*: sg_stencil_op
depth_fail_op*: sg_stencil_op
pass_op*: sg_stencil_op
compare_func*: sg_compare_func
sg_depth_stencil_state* {.bycopy, imprizzHdr,
importc: "struct sg_depth_stencil_state".} = object
stencil_front*: sg_stencil_state
stencil_back*: sg_stencil_state
depth_compare_func*: sg_compare_func
depth_write_enabled*: bool
stencil_enabled*: bool
stencil_read_mask*: uint8
stencil_write_mask*: uint8
stencil_ref*: uint8
sg_blend_state* {.bycopy, imprizzHdr, importc: "struct sg_blend_state".} = object
enabled*: bool
src_factor_rgb*: sg_blend_factor
dst_factor_rgb*: sg_blend_factor
op_rgb*: sg_blend_op
src_factor_alpha*: sg_blend_factor
dst_factor_alpha*: sg_blend_factor
op_alpha*: sg_blend_op
color_write_mask*: uint8
color_attachment_count*: cint
color_format*: sg_pixel_format
depth_format*: sg_pixel_format
blend_color*: array[4, cfloat]
sg_rasterizer_state* {.bycopy, imprizzHdr, importc: "struct sg_rasterizer_state".} = object
alpha_to_coverage_enabled*: bool
cull_mode*: sg_cull_mode
face_winding*: sg_face_winding
sample_count*: cint
depth_bias*: cfloat
depth_bias_slope_scale*: cfloat
depth_bias_clamp*: cfloat
sg_pipeline_desc* {.bycopy, imprizzHdr, importc: "struct sg_pipeline_desc".} = object
start_canary*: uint32
layout*: sg_layout_desc
shader*: sg_shader
primitive_type*: sg_primitive_type
index_type*: sg_index_type
depth_stencil*: sg_depth_stencil_state
blend*: sg_blend_state
rasterizer*: sg_rasterizer_state
label*: cstring
end_canary*: uint32
Union_rizzh3* {.union, bycopy, imprizzHdr, importc: "union Union_rizzh3".} = object
face*: cint
layer*: cint
slice*: cint
sg_attachment_desc* {.bycopy, imprizzHdr, importc: "struct sg_attachment_desc".} = object ## ```
## sg_pass_desc
##
## Creation parameters for an sg_pass object, used as argument
## to the sg_make_pass() function.
##
## A pass object contains 1..4 color-attachments and none, or one,
## depth-stencil-attachment. Each attachment consists of
## an image, and two additional indices describing
## which subimage the pass will render to: one mipmap index, and
## if the image is a cubemap, array-texture or 3D-texture, the
## face-index, array-layer or depth-slice.
##
## Pass images must fulfill the following requirements:
##
## All images must have:
## - been created as render target (sg_image_desc.render_target = true)
## - the same size
## - the same sample count
##
## In addition, all color-attachment images must have the same pixel format.
## ```
image*: sg_image
mip_level*: cint
a3*: Union_rizzh3
sg_pass_desc* {.bycopy, imprizzHdr, importc: "struct sg_pass_desc".} = object
start_canary*: uint32
color_attachments*: array[SG_MAX_COLOR_ATTACHMENTS, sg_attachment_desc]
depth_stencil_attachment*: sg_attachment_desc
label*: cstring
end_canary*: uint32
sg_trace_hooks* {.bycopy, imprizzHdr, importc: "struct sg_trace_hooks".} = object ## ```
## sg_trace_hooks
##
## Installable callback functions to keep track of the sokol-gfx calls,
## this is useful for debugging, or keeping track of resource creation
## and destruction.
##
## Trace hooks are installed with sg_install_trace_hooks(), this returns
## another sg_trace_hooks struct with the previous set of
## trace hook function pointers. These should be invoked by the
## new trace hooks to form a proper call chain.
## ```
user_data*: pointer
reset_state_cache*: proc (user_data: pointer) {.cdecl.}
make_buffer*: proc (desc: ptr sg_buffer_desc; result: sg_buffer; user_data: pointer) {.
cdecl.}
make_image*: proc (desc: ptr sg_image_desc; result: sg_image; user_data: pointer) {.
cdecl.}
make_shader*: proc (desc: ptr sg_shader_desc; result: sg_shader; user_data: pointer) {.
cdecl.}
make_pipeline*: proc (desc: ptr sg_pipeline_desc; result: sg_pipeline;
user_data: pointer) {.cdecl.}
make_pass*: proc (desc: ptr sg_pass_desc; result: sg_pass; user_data: pointer) {.
cdecl.}
destroy_buffer*: proc (buf: sg_buffer; user_data: pointer) {.cdecl.}
destroy_image*: proc (img: sg_image; user_data: pointer) {.cdecl.}
destroy_shader*: proc (shd: sg_shader; user_data: pointer) {.cdecl.}
destroy_pipeline*: proc (pip: sg_pipeline; user_data: pointer) {.cdecl.}
destroy_pass*: proc (pass: sg_pass; user_data: pointer) {.cdecl.}
update_buffer*: proc (buf: sg_buffer; data_ptr: pointer; data_size: cint;
user_data: pointer) {.cdecl.}
update_image*: proc (img: sg_image; data: ptr sg_image_content; user_data: pointer) {.
cdecl.}
append_buffer*: proc (buf: sg_buffer; data_ptr: pointer; data_size: cint;
result: cint; user_data: pointer) {.cdecl.}
begin_default_pass*: proc (pass_action: ptr sg_pass_action; width: cint;
height: cint; user_data: pointer) {.cdecl.}
begin_pass*: proc (pass: sg_pass; pass_action: ptr sg_pass_action;
user_data: pointer) {.cdecl.}
apply_viewport*: proc (x: cint; y: cint; width: cint; height: cint;
origin_top_left: bool; user_data: pointer) {.cdecl.}
apply_scissor_rect*: proc (x: cint; y: cint; width: cint; height: cint;
origin_top_left: bool; user_data: pointer) {.cdecl.}
apply_pipeline*: proc (pip: sg_pipeline; user_data: pointer) {.cdecl.}
apply_bindings*: proc (bindings: ptr sg_bindings; user_data: pointer) {.cdecl.}
apply_uniforms*: proc (stage: sg_shader_stage; ub_index: cint; data: pointer;
num_bytes: cint; user_data: pointer) {.cdecl.}
draw*: proc (base_element: cint; num_elements: cint; num_instances: cint;
user_data: pointer) {.cdecl.}
end_pass*: proc (user_data: pointer) {.cdecl.}
commit*: proc (user_data: pointer) {.cdecl.}
alloc_buffer*: proc (result: sg_buffer; user_data: pointer) {.cdecl.}
alloc_image*: proc (result: sg_image; user_data: pointer) {.cdecl.}
alloc_shader*: proc (result: sg_shader; user_data: pointer) {.cdecl.}
alloc_pipeline*: proc (result: sg_pipeline; user_data: pointer) {.cdecl.}
alloc_pass*: proc (result: sg_pass; user_data: pointer) {.cdecl.}
init_buffer*: proc (buf_id: sg_buffer; desc: ptr sg_buffer_desc; user_data: pointer) {.
cdecl.}
init_image*: proc (img_id: sg_image; desc: ptr sg_image_desc; user_data: pointer) {.
cdecl.}
init_shader*: proc (shd_id: sg_shader; desc: ptr sg_shader_desc; user_data: pointer) {.
cdecl.}
init_pipeline*: proc (pip_id: sg_pipeline; desc: ptr sg_pipeline_desc;
user_data: pointer) {.cdecl.}
init_pass*: proc (pass_id: sg_pass; desc: ptr sg_pass_desc; user_data: pointer) {.
cdecl.}
fail_buffer*: proc (buf_id: sg_buffer; user_data: pointer) {.cdecl.}
fail_image*: proc (img_id: sg_image; user_data: pointer) {.cdecl.}
fail_shader*: proc (shd_id: sg_shader; user_data: pointer) {.cdecl.}
fail_pipeline*: proc (pip_id: sg_pipeline; user_data: pointer) {.cdecl.}
fail_pass*: proc (pass_id: sg_pass; user_data: pointer) {.cdecl.}
push_debug_group*: proc (name: cstring; user_data: pointer) {.cdecl.}
pop_debug_group*: proc (user_data: pointer) {.cdecl.}
err_buffer_pool_exhausted*: proc (user_data: pointer) {.cdecl.}
err_image_pool_exhausted*: proc (user_data: pointer) {.cdecl.}
err_shader_pool_exhausted*: proc (user_data: pointer) {.cdecl.}
err_pipeline_pool_exhausted*: proc (user_data: pointer) {.cdecl.}
err_pass_pool_exhausted*: proc (user_data: pointer) {.cdecl.}
err_context_mismatch*: proc (user_data: pointer) {.cdecl.}
err_pass_invalid*: proc (user_data: pointer) {.cdecl.}
err_draw_invalid*: proc (user_data: pointer) {.cdecl.}
err_bindings_invalid*: proc (user_data: pointer) {.cdecl.}
sg_slot_info* {.bycopy, imprizzHdr, importc: "struct sg_slot_info".} = object ## ```
## sg_buffer_info
## sg_image_info
## sg_shader_info
## sg_pipeline_info
## sg_pass_info
##
## These structs contain various internal resource attributes which
## might be useful for debug-inspection. Please don't rely on the
## actual content of those structs too much, as they are quite closely
## tied to sokol_gfx.h internals and may change more frequently than
## the other public API elements.
##
## The_info structs are used as the return values of the following functions:
##
## sg_query_buffer_info()
## sg_query_image_info()
## sg_query_shader_info()
## sg_query_pipeline_info()
## sg_query_pass_info()
## ```
state*: sg_resource_state ## ```
## the current state of this resource slot
## ```
res_id*: uint32 ## ```
## type-neutral resource if (e.g. sg_buffer.id)
## ```
ctx_id*: uint32 ## ```
## the context this resource belongs to
## ```
sg_buffer_info* {.bycopy, imprizzHdr, importc: "struct sg_buffer_info".} = object
slot*: sg_slot_info ## ```
## resource pool slot info
## ```
update_frame_index*: uint32 ## ```
## frame index of last sg_update_buffer()
## ```
append_frame_index*: uint32 ## ```
## frame index of last sg_append_buffer()
## ```
map_frame_index*: uint32 ## ```
## frame index of last sg_append_buffer()
## ```
append_pos*: cint ## ```
## current position in buffer for sg_append_buffer()
## ```
append_overflow*: bool ## ```
## is buffer in overflow state (due to sg_append_buffer)
## ```
num_slots*: cint ## ```
## number of renaming-slots for dynamically updated buffers
## ```
active_slot*: cint ## ```
## currently active write-slot for dynamically updated buffers
## ```
sg_image_info* {.bycopy, imprizzHdr, importc: "struct sg_image_info".} = object
slot*: sg_slot_info ## ```
## resource pool slot info
## ```
upd_frame_index*: uint32 ## ```
## frame index of last sg_update_image()
## ```
num_slots*: cint ## ```
## number of renaming-slots for dynamically updated images
## ```
active_slot*: cint ## ```
## currently active write-slot for dynamically updated images
## ```
sg_shader_info* {.bycopy, imprizzHdr, importc: "struct sg_shader_info".} = object
slot*: sg_slot_info ## ```
## resoure pool slot info
## ```
sg_pipeline_info* {.bycopy, imprizzHdr, importc: "struct sg_pipeline_info".} = object
slot*: sg_slot_info ## ```
## resource pool slot info
## ```
sg_pass_info* {.bycopy, imprizzHdr, importc: "struct sg_pass_info".} = object
slot*: sg_slot_info ## ```
## resource pool slot info
## ```
sg_gl_context_desc* {.bycopy, imprizzHdr, importc: "struct sg_gl_context_desc".} = object ## ```
## sg_desc
##
## The sg_desc struct contains configuration values for sokol_gfx,
## it is used as parameter to the sg_setup() call.
##
## FIXME: explain the various configuration options
##
## The default configuration is:
##
## .buffer_pool_size 128
## .image_pool_size 128
## .shader_pool_size 32
## .pipeline_pool_size 64
## .pass_pool_size 16
## .context_pool_size 16
## .sampler_cache_size 64
## .uniform_buffer_size 4 MB (4*1024*1024)
## .staging_buffer_size 8 MB (8*1024*1024)
##
## .context.color_format: default value depends on selected backend:
## all GL backends: SG_PIXELFORMAT_RGBA8
## Metal and D3D11: SG_PIXELFORMAT_BGRA8
## WGPU: no default* (must be queried from WGPU swapchain)
## .context.depth_format SG_PIXELFORMAT_DEPTH_STENCIL
## .context.sample_count 1
##
## GL specific:
## .context.gl.force_gles2
## if this is true the GL backend will act in "GLES2 fallback mode" even
## when compiled with SOKOL_GLES3, this is useful to fall back
## to traditional WebGL if a browser doesn't support a WebGL2 context
##
## Metal specific:
## (NOTE: All Objective-C object references are transferred through
## a bridged (const void*) to sokol_gfx, which will use a unretained
## bridged cast (__bridged id<xxx>) to retrieve the Objective-C
## references back. Since the bridge cast is unretained, the caller
## must hold a strong reference to the Objective-C object for the
## duration of the sokol_gfx call!
##
## .context.metal.device
## a pointer to the MTLDevice object
## .context.metal.renderpass_descriptor_cb
## a C callback function to obtain the MTLRenderPassDescriptor for the
## current frame when rendering to the default framebuffer, will be called
## in sg_begin_default_pass()
## .context.metal.drawable_cb
## a C callback function to obtain a MTLDrawable for the current
## frame when rendering to the default framebuffer, will be called in
## sg_end_pass() of the default pass
##
## D3D11 specific:
## .context.d3d11.device
## a pointer to the ID3D11Device object, this must have been created
## before sg_setup() is called
## .context..d3d11.device_context
## a pointer to the ID3D11DeviceContext object
## .context..d3d11.render_target_view_cb
## a C callback function to obtain a pointer to the current
## ID3D11RenderTargetView object of the default framebuffer,
## this function will be called in sg_begin_pass() when rendering
## to the default framebuffer
## .context.d3d11.depth_stencil_view_cb
## a C callback function to obtain a pointer to the current
## ID3D11DepthStencilView object of the default framebuffer,
## this function will be called in sg_begin_pass() when rendering
## to the default framebuffer
##
## WebGPU specific:
## .context.wgpu.device
## a WGPUDevice handle
## .context.wgpu.render_format
## WGPUTextureFormat of the swap chain surface
## .context.wgpu.render_view_cb
## callback to get the current WGPUTextureView of the swapchain's
## rendering attachment (may be an MSAA surface)
## .context.wgpu.resolve_view_cb
## callback to get the current WGPUTextureView of the swapchain's
## MSAA-resolve-target surface, must return 0 if not MSAA rendering
## .context.wgpu.depth_stencil_view_cb
## callback to get current default-pass depth-stencil-surface WGPUTextureView
## the pixel format of the default WGPUTextureView must be WGPUTextureFormat_Depth24Plus8
##
## When using sokol_gfx.h and sokol_app.h together, consider using the
## helper function sapp_sgcontext() in the sokol_glue.h header to
## initialize the sg_desc.context nested struct. sapp_sgcontext() returns
## a completely initialized sg_context_desc struct with information
## provided by sokol_app.h.
## ```
force_gles2*: bool
sg_mtl_context_desc* {.bycopy, imprizzHdr, importc: "struct sg_mtl_context_desc".} = object
device*: pointer
renderpass_descriptor_cb*: proc (): pointer {.cdecl.}
drawable_cb*: proc (): pointer {.cdecl.}
sg_metal_context_desc* {.importc, imprizzHdr.} = sg_mtl_context_desc
sg_d3d11_context_desc* {.bycopy, imprizzHdr,
importc: "struct sg_d3d11_context_desc".} = object
device*: pointer
device_context*: pointer
render_target_view_cb*: proc (): pointer {.cdecl.}
depth_stencil_view_cb*: proc (): pointer {.cdecl.}
sg_wgpu_context_desc* {.bycopy, imprizzHdr,
importc: "struct sg_wgpu_context_desc".} = object
device*: pointer ## ```
## WGPUDevice
## ```
render_view_cb*: proc (): pointer {.cdecl.} ## ```
## returns WGPUTextureView
## ```
resolve_view_cb*: proc (): pointer {.cdecl.} ## ```
## returns WGPUTextureView
## ```
depth_stencil_view_cb*: proc (): pointer {.cdecl.} ## ```
## returns WGPUTextureView, must be WGPUTextureFormat_Depth24Plus8
## ```
sg_context_desc* {.bycopy, imprizzHdr, importc: "struct sg_context_desc".} = object
color_format*: sg_pixel_format
depth_format*: sg_pixel_format
sample_count*: cint
gl*: sg_gl_context_desc
metal*: sg_metal_context_desc
d3d11*: sg_d3d11_context_desc
wgpu*: sg_wgpu_context_desc
sg_desc* {.bycopy, imprizzHdr, importc: "struct sg_desc".} = object
start_canary*: uint32
buffer_pool_size*: cint
image_pool_size*: cint
shader_pool_size*: cint
pipeline_pool_size*: cint
pass_pool_size*: cint
context_pool_size*: cint
uniform_buffer_size*: cint
staging_buffer_size*: cint
sampler_cache_size*: cint
context*: sg_context_desc
end_canary*: uint32
rizz_shader_refl_input* {.bycopy, imprizzHdr,
importc: "struct rizz_shader_refl_input".} = object
name*: array[32, cchar]
semantic*: array[32, cchar]
semantic_index*: cint
`type`*: sg_vertex_format
rizz_shader_refl_uniform_buffer* {.bycopy, imprizzHdr, importc: "struct rizz_shader_refl_uniform_buffer".} = object
name*: array[32, cchar]
size_bytes*: cint
binding*: cint
array_size*: cint ## ```
## for flattened ubos, we must provide array_size to the api with the type
## FLOAT4
## ```
rizz_shader_refl_buffer* {.bycopy, imprizzHdr,
importc: "struct rizz_shader_refl_buffer".} = object
name*: array[32, cchar]
size_bytes*: cint
binding*: cint
array_stride*: cint
rizz_shader_refl_texture* {.bycopy, imprizzHdr,
importc: "struct rizz_shader_refl_texture".} = object
name*: array[32, cchar]
binding*: cint
`type`*: sg_image_type
rizz_shader_refl* {.bycopy, imprizzHdr, importc: "struct rizz_shader_refl".} = object
lang*: rizz_shader_lang
stage*: rizz_shader_stage
profile_version*: cint
source_file*: array[32, cchar]
inputs*: ptr rizz_shader_refl_input
num_inputs*: cint
textures*: ptr rizz_shader_refl_texture
num_textures*: cint
storage_images*: ptr rizz_shader_refl_texture
num_storage_images*: cint
storage_buffers*: ptr rizz_shader_refl_buffer
num_storage_buffers*: cint
uniform_buffers*: ptr rizz_shader_refl_uniform_buffer
num_uniform_buffers*: cint
code_type*: rizz_shader_code_type
flatten_ubos*: bool
rizz_shader_info* {.bycopy, imprizzHdr, importc: "struct rizz_shader_info".} = object ## ```
## shader metadata
## ```
inputs*: array[SG_MAX_VERTEX_ATTRIBUTES, rizz_shader_refl_input]
num_inputs*: cint
rizz_vertex_attr* {.bycopy, imprizzHdr, importc: "struct rizz_vertex_attr".} = object
semantic*: cstring
semantic_idx*: cint
offset*: cint
format*: sg_vertex_format
buffer_index*: cint
rizz_vertex_layout* {.bycopy, imprizzHdr, importc: "struct rizz_vertex_layout".} = object
attrs*: array[SG_MAX_VERTEX_ATTRIBUTES, rizz_vertex_attr]
rizz_shader* {.bycopy, imprizzHdr, importc: "struct rizz_shader".} = object
shd*: sg_shader
info*: rizz_shader_info
rizz_texture_load_params* {.bycopy, imprizzHdr,
importc: "struct rizz_texture_load_params".} = object
first_mip*: cint
min_filter*: sg_filter
mag_filter*: sg_filter
wrap_u*: sg_wrap
wrap_v*: sg_wrap
wrap_w*: sg_wrap
fmt*: sg_pixel_format ## ```
## request image format. only valid for basis files
## ```
Union_rizzh4* {.union, bycopy, imprizzHdr, importc: "union Union_rizzh4".} = object
depth*: cint
layers*: cint
rizz_texture_info* {.bycopy, imprizzHdr, importc: "struct rizz_texture_info".} = object ## ```
## texture metadata
## ```
`type`*: sg_image_type
format*: sg_pixel_format
mem_size_bytes*: cint
width*: cint
height*: cint
a6*: Union_rizzh4
mips*: cint
bpp*: cint
rizz_texture* {.bycopy, imprizzHdr, importc: "struct rizz_texture".} = object
img*: sg_image
info*: rizz_texture_info
rizz_gfx_perframe_trace_info* {.bycopy, imprizzHdr,
importc: "struct rizz_gfx_perframe_trace_info".} = object
num_draws*: cint
num_instances*: cint
num_apply_pipelines*: cint
num_apply_passes*: cint
num_elements*: cint
rizz_gfx_trace_info* {.bycopy, imprizzHdr, importc: "struct rizz_gfx_trace_info".} = object
pf*: array[RIZZ_GFX_TRACE_COUNT, rizz_gfx_perframe_trace_info] ## ```
## per-frame stats
## ```
num_pipelines*: cint ## ```
## persistent stats
## ```
num_shaders*: cint
num_passes*: cint
num_images*: cint
num_buffers*: cint
texture_size*: int64
texture_peak*: int64
buffer_size*: int64
buffer_peak*: int64
render_target_size*: int64
render_target_peak*: int64 ## ```
## end: persistent stats
## ```
sjson_context* {.importc, imprizzHdr, incompleteStruct.} = object
rizz_api_gfx_draw* {.bycopy, imprizzHdr, importc: "struct rizz_api_gfx_draw".} = object ## ```
## shader_parse_reflection
## There are two kinds of drawing APIs:
##
## Immediate API: access directly to GPU graphics API. this is actually a thin wrapper over backend
## Calls are executed immediately and sequentially, unlike _staged_ API (see below)
## Note: this API is NOT multi-threaded
## Immediate mode is more of a direct and immediate graphics API
## It is recommended to use staged API mentioned below,
##
## Staged API: staged (deferred calls), multi-threaded API.
## Contains only a selection of drawing functions
## Can be called within worker threads spawned by job_dispatch, but with some rules
## and restrictions
##
## Usage: always call begin_stage first, execute commands, then call end_stage
## At the end of the frame step, all commands buffers will be merged and executed by the
## rendering stages. Also, stages must be registered and setup before using staged
## functions. (see below)
##
## Rule #1: in a worker threads, always end_stage before spawning and waiting for
## another job because the command-buffer may change on thread-switch and drawing will be
## messed up
## Example of misuse:
## { dispatched job (worker-thread)
## job_dispatch(..);
## begin_stage(..)
## begin_pass(..);
## apply_viewport(..);
## job_wait_and_del(..) DON'T DO THIS: after wait, cmd-buffer will be changed
## instead, wait after end_stage call
## draw(..)
## end_stage(..)
## }
##
## Rule #2: Do not destroy graphics objects (buffers/shaders/textures) during rendering work
## This is actually like the multi-threaded asset usage pattern (see asset.h)
## You should only destroy graphics objects when they are not being rendered or used
##
## Rule #3: The commands will be submitted to GPU at the end of the frame update automatically
## But, you can use presend_commands and commit_commands to submit commands early
## and prevent the GPU driver from doing too much work at the end. see below:
##
## Common multi-threaded usage pattern is like as follows:
##
## [thread #1] -> |---draw---| |---draw---|
## [thread #2] -> |---draw---| |---draw---|
## [thread #3] -> |---draw---| |---draw---|
## [game update] -> ----dispatch+---draw---|wait+present---dispatch+commit----|wait---draw--- <- end
## | | |
## present called when no drawing is being done <-/ | |
## commit called during drawing (main thread) but after present <-/ |
## when frame is done, the framework will automatically execute and flush remaining commands <-/
## ```
begin*: proc (stage: rizz_gfx_stage): bool {.cdecl.}
`end`*: proc () {.cdecl.}
begin_default_pass*: proc (pass_action: ptr sg_pass_action; width: cint;
height: cint) {.cdecl.}
begin_pass*: proc (pass: sg_pass; pass_action: ptr sg_pass_action) {.cdecl.}
apply_viewport*: proc (x: cint; y: cint; width: cint; height: cint;
origin_top_left: bool) {.cdecl.}
apply_scissor_rect*: proc (x: cint; y: cint; width: cint; height: cint;
origin_top_left: bool) {.cdecl.}
apply_pipeline*: proc (pip: sg_pipeline) {.cdecl.}
apply_bindings*: proc (`bind`: ptr sg_bindings) {.cdecl.}
apply_uniforms*: proc (stage: sg_shader_stage; ub_index: cint; data: pointer;
num_bytes: cint) {.cdecl.}
draw*: proc (base_element: cint; num_elements: cint; num_instances: cint) {.cdecl.}
dispatch*: proc (thread_group_x: cint; thread_group_y: cint; thread_group_z: cint) {.
cdecl.}
end_pass*: proc () {.cdecl.}
update_buffer*: proc (buf: sg_buffer; data_ptr: pointer; data_size: cint) {.cdecl.}
append_buffer*: proc (buf: sg_buffer; data_ptr: pointer; data_size: cint): cint {.
cdecl.}
update_image*: proc (img: sg_image; data: ptr sg_image_content) {.cdecl.}
begin_profile_sample*: proc (name: cstring; hash_cache: ptr uint32) {.cdecl.} ## ```
## profile
## ```
end_profile_sample*: proc () {.cdecl.}
rizz_api_gfx* {.bycopy, imprizzHdr, importc: "struct rizz_api_gfx".} = object
imm*: rizz_api_gfx_draw ## ```
## immediate draw API
## ```
staged*: rizz_api_gfx_draw ## ```
## staged (deferred calls) draw API
## ```
backend*: proc (): rizz_gfx_backend {.cdecl.}
GL_family*: proc (): bool {.cdecl.}
GLES_family*: proc (): bool {.cdecl.}
reset_state_cache*: proc () {.cdecl.}
present_commands*: proc () {.cdecl.} ## ```
## multi-threading
## swaps the command buffers, makes previously submitted commands visible to commit_commands
## NOTE: care must be taken when calling this function, first of all, it should be called on
## the main thread. And should never be called when rendering jobs are running or
## undefined behviour will occur. see documentation for more info.
## ```
commit_commands*: proc () {.cdecl.} ## ```
## call this function to submit queued commands to the gpu. it will be also called automatically
## at the end of the frame. User must call present_commands before making this call
## NOTE: should call this function only on the main thread. see documentation for more info.
## ```
make_buffer*: proc (desc: ptr sg_buffer_desc): sg_buffer {.cdecl.} ## ```
## resource creation, destruction and updating
## ```
make_image*: proc (desc: ptr sg_image_desc): sg_image {.cdecl.}
make_shader*: proc (desc: ptr sg_shader_desc): sg_shader {.cdecl.}
make_pipeline*: proc (desc: ptr sg_pipeline_desc): sg_pipeline {.cdecl.}
make_pass*: proc (desc: ptr sg_pass_desc): sg_pass {.cdecl.}
destroy_buffer*: proc (buf: sg_buffer) {.cdecl.} ## ```
## destroys (destroys are deferred calls, they execute after 1 frame, if object is not used)
## ```
destroy_image*: proc (img: sg_image) {.cdecl.}
destroy_shader*: proc (shd: sg_shader) {.cdecl.}
destroy_pipeline*: proc (pip: sg_pipeline) {.cdecl.}
destroy_pass*: proc (pass: sg_pass) {.cdecl.}
query_buffer_overflow*: proc (buf: sg_buffer): bool {.cdecl.}
query_buffer_state*: proc (buf: sg_buffer): sg_resource_state {.cdecl.}
query_image_state*: proc (img: sg_image): sg_resource_state {.cdecl.}
query_shader_state*: proc (shd: sg_shader): sg_resource_state {.cdecl.}
query_pipeline_state*: proc (pip: sg_pipeline): sg_resource_state {.cdecl.}
query_pass_state*: proc (pass: sg_pass): sg_resource_state {.cdecl.}
alloc_buffer*: proc (): sg_buffer {.cdecl.} ## ```
## separate resource allocation and initialization (for async setup)
## ```
alloc_image*: proc (): sg_image {.cdecl.}
alloc_shader*: proc (): sg_shader {.cdecl.}
alloc_pipeline*: proc (): sg_pipeline {.cdecl.}
alloc_pass*: proc (): sg_pass {.cdecl.}
init_buffer*: proc (buf_id: sg_buffer; desc: ptr sg_buffer_desc) {.cdecl.} ## ```
## init/fail objects
## ```
init_image*: proc (img_id: sg_image; desc: ptr sg_image_desc) {.cdecl.}
init_shader*: proc (shd_id: sg_shader; desc: ptr sg_shader_desc) {.cdecl.}
init_pipeline*: proc (pip_id: sg_pipeline; desc: ptr sg_pipeline_desc) {.cdecl.}
init_pass*: proc (pass_id: sg_pass; desc: ptr sg_pass_desc) {.cdecl.}
fail_buffer*: proc (buf_id: sg_buffer) {.cdecl.}
fail_image*: proc (img_id: sg_image) {.cdecl.}
fail_shader*: proc (shd_id: sg_shader) {.cdecl.}
fail_pipeline*: proc (pip_id: sg_pipeline) {.cdecl.}
fail_pass*: proc (pass_id: sg_pass) {.cdecl.}
setup_context*: proc (): sg_context {.cdecl.} ## ```
## rendering contexts for multi-window rendering (optional)
## ```
activate_context*: proc (ctx_id: sg_context) {.cdecl.}
discard_context*: proc (ctx_id: sg_context) {.cdecl.}
install_trace_hooks*: proc (trace_hooks: ptr sg_trace_hooks): sg_trace_hooks {.
cdecl.}
query_desc*: proc (): sg_desc {.cdecl.}
query_buffer_info*: proc (buf: sg_buffer): sg_buffer_info {.cdecl.}
query_image_info*: proc (img: sg_image): sg_image_info {.cdecl.}
query_shader_info*: proc (shd: sg_shader): sg_shader_info {.cdecl.}
query_pipeline_info*: proc (pip: sg_pipeline): sg_pipeline_info {.cdecl.}
query_pass_info*: proc (pass: sg_pass): sg_pass_info {.cdecl.}
query_features*: proc (): sg_features {.cdecl.}
query_limits*: proc (): sg_limits {.cdecl.}
query_pixelformat*: proc (fmt: sg_pixel_format): sg_pixelformat_info {.cdecl.}
query_buffer_defaults*: proc (desc: ptr sg_buffer_desc): sg_buffer_desc {.cdecl.}
query_image_defaults*: proc (desc: ptr sg_image_desc): sg_image_desc {.cdecl.}
query_shader_defaults*: proc (desc: ptr sg_shader_desc): sg_shader_desc {.cdecl.}
query_pipeline_defaults*: proc (desc: ptr sg_pipeline_desc): sg_pipeline_desc {.
cdecl.}
query_pass_defaults*: proc (desc: ptr sg_pass_desc): sg_pass_desc {.cdecl.}
internal_state*: proc (make_cmdbuff: ptr pointer; make_cmdbuff_sz: ptr cint) {.cdecl.} ## ```
## internal use (imgui plugin)
## ```
stage_register*: proc (name: cstring; parent_stage: rizz_gfx_stage): rizz_gfx_stage {.
cdecl.} ## ```
## Stage:
## To performed deferred drawing calls, you should setup rendering stages on application
## init: register_stage Stages can be any group of drawing calls. For example, drawing a
## shadow-map for a light can be a stage Stages can also depend on each other. Multiple
## stages can depend on one stage to be finished, like a tree graph When the parent stage is
## disabled, all child stages are disabled
## ```
stage_enable*: proc (stage: rizz_gfx_stage) {.cdecl.}
stage_disable*: proc (stage: rizz_gfx_stage) {.cdecl.}
stage_isenabled*: proc (stage: rizz_gfx_stage): bool {.cdecl.}
stage_find*: proc (name: cstring): rizz_gfx_stage {.cdecl.}
shader_parse_reflection*: proc (alloc: ptr sx_alloc; stage_refl_json: cstring;
stage_refl_len: cint): ptr rizz_shader_refl {.
cdecl.} ## ```
## Shader
## ```
shader_free_reflection*: proc (refl: ptr rizz_shader_refl; alloc: ptr sx_alloc) {.
cdecl.}
shader_setup_desc*: proc (desc: ptr sg_shader_desc;
vs_refl: ptr rizz_shader_refl; vs: pointer;
vs_size: cint; fs_refl: ptr rizz_shader_refl;
fs: pointer; fs_size: cint): ptr sg_shader_desc {.cdecl.}
shader_make_with_data*: proc (alloc: ptr sx_alloc; vs_data_size: uint32;
vs_data: ptr uint32; vs_refl_size: uint32;
vs_refl_json: ptr uint32; fs_data_size: uint32;
fs_data: ptr uint32; fs_refl_size: uint32;
fs_refl_json: ptr uint32): rizz_shader {.cdecl.}
shader_bindto_pipeline*: proc (shd: ptr rizz_shader;
pip_desc: ptr sg_pipeline_desc;
vl: ptr rizz_vertex_layout): ptr sg_pipeline_desc {.
cdecl.}
shader_bindto_pipeline_sg*: proc (shd: sg_shader;
inputs: ptr rizz_shader_refl_input;
num_inputs: cint;
pip_desc: ptr sg_pipeline_desc;
vl: ptr rizz_vertex_layout): ptr sg_pipeline_desc {.
cdecl.}
shader_get*: proc (shader_asset: rizz_asset): ptr rizz_shader {.cdecl.}
texture_white*: proc (): sg_image {.cdecl.} ## ```
## texture
## ```
texture_black*: proc (): sg_image {.cdecl.}
texture_checker*: proc (): sg_image {.cdecl.}
texture_create_checker*: proc (checker_size: cint; size: cint;
colors: array[2, sx_color]): rizz_texture {.cdecl.}
texture_get*: proc (texture_asset: rizz_asset): ptr rizz_texture {.cdecl.}
trace_info*: proc (): ptr rizz_gfx_trace_info {.cdecl.} ## ```
## info
## ```
rizz_plugin* {.importc, imprizzHdr, bycopy.} = object
p*: pointer
api*: ptr rizz_api_plugin
iteration*: uint32 ## ```
## What reload we are on, first load is 1
## ```
crash_reason*: rizz_plugin_crash ## ```
## What reload we are on, first load is 1
## ```
rizz_plugin_info* {.importc, imprizzHdr, bycopy.} = object
version*: uint32
deps*: ptr cstring ## ```
## array: name of dependency plugins
## ```
num_deps*: cint ## ```
## array: name of dependency plugins
## ```
name*: array[32, cchar]
desc*: array[256, cchar]
rizz_plugin_main_cb* {.importc, imprizzHdr.} = proc (ctx: ptr rizz_plugin;
e: rizz_plugin_event): cint {.cdecl.}
rizz_plugin_get_info_cb* {.importc, imprizzHdr.} = proc (
out_info: ptr rizz_plugin_info) {.cdecl.}
rizz_plugin_event_handler_cb* {.importc, imprizzHdr.} = proc (
ev: ptr rizz_app_event) {.cdecl.}
rizz_api_plugin* {.bycopy, imprizzHdr, importc: "struct rizz_api_plugin".} = object
load*: proc (name: cstring): bool {.cdecl.}
inject_api*: proc (name: cstring; version: uint32; api: pointer) {.cdecl.}
remove_api*: proc (name: cstring; version: uint32) {.cdecl.}
get_api*: proc (api: rizz_api_type; version: uint32): pointer {.cdecl.}
get_api_byname*: proc (name: cstring; version: uint32): pointer {.cdecl.}
crash_reason*: proc (crash: rizz_plugin_crash): cstring {.cdecl.}
rizz_http_state* {.bycopy, imprizzHdr, importc: "struct rizz_http_state".} = object
status*: rizz_http_status
status_code*: cint
reason_phrase*: cstring
content_type*: cstring
response_size*: uint
response_data*: pointer
rizz_http_cb* {.importc, imprizzHdr.} = proc (http: ptr rizz_http_state; user: pointer) {.
cdecl.}
rizz_api_http* {.bycopy, imprizzHdr, importc: "struct rizz_api_http".} = object
get*: proc (url: cstring): rizz_http {.cdecl.} ## ```
## normal requests: returns immediately (async sockets)
## check status_code for retrieved http object to determine if it's finished or failed
## call free if http data is not needed any more. if not freed by the user, it will be freed
## when engine exits and throws a warning
## ```
post*: proc (url: cstring; data: pointer; size: uint): rizz_http {.cdecl.}
free*: proc (handle: rizz_http) {.cdecl.}
state*: proc (handle: rizz_http): ptr rizz_http_state {.cdecl.} ## ```
## return can be NULL (if it is not even started)
## ```
get_cb*: proc (url: cstring; callback: ptr rizz_http_cb; user: pointer) {.cdecl.} ## ```
## callback requests: triggers the callback when get/post is complete
## NOTE: do not call free in the callback functions, the request will be freed automatically
## ```
post_cb*: proc (url: cstring; data: pointer; size: uint; callback: ptr rizz_http_cb;
user: pointer) {.cdecl.}
Union_rizzh5* {.union, bycopy, imprizzHdr, importc: "union Union_rizzh5".} = object
any*: pointer
offset*: ptr int
rizz_refl_info* {.bycopy, imprizzHdr, importc: "struct rizz_refl_info".} = object
a1*: Union_rizzh5
`type`*: cstring
name*: cstring
base*: cstring
desc*: cstring
size*: cint
array_size*: cint
stride*: cint
flags*: uint32
internal_type*: rizz_refl_type
rizz_refl_field* {.bycopy, imprizzHdr, importc: "struct rizz__refl_field".} = object
info*: rizz_refl_info
value*: pointer
rizz_api_refl* {.bycopy, imprizzHdr, importc: "struct rizz_api_refl".} = object
reg*: proc (internal_type: rizz_refl_type; any: pointer; `type`: cstring;
name: cstring; base: cstring; desc: cstring; size: cint; base_size: cint) {.
cdecl.}
size_of*: proc (base_type: cstring): cint {.cdecl.}
get_func*: proc (name: cstring): pointer {.cdecl.}
get_enum*: proc (name: cstring; not_found: cint): cint {.cdecl.}
get_enum_name*: proc (`type`: cstring; val: cint): cstring {.cdecl.}
get_field*: proc (base_type: cstring; obj: pointer; name: cstring): pointer {.cdecl.}
get_fields*: proc (base_type: cstring; obj: pointer; fields: ptr rizz_refl_field;
max_fields: cint): cint {.cdecl.}
reg_count*: proc (): cint {.cdecl.}
is_cstring*: proc (r: ptr rizz_refl_info): bool {.cdecl.}
var
total* {.importc, imprizzHdr.}: uint
`ptr`* {.importc: "ptr", imprizzHdr.}: uint8
aligned* {.importc, imprizzHdr.}: uint8
header* {.importc, imprizzHdr.}: uint32
new_aligned* {.importc, imprizzHdr.}: uint8
var_b* {.importc: "var__b", imprizzHdr.}: typeof
SX_VEC2_ZERO* {.importc, imprizzHdr.}: sx_vec2 ## ```
## cpp operators
##
## Predefined static primitives
## ```
SX_VEC2_UNITX* {.importc, imprizzHdr.}: sx_vec2
SX_VEC2_UNITY* {.importc, imprizzHdr.}: sx_vec2
SX_VEC3_ZERO* {.importc, imprizzHdr.}: sx_vec3
SX_VEC3_UNITX* {.importc, imprizzHdr.}: sx_vec3
SX_VEC3_UNITY* {.importc, imprizzHdr.}: sx_vec3
SX_VEC3_UNITZ* {.importc, imprizzHdr.}: sx_vec3
SX_VEC4_ZERO* {.importc, imprizzHdr.}: sx_vec4
SX_VEC4_UNITX* {.importc, imprizzHdr.}: sx_vec4
SX_VEC4_UNITY* {.importc, imprizzHdr.}: sx_vec4
SX_VEC4_UNITZ* {.importc, imprizzHdr.}: sx_vec4
SX_COLOR_WHITE* {.importc, imprizzHdr.}: sx_color
SX_COLOR_BLACK* {.importc, imprizzHdr.}: sx_color
SX_COLOR_RED* {.importc, imprizzHdr.}: sx_color
SX_COLOR_YELLOW* {.importc, imprizzHdr.}: sx_color
SX_COLOR_GREEN* {.importc, imprizzHdr.}: sx_color
SX_COLOR_BLUE* {.importc, imprizzHdr.}: sx_color
SX_COLOR_PURPLE* {.importc, imprizzHdr.}: sx_color
proc sx_break_program*(text: cstring) {.importc: "sx__break_program", cdecl,
imprizzHdr.}
## ```
## static_assert doesn't do anything in MSVC + C compiler, because we just don't have it !
## Some libc function overrides
## Use sx_ versions in the code and override if required
## internal
## ```
proc sx_alloc_malloc*(): ptr sx_alloc {.importc, cdecl, imprizzHdr.}
## ```
## Default allocator: allocate from heap
## ```
proc sx_alloc_malloc_leak_detect*(): ptr sx_alloc {.importc, cdecl, imprizzHdr.}
## ```
## Leak checking allocator, useful for debug and SX_CONFIG_DEBUG_ALLOCATOR=1
## sx_alloc* sx_alloc_malloc_leak_detect();
## ```
proc sx_dump_leaks*(dump_leak_fn: sx_dump_leak_cb) {.importc, cdecl, imprizzHdr.}
proc sx_is_aligned*(`ptr`: pointer; align: uint32): bool {.importc, cdecl, imprizzHdr.}
proc sx_free*(alloc: ptr sx_alloc; `ptr`: pointer; align: uint32; file: cstring;
`func`: cstring; line: uint32) {.importc: "sx__free", cdecl, imprizzHdr.}
proc sx_aligned_free*(alloc: ptr sx_alloc; `ptr`: pointer; file: cstring;
`func`: cstring; line: uint32) {.importc: "sx__aligned_free",
cdecl, imprizzHdr.}
proc sx_coro_create_context*(alloc: ptr sx_alloc; max_fibers: cint; stack_sz: cint): ptr sx_coro_context {.
importc, cdecl, imprizzHdr.}
proc sx_coro_destroy_context*(ctx: ptr sx_coro_context; alloc: ptr sx_alloc) {.importc,
cdecl, imprizzHdr.}
proc sx_coro_update*(ctx: ptr sx_coro_context; dt: cfloat) {.importc, cdecl, imprizzHdr.}
proc sx_coro_replace_callback*(ctx: ptr sx_coro_context; callback: ptr sx_fiber_cb;
new_callback: ptr sx_fiber_cb): bool {.importc, cdecl,
imprizzHdr.}
proc sx_coro_invoke*(ctx: ptr sx_coro_context; callback: ptr sx_fiber_cb; user: pointer) {.
importc: "sx__coro_invoke", cdecl, imprizzHdr.}
proc sx_coro_end*(ctx: ptr sx_coro_context; pfrom: ptr sx_fiber_t) {.
importc: "sx__coro_end", cdecl, imprizzHdr.}
proc sx_coro_wait*(ctx: ptr sx_coro_context; pfrom: ptr sx_fiber_t; msecs: cint) {.
importc: "sx__coro_wait", cdecl, imprizzHdr.}
proc sx_coro_yield*(ctx: ptr sx_coro_context; pfrom: ptr sx_fiber_t; nupdates: cint) {.
importc: "sx__coro_yield", cdecl, imprizzHdr.}
proc sx_fiber_stack_init*(fstack: ptr sx_fiber_stack; size: cuint): bool {.importc,
cdecl, imprizzHdr.}
## ```
## Low-level functions
## ```
proc sx_fiber_stack_init_ptr*(fstack: ptr sx_fiber_stack; `ptr`: pointer; size: cuint) {.
importc, cdecl, imprizzHdr.}
proc sx_fiber_stack_release*(fstack: ptr sx_fiber_stack) {.importc, cdecl, imprizzHdr.}
proc sx_fiber_create*(stack: sx_fiber_stack; fiber_cb: ptr sx_fiber_cb): sx_fiber_t {.
importc, cdecl, imprizzHdr.}
proc sx_fiber_switch*(to: sx_fiber_t; user: pointer): sx_fiber_transfer {.importc,
cdecl, imprizzHdr.}
## ```
## Copyright 2018 Sepehr Taghdisian (septag@github). All rights reserved.
## License: https:github.com/septag/sx#license-bsd-2-clause
##
## clang-format off
## io.h v1.0: Some IO primitives like streaming memory reader/writer. File and IFF format implementation
## sx_mem_block: Memory block represents a piece of memory that can also grow with an allocator
## sx_mem_create_block allocates the entire continous block object with it's
## memory. this type CAN NOT grow
## sx_mem_destroy_block destroys the allocated block, use only with
## sx_mem_create_block
## sx_mem_init_block allocates a block of memory from allocator,
## this type can grow later
## sx_mem_release_block destroy the memory inside the memory block object,
## only use with 'sx_mem_init_block'
## sx_mem_init_block_ptr initializes a block of memory from pre-allocated memory,
## this type CAN NOT grow
## sx_mem_grow grows the memory is 'size' bytes, does not affect blocks
## initialized with _ptr
## sx_define_mem_block_onstack creates and initializes memory block on stack
##
## sx_mem_writer: Writes to an initialized memory block for streamed writing
## sx_mem_init_writer initializes the writer, allocates init_size as start
## sx_mem_release_writer releases writer memory
## sx_mem_write writes a piece of data to memory
## sx_mem_seekw seeks inside the buffer
## sx_mem_write_var helper macro to write single variables
##
## sx_mem_reader: Reads from a pre-allocated memory for streamed reading
## sx_init_reader initializes the read, data must be pre-allocated and
## alive during the read operations
## sx_mem_read reads a piece of data to memory
## sx_mem_seekr seeks inside the buffer
## sx_mem_read_var helper macro to read a single variable
## sx_mem_get_iff_chunk helper for reading IFF chunks
## searches size bytes from the current location for
## FOURCC chunk type. if size <= 0, searches till the end
## if chunk is not found, returning pos variable will be -1 -1
##
## sx_file: file related IO functions
## sx_file_open opens a file for writing or reading, initiates file objects
## sx_file_close closes an opened file
## sx_file_read Reads a buffer from file, offsets file pointer
## sx_file_write Writes a buffer to file, offsets file pointer
## sx_file_seek Sets file pointer, offset is in bytes
##
## sx_file_load_bin allocates memory and loads the file data into it
## sx_file_load_text Same as binary, but appends a null terminator to the end of the buffer
##
## sx_file_write_var Helper macro: writes a variable to file (no need for sizeof)
## sx_file_write_text Helper macro: writes a string to file (no need for strlen)
## sx_file_read_var Helper macro: reads a variable from file (no need for sizeof)
##
## sx_iff_file: binary IFF-like file writer/reader
## IFF is an old binary format, that is chunked-based. Each chunk has a FOURCC Id
## and can have multiple chunks as a child.
## There is no TOC, so new chunks can be appended to the end of the file,
## you can even mix different types of data into a single IFF file
## Reference: https:en.wikipedia.org/wiki/Interchange_File_Format
##
## sx_iff_init_from_file_reader: initialize IFF file for reading from a disk file.
## needs an already opened file with read access
## sx_iff_init_from_file_writer: initialize IFF file for writing to a disk file
## needs an already opened file with write access
## sx_iff_init_from_mem_reader: initialize IFF file for reading from memory buffer
## sx_iff_init_from_mem_writer: initialize IFF file for writing to memory buffer
## sx_iff_release: release any internal arrays and TOCs of chunks
## you should close any file handle (sx_file) after release
## sx_iff_get_chunk: searches for a specific chunk with a FOURCC code and
## a parent_id, parent_id should be 0 if it's on the root level
## Returns the index to sx_iff_file.chunks array if found and -1 if not
## sx_iff_get_next_chunk: Searches for the next chunk with the same FOURCC code and
## the same level (same parent) as the previous one
## The search patterns of multiple chunks would be like:
## int chunk = sx_iff_get_chunk(iff, fourcc, parent_id);
## while (chunk != -1) {
## sx_iff_read_chunk(chunk, data, ..);
## chunk = sx_iff_get_next_chunk(iff, chunk);
## }
## sx_iff_read_chunk: Read chunk data. You should provide the chunk_id returned
## by get_chunk family of functions
## sx_iff_put_chunk: Writes a chunk to IFF file
## you should provide parent_id (0 if has no parent)
## and memory to be written
## optionally, you can provide compression values for the chunk
## For example, if you have zipped the data, then you can provide
## uncompressed_size or hash value to later properly decompress the chunk data
##
## clang-format on
## ```
proc sx_mem_create_block*(alloc: ptr sx_alloc; size: int64; data: pointer; align: cint): ptr sx_mem_block {.
importc, cdecl, imprizzHdr.}
proc sx_mem_ref_block*(alloc: ptr sx_alloc; size: int64; data: pointer): ptr sx_mem_block {.
importc, cdecl, imprizzHdr.}
proc sx_mem_destroy_block*(mem: ptr sx_mem_block) {.importc, cdecl, imprizzHdr.}
proc sx_mem_init_block_ptr*(mem: ptr sx_mem_block; data: pointer; size: int64) {.
importc, cdecl, imprizzHdr.}
proc sx_mem_grow*(pmem: ptr ptr sx_mem_block; size: int64): bool {.importc, cdecl,
imprizzHdr.}
proc sx_mem_init_writer*(writer: ptr sx_mem_writer; alloc: ptr sx_alloc;
init_size: int64) {.importc, cdecl, imprizzHdr.}
proc sx_mem_release_writer*(writer: ptr sx_mem_writer) {.importc, cdecl, imprizzHdr.}
proc sx_mem_write*(writer: ptr sx_mem_writer; data: pointer; size: int64): int64 {.
importc, cdecl, imprizzHdr.}
proc sx_mem_seekw*(writer: ptr sx_mem_writer; offset: int64; whence: sx_whence): int64 {.
importc, cdecl, imprizzHdr.}
proc sx_mem_init_reader*(reader: ptr sx_mem_reader; data: pointer; size: int64) {.
importc, cdecl, imprizzHdr.}
proc sx_mem_read*(reader: ptr sx_mem_reader; data: pointer; size: int64): int64 {.
importc, cdecl, imprizzHdr.}
proc sx_mem_seekr*(reader: ptr sx_mem_reader; offset: int64; whence: sx_whence): int64 {.
importc, cdecl, imprizzHdr.}
proc sx_file_open*(file: ptr sx_file; filepath: cstring; flags: sx_file_open_flags): bool {.
importc, cdecl, imprizzHdr.}
proc sx_file_close*(file: ptr sx_file) {.importc, cdecl, imprizzHdr.}
proc sx_file_read*(file: ptr sx_file; data: pointer; size: int64): int64 {.importc, cdecl,
imprizzHdr.}
proc sx_file_write*(file: ptr sx_file; data: pointer; size: int64): int64 {.importc,
cdecl, imprizzHdr.}
proc sx_file_seek*(file: ptr sx_file; offset: int64; whence: sx_whence): int64 {.importc,
cdecl, imprizzHdr.}
proc sx_file_size*(file: ptr sx_file): int64 {.importc, cdecl, imprizzHdr.}
proc sx_file_load_text*(alloc: ptr sx_alloc; filepath: cstring): ptr sx_mem_block {.
importc, cdecl, imprizzHdr.}
proc sx_file_load_bin*(alloc: ptr sx_alloc; filepath: cstring): ptr sx_mem_block {.
importc, cdecl, imprizzHdr.}
proc sx_iff_init_from_file_reader*(iff: ptr sx_iff_file; file: ptr sx_file;
flags: sx_iff_flags; alloc: ptr sx_alloc): bool {.
importc, cdecl, imprizzHdr.}
proc sx_iff_init_from_file_writer*(iff: ptr sx_iff_file; file: ptr sx_file;
flags: sx_iff_flags; alloc: ptr sx_alloc): bool {.
importc, cdecl, imprizzHdr.}
proc sx_iff_init_from_mem_reader*(iff: ptr sx_iff_file; mread: ptr sx_mem_reader;
flags: sx_iff_flags; alloc: ptr sx_alloc): bool {.
importc, cdecl, imprizzHdr.}
proc sx_iff_init_from_mem_writer*(iff: ptr sx_iff_file; mwrite: ptr sx_mem_writer;
flags: sx_iff_flags; alloc: ptr sx_alloc): bool {.
importc, cdecl, imprizzHdr.}
proc sx_iff_release*(iff: ptr sx_iff_file) {.importc, cdecl, imprizzHdr.}
proc sx_iff_get_chunk*(iff: ptr sx_iff_file; fourcc: uint32; parent_id: cint): cint {.
importc, cdecl, imprizzHdr.}
proc sx_iff_get_next_chunk*(iff: ptr sx_iff_file; start_chunk_id: cint): cint {.
importc, cdecl, imprizzHdr.}
proc sx_iff_read_chunk*(iff: ptr sx_iff_file; chunk_id: cint; chunk_data: pointer;
size: int64): bool {.importc, cdecl, imprizzHdr.}
proc sx_iff_put_chunk*(iff: ptr sx_iff_file; parent_id: cint; fourcc: uint32;
chunk_data: pointer; size: int64; uncompressed_size: int64;
hash: uint64): cint {.importc, cdecl, imprizzHdr.}
proc sx_job_create_context*(alloc: ptr sx_alloc; desc: ptr sx_job_context_desc): ptr sx_job_context {.
importc, cdecl, imprizzHdr.}
proc sx_job_destroy_context*(ctx: ptr sx_job_context; alloc: ptr sx_alloc) {.importc,
cdecl, imprizzHdr.}
proc sx_job_dispatch*(ctx: ptr sx_job_context; count: cint; callback: ptr sx_job_cb;
user: pointer; priority: sx_job_priority; tags: cuint): sx_job_t {.
importc, cdecl, imprizzHdr.}
proc sx_job_wait_and_del*(ctx: ptr sx_job_context; job: sx_job_t) {.importc, cdecl,
imprizzHdr.}
proc sx_job_test_and_del*(ctx: ptr sx_job_context; job: sx_job_t): bool {.importc,
cdecl, imprizzHdr.}
proc sx_job_num_worker_threads*(ctx: ptr sx_job_context): cint {.importc, cdecl,
imprizzHdr.}
proc sx_job_set_current_thread_tags*(ctx: ptr sx_job_context; tags: cuint) {.importc,
cdecl, imprizzHdr.}
proc sx_job_thread_index*(ctx: ptr sx_job_context): cint {.importc, cdecl, imprizzHdr.}
proc sx_job_thread_id*(ctx: ptr sx_job_context): cuint {.importc, cdecl, imprizzHdr.}
## ```
## Copyright 2018 Sepehr Taghdisian (septag@github). All rights reserved.
## License: https:github.com/septag/sx#license-bsd-2-clause
##
## parts of this code is copied from bx library: https:github.com/bkaradzic/bx
## Copyright 2011-2019 Branimir Karadzic. All rights reserved.
## License: https:github.com/bkaradzic/bx#license-bsd-2-clause
##
##
## math.h - 1.3 Scalar and Vector math functions
## Contains vector primitives and vector/fpu math functions, event functions implemented in libm
## Many functions are taken from bx library (https:github.com/bkaradzic/bx)
## Easings:
## Reference: https:easings.net/
## https:github.com/r-lyeh-archived/tween
##
## Conventions:
## The lib prefers Right-Handed system, although there are functions for both LH or RH system
## for calulating view/projection matrices
## Rotations are CCW
## Matrices are Column-Major, but the representation is row-major, which means:
## mat->m[r][c] -> which R is the row, and C is column index
## transform vector (v) by matrix (M) = M.v
## matrix transforms are multiplied in reverse: Scale->Rotation->Translate = TxRxS
##
##
## Some math constants
## ```
proc sx_floor*(f: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_cos*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_acos*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_sin*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_asin*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_atan2*(y: cfloat; x: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_exp*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_log*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_sqrt*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_rsqrt*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_plane_normal*(va: sx_vec3; vb: sx_vec3; vc: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
proc sx_plane3p*(va: sx_vec3; vb: sx_vec3; vc: sx_vec3): sx_plane {.importc, cdecl,
imprizzHdr.}
proc sx_planenp*(normal: sx_vec3; p: sx_vec3): sx_plane {.importc, cdecl, imprizzHdr.}
proc sx_plane_distance*(plane: sx_plane; p: sx_vec3): cfloat {.importc, cdecl,
imprizzHdr.}
proc sx_plane_project_point*(plane: sx_plane; p: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
proc sx_plane_origin*(plane: sx_plane): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_calc_linearfit2D*(points: ptr sx_vec2; num: cint): sx_vec2 {.importc,
cdecl, imprizzHdr.}
proc sx_vec3_calc_linearfit3D*(points: ptr sx_vec3; num: cint): sx_vec3 {.importc,
cdecl, imprizzHdr.}
proc sx_mat4_from_normal*(normal: sx_vec3; scale: cfloat; pos: sx_vec3): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_from_normal_angle*(normal: sx_vec3; scale: cfloat; pos: sx_vec3;
angle: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_view_lookat*(eye: sx_vec3; target: sx_vec3; up: sx_vec3): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_view_lookatLH*(eye: sx_vec3; target: sx_vec3; up: sx_vec3): sx_mat4 {.
importc, cdecl, imprizzHdr.}
## ```
## https:www.3dgep.com/understanding-the-view-matrix/
## ```
proc sx_mat4_view_FPS*(eye: sx_vec3; pitch: cfloat; yaw: cfloat): sx_mat4 {.importc,
cdecl, imprizzHdr.}
## ```
## https:www.3dgep.com/understanding-the-view-matrix/
## ```
proc sx_mat4_view_arcball*(move: sx_vec3; rot: sx_quat; target_pos: sx_vec3): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_perspective*(width: cfloat; height: cfloat; zn: cfloat; zf: cfloat;
ogl_ndc: bool): sx_mat4 {.importc, cdecl, imprizzHdr.}
## ```
## https:docs.microsoft.com/en-us/windows/desktop/direct3d9/d3dxmatrixperspectivefovlh
## ```
proc sx_mat4_perspectiveLH*(width: cfloat; height: cfloat; zn: cfloat; zf: cfloat;
ogl_ndc: bool): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_perspective_offcenter*(xmin: cfloat; ymin: cfloat; xmax: cfloat;
ymax: cfloat; zn: cfloat; zf: cfloat; ogl_ndc: bool): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_perspective_offcenterLH*(xmin: cfloat; ymin: cfloat; xmax: cfloat;
ymax: cfloat; zn: cfloat; zf: cfloat;
ogl_ndc: bool): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_perspectiveFOV*(fov_y: cfloat; aspect: cfloat; zn: cfloat; zf: cfloat;
ogl_ndc: bool): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_perspectiveFOV_LH*(fov_y: cfloat; aspect: cfloat; zn: cfloat; zf: cfloat;
ogl_ndc: bool): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_ortho*(width: cfloat; height: cfloat; zn: cfloat; zf: cfloat;
offset: cfloat; ogl_ndc: bool): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_orthoLH*(width: cfloat; height: cfloat; zn: cfloat; zf: cfloat;
offset: cfloat; ogl_ndc: bool): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_ortho_offcenter*(xmin: cfloat; ymin: cfloat; xmax: cfloat; ymax: cfloat;
zn: cfloat; zf: cfloat; offset: cfloat; ogl_ndc: bool): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_ortho_offcenterLH*(xmin: cfloat; ymin: cfloat; xmax: cfloat; ymax: cfloat;
zn: cfloat; zf: cfloat; offset: cfloat; ogl_ndc: bool): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_SRT*(sx: cfloat; sy: cfloat; sz: cfloat; ax: cfloat; ay: cfloat; az: cfloat;
tx: cfloat; ty: cfloat; tz: cfloat): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_mul*(a: ptr sx_mat4; b: ptr sx_mat4): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_inv*(a: ptr sx_mat4): sx_mat4 {.importc, cdecl, imprizzHdr.}
## ```
## / Inverse for transform-only matrices (column4=0) (mat4x)
## ```
proc sx_mat4x_inv*(a: ptr sx_mat4): sx_mat4 {.importc, cdecl, imprizzHdr.}
## ```
## / Inverse for transform-only matrices (column4=0) (mat4x)
## ```
proc sx_mat4_quat*(mat: ptr sx_mat4): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_mat4_project_plane*(plane_normal: sx_vec3): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat3_inv*(a: ptr sx_mat3): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_mul*(a: ptr sx_mat3; b: ptr sx_mat3): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_quad_mat3*(quat: sx_quat): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_quat_mat4*(quat: sx_quat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_color_RGBtoHSV*(hsv: array[3, cfloat]; rgb: array[3, cfloat]) {.importc, cdecl,
imprizzHdr.}
proc sx_color_HSVtoRGB*(rgb: array[3, cfloat]; hsv: array[3, cfloat]) {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_transform*(aabb: ptr sx_aabb; mat: ptr sx_mat4): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_nearest_pow2*(n: cint): cint {.importc, cdecl, imprizzHdr.}
## ```
## https:graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
## ```
proc sx_ispow2*(n: cint): bool {.importc, cdecl, imprizzHdr.}
proc sx_torad*(deg: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_todeg*(rad: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_ftob*(a: cfloat): cuint {.importc, cdecl, imprizzHdr.}
## ```
## Packs float to unsigned int
## ```
proc sx_btof*(a: cuint): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## Unpacks float from unsigned int
## ```
proc sx_dtob*(a: cdouble): uint64 {.importc, cdecl, imprizzHdr.}
## ```
## Packs double to uint64_t
## ```
proc sx_btod*(a: uint64): cdouble {.importc, cdecl, imprizzHdr.}
## ```
## Unpacks uint64_t to double
## ```
proc sx_fflip*(value: cuint): cuint {.importc, cdecl, imprizzHdr.}
## ```
## Returns sortable bit packed float value
## http:archive.fo/2012.12.08-212402/http:stereopsis.com/radix.html
## ```
proc sx_isnan*(f: cfloat): bool {.importc, cdecl, imprizzHdr.}
proc sx_isnand*(f: cdouble): bool {.importc, cdecl, imprizzHdr.}
proc sx_isfin*(f: cfloat): bool {.importc, cdecl, imprizzHdr.}
proc sx_isfind*(f: cdouble): bool {.importc, cdecl, imprizzHdr.}
proc sx_isinf*(f: cfloat): bool {.importc, cdecl, imprizzHdr.}
proc sx_isinfd*(f: cdouble): bool {.importc, cdecl, imprizzHdr.}
proc sx_round*(f: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_ceil*(f: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_lerp*(a: cfloat; b: cfloat; t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_sign*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_abs*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_tan*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_sinh*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_cosh*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_tanh*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_atan*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_pow*(a: cfloat; b: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_exp2*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_log2*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_trunc*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## Returns the nearest integer not greater in magnitude than _a.
## ```
proc sx_fract*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## Returns the fractional (or decimal) part of _a, which is 0~1
## ```
proc sx_mod*(a: cfloat; b: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## Returns the floating-point remainder of the division operation _a/_b.
## ```
proc sx_equal_arr*(a: ptr cfloat; b: ptr cfloat; num: cint; epsilon: cfloat): bool {.
importc, cdecl, imprizzHdr.}
proc sx_wrap*(a: cfloat; wrap: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_wrap_range*(x: cfloat; fmin: cfloat; fmax: cfloat): cfloat {.importc, cdecl,
imprizzHdr.}
proc sx_iwrap_range*(x: cint; imin: cint; imax: cint): cint {.importc, cdecl, imprizzHdr.}
proc sx_step*(a: cfloat; edge: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## Returns 0 if _a < _edge, else 1
## ```
proc sx_pulse*(a: cfloat; start: cfloat; `end`: cfloat): cfloat {.importc, cdecl,
imprizzHdr.}
proc sx_bias*(time: cfloat; bias: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## References:
## - Bias And Gain Are Your Friend
## http:blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
## - http:demofox.org/biasgain.html
## ```
proc sx_gain*(time: cfloat; gain: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_angle_diff*(a: cfloat; b: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_angle_lerp*(a: cfloat; b: cfloat; t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_vec3f*(x: cfloat; y: cfloat; z: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_vec3fv*(f: ptr cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3v2*(vec: sx_vec2; z: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3splat*(f: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec2f*(x: cfloat; y: cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_vec2fv*(f: ptr cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2splat*(f: cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec4f*(x: cfloat; y: cfloat; z: cfloat; w: cfloat): sx_vec4 {.importc, cdecl,
imprizzHdr.}
## ```
##
## ```
proc sx_vec4fv*(f: ptr cfloat): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_vec4v3*(vec: sx_vec3; w: cfloat): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_vec4splat*(f: cfloat): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_ivec2i*(x: cint; y: cint): sx_ivec2 {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_ivec2iv*(f: ptr cint): sx_ivec2 {.importc, cdecl, imprizzHdr.}
proc sx_ivec2splat*(f: cint): sx_ivec2 {.importc, cdecl, imprizzHdr.}
proc sx_color4u*(r: cuchar; g: cuchar; b: cuchar; a: cuchar): sx_color {.importc, cdecl,
imprizzHdr.}
## ```
##
## ```
proc sx_color4f*(r: cfloat; g: cfloat; b: cfloat; a: cfloat): sx_color {.importc, cdecl,
imprizzHdr.}
proc sx_colorn*(n: cuint): sx_color {.importc, cdecl, imprizzHdr.}
proc sx_color_vec4*(c: sx_color): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_quat4f*(x: cfloat; y: cfloat; z: cfloat; w: cfloat): sx_quat {.importc, cdecl,
imprizzHdr.}
## ```
## Quaternion
## ```
proc sx_quat4fv*(f: ptr cfloat): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_quat_ident*(): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_quat_mulXYZ*(qa: sx_quat; qb: sx_quat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_quat_mul*(p: sx_quat; q: sx_quat): sx_quat {.importc, cdecl, imprizzHdr.}
## ```
## The product of two rotation quaternions will be equivalent to the rotation q followed by
## the rotation p
## ```
proc sx_quat_inv*(quat: sx_quat): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_quat_dot*(a: sx_quat; b: sx_quat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_quat_toeuler*(quat: sx_quat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_quat_rotateaxis*(axis: sx_vec3; angle: cfloat): sx_quat {.importc, cdecl,
imprizzHdr.}
proc sx_quat_rotateX*(ax: cfloat): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_quat_rotateY*(ay: cfloat): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_quat_rotateZ*(az: cfloat): sx_quat {.importc, cdecl, imprizzHdr.}
proc sx_vec3_abs*(a: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
## ```
## Vec3
## ```
proc sx_vec3_neg*(a: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_add*(a: sx_vec3; b: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_addf*(a: sx_vec3; b: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_sub*(a: sx_vec3; b: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_subf*(a: sx_vec3; b: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_mul*(a: sx_vec3; b: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_mulf*(a: sx_vec3; b: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_dot*(a: sx_vec3; b: sx_vec3): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_vec3_cross*(a: sx_vec3; b: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_len*(a: sx_vec3): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_vec3_lerp*(a: sx_vec3; b: sx_vec3; t: cfloat): sx_vec3 {.importc, cdecl,
imprizzHdr.}
proc sx_vec3_rcp*(a: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_tangent*(t: ptr sx_vec3; b: ptr sx_vec3; n: sx_vec3) {.importc, cdecl,
imprizzHdr.}
proc sx_vec3_tangent_angle*(t: ptr sx_vec3; b: ptr sx_vec3; n: sx_vec3; angle: cfloat) {.
importc, cdecl, imprizzHdr.}
proc sx_vec3_fromlatlong*(u: cfloat; v: cfloat): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_tolatlong*(dir: sx_vec3): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec3_mul_quat*(vec: sx_vec3; quat: sx_quat): sx_vec3 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4f*(m11: cfloat; m12: cfloat; m13: cfloat; m14: cfloat; m21: cfloat;
m22: cfloat; m23: cfloat; m24: cfloat; m31: cfloat; m32: cfloat;
m33: cfloat; m34: cfloat; m41: cfloat; m42: cfloat; m43: cfloat; m44: cfloat): sx_mat4 {.
importc, cdecl, imprizzHdr.}
## ```
## Matrix
## ```
proc sx_mat4fv*(col1: ptr cfloat; col2: ptr cfloat; col3: ptr cfloat; col4: ptr cfloat): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4v*(col1: sx_vec4; col2: sx_vec4; col3: sx_vec4; col4: sx_vec4): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_ident*(): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_row1*(m: ptr sx_mat4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_row2*(m: ptr sx_mat4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_row3*(m: ptr sx_mat4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_row4*(m: ptr sx_mat4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_translate*(tx: cfloat; ty: cfloat; tz: cfloat): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_scale*(sx: cfloat; sy: cfloat; sz: cfloat): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_scalef*(scale: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_rotateX*(ax: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_rotateY*(ay: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_rotateZ*(az: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_rotateXY*(ax: cfloat; ay: cfloat): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_rotateXYZ*(ax: cfloat; ay: cfloat; az: cfloat): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_rotateZYX*(ax: cfloat; ay: cfloat; az: cfloat): sx_mat4 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_quat_translate*(quat: sx_quat; translation: sx_vec3): sx_mat4 {.importc,
cdecl, imprizzHdr.}
proc sx_mat4_quat_translate_HMD*(quat: sx_quat; translation: sx_vec3): sx_mat4 {.
importc, cdecl, imprizzHdr.}
proc sx_mat4_mul_vec3*(mat: ptr sx_mat4; vec: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
## ```
## / multiply vector3 into 4x4 matrix without considering 4th column, which is not used in transform
## / matrices
## ```
proc sx_mat4_mul_vec3_xyz0*(mat: ptr sx_mat4; vec: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
## ```
## / multiply vector3 into rotation part of the matrix only (used for normal vectors, etc...)
## ```
proc sx_mat4_mul_vec3_H*(mat: ptr sx_mat4; vec: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
proc sx_mat4_mul_vec4*(mat: ptr sx_mat4; vec: sx_vec4): sx_vec4 {.importc, cdecl,
imprizzHdr.}
proc sx_vec4_mul*(a: sx_vec4; b: sx_vec4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_vec4_mulf*(a: sx_vec4; b: cfloat): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_vec4_add*(a: sx_vec4; b: sx_vec4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_vec4_sub*(a: sx_vec4; b: sx_vec4): sx_vec4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_transpose*(a: ptr sx_mat4): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_proj_flip_handedness*(dst: ptr sx_mat4; src: ptr sx_mat4) {.importc, cdecl,
imprizzHdr.}
## ```
## / Convert LH to RH projection matrix and vice versa.
## ```
proc sx_mat4_view_flip_handedness*(dst: ptr sx_mat4; src: ptr sx_mat4) {.importc, cdecl,
imprizzHdr.}
## ```
## / Convert LH to RH view matrix and vice versa.
## ```
proc sx_color_tolinear*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_color_togamma*(a: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_mat3f*(m11: cfloat; m12: cfloat; m13: cfloat; m21: cfloat; m22: cfloat;
m23: cfloat; m31: cfloat; m32: cfloat; m33: cfloat): sx_mat3 {.importc,
cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_mat3fv*(col1: ptr cfloat; col2: ptr cfloat; col3: ptr cfloat): sx_mat3 {.importc,
cdecl, imprizzHdr.}
proc sx_mat3v*(col1: sx_vec3; col2: sx_vec3; col3: sx_vec3): sx_mat3 {.importc, cdecl,
imprizzHdr.}
proc sx_mat3_ident*(): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_mul_vec3*(mat: ptr sx_mat3; vec: sx_vec3): sx_vec3 {.importc, cdecl,
imprizzHdr.}
## ```
## / multiply vector3 into 4x4 matrix that [x/w, y/w, z/w, 1], used for projections, etc...
## ```
proc sx_mat3_mul_vec2*(mat: ptr sx_mat3; vec: sx_vec2): sx_vec2 {.importc, cdecl,
imprizzHdr.}
proc sx_mat3_translate*(x: cfloat; y: cfloat): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_translatev*(p: sx_vec2): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_rotate*(theta: cfloat): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_scale*(sx: cfloat; sy: cfloat): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_mat3_SRT*(sx: cfloat; sy: cfloat; angle: cfloat; tx: cfloat; ty: cfloat): sx_mat3 {.
importc, cdecl, imprizzHdr.}
proc sx_mat3_transpose*(a: ptr sx_mat3): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_dot*(a: sx_vec2; b: sx_vec2): cfloat {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_vec2_len*(a: sx_vec2): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_vec2_lerp*(a: sx_vec2; b: sx_vec2; t: cfloat): sx_vec2 {.importc, cdecl,
imprizzHdr.}
proc sx_vec2_abs*(a: sx_vec2): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_neg*(a: sx_vec2): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_add*(a: sx_vec2; b: sx_vec2): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_addf*(a: sx_vec2; b: cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_sub*(a: sx_vec2; b: sx_vec2): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_subf*(a: sx_vec2; b: cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_mul*(a: sx_vec2; b: sx_vec2): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_vec2_mulf*(a: sx_vec2; b: cfloat): sx_vec2 {.importc, cdecl, imprizzHdr.}
proc sx_ivec2_add*(a: sx_ivec2; b: sx_ivec2): sx_ivec2 {.importc, cdecl, imprizzHdr.}
proc sx_ivec2_sub*(a: sx_ivec2; b: sx_ivec2): sx_ivec2 {.importc, cdecl, imprizzHdr.}
proc sx_rectf*(xmin: cfloat; ymin: cfloat; xmax: cfloat; ymax: cfloat): sx_rect {.importc,
cdecl, imprizzHdr.}
proc sx_rectwh*(x: cfloat; y: cfloat; w: cfloat; h: cfloat): sx_rect {.importc, cdecl,
imprizzHdr.}
proc sx_rectv*(min: sx_vec2; max: sx_vec2): sx_rect {.importc, cdecl, imprizzHdr.}
proc sx_rect_expand*(rc: sx_rect; expand: sx_vec2): sx_rect {.importc, cdecl, imprizzHdr.}
proc sx_rect_test_point*(rc: sx_rect; pt: sx_vec2): bool {.importc, cdecl, imprizzHdr.}
proc sx_rect_test_rect*(rc1: sx_rect; rc2: sx_rect): bool {.importc, cdecl, imprizzHdr.}
proc sx_rect_add_point*(rc: ptr sx_rect; pt: sx_vec2) {.importc, cdecl, imprizzHdr.}
proc sx_rect_corner*(rc: ptr sx_rect; index: cint): sx_vec2 {.importc, cdecl, imprizzHdr.}
## ```
## 2 3
## -----------------
## | |
## | |
## | |
## | |
## | |
## -----------------
## 0 1
## ```
proc sx_rect_corners*(corners: array[4, sx_vec2]; rc: ptr sx_rect) {.importc, cdecl,
imprizzHdr.}
proc sx_rect_width*(rc: sx_rect): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_rect_height*(rc: sx_rect): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_rect_move*(rc: sx_rect; pos: sx_vec2): sx_rect {.importc, cdecl, imprizzHdr.}
proc sx_irecti*(xmin: cint; ymin: cint; xmax: cint; ymax: cint): sx_irect {.importc, cdecl,
imprizzHdr.}
proc sx_irectwh*(x: cint; y: cint; w: cint; h: cint): sx_irect {.importc, cdecl, imprizzHdr.}
proc sx_irectv*(min: sx_ivec2; max: sx_ivec2): sx_irect {.importc, cdecl, imprizzHdr.}
proc sx_irect_expand*(rc: sx_irect; expand: sx_ivec2): sx_irect {.importc, cdecl,
imprizzHdr.}
proc sx_irect_test_point*(rc: sx_irect; pt: sx_ivec2): bool {.importc, cdecl, imprizzHdr.}
proc sx_irect_test_rect*(rc1: sx_irect; rc2: sx_irect): bool {.importc, cdecl,
imprizzHdr.}
proc sx_irect_add_point*(rc: ptr sx_irect; pt: sx_ivec2) {.importc, cdecl, imprizzHdr.}
proc sx_irect_width*(rc: sx_irect): cint {.importc, cdecl, imprizzHdr.}
proc sx_irect_height*(rc: sx_irect): cint {.importc, cdecl, imprizzHdr.}
proc sx_planef*(nx: cfloat; ny: cfloat; nz: cfloat; d: cfloat): sx_plane {.importc, cdecl,
imprizzHdr.}
## ```
##
## ```
proc sx_planev*(normal: sx_vec3; d: cfloat): sx_plane {.importc, cdecl, imprizzHdr.}
proc sx_irect_corner*(rc: ptr sx_irect; index: cint): sx_ivec2 {.importc, cdecl,
imprizzHdr.}
## ```
## 2 3 (max)
## -----------------
## | |
## | |
## | |
## | |
## | |
## -----------------
## 0 (min) 1
## ```
proc sx_irect_corners*(corners: array[4, sx_ivec2]; rc: ptr sx_irect) {.importc, cdecl,
imprizzHdr.}
proc sx_aabbf*(xmin: cfloat; ymin: cfloat; zmin: cfloat; xmax: cfloat; ymax: cfloat;
zmax: cfloat): sx_aabb {.importc, cdecl, imprizzHdr.}
## ```
## AABB
## ```
proc sx_aabbv*(vmin: sx_vec3; vmax: sx_vec3): sx_aabb {.importc, cdecl, imprizzHdr.}
proc sx_aabbwhd*(w: cfloat; h: cfloat; d: cfloat): sx_aabb {.importc, cdecl, imprizzHdr.}
proc sx_aabb_empty*(): sx_aabb {.importc, cdecl, imprizzHdr.}
proc sx_aabb_isempty*(aabb: ptr sx_aabb): bool {.importc, cdecl, imprizzHdr.}
proc sx_aabb_add_point*(aabb: ptr sx_aabb; pt: sx_vec3) {.importc, cdecl, imprizzHdr.}
proc sx_aabb_add*(aabb1: ptr sx_aabb; aabb2: ptr sx_aabb): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_test_point*(aabb: ptr sx_aabb; pt: sx_vec3): bool {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_corners*(corners: array[8, sx_vec3]; aabb: ptr sx_aabb) {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_extents*(aabb: ptr sx_aabb): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_aabb_center*(aabb: ptr sx_aabb): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_aabb_translate*(aabb: ptr sx_aabb; offset: sx_vec3): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_setpos*(aabb: ptr sx_aabb; pos: sx_vec3): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_expand*(aabb: ptr sx_aabb; expand: sx_vec3): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_aabb_scale*(aabb: ptr sx_aabb; scale: sx_vec3): sx_aabb {.importc, cdecl,
imprizzHdr.}
proc sx_tx3d_set*(pos: sx_vec3; rot: sx_mat3): sx_tx3d {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_tx3d_setf*(x: cfloat; y: cfloat; z: cfloat; rx: cfloat; ry: cfloat; rz: cfloat): sx_tx3d {.
importc, cdecl, imprizzHdr.}
proc sx_tx3d_ident*(): sx_tx3d {.importc, cdecl, imprizzHdr.}
proc sx_tx3d_mul*(txa: ptr sx_tx3d; txb: ptr sx_tx3d): sx_tx3d {.importc, cdecl,
imprizzHdr.}
proc sx_tx3d_mul_vec3*(tx: ptr sx_tx3d; v: sx_vec3): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_tx3d_mul_vec3_scale*(tx: ptr sx_tx3d; scale: sx_vec3; v: sx_vec3): sx_vec3 {.
importc, cdecl, imprizzHdr.}
proc sx_tx3d_inverse*(tx: ptr sx_tx3d): sx_tx3d {.importc, cdecl, imprizzHdr.}
proc sx_tx3d_mat4*(tx: ptr sx_tx3d): sx_mat4 {.importc, cdecl, imprizzHdr.}
proc sx_mat4_tx3d*(mat: ptr sx_mat4): sx_tx3d {.importc, cdecl, imprizzHdr.}
proc sx_box_set*(tx: sx_tx3d; extents: sx_vec3): sx_box {.importc, cdecl, imprizzHdr.}
## ```
##
## ```
proc sx_box_setpne*(pos: sx_vec3; extents: sx_vec3): sx_box {.importc, cdecl, imprizzHdr.}
proc sx_box_pos*(box: ptr sx_box): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_box_rot*(box: ptr sx_box): sx_mat3 {.importc, cdecl, imprizzHdr.}
proc sx_box_extents*(box: ptr sx_box): sx_vec3 {.importc, cdecl, imprizzHdr.}
proc sx_easein_quad*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
## ```
## easing
## ```
proc sx_easeout_quad*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_quad*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_cubic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_cubic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_cubic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_quart*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_quart*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_quart*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_quint*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_quint*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_quint*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_sine*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_sine*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_sine*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_circ*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_circ*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_circ*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_expo*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_expo*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_expo*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_elastic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_elastic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_elastic*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_back*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_back*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_back*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeout_bounce*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easein_bounce*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_easeinout_bounce*(t: cfloat): cfloat {.importc, cdecl, imprizzHdr.}
proc sx_tm_init*() {.importc, cdecl, imprizzHdr.}
proc sx_tm_now*(): uint64 {.importc, cdecl, imprizzHdr.}
proc sx_tm_diff*(new_ticks: uint64; old_ticks: uint64): uint64 {.importc, cdecl,
imprizzHdr.}
proc sx_tm_since*(start_ticks: uint64): uint64 {.importc, cdecl, imprizzHdr.}
proc sx_tm_laptime*(last_ticks: ptr uint64): uint64 {.importc, cdecl, imprizzHdr.}
proc sx_tm_round_to_common_refresh_rate*(duration: uint64): uint64 {.importc, cdecl,
imprizzHdr.}
proc sx_tm_sec*(ticks: uint64): cdouble {.importc, cdecl, imprizzHdr.}
proc sx_tm_ms*(ticks: uint64): cdouble {.importc, cdecl, imprizzHdr.}
proc sx_tm_us*(ticks: uint64): cdouble {.importc, cdecl, imprizzHdr.}
proc sx_tm_ns*(ticks: uint64): cdouble {.importc, cdecl, imprizzHdr.}
{.pop.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment