From 6255c0455533631e120ff7e7a1f91e3c130e7773 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 29 May 2023 11:19:52 +0200 Subject: [PATCH 001/292] sokol_gfx.h: image/sampler split wip --- sokol_gfx.h | 104 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 35 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7199fe571..b5b92ef4c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1255,6 +1255,7 @@ extern "C" { */ typedef struct sg_buffer { uint32_t id; } sg_buffer; typedef struct sg_image { uint32_t id; } sg_image; +typedef struct sg_sampler { uint32_t id; } sg_sampler; typedef struct sg_shader { uint32_t id; } sg_shader; typedef struct sg_pipeline { uint32_t id; } sg_pipeline; typedef struct sg_pass { uint32_t id; } sg_pass; @@ -2341,30 +2342,45 @@ typedef struct sg_image_desc { sg_usage usage; sg_pixel_format pixel_format; int sample_count; - sg_filter min_filter; - sg_filter mag_filter; - sg_wrap wrap_u; - sg_wrap wrap_v; - sg_wrap wrap_w; - sg_border_color border_color; - uint32_t max_anisotropy; - float min_lod; - float max_lod; sg_image_data data; const char* label; - /* GL specific */ + // optionally inject backend-specific resources uint32_t gl_textures[SG_NUM_INFLIGHT_FRAMES]; uint32_t gl_texture_target; - /* Metal specific */ const void* mtl_textures[SG_NUM_INFLIGHT_FRAMES]; - /* D3D11 specific */ const void* d3d11_texture; const void* d3d11_shader_resource_view; - /* WebGPU specific */ const void* wgpu_texture; uint32_t _end_canary; } sg_image_desc; +/* + sg_sampler_desc + + FIXME +*/ +typedef struct sg_sampler_desc { + uint32_t _start_canary; + sg_filter min_filter; + sg_filter mag_filter; + sg_filter mipmap_filter; + sg_wrap wrap_u; + sg_wrap wrap_v; + sg_wrap wrap_w; + float min_lod; + float max_lod; + sg_border_color border_color; + sg_compare_func compare; + uint32_t max_anisotropy; + const char* label; + // optionally inject backend-specific resources + uint32_t gl_sampler; + const void* mtl_sampler; + const void* d3d11_sampler; + const void* wgpu_sampler; + uint32_t _end_canary; +} sg_sampler_desc; + /* sg_shader_desc @@ -2735,38 +2751,42 @@ typedef struct sg_trace_hooks { sg_query_pass_info() */ typedef struct sg_slot_info { - sg_resource_state state; /* the current state of this resource slot */ - uint32_t res_id; /* type-neutral resource if (e.g. sg_buffer.id) */ - uint32_t ctx_id; /* the context this resource belongs to */ + sg_resource_state state; // the current state of this resource slot + uint32_t res_id; // type-neutral resource if (e.g. sg_buffer.id) + uint32_t ctx_id; // the context this resource belongs to } sg_slot_info; typedef struct sg_buffer_info { - sg_slot_info slot; /* resource pool slot info */ - uint32_t update_frame_index; /* frame index of last sg_update_buffer() */ - uint32_t append_frame_index; /* frame index of last sg_append_buffer() */ - int append_pos; /* current position in buffer for sg_append_buffer() */ - bool append_overflow; /* is buffer in overflow state (due to sg_append_buffer) */ - int num_slots; /* number of renaming-slots for dynamically updated buffers */ - int active_slot; /* currently active write-slot for dynamically updated buffers */ + sg_slot_info slot; // resource pool slot info + uint32_t update_frame_index; // frame index of last sg_update_buffer() + uint32_t append_frame_index; // frame index of last sg_append_buffer() + int append_pos; // current position in buffer for sg_append_buffer() + bool append_overflow; // is buffer in overflow state (due to sg_append_buffer) + int num_slots; // number of renaming-slots for dynamically updated buffers + int active_slot; // currently active write-slot for dynamically updated buffers } sg_buffer_info; typedef struct sg_image_info { - sg_slot_info slot; /* resource pool slot info */ - uint32_t upd_frame_index; /* frame index of last sg_update_image() */ - int num_slots; /* number of renaming-slots for dynamically updated images */ - int active_slot; /* currently active write-slot for dynamically updated images */ + sg_slot_info slot; // resource pool slot info + uint32_t upd_frame_index; // frame index of last sg_update_image() + int num_slots; // number of renaming-slots for dynamically updated images + int active_slot; // currently active write-slot for dynamically updated images } sg_image_info; +typedef struct sg_sampler_info { + sg_slot_info slot; // resource pool slot info +} sg_sampler_info; + typedef struct sg_shader_info { - sg_slot_info slot; /* resource pool slot info */ + sg_slot_info slot; // resource pool slot info } sg_shader_info; typedef struct sg_pipeline_info { - sg_slot_info slot; /* resource pool slot info */ + sg_slot_info slot; // resource pool slot info } sg_pipeline_info; typedef struct sg_pass_info { - sg_slot_info slot; /* resource pool slot info */ + sg_slot_info slot; // resource pool slot info } sg_pass_info; /* @@ -3220,11 +3240,13 @@ SOKOL_GFX_API_DECL bool sg_remove_commit_listener(sg_commit_listener listener); /* resource creation, destruction and updating */ SOKOL_GFX_API_DECL sg_buffer sg_make_buffer(const sg_buffer_desc* desc); SOKOL_GFX_API_DECL sg_image sg_make_image(const sg_image_desc* desc); +SOKOL_GFX_API_DECL sg_sampler sg_make_sampler(const sg_sampler_desc* desc); SOKOL_GFX_API_DECL sg_shader sg_make_shader(const sg_shader_desc* desc); SOKOL_GFX_API_DECL sg_pipeline sg_make_pipeline(const sg_pipeline_desc* desc); SOKOL_GFX_API_DECL sg_pass sg_make_pass(const sg_pass_desc* desc); SOKOL_GFX_API_DECL void sg_destroy_buffer(sg_buffer buf); SOKOL_GFX_API_DECL void sg_destroy_image(sg_image img); +SOKOL_GFX_API_DECL void sg_destroy_sampler(sg_sampler smp); SOKOL_GFX_API_DECL void sg_destroy_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_destroy_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_destroy_pass(sg_pass pass); @@ -3258,24 +3280,28 @@ SOKOL_GFX_API_DECL sg_pixelformat_info sg_query_pixelformat(sg_pixel_format fmt) /* get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) */ SOKOL_GFX_API_DECL sg_resource_state sg_query_buffer_state(sg_buffer buf); SOKOL_GFX_API_DECL sg_resource_state sg_query_image_state(sg_image img); +SOKOL_GFX_API_DECL sg_resource_state sg_query_sampler_state(sg_sampler smp); SOKOL_GFX_API_DECL sg_resource_state sg_query_shader_state(sg_shader shd); SOKOL_GFX_API_DECL sg_resource_state sg_query_pipeline_state(sg_pipeline pip); SOKOL_GFX_API_DECL sg_resource_state sg_query_pass_state(sg_pass pass); /* get runtime information about a resource */ SOKOL_GFX_API_DECL sg_buffer_info sg_query_buffer_info(sg_buffer buf); SOKOL_GFX_API_DECL sg_image_info sg_query_image_info(sg_image img); +SOKOL_GFX_API_DECL sg_sampler_info sg_query_sampler_info(sg_sampler smp); SOKOL_GFX_API_DECL sg_shader_info sg_query_shader_info(sg_shader shd); SOKOL_GFX_API_DECL sg_pipeline_info sg_query_pipeline_info(sg_pipeline pip); SOKOL_GFX_API_DECL sg_pass_info sg_query_pass_info(sg_pass pass); /* get desc structs matching a specific resource (NOTE that not all creation attributes may be provided) */ SOKOL_GFX_API_DECL sg_buffer_desc sg_query_buffer_desc(sg_buffer buf); SOKOL_GFX_API_DECL sg_image_desc sg_query_image_desc(sg_image img); +SOKOL_GFX_API_DECL sg_sampler_desc sg_query_sampler_desc(sg_sampler smp); SOKOL_GFX_API_DECL sg_shader_desc sg_query_shader_desc(sg_shader shd); SOKOL_GFX_API_DECL sg_pipeline_desc sg_query_pipeline_desc(sg_pipeline pip); SOKOL_GFX_API_DECL sg_pass_desc sg_query_pass_desc(sg_pass pass); /* get resource creation desc struct with their default values replaced */ SOKOL_GFX_API_DECL sg_buffer_desc sg_query_buffer_defaults(const sg_buffer_desc* desc); SOKOL_GFX_API_DECL sg_image_desc sg_query_image_defaults(const sg_image_desc* desc); +SOKOL_GFX_API_DECL sg_sampler_desc sg_query_sampler_defaults(const sg_sampler_desc* desc); SOKOL_GFX_API_DECL sg_shader_desc sg_query_shader_defaults(const sg_shader_desc* desc); SOKOL_GFX_API_DECL sg_pipeline_desc sg_query_pipeline_defaults(const sg_pipeline_desc* desc); SOKOL_GFX_API_DECL sg_pass_desc sg_query_pass_defaults(const sg_pass_desc* desc); @@ -3283,26 +3309,31 @@ SOKOL_GFX_API_DECL sg_pass_desc sg_query_pass_defaults(const sg_pass_desc* desc) /* separate resource allocation and initialization (for async setup) */ SOKOL_GFX_API_DECL sg_buffer sg_alloc_buffer(void); SOKOL_GFX_API_DECL sg_image sg_alloc_image(void); +SOKOL_GFX_API_DECL sg_sampler sg_alloc_sampler(void); SOKOL_GFX_API_DECL sg_shader sg_alloc_shader(void); SOKOL_GFX_API_DECL sg_pipeline sg_alloc_pipeline(void); SOKOL_GFX_API_DECL sg_pass sg_alloc_pass(void); SOKOL_GFX_API_DECL void sg_dealloc_buffer(sg_buffer buf); SOKOL_GFX_API_DECL void sg_dealloc_image(sg_image img); +SOKOL_GFX_API_DECL void sg_dealloc_sampler(sg_sampler smp); SOKOL_GFX_API_DECL void sg_dealloc_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_dealloc_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_dealloc_pass(sg_pass pass); SOKOL_GFX_API_DECL void sg_init_buffer(sg_buffer buf, const sg_buffer_desc* desc); SOKOL_GFX_API_DECL void sg_init_image(sg_image img, const sg_image_desc* desc); +SOKOL_GFX_API_DECL void sg_init_sampler(sg_sampler smg, const sg_sampler_desc* desc); SOKOL_GFX_API_DECL void sg_init_shader(sg_shader shd, const sg_shader_desc* desc); SOKOL_GFX_API_DECL void sg_init_pipeline(sg_pipeline pip, const sg_pipeline_desc* desc); SOKOL_GFX_API_DECL void sg_init_pass(sg_pass pass, const sg_pass_desc* desc); SOKOL_GFX_API_DECL void sg_uninit_buffer(sg_buffer buf); SOKOL_GFX_API_DECL void sg_uninit_image(sg_image img); +SOKOL_GFX_API_DECL void sg_uninit_sampler(sg_sampler smp); SOKOL_GFX_API_DECL void sg_uninit_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_uninit_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_uninit_pass(sg_pass pass); SOKOL_GFX_API_DECL void sg_fail_buffer(sg_buffer buf); SOKOL_GFX_API_DECL void sg_fail_image(sg_image img); +SOKOL_GFX_API_DECL void sg_fail_sampler(sg_sampler smp); SOKOL_GFX_API_DECL void sg_fail_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_fail_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_fail_pass(sg_pass pass); @@ -3335,6 +3366,7 @@ inline void sg_setup(const sg_desc& desc) { return sg_setup(&desc); } inline sg_buffer sg_make_buffer(const sg_buffer_desc& desc) { return sg_make_buffer(&desc); } inline sg_image sg_make_image(const sg_image_desc& desc) { return sg_make_image(&desc); } +inline sg_sampler sg_make_sampler(const sg_sampler_desc& desc) { return sg_make_sampler(&desc); } inline sg_shader sg_make_shader(const sg_shader_desc& desc) { return sg_make_shader(&desc); } inline sg_pipeline sg_make_pipeline(const sg_pipeline_desc& desc) { return sg_make_pipeline(&desc); } inline sg_pass sg_make_pass(const sg_pass_desc& desc) { return sg_make_pass(&desc); } @@ -3348,15 +3380,17 @@ inline void sg_apply_uniforms(sg_shader_stage stage, int ub_index, const sg_rang inline sg_buffer_desc sg_query_buffer_defaults(const sg_buffer_desc& desc) { return sg_query_buffer_defaults(&desc); } inline sg_image_desc sg_query_image_defaults(const sg_image_desc& desc) { return sg_query_image_defaults(&desc); } +inline sg_sampler_desc sg_query_sampler_defaults(const sg_sampler_desc& desc) { return sg_query_sampler_defaults(&desc); } inline sg_shader_desc sg_query_shader_defaults(const sg_shader_desc& desc) { return sg_query_shader_defaults(&desc); } inline sg_pipeline_desc sg_query_pipeline_defaults(const sg_pipeline_desc& desc) { return sg_query_pipeline_defaults(&desc); } inline sg_pass_desc sg_query_pass_defaults(const sg_pass_desc& desc) { return sg_query_pass_defaults(&desc); } -inline void sg_init_buffer(sg_buffer buf_id, const sg_buffer_desc& desc) { return sg_init_buffer(buf_id, &desc); } -inline void sg_init_image(sg_image img_id, const sg_image_desc& desc) { return sg_init_image(img_id, &desc); } -inline void sg_init_shader(sg_shader shd_id, const sg_shader_desc& desc) { return sg_init_shader(shd_id, &desc); } -inline void sg_init_pipeline(sg_pipeline pip_id, const sg_pipeline_desc& desc) { return sg_init_pipeline(pip_id, &desc); } -inline void sg_init_pass(sg_pass pass_id, const sg_pass_desc& desc) { return sg_init_pass(pass_id, &desc); } +inline void sg_init_buffer(sg_buffer buf, const sg_buffer_desc& desc) { return sg_init_buffer(buf, &desc); } +inline void sg_init_image(sg_image img, const sg_image_desc& desc) { return sg_init_image(img, &desc); } +inline void sg_init_sampler(sg_sampler smp, const sg_sampler_desc& desc) { return sg_init_sampler(smp, &desc); } +inline void sg_init_shader(sg_shader shd, const sg_shader_desc& desc) { return sg_init_shader(shd, &desc); } +inline void sg_init_pipeline(sg_pipeline pip, const sg_pipeline_desc& desc) { return sg_init_pipeline(pip, &desc); } +inline void sg_init_pass(sg_pass pass, const sg_pass_desc& desc) { return sg_init_pass(pass, &desc); } inline void sg_update_buffer(sg_buffer buf_id, const sg_range& data) { return sg_update_buffer(buf_id, &data); } inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_append_buffer(buf_id, &data); } From 2ab7f7dc8dd6bfdeeddb486419431ac82851ae22 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 29 May 2023 13:12:24 +0200 Subject: [PATCH 002/292] sokol_gfx.h: sampler bindings wip --- sokol_gfx.h | 166 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 69 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b5b92ef4c..235b545f4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1292,8 +1292,9 @@ enum { SG_NUM_SHADER_STAGES = 2, SG_NUM_INFLIGHT_FRAMES = 2, SG_MAX_COLOR_ATTACHMENTS = 4, - SG_MAX_SHADERSTAGE_BUFFERS = 8, + SG_MAX_VERTEX_BUFFERS = 8, SG_MAX_SHADERSTAGE_IMAGES = 12, + SG_MAX_SHADERSTAGE_SAMPLERS = 8, SG_MAX_SHADERSTAGE_UBS = 4, SG_MAX_UB_MEMBERS = 16, SG_MAX_VERTEX_ATTRIBUTES = 16, @@ -1618,21 +1619,33 @@ typedef enum sg_image_type { } sg_image_type; /* - sg_sampler_type + sg_image_sample_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. + FIXME +*/ +typedef enum sg_image_sample_type { + _SG_IMAGESAMPLETYPE_DEFAULT, // value 0 reserved for default-init + SG_IMAGESAMPLETYPE_FLOAT, + SG_IMAGESAMPLETYPE_DEPTH, + SG_IMAGESAMPLETYPE_SINT, + SG_IMAGESAMPLETYPE_UINT, + _SG_IMAGESAMPLETYPE_NUM, + _SG_IMAGESAMPLETYPE_FORCE_U32 = 0x7FFFFFFF +} sg_image_sample_type; + +/* + sg_sampler_binding_type - The default sampler type is SG_SAMPLERTYPE_FLOAT. + FIXME (WGPU only) */ -typedef enum sg_sampler_type { - _SG_SAMPLERTYPE_DEFAULT, /* value 0 reserved for default-init */ - SG_SAMPLERTYPE_FLOAT, - SG_SAMPLERTYPE_SINT, - SG_SAMPLERTYPE_UINT, -} sg_sampler_type; +typedef enum sg_sampler_binding_type { + _SG_SAMPLERBINDINGTYPE_DEFAULT, + SG_SAMPLERBINDINGTYPE_FILTERING, + SG_SAMPLERBINDINGTYPE_NONFILTERING, + SG_SAMPLERBINDINGTYPE_COMPARISON, + _SG_SAMPLERBINDINGTYPE_NUM, + _SG_SAMPLERBINDINGTYPE_FORCE_U32, +} sg_sampler_binding_type; /* sg_cube_face @@ -1701,10 +1714,6 @@ typedef enum sg_filter { _SG_FILTER_DEFAULT, /* value 0 reserved for default-init */ SG_FILTER_NEAREST, SG_FILTER_LINEAR, - SG_FILTER_NEAREST_MIPMAP_NEAREST, - SG_FILTER_NEAREST_MIPMAP_LINEAR, - SG_FILTER_LINEAR_MIPMAP_NEAREST, - SG_FILTER_LINEAR_MIPMAP_LINEAR, _SG_FILTER_NUM, _SG_FILTER_FORCE_U32 = 0x7FFFFFFF } sg_filter; @@ -2154,6 +2163,8 @@ typedef struct sg_pass_action { /* sg_bindings + FIXME + The sg_bindings structure defines the resource binding slots of the sokol_gfx render pipeline, used as argument to the sg_apply_bindings() function. @@ -2168,20 +2179,25 @@ typedef struct sg_pass_action { - 0..N fragment shader stage images The max number of vertex buffer and shader stage images - are defined by the SG_MAX_SHADERSTAGE_BUFFERS and + are defined by the SG_MAX_VERTEX_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. */ +typedef struct sg_stage_bindings { + sg_image images[SG_MAX_SHADERSTAGE_IMAGES]; + sg_sampler samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; +} sg_stage_bindings; + typedef struct sg_bindings { uint32_t _start_canary; - sg_buffer vertex_buffers[SG_MAX_SHADERSTAGE_BUFFERS]; - int vertex_buffer_offsets[SG_MAX_SHADERSTAGE_BUFFERS]; + sg_buffer vertex_buffers[SG_MAX_VERTEX_BUFFERS]; + int vertex_buffer_offsets[SG_MAX_VERTEX_BUFFERS]; sg_buffer index_buffer; int index_buffer_offset; - sg_image vs_images[SG_MAX_SHADERSTAGE_IMAGES]; - sg_image fs_images[SG_MAX_SHADERSTAGE_IMAGES]; + sg_stage_bindings vs; + sg_stage_bindings fs; uint32_t _end_canary; } sg_bindings; @@ -2245,13 +2261,10 @@ typedef struct sg_buffer_desc { sg_usage usage; sg_range data; const char* label; - /* GL specific */ + // optionally inject backend-specific resources uint32_t gl_buffers[SG_NUM_INFLIGHT_FRAMES]; - /* Metal specific */ const void* mtl_buffers[SG_NUM_INFLIGHT_FRAMES]; - /* D3D11 specific */ const void* d3d11_buffer; - /* WebGPU specific */ const void* wgpu_buffer; uint32_t _end_canary; } sg_buffer_desc; @@ -2435,11 +2448,18 @@ typedef struct sg_shader_uniform_block_desc { } sg_shader_uniform_block_desc; typedef struct sg_shader_image_desc { - const char* name; + const char* name; // GLSL location name (optional) sg_image_type image_type; - sg_sampler_type sampler_type; + sg_image_sample_type sample_type; + bool multisampled; + int glsl_sampler_index; // GLSL only: index into sg_shader_stage_desc.samplers array to form combined-image-sampler } sg_shader_image_desc; +typedef struct sg_shader_sampler_desc { + const char* name; // GLSL location name (optional) + sg_sampler_binding_type type; +} sg_shader_sampler_desc; + typedef struct sg_shader_stage_desc { const char* source; sg_range bytecode; @@ -2447,6 +2467,7 @@ typedef struct sg_shader_stage_desc { const char* d3d11_target; sg_shader_uniform_block_desc uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; sg_shader_image_desc images[SG_MAX_SHADERSTAGE_IMAGES]; + sg_shader_sampler_desc samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; } sg_shader_stage_desc; typedef struct sg_shader_desc { @@ -2527,28 +2548,28 @@ typedef struct sg_shader_desc { .alpha_to_coverage_enabled: false .label 0 (optional string label for trace hooks) */ -typedef struct sg_buffer_layout_desc { +typedef struct sg_vertex_buffer_layout_state { int stride; sg_vertex_step step_func; int step_rate; #if defined(SOKOL_ZIG_BINDINGS) uint32_t __pad[2]; #endif -} sg_buffer_layout_desc; +} sg_vertex_buffer_layout_state; -typedef struct sg_vertex_attr_desc { +typedef struct sg_vertex_attr_state { int buffer_index; int offset; sg_vertex_format format; #if defined(SOKOL_ZIG_BINDINGS) uint32_t __pad[2]; #endif -} sg_vertex_attr_desc; +} sg_vertex_attr_state; -typedef struct sg_layout_desc { - sg_buffer_layout_desc buffers[SG_MAX_SHADERSTAGE_BUFFERS]; - sg_vertex_attr_desc attrs[SG_MAX_VERTEX_ATTRIBUTES]; -} sg_layout_desc; +typedef struct sg_vertex_layout_state { + sg_vertex_buffer_layout_state buffers[SG_MAX_VERTEX_BUFFERS]; + sg_vertex_attr_state attrs[SG_MAX_VERTEX_ATTRIBUTES]; +} sg_vertex_layout_state; typedef struct sg_stencil_face_state { sg_compare_func compare; @@ -2585,20 +2606,20 @@ typedef struct sg_blend_state { sg_blend_op op_alpha; } sg_blend_state; -typedef struct sg_color_state { +typedef struct sg_color_target_state { sg_pixel_format pixel_format; sg_color_mask write_mask; sg_blend_state blend; -} sg_color_state; +} sg_color_target_state; typedef struct sg_pipeline_desc { uint32_t _start_canary; sg_shader shader; - sg_layout_desc layout; + sg_vertex_layout_state layout; sg_depth_state depth; sg_stencil_state stencil; int color_count; - sg_color_state colors[SG_MAX_COLOR_ATTACHMENTS]; + sg_color_target_state colors[SG_MAX_COLOR_ATTACHMENTS]; sg_primitive_type primitive_type; sg_index_type index_type; sg_cull_mode cull_mode; @@ -2670,11 +2691,13 @@ typedef struct sg_trace_hooks { void (*reset_state_cache)(void* user_data); void (*make_buffer)(const sg_buffer_desc* desc, sg_buffer result, void* user_data); void (*make_image)(const sg_image_desc* desc, sg_image result, void* user_data); + void (*make_sampler)(const sg_sampler_desc* desc, sg_sampler result, void* user_data); void (*make_shader)(const sg_shader_desc* desc, sg_shader result, void* user_data); void (*make_pipeline)(const sg_pipeline_desc* desc, sg_pipeline result, void* user_data); void (*make_pass)(const sg_pass_desc* desc, sg_pass result, void* user_data); void (*destroy_buffer)(sg_buffer buf, void* user_data); void (*destroy_image)(sg_image img, void* user_data); + void (*destroy_sampler)(sg_sampler smp, void* user_data); void (*destroy_shader)(sg_shader shd, void* user_data); void (*destroy_pipeline)(sg_pipeline pip, void* user_data); void (*destroy_pass)(sg_pass pass, void* user_data); @@ -2693,26 +2716,31 @@ typedef struct sg_trace_hooks { void (*commit)(void* user_data); void (*alloc_buffer)(sg_buffer result, void* user_data); void (*alloc_image)(sg_image result, void* user_data); + void (*alloc_sampler)(sg_sampler result, void* user_data); void (*alloc_shader)(sg_shader result, void* user_data); void (*alloc_pipeline)(sg_pipeline result, void* user_data); void (*alloc_pass)(sg_pass result, void* user_data); void (*dealloc_buffer)(sg_buffer buf_id, void* user_data); void (*dealloc_image)(sg_image img_id, void* user_data); + void (*dealloc_sampler)(sg_sampler smp_id, void* user_data); void (*dealloc_shader)(sg_shader shd_id, void* user_data); void (*dealloc_pipeline)(sg_pipeline pip_id, void* user_data); void (*dealloc_pass)(sg_pass pass_id, void* user_data); void (*init_buffer)(sg_buffer buf_id, const sg_buffer_desc* desc, void* user_data); void (*init_image)(sg_image img_id, const sg_image_desc* desc, void* user_data); + void (*init_sampler)(sg_sampler smp_id, const sg_sampler_desc* desc, void* user_data); void (*init_shader)(sg_shader shd_id, const sg_shader_desc* desc, void* user_data); void (*init_pipeline)(sg_pipeline pip_id, const sg_pipeline_desc* desc, void* user_data); void (*init_pass)(sg_pass pass_id, const sg_pass_desc* desc, void* user_data); void (*uninit_buffer)(sg_buffer buf_id, void* user_data); void (*uninit_image)(sg_image img_id, void* user_data); + void (*uninit_sampler)(sg_sampler smp_id, void* user_data); void (*uninit_shader)(sg_shader shd_id, void* user_data); void (*uninit_pipeline)(sg_pipeline pip_id, void* user_data); void (*uninit_pass)(sg_pass pass_id, void* user_data); void (*fail_buffer)(sg_buffer buf_id, void* user_data); void (*fail_image)(sg_image img_id, void* user_data); + void (*fail_sampler)(sg_sampler smp_id, void* user_data); void (*fail_shader)(sg_shader shd_id, void* user_data); void (*fail_pipeline)(sg_pipeline pip_id, void* user_data); void (*fail_pass)(sg_pass pass_id, void* user_data); @@ -4079,7 +4107,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh } typedef struct { - bool vertex_layout_valid[SG_MAX_SHADERSTAGE_BUFFERS]; + bool vertex_layout_valid[SG_MAX_VERTEX_BUFFERS]; bool use_instanced_draw; sg_shader shader_id; sg_layout_desc layout; @@ -4098,7 +4126,7 @@ typedef struct { _SOKOL_PRIVATE void _sg_pipeline_common_init(_sg_pipeline_common_t* cmn, const sg_pipeline_desc* desc) { SOKOL_ASSERT((desc->color_count >= 1) && (desc->color_count <= SG_MAX_COLOR_ATTACHMENTS)); - for (int i = 0; i < SG_MAX_SHADERSTAGE_BUFFERS; i++) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { cmn->vertex_layout_valid[i] = false; } cmn->use_instanced_draw = false; @@ -4423,7 +4451,7 @@ typedef struct { _sg_shader_t* shader; struct { UINT stencil_ref; - UINT vb_strides[SG_MAX_SHADERSTAGE_BUFFERS]; + UINT vb_strides[SG_MAX_VERTEX_BUFFERS]; D3D_PRIMITIVE_TOPOLOGY topology; DXGI_FORMAT index_format; ID3D11InputLayout* il; @@ -4590,9 +4618,9 @@ typedef struct { const _sg_buffer_t* cur_indexbuffer; int cur_indexbuffer_offset; sg_buffer cur_indexbuffer_id; - const _sg_buffer_t* cur_vertexbuffers[SG_MAX_SHADERSTAGE_BUFFERS]; - int cur_vertexbuffer_offsets[SG_MAX_SHADERSTAGE_BUFFERS]; - sg_buffer cur_vertexbuffer_ids[SG_MAX_SHADERSTAGE_BUFFERS]; + const _sg_buffer_t* cur_vertexbuffers[SG_MAX_VERTEX_BUFFERS]; + int cur_vertexbuffer_offsets[SG_MAX_VERTEX_BUFFERS]; + sg_buffer cur_vertexbuffer_ids[SG_MAX_VERTEX_BUFFERS]; const _sg_image_t* cur_vs_images[SG_MAX_SHADERSTAGE_IMAGES]; sg_image cur_vs_image_ids[SG_MAX_SHADERSTAGE_IMAGES]; const _sg_image_t* cur_fs_images[SG_MAX_SHADERSTAGE_IMAGES]; @@ -5573,7 +5601,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; } return SG_RESOURCESTATE_VALID; @@ -7346,7 +7374,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[a_desc->buffer_index]; const sg_vertex_step step_func = l_desc->step_func; const int step_rate = l_desc->step_rate; @@ -9454,7 +9482,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[a_desc->buffer_index]; const sg_vertex_step step_func = l_desc->step_func; const int step_rate = l_desc->step_rate; @@ -9471,7 +9499,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, } pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; } - for (int layout_index = 0; layout_index < SG_MAX_SHADERSTAGE_BUFFERS; layout_index++) { + for (int layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { if (pip->cmn.vertex_layout_valid[layout_index]) { const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; SOKOL_ASSERT(l_desc->stride > 0); @@ -9920,8 +9948,8 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( // gather all the D3D11 resources into arrays ID3D11Buffer* d3d11_ib = ib ? ib->d3d11.buf : 0; - ID3D11Buffer* d3d11_vbs[SG_MAX_SHADERSTAGE_BUFFERS]; - UINT d3d11_vb_offsets[SG_MAX_SHADERSTAGE_BUFFERS]; + ID3D11Buffer* d3d11_vbs[SG_MAX_VERTEX_BUFFERS]; + UINT d3d11_vb_offsets[SG_MAX_VERTEX_BUFFERS]; ID3D11ShaderResourceView* d3d11_vs_srvs[SG_MAX_SHADERSTAGE_IMAGES]; ID3D11SamplerState* d3d11_vs_smps[SG_MAX_SHADERSTAGE_IMAGES]; ID3D11ShaderResourceView* d3d11_fs_srvs[SG_MAX_SHADERSTAGE_IMAGES]; @@ -9932,7 +9960,7 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( d3d11_vbs[i] = vbs[i]->d3d11.buf; d3d11_vb_offsets[i] = (UINT)vb_offsets[i]; } - for (; i < SG_MAX_SHADERSTAGE_BUFFERS; i++) { + for (; i < SG_MAX_VERTEX_BUFFERS; i++) { d3d11_vbs[i] = 0; d3d11_vb_offsets[i] = 0; } @@ -9957,7 +9985,7 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( d3d11_fs_smps[i] = 0; } - _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_BUFFERS, d3d11_vbs, pip->d3d11.vb_strides, d3d11_vb_offsets); + _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, pip->d3d11.vb_strides, d3d11_vb_offsets); _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)ib_offset); _sg_d3d11_VSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_srvs); _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_smps); @@ -11206,13 +11234,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); vtx_desc.attributes[attr_index].format = _sg_mtl_vertex_format(a_desc->format); vtx_desc.attributes[attr_index].offset = (NSUInteger)a_desc->offset; vtx_desc.attributes[attr_index].bufferIndex = (NSUInteger)(a_desc->buffer_index + SG_MAX_SHADERSTAGE_UBS); pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; } - for (NSUInteger layout_index = 0; layout_index < SG_MAX_SHADERSTAGE_BUFFERS; layout_index++) { + for (NSUInteger layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { if (pip->cmn.vertex_layout_valid[layout_index]) { const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; const NSUInteger mtl_vb_slot = layout_index + SG_MAX_SHADERSTAGE_UBS; @@ -11243,7 +11271,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s rp_desc.stencilAttachmentPixelFormat = _sg_mtl_pixel_format(desc->depth.pixel_format); } /* FIXME: this only works on macOS 10.13! - for (int i = 0; i < (SG_MAX_SHADERSTAGE_UBS+SG_MAX_SHADERSTAGE_BUFFERS); i++) { + for (int i = 0; i < (SG_MAX_SHADERSTAGE_UBS+SG_MAX_VERTEX_BUFFERS); i++) { rp_desc.vertexBuffers[i].mutability = MTLMutabilityImmutable; } for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { @@ -13028,12 +13056,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ pl_desc.bindGroupLayouts = &pip_bgl[0]; WGPUPipelineLayout pip_layout = wgpuDeviceCreatePipelineLayout(_sg.wgpu.dev, &pl_desc); - WGPUVertexBufferLayoutDescriptor vb_desc[SG_MAX_SHADERSTAGE_BUFFERS]; + WGPUVertexBufferLayoutDescriptor vb_desc[SG_MAX_VERTEX_BUFFERS]; _sg_clear(&vb_desc, sizeof(vb_desc)); - WGPUVertexAttributeDescriptor va_desc[SG_MAX_SHADERSTAGE_BUFFERS][SG_MAX_VERTEX_ATTRIBUTES]; + WGPUVertexAttributeDescriptor va_desc[SG_MAX_VERTEX_BUFFERS][SG_MAX_VERTEX_ATTRIBUTES]; _sg_clear(&va_desc, sizeof(va_desc)); int vb_idx = 0; - for (; vb_idx < SG_MAX_SHADERSTAGE_BUFFERS; vb_idx++) { + for (; vb_idx < SG_MAX_VERTEX_BUFFERS; vb_idx++) { const sg_buffer_layout_desc* src_vb_desc = &desc->layout.buffers[vb_idx]; if (0 == src_vb_desc->stride) { break; @@ -14682,7 +14710,7 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_PIPELINEDESC_CANARY); _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_PIPELINEDESC_CANARY); _SG_VALIDATE(desc->shader.id != SG_INVALID_ID, VALIDATE_PIPELINEDESC_SHADER); - for (int buf_index = 0; buf_index < SG_MAX_SHADERSTAGE_BUFFERS; buf_index++) { + for (int buf_index = 0; buf_index < SG_MAX_VERTEX_BUFFERS; buf_index++) { const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[buf_index]; if (l_desc->stride == 0) { continue; @@ -14702,7 +14730,7 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { continue; } _SG_VALIDATE(attrs_cont, VALIDATE_PIPELINEDESC_NO_ATTRS); - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); #if defined(SOKOL_D3D11) /* on D3D11, semantic names (and semantic indices) must be provided */ _SG_VALIDATE(!_sg_strempty(&shd->d3d11.attrs[attr_index].sem_name), VALIDATE_PIPELINEDESC_ATTR_SEMANTICS); @@ -14925,7 +14953,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); // has expected vertex buffers, and vertex buffers still exist - for (int i = 0; i < SG_MAX_SHADERSTAGE_BUFFERS; i++) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { if (bindings->vertex_buffers[i].id != SG_INVALID_ID) { _SG_VALIDATE(pip->cmn.vertex_layout_valid[i], VALIDATE_ABND_VBS); // buffers in vertex-buffer-slots must be of type SG_BUFFERTYPE_VERTEXBUFFER @@ -15217,14 +15245,14 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); sg_buffer_layout_desc* b_desc = &def.layout.buffers[a_desc->buffer_index]; b_desc->step_func = _sg_def(b_desc->step_func, SG_VERTEXSTEP_PER_VERTEX); b_desc->step_rate = _sg_def(b_desc->step_rate, 1); } /* resolve vertex layout strides and offsets */ - int auto_offset[SG_MAX_SHADERSTAGE_BUFFERS]; + int auto_offset[SG_MAX_VERTEX_BUFFERS]; _sg_clear(auto_offset, sizeof(auto_offset)); bool use_auto_offset = true; for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { @@ -15238,14 +15266,14 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des if (a_desc->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); if (use_auto_offset) { a_desc->offset = auto_offset[a_desc->buffer_index]; } auto_offset[a_desc->buffer_index] += _sg_vertexformat_bytesize(a_desc->format); } /* compute vertex strides if needed */ - for (int buf_index = 0; buf_index < SG_MAX_SHADERSTAGE_BUFFERS; buf_index++) { + for (int buf_index = 0; buf_index < SG_MAX_VERTEX_BUFFERS; buf_index++) { sg_buffer_layout_desc* l_desc = &def.layout.buffers[buf_index]; if (l_desc->stride == 0) { l_desc->stride = auto_offset[buf_index]; @@ -16378,9 +16406,9 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, _sg.cur_pipeline.id); SOKOL_ASSERT(pip); - _sg_buffer_t* vbs[SG_MAX_SHADERSTAGE_BUFFERS] = { 0 }; + _sg_buffer_t* vbs[SG_MAX_VERTEX_BUFFERS] = { 0 }; int num_vbs = 0; - for (int i = 0; i < SG_MAX_SHADERSTAGE_BUFFERS; i++, num_vbs++) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++, num_vbs++) { if (bindings->vertex_buffers[i].id) { vbs[i] = _sg_lookup_buffer(&_sg.pools, bindings->vertex_buffers[i].id); SOKOL_ASSERT(vbs[i]); From 5a468bb53a24cfaf848ec5619f9d30fa1f8fd29e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 29 May 2023 13:23:04 +0200 Subject: [PATCH 003/292] sokol_gfx.h: sg_sampler_binding_type => sg_sampler_type --- sokol_gfx.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 235b545f4..acd4e5ee7 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1634,18 +1634,17 @@ typedef enum sg_image_sample_type { } sg_image_sample_type; /* - sg_sampler_binding_type + sg_sampler_type FIXME (WGPU only) */ -typedef enum sg_sampler_binding_type { - _SG_SAMPLERBINDINGTYPE_DEFAULT, - SG_SAMPLERBINDINGTYPE_FILTERING, - SG_SAMPLERBINDINGTYPE_NONFILTERING, - SG_SAMPLERBINDINGTYPE_COMPARISON, - _SG_SAMPLERBINDINGTYPE_NUM, - _SG_SAMPLERBINDINGTYPE_FORCE_U32, -} sg_sampler_binding_type; +typedef enum sg_sampler_type { + _SG_SAMPLERTYPE_DEFAULT, + SG_SAMPLERTYPE_SAMPLER, + SG_SAMPLERTYPE_COMPARISON, + _SG_SAMPLERTYPE_NUM, + _SG_SAMPLERTYPE_FORCE_U32, +} sg_sampler_type; /* sg_cube_face @@ -2457,7 +2456,7 @@ typedef struct sg_shader_image_desc { typedef struct sg_shader_sampler_desc { const char* name; // GLSL location name (optional) - sg_sampler_binding_type type; + sg_sampler_type type; } sg_shader_sampler_desc; typedef struct sg_shader_stage_desc { @@ -11893,11 +11892,12 @@ _SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_viewdim(sg_image_type t) { } } -_SOKOL_PRIVATE WGPUTextureComponentType _sg_wgpu_tex_comptype(sg_sampler_type t) { +_SOKOL_PRIVATE WGPUTextureComponentType _sg_wgpu_tex_comptype(sg_image_sample_type t) { + // FIXME switch (t) { - case SG_SAMPLERTYPE_FLOAT: return WGPUTextureComponentType_Float; - case SG_SAMPLERTYPE_SINT: return WGPUTextureComponentType_Sint; - case SG_SAMPLERTYPE_UINT: return WGPUTextureComponentType_Uint; + case SG_IMAGESAMPLETYPE_FLOAT: return WGPUTextureComponentType_Float; + case SG_IMAGESAMPLETYPE_SINT: return WGPUTextureComponentType_Sint; + case SG_IMAGESAMPLETYPE_UINT: return WGPUTextureComponentType_Uint; default: SOKOL_UNREACHABLE; return WGPUTextureComponentType_Force32; } } From 1a4d764a2a7a11542ea6e97ab2b94e571fb0d4d4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 29 May 2023 17:30:03 +0200 Subject: [PATCH 004/292] sokol_gfx.h: add bind-mapping info to shader desc --- sokol_gfx.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index acd4e5ee7..eb07eff04 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2447,18 +2447,24 @@ typedef struct sg_shader_uniform_block_desc { } sg_shader_uniform_block_desc; typedef struct sg_shader_image_desc { - const char* name; // GLSL location name (optional) sg_image_type image_type; sg_image_sample_type sample_type; bool multisampled; - int glsl_sampler_index; // GLSL only: index into sg_shader_stage_desc.samplers array to form combined-image-sampler + uint8_t binding; + uint8_t wgpu_bindgroup; } sg_shader_image_desc; typedef struct sg_shader_sampler_desc { - const char* name; // GLSL location name (optional) sg_sampler_type type; + uint8_t binding; + uint8_t wgpu_bindgroup; } sg_shader_sampler_desc; +typedef struct sg_shader_combined_image_sampler_desc { + const char* name; // optional GLSL location + uint8_t binding; // binding location if name not provided +} sg_shader_combined_image_sampler_desc; + typedef struct sg_shader_stage_desc { const char* source; sg_range bytecode; @@ -2467,6 +2473,7 @@ typedef struct sg_shader_stage_desc { sg_shader_uniform_block_desc uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; sg_shader_image_desc images[SG_MAX_SHADERSTAGE_IMAGES]; sg_shader_sampler_desc samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; + sg_shader_combined_image_sampler_desc combined_image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; } sg_shader_stage_desc; typedef struct sg_shader_desc { From 667f838014da7ccd2269ca6ddcafdabcd5869b15 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 29 May 2023 17:52:32 +0200 Subject: [PATCH 005/292] sokol_gfx.h: remove wgpu_bindgroup from sg_shader_desc, this will be hardwired per shader stage --- sokol_gfx.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index eb07eff04..b56f0c8d9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2451,13 +2451,11 @@ typedef struct sg_shader_image_desc { sg_image_sample_type sample_type; bool multisampled; uint8_t binding; - uint8_t wgpu_bindgroup; } sg_shader_image_desc; typedef struct sg_shader_sampler_desc { sg_sampler_type type; uint8_t binding; - uint8_t wgpu_bindgroup; } sg_shader_sampler_desc; typedef struct sg_shader_combined_image_sampler_desc { From 1a729041028ef9a0a7d4b0e66aadd0e6fd8834c2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 30 May 2023 18:26:36 +0200 Subject: [PATCH 006/292] sokol_gfx.h: start implementing separate sampler objects --- sokol_gfx.h | 695 ++++++++++++++++++++++++++++------------------------ 1 file changed, 374 insertions(+), 321 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b56f0c8d9..6c4640f83 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -366,8 +366,6 @@ per uniform update (this worst-case alignment is 256 bytes) - the max size of all dynamic resource updates (sg_update_buffer, sg_append_buffer and sg_update_image) per frame - - the max number of entries in the texture sampler cache - (how many unique texture sampler can exist at the same time) Not all of those limit values are used by all backends, but it is good practice to provide them none-the-less. @@ -2752,6 +2750,7 @@ typedef struct sg_trace_hooks { void (*pop_debug_group)(void* user_data); void (*err_buffer_pool_exhausted)(void* user_data); void (*err_image_pool_exhausted)(void* user_data); + void (*err_sampler_pool_exhausted)(void* user_data); void (*err_shader_pool_exhausted)(void* user_data); void (*err_pipeline_pool_exhausted)(void* user_data); void (*err_pass_pool_exhausted)(void* user_data); @@ -2878,6 +2877,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(WGPU_ACTIVATE_CONTEXT_FIXME, "_sg_wgpu_activate_context: fixme") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ + _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SHADER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in shader uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_PIPELINE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in pipeline uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_PASS_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in pass uninit (must be same as for creation)") \ @@ -2886,6 +2886,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(TRACE_HOOKS_NOT_ENABLED, "sg_install_trace_hooks() called, but SG_TRACE_HOOKS is not defined") \ _SG_LOGITEM_XMACRO(DEALLOC_BUFFER_INVALID_STATE, "sg_dealloc_buffer(): buffer must be in ALLOC state") \ _SG_LOGITEM_XMACRO(DEALLOC_IMAGE_INVALID_STATE, "sg_dealloc_image(): image must be in alloc state") \ + _SG_LOGITEM_XMACRO(DEALLOC_SAMPLER_INVALID_STATE, "sg_dealloc_sampler(): sampler must be in alloc state") \ _SG_LOGITEM_XMACRO(DEALLOC_SHADER_INVALID_STATE, "sg_dealloc_shader(): shader must be in ALLOC state") \ _SG_LOGITEM_XMACRO(DEALLOC_PIPELINE_INVALID_STATE, "sg_dealloc_pipeline(): pipeline must be in ALLOC state") \ _SG_LOGITEM_XMACRO(DEALLOC_PASS_INVALID_STATE, "sg_dealloc_pass(): pass must be in ALLOC state") \ @@ -2896,16 +2897,19 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(INIT_PASS_INVALID_STATE, "sg_init_pass(): pass must be in ALLOC state") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_INVALID_STATE, "sg_uninit_buffer(): buffer must be in VALID or FAILED state") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_INVALID_STATE, "sg_uninit_image(): image must be in VALID or FAILED state") \ + _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_INVALID_STATE, "sg_uninit_sampler(): sampler must be in VALID or FAILED state") \ _SG_LOGITEM_XMACRO(UNINIT_SHADER_INVALID_STATE, "sg_uninit_shader(): shader must be in VALID or FAILED state") \ _SG_LOGITEM_XMACRO(UNINIT_PIPELINE_INVALID_STATE, "sg_uninit_pipeline(): pipeline must be in VALID or FAILED state") \ _SG_LOGITEM_XMACRO(UNINIT_PASS_INVALID_STATE, "sg_uninit_pass(): pass must be in VALID or FAILED state") \ _SG_LOGITEM_XMACRO(FAIL_BUFFER_INVALID_STATE, "sg_fail_buffer(): buffer must be in ALLOC state") \ _SG_LOGITEM_XMACRO(FAIL_IMAGE_INVALID_STATE, "sg_fail_image(): image must be in ALLOC state") \ + _SG_LOGITEM_XMACRO(FAIL_SAMPLER_INVALID_STATE, "sg_fail_sampler(): sampler must be in ALLOC state") \ _SG_LOGITEM_XMACRO(FAIL_SHADER_INVALID_STATE, "sg_fail_shader(): shader must be in ALLOC state") \ _SG_LOGITEM_XMACRO(FAIL_PIPELINE_INVALID_STATE, "sg_fail_pipeline(): pipeline must be in ALLOC state") \ _SG_LOGITEM_XMACRO(FAIL_PASS_INVALID_STATE, "sg_fail_pass(): pass must be in ALLOC state") \ _SG_LOGITEM_XMACRO(BUFFER_POOL_EXHAUSTED, "buffer pool exhausted") \ _SG_LOGITEM_XMACRO(IMAGE_POOL_EXHAUSTED, "image pool exhausted") \ + _SG_LOGITEM_XMACRO(SAMPLER_POOL_EXHAUSTED, "sampler pool exhausted") \ _SG_LOGITEM_XMACRO(SHADER_POOL_EXHAUSTED, "shader pool exhausted") \ _SG_LOGITEM_XMACRO(PIPELINE_POOL_EXHAUSTED, "pipeline pool exhausted") \ _SG_LOGITEM_XMACRO(PASS_POOL_EXHAUSTED, "pass pool exhausted") \ @@ -3056,13 +3060,13 @@ typedef enum sg_log_item { .buffer_pool_size 128 .image_pool_size 128 + .sampler_pool_size 64 .shader_pool_size 32 .pipeline_pool_size 64 .pass_pool_size 16 .context_pool_size 16 .uniform_buffer_size 4 MB (4*1024*1024) .staging_buffer_size 8 MB (8*1024*1024) - .sampler_cache_size 64 .max_commit_listeners 1024 .disable_validation false @@ -3243,13 +3247,13 @@ typedef struct sg_desc { uint32_t _start_canary; int buffer_pool_size; int image_pool_size; + int sampler_pool_size; int shader_pool_size; int pipeline_pool_size; int pass_pool_size; int context_pool_size; int uniform_buffer_size; int staging_buffer_size; - int sampler_cache_size; int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests sg_allocator allocator; @@ -3946,11 +3950,11 @@ enum { _SG_MAX_POOL_SIZE = (1<<_SG_SLOT_SHIFT), _SG_DEFAULT_BUFFER_POOL_SIZE = 128, _SG_DEFAULT_IMAGE_POOL_SIZE = 128, + _SG_DEFAULT_SAMPLER_POOL_SIZE = 64, _SG_DEFAULT_SHADER_POOL_SIZE = 32, _SG_DEFAULT_PIPELINE_POOL_SIZE = 64, _SG_DEFAULT_PASS_POOL_SIZE = 16, _SG_DEFAULT_CONTEXT_POOL_SIZE = 16, - _SG_DEFAULT_SAMPLER_CACHE_CAPACITY = 64, _SG_DEFAULT_UB_SIZE = 4 * 1024 * 1024, _SG_DEFAULT_STAGING_SIZE = 8 * 1024 * 1024, _SG_DEFAULT_MAX_COMMIT_LISTENERS = 1024, @@ -3973,25 +3977,6 @@ _SOKOL_PRIVATE void* _sg_malloc_clear(size_t size); _SOKOL_PRIVATE void _sg_free(void* ptr); _SOKOL_PRIVATE void _sg_clear(void* ptr, size_t size); -typedef struct { - sg_filter min_filter; - sg_filter mag_filter; - sg_wrap wrap_u; - sg_wrap wrap_v; - sg_wrap wrap_w; - sg_border_color border_color; - uint32_t max_anisotropy; - int min_lod; /* orig min/max_lod is float, this is int(min/max_lod*1000.0) */ - int max_lod; - uintptr_t sampler_handle; -} _sg_sampler_cache_item_t; - -typedef struct { - int capacity; - int num_items; - _sg_sampler_cache_item_t* items; -} _sg_sampler_cache_t; - typedef struct { int size; int append_pos; @@ -4029,15 +4014,6 @@ typedef struct { sg_usage usage; sg_pixel_format pixel_format; int sample_count; - sg_filter min_filter; - sg_filter mag_filter; - sg_wrap wrap_u; - sg_wrap wrap_v; - sg_wrap wrap_w; - sg_border_color border_color; - uint32_t max_anisotropy; - float min_lod; - float max_lod; } _sg_image_common_t; _SOKOL_PRIVATE void _sg_image_common_init(_sg_image_common_t* cmn, const sg_image_desc* desc) { @@ -4053,15 +4029,33 @@ _SOKOL_PRIVATE void _sg_image_common_init(_sg_image_common_t* cmn, const sg_imag cmn->usage = desc->usage; cmn->pixel_format = desc->pixel_format; cmn->sample_count = desc->sample_count; +} + +typedef struct { + sg_filter min_filter; + sg_filter mag_filter; + sg_filter mipmap_filter; + sg_wrap wrap_u; + sg_wrap wrap_v; + sg_wrap wrap_w; + float min_lod; + float max_lod; + sg_border_color border_color; + sg_compare_func compare; + uint32_t max_anisotropy; +} _sg_sampler_common_t; + +_SOKOL_PRIVATE void _sg_sampler_common_init(_sg_sampler_common_t* cmn, const sg_sampler_desc* desc) { cmn->min_filter = desc->min_filter; cmn->mag_filter = desc->mag_filter; cmn->wrap_u = desc->wrap_u; cmn->wrap_v = desc->wrap_v; cmn->wrap_w = desc->wrap_w; - cmn->border_color = desc->border_color; - cmn->max_anisotropy = desc->max_anisotropy; cmn->min_lod = desc->min_lod; cmn->max_lod = desc->max_lod; + cmn->border_color = desc->border_color; + cmn->compare = desc->compare; + cmn->max_anisotropy = desc->max_anisotropy; } typedef struct { @@ -4196,6 +4190,12 @@ typedef struct { } _sg_dummy_image_t; typedef _sg_dummy_image_t _sg_image_t; +typedef struct { + _sg_slot_t slot; + _sg_sampler_common_t cmn; +} _sg_dummy_sampler_t; +typedef _sg_dummy_sampler_t _sg_sampler_t; + typedef struct { _sg_slot_t slot; _sg_shader_common_t cmn; @@ -4558,11 +4558,19 @@ typedef struct { _sg_image_common_t cmn; struct { int tex[SG_NUM_INFLIGHT_FRAMES]; - int sampler_state; } mtl; } _sg_mtl_image_t; typedef _sg_mtl_image_t _sg_image_t; +typedef struct { + _sg_slot_t slot; + _sg_sampler_common_t cmn; + struct { + int sampler_state; + } mtl; +} _sg_mtl_sampler_t; +typedef _sg_mtl_sampler_t _sg_sampler_t; + typedef struct { int mtl_lib; int mtl_func; @@ -4648,7 +4656,6 @@ typedef struct { int cur_width; int cur_height; _sg_mtl_state_cache_t state_cache; - _sg_sampler_cache_t sampler_cache; _sg_mtl_idpool_t idpool; dispatch_semaphore_t sem; id device; @@ -4784,7 +4791,6 @@ typedef struct { WGPUBindGroup empty_bind_group; const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; - _sg_sampler_cache_t sampler_cache; _sg_wgpu_ubpool_t ub; _sg_wgpu_stagingpool_t staging; } _sg_wgpu_backend_t; @@ -4806,6 +4812,7 @@ typedef struct { typedef struct { _sg_pool_t buffer_pool; _sg_pool_t image_pool; + _sg_pool_t sampler_pool; _sg_pool_t shader_pool; _sg_pool_t pipeline_pool; _sg_pool_t pass_pool; @@ -4858,90 +4865,6 @@ typedef struct { } _sg_state_t; static _sg_state_t _sg; -// ███████ █████ ███ ███ ██████ ██ ███████ ██████ ██████ █████ ██████ ██ ██ ███████ -// ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -// ███████ ███████ ██ ████ ██ ██████ ██ █████ ██████ ██ ███████ ██ ███████ █████ -// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -// ███████ ██ ██ ██ ██ ██ ███████ ███████ ██ ██ ██████ ██ ██ ██████ ██ ██ ███████ -// -// >>sampler cache -/* - this is used by the Metal and WGPU backends to reduce the - number of sampler state objects created through the backend API -*/ -_SOKOL_PRIVATE void _sg_smpcache_init(_sg_sampler_cache_t* cache, int capacity) { - SOKOL_ASSERT(cache && (capacity > 0)); - _sg_clear(cache, sizeof(_sg_sampler_cache_t)); - cache->capacity = capacity; - const size_t size = (size_t)cache->capacity * sizeof(_sg_sampler_cache_item_t); - cache->items = (_sg_sampler_cache_item_t*) _sg_malloc_clear(size); -} - -_SOKOL_PRIVATE void _sg_smpcache_discard(_sg_sampler_cache_t* cache) { - SOKOL_ASSERT(cache && cache->items); - _sg_free(cache->items); - cache->items = 0; - cache->num_items = 0; - cache->capacity = 0; -} - -_SOKOL_PRIVATE int _sg_smpcache_minlod_int(float min_lod) { - return (int) (min_lod * 1000.0f); -} - -_SOKOL_PRIVATE int _sg_smpcache_maxlod_int(float max_lod) { - return (int) (_sg_clamp(max_lod, 0.0f, 1000.0f) * 1000.0f); -} - -_SOKOL_PRIVATE int _sg_smpcache_find_item(const _sg_sampler_cache_t* cache, const sg_image_desc* img_desc) { - /* return matching sampler cache item index or -1 */ - SOKOL_ASSERT(cache && cache->items); - SOKOL_ASSERT(img_desc); - const int min_lod = _sg_smpcache_minlod_int(img_desc->min_lod); - const int max_lod = _sg_smpcache_maxlod_int(img_desc->max_lod); - for (int i = 0; i < cache->num_items; i++) { - const _sg_sampler_cache_item_t* item = &cache->items[i]; - if ((img_desc->min_filter == item->min_filter) && - (img_desc->mag_filter == item->mag_filter) && - (img_desc->wrap_u == item->wrap_u) && - (img_desc->wrap_v == item->wrap_v) && - (img_desc->wrap_w == item->wrap_w) && - (img_desc->max_anisotropy == item->max_anisotropy) && - (img_desc->border_color == item->border_color) && - (min_lod == item->min_lod) && - (max_lod == item->max_lod)) - { - return i; - } - } - /* fallthrough: no matching cache item found */ - return -1; -} - -_SOKOL_PRIVATE void _sg_smpcache_add_item(_sg_sampler_cache_t* cache, const sg_image_desc* img_desc, uintptr_t sampler_handle) { - SOKOL_ASSERT(cache && cache->items); - SOKOL_ASSERT(img_desc); - SOKOL_ASSERT(cache->num_items < cache->capacity); - const int item_index = cache->num_items++; - _sg_sampler_cache_item_t* item = &cache->items[item_index]; - item->min_filter = img_desc->min_filter; - item->mag_filter = img_desc->mag_filter; - item->wrap_u = img_desc->wrap_u; - item->wrap_v = img_desc->wrap_v; - item->wrap_w = img_desc->wrap_w; - item->border_color = img_desc->border_color; - item->max_anisotropy = img_desc->max_anisotropy; - item->min_lod = _sg_smpcache_minlod_int(img_desc->min_lod); - item->max_lod = _sg_smpcache_maxlod_int(img_desc->max_lod); - item->sampler_handle = sampler_handle; -} - -_SOKOL_PRIVATE uintptr_t _sg_smpcache_sampler(_sg_sampler_cache_t* cache, int item_index) { - SOKOL_ASSERT(cache && cache->items); - SOKOL_ASSERT(item_index < cache->num_items); - return cache->items[item_index].sampler_handle; -} - // ██ ██████ ██████ ██████ ██ ███ ██ ██████ // ██ ██ ██ ██ ██ ██ ████ ██ ██ // ██ ██ ██ ██ ███ ██ ███ ██ ██ ██ ██ ██ ███ @@ -10487,7 +10410,8 @@ _SOKOL_PRIVATE void _sg_mtl_init_pool(const sg_desc* desc) { _sg.mtl.idpool.num_slots = 2 * ( 2 * desc->buffer_pool_size + - 5 * desc->image_pool_size + + 4 * desc->image_pool_size + + 1 * desc->sampler_pool_size + 4 * desc->shader_pool_size + 2 * desc->pipeline_pool_size + desc->pass_pool_size @@ -10608,57 +10532,33 @@ _SOKOL_PRIVATE id _sg_mtl_id(int slot_index) { return _sg.mtl.idpool.pool[(NSUInteger)slot_index]; } -_SOKOL_PRIVATE void _sg_mtl_init_sampler_cache(const sg_desc* desc) { - SOKOL_ASSERT(desc->sampler_cache_size > 0); - _sg_smpcache_init(&_sg.mtl.sampler_cache, desc->sampler_cache_size); -} - -/* destroy the sampler cache, and release all sampler objects */ -_SOKOL_PRIVATE void _sg_mtl_destroy_sampler_cache(uint32_t frame_index) { - SOKOL_ASSERT(_sg.mtl.sampler_cache.items); - SOKOL_ASSERT(_sg.mtl.sampler_cache.num_items <= _sg.mtl.sampler_cache.capacity); - for (int i = 0; i < _sg.mtl.sampler_cache.num_items; i++) { - _sg_mtl_release_resource(frame_index, (int)_sg_smpcache_sampler(&_sg.mtl.sampler_cache, i)); - } - _sg_smpcache_discard(&_sg.mtl.sampler_cache); -} - /* create and add an MTLSamplerStateObject and return its resource pool index, reuse identical sampler state if one exists */ _SOKOL_PRIVATE int _sg_mtl_create_sampler(id mtl_device, const sg_image_desc* img_desc) { SOKOL_ASSERT(img_desc); - int index = _sg_smpcache_find_item(&_sg.mtl.sampler_cache, img_desc); - if (index >= 0) { - /* reuse existing sampler */ - return (int)_sg_smpcache_sampler(&_sg.mtl.sampler_cache, index); - } - else { - /* create a new Metal sampler state object and add to sampler cache */ - MTLSamplerDescriptor* mtl_desc = [[MTLSamplerDescriptor alloc] init]; - mtl_desc.sAddressMode = _sg_mtl_address_mode(img_desc->wrap_u); - mtl_desc.tAddressMode = _sg_mtl_address_mode(img_desc->wrap_v); - if (SG_IMAGETYPE_3D == img_desc->type) { - mtl_desc.rAddressMode = _sg_mtl_address_mode(img_desc->wrap_w); - } - #if defined(_SG_TARGET_MACOS) - mtl_desc.borderColor = _sg_mtl_border_color(img_desc->border_color); - #endif - mtl_desc.minFilter = _sg_mtl_minmag_filter(img_desc->min_filter); - mtl_desc.magFilter = _sg_mtl_minmag_filter(img_desc->mag_filter); - mtl_desc.mipFilter = _sg_mtl_mip_filter(img_desc->min_filter); - mtl_desc.lodMinClamp = img_desc->min_lod; - mtl_desc.lodMaxClamp = img_desc->max_lod; - mtl_desc.maxAnisotropy = img_desc->max_anisotropy; - mtl_desc.normalizedCoordinates = YES; - id mtl_sampler = [mtl_device newSamplerStateWithDescriptor:mtl_desc]; - _SG_OBJC_RELEASE(mtl_desc); - int sampler_handle = _sg_mtl_add_resource(mtl_sampler); - _SG_OBJC_RELEASE(mtl_sampler); - _sg_smpcache_add_item(&_sg.mtl.sampler_cache, img_desc, (uintptr_t)sampler_handle); - return sampler_handle; + MTLSamplerDescriptor* mtl_desc = [[MTLSamplerDescriptor alloc] init]; + mtl_desc.sAddressMode = _sg_mtl_address_mode(img_desc->wrap_u); + mtl_desc.tAddressMode = _sg_mtl_address_mode(img_desc->wrap_v); + if (SG_IMAGETYPE_3D == img_desc->type) { + mtl_desc.rAddressMode = _sg_mtl_address_mode(img_desc->wrap_w); } + #if defined(_SG_TARGET_MACOS) + mtl_desc.borderColor = _sg_mtl_border_color(img_desc->border_color); + #endif + mtl_desc.minFilter = _sg_mtl_minmag_filter(img_desc->min_filter); + mtl_desc.magFilter = _sg_mtl_minmag_filter(img_desc->mag_filter); + mtl_desc.mipFilter = _sg_mtl_mip_filter(img_desc->min_filter); + mtl_desc.lodMinClamp = img_desc->min_lod; + mtl_desc.lodMaxClamp = img_desc->max_lod; + mtl_desc.maxAnisotropy = img_desc->max_anisotropy; + mtl_desc.normalizedCoordinates = YES; + id mtl_sampler = [mtl_device newSamplerStateWithDescriptor:mtl_desc]; + _SG_OBJC_RELEASE(mtl_desc); + int sampler_handle = _sg_mtl_add_resource(mtl_sampler); + _SG_OBJC_RELEASE(mtl_sampler); + return sampler_handle; } _SOKOL_PRIVATE void _sg_mtl_clear_state_cache(void) { @@ -10812,7 +10712,6 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc->context.metal.drawable_cb || desc->context.metal.drawable_userdata_cb); SOKOL_ASSERT(desc->uniform_buffer_size > 0); _sg_mtl_init_pool(desc); - _sg_mtl_init_sampler_cache(desc); _sg_mtl_clear_state_cache(); _sg.mtl.valid = true; _sg.mtl.renderpass_descriptor_cb = desc->context.metal.renderpass_descriptor_cb; @@ -10844,7 +10743,6 @@ _SOKOL_PRIVATE void _sg_mtl_discard_backend(void) { for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { dispatch_semaphore_signal(_sg.mtl.sem); } - _sg_mtl_destroy_sampler_cache(_sg.mtl.frame_index); _sg_mtl_garbage_collect(_sg.mtl.frame_index + SG_NUM_INFLIGHT_FRAMES + 2); _sg_mtl_destroy_pool(); _sg.mtl.valid = false; @@ -12649,46 +12547,23 @@ _SOKOL_PRIVATE void _sg_wgpu_staging_unmap(void) { wgpuBufferUnmap(_sg.wgpu.staging.buf[cur]); } -/*--- WGPU sampler cache functions ---*/ -_SOKOL_PRIVATE void _sg_wgpu_init_sampler_cache(const sg_desc* desc) { - SOKOL_ASSERT(desc->sampler_cache_size > 0); - _sg_smpcache_init(&_sg.wgpu.sampler_cache, desc->sampler_cache_size); -} - -_SOKOL_PRIVATE void _sg_wgpu_destroy_sampler_cache(void) { - SOKOL_ASSERT(_sg.wgpu.sampler_cache.items); - SOKOL_ASSERT(_sg.wgpu.sampler_cache.num_items <= _sg.wgpu.sampler_cache.capacity); - for (int i = 0; i < _sg.wgpu.sampler_cache.num_items; i++) { - wgpuSamplerRelease((WGPUSampler)_sg_smpcache_sampler(&_sg.wgpu.sampler_cache, i)); - } - _sg_smpcache_discard(&_sg.wgpu.sampler_cache); -} - _SOKOL_PRIVATE WGPUSampler _sg_wgpu_create_sampler(const sg_image_desc* img_desc) { SOKOL_ASSERT(img_desc); - int index = _sg_smpcache_find_item(&_sg.wgpu.sampler_cache, img_desc); - if (index >= 0) { - /* reuse existing sampler */ - return (WGPUSampler) _sg_smpcache_sampler(&_sg.wgpu.sampler_cache, index); - } - else { - /* create a new WGPU sampler and add to sampler cache */ - /* FIXME: anisotropic filtering not supported? */ - WGPUSamplerDescriptor smp_desc; - _sg_clear(&smp_desc, sizeof(smp_desc)); - smp_desc.addressModeU = _sg_wgpu_sampler_addrmode(img_desc->wrap_u); - smp_desc.addressModeV = _sg_wgpu_sampler_addrmode(img_desc->wrap_v); - smp_desc.addressModeW = _sg_wgpu_sampler_addrmode(img_desc->wrap_w); - smp_desc.magFilter = _sg_wgpu_sampler_minmagfilter(img_desc->mag_filter); - smp_desc.minFilter = _sg_wgpu_sampler_minmagfilter(img_desc->min_filter); - smp_desc.mipmapFilter = _sg_wgpu_sampler_mipfilter(img_desc->min_filter); - smp_desc.lodMinClamp = img_desc->min_lod; - smp_desc.lodMaxClamp = img_desc->max_lod; - WGPUSampler smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &smp_desc); - SOKOL_ASSERT(smp); - _sg_smpcache_add_item(&_sg.wgpu.sampler_cache, img_desc, (uintptr_t)smp); - return smp; - } + /* create a new WGPU sampler */ + /* FIXME: anisotropic filtering not supported? */ + WGPUSamplerDescriptor smp_desc; + _sg_clear(&smp_desc, sizeof(smp_desc)); + smp_desc.addressModeU = _sg_wgpu_sampler_addrmode(img_desc->wrap_u); + smp_desc.addressModeV = _sg_wgpu_sampler_addrmode(img_desc->wrap_v); + smp_desc.addressModeW = _sg_wgpu_sampler_addrmode(img_desc->wrap_w); + smp_desc.magFilter = _sg_wgpu_sampler_minmagfilter(img_desc->mag_filter); + smp_desc.minFilter = _sg_wgpu_sampler_minmagfilter(img_desc->min_filter); + smp_desc.mipmapFilter = _sg_wgpu_sampler_mipfilter(img_desc->min_filter); + smp_desc.lodMinClamp = img_desc->min_lod; + smp_desc.lodMaxClamp = img_desc->max_lod; + WGPUSampler smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &smp_desc); + SOKOL_ASSERT(smp); + return smp; } /*--- WGPU backend API functions ---*/ @@ -12716,8 +12591,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { /* setup WebGPU features and limits */ _sg_wgpu_init_caps(); - /* setup the sampler cache, uniform and staging buffer pools */ - _sg_wgpu_init_sampler_cache(&_sg.desc); + /* setup the uniform and staging buffer pools */ _sg_wgpu_ubpool_init(desc); _sg_wgpu_ubpool_next_frame(true); _sg_wgpu_staging_init(desc); @@ -12751,7 +12625,6 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { _sg.wgpu.valid = false; _sg_wgpu_ubpool_discard(); _sg_wgpu_staging_discard(); - _sg_wgpu_destroy_sampler_cache(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; @@ -14099,15 +13972,15 @@ static inline void _sg_update_image(_sg_image_t* img, const sg_image_data* data) // >>pool _SOKOL_PRIVATE void _sg_init_pool(_sg_pool_t* pool, int num) { SOKOL_ASSERT(pool && (num >= 1)); - /* slot 0 is reserved for the 'invalid id', so bump the pool size by 1 */ + // slot 0 is reserved for the 'invalid id', so bump the pool size by 1 pool->size = num + 1; pool->queue_top = 0; - /* generation counters indexable by pool slot index, slot 0 is reserved */ + // generation counters indexable by pool slot index, slot 0 is reserved size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size; pool->gen_ctrs = (uint32_t*)_sg_malloc_clear(gen_ctrs_size); - /* it's not a bug to only reserve 'num' here */ + // it's not a bug to only reserve 'num' here pool->free_queue = (int*) _sg_malloc_clear(sizeof(int) * (size_t)num); - /* never allocate the zero-th pool item since the invalid id is 0 */ + // never allocate the zero-th pool item since the invalid id is 0 for (int i = pool->size-1; i >= 1; i--) { pool->free_queue[pool->queue_top++] = i; } @@ -14134,7 +14007,7 @@ _SOKOL_PRIVATE int _sg_pool_alloc_index(_sg_pool_t* pool) { return slot_index; } else { - /* pool exhausted */ + // pool exhausted return _SG_INVALID_SLOT_INDEX; } } @@ -14145,7 +14018,7 @@ _SOKOL_PRIVATE void _sg_pool_free_index(_sg_pool_t* pool, int slot_index) { SOKOL_ASSERT(pool->free_queue); SOKOL_ASSERT(pool->queue_top < pool->size); #ifdef SOKOL_DEBUG - /* debug check against double-free */ + // debug check against double-free for (int i = 0; i < pool->queue_top; i++) { SOKOL_ASSERT(pool->free_queue[i] != slot_index); } @@ -14175,6 +14048,14 @@ _SOKOL_PRIVATE void _sg_reset_image_to_alloc_state(_sg_image_t* img) { img->slot.state = SG_RESOURCESTATE_ALLOC; } +_SOKOL_PRIVATE void _sg_reset_sampler_to_alloc_state(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + _sg_slot_t slot = smp->slot; + _sg_clear(smp, sizepf(_sg_sampler_t)); + smp->slot = slot; + smp->slot.state = SG_RESOURCESTATE_ALLOC; +} + _SOKOL_PRIVATE void _sg_reset_shader_to_alloc_state(_sg_shader_t* shd) { SOKOL_ASSERT(shd); _sg_slot_t slot = shd->slot; @@ -14210,7 +14091,7 @@ _SOKOL_PRIVATE void _sg_reset_context_to_alloc_state(_sg_context_t* ctx) { _SOKOL_PRIVATE void _sg_setup_pools(_sg_pools_t* p, const sg_desc* desc) { SOKOL_ASSERT(p); SOKOL_ASSERT(desc); - /* note: the pools here will have an additional item, since slot 0 is reserved */ + // note: the pools here will have an additional item, since slot 0 is reserved SOKOL_ASSERT((desc->buffer_pool_size > 0) && (desc->buffer_pool_size < _SG_MAX_POOL_SIZE)); _sg_init_pool(&p->buffer_pool, desc->buffer_pool_size); size_t buffer_pool_byte_size = sizeof(_sg_buffer_t) * (size_t)p->buffer_pool.size; @@ -14221,6 +14102,11 @@ _SOKOL_PRIVATE void _sg_setup_pools(_sg_pools_t* p, const sg_desc* desc) { size_t image_pool_byte_size = sizeof(_sg_image_t) * (size_t)p->image_pool.size; p->images = (_sg_image_t*) _sg_malloc_clear(image_pool_byte_size); + SOKOL_ASSERT((desc->sampler_pool_size > 0) && (desc->sampler_pool_size < _SG_MAX_POOL_SIZE)); + _sg_init_pool(&p->sampler_pool, desc->sampler_pool_size); + size_t sampler_pool_byte_size = sizeof(_sg_sampler_t) * (size_t)p->sampler_pool.size; + p->samplers = (_sg_sampler_t*) _sg_malloc_clear(sampler_pool_byte_size); + SOKOL_ASSERT((desc->shader_pool_size > 0) && (desc->shader_pool_size < _SG_MAX_POOL_SIZE)); _sg_init_pool(&p->shader_pool, desc->shader_pool_size); size_t shader_pool_byte_size = sizeof(_sg_shader_t) * (size_t)p->shader_pool.size; @@ -14248,12 +14134,14 @@ _SOKOL_PRIVATE void _sg_discard_pools(_sg_pools_t* p) { _sg_free(p->passes); p->passes = 0; _sg_free(p->pipelines); p->pipelines = 0; _sg_free(p->shaders); p->shaders = 0; + _sg_free(p->samplers); p->samplers = 0; _sg_free(p->images); p->images = 0; _sg_free(p->buffers); p->buffers = 0; _sg_discard_pool(&p->context_pool); _sg_discard_pool(&p->pass_pool); _sg_discard_pool(&p->pipeline_pool); _sg_discard_pool(&p->shader_pool); + _sg_discard_pool(&p->sampler_pool); _sg_discard_pool(&p->image_pool); _sg_discard_pool(&p->buffer_pool); } @@ -14279,14 +14167,14 @@ _SOKOL_PRIVATE uint32_t _sg_slot_alloc(_sg_pool_t* pool, _sg_slot_t* slot, int s return slot->id; } -/* extract slot index from id */ +// extract slot index from id _SOKOL_PRIVATE int _sg_slot_index(uint32_t id) { int slot_index = (int) (id & _SG_SLOT_MASK); SOKOL_ASSERT(_SG_INVALID_SLOT_INDEX != slot_index); return slot_index; } -/* returns pointer to resource by id without matching id check */ +// returns pointer to resource by id without matching id check _SOKOL_PRIVATE _sg_buffer_t* _sg_buffer_at(const _sg_pools_t* p, uint32_t buf_id) { SOKOL_ASSERT(p && (SG_INVALID_ID != buf_id)); int slot_index = _sg_slot_index(buf_id); @@ -14301,6 +14189,13 @@ _SOKOL_PRIVATE _sg_image_t* _sg_image_at(const _sg_pools_t* p, uint32_t img_id) return &p->images[slot_index]; } +_SOKOL_PRIVATE _sg_sampler_t* _sg_sampler_at(const _sg_pools_t* p, uint32_t smp_id) { + SOKOL_ASSERT(p && (SG_INVALID_ID != smp_id)); + int slot_index = _sg_slot_index(smp_id); + SOKOL_ASSERT((slot_index > _SG_INVALID_SLOT_INDEX) && (slot_index < p->sampler_pool.size)); + return &p->samplers[slot_index]; +} + _SOKOL_PRIVATE _sg_shader_t* _sg_shader_at(const _sg_pools_t* p, uint32_t shd_id) { SOKOL_ASSERT(p && (SG_INVALID_ID != shd_id)); int slot_index = _sg_slot_index(shd_id); @@ -14329,7 +14224,7 @@ _SOKOL_PRIVATE _sg_context_t* _sg_context_at(const _sg_pools_t* p, uint32_t cont return &p->contexts[slot_index]; } -/* returns pointer to resource with matching id check, may return 0 */ +// returns pointer to resource with matching id check, may return 0 _SOKOL_PRIVATE _sg_buffer_t* _sg_lookup_buffer(const _sg_pools_t* p, uint32_t buf_id) { if (SG_INVALID_ID != buf_id) { _sg_buffer_t* buf = _sg_buffer_at(p, buf_id); @@ -14350,6 +14245,16 @@ _SOKOL_PRIVATE _sg_image_t* _sg_lookup_image(const _sg_pools_t* p, uint32_t img_ return 0; } +_SOKOL_PRIVATE _sg_sampler_t* _sg_lookup_sampler(const _sg_pool_t* p, uint32_t smp_id) { + if (SG_INVALID_ID != smp_id) { + _sg_sampler_t* smp = _sg_sampler_at(p, smp_id); + if (smp->slot.id == smp_id) { + return smp; + } + } + return 0; +} + _SOKOL_PRIVATE _sg_shader_t* _sg_lookup_shader(const _sg_pools_t* p, uint32_t shd_id) { SOKOL_ASSERT(p); if (SG_INVALID_ID != shd_id) { @@ -14418,6 +14323,14 @@ _SOKOL_PRIVATE void _sg_discard_all_resources(_sg_pools_t* p, uint32_t ctx_id) { } } } + for (int i = 1; i < p->sampler_pool.size; i++) { + if (p->samplers[i].slot.ctx_id == ctx_id) { + sg_resource_state state = p->samplers[i].slot.state; + if ((state == SG_RESOURCESTATE_VALID) || (state == SG_RESOURCESTATE_FAILED)) { + _sg_discard_sampler(&p->samplers[i]); + } + } + } for (int i = 1; i < p->shader_pool.size; i++) { if (p->shaders[i].slot.ctx_id == ctx_id) { sg_resource_state state = p->shaders[i].slot.state; @@ -14595,6 +14508,23 @@ _SOKOL_PRIVATE bool _sg_validate_image_desc(const sg_image_desc* desc) { #endif } +_SOKOL_PRIVATE bool _sg_validate_sampler_desc(const sg_sampler_desc* desc) { + #if !defined(SOKOL_DEBUG) + _SOKOL_UNUSED(desc); + return true; + #else + if (_sg.desc.disable_validation) { + return true; + } + SOKOL_ASSERT(desc); + _sg_validate_begin(); + _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_IMAGEDESC_CANARY); + _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_IMAGEDESC_CANARY); + // FIXME + return _sg_validate_end(); + #endif +} + _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { #if !defined(SOKOL_DEBUG) _SOKOL_UNUSED(desc); @@ -15153,15 +15083,21 @@ _SOKOL_PRIVATE sg_image_desc _sg_image_desc_defaults(const sg_image_desc* desc) def.pixel_format = _sg_def(def.pixel_format, SG_PIXELFORMAT_RGBA8); def.sample_count = _sg_def(def.sample_count, 1); } + return def; +} + +_SOKOL_PRIVATE sg_sampler_desc _sg_sampler_desc_defaults(const sg_sampler_desc* desc) { + sg_sampler_desc def = *desc; def.min_filter = _sg_def(def.min_filter, SG_FILTER_NEAREST); def.mag_filter = _sg_def(def.mag_filter, SG_FILTER_NEAREST); + def.mipmap_filter = _sg_def(def.mipmap_filter, SG_FILTER_NEAREST); def.wrap_u = _sg_def(def.wrap_u, SG_WRAP_REPEAT); def.wrap_v = _sg_def(def.wrap_v, SG_WRAP_REPEAT); def.wrap_w = _sg_def(def.wrap_w, SG_WRAP_REPEAT); + def.max_lod = _sg_def_flt(def.max_lod, FLT_MAX); def.border_color = _sg_def(def.border_color, SG_BORDERCOLOR_OPAQUE_BLACK); + def.compare = _sg_def(def.compare, SG_COMPAREFUNC_NEVER); def.max_anisotropy = _sg_def(def.max_anisotropy, 1); - def.max_lod = _sg_def_flt(def.max_lod, FLT_MAX); - return def; } _SOKOL_PRIVATE sg_shader_desc _sg_shader_desc_defaults(const sg_shader_desc* desc) { @@ -15299,8 +15235,7 @@ _SOKOL_PRIVATE sg_buffer _sg_alloc_buffer(void) { int slot_index = _sg_pool_alloc_index(&_sg.pools.buffer_pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { res.id = _sg_slot_alloc(&_sg.pools.buffer_pool, &_sg.pools.buffers[slot_index].slot, slot_index); - } - else { + } else { res.id = SG_INVALID_ID; _SG_ERROR(BUFFER_POOL_EXHAUSTED); _SG_TRACE_NOARGS(err_buffer_pool_exhausted); @@ -15313,8 +15248,7 @@ _SOKOL_PRIVATE sg_image _sg_alloc_image(void) { int slot_index = _sg_pool_alloc_index(&_sg.pools.image_pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { res.id = _sg_slot_alloc(&_sg.pools.image_pool, &_sg.pools.images[slot_index].slot, slot_index); - } - else { + } else { res.id = SG_INVALID_ID; _SG_ERROR(IMAGE_POOL_EXHAUSTED); _SG_TRACE_NOARGS(err_image_pool_exhausted); @@ -15322,13 +15256,25 @@ _SOKOL_PRIVATE sg_image _sg_alloc_image(void) { return res; } +_SOKOL_PRIVATE sg_sampler _sg_alloc_sampler(void) { + sg_sampler res; + int slot_index = _sg_pool_alloc_index(&_sg.pools.sampler_pool); + if (_SG_INVALID_SLOT_INDEX != slot_index) { + res.id = _sg_slot_alloc(&_sg.pools.sampler_pool, &_sg.pools.samplers[slot_index].slot, slot_index); + } else { + res.id = SG_INVALID_ID; + _SG_ERROR(SAMPLER_POOL_EXHAUSTED); + _SG_TRACE_NOARGS(err_sampler_pool_exhausted); + } + return res; +} + _SOKOL_PRIVATE sg_shader _sg_alloc_shader(void) { sg_shader res; int slot_index = _sg_pool_alloc_index(&_sg.pools.shader_pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { res.id = _sg_slot_alloc(&_sg.pools.shader_pool, &_sg.pools.shaders[slot_index].slot, slot_index); - } - else { + } else { res.id = SG_INVALID_ID; _SG_ERROR(SHADER_POOL_EXHAUSTED); _SG_TRACE_NOARGS(err_shader_pool_exhausted); @@ -15341,8 +15287,7 @@ _SOKOL_PRIVATE sg_pipeline _sg_alloc_pipeline(void) { int slot_index = _sg_pool_alloc_index(&_sg.pools.pipeline_pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { res.id =_sg_slot_alloc(&_sg.pools.pipeline_pool, &_sg.pools.pipelines[slot_index].slot, slot_index); - } - else { + } else { res.id = SG_INVALID_ID; _SG_ERROR(PIPELINE_POOL_EXHAUSTED); _SG_TRACE_NOARGS(err_pipeline_pool_exhausted); @@ -15355,8 +15300,7 @@ _SOKOL_PRIVATE sg_pass _sg_alloc_pass(void) { int slot_index = _sg_pool_alloc_index(&_sg.pools.pass_pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { res.id = _sg_slot_alloc(&_sg.pools.pass_pool, &_sg.pools.passes[slot_index].slot, slot_index); - } - else { + } else { res.id = SG_INVALID_ID; _SG_ERROR(PASS_POOL_EXHAUSTED); _SG_TRACE_NOARGS(err_pass_pool_exhausted); @@ -15376,6 +15320,12 @@ _SOKOL_PRIVATE void _sg_dealloc_image(_sg_image_t* img) { _sg_reset_slot(&img->slot); } +_SOKOL_PRIVATE void _sg_dealloc_sampler(_sg_sampler* smp) { + SOKOL_ASSERT(smp && (smp->slot.state == SG_RESOURCESTATE_ALLOC) && (smp->slot.id != SG_INVALID_ID)); + _sg_pool_free_index(&_sg.pools.sampler_pool, _sg_slot_index(smp->slot.id)); + _sg_reset_slot(&smp->slot); +} + _SOKOL_PRIVATE void _sg_dealloc_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd && (shd->slot.state == SG_RESOURCESTATE_ALLOC) && (shd->slot.id != SG_INVALID_ID)); _sg_pool_free_index(&_sg.pools.shader_pool, _sg_slot_index(shd->slot.id)); @@ -15400,8 +15350,7 @@ _SOKOL_PRIVATE void _sg_init_buffer(_sg_buffer_t* buf, const sg_buffer_desc* des buf->slot.ctx_id = _sg.active_context.id; if (_sg_validate_buffer_desc(desc)) { buf->slot.state = _sg_create_buffer(buf, desc); - } - else { + } else { buf->slot.state = SG_RESOURCESTATE_FAILED; } SOKOL_ASSERT((buf->slot.state == SG_RESOURCESTATE_VALID)||(buf->slot.state == SG_RESOURCESTATE_FAILED)); @@ -15413,21 +15362,31 @@ _SOKOL_PRIVATE void _sg_init_image(_sg_image_t* img, const sg_image_desc* desc) img->slot.ctx_id = _sg.active_context.id; if (_sg_validate_image_desc(desc)) { img->slot.state = _sg_create_image(img, desc); - } - else { + } else { img->slot.state = SG_RESOURCESTATE_FAILED; } SOKOL_ASSERT((img->slot.state == SG_RESOURCESTATE_VALID)||(img->slot.state == SG_RESOURCESTATE_FAILED)); } +_SOKOL_PRIVATE void _sg_init_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && (smp->slot.state == SG_RESOURCESTATE_ALLOC)); + SOKOL_ASSERT(desc); + smp->slot.ctx_id = _sg.active_context.id; + if (_sg_validate_sampler_desc(desc)) { + smp->slot.state = _sg_create_sampler(smp, desc); + } else { + smp->slot.state = SG_RESOURCESTATE_FAILED; + } + SOKOL_ASSERT((smp->slot.state == SG_RESOURCESTATE_VALID)||(smp->slot.state == SG_RESOURCESTATE_FAILED)); +} + _SOKOL_PRIVATE void _sg_init_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && (shd->slot.state == SG_RESOURCESTATE_ALLOC)); SOKOL_ASSERT(desc); shd->slot.ctx_id = _sg.active_context.id; if (_sg_validate_shader_desc(desc)) { shd->slot.state = _sg_create_shader(shd, desc); - } - else { + } else { shd->slot.state = SG_RESOURCESTATE_FAILED; } SOKOL_ASSERT((shd->slot.state == SG_RESOURCESTATE_VALID)||(shd->slot.state == SG_RESOURCESTATE_FAILED)); @@ -15441,12 +15400,10 @@ _SOKOL_PRIVATE void _sg_init_pipeline(_sg_pipeline_t* pip, const sg_pipeline_des _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, desc->shader.id); if (shd && (shd->slot.state == SG_RESOURCESTATE_VALID)) { pip->slot.state = _sg_create_pipeline(pip, shd, desc); - } - else { + } else { pip->slot.state = SG_RESOURCESTATE_FAILED; } - } - else { + } else { pip->slot.state = SG_RESOURCESTATE_FAILED; } SOKOL_ASSERT((pip->slot.state == SG_RESOURCESTATE_VALID)||(pip->slot.state == SG_RESOURCESTATE_FAILED)); @@ -15496,8 +15453,7 @@ _SOKOL_PRIVATE void _sg_uninit_buffer(_sg_buffer_t* buf) { if (buf->slot.ctx_id == _sg.active_context.id) { _sg_discard_buffer(buf); _sg_reset_buffer_to_alloc_state(buf); - } - else { + } else { _SG_WARN(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH); _SG_TRACE_NOARGS(err_context_mismatch); } @@ -15508,20 +15464,29 @@ _SOKOL_PRIVATE void _sg_uninit_image(_sg_image_t* img) { if (img->slot.ctx_id == _sg.active_context.id) { _sg_discard_image(img); _sg_reset_image_to_alloc_state(img); - } - else { + } else { _SG_WARN(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH); _SG_TRACE_NOARGS(err_context_mismatch); } } +_SOKOL_PRIVATE void _sg_uninit_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp && ((smp->slot.state == SG_RESOURCESTATE_VALID) || (smp->slot.state == SG_RESOURCESTATE_FAILED))); + if (smp->slot.ctx_id == _sg.active_context.id) { + _sg_discard_sampler(smp); + _sg_reset_sampler_to_alloc_state(smp); + } else { + _SG_WARN(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH); + _SG_TRACE_NOARGS(err_context_mismatch); + } +} + _SOKOL_PRIVATE void _sg_uninit_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd && ((shd->slot.state == SG_RESOURCESTATE_VALID) || (shd->slot.state == SG_RESOURCESTATE_FAILED))); if (shd->slot.ctx_id == _sg.active_context.id) { _sg_discard_shader(shd); _sg_reset_shader_to_alloc_state(shd); - } - else { + } else { _SG_WARN(UNINIT_SHADER_ACTIVE_CONTEXT_MISMATCH); _SG_TRACE_NOARGS(err_context_mismatch); } @@ -15532,8 +15497,7 @@ _SOKOL_PRIVATE void _sg_uninit_pipeline(_sg_pipeline_t* pip) { if (pip->slot.ctx_id == _sg.active_context.id) { _sg_discard_pipeline(pip); _sg_reset_pipeline_to_alloc_state(pip); - } - else { + } else { _SG_WARN(UNINIT_PIPELINE_ACTIVE_CONTEXT_MISMATCH); _SG_TRACE_NOARGS(err_context_mismatch); } @@ -15544,8 +15508,7 @@ _SOKOL_PRIVATE void _sg_uninit_pass(_sg_pass_t* pass) { if (pass->slot.ctx_id == _sg.active_context.id) { _sg_discard_pass(pass); _sg_reset_pass_to_alloc_state(pass); - } - else { + } else { _SG_WARN(UNINIT_PASS_ACTIVE_CONTEXT_MISMATCH); _SG_TRACE_NOARGS(err_context_mismatch); } @@ -15644,13 +15607,13 @@ _SOKOL_PRIVATE sg_desc _sg_desc_defaults(const sg_desc* desc) { res.context.sample_count = _sg_def(res.context.sample_count, 1); res.buffer_pool_size = _sg_def(res.buffer_pool_size, _SG_DEFAULT_BUFFER_POOL_SIZE); res.image_pool_size = _sg_def(res.image_pool_size, _SG_DEFAULT_IMAGE_POOL_SIZE); + res.sampler_pool_size = _sg_def(res.sampler_pool_size, _SG_DEFAULT_SAMPLER_POOL_SIZE); res.shader_pool_size = _sg_def(res.shader_pool_size, _SG_DEFAULT_SHADER_POOL_SIZE); res.pipeline_pool_size = _sg_def(res.pipeline_pool_size, _SG_DEFAULT_PIPELINE_POOL_SIZE); res.pass_pool_size = _sg_def(res.pass_pool_size, _SG_DEFAULT_PASS_POOL_SIZE); res.context_pool_size = _sg_def(res.context_pool_size, _SG_DEFAULT_CONTEXT_POOL_SIZE); res.uniform_buffer_size = _sg_def(res.uniform_buffer_size, _SG_DEFAULT_UB_SIZE); res.staging_buffer_size = _sg_def(res.staging_buffer_size, _SG_DEFAULT_STAGING_SIZE); - res.sampler_cache_size = _sg_def(res.sampler_cache_size, _SG_DEFAULT_SAMPLER_CACHE_CAPACITY); res.max_commit_listeners = _sg_def(res.max_commit_listeners, _SG_DEFAULT_MAX_COMMIT_LISTENERS); return res; } @@ -15794,6 +15757,13 @@ SOKOL_API_IMPL sg_image sg_alloc_image(void) { return res; } +SOKOL_API_IMPL sg_sampler sg_alloc_sampler(void) { + SOKOL_ASSERT(sg.valid); + sg_sampler res = _sg_alloc_sampler(); + _SG_TRACE_ARGS(alloc_sampler, res); + return res; +} + SOKOL_API_IMPL sg_shader sg_alloc_shader(void) { SOKOL_ASSERT(_sg.valid); sg_shader res = _sg_alloc_shader(); @@ -15821,8 +15791,7 @@ SOKOL_API_IMPL void sg_dealloc_buffer(sg_buffer buf_id) { if (buf) { if (buf->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_buffer(buf); - } - else { + } else { _SG_ERROR(DEALLOC_BUFFER_INVALID_STATE); } } @@ -15831,26 +15800,37 @@ SOKOL_API_IMPL void sg_dealloc_buffer(sg_buffer buf_id) { SOKOL_API_IMPL void sg_dealloc_image(sg_image img_id) { SOKOL_ASSERT(_sg.valid); - _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + _sg_image_t* img = _sg_lookup_image(&_sg.pool if (img) { if (img->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_image(img); - } - else { + } else { _SG_ERROR(DEALLOC_IMAGE_INVALID_STATE); } } _SG_TRACE_ARGS(dealloc_image, img_id); } +SOKOL_API_IMPL void sg_dealloc_sampler(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if (smp->slot.state == SG_RESOURCESTATE_ALLOC) { + _sg_dealloc_sampler(img); + } else { + _SG_ERROR(DEALLOC_SAMPLER_INVALID_STATE); + } + } + _SG_TRACE_ARGS(dealloc_sampler, smp_id); +} + SOKOL_API_IMPL void sg_dealloc_shader(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); if (shd) { if (shd->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_shader(shd); - } - else { + } else { _SG_ERROR(DEALLOC_SHADER_INVALID_STATE); } } @@ -15863,8 +15843,7 @@ SOKOL_API_IMPL void sg_dealloc_pipeline(sg_pipeline pip_id) { if (pip) { if (pip->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_pipeline(pip); - } - else { + } else { _SG_ERROR(DEALLOC_PIPELINE_INVALID_STATE); } } @@ -15877,8 +15856,7 @@ SOKOL_API_IMPL void sg_dealloc_pass(sg_pass pass_id) { if (pass) { if (pass->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_pass(pass); - } - else { + } else { _SG_ERROR(DEALLOC_PASS_INVALID_STATE); } } @@ -15893,8 +15871,7 @@ SOKOL_API_IMPL void sg_init_buffer(sg_buffer buf_id, const sg_buffer_desc* desc) if (buf->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_init_buffer(buf, &desc_def); SOKOL_ASSERT((buf->slot.state == SG_RESOURCESTATE_VALID) || (buf->slot.state == SG_RESOURCESTATE_FAILED)); - } - else { + } else { _SG_ERROR(INIT_BUFFER_INVALID_STATE); } } @@ -15909,8 +15886,7 @@ SOKOL_API_IMPL void sg_init_image(sg_image img_id, const sg_image_desc* desc) { if (img->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_init_image(img, &desc_def); SOKOL_ASSERT((img->slot.state == SG_RESOURCESTATE_VALID) || (img->slot.state == SG_RESOURCESTATE_FAILED)); - } - else { + } else { _SG_ERROR(INIT_IMAGE_INVALID_STATE); } } @@ -15925,8 +15901,7 @@ SOKOL_API_IMPL void sg_init_shader(sg_shader shd_id, const sg_shader_desc* desc) if (shd->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_init_shader(shd, &desc_def); SOKOL_ASSERT((shd->slot.state == SG_RESOURCESTATE_VALID) || (shd->slot.state == SG_RESOURCESTATE_FAILED)); - } - else { + } else { _SG_ERROR(INIT_SHADER_INVALID_STATE); } } @@ -15941,8 +15916,7 @@ SOKOL_API_IMPL void sg_init_pipeline(sg_pipeline pip_id, const sg_pipeline_desc* if (pip->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_init_pipeline(pip, &desc_def); SOKOL_ASSERT((pip->slot.state == SG_RESOURCESTATE_VALID) || (pip->slot.state == SG_RESOURCESTATE_FAILED)); - } - else { + } else { _SG_ERROR(INIT_PIPELINE_INVALID_STATE); } } @@ -15957,8 +15931,7 @@ SOKOL_API_IMPL void sg_init_pass(sg_pass pass_id, const sg_pass_desc* desc) { if (pass->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_init_pass(pass, &desc_def); SOKOL_ASSERT((pass->slot.state == SG_RESOURCESTATE_VALID) || (pass->slot.state == SG_RESOURCESTATE_FAILED)); - } - else { + } else { _SG_ERROR(INIT_PASS_INVALID_STATE); } } @@ -15972,8 +15945,7 @@ SOKOL_API_IMPL void sg_uninit_buffer(sg_buffer buf_id) { if ((buf->slot.state == SG_RESOURCESTATE_VALID) || (buf->slot.state == SG_RESOURCESTATE_FAILED)) { _sg_uninit_buffer(buf); SOKOL_ASSERT(buf->slot.state == SG_RESOURCESTATE_ALLOC); - } - else { + } else { _SG_ERROR(UNINIT_BUFFER_INVALID_STATE); } } @@ -15987,14 +15959,27 @@ SOKOL_API_IMPL void sg_uninit_image(sg_image img_id) { if ((img->slot.state == SG_RESOURCESTATE_VALID) || (img->slot.state == SG_RESOURCESTATE_FAILED)) { _sg_uninit_image(img); SOKOL_ASSERT(img->slot.state == SG_RESOURCESTATE_ALLOC); - } - else { + } else { _SG_ERROR(UNINIT_IMAGE_INVALID_STATE); } } _SG_TRACE_ARGS(uninit_image, img_id); } +SOKOL_API_IMPL void sg_uninit_sampler(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if ((smp->slot.state == SG_RESOURCESTATE_VALID) || (smp->slot.state == SG_RESOURCESTATE_FAILED)) { + _sg_uninit_sampler(smp); + SOKOL_ASSERT(smp->slot.state == SG_RESOURCESTATE_ALLOC); + } else { + _SG_ERROR(UNINIT_SAMPLER_INVALID_STATE); + } + } + _SG_TRACE_ARGS(uninit_sampler, smp_id); +} + SOKOL_API_IMPL void sg_uninit_shader(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); @@ -16002,8 +15987,7 @@ SOKOL_API_IMPL void sg_uninit_shader(sg_shader shd_id) { if ((shd->slot.state == SG_RESOURCESTATE_VALID) || (shd->slot.state == SG_RESOURCESTATE_FAILED)) { _sg_uninit_shader(shd); SOKOL_ASSERT(shd->slot.state == SG_RESOURCESTATE_ALLOC); - } - else { + } else { _SG_ERROR(UNINIT_SHADER_INVALID_STATE); } } @@ -16017,8 +16001,7 @@ SOKOL_API_IMPL void sg_uninit_pipeline(sg_pipeline pip_id) { if ((pip->slot.state == SG_RESOURCESTATE_VALID) || (pip->slot.state == SG_RESOURCESTATE_FAILED)) { _sg_uninit_pipeline(pip); SOKOL_ASSERT(pip->slot.state == SG_RESOURCESTATE_ALLOC); - } - else { + } else { _SG_ERROR(UNINIT_PIPELINE_INVALID_STATE); } } @@ -16032,8 +16015,7 @@ SOKOL_API_IMPL void sg_uninit_pass(sg_pass pass_id) { if ((pass->slot.state == SG_RESOURCESTATE_VALID) || (pass->slot.state == SG_RESOURCESTATE_FAILED)) { _sg_uninit_pass(pass); SOKOL_ASSERT(pass->slot.state == SG_RESOURCESTATE_ALLOC); - } - else { + } else { _SG_ERROR(UNINIT_PASS_INVALID_STATE); } } @@ -16048,8 +16030,7 @@ SOKOL_API_IMPL void sg_fail_buffer(sg_buffer buf_id) { if (buf->slot.state == SG_RESOURCESTATE_ALLOC) { buf->slot.ctx_id = _sg.active_context.id; buf->slot.state = SG_RESOURCESTATE_FAILED; - } - else { + } else { _SG_ERROR(FAIL_BUFFER_INVALID_STATE); } } @@ -16063,14 +16044,27 @@ SOKOL_API_IMPL void sg_fail_image(sg_image img_id) { if (img->slot.state == SG_RESOURCESTATE_ALLOC) { img->slot.ctx_id = _sg.active_context.id; img->slot.state = SG_RESOURCESTATE_FAILED; - } - else { + } else { _SG_ERROR(FAIL_IMAGE_INVALID_STATE); } } _SG_TRACE_ARGS(fail_image, img_id); } +SOKOL_API_IMPL void sg_fail_sampler(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if (smp->slot.state == SG_RESOURCESTATE_ALLOC) { + smp->slot.ctx_id = _sg.active_context.id; + smp->slot.state = SG_RESOURCESTATE_FAILED; + } else { + _SG_ERROR(FAIL_SAMPLER_INVALID_STATE); + } + } + _SG_TRACE_ARGS(fail_sampler, smp_id); +} + SOKOL_API_IMPL void sg_fail_shader(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); @@ -16078,8 +16072,7 @@ SOKOL_API_IMPL void sg_fail_shader(sg_shader shd_id) { if (shd->slot.state == SG_RESOURCESTATE_ALLOC) { shd->slot.ctx_id = _sg.active_context.id; shd->slot.state = SG_RESOURCESTATE_FAILED; - } - else { + } else { _SG_ERROR(FAIL_SHADER_INVALID_STATE); } } @@ -16093,8 +16086,7 @@ SOKOL_API_IMPL void sg_fail_pipeline(sg_pipeline pip_id) { if (pip->slot.state == SG_RESOURCESTATE_ALLOC) { pip->slot.ctx_id = _sg.active_context.id; pip->slot.state = SG_RESOURCESTATE_FAILED; - } - else { + } else { _SG_ERROR(FAIL_PIPELINE_INVALID_STATE); } } @@ -16108,8 +16100,7 @@ SOKOL_API_IMPL void sg_fail_pass(sg_pass pass_id) { if (pass->slot.state == SG_RESOURCESTATE_ALLOC) { pass->slot.ctx_id = _sg.active_context.id; pass->slot.state = SG_RESOURCESTATE_FAILED; - } - else { + } else { _SG_ERROR(FAIL_PASS_INVALID_STATE); } } @@ -16131,6 +16122,13 @@ SOKOL_API_IMPL sg_resource_state sg_query_image_state(sg_image img_id) { return res; } +SOKOL_API_IMPL sg_resource_state sg_query_sampler_state(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + sg_resource_state res = smp ? smp->slot.state : SG_RESOURCESTATE_INVALID; + return res; +} + SOKOL_API_IMPL sg_resource_state sg_query_shader_state(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); @@ -16183,6 +16181,21 @@ SOKOL_API_IMPL sg_image sg_make_image(const sg_image_desc* desc) { return img_id; } +SOKOL_API_IMPL sg_sampler sg_make_sampler(const sg_sampler_desc* desc) { + SOKOL_ASSERT(_sg.valid); + SOKOL_ASSERT(desc); + sg_sampler_desc desc_def = _sg_sampler_desc_defaults(desc); + sg_sampler smp_id = _sg_alloc_sampler(); + if (smp_id.id != SG_INVALID_ID) { + _sg_sampler_t* smp = _sg_sampler_at(&_sg.pools, smp_id.id); + SOKOL_ASSERT(smp && (smp->slot.state == SG_RESOURCESTATE_ALLOC)); + _sg_init_sampler(smp, &desc_def); + SOKOL_ASSERT((smp->slot.state == SG_RESOURCESTATE_VALID) || (smp->slot.state == SG_RESOURCESTATE_FAILED)); + } + _SG_TRACE_ARGS(make_sampler, &desc_def, smp_id); + return smp_id; +} + SOKOL_API_IMPL sg_shader sg_make_shader(const sg_shader_desc* desc) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(desc); @@ -16261,6 +16274,22 @@ SOKOL_API_IMPL void sg_destroy_image(sg_image img_id) { } } +SOKOL_API_IMPL void sg_destroy_sampler(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + _SG_TRACE_ARGS(destroy_sampler, smp_id); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if ((smp->slot.state == SG_RESOURCESTATE_VALID) || (smp->slot.state == SG_RESOURCESTATE_FAILED)) { + _sg_uninit_sampler(smp); + SOKOL_ASSERT(smp->slot.state == SG_RESOURCESTATE_ALLOC); + } + if (smp->slot.state == SG_RESOURCESTATE_ALLOC) { + _sg_dealloc_sampler(smp); + SOKOL_ASSERT(smp->slot.state == SG_RESOURCESTATE_INITIAL); + } + } +} + SOKOL_API_IMPL void sg_destroy_shader(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); _SG_TRACE_ARGS(destroy_shader, shd_id); @@ -16341,8 +16370,7 @@ SOKOL_API_IMPL void sg_begin_pass(sg_pass pass_id, const sg_pass_action* pass_ac const int h = img->cmn.height; _sg_begin_pass(pass, &pa, w, h); _SG_TRACE_ARGS(begin_pass, pass_id, &pa); - } - else { + } else { _sg.pass_valid = false; _SG_TRACE_NOARGS(err_pass_invalid); } @@ -16419,8 +16447,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { SOKOL_ASSERT(vbs[i]); _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vbs[i]->slot.state); _sg.next_draw_valid &= !vbs[i]->cmn.append_overflow; - } - else { + } else { break; } } @@ -16440,8 +16467,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { vs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->vs_images[i].id); SOKOL_ASSERT(vs_imgs[i]); _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vs_imgs[i]->slot.state); - } - else { + } else { break; } } @@ -16453,8 +16479,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { fs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->fs_images[i].id); SOKOL_ASSERT(fs_imgs[i]); _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == fs_imgs[i]->slot.state); - } - else { + } else { break; } } @@ -16463,8 +16488,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { int ib_offset = bindings->index_buffer_offset; _sg_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); _SG_TRACE_ARGS(apply_bindings, bindings); - } - else { + } else { _SG_TRACE_NOARGS(err_draw_invalid); } } @@ -16558,9 +16582,9 @@ SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { if ((data->size > 0) && buf && (buf->slot.state == SG_RESOURCESTATE_VALID)) { if (_sg_validate_update_buffer(buf, data)) { SOKOL_ASSERT(data->size <= (size_t)buf->cmn.size); - /* only one update allowed per buffer and frame */ + // only one update allowed per buffer and frame SOKOL_ASSERT(buf->cmn.update_frame_index != _sg.frame_index); - /* update and append on same buffer in same frame not allowed */ + // update and append on same buffer in same frame not allowed SOKOL_ASSERT(buf->cmn.append_frame_index != _sg.frame_index); _sg_update_buffer(buf, data); buf->cmn.update_frame_index = _sg.frame_index; @@ -16575,7 +16599,7 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); int result; if (buf) { - /* rewind append cursor in a new frame */ + // rewind append cursor in a new frame if (buf->cmn.append_frame_index != _sg.frame_index) { buf->cmn.append_pos = 0; buf->cmn.append_overflow = false; @@ -16587,7 +16611,7 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { if (buf->slot.state == SG_RESOURCESTATE_VALID) { if (_sg_validate_append_buffer(buf, data)) { if (!buf->cmn.append_overflow && (data->size > 0)) { - /* update and append on same buffer in same frame not allowed */ + // update and append on same buffer in same frame not allowed SOKOL_ASSERT(buf->cmn.update_frame_index != _sg.frame_index); int copied_num_bytes = _sg_append_buffer(buf, data, buf->cmn.append_frame_index != _sg.frame_index); buf->cmn.append_pos += copied_num_bytes; @@ -16596,9 +16620,8 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { } } result = start_pos; - } - else { - /* FIXME: should we return -1 here? */ + } else { + // FIXME: should we return -1 here? result = 0; } _SG_TRACE_ARGS(append_buffer, buf_id, data, result); @@ -16618,7 +16641,7 @@ SOKOL_API_IMPL bool sg_query_buffer_will_overflow(sg_buffer buf_id, size_t size) bool result = false; if (buf) { int append_pos = buf->cmn.append_pos; - /* rewind append cursor in a new frame */ + // rewind append cursor in a new frame if (buf->cmn.append_frame_index != _sg.frame_index) { append_pos = 0; } @@ -16709,6 +16732,19 @@ SOKOL_API_IMPL sg_image_info sg_query_image_info(sg_image img_id) { return info; } +SOKOL_API_IMPL sg_sampler_info sg_query_sampler_info(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_sampler_info info; + _sg_clear(&info, sizeof(info)); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + info.slot.state = smp->slot.state; + info.slot.res_id = smp->slot.id; + info.slot.ctx_id = smp->slot.ctx_id; + } + return info; +} + SOKOL_API_IMPL sg_shader_info sg_query_shader_info(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); sg_shader_info info; @@ -16776,15 +16812,27 @@ SOKOL_API_IMPL sg_image_desc sg_query_image_desc(sg_image img_id) { desc.usage = img->cmn.usage; desc.pixel_format = img->cmn.pixel_format; desc.sample_count = img->cmn.sample_count; - desc.min_filter = img->cmn.min_filter; - desc.mag_filter = img->cmn.mag_filter; - desc.wrap_u = img->cmn.wrap_u; - desc.wrap_v = img->cmn.wrap_v; - desc.wrap_w = img->cmn.wrap_w; - desc.border_color = img->cmn.border_color; - desc.max_anisotropy = img->cmn.max_anisotropy; - desc.min_lod = img->cmn.min_lod; - desc.max_lod = img->cmn.max_lod; + } + return desc; +} + +SOKOL_API_IMPL sg_sampler_desc sg_query_sampler_desc(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_sampler_desc desc; + _sg_clear(&desc, sizeof(desc)); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + desc.min_filter = smp->cmn.min_filter; + desc.mag_filter = smp->cmn.mag_filter; + desc.mipmap_filter = smp->cmn.mipmap_filter; + desc.wrap_u = smp->cmn.wrap_u; + desc.wrap_v = smp->cmn.wrap_v; + desc.wrap_w = smp->cmn.wrap_w; + desc.min_lod = smp->cmn.min_lod; + desc.max_lod = smp->cmn.max_lod; + desc.border_color = smp->cmn.border_color; + desc.compare = smp->cmn.compare; + desc.max_anisotropy = smp->cmn.max_anisotropy; } return desc; } @@ -16867,6 +16915,11 @@ SOKOL_API_IMPL sg_image_desc sg_query_image_defaults(const sg_image_desc* desc) return _sg_image_desc_defaults(desc); } +SOKOL_API_IMPL sg_sampler_desc sg_query_sampler_defaults(const sg_sampler_desc* desc) { + SOKOL_ASSERT(_sg.valid && desc); + return _sg_sampler_desc_defaults(desc); +} + SOKOL_API_IMPL sg_shader_desc sg_query_shader_defaults(const sg_shader_desc* desc) { SOKOL_ASSERT(_sg.valid && desc); return _sg_shader_desc_defaults(desc); From e1c4c51131a4a5cd1aaaf2821cac9cbaa3c3ec13 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 31 May 2023 20:23:05 +0200 Subject: [PATCH 007/292] sokol_gfx.h metal: sampler objects wip --- sokol_gfx.h | 284 +++++++++++++++++++++++++++++----------------------- 1 file changed, 161 insertions(+), 123 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 6c4640f83..284f4bd2a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3549,6 +3549,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #endif #endif #include + #include #if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE #define _SG_TARGET_MACOS (1) #else @@ -3557,6 +3558,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define _SG_TARGET_IOS_SIMULATOR (1) #endif #endif + #define _SG_METAL_HAS_BORDER_COLOR ((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)) #import #elif defined(SOKOL_WGPU) #if defined(__EMSCRIPTEN__) @@ -4064,7 +4066,7 @@ typedef struct { typedef struct { sg_image_type image_type; - sg_sampler_type sampler_type; + sg_image_sample_type sample_type; } _sg_shader_image_t; typedef struct { @@ -4098,7 +4100,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh break; } stage->images[img_index].image_type = img_desc->image_type; - stage->images[img_index].sampler_type = img_desc->sampler_type; + stage->images[img_index].sample_type = img_desc->sample_type; stage->num_images++; } } @@ -4108,11 +4110,11 @@ typedef struct { bool vertex_layout_valid[SG_MAX_VERTEX_BUFFERS]; bool use_instanced_draw; sg_shader shader_id; - sg_layout_desc layout; + sg_vertex_layout_state layout; sg_depth_state depth; sg_stencil_state stencil; int color_count; - sg_color_state colors[SG_MAX_COLOR_ATTACHMENTS]; + sg_color_target_state colors[SG_MAX_COLOR_ATTACHMENTS]; sg_primitive_type primitive_type; sg_index_type index_type; sg_cull_mode cull_mode; @@ -4819,6 +4821,7 @@ typedef struct { _sg_pool_t context_pool; _sg_buffer_t* buffers; _sg_image_t* images; + _sg_sampler_t* samplers; _sg_shader_t* shaders; _sg_pipeline_t* pipelines; _sg_pass_t* passes; @@ -10373,31 +10376,22 @@ _SOKOL_PRIVATE MTLSamplerBorderColor _sg_mtl_border_color(sg_border_color c) { } #endif -_SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter f) { - switch (f) { +_SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter minmag_filter) { + switch (minmag_filter) { case SG_FILTER_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_LINEAR: return MTLSamplerMinMagFilterNearest; case SG_FILTER_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: - case SG_FILTER_LINEAR_MIPMAP_LINEAR: return MTLSamplerMinMagFilterLinear; default: SOKOL_UNREACHABLE; return (MTLSamplerMinMagFilter)0; } } -_SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mip_filter(sg_filter f) { - switch (f) { +_SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mipmap_filter(sg_filter mipmap_filter) { + switch (mipmap_filter) { case SG_FILTER_NEAREST: - case SG_FILTER_LINEAR: - return MTLSamplerMipFilterNotMipmapped; - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: return MTLSamplerMipFilterNearest; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_LINEAR: + case SG_FILTER_LINEAR: return MTLSamplerMipFilterLinear; default: SOKOL_UNREACHABLE; return (MTLSamplerMipFilter)0; @@ -10532,35 +10526,6 @@ _SOKOL_PRIVATE id _sg_mtl_id(int slot_index) { return _sg.mtl.idpool.pool[(NSUInteger)slot_index]; } -/* - create and add an MTLSamplerStateObject and return its resource pool index, - reuse identical sampler state if one exists -*/ -_SOKOL_PRIVATE int _sg_mtl_create_sampler(id mtl_device, const sg_image_desc* img_desc) { - SOKOL_ASSERT(img_desc); - MTLSamplerDescriptor* mtl_desc = [[MTLSamplerDescriptor alloc] init]; - mtl_desc.sAddressMode = _sg_mtl_address_mode(img_desc->wrap_u); - mtl_desc.tAddressMode = _sg_mtl_address_mode(img_desc->wrap_v); - if (SG_IMAGETYPE_3D == img_desc->type) { - mtl_desc.rAddressMode = _sg_mtl_address_mode(img_desc->wrap_w); - } - #if defined(_SG_TARGET_MACOS) - mtl_desc.borderColor = _sg_mtl_border_color(img_desc->border_color); - #endif - mtl_desc.minFilter = _sg_mtl_minmag_filter(img_desc->min_filter); - mtl_desc.magFilter = _sg_mtl_minmag_filter(img_desc->mag_filter); - mtl_desc.mipFilter = _sg_mtl_mip_filter(img_desc->min_filter); - mtl_desc.lodMinClamp = img_desc->min_lod; - mtl_desc.lodMaxClamp = img_desc->max_lod; - mtl_desc.maxAnisotropy = img_desc->max_anisotropy; - mtl_desc.normalizedCoordinates = YES; - id mtl_sampler = [mtl_device newSamplerStateWithDescriptor:mtl_desc]; - _SG_OBJC_RELEASE(mtl_desc); - int sampler_handle = _sg_mtl_add_resource(mtl_sampler); - _SG_OBJC_RELEASE(mtl_sampler); - return sampler_handle; -} - _SOKOL_PRIVATE void _sg_mtl_clear_state_cache(void) { _sg_clear(&_sg.mtl.state_cache, sizeof(_sg.mtl.state_cache)); } @@ -10577,7 +10542,7 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { #endif #endif _sg.features.origin_top_left = true; - #if defined(_SG_TARGET_MACOS) + #if _SG_METAL_HAS_BORDER_COLOR _sg.features.image_clamp_to_border = true; #else _sg.features.image_clamp_to_border = false; @@ -10960,7 +10925,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_image(_sg_image_t* img, const sg for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { img->mtl.tex[i] = _sg_mtl_add_resource(nil); } - img->mtl.sampler_state = _sg_mtl_add_resource(nil); // initialize a Metal texture descriptor MTLTextureDescriptor* mtl_desc = [[MTLTextureDescriptor alloc] init]; @@ -10976,25 +10940,19 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_image(_sg_image_t* img, const sg } } for (int slot = 0; slot < img->cmn.num_slots; slot++) { - id tex; + id mtl_tex; if (injected) { SOKOL_ASSERT(desc->mtl_textures[slot]); - tex = (__bridge id) desc->mtl_textures[slot]; + mtl_tex = (__bridge id) desc->mtl_textures[slot]; } else { - tex = [_sg.mtl.device newTextureWithDescriptor:mtl_desc]; + mtl_tex = [_sg.mtl.device newTextureWithDescriptor:mtl_desc]; if ((img->cmn.usage == SG_USAGE_IMMUTABLE) && !img->cmn.render_target) { - _sg_mtl_copy_image_data(img, tex, &desc->data); + _sg_mtl_copy_image_data(img, mtl_tex, &desc->data); } } - img->mtl.tex[slot] = _sg_mtl_add_resource(tex); - _SG_OBJC_RELEASE(tex); - } - - // create (possibly shared) sampler state (not for MSAA textures, which cannot be sampled) - if (img->cmn.sample_count == 1) { - img->mtl.sampler_state = _sg_mtl_create_sampler(_sg.mtl.device, desc); + img->mtl.tex[slot] = _sg_mtl_add_resource(mtl_tex); + _SG_OBJC_RELEASE(mtl_tex); } - _SG_OBJC_RELEASE(mtl_desc); return SG_RESOURCESTATE_VALID; } @@ -11005,7 +10963,45 @@ _SOKOL_PRIVATE void _sg_mtl_discard_image(_sg_image_t* img) { for (int slot = 0; slot < img->cmn.num_slots; slot++) { _sg_mtl_release_resource(_sg.mtl.frame_index, img->mtl.tex[slot]); } - // NOTE: sampler state objects are shared and not released until shutdown +} + +_SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && desc); + _sg_sampler_common_init(&smp->cmn, desc); + id mtl_smp; + const bool injected = (0 != desc->mtl_sampler); + if (injected) { + SOKOL_ASSERT(desc->mtl_sampler); + mtl_smp = (__bridge id) desc->mtl_sampler; + } else { + MTLSamplerDescriptor* mtl_desc = [[MTLSamplerDescriptor alloc] init]; + mtl_desc.sAddressMode = _sg_mtl_address_mode(desc->wrap_u); + mtl_desc.tAddressMode = _sg_mtl_address_mode(desc->wrap_v); + mtl_desc.rAddressMode = _sg_mtl_address_mode(desc->wrap_w); + #if _SG_METAL_HAS_BORDER_COLOR + mtl_desc.borderColor = _sg_mtl_border_color(desc->border_color); + #endif + mtl_desc.minFilter = _sg_mtl_minmag_filter(desc->min_filter); + mtl_desc.magFilter = _sg_mtl_minmag_filter(desc->mag_filter); + mtl_desc.mipFilter = _sg_mtl_mipmap_filter(desc->mipmap_filter); + mtl_desc.lodMinClamp = desc->min_lod; + mtl_desc.lodMaxClamp = desc->max_lod; + // FIXME: lodAverage? + mtl_desc.maxAnisotropy = desc->max_anisotropy; + mtl_desc.normalizedCoordinates = YES; + mtl_desc.compareFunction = _sg_mtl_compare_func(desc->compare); + mtl_smp = [_sg.mtl.device newSamplerStateWithDescriptor:mtl_desc]; + _SG_OBJC_RELEASE(mtl_desc); + } + smp->mtl.sampler_state = _sg_mtl_add_resource(mtl_smp); + _SG_OBJC_RELEASE(mtl_smp); + return SG_RESOURCESTATE_VALID; +} + +_SOKOL_PRIVATE void _sg_mtl_discard_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + // it's valid to call release resource with a 'null resource' + _sg_mtl_release_resource(_sg.mtl.frame_index, smp->mtl.sampler_state); } _SOKOL_PRIVATE id _sg_mtl_compile_library(const char* src) { @@ -11132,25 +11128,25 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s /* create vertex-descriptor */ MTLVertexDescriptor* vtx_desc = [MTLVertexDescriptor vertexDescriptor]; for (NSUInteger attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - const sg_vertex_attr_desc* a_desc = &desc->layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - vtx_desc.attributes[attr_index].format = _sg_mtl_vertex_format(a_desc->format); - vtx_desc.attributes[attr_index].offset = (NSUInteger)a_desc->offset; - vtx_desc.attributes[attr_index].bufferIndex = (NSUInteger)(a_desc->buffer_index + SG_MAX_SHADERSTAGE_UBS); - pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); + vtx_desc.attributes[attr_index].format = _sg_mtl_vertex_format(a_state->format); + vtx_desc.attributes[attr_index].offset = (NSUInteger)a_state->offset; + vtx_desc.attributes[attr_index].bufferIndex = (NSUInteger)(a_state->buffer_index + SG_MAX_SHADERSTAGE_UBS); + pip->cmn.vertex_layout_valid[a_state->buffer_index] = true; } for (NSUInteger layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { if (pip->cmn.vertex_layout_valid[layout_index]) { - const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; + const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[layout_index]; const NSUInteger mtl_vb_slot = layout_index + SG_MAX_SHADERSTAGE_UBS; - SOKOL_ASSERT(l_desc->stride > 0); - vtx_desc.layouts[mtl_vb_slot].stride = (NSUInteger)l_desc->stride; - vtx_desc.layouts[mtl_vb_slot].stepFunction = _sg_mtl_step_function(l_desc->step_func); - vtx_desc.layouts[mtl_vb_slot].stepRate = (NSUInteger)l_desc->step_rate; - if (SG_VERTEXSTEP_PER_INSTANCE == l_desc->step_func) { + SOKOL_ASSERT(l_state->stride > 0); + vtx_desc.layouts[mtl_vb_slot].stride = (NSUInteger)l_state->stride; + vtx_desc.layouts[mtl_vb_slot].stepFunction = _sg_mtl_step_function(l_state->step_func); + vtx_desc.layouts[mtl_vb_slot].stepRate = (NSUInteger)l_state->step_rate; + if (SG_VERTEXSTEP_PER_INSTANCE == l_state->step_func) { // NOTE: not actually used in _sg_mtl_draw() pip->cmn.use_instanced_draw = true; } @@ -11182,7 +11178,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s */ for (NSUInteger i = 0; i < (NSUInteger)desc->color_count; i++) { SOKOL_ASSERT(i < SG_MAX_COLOR_ATTACHMENTS); - const sg_color_state* cs = &desc->colors[i]; + const sg_color_target_state* cs = &desc->colors[i]; rp_desc.colorAttachments[i].pixelFormat = _sg_mtl_pixel_format(cs->pixel_format); rp_desc.colorAttachments[i].writeMask = _sg_mtl_color_write_mask(cs->write_mask); rp_desc.colorAttachments[i].blendingEnabled = cs->blend.enabled; @@ -11596,19 +11592,18 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); - /* store index buffer binding, this will be needed later in sg_draw() */ + // store index buffer binding, this will be needed later in sg_draw() _sg.mtl.state_cache.cur_indexbuffer = ib; _sg.mtl.state_cache.cur_indexbuffer_offset = ib_offset; if (ib) { SOKOL_ASSERT(pip->cmn.index_type != SG_INDEXTYPE_NONE); _sg.mtl.state_cache.cur_indexbuffer_id.id = ib->slot.id; - } - else { + } else { SOKOL_ASSERT(pip->cmn.index_type == SG_INDEXTYPE_NONE); _sg.mtl.state_cache.cur_indexbuffer_id.id = SG_INVALID_ID; } - /* apply vertex buffers */ + // apply vertex buffers NSUInteger slot; for (slot = 0; slot < (NSUInteger)num_vbs; slot++) { const _sg_buffer_t* vb = vbs[slot]; @@ -11627,7 +11622,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } } - /* apply vertex shader images */ + // apply vertex shader images for (slot = 0; slot < (NSUInteger)num_vs_imgs; slot++) { const _sg_image_t* img = vs_imgs[slot]; if ((_sg.mtl.state_cache.cur_vs_images[slot] != img) || (_sg.mtl.state_cache.cur_vs_image_ids[slot].id != img->slot.id)) { @@ -11635,12 +11630,17 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( _sg.mtl.state_cache.cur_vs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setVertexTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; - SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); - [_sg.mtl.cmd_encoder setVertexSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; } } - /* apply fragment shader images */ + // apply vertex shader samplers + // FIXME! + /* + SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); + [_sg.mtl.cmd_encoder setVertexSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; + */ + + // apply fragment shader images for (slot = 0; slot < (NSUInteger)num_fs_imgs; slot++) { const _sg_image_t* img = fs_imgs[slot]; if ((_sg.mtl.state_cache.cur_fs_images[slot] != img) || (_sg.mtl.state_cache.cur_fs_image_ids[slot].id != img->slot.id)) { @@ -11648,10 +11648,15 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( _sg.mtl.state_cache.cur_fs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setFragmentTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; - SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); - [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; } } + + // apply fragme shader samplers + // FIXME! + /* + SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); + [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; + */ } _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -13621,6 +13626,38 @@ static inline void _sg_discard_image(_sg_image_t* img) { #endif } +static inline sg_resource_state _sg_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + #if defined(_SOKOL_ANY_GL) + return _sg_gl_create_sampler(smp, desc); + #elif defined(SOKOL_METAL) + return _sg_mtl_create_sampler(smp, desc); + #elif defined(SOKOL_D3D11) + return _sg_d3d11_create_sampler(smp, desc); + #elif defined(SOKOL_WGPU) + return _sg_wgpu_create_sampler(smp, desc); + #elif defined(SOKOL_DUMMY_BACKEND) + return _sg_dummy_create_sampler(smp, desc); + #else + #error("INVALID BACKEND"); + #endif +} + +static inline void _sg_discard_sampler(_sg_sampler_t* smp) { + #if defined(_SOKOL_ANY_GL) + _sg_gl_discard_sampler(smp); + #elif defined(SOKOL_METAL) + _sg_mtl_discard_sampler(smp); + #elif defined(SOKOL_D3D11) + _sg_d3d11_discard_sampler(smp); + #elif defined(SOKOL_WGPU) + _sg_wgpu_discard_sampler(smp); + #elif defined(SOKOL_DUMMY_BACKEND) + _sg_dummy_discard_sampler(smp); + #else + #error("INVALID BACKEND"); + #endif +} + static inline sg_resource_state _sg_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { #if defined(_SOKOL_ANY_GL) return _sg_gl_create_shader(shd, desc); @@ -14051,7 +14088,7 @@ _SOKOL_PRIVATE void _sg_reset_image_to_alloc_state(_sg_image_t* img) { _SOKOL_PRIVATE void _sg_reset_sampler_to_alloc_state(_sg_sampler_t* smp) { SOKOL_ASSERT(smp); _sg_slot_t slot = smp->slot; - _sg_clear(smp, sizepf(_sg_sampler_t)); + _sg_clear(smp, sizeof(_sg_sampler_t)); smp->slot = slot; smp->slot.state = SG_RESOURCESTATE_ALLOC; } @@ -14245,7 +14282,7 @@ _SOKOL_PRIVATE _sg_image_t* _sg_lookup_image(const _sg_pools_t* p, uint32_t img_ return 0; } -_SOKOL_PRIVATE _sg_sampler_t* _sg_lookup_sampler(const _sg_pool_t* p, uint32_t smp_id) { +_SOKOL_PRIVATE _sg_sampler_t* _sg_lookup_sampler(const _sg_pools_t* p, uint32_t smp_id) { if (SG_INVALID_ID != smp_id) { _sg_sampler_t* smp = _sg_sampler_at(p, smp_id); if (smp->slot.id == smp_id) { @@ -14646,11 +14683,11 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_PIPELINEDESC_CANARY); _SG_VALIDATE(desc->shader.id != SG_INVALID_ID, VALIDATE_PIPELINEDESC_SHADER); for (int buf_index = 0; buf_index < SG_MAX_VERTEX_BUFFERS; buf_index++) { - const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[buf_index]; - if (l_desc->stride == 0) { + const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[buf_index]; + if (l_state->stride == 0) { continue; } - _SG_VALIDATE((l_desc->stride & 3) == 0, VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4); + _SG_VALIDATE((l_state->stride & 3) == 0, VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4); } _SG_VALIDATE(desc->layout.attrs[0].format != SG_VERTEXFORMAT_INVALID, VALIDATE_PIPELINEDESC_NO_ATTRS); const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, desc->shader.id); @@ -14659,13 +14696,13 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { _SG_VALIDATE(shd->slot.state == SG_RESOURCESTATE_VALID, VALIDATE_PIPELINEDESC_SHADER); bool attrs_cont = true; for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - const sg_vertex_attr_desc* a_desc = &desc->layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { attrs_cont = false; continue; } _SG_VALIDATE(attrs_cont, VALIDATE_PIPELINEDESC_NO_ATTRS); - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); #if defined(SOKOL_D3D11) /* on D3D11, semantic names (and semantic indices) must be provided */ _SG_VALIDATE(!_sg_strempty(&shd->d3d11.attrs[attr_index].sem_name), VALIDATE_PIPELINEDESC_ATTR_SEMANTICS); @@ -14925,9 +14962,9 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; - if (bindings->vs_images[i].id != SG_INVALID_ID) { + if (bindings->vs.images[i].id != SG_INVALID_ID) { _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_VS_IMGS); - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs_images[i].id); + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); _SG_VALIDATE(img != 0, VALIDATE_ABND_VS_IMG_EXISTS); if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_VS_IMG_TYPES); @@ -14942,9 +14979,9 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected fragment shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; - if (bindings->fs_images[i].id != SG_INVALID_ID) { + if (bindings->fs.images[i].id != SG_INVALID_ID) { _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_FS_IMGS); - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs_images[i].id); + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); _SG_VALIDATE(img != 0, VALIDATE_ABND_FS_IMG_EXISTS); if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_FS_IMG_TYPES); @@ -15098,6 +15135,7 @@ _SOKOL_PRIVATE sg_sampler_desc _sg_sampler_desc_defaults(const sg_sampler_desc* def.border_color = _sg_def(def.border_color, SG_BORDERCOLOR_OPAQUE_BLACK); def.compare = _sg_def(def.compare, SG_COMPAREFUNC_NEVER); def.max_anisotropy = _sg_def(def.max_anisotropy, 1); + return def; } _SOKOL_PRIVATE sg_shader_desc _sg_shader_desc_defaults(const sg_shader_desc* desc) { @@ -15138,7 +15176,7 @@ _SOKOL_PRIVATE sg_shader_desc _sg_shader_desc_defaults(const sg_shader_desc* des if (img_desc->image_type == _SG_IMAGETYPE_DEFAULT) { break; } - img_desc->sampler_type = _sg_def(img_desc->sampler_type, SG_SAMPLERTYPE_FLOAT); + img_desc->sample_type = _sg_def(img_desc->sample_type, SG_IMAGESAMPLETYPE_FLOAT); } } return def; @@ -15169,7 +15207,7 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des def.color_count = SG_MAX_COLOR_ATTACHMENTS; } for (int i = 0; i < def.color_count; i++) { - sg_color_state* cs = &def.colors[i]; + sg_color_target_state* cs = &def.colors[i]; cs->pixel_format = _sg_def(cs->pixel_format, _sg.desc.context.color_format); cs->write_mask = _sg_def(cs->write_mask, SG_COLORMASK_RGBA); sg_blend_state* bs = &def.colors[i].blend; @@ -15182,14 +15220,14 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des } for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - sg_vertex_attr_desc* a_desc = &def.layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + sg_vertex_attr_state* a_state = &def.layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - sg_buffer_layout_desc* b_desc = &def.layout.buffers[a_desc->buffer_index]; - b_desc->step_func = _sg_def(b_desc->step_func, SG_VERTEXSTEP_PER_VERTEX); - b_desc->step_rate = _sg_def(b_desc->step_rate, 1); + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); + sg_vertex_buffer_layout_state* l_state = &def.layout.buffers[a_state->buffer_index]; + l_state->step_func = _sg_def(l_state->step_func, SG_VERTEXSTEP_PER_VERTEX); + l_state->step_rate = _sg_def(l_state->step_rate, 1); } /* resolve vertex layout strides and offsets */ @@ -15203,21 +15241,21 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des } } for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - sg_vertex_attr_desc* a_desc = &def.layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + sg_vertex_attr_state* a_state = &def.layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); if (use_auto_offset) { - a_desc->offset = auto_offset[a_desc->buffer_index]; + a_state->offset = auto_offset[a_state->buffer_index]; } - auto_offset[a_desc->buffer_index] += _sg_vertexformat_bytesize(a_desc->format); + auto_offset[a_state->buffer_index] += _sg_vertexformat_bytesize(a_state->format); } /* compute vertex strides if needed */ for (int buf_index = 0; buf_index < SG_MAX_VERTEX_BUFFERS; buf_index++) { - sg_buffer_layout_desc* l_desc = &def.layout.buffers[buf_index]; - if (l_desc->stride == 0) { - l_desc->stride = auto_offset[buf_index]; + sg_vertex_buffer_layout_state* l_state = &def.layout.buffers[buf_index]; + if (l_state->stride == 0) { + l_state->stride = auto_offset[buf_index]; } } @@ -15320,7 +15358,7 @@ _SOKOL_PRIVATE void _sg_dealloc_image(_sg_image_t* img) { _sg_reset_slot(&img->slot); } -_SOKOL_PRIVATE void _sg_dealloc_sampler(_sg_sampler* smp) { +_SOKOL_PRIVATE void _sg_dealloc_sampler(_sg_sampler_t* smp) { SOKOL_ASSERT(smp && (smp->slot.state == SG_RESOURCESTATE_ALLOC) && (smp->slot.id != SG_INVALID_ID)); _sg_pool_free_index(&_sg.pools.sampler_pool, _sg_slot_index(smp->slot.id)); _sg_reset_slot(&smp->slot); @@ -15758,7 +15796,7 @@ SOKOL_API_IMPL sg_image sg_alloc_image(void) { } SOKOL_API_IMPL sg_sampler sg_alloc_sampler(void) { - SOKOL_ASSERT(sg.valid); + SOKOL_ASSERT(_sg.valid); sg_sampler res = _sg_alloc_sampler(); _SG_TRACE_ARGS(alloc_sampler, res); return res; @@ -15800,7 +15838,7 @@ SOKOL_API_IMPL void sg_dealloc_buffer(sg_buffer buf_id) { SOKOL_API_IMPL void sg_dealloc_image(sg_image img_id) { SOKOL_ASSERT(_sg.valid); - _sg_image_t* img = _sg_lookup_image(&_sg.pool + _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); if (img) { if (img->slot.state == SG_RESOURCESTATE_ALLOC) { _sg_dealloc_image(img); @@ -15816,7 +15854,7 @@ SOKOL_API_IMPL void sg_dealloc_sampler(sg_sampler smp_id) { _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); if (smp) { if (smp->slot.state == SG_RESOURCESTATE_ALLOC) { - _sg_dealloc_sampler(img); + _sg_dealloc_sampler(smp); } else { _SG_ERROR(DEALLOC_SAMPLER_INVALID_STATE); } @@ -16463,8 +16501,8 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { _sg_image_t* vs_imgs[SG_MAX_SHADERSTAGE_IMAGES] = { 0 }; int num_vs_imgs = 0; for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, num_vs_imgs++) { - if (bindings->vs_images[i].id) { - vs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->vs_images[i].id); + if (bindings->vs.images[i].id) { + vs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); SOKOL_ASSERT(vs_imgs[i]); _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vs_imgs[i]->slot.state); } else { @@ -16475,8 +16513,8 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { _sg_image_t* fs_imgs[SG_MAX_SHADERSTAGE_IMAGES] = { 0 }; int num_fs_imgs = 0; for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, num_fs_imgs++) { - if (bindings->fs_images[i].id) { - fs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->fs_images[i].id); + if (bindings->fs.images[i].id) { + fs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); SOKOL_ASSERT(fs_imgs[i]); _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == fs_imgs[i]->slot.state); } else { @@ -16855,7 +16893,7 @@ SOKOL_API_IMPL sg_shader_desc sg_query_shader_desc(sg_shader shd_id) { sg_shader_image_desc* img_desc = &stage_desc->images[img_idx]; const _sg_shader_image_t* img = &stage->images[img_idx]; img_desc->image_type = img->image_type; - img_desc->sampler_type = img->sampler_type; + img_desc->sample_type = img->sample_type; } } } From 45990a0fde3e8e6fed2f34966d271e934a78d363 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 1 Jun 2023 20:56:56 +0200 Subject: [PATCH 008/292] sokol_gfx.h metal: bind sampler objects wip --- sokol_gfx.h | 249 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 162 insertions(+), 87 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 284f4bd2a..034b5050d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2448,17 +2448,14 @@ typedef struct sg_shader_image_desc { sg_image_type image_type; sg_image_sample_type sample_type; bool multisampled; - uint8_t binding; } sg_shader_image_desc; typedef struct sg_shader_sampler_desc { sg_sampler_type type; - uint8_t binding; } sg_shader_sampler_desc; typedef struct sg_shader_combined_image_sampler_desc { const char* name; // optional GLSL location - uint8_t binding; // binding location if name not provided } sg_shader_combined_image_sampler_desc; typedef struct sg_shader_stage_desc { @@ -2948,8 +2945,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_SIZE_MISMATCH, "size of uniform block members doesn't match uniform block size") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_ARRAY_COUNT, "uniform array count must be >= 1") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_STD140_ARRAY_TYPE, "uniform arrays only allowed for FLOAT4, INT4, MAT4 in std140 layout") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMGS, "shader images must occupy continuous slots") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMG_NAME, "GL backend requires uniform block member names") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMGS, "shader images must occupy continuous slots (sg_shader_desc.vs|fs.images[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_SMPS, "shader samplers must occupy continuous slots (sg_shader_desc.vs|fs.samplers[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_SEMANTICS, "D3D11 backend requires vertex attribute semantics") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_STRING_TOO_LONG, "vertex attribute name/semantic string too long (max len 16)") \ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_CANARY, "sg_pipeline_desc not initialized") \ @@ -3013,16 +3010,20 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_EXISTS, "sg_apply_bindings: index buffer no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_TYPE, "sg_apply_bindings: buffer in index buffer slot is not a SG_BUFFERTYPE_INDEXBUFFER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_OVERFLOW, "sg_apply_bindings: buffer in index buffer slot is overflown") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMGS, "sg_apply_bindings: vertex shader image count doesn't match sg_shader_desc") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: vertex shader image no longer alive") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMGS, "sg_apply_bindings: number of images bound to vertex stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: image bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_TYPES, "sg_apply_bindings: one or more vertex shader image types don't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMGS, "sg_apply_bindings: fragment shader image count doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMPS, "sg_apply_bindings: number of samplers bound to vertex stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMGS, "sg_apply_bindings: number of images bound to fragment stage doesn't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: fragment shader image no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_TYPES, "sg_apply_bindings: one or more fragment shader image types don't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMPS, "sg_apply_bindings: number of samplers bound to fragment stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_UB_AT_SLOT, "sg_apply_uniforms: no uniform block declaration at this shader stage UB slot") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_SIZE, "sg_apply_uniforms: data size exceeds declared uniform block size") \ @@ -4069,11 +4070,17 @@ typedef struct { sg_image_sample_type sample_type; } _sg_shader_image_t; +typedef struct { + sg_sampler_type type; +} _sg_shader_sampler_t; + typedef struct { int num_uniform_blocks; int num_images; + int num_samplers; _sg_shader_uniform_block_t uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; _sg_shader_image_t images[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_shader_sampler_t samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; } _sg_shader_stage_t; typedef struct { @@ -4103,6 +4110,15 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh stage->images[img_index].sample_type = img_desc->sample_type; stage->num_images++; } + SOKOL_ASSERT(stage->num_samplers == 0); + for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { + const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; + if (smp_desc->type == _SG_SAMPLERTYPE_DEFAULT) { + break; + } + stage->samplers[smp_index].type = smp_desc->type; + stage->num_samplers++; + } } } @@ -4639,6 +4655,10 @@ typedef struct { sg_image cur_vs_image_ids[SG_MAX_SHADERSTAGE_IMAGES]; const _sg_image_t* cur_fs_images[SG_MAX_SHADERSTAGE_IMAGES]; sg_image cur_fs_image_ids[SG_MAX_SHADERSTAGE_IMAGES]; + const _sg_sampler_t* cur_vs_samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; + sg_sampler cur_vs_sampler_ids[SG_MAX_SHADERSTAGE_SAMPLERS]; + const _sg_sampler_t* cur_fs_samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; + sg_sampler cur_fs_sampler_ids[SG_MAX_SHADERSTAGE_SAMPLERS]; } _sg_mtl_state_cache_t; typedef struct { @@ -11035,7 +11055,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const _sg_shader_common_init(&shd->cmn, desc); - /* create metal library objects and lookup entry functions */ + // create metal library objects and lookup entry functions id vs_lib = nil; id fs_lib = nil; id vs_func = nil; @@ -11043,7 +11063,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const const char* vs_entry = desc->vs.entry; const char* fs_entry = desc->fs.entry; if (desc->vs.bytecode.ptr && desc->fs.bytecode.ptr) { - /* separate byte code provided */ + // separate byte code provided vs_lib = _sg_mtl_library_from_bytecode(desc->vs.bytecode.ptr, desc->vs.bytecode.size); fs_lib = _sg_mtl_library_from_bytecode(desc->fs.bytecode.ptr, desc->fs.bytecode.size); if ((nil == vs_lib) || (nil == fs_lib)) { @@ -11051,9 +11071,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const } vs_func = [vs_lib newFunctionWithName:[NSString stringWithUTF8String:vs_entry]]; fs_func = [fs_lib newFunctionWithName:[NSString stringWithUTF8String:fs_entry]]; - } - else if (desc->vs.source && desc->fs.source) { - /* separate sources provided */ + } else if (desc->vs.source && desc->fs.source) { + // separate sources provided vs_lib = _sg_mtl_compile_library(desc->vs.source); fs_lib = _sg_mtl_compile_library(desc->fs.source); if ((nil == vs_lib) || (nil == fs_lib)) { @@ -11061,8 +11080,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const } vs_func = [vs_lib newFunctionWithName:[NSString stringWithUTF8String:vs_entry]]; fs_func = [fs_lib newFunctionWithName:[NSString stringWithUTF8String:fs_entry]]; - } - else { + } else { goto failed; } if (nil == vs_func) { @@ -11073,7 +11091,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const _SG_ERROR(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND); goto failed; } - /* it is legal to call _sg_mtl_add_resource with a nil value, this will return a special 0xFFFFFFFF index */ + // it is legal to call _sg_mtl_add_resource with a nil value, this will return a special 0xFFFFFFFF index shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib = _sg_mtl_add_resource(vs_lib); _SG_OBJC_RELEASE(vs_lib); shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib = _sg_mtl_add_resource(fs_lib); @@ -11125,7 +11143,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s pip->mtl.winding = _sg_mtl_winding(desc->face_winding); pip->mtl.stencil_ref = desc->stencil.ref; - /* create vertex-descriptor */ + // create vertex-descriptor MTLVertexDescriptor* vtx_desc = [MTLVertexDescriptor vertexDescriptor]; for (NSUInteger attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; @@ -11153,7 +11171,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s } } - /* render-pipeline descriptor */ + // render-pipeline descriptor MTLRenderPipelineDescriptor* rp_desc = [[MTLRenderPipelineDescriptor alloc] init]; rp_desc.vertexDescriptor = vtx_desc; SOKOL_ASSERT(shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func != _SG_MTL_INVALID_SLOT_INDEX); @@ -11199,7 +11217,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s return SG_RESOURCESTATE_FAILED; } - /* depth-stencil-state */ + // depth-stencil-state MTLDepthStencilDescriptor* ds_desc = [[MTLDepthStencilDescriptor alloc] init]; ds_desc.depthCompareFunction = _sg_mtl_compare_func(desc->depth.compare); ds_desc.depthWriteEnabled = desc->depth.write_enabled; @@ -11562,7 +11580,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_pipeline(_sg_pipeline_t* pip) { } SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); - if ((_sg.mtl.state_cache.cur_pipeline != pip) || (_sg.mtl.state_cache.cur_pipeline_id.id != pip->slot.id)) { + if (_sg.mtl.state_cache.cur_pipeline_id.id != pip->slot.id) { _sg.mtl.state_cache.cur_pipeline = pip; _sg.mtl.state_cache.cur_pipeline_id.id = pip->slot.id; sg_color c = pip->cmn.blend_color; @@ -11583,7 +11601,9 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { _SOKOL_UNUSED(pip); SOKOL_ASSERT(_sg.mtl.in_pass); @@ -11604,12 +11624,10 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } // apply vertex buffers - NSUInteger slot; - for (slot = 0; slot < (NSUInteger)num_vbs; slot++) { + for (NSUInteger slot = 0; slot < (NSUInteger)num_vbs; slot++) { const _sg_buffer_t* vb = vbs[slot]; - if ((_sg.mtl.state_cache.cur_vertexbuffers[slot] != vb) || - (_sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] != vb_offsets[slot]) || - (_sg.mtl.state_cache.cur_vertexbuffer_ids[slot].id != vb->slot.id)) + if ((_sg.mtl.state_cache.cur_vertexbuffer_ids[slot].id != vb->slot.id) || + (_sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] != vb_offsets[slot])) { _sg.mtl.state_cache.cur_vertexbuffers[slot] = vb; _sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] = vb_offsets[slot]; @@ -11623,9 +11641,9 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } // apply vertex shader images - for (slot = 0; slot < (NSUInteger)num_vs_imgs; slot++) { + for (NSUInteger slot = 0; slot < (NSUInteger)num_vs_imgs; slot++) { const _sg_image_t* img = vs_imgs[slot]; - if ((_sg.mtl.state_cache.cur_vs_images[slot] != img) || (_sg.mtl.state_cache.cur_vs_image_ids[slot].id != img->slot.id)) { + if (_sg.mtl.state_cache.cur_vs_image_ids[slot].id != img->slot.id) { _sg.mtl.state_cache.cur_vs_images[slot] = img; _sg.mtl.state_cache.cur_vs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); @@ -11633,17 +11651,10 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } } - // apply vertex shader samplers - // FIXME! - /* - SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); - [_sg.mtl.cmd_encoder setVertexSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; - */ - // apply fragment shader images - for (slot = 0; slot < (NSUInteger)num_fs_imgs; slot++) { + for (NSUInteger slot = 0; slot < (NSUInteger)num_fs_imgs; slot++) { const _sg_image_t* img = fs_imgs[slot]; - if ((_sg.mtl.state_cache.cur_fs_images[slot] != img) || (_sg.mtl.state_cache.cur_fs_image_ids[slot].id != img->slot.id)) { + if (_sg.mtl.state_cache.cur_fs_image_ids[slot].id != img->slot.id) { _sg.mtl.state_cache.cur_fs_images[slot] = img; _sg.mtl.state_cache.cur_fs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); @@ -11651,12 +11662,27 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( } } - // apply fragme shader samplers - // FIXME! - /* - SOKOL_ASSERT(img->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); - [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(img->mtl.sampler_state) atIndex:slot]; - */ + // apply vertex shader samplers + for (NSUInteger slot = 0; slot < (NSUInteger)num_vs_smps; slot++) { + const _sg_sampler_t* smp = vs_smps[slot]; + if (_sg.mtl.state_cache.cur_vs_sampler_ids[slot].id != smp->slot.id) { + _sg.mtl.state_cache.cur_vs_samplers[slot] = smp; + _sg.mtl.state_cache.cur_vs_sampler_ids[slot].id = smp->slot.id; + SOKOL_ASSERT(smp->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); + [_sg.mtl.cmd_encoder setVertexSamplerState:_sg_mtl_id(smp->mtl.sampler_state) atIndex:slot]; + } + } + + // apply fragment shader samplers + for (NSUInteger slot = 0; slot < (NSUInteger)num_fs_smps; slot++) { + const _sg_sampler_t* smp = fs_smps[slot]; + if (_sg.mtl.state_cache.cur_fs_sampler_ids[slot].id != smp->slot.id) { + _sg.mtl.state_cache.cur_fs_samplers[slot] = smp; + _sg.mtl.state_cache.cur_fs_sampler_ids[slot].id = smp->slot.id; + SOKOL_ASSERT(smp->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); + [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(smp->mtl.sampler_state) atIndex:slot]; + } + } } _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -13887,18 +13913,20 @@ static inline void _sg_apply_bindings( _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { #if defined(_SOKOL_ANY_GL) - _sg_gl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_gl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_METAL) - _sg_mtl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_mtl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_D3D11) - _sg_d3d11_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_d3d11_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_WGPU) - _sg_wgpu_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_wgpu_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_DUMMY_BACKEND) - _sg_dummy_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_dummy_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #else #error("INVALID BACKEND"); #endif @@ -14578,19 +14606,19 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { _SG_VALIDATE(0 != desc->attrs[0].sem_name, VALIDATE_SHADERDESC_ATTR_SEMANTICS); #endif #if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) - /* on GL, must provide shader source code */ + // on GL, must provide shader source code _SG_VALIDATE(0 != desc->vs.source, VALIDATE_SHADERDESC_SOURCE); _SG_VALIDATE(0 != desc->fs.source, VALIDATE_SHADERDESC_SOURCE); #elif defined(SOKOL_METAL) || defined(SOKOL_D3D11) - /* on Metal or D3D11, must provide shader source code or byte code */ + // on Metal or D3D11, must provide shader source code or byte code _SG_VALIDATE((0 != desc->vs.source)||(0 != desc->vs.bytecode.ptr), VALIDATE_SHADERDESC_SOURCE_OR_BYTECODE); _SG_VALIDATE((0 != desc->fs.source)||(0 != desc->fs.bytecode.ptr), VALIDATE_SHADERDESC_SOURCE_OR_BYTECODE); #elif defined(SOKOL_WGPU) - /* on WGPU byte code must be provided */ + // on WGPU byte code must be provided _SG_VALIDATE((0 != desc->vs.bytecode.ptr), VALIDATE_SHADERDESC_BYTECODE); _SG_VALIDATE((0 != desc->fs.bytecode.ptr), VALIDATE_SHADERDESC_BYTECODE); #else - /* Dummy Backend, don't require source or bytecode */ + // Dummy Backend, don't require source or bytecode #endif for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { if (desc->attrs[i].name) { @@ -14600,7 +14628,7 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { _SG_VALIDATE(strlen(desc->attrs[i].sem_name) < _SG_STRING_SIZE, VALIDATE_SHADERDESC_ATTR_STRING_TOO_LONG); } } - /* if shader byte code, the size must also be provided */ + // if shader byte code, the size must also be provided if (0 != desc->vs.bytecode.ptr) { _SG_VALIDATE(desc->vs.bytecode.size > 0, VALIDATE_SHADERDESC_NO_BYTECODE_SIZE); } @@ -14638,8 +14666,7 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { _SG_VALIDATE((u_desc->type == SG_UNIFORMTYPE_FLOAT4) || (u_desc->type == SG_UNIFORMTYPE_INT4) || (u_desc->type == SG_UNIFORMTYPE_MAT4), VALIDATE_SHADERDESC_UB_STD140_ARRAY_TYPE); } } - } - else { + } else { uniforms_continuous = false; } } @@ -14649,8 +14676,7 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { _SG_VALIDATE((size_t)uniform_offset == ub_desc->size, VALIDATE_SHADERDESC_UB_SIZE_MISMATCH); _SG_VALIDATE(num_uniforms > 0, VALIDATE_SHADERDESC_NO_UB_MEMBERS); #endif - } - else { + } else { uniform_blocks_continuous = false; } } @@ -14659,11 +14685,19 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; if (img_desc->image_type != _SG_IMAGETYPE_DEFAULT) { _SG_VALIDATE(images_continuous, VALIDATE_SHADERDESC_NO_CONT_IMGS); - } - else { + } else { images_continuous = false; } } + bool samplers_continuous = true; + for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { + const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; + if (smp_desc->type != _SG_SAMPLERTYPE_DEFAULT) { + _SG_VALIDATE(samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_SMPS); + } else { + samplers_continuous = false; + } + } } return _sg_validate_end(); #endif @@ -14704,7 +14738,7 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { _SG_VALIDATE(attrs_cont, VALIDATE_PIPELINEDESC_NO_ATTRS); SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); #if defined(SOKOL_D3D11) - /* on D3D11, semantic names (and semantic indices) must be provided */ + // on D3D11, semantic names (and semantic indices) must be provided _SG_VALIDATE(!_sg_strempty(&shd->d3d11.attrs[attr_index].sem_name), VALIDATE_PIPELINEDESC_ATTR_SEMANTICS); #endif } @@ -14744,19 +14778,16 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->mip_level < img->cmn.num_mipmaps, VALIDATE_PASSDESC_MIPLEVEL); if (img->cmn.type == SG_IMAGETYPE_CUBE) { _SG_VALIDATE(att->slice < 6, VALIDATE_PASSDESC_FACE); - } - else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { + } else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_LAYER); - } - else if (img->cmn.type == SG_IMAGETYPE_3D) { + } else if (img->cmn.type == SG_IMAGETYPE_3D) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_SLICE); } if (att_index == 0) { width = img->cmn.width >> att->mip_level; height = img->cmn.height >> att->mip_level; sample_count = img->cmn.sample_count; - } - else { + } else { _SG_VALIDATE(width == img->cmn.width >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); _SG_VALIDATE(height == img->cmn.height >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); _SG_VALIDATE(sample_count == img->cmn.sample_count, VALIDATE_PASSDESC_IMAGE_SAMPLE_COUNTS); @@ -14777,11 +14808,9 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(res_att->mip_level < res_img->cmn.num_mipmaps, VALIDATE_PASSDESC_RESOLVE_MIPLEVEL); if (res_img->cmn.type == SG_IMAGETYPE_CUBE) { _SG_VALIDATE(res_att->slice < 6, VALIDATE_PASSDESC_RESOLVE_FACE); - } - else if (res_img->cmn.type == SG_IMAGETYPE_ARRAY) { + } else if (res_img->cmn.type == SG_IMAGETYPE_ARRAY) { _SG_VALIDATE(res_att->slice < res_img->cmn.num_slices, VALIDATE_PASSDESC_RESOLVE_LAYER); - } - else if (res_img->cmn.type == SG_IMAGETYPE_3D) { + } else if (res_img->cmn.type == SG_IMAGETYPE_3D) { _SG_VALIDATE(res_att->slice < res_img->cmn.num_slices, VALIDATE_PASSDESC_RESOLVE_SLICE); } _SG_VALIDATE(img->cmn.pixel_format == res_img->cmn.pixel_format, VALIDATE_PASSDESC_RESOLVE_IMAGE_FORMAT); @@ -14800,11 +14829,9 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->mip_level < img->cmn.num_mipmaps, VALIDATE_PASSDESC_DEPTH_MIPLEVEL); if (img->cmn.type == SG_IMAGETYPE_CUBE) { _SG_VALIDATE(att->slice < 6, VALIDATE_PASSDESC_DEPTH_FACE); - } - else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { + } else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_DEPTH_LAYER); - } - else if (img->cmn.type == SG_IMAGETYPE_3D) { + } else if (img->cmn.type == SG_IMAGETYPE_3D) { // NOTE: this can't actually happen because of VALIDATE_IMAGEDESC_DEPTH_3D_IMAGE _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_DEPTH_SLICE); } @@ -14863,7 +14890,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_pipeline(sg_pipeline pip_id) { return true; } _sg_validate_begin(); - /* the pipeline object must be alive and valid */ + // the pipeline object must be alive and valid _SG_VALIDATE(pip_id.id != SG_INVALID_ID, VALIDATE_APIP_PIPELINE_VALID_ID); const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); _SG_VALIDATE(pip != 0, VALIDATE_APIP_PIPELINE_EXISTS); @@ -14871,14 +14898,14 @@ _SOKOL_PRIVATE bool _sg_validate_apply_pipeline(sg_pipeline pip_id) { return _sg_validate_end(); } _SG_VALIDATE(pip->slot.state == SG_RESOURCESTATE_VALID, VALIDATE_APIP_PIPELINE_VALID); - /* the pipeline's shader must be alive and valid */ + // the pipeline's shader must be alive and valid SOKOL_ASSERT(pip->shader); _SG_VALIDATE(pip->shader->slot.id == pip->cmn.shader_id.id, VALIDATE_APIP_SHADER_EXISTS); _SG_VALIDATE(pip->shader->slot.state == SG_RESOURCESTATE_VALID, VALIDATE_APIP_SHADER_VALID); - /* check that pipeline attributes match current pass attributes */ + // check that pipeline attributes match current pass attributes const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, _sg.cur_pass.id); if (pass) { - /* an offscreen pass */ + // an offscreen pass _SG_VALIDATE(pip->cmn.color_count == pass->cmn.num_color_atts, VALIDATE_APIP_ATT_COUNT); for (int i = 0; i < pip->cmn.color_count; i++) { const _sg_image_t* att_img = _sg_pass_color_image(pass, i); @@ -14888,13 +14915,11 @@ _SOKOL_PRIVATE bool _sg_validate_apply_pipeline(sg_pipeline pip_id) { const _sg_image_t* att_dsimg = _sg_pass_ds_image(pass); if (att_dsimg) { _SG_VALIDATE(pip->cmn.depth.pixel_format == att_dsimg->cmn.pixel_format, VALIDATE_APIP_DEPTH_FORMAT); - } - else { + } else { _SG_VALIDATE(pip->cmn.depth.pixel_format == SG_PIXELFORMAT_NONE, VALIDATE_APIP_DEPTH_FORMAT); } - } - else { - /* default pass */ + } else { + // default pass _SG_VALIDATE(pip->cmn.color_count == 1, VALIDATE_APIP_ATT_COUNT); _SG_VALIDATE(pip->cmn.colors[0].pixel_format == _sg.desc.context.color_format, VALIDATE_APIP_COLOR_FORMAT); _SG_VALIDATE(pip->cmn.depth.pixel_format == _sg.desc.context.depth_format, VALIDATE_APIP_DEPTH_FORMAT); @@ -14961,7 +14986,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; if (bindings->vs.images[i].id != SG_INVALID_ID) { _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_VS_IMGS); const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); @@ -14976,9 +15001,21 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { } } + // has expected vertex shader image samplers + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; + if (bindings->vs.samplers[i].id != SG_INVALID_ID) { + _SG_VALIDATE(i < stage->num_samplers, VALIDATE_ABND_VS_SMPS); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); + _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); + } else { + _SG_VALIDATE(i >= stage->num_samplers, VALIDATE_ABND_VS_SMPS); + } + } + // has expected fragment shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; if (bindings->fs.images[i].id != SG_INVALID_ID) { _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_FS_IMGS); const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); @@ -14992,6 +15029,19 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { _SG_VALIDATE(i >= stage->num_images, VALIDATE_ABND_FS_IMGS); } } + + // has expected fragment shader samplers + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; + if (bindings->fs.samplers[i].id != SG_INVALID_ID) { + _SG_VALIDATE(i < stage->num_samplers, VALIDATE_ABND_FS_SMPS); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); + _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); + } else { + _SG_VALIDATE(i >= stage->num_samplers, VALIDATE_ABND_FS_SMPS); + } + } + return _sg_validate_end(); #endif } @@ -16521,10 +16571,35 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { break; } } + + _sg_sampler_t* vs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = { 0 }; + int num_vs_smps = 0; + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, num_vs_smps++) { + if (bindings->vs.samplers[i].id) { + vs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); + SOKOL_ASSERT(vs_smps[i]); + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vs_smps[i]->slot.state); + } else { + break; + } + } + + _sg_sampler_t* fs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = { 0 }; + int num_fs_smps = 0; + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, num_fs_smps++) { + if (bindings->fs.samplers[i].id) { + fs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); + SOKOL_ASSERT(fs_smps[i]); + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == fs_smps[i]->slot.state); + } else { + break; + } + } + if (_sg.next_draw_valid) { const int* vb_offsets = bindings->vertex_buffer_offsets; int ib_offset = bindings->index_buffer_offset; - _sg_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs); + _sg_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); _SG_TRACE_ARGS(apply_bindings, bindings); } else { _SG_TRACE_NOARGS(err_draw_invalid); From 1d9209c7f15cdd01966c32e95a791717ea62a024 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 2 Jun 2023 19:33:39 +0200 Subject: [PATCH 009/292] sokol_gfx.h: code formatting, fix sampler common attributes init --- sokol_gfx.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 034b5050d..aee747810 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2455,7 +2455,7 @@ typedef struct sg_shader_sampler_desc { } sg_shader_sampler_desc; typedef struct sg_shader_combined_image_sampler_desc { - const char* name; // optional GLSL location + const char* name; // required for GLSL } sg_shader_combined_image_sampler_desc; typedef struct sg_shader_stage_desc { @@ -4051,6 +4051,7 @@ typedef struct { _SOKOL_PRIVATE void _sg_sampler_common_init(_sg_sampler_common_t* cmn, const sg_sampler_desc* desc) { cmn->min_filter = desc->min_filter; cmn->mag_filter = desc->mag_filter; + cmn->mipmap_filter = desc->mipmap_filter; cmn->wrap_u = desc->wrap_u; cmn->wrap_v = desc->wrap_v; cmn->wrap_w = desc->wrap_w; @@ -10793,13 +10794,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_buffer(_sg_buffer_t* buf, const if (injected) { SOKOL_ASSERT(desc->mtl_buffers[slot]); mtl_buf = (__bridge id) desc->mtl_buffers[slot]; - } - else { + } else { if (buf->cmn.usage == SG_USAGE_IMMUTABLE) { SOKOL_ASSERT(desc->data.ptr); mtl_buf = [_sg.mtl.device newBufferWithBytes:desc->data.ptr length:(NSUInteger)buf->cmn.size options:mtl_options]; - } - else { + } else { mtl_buf = [_sg.mtl.device newBufferWithLength:(NSUInteger)buf->cmn.size options:mtl_options]; } } @@ -14070,8 +14069,7 @@ _SOKOL_PRIVATE int _sg_pool_alloc_index(_sg_pool_t* pool) { int slot_index = pool->free_queue[--pool->queue_top]; SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); return slot_index; - } - else { + } else { // pool exhausted return _SG_INVALID_SLOT_INDEX; } @@ -14469,8 +14467,7 @@ _SOKOL_PRIVATE bool _sg_validate_buffer_desc(const sg_buffer_desc* desc) { if (!injected && (desc->usage == SG_USAGE_IMMUTABLE)) { _SG_VALIDATE((0 != desc->data.ptr) && (desc->data.size > 0), VALIDATE_BUFFERDESC_DATA); _SG_VALIDATE(desc->size == desc->data.size, VALIDATE_BUFFERDESC_DATA_SIZE); - } - else { + } else { _SG_VALIDATE(0 == desc->data.ptr, VALIDATE_BUFFERDESC_NO_DATA); } return _sg_validate_end(); @@ -15149,8 +15146,7 @@ _SOKOL_PRIVATE sg_buffer_desc _sg_buffer_desc_defaults(const sg_buffer_desc* des def.usage = _sg_def(def.usage, SG_USAGE_IMMUTABLE); if (def.size == 0) { def.size = def.data.size; - } - else if (def.data.size == 0) { + } else if (def.data.size == 0) { def.data.size = def.size; } return def; @@ -15165,8 +15161,7 @@ _SOKOL_PRIVATE sg_image_desc _sg_image_desc_defaults(const sg_image_desc* desc) if (desc->render_target) { def.pixel_format = _sg_def(def.pixel_format, _sg.desc.context.color_format); def.sample_count = _sg_def(def.sample_count, _sg.desc.context.sample_count); - } - else { + } else { def.pixel_format = _sg_def(def.pixel_format, SG_PIXELFORMAT_RGBA8); def.sample_count = _sg_def(def.sample_count, 1); } From ff90b5f173067c73ca0b303baea0877c6884430a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 2 Jun 2023 19:56:27 +0200 Subject: [PATCH 010/292] sokol_gfx.h: code formatting --- sokol_gfx.h | 150 ++++++++++++++++------------------------------------ 1 file changed, 45 insertions(+), 105 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index aee747810..1e8db1b49 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4921,8 +4921,7 @@ static void _sg_log(sg_log_item log_item, uint32_t log_level, const char* msg, u } #endif _sg.desc.logger.func("sg", log_level, log_item, msg, line_nr, filename, _sg.desc.logger.user_data); - } - else { + } else { // for log level PANIC it would be 'undefined behaviour' to continue if (log_level == 0) { abort(); @@ -4959,8 +4958,7 @@ _SOKOL_PRIVATE void* _sg_malloc(size_t size) { void* ptr; if (_sg.desc.allocator.alloc) { ptr = _sg.desc.allocator.alloc(size, _sg.desc.allocator.user_data); - } - else { + } else { ptr = malloc(size); } if (0 == ptr) { @@ -4978,8 +4976,7 @@ _SOKOL_PRIVATE void* _sg_malloc_clear(size_t size) { _SOKOL_PRIVATE void _sg_free(void* ptr) { if (_sg.desc.allocator.free) { _sg.desc.allocator.free(ptr, _sg.desc.allocator.user_data); - } - else { + } else { free(ptr); } } @@ -5001,8 +4998,7 @@ _SOKOL_PRIVATE void _sg_strcpy(_sg_str_t* dst, const char* src) { strncpy(dst->buf, src, _SG_STRING_SIZE); #endif dst->buf[_SG_STRING_SIZE-1] = 0; - } - else { + } else { _sg_clear(dst->buf, _SG_STRING_SIZE); } } @@ -5049,8 +5045,7 @@ _SOKOL_PRIVATE int _sg_vertexformat_bytesize(sg_vertex_format fmt) { _SOKOL_PRIVATE uint32_t _sg_uniform_alignment(sg_uniform_type type, int array_count, sg_uniform_layout ub_layout) { if (ub_layout == SG_UNIFORMLAYOUT_NATIVE) { return 1; - } - else { + } else { SOKOL_ASSERT(array_count > 0); if (array_count == 1) { switch (type) { @@ -5071,8 +5066,7 @@ _SOKOL_PRIVATE uint32_t _sg_uniform_alignment(sg_uniform_type type, int array_co SOKOL_UNREACHABLE; return 1; } - } - else { + } else { return 16; } } @@ -5100,8 +5094,7 @@ _SOKOL_PRIVATE uint32_t _sg_uniform_size(sg_uniform_type type, int array_count, SOKOL_UNREACHABLE; return 0; } - } - else { + } else { if (ub_layout == SG_UNIFORMLAYOUT_NATIVE) { switch (type) { case SG_UNIFORMTYPE_FLOAT: @@ -5122,8 +5115,7 @@ _SOKOL_PRIVATE uint32_t _sg_uniform_size(sg_uniform_type type, int array_count, SOKOL_UNREACHABLE; return 0; } - } - else { + } else { switch (type) { case SG_UNIFORMTYPE_FLOAT: case SG_UNIFORMTYPE_FLOAT2: @@ -7239,8 +7231,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s cur_uniform_offset += u_size; if (u_desc->name) { u->gl_loc = glGetUniformLocation(gl_prog, u_desc->name); - } - else { + } else { u->gl_loc = u_index; } ub->num_uniforms++; @@ -7351,8 +7342,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg gl_attr->type = _sg_gl_vertexformat_type(a_desc->format); gl_attr->normalized = _sg_gl_vertexformat_normalized(a_desc->format); pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; - } - else { + } else { _SG_ERROR(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER); _SG_LOGMSG(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, _sg_strptr(&shd->gl.attrs[attr_index].name)); } @@ -8688,8 +8678,7 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_index_format(sg_index_type index_type) { _SOKOL_PRIVATE D3D11_FILTER _sg_d3d11_filter(sg_filter min_f, sg_filter mag_f, uint32_t max_anisotropy) { if (max_anisotropy > 1) { return D3D11_FILTER_ANISOTROPIC; - } - else if (mag_f == SG_FILTER_NEAREST) { + } else if (mag_f == SG_FILTER_NEAREST) { switch (min_f) { case SG_FILTER_NEAREST: case SG_FILTER_NEAREST_MIPMAP_NEAREST: @@ -8704,8 +8693,7 @@ _SOKOL_PRIVATE D3D11_FILTER _sg_d3d11_filter(sg_filter min_f, sg_filter mag_f, u default: SOKOL_UNREACHABLE; break; } - } - else if (mag_f == SG_FILTER_LINEAR) { + } else if (mag_f == SG_FILTER_LINEAR) { switch (min_f) { case SG_FILTER_NEAREST: case SG_FILTER_NEAREST_MIPMAP_NEAREST: @@ -8949,8 +8937,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_buffer(_sg_buffer_t* buf, cons if (injected) { buf->d3d11.buf = (ID3D11Buffer*) desc->d3d11_buffer; _sg_d3d11_AddRef(buf->d3d11.buf); - } - else { + } else { D3D11_BUFFER_DESC d3d11_desc; _sg_clear(&d3d11_desc, sizeof(d3d11_desc)); d3d11_desc.ByteWidth = (UINT)buf->cmn.size; @@ -9001,8 +8988,7 @@ _SOKOL_PRIVATE void _sg_d3d11_fill_subres_data(const _sg_image_t* img, const sg_ if (img->cmn.type == SG_IMAGETYPE_3D) { /* FIXME? const int mip_depth = ((img->depth>>mip_index)>0) ? img->depth>>mip_index : 1; */ subres_data->SysMemSlicePitch = (UINT)_sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, 1); - } - else { + } else { subres_data->SysMemSlicePitch = 0; } } @@ -9152,8 +9138,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const d3d11_tex_desc.Usage = D3D11_USAGE_DEFAULT; d3d11_tex_desc.BindFlags = D3D11_BIND_RENDER_TARGET; d3d11_tex_desc.CPUAccessFlags = 0; - } - else { + } else { d3d11_tex_desc.Usage = _sg_d3d11_usage(img->cmn.usage); d3d11_tex_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; d3d11_tex_desc.CPUAccessFlags = _sg_d3d11_cpu_access_flags(img->cmn.usage); @@ -9350,8 +9335,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_shader(_sg_shader_t* shd, cons fs_ptr = desc->fs.bytecode.ptr; vs_length = desc->vs.bytecode.size; fs_length = desc->fs.bytecode.size; - } - else { + } else { /* compile from shader source code */ vs_blob = _sg_d3d11_compile_shader(&desc->vs); fs_blob = _sg_d3d11_compile_shader(&desc->fs); @@ -9455,8 +9439,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; SOKOL_ASSERT(l_desc->stride > 0); pip->d3d11.vb_strides[layout_index] = (UINT)l_desc->stride; - } - else { + } else { pip->d3d11.vb_strides[layout_index] = 0; } } @@ -9960,16 +9943,13 @@ _SOKOL_PRIVATE void _sg_d3d11_draw(int base_element, int num_elements, int num_i if (_sg.d3d11.use_indexed_draw) { if (_sg.d3d11.use_instanced_draw) { _sg_d3d11_DrawIndexedInstanced(_sg.d3d11.ctx, (UINT)num_elements, (UINT)num_instances, (UINT)base_element, 0, 0); - } - else { + } else { _sg_d3d11_DrawIndexed(_sg.d3d11.ctx, (UINT)num_elements, (UINT)base_element, 0); } - } - else { + } else { if (_sg.d3d11.use_instanced_draw) { _sg_d3d11_DrawInstanced(_sg.d3d11.ctx, (UINT)num_elements, (UINT)num_instances, (UINT)base_element, 0); - } - else { + } else { _sg_d3d11_Draw(_sg.d3d11.ctx, (UINT)num_elements, (UINT)base_element); } } @@ -9988,8 +9968,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* d if (SUCCEEDED(hr)) { memcpy(d3d11_msr.pData, data->ptr, data->size); _sg_d3d11_Unmap(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0); - } - else { + } else { _SG_ERROR(D3D11_MAP_FOR_UPDATE_BUFFER_FAILED); } } @@ -10005,8 +9984,7 @@ _SOKOL_PRIVATE int _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* da uint8_t* dst_ptr = (uint8_t*)d3d11_msr.pData + buf->cmn.append_pos; memcpy(dst_ptr, data->ptr, data->size); _sg_d3d11_Unmap(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0); - } - else { + } else { _SG_ERROR(D3D11_MAP_FOR_APPEND_BUFFER_FAILED); } /* NOTE: this alignment is a requirement from WebGPU, but we want identical behaviour across all backend */ @@ -10038,8 +10016,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data /* FIXME: need to handle difference in depth-pitch for 3D textures as well! */ if (src_pitch == (int)d3d11_msr.RowPitch) { memcpy(d3d11_msr.pData, slice_ptr, slice_size); - } - else { + } else { SOKOL_ASSERT(src_pitch < (int)d3d11_msr.RowPitch); const uint8_t* src_ptr = slice_ptr; uint8_t* dst_ptr = (uint8_t*) d3d11_msr.pData; @@ -10050,8 +10027,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data } } _sg_d3d11_Unmap(_sg.d3d11.ctx, img->d3d11.res, subres_index); - } - else { + } else { _SG_ERROR(D3D11_MAP_FOR_UPDATE_IMAGE_FAILED); } } @@ -10845,8 +10821,7 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr bytes_per_image = bytes_per_slice; /* FIXME: apparently the minimal bytes_per_image size for 3D texture is 4 KByte... somehow need to handle this */ - } - else { + } else { region = MTLRegionMake2D(0, 0, (NSUInteger)mip_width, (NSUInteger)mip_height); bytes_per_image = 0; } @@ -10866,21 +10841,6 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr } } -/* - FIXME: METAL RESOURCE STORAGE MODE FOR macOS AND iOS - - For immutable textures on macOS, the recommended procedure is to create - a MTLStorageModeManaged texture with the immutable content first, - and then use the GPU to blit the content into a MTLStorageModePrivate - texture before the first use. - - On iOS use the same one-time-blit procedure, but from a - MTLStorageModeShared to a MTLStorageModePrivate texture. - - It probably makes sense to handle this in a separate 'resource manager' - with a recycable pool of blit-source-textures? -*/ - // initialize MTLTextureDescritor with common attributes _SOKOL_PRIVATE bool _sg_mtl_init_texdesc_common(MTLTextureDescriptor* mtl_desc, _sg_image_t* img) { mtl_desc.textureType = _sg_mtl_texture_type(img->cmn.type); @@ -11503,8 +11463,7 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { id cur_drawable = nil; if (_sg.mtl.drawable_cb) { cur_drawable = (__bridge id) _sg.mtl.drawable_cb(); - } - else { + } else { cur_drawable = (__bridge id) _sg.mtl.drawable_userdata_cb(_sg.mtl.user_data); } if (nil != cur_drawable) { @@ -11703,8 +11662,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_i memcpy(dst, data->ptr, data->size); if (stage_index == SG_SHADERSTAGE_VS) { [_sg.mtl.cmd_encoder setVertexBufferOffset:(NSUInteger)_sg.mtl.cur_ub_offset atIndex:(NSUInteger)ub_index]; - } - else { + } else { [_sg.mtl.cmd_encoder setFragmentBufferOffset:(NSUInteger)_sg.mtl.cur_ub_offset atIndex:(NSUInteger)ub_index]; } _sg.mtl.cur_ub_offset = _sg_roundup(_sg.mtl.cur_ub_offset + (int)data->size, _SG_MTL_UB_ALIGN); @@ -11729,8 +11687,7 @@ _SOKOL_PRIVATE void _sg_mtl_draw(int base_element, int num_elements, int num_ins indexBuffer:_sg_mtl_id(ib->mtl.buf[ib->cmn.active_slot]) indexBufferOffset:index_buffer_offset instanceCount:(NSUInteger)num_instances]; - } - else { + } else { /* non-indexed rendering */ [_sg.mtl.cmd_encoder drawPrimitives:_sg.mtl.state_cache.cur_pipeline->mtl.prim_type vertexStart:(NSUInteger)base_element @@ -11792,8 +11749,7 @@ _SOKOL_PRIVATE WGPUBufferUsageFlags _sg_wgpu_buffer_usage(sg_buffer_type t, sg_u WGPUBufferUsageFlags res = 0; if (SG_BUFFERTYPE_VERTEXBUFFER == t) { res |= WGPUBufferUsage_Vertex; - } - else { + } else { res |= WGPUBufferUsage_Index; } if (SG_USAGE_IMMUTABLE != u) { @@ -11838,8 +11794,7 @@ _SOKOL_PRIVATE WGPUTextureComponentType _sg_wgpu_tex_comptype(sg_image_sample_ty _SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_tex_dim(sg_image_type t) { if (SG_IMAGETYPE_3D == t) { return WGPUTextureDimension_3D; - } - else { + } else { return WGPUTextureDimension_2D; } } @@ -12399,8 +12354,7 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st /* can do a single memcpy */ uint32_t num_bytes = data->subimage[face_index][mip_index].size; memcpy(dst_base_ptr, src_base_ptr, num_bytes); - } - else { + } else { /* src/dst pitch doesn't match, need to copy row by row */ uint8_t* dst_ptr = dst_base_ptr; const uint8_t* src_ptr = src_base_ptr; @@ -12693,8 +12647,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const if (injected) { buf->wgpu.buf = (WGPUBuffer) desc->wgpu_buffer; wgpuBufferReference(buf->wgpu.buf); - } - else { + } else { WGPUBufferDescriptor wgpu_buf_desc; _sg_clear(&wgpu_buf_desc, sizeof(wgpu_buf_desc)); wgpu_buf_desc.usage = _sg_wgpu_buffer_usage(buf->cmn.type, buf->cmn.usage); @@ -12706,8 +12659,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const SOKOL_ASSERT(res.data && (res.dataLength == buf->cmn.size)); memcpy(res.data, desc->data.ptr, buf->cmn.size); wgpuBufferUnmap(res.buffer); - } - else { + } else { buf->wgpu.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &wgpu_buf_desc); } } @@ -12730,12 +12682,10 @@ _SOKOL_PRIVATE void _sg_wgpu_init_texdesc_common(WGPUTextureDescriptor* wgpu_tex if (desc->type == SG_IMAGETYPE_3D) { wgpu_tex_desc->size.depth = desc->num_slices; wgpu_tex_desc->arrayLayerCount = 1; - } - else if (desc->type == SG_IMAGETYPE_CUBE) { + } else if (desc->type == SG_IMAGETYPE_CUBE) { wgpu_tex_desc->size.depth = 1; wgpu_tex_desc->arrayLayerCount = 6; - } - else { + } else { wgpu_tex_desc->size.depth = 1; wgpu_tex_desc->arrayLayerCount = desc->num_slices; } @@ -12768,13 +12718,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s wgpu_tex_desc.sampleCount = desc->sample_count; img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); SOKOL_ASSERT(img->wgpu.tex); - } - else { + } else { if (injected) { img->wgpu.tex = (WGPUTexture) desc->wgpu_texture; wgpuTextureReference(img->wgpu.tex); - } - else { + } else { /* NOTE: in the MSAA-rendertarget case, both the MSAA texture *and* the resolve texture need OutputAttachment usage */ @@ -13216,8 +13164,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att_desc; _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &wgpu_pass_desc); } - } - else { + } else { /* default render pass */ WGPUTextureView wgpu_render_view = _sg.wgpu.render_view_cb ? _sg.wgpu.render_view_cb() : _sg.wgpu.render_view_userdata_cb(_sg.wgpu.user_data); WGPUTextureView wgpu_resolve_view = _sg.wgpu.resolve_view_cb ? _sg.wgpu.resolve_view_cb() : _sg.wgpu.resolve_view_userdata_cb(_sg.wgpu.user_data); @@ -13408,8 +13355,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( WGPUBindGroup vs_img_bg = _sg_wgpu_create_images_bindgroup(vs_bgl, vs_imgs, num_vs_imgs); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 1, vs_img_bg, 0, 0); wgpuBindGroupRelease(vs_img_bg); - } - else { + } else { wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 1, _sg.wgpu.empty_bind_group, 0, 0); } if (num_fs_imgs > 0) { @@ -13421,8 +13367,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( WGPUBindGroup fs_img_bg = _sg_wgpu_create_images_bindgroup(fs_bgl, fs_imgs, num_fs_imgs); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 2, fs_img_bg, 0, 0); wgpuBindGroupRelease(fs_img_bg); - } - else { + } else { wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 2, _sg.wgpu.empty_bind_group, 0, 0); } } @@ -13456,8 +13401,7 @@ _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_in SOKOL_ASSERT(_sg.wgpu.pass_enc); if (_sg.wgpu.draw_indexed) { wgpuRenderPassEncoderDrawIndexed(_sg.wgpu.pass_enc, num_elements, num_instances, base_element, 0, 0); - } - else { + } else { wgpuRenderPassEncoderDraw(_sg.wgpu.pass_enc, num_elements, num_instances, base_element, 0); } } @@ -14440,8 +14384,7 @@ _SOKOL_PRIVATE bool _sg_validate_end(void) { #else return false; #endif - } - else { + } else { return true; } } @@ -15781,8 +15724,7 @@ SOKOL_API_IMPL sg_context sg_setup_context(void) { ctx->slot.state = _sg_create_context(ctx); SOKOL_ASSERT(ctx->slot.state == SG_RESOURCESTATE_VALID); _sg_activate_context(ctx); - } - else { + } else { /* pool is exhausted */ res.id = SG_INVALID_ID; } @@ -17055,8 +16997,7 @@ SOKOL_API_IMPL const void* sg_mtl_device(void) { #if defined(SOKOL_METAL) if (nil != _sg.mtl.device) { return (__bridge const void*) _sg.mtl.device; - } - else { + } else { return 0; } #else @@ -17068,8 +17009,7 @@ SOKOL_API_IMPL const void* sg_mtl_render_command_encoder(void) { #if defined(SOKOL_METAL) if (nil != _sg.mtl.cmd_encoder) { return (__bridge const void*) _sg.mtl.cmd_encoder; - } - else { + } else { return 0; } #else From 3190950b27dcc75ec12bcbfe530dc04376c4033d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 3 Jun 2023 12:27:08 +0200 Subject: [PATCH 011/292] sokol_gfx.h metal: use StorageModeShared if MTLDevice.hasUnifiedMemory --- sokol_gfx.h | 69 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 1e8db1b49..257089171 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3257,6 +3257,7 @@ typedef struct sg_desc { int staging_buffer_size; int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests + bool mtl_force_managed_storage_mode; // for debugging: use Metal managed storage mode for resources even with UMA sg_allocator allocator; sg_logger logger; // optional log function override sg_context_desc context; @@ -3559,7 +3560,6 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define _SG_TARGET_IOS_SIMULATOR (1) #endif #endif - #define _SG_METAL_HAS_BORDER_COLOR ((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)) #import #elif defined(SOKOL_WGPU) #if defined(__EMSCRIPTEN__) @@ -4664,6 +4664,8 @@ typedef struct { typedef struct { bool valid; + bool has_unified_memory; + bool force_managed_storage_mode; const void*(*renderpass_descriptor_cb)(void); const void*(*renderpass_descriptor_userdata_cb)(void*); const void*(*drawable_cb)(void); @@ -10082,21 +10084,21 @@ _SOKOL_PRIVATE MTLStoreAction _sg_mtl_store_action(sg_store_action a, bool resol } } +_SOKOL_PRIVATE MTLResourceOptions _sg_mtl_resource_options_storage_mode_managed_or_shared(void) { + if (_sg.mtl.force_managed_storage_mode || !_sg.mtl.has_unified_memory) { + return MTLResourceStorageModeManaged; + } else { + return MTLResourceStorageModeShared; + } +} + _SOKOL_PRIVATE MTLResourceOptions _sg_mtl_buffer_resource_options(sg_usage usg) { switch (usg) { case SG_USAGE_IMMUTABLE: - #if defined(_SG_TARGET_MACOS) - return MTLResourceStorageModeManaged; - #else - return MTLResourceStorageModeShared; - #endif + return _sg_mtl_resource_options_storage_mode_managed_or_shared(); case SG_USAGE_DYNAMIC: case SG_USAGE_STREAM: - #if defined(_SG_TARGET_MACOS) - return MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModeManaged; - #else - return MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModeShared; - #endif + return MTLResourceCPUCacheModeWriteCombined | _sg_mtl_resource_options_storage_mode_managed_or_shared(); default: SOKOL_UNREACHABLE; return 0; @@ -10539,22 +10541,27 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { #endif #endif _sg.features.origin_top_left = true; - #if _SG_METAL_HAS_BORDER_COLOR - _sg.features.image_clamp_to_border = true; - #else - _sg.features.image_clamp_to_border = false; - #endif _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; #if defined(_SG_TARGET_MACOS) + if (@available(macOS 12.0, *)) { + _sg.features.image_clamp_to_border = true; + } else { + _sg.features.image_clamp_to_border = false; + } _sg.limits.max_image_size_2d = 16 * 1024; _sg.limits.max_image_size_cube = 16 * 1024; _sg.limits.max_image_size_3d = 2 * 1024; _sg.limits.max_image_size_array = 16 * 1024; _sg.limits.max_image_array_layers = 2 * 1024; #else - /* newer iOS devices support 16k textures */ + if (@available(iOS 14.0, *)) { + _sg.features.image_clamp_to_border = true; + } else { + _sg.features.image_clamp_to_border = false; + } + // FIXME: newer iOS devices support 16k textures _sg.limits.max_image_size_2d = 8 * 1024; _sg.limits.max_image_size_cube = 8 * 1024; _sg.limits.max_image_size_3d = 2 * 1024; @@ -10692,6 +10699,16 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModeShared ]; } + if (@available(macOS 10.15, *)) { + _sg.mtl.has_unified_memory = _sg.mtl.device.hasUnifiedMemory; + } else { + #if defined(_SG_TARGET_MACOS) + _sg.mtl.has_unified_memory = false; + #else + _sg.mtl.has_unified_memory = true; + #endif + } + _sg.mtl.force_managed_storage_mode = desc->mtl_force_managed_storage_mode; _sg_mtl_init_caps(); } @@ -10867,18 +10884,12 @@ _SOKOL_PRIVATE bool _sg_mtl_init_texdesc_common(MTLTextureDescriptor* mtl_desc, if (img->cmn.usage != SG_USAGE_IMMUTABLE) { res_options |= MTLResourceCPUCacheModeWriteCombined; } - #if defined(_SG_TARGET_MACOS) - // macOS: use managed textures - res_options |= MTLResourceStorageModeManaged; - #else - // iOS: use CPU/GPU shared memory - res_options |= MTLResourceStorageModeShared; - #endif + res_options |= _sg_mtl_resource_options_storage_mode_managed_or_shared(); mtl_desc.resourceOptions = res_options; return true; } -/* initialize MTLTextureDescritor with rendertarget attributes */ +// initialize MTLTextureDescritor with rendertarget attributes _SOKOL_PRIVATE void _sg_mtl_init_texdesc_rt(MTLTextureDescriptor* mtl_desc, _sg_image_t* img) { SOKOL_ASSERT(img->cmn.render_target); _SOKOL_UNUSED(img); @@ -10886,7 +10897,7 @@ _SOKOL_PRIVATE void _sg_mtl_init_texdesc_rt(MTLTextureDescriptor* mtl_desc, _sg_ mtl_desc.resourceOptions = MTLResourceStorageModePrivate; } -/* initialize MTLTextureDescritor with MSAA attributes */ +// initialize MTLTextureDescritor with MSAA attributes _SOKOL_PRIVATE void _sg_mtl_init_texdesc_rt_msaa(MTLTextureDescriptor* mtl_desc, _sg_image_t* img) { SOKOL_ASSERT(img->cmn.sample_count > 1); mtl_desc.usage = MTLTextureUsageRenderTarget; @@ -10957,9 +10968,9 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, cons mtl_desc.sAddressMode = _sg_mtl_address_mode(desc->wrap_u); mtl_desc.tAddressMode = _sg_mtl_address_mode(desc->wrap_v); mtl_desc.rAddressMode = _sg_mtl_address_mode(desc->wrap_w); - #if _SG_METAL_HAS_BORDER_COLOR - mtl_desc.borderColor = _sg_mtl_border_color(desc->border_color); - #endif + if (_sg.features.image_clamp_to_border) { + mtl_desc.borderColor = _sg_mtl_border_color(desc->border_color); + } mtl_desc.minFilter = _sg_mtl_minmag_filter(desc->min_filter); mtl_desc.magFilter = _sg_mtl_minmag_filter(desc->mag_filter); mtl_desc.mipFilter = _sg_mtl_mipmap_filter(desc->mipmap_filter); From e1f008e3ab0c1876cb1518d3dc66c771127e8ebb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 3 Jun 2023 16:39:25 +0200 Subject: [PATCH 012/292] sokol_gfx.h metal: set buffer mutability flag in pso --- sokol_gfx.h | 54 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 257089171..25ec848c1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4124,7 +4124,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh } typedef struct { - bool vertex_layout_valid[SG_MAX_VERTEX_BUFFERS]; + bool vertex_buffer_layout_active[SG_MAX_VERTEX_BUFFERS]; bool use_instanced_draw; sg_shader shader_id; sg_vertex_layout_state layout; @@ -4144,7 +4144,7 @@ typedef struct { _SOKOL_PRIVATE void _sg_pipeline_common_init(_sg_pipeline_common_t* cmn, const sg_pipeline_desc* desc) { SOKOL_ASSERT((desc->color_count >= 1) && (desc->color_count <= SG_MAX_COLOR_ATTACHMENTS)); for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { - cmn->vertex_layout_valid[i] = false; + cmn->vertex_buffer_layout_active[i] = false; } cmn->use_instanced_draw = false; cmn->shader_id = desc->shader; @@ -5547,7 +5547,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, break; } SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; } return SG_RESOURCESTATE_VALID; } @@ -7343,7 +7343,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg gl_attr->size = (uint8_t) _sg_gl_vertexformat_size(a_desc->format); gl_attr->type = _sg_gl_vertexformat_type(a_desc->format); gl_attr->normalized = _sg_gl_vertexformat_normalized(a_desc->format); - pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; } else { _SG_ERROR(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER); _SG_LOGMSG(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, _sg_strptr(&shd->gl.attrs[attr_index].name)); @@ -9434,10 +9434,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, d3d11_comp->InstanceDataStepRate = (UINT)step_rate; pip->cmn.use_instanced_draw = true; } - pip->cmn.vertex_layout_valid[a_desc->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; } for (int layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { - if (pip->cmn.vertex_layout_valid[layout_index]) { + if (pip->cmn.vertex_buffer_layout_active[layout_index]) { const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; SOKOL_ASSERT(l_desc->stride > 0); pip->d3d11.vb_strides[layout_index] = (UINT)l_desc->stride; @@ -10543,24 +10543,19 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { _sg.features.origin_top_left = true; _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; + if (@available(macOS 12.0, iOS 14.0, *)) { + _sg.features.image_clamp_to_border = true; + } else { + _sg.features.image_clamp_to_border = false; + } #if defined(_SG_TARGET_MACOS) - if (@available(macOS 12.0, *)) { - _sg.features.image_clamp_to_border = true; - } else { - _sg.features.image_clamp_to_border = false; - } _sg.limits.max_image_size_2d = 16 * 1024; _sg.limits.max_image_size_cube = 16 * 1024; _sg.limits.max_image_size_3d = 2 * 1024; _sg.limits.max_image_size_array = 16 * 1024; _sg.limits.max_image_array_layers = 2 * 1024; #else - if (@available(iOS 14.0, *)) { - _sg.features.image_clamp_to_border = true; - } else { - _sg.features.image_clamp_to_border = false; - } // FIXME: newer iOS devices support 16k textures _sg.limits.max_image_size_2d = 8 * 1024; _sg.limits.max_image_size_cube = 8 * 1024; @@ -10699,7 +10694,7 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModeShared ]; } - if (@available(macOS 10.15, *)) { + if (@available(macOS 10.15, iOS 13.0, *)) { _sg.mtl.has_unified_memory = _sg.mtl.device.hasUnifiedMemory; } else { #if defined(_SG_TARGET_MACOS) @@ -11124,10 +11119,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s vtx_desc.attributes[attr_index].format = _sg_mtl_vertex_format(a_state->format); vtx_desc.attributes[attr_index].offset = (NSUInteger)a_state->offset; vtx_desc.attributes[attr_index].bufferIndex = (NSUInteger)(a_state->buffer_index + SG_MAX_SHADERSTAGE_UBS); - pip->cmn.vertex_layout_valid[a_state->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[a_state->buffer_index] = true; } for (NSUInteger layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { - if (pip->cmn.vertex_layout_valid[layout_index]) { + if (pip->cmn.vertex_buffer_layout_active[layout_index]) { const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[layout_index]; const NSUInteger mtl_vb_slot = layout_index + SG_MAX_SHADERSTAGE_UBS; SOKOL_ASSERT(l_state->stride > 0); @@ -11156,14 +11151,14 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s if (desc->depth.pixel_format == SG_PIXELFORMAT_DEPTH_STENCIL) { rp_desc.stencilAttachmentPixelFormat = _sg_mtl_pixel_format(desc->depth.pixel_format); } - /* FIXME: this only works on macOS 10.13! - for (int i = 0; i < (SG_MAX_SHADERSTAGE_UBS+SG_MAX_VERTEX_BUFFERS); i++) { - rp_desc.vertexBuffers[i].mutability = MTLMutabilityImmutable; - } - for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { - rp_desc.fragmentBuffers[i].mutability = MTLMutabilityImmutable; + if (@available(macOS 10.13, iOS 11.0, *)) { + for (NSUInteger i = 0; i < (SG_MAX_SHADERSTAGE_UBS+SG_MAX_VERTEX_BUFFERS); i++) { + rp_desc.vertexBuffers[i].mutability = MTLMutabilityImmutable; + } + for (NSUInteger i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { + rp_desc.fragmentBuffers[i].mutability = MTLMutabilityImmutable; + } } - */ for (NSUInteger i = 0; i < (NSUInteger)desc->color_count; i++) { SOKOL_ASSERT(i < SG_MAX_COLOR_ATTACHMENTS); const sg_color_target_state* cs = &desc->colors[i]; @@ -12944,7 +12939,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ if (SG_VERTEXFORMAT_INVALID == src_va_desc->format) { break; } - pip->cmn.vertex_layout_valid[src_va_desc->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[src_va_desc->buffer_index] = true; if (vb_idx == src_va_desc->buffer_index) { va_desc[vb_idx][va_idx].format = _sg_wgpu_vertexformat(src_va_desc->format); va_desc[vb_idx][va_idx].offset = src_va_desc->offset; @@ -14536,7 +14531,6 @@ _SOKOL_PRIVATE bool _sg_validate_sampler_desc(const sg_sampler_desc* desc) { _sg_validate_begin(); _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_IMAGEDESC_CANARY); _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_IMAGEDESC_CANARY); - // FIXME return _sg_validate_end(); #endif } @@ -14903,7 +14897,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex buffers, and vertex buffers still exist for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { if (bindings->vertex_buffers[i].id != SG_INVALID_ID) { - _SG_VALIDATE(pip->cmn.vertex_layout_valid[i], VALIDATE_ABND_VBS); + _SG_VALIDATE(pip->cmn.vertex_buffer_layout_active[i], VALIDATE_ABND_VBS); // buffers in vertex-buffer-slots must be of type SG_BUFFERTYPE_VERTEXBUFFER const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, bindings->vertex_buffers[i].id); _SG_VALIDATE(buf != 0, VALIDATE_ABND_VB_EXISTS); @@ -14913,7 +14907,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { } } else { // vertex buffer provided in a slot which has no vertex layout in pipeline - _SG_VALIDATE(!pip->cmn.vertex_layout_valid[i], VALIDATE_ABND_VBS); + _SG_VALIDATE(!pip->cmn.vertex_buffer_layout_active[i], VALIDATE_ABND_VBS); } } From 8e481d9810a21f1502369541f1ab21ef4182eefa Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 4 Jun 2023 15:34:36 +0200 Subject: [PATCH 013/292] sokol_gfx.h: better sampler binding validation checks --- sokol_gfx.h | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 25ec848c1..0a4104319 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1638,7 +1638,7 @@ typedef enum sg_image_sample_type { */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, - SG_SAMPLERTYPE_SAMPLER, + SG_SAMPLERTYPE_SAMPLING, SG_SAMPLERTYPE_COMPARISON, _SG_SAMPLERTYPE_NUM, _SG_SAMPLERTYPE_FORCE_U32, @@ -3015,14 +3015,20 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_TYPES, "sg_apply_bindings: one or more vertex shader image types don't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMPS, "sg_apply_bindings: number of samplers bound to vertex stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMGS, "sg_apply_bindings: number of images bound to fragment stage doesn't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: fragment shader image no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_TYPES, "sg_apply_bindings: one or more fragment shader image types don't match sg_shader_desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMPS, "sg_apply_bindings: number of samplers bound to fragment stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_UB_AT_SLOT, "sg_apply_uniforms: no uniform block declaration at this shader stage UB slot") \ @@ -14949,12 +14955,21 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex shader image samplers for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; - if (bindings->vs.samplers[i].id != SG_INVALID_ID) { - _SG_VALIDATE(i < stage->num_samplers, VALIDATE_ABND_VS_SMPS); - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); - _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); + if (stage->samplers[i].type != _SG_SAMPLERTYPE_DEFAULT) { + _SG_VALIDATE(bindings->vs.samplers[i].id != SG_INVALID_ID, VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING); + if (bindings->vs.samplers[i].id != SG_INVALID_ID) { + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); + _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); + if (smp) { + if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARISON) { + _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER); + } else { + _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER); + } + } + } } else { - _SG_VALIDATE(i >= stage->num_samplers, VALIDATE_ABND_VS_SMPS); + _SG_VALIDATE(bindings->vs.samplers[i].id == SG_INVALID_ID, VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING); } } @@ -14978,15 +14993,23 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected fragment shader samplers for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; - if (bindings->fs.samplers[i].id != SG_INVALID_ID) { - _SG_VALIDATE(i < stage->num_samplers, VALIDATE_ABND_FS_SMPS); - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); - _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); + if (stage->samplers[i].type != _SG_SAMPLERTYPE_DEFAULT) { + _SG_VALIDATE(bindings->fs.samplers[i].id != SG_INVALID_ID, VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING); + if (bindings->fs.samplers[i].id != SG_INVALID_ID) { + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); + _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); + if (smp) { + if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARISON) { + _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER); + } else { + _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER); + } + } + } } else { - _SG_VALIDATE(i >= stage->num_samplers, VALIDATE_ABND_FS_SMPS); + _SG_VALIDATE(bindings->fs.samplers[i].id == SG_INVALID_ID, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING); } } - return _sg_validate_end(); #endif } From 054e771074428c8cc25ec9b09a3354d9ca01d274 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 4 Jun 2023 17:48:45 +0200 Subject: [PATCH 014/292] sokol_gfx.h: better image binding validation checks --- sokol_gfx.h | 60 +++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0a4104319..fcc3cdaf8 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3010,21 +3010,23 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_EXISTS, "sg_apply_bindings: index buffer no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_TYPE, "sg_apply_bindings: buffer in index buffer slot is not a SG_BUFFERTYPE_INDEXBUFFER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_OVERFLOW, "sg_apply_bindings: buffer in index buffer slot is overflown") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMGS, "sg_apply_bindings: number of images bound to vertex stage doesn't match sg_shader_desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: image bound to vertex stage no longer alive") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_TYPES, "sg_apply_bindings: one or more vertex shader image types don't match sg_shader_desc") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to vertex stage doesn't match shader desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMGS, "sg_apply_bindings: number of images bound to fragment stage doesn't match sg_shader_desc") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: fragment shader image no longer alive") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_TYPES, "sg_apply_bindings: one or more fragment shader image types don't match sg_shader_desc") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ @@ -14938,17 +14940,19 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; - if (bindings->vs.images[i].id != SG_INVALID_ID) { - _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_VS_IMGS); - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); - _SG_VALIDATE(img != 0, VALIDATE_ABND_VS_IMG_EXISTS); - if (img && img->slot.state == SG_RESOURCESTATE_VALID) { - _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_VS_IMG_TYPES); - _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_VS_IMG_MSAA); - _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_VS_IMG_DEPTH); + if (stage->images[i].image_type != _SG_IMAGETYPE_DEFAULT) { + _SG_VALIDATE(bindings->vs.images[i].id != SG_INVALID_ID, VALIDATE_ABND_VS_EXPECTED_IMAGE_BINDING); + if (bindings->vs.images[i].id != SG_INVALID_ID) { + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); + _SG_VALIDATE(img != 0, VALIDATE_ABND_VS_IMG_EXISTS); + if (img && img->slot.state == SG_RESOURCESTATE_VALID) { + _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH); + _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_VS_IMAGE_MSAA); + _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_VS_IMAGE_DEPTH); + } } } else { - _SG_VALIDATE(i >= stage->num_images, VALIDATE_ABND_VS_IMGS); + _SG_VALIDATE(bindings->vs.images[i].id == SG_INVALID_ID, VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING); } } @@ -14976,17 +14980,19 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected fragment shader images for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; - if (bindings->fs.images[i].id != SG_INVALID_ID) { - _SG_VALIDATE(i < stage->num_images, VALIDATE_ABND_FS_IMGS); - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); - _SG_VALIDATE(img != 0, VALIDATE_ABND_FS_IMG_EXISTS); - if (img && img->slot.state == SG_RESOURCESTATE_VALID) { - _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_FS_IMG_TYPES); - _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_FS_IMG_MSAA); - _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_FS_IMG_DEPTH); + if (stage->images[i].image_type != _SG_IMAGETYPE_DEFAULT) { + _SG_VALIDATE(bindings->fs.images[i].id != SG_INVALID_ID, VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING); + if (bindings->fs.images[i].id != SG_INVALID_ID) { + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); + _SG_VALIDATE(img != 0, VALIDATE_ABND_FS_IMG_EXISTS); + if (img && img->slot.state == SG_RESOURCESTATE_VALID) { + _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH); + _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_FS_IMAGE_MSAA); + _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_FS_IMAGE_DEPTH); + } } } else { - _SG_VALIDATE(i >= stage->num_images, VALIDATE_ABND_FS_IMGS); + _SG_VALIDATE(bindings->fs.images[i].id == SG_INVALID_ID, VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING); } } From 5117c4ed864733e17fb0c92c065f4dcee98ffdc9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 4 Jun 2023 18:12:51 +0200 Subject: [PATCH 015/292] sokol_gfx.h metal: only call didModifyRange for MTLStorageModeManaged --- sokol_gfx.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index fcc3cdaf8..84314d528 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -11718,9 +11718,9 @@ _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* dat __unsafe_unretained id mtl_buf = _sg_mtl_id(buf->mtl.buf[buf->cmn.active_slot]); void* dst_ptr = [mtl_buf contents]; memcpy(dst_ptr, data->ptr, data->size); - #if defined(_SG_TARGET_MACOS) - [mtl_buf didModifyRange:NSMakeRange(0, data->size)]; - #endif + if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { + [mtl_buf didModifyRange:NSMakeRange(0, data->size)]; + } } _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { @@ -11734,9 +11734,9 @@ _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data uint8_t* dst_ptr = (uint8_t*) [mtl_buf contents]; dst_ptr += buf->cmn.append_pos; memcpy(dst_ptr, data->ptr, data->size); - #if defined(_SG_TARGET_MACOS) - [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; - #endif + if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { + [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; + } /* NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backends */ return _sg_roundup((int)data->size, 4); } From 973b4e0c4bcce974704e2b99f4ec2f9ba80b1ee1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 6 Jun 2023 19:01:31 +0200 Subject: [PATCH 016/292] sokol_gfx.h d3d11: separate sampler objects wip --- sokol_gfx.h | 217 +++++++++++++++++++++++++++++----------------------- 1 file changed, 123 insertions(+), 94 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 84314d528..843b64e78 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4448,11 +4448,19 @@ typedef struct { ID3D11Texture3D* tex3d; ID3D11Resource* res; // either tex2d or tex3d ID3D11ShaderResourceView* srv; - ID3D11SamplerState* smp; } d3d11; } _sg_d3d11_image_t; typedef _sg_d3d11_image_t _sg_image_t; +typedef struct { + _sg_slot_t slot; + _sg_sampler_common_t cmn; + struct { + ID3D11SamplerState* smp; + } d3d11; +} _sg_d3d11_sampler_t; +typedef _sg_d3d11_sampler_t _sg_sampler_t; + typedef struct { _sg_str_t sem_name; int sem_index; @@ -8685,43 +8693,43 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_index_format(sg_index_type index_type) { } } -_SOKOL_PRIVATE D3D11_FILTER _sg_d3d11_filter(sg_filter min_f, sg_filter mag_f, uint32_t max_anisotropy) { +_SOKOL_PRIVATE D3D11_FILTER _sg_d3d11_filter(sg_filter min_f, sg_filter mag_f, sg_filter mipmap_f, bool comparison, uint32_t max_anisotropy) { + uint32_t d3d11_filter = 0; if (max_anisotropy > 1) { - return D3D11_FILTER_ANISOTROPIC; - } else if (mag_f == SG_FILTER_NEAREST) { - switch (min_f) { - case SG_FILTER_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - return D3D11_FILTER_MIN_MAG_MIP_POINT; - case SG_FILTER_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: - return D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: - return D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR; - case SG_FILTER_LINEAR_MIPMAP_LINEAR: - return D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR; - default: - SOKOL_UNREACHABLE; break; - } - } else if (mag_f == SG_FILTER_LINEAR) { - switch (min_f) { - case SG_FILTER_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - return D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT; - case SG_FILTER_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: - return D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: - return D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR; - case SG_FILTER_LINEAR_MIPMAP_LINEAR: - return D3D11_FILTER_MIN_MAG_MIP_LINEAR; - default: - SOKOL_UNREACHABLE; break; - } - } - /* invalid value for mag filter */ - SOKOL_UNREACHABLE; - return D3D11_FILTER_MIN_MAG_MIP_POINT; + // D3D11_FILTER_ANISOTROPIC = 0x55, + d3d11_filter |= 0x55; + } else { + // D3D11_FILTER_MIN_MAG_MIP_POINT = 0, + // D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + // D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + // D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + // D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + // D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + // D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + // D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + if (mipmap_f == SG_FILTER_LINEAR) { + d3d11_filter |= 0x01; + } + if (mag_f == SG_FILTER_LINEAR) { + d3d11_filter |= 0x04; + } + if (min_f == SG_FILTER_LINEAR) { + d3d11_filter |= 0x10; + } + } + // D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + // D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + // D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + // D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + // D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + // D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + // D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + // D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + // D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + if (comparison) { + d3d11_filter |= 0x80; + } + return d3d11_filter; } _SOKOL_PRIVATE D3D11_TEXTURE_ADDRESS_MODE _sg_d3d11_address_mode(sg_wrap m) { @@ -9008,8 +9016,7 @@ _SOKOL_PRIVATE void _sg_d3d11_fill_subres_data(const _sg_image_t* img, const sg_ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); - SOKOL_ASSERT(!img->d3d11.tex2d && !img->d3d11.tex3d); - SOKOL_ASSERT(!img->d3d11.srv && !img->d3d11.smp); + SOKOL_ASSERT((0 == img->d3d11.tex2d) && (0 == img->d3d11.tex3d) && (0 == img->d3d11.res) && (0 == img->d3d11.srv)); HRESULT hr; _sg_image_common_init(&img->cmn, desc); @@ -9180,17 +9187,42 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const } } } + return SG_RESOURCESTATE_VALID; +} - // a sampler object is only needed when the texture can be bound to a shader, - // NOTE: D3D11 implements an internal shared-pool for sampler objects - if (0 != img->d3d11.srv) { +_SOKOL_PRIVATE void _sg_d3d11_discard_image(_sg_image_t* img) { + SOKOL_ASSERT(img); + if (img->d3d11.tex2d) { + _sg_d3d11_Release(img->d3d11.tex2d); + } + if (img->d3d11.tex3d) { + _sg_d3d11_Release(img->d3d11.tex3d); + } + if (img->d3d11.res) { + _sg_d3d11_Release(img->d3d11.res); + } + if (img->d3d11.srv) { + _sg_d3d11_Release(img->d3d11.srv); + } +} + +_SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && desc); + SOKOL_ASSERT(0 == smp->d3d11.smp); + _sg_sampler_common_init(&smp->cmn, desc); + const bool injected = (0 != desc->d3d11_sampler); + if (injected) { + smp->d3d11.smp = (ID3D11SamplerState*)desc->d3d11_sampler; + _sg_d3d11_AddRef(smp->d3d11.smp); + } else { D3D11_SAMPLER_DESC d3d11_smp_desc; _sg_clear(&d3d11_smp_desc, sizeof(d3d11_smp_desc)); - d3d11_smp_desc.Filter = _sg_d3d11_filter(img->cmn.min_filter, img->cmn.mag_filter, img->cmn.max_anisotropy); - d3d11_smp_desc.AddressU = _sg_d3d11_address_mode(img->cmn.wrap_u); - d3d11_smp_desc.AddressV = _sg_d3d11_address_mode(img->cmn.wrap_v); - d3d11_smp_desc.AddressW = _sg_d3d11_address_mode(img->cmn.wrap_w); - switch (img->cmn.border_color) { + d3d11_smp_desc.Filter = _sg_d3d11_filter(desc->min_filter, desc->mag_filter, desc->mipmap_filter, desc->compare != SG_COMPAREFUNC_NEVER, desc->max_anisotropy); + d3d11_smp_desc.AddressU = _sg_d3d11_address_mode(desc->wrap_u); + d3d11_smp_desc.AddressV = _sg_d3d11_address_mode(desc->wrap_v); + d3d11_smp_desc.AddressW = _sg_d3d11_address_mode(desc->wrap_w); + d3d11_smp_desc.MipLODBias = 0.0f; // FIXME? + switch (desc->border_color) { case SG_BORDERCOLOR_TRANSPARENT_BLACK: // all 0.0f break; @@ -9204,12 +9236,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const d3d11_smp_desc.BorderColor[3] = 1.0f; break; } - d3d11_smp_desc.MaxAnisotropy = img->cmn.max_anisotropy; - d3d11_smp_desc.ComparisonFunc = D3D11_COMPARISON_NEVER; + d3d11_smp_desc.MaxAnisotropy = desc->max_anisotropy; + d3d11_smp_desc.ComparisonFunc = _sg_d3d11_compare_func(desc->compare); d3d11_smp_desc.MinLOD = desc->min_lod; d3d11_smp_desc.MaxLOD = desc->max_lod; - hr = _sg_d3d11_CreateSamplerState(_sg.d3d11.dev, &d3d11_smp_desc, &img->d3d11.smp); - if (!(SUCCEEDED(hr) && img->d3d11.smp)) { + HRESULT hr = _sg_d3d11_CreateSamplerState(_sg.d3d11.dev, &d3d11_smp_desc, &smp->d3d11.smp); + if (!(SUCCEEDED(hr) && smp->d3d11.smp)) { _SG_ERROR(D3D11_CREATE_SAMPLER_STATE_FAILED); return SG_RESOURCESTATE_FAILED; } @@ -9217,22 +9249,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const return SG_RESOURCESTATE_VALID; } -_SOKOL_PRIVATE void _sg_d3d11_discard_image(_sg_image_t* img) { - SOKOL_ASSERT(img); - if (img->d3d11.tex2d) { - _sg_d3d11_Release(img->d3d11.tex2d); - } - if (img->d3d11.tex3d) { - _sg_d3d11_Release(img->d3d11.tex3d); - } - if (img->d3d11.res) { - _sg_d3d11_Release(img->d3d11.res); - } - if (img->d3d11.srv) { - _sg_d3d11_Release(img->d3d11.srv); - } - if (img->d3d11.smp) { - _sg_d3d11_Release(img->d3d11.smp); +_SOKOL_PRIVATE void _sg_d3d11_discard_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + if (smp->d3d11.smp) { + _sg_d3d11_Release(smp->d3d11.smp); } } @@ -9417,54 +9437,54 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, pip->d3d11.topology = _sg_d3d11_primitive_topology(desc->primitive_type); pip->d3d11.stencil_ref = desc->stencil.ref; - /* create input layout object */ + // create input layout object HRESULT hr; D3D11_INPUT_ELEMENT_DESC d3d11_comps[SG_MAX_VERTEX_ATTRIBUTES]; _sg_clear(d3d11_comps, sizeof(d3d11_comps)); int attr_index = 0; for (; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - const sg_vertex_attr_desc* a_desc = &desc->layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[a_desc->buffer_index]; - const sg_vertex_step step_func = l_desc->step_func; - const int step_rate = l_desc->step_rate; + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); + const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[a_state->buffer_index]; + const sg_vertex_step step_func = l_state->step_func; + const int step_rate = l_state->step_rate; D3D11_INPUT_ELEMENT_DESC* d3d11_comp = &d3d11_comps[attr_index]; d3d11_comp->SemanticName = _sg_strptr(&shd->d3d11.attrs[attr_index].sem_name); d3d11_comp->SemanticIndex = (UINT)shd->d3d11.attrs[attr_index].sem_index; - d3d11_comp->Format = _sg_d3d11_vertex_format(a_desc->format); - d3d11_comp->InputSlot = (UINT)a_desc->buffer_index; - d3d11_comp->AlignedByteOffset = (UINT)a_desc->offset; + d3d11_comp->Format = _sg_d3d11_vertex_format(a_state->format); + d3d11_comp->InputSlot = (UINT)a_state->buffer_index; + d3d11_comp->AlignedByteOffset = (UINT)a_state->offset; d3d11_comp->InputSlotClass = _sg_d3d11_input_classification(step_func); if (SG_VERTEXSTEP_PER_INSTANCE == step_func) { d3d11_comp->InstanceDataStepRate = (UINT)step_rate; pip->cmn.use_instanced_draw = true; } - pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; + pip->cmn.vertex_buffer_layout_active[a_state->buffer_index] = true; } for (int layout_index = 0; layout_index < SG_MAX_VERTEX_BUFFERS; layout_index++) { if (pip->cmn.vertex_buffer_layout_active[layout_index]) { - const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[layout_index]; - SOKOL_ASSERT(l_desc->stride > 0); - pip->d3d11.vb_strides[layout_index] = (UINT)l_desc->stride; + const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[layout_index]; + SOKOL_ASSERT(l_state->stride > 0); + pip->d3d11.vb_strides[layout_index] = (UINT)l_state->stride; } else { pip->d3d11.vb_strides[layout_index] = 0; } } hr = _sg_d3d11_CreateInputLayout(_sg.d3d11.dev, - d3d11_comps, /* pInputElementDesc */ - (UINT)attr_index, /* NumElements */ - shd->d3d11.vs_blob, /* pShaderByteCodeWithInputSignature */ - shd->d3d11.vs_blob_length, /* BytecodeLength */ + d3d11_comps, // pInputElementDesc + (UINT)attr_index, // NumElements + shd->d3d11.vs_blob, // pShaderByteCodeWithInputSignature + shd->d3d11.vs_blob_length, // BytecodeLength &pip->d3d11.il); if (!(SUCCEEDED(hr) && pip->d3d11.il)) { _SG_ERROR(D3D11_CREATE_INPUT_LAYOUT_FAILED); return SG_RESOURCESTATE_FAILED; } - /* create rasterizer state */ + // create rasterizer state D3D11_RASTERIZER_DESC rs_desc; _sg_clear(&rs_desc, sizeof(rs_desc)); rs_desc.FillMode = D3D11_FILL_SOLID; @@ -9483,7 +9503,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, return SG_RESOURCESTATE_FAILED; } - /* create depth-stencil state */ + // create depth-stencil state D3D11_DEPTH_STENCIL_DESC dss_desc; _sg_clear(&dss_desc, sizeof(dss_desc)); dss_desc.DepthEnable = TRUE; @@ -9508,7 +9528,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, return SG_RESOURCESTATE_FAILED; } - /* create blend state */ + // create blend state D3D11_BLEND_DESC bs_desc; _sg_clear(&bs_desc, sizeof(bs_desc)); bs_desc.AlphaToCoverageEnable = desc->alpha_to_coverage_enabled; @@ -9884,7 +9904,9 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(pip); SOKOL_ASSERT(_sg.d3d11.ctx); @@ -9910,25 +9932,32 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( } for (i = 0; i < num_vs_imgs; i++) { SOKOL_ASSERT(vs_imgs[i]->d3d11.srv); - SOKOL_ASSERT(vs_imgs[i]->d3d11.smp); d3d11_vs_srvs[i] = vs_imgs[i]->d3d11.srv; - d3d11_vs_smps[i] = vs_imgs[i]->d3d11.smp; } for (; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { d3d11_vs_srvs[i] = 0; + } + for (i = 0; i < num_vs_smps; i++) { + SOKOL_ASSERT(vs_smps[i]->d3d11.smp); + d3d11_vs_smps[i] = vs_smps[i]->d3d11.smp; + } + for (; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { d3d11_vs_smps[i] = 0; } for (i = 0; i < num_fs_imgs; i++) { SOKOL_ASSERT(fs_imgs[i]->d3d11.srv); - SOKOL_ASSERT(fs_imgs[i]->d3d11.smp); d3d11_fs_srvs[i] = fs_imgs[i]->d3d11.srv; - d3d11_fs_smps[i] = fs_imgs[i]->d3d11.smp; } for (; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { d3d11_fs_srvs[i] = 0; + } + for (i = 0; i < num_fs_smps; i++) { + SOKOL_ASSERT(fs_smps[i]->d3d11.smp); + d3d11_fs_smps[i] = fs_smps[i]->d3d11.smp; + } + for (; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { d3d11_fs_smps[i] = 0; } - _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, pip->d3d11.vb_strides, d3d11_vb_offsets); _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)ib_offset); _sg_d3d11_VSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_srvs); From 1c2a10abe9cb5a9fdb9113f5f804666e22a8d23c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 6 Jun 2023 19:51:51 +0200 Subject: [PATCH 017/292] sokol_gfx.h d3d11: fix sampler binding --- sokol_gfx.h | 49 ++++++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 843b64e78..edc975aea 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -8729,7 +8729,7 @@ _SOKOL_PRIVATE D3D11_FILTER _sg_d3d11_filter(sg_filter min_f, sg_filter mag_f, s if (comparison) { d3d11_filter |= 0x80; } - return d3d11_filter; + return (D3D11_FILTER)d3d11_filter; } _SOKOL_PRIVATE D3D11_TEXTURE_ADDRESS_MODE _sg_d3d11_address_mode(sg_wrap m) { @@ -9914,56 +9914,39 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( // gather all the D3D11 resources into arrays ID3D11Buffer* d3d11_ib = ib ? ib->d3d11.buf : 0; - ID3D11Buffer* d3d11_vbs[SG_MAX_VERTEX_BUFFERS]; - UINT d3d11_vb_offsets[SG_MAX_VERTEX_BUFFERS]; - ID3D11ShaderResourceView* d3d11_vs_srvs[SG_MAX_SHADERSTAGE_IMAGES]; - ID3D11SamplerState* d3d11_vs_smps[SG_MAX_SHADERSTAGE_IMAGES]; - ID3D11ShaderResourceView* d3d11_fs_srvs[SG_MAX_SHADERSTAGE_IMAGES]; - ID3D11SamplerState* d3d11_fs_smps[SG_MAX_SHADERSTAGE_IMAGES]; - int i; - for (i = 0; i < num_vbs; i++) { + ID3D11Buffer* d3d11_vbs[SG_MAX_VERTEX_BUFFERS] = {0}; + UINT d3d11_vb_offsets[SG_MAX_VERTEX_BUFFERS] = {0}; + ID3D11ShaderResourceView* d3d11_vs_srvs[SG_MAX_SHADERSTAGE_IMAGES] = {0}; + ID3D11ShaderResourceView* d3d11_fs_srvs[SG_MAX_SHADERSTAGE_IMAGES] = {0}; + ID3D11SamplerState* d3d11_vs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = {0}; + ID3D11SamplerState* d3d11_fs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = {0}; + for (int i = 0; i < num_vbs; i++) { SOKOL_ASSERT(vbs[i]->d3d11.buf); d3d11_vbs[i] = vbs[i]->d3d11.buf; d3d11_vb_offsets[i] = (UINT)vb_offsets[i]; } - for (; i < SG_MAX_VERTEX_BUFFERS; i++) { - d3d11_vbs[i] = 0; - d3d11_vb_offsets[i] = 0; - } - for (i = 0; i < num_vs_imgs; i++) { + for (int i = 0; i < num_vs_imgs; i++) { SOKOL_ASSERT(vs_imgs[i]->d3d11.srv); d3d11_vs_srvs[i] = vs_imgs[i]->d3d11.srv; } - for (; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - d3d11_vs_srvs[i] = 0; - } - for (i = 0; i < num_vs_smps; i++) { - SOKOL_ASSERT(vs_smps[i]->d3d11.smp); - d3d11_vs_smps[i] = vs_smps[i]->d3d11.smp; - } - for (; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { - d3d11_vs_smps[i] = 0; - } - for (i = 0; i < num_fs_imgs; i++) { + for (int i = 0; i < num_fs_imgs; i++) { SOKOL_ASSERT(fs_imgs[i]->d3d11.srv); d3d11_fs_srvs[i] = fs_imgs[i]->d3d11.srv; } - for (; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - d3d11_fs_srvs[i] = 0; + for (int i = 0; i < num_vs_smps; i++) { + SOKOL_ASSERT(vs_smps[i]->d3d11.smp); + d3d11_vs_smps[i] = vs_smps[i]->d3d11.smp; } - for (i = 0; i < num_fs_smps; i++) { + for (int i = 0; i < num_fs_smps; i++) { SOKOL_ASSERT(fs_smps[i]->d3d11.smp); d3d11_fs_smps[i] = fs_smps[i]->d3d11.smp; } - for (; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { - d3d11_fs_smps[i] = 0; - } _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, pip->d3d11.vb_strides, d3d11_vb_offsets); _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)ib_offset); _sg_d3d11_VSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_srvs); - _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_smps); _sg_d3d11_PSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_srvs); - _sg_d3d11_PSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_smps); + _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_vs_smps); + _sg_d3d11_PSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_fs_smps); } _SOKOL_PRIVATE void _sg_d3d11_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { From be77b8651c43b9cd7f273594ca903cf4a4e9a50c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 7 Jun 2023 19:54:40 +0200 Subject: [PATCH 018/292] sokol_gfx.h rename sampler type to SAMPLE and COMPARE --- sokol_gfx.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index edc975aea..82c074e87 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1638,8 +1638,8 @@ typedef enum sg_image_sample_type { */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, - SG_SAMPLERTYPE_SAMPLING, - SG_SAMPLERTYPE_COMPARISON, + SG_SAMPLERTYPE_SAMPLE, + SG_SAMPLERTYPE_COMPARE, _SG_SAMPLERTYPE_NUM, _SG_SAMPLERTYPE_FORCE_U32, } sg_sampler_type; @@ -2414,7 +2414,7 @@ typedef struct sg_sampler_desc { - 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 sampler type (SG_SAMPLETYPE_xxx, default is SG_SAMPLETYPE_FLOAT) - the name of the texture sampler (optional) For all GL backends, shader source-code must be provided. For D3D11 and Metal, @@ -3017,8 +3017,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on fragment stage") \ @@ -3028,8 +3028,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ @@ -14977,7 +14977,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARISON) { + if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARE) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER); @@ -15017,7 +15017,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARISON) { + if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARE) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER); From 711da77d5e7e97143c43a7d9ccac76a8a86296ff Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 9 Jun 2023 19:53:28 +0200 Subject: [PATCH 019/292] sokol_gfx.h gl: separate sampler objects wip --- sokol_gfx.h | 212 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 133 insertions(+), 79 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 82c074e87..5db56476e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4263,7 +4263,7 @@ typedef struct { _sg_buffer_common_t cmn; struct { GLuint buf[SG_NUM_INFLIGHT_FRAMES]; - bool ext_buffers; /* if true, external buffers were injected with sg_buffer_desc.gl_buffers */ + bool injected; // if true, external buffers were injected with sg_buffer_desc.gl_buffers } gl; } _sg_gl_buffer_t; typedef _sg_gl_buffer_t _sg_buffer_t; @@ -4275,11 +4275,21 @@ typedef struct { GLenum target; GLuint msaa_render_buffer; GLuint tex[SG_NUM_INFLIGHT_FRAMES]; - bool ext_textures; /* if true, external textures were injected with sg_image_desc.gl_textures */ + bool injected; // if true, external textures were injected with sg_image_desc.gl_textures } gl; } _sg_gl_image_t; typedef _sg_gl_image_t _sg_image_t; +typedef struct { + _sg_slot_t slot; + _sg_sampler_common_t cmn; + struct { + GLuint smp; + bool injected; // true if external sampler was injects in sg_sampler_desc.gl_sampler + } gl; +} _sg_gl_sampler_t; +typedef _sg_gl_sampler_t _sg_sampler_t; + typedef struct { GLint gl_loc; sg_uniform_type type; @@ -6057,15 +6067,27 @@ _SOKOL_PRIVATE GLenum _sg_gl_blend_op(sg_blend_op op) { } } -_SOKOL_PRIVATE GLenum _sg_gl_filter(sg_filter f) { - switch (f) { - case SG_FILTER_NEAREST: return GL_NEAREST; - case SG_FILTER_LINEAR: return GL_LINEAR; - case SG_FILTER_NEAREST_MIPMAP_NEAREST: return GL_NEAREST_MIPMAP_NEAREST; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: return GL_NEAREST_MIPMAP_LINEAR; - case SG_FILTER_LINEAR_MIPMAP_NEAREST: return GL_LINEAR_MIPMAP_NEAREST; - case SG_FILTER_LINEAR_MIPMAP_LINEAR: return GL_LINEAR_MIPMAP_LINEAR; - default: SOKOL_UNREACHABLE; return 0; +_SOKOL_PRIVATE GLenum _sg_gl_min_filter(sg_filter min_f, sg_filter mipmap_f) { + if (min_f == SG_FILTER_NEAREST) { + if (mipmap_f == SG_FILTER_NEAREST) { + return GL_NEAREST_MIPMAP_NEAREST; + } else { + return GL_NEAREST_MIPMAP_LINEAR; + } + } else { + if (mipmap_f == SG_FILTER_NEAREST) { + return GL_LINEAR_MIPMAP_NEAREST; + } else { + return GL_LINEAR_MIPMAP_LINEAR; + } + } +} + +_SOKOL_PRIVATE GLenum _sg_gl_mag_filter(sg_filter mag_f) { + if (mag_f == SG_FILTER_NEAREST) { + return GL_NEAREST; + } else { + return GL_LINEAR; } } @@ -6684,20 +6706,20 @@ _SOKOL_PRIVATE void _sg_gl_cache_store_buffer_binding(GLenum target) { _SOKOL_PRIVATE void _sg_gl_cache_restore_buffer_binding(GLenum target) { if (target == GL_ARRAY_BUFFER) { if (_sg.gl.cache.stored_vertex_buffer != 0) { - /* we only care restoring valid ids */ + // we only care about restoring valid ids _sg_gl_cache_bind_buffer(target, _sg.gl.cache.stored_vertex_buffer); _sg.gl.cache.stored_vertex_buffer = 0; } } else { if (_sg.gl.cache.stored_index_buffer != 0) { - /* we only care restoring valid ids */ + // we only care about restoring valid ids _sg_gl_cache_bind_buffer(target, _sg.gl.cache.stored_index_buffer); _sg.gl.cache.stored_index_buffer = 0; } } } -/* called when _sg_gl_deinit_buffer() */ +// called when _sg_gl_discard_buffer() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_buffer(GLuint buf) { if (buf == _sg.gl.cache.vertex_buffer) { _sg.gl.cache.vertex_buffer = 0; @@ -6755,11 +6777,11 @@ _SOKOL_PRIVATE void _sg_gl_cache_bind_texture(int slot_index, GLenum target, GLu _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.textures[slot_index]; if ((slot->target != target) || (slot->texture != texture)) { _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + slot_index)); - /* if the target has changed, clear the previous binding on that target */ + // if the target has changed, clear the previous binding on that target if ((target != slot->target) && (slot->target != 0)) { glBindTexture(slot->target, 0); } - /* apply new binding (texture can be 0 to unbind) */ + // apply new binding (texture can be 0 to unbind) if (target != 0) { glBindTexture(target, texture); } @@ -6777,7 +6799,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_restore_texture_binding(int slot_index) { SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_IMAGE_CACHE_SIZE)); _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.stored_texture; if (slot->texture != 0) { - /* we only care restoring valid ids */ + // we only care restoring valid ids SOKOL_ASSERT(slot->target != 0); _sg_gl_cache_bind_texture(slot_index, slot->target, slot->texture); slot->target = 0; @@ -6785,7 +6807,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_restore_texture_binding(int slot_index) { } } -/* called from _sg_gl_destroy_texture() */ +// called from _sg_gl_discard_texture() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture(GLuint tex) { for (int i = 0; i < _SG_GL_IMAGE_CACHE_SIZE; i++) { _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.textures[i]; @@ -6802,6 +6824,13 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture(GLuint tex) { } } +// called from _sg_gl_discard_sampler() +_SOKOL_PRIVATE void _sg_gl_cache_invalidate_sampler(GLuint smp) { + // FIXME! + (void)smp; + SOKOL_ASSERT(false); +} + /* called from _sg_gl_discard_shader() */ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_program(GLuint prog) { if (prog == _sg.gl.cache.prog) { @@ -6958,12 +6987,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_buffer(_sg_buffer_t* buf, const s SOKOL_ASSERT(buf && desc); _SG_GL_CHECK_ERROR(); _sg_buffer_common_init(&buf->cmn, desc); - buf->gl.ext_buffers = (0 != desc->gl_buffers[0]); + buf->gl.injected = (0 != desc->gl_buffers[0]); const GLenum gl_target = _sg_gl_buffer_target(buf->cmn.type); const GLenum gl_usage = _sg_gl_usage(buf->cmn.usage); for (int slot = 0; slot < buf->cmn.num_slots; slot++) { GLuint gl_buf = 0; - if (buf->gl.ext_buffers) { + if (buf->gl.injected) { SOKOL_ASSERT(desc->gl_buffers[slot]); gl_buf = desc->gl_buffers[slot]; } else { @@ -6990,7 +7019,7 @@ _SOKOL_PRIVATE void _sg_gl_discard_buffer(_sg_buffer_t* buf) { for (int slot = 0; slot < buf->cmn.num_slots; slot++) { if (buf->gl.buf[slot]) { _sg_gl_cache_invalidate_buffer(buf->gl.buf[slot]); - if (!buf->gl.ext_buffers) { + if (!buf->gl.injected) { glDeleteBuffers(1, &buf->gl.buf[slot]); } } @@ -7008,7 +7037,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ SOKOL_ASSERT(img && desc); _SG_GL_CHECK_ERROR(); _sg_image_common_init(&img->cmn, desc); - img->gl.ext_textures = (0 != desc->gl_textures[0]); + img->gl.injected = (0 != desc->gl_textures[0]); // check if texture format is support if (!_sg_gl_supported_texture_format(img->cmn.pixel_format)) { @@ -7023,7 +7052,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ glGenRenderbuffers(1, &img->gl.msaa_render_buffer); glBindRenderbuffer(GL_RENDERBUFFER, img->gl.msaa_render_buffer); glRenderbufferStorageMultisample(GL_RENDERBUFFER, img->cmn.sample_count, gl_internal_format, img->cmn.width, img->cmn.height); - } else if (img->gl.ext_textures) { + } else if (img->gl.injected) { img->gl.target = _sg_gl_texture_target(img->cmn.type); // inject externally GL textures for (int slot = 0; slot < img->cmn.num_slots; slot++) { @@ -7043,47 +7072,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ SOKOL_ASSERT(img->gl.tex[slot]); _sg_gl_cache_store_texture_binding(0); _sg_gl_cache_bind_texture(0, img->gl.target, img->gl.tex[slot]); - const GLenum gl_min_filter = _sg_gl_filter(img->cmn.min_filter); - const GLenum gl_mag_filter = _sg_gl_filter(img->cmn.mag_filter); - glTexParameteri(img->gl.target, GL_TEXTURE_MIN_FILTER, (GLint)gl_min_filter); - glTexParameteri(img->gl.target, GL_TEXTURE_MAG_FILTER, (GLint)gl_mag_filter); - if (_sg.gl.ext_anisotropic && (img->cmn.max_anisotropy > 1)) { - GLint max_aniso = (GLint) img->cmn.max_anisotropy; - if (max_aniso > _sg.gl.max_anisotropy) { - max_aniso = _sg.gl.max_anisotropy; - } - glTexParameteri(img->gl.target, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_aniso); - } - if (img->cmn.type == SG_IMAGETYPE_CUBE) { - glTexParameteri(img->gl.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(img->gl.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } else { - glTexParameteri(img->gl.target, GL_TEXTURE_WRAP_S, (GLint)_sg_gl_wrap(img->cmn.wrap_u)); - glTexParameteri(img->gl.target, GL_TEXTURE_WRAP_T, (GLint)_sg_gl_wrap(img->cmn.wrap_v)); - if (img->cmn.type == SG_IMAGETYPE_3D) { - glTexParameteri(img->gl.target, GL_TEXTURE_WRAP_R, (GLint)_sg_gl_wrap(img->cmn.wrap_w)); - } - #if defined(SOKOL_GLCORE33) - float border[4]; - switch (img->cmn.border_color) { - case SG_BORDERCOLOR_TRANSPARENT_BLACK: - border[0] = 0.0f; border[1] = 0.0f; border[2] = 0.0f; border[3] = 0.0f; - break; - case SG_BORDERCOLOR_OPAQUE_WHITE: - border[0] = 1.0f; border[1] = 1.0f; border[2] = 1.0f; border[3] = 1.0f; - break; - default: - border[0] = 0.0f; border[1] = 0.0f; border[2] = 0.0f; border[3] = 1.0f; - break; - } - glTexParameterfv(img->gl.target, GL_TEXTURE_BORDER_COLOR, border); - #endif - } - /* GL spec has strange defaults for mipmap min/max lod: -1000 to +1000 */ - const float min_lod = _sg_clamp(desc->min_lod, 0.0f, 1000.0f); - const float max_lod = _sg_clamp(desc->max_lod, 0.0f, 1000.0f); - glTexParameterf(img->gl.target, GL_TEXTURE_MIN_LOD, min_lod); - glTexParameterf(img->gl.target, GL_TEXTURE_MAX_LOD, max_lod); const int num_faces = img->cmn.type == SG_IMAGETYPE_CUBE ? 6 : 1; int data_index = 0; for (int face_index = 0; face_index < num_faces; face_index++) { @@ -7144,7 +7132,7 @@ _SOKOL_PRIVATE void _sg_gl_discard_image(_sg_image_t* img) { for (int slot = 0; slot < img->cmn.num_slots; slot++) { if (img->gl.tex[slot]) { _sg_gl_cache_invalidate_texture(img->gl.tex[slot]); - if (!img->gl.ext_textures) { + if (!img->gl.injected) { glDeleteTextures(1, &img->gl.tex[slot]); } } @@ -7155,6 +7143,72 @@ _SOKOL_PRIVATE void _sg_gl_discard_image(_sg_image_t* img) { _SG_GL_CHECK_ERROR(); } +_SOKOL_PRIVATE sg_resource_state _sg_gl_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && desc); + _SG_GL_CHECK_ERROR(); + _sg_sampler_common_init(&smp->cmn, desc); + smp->gl.injected = (0 != desc->gl_sampler); + if (smp->gl.injected) { + smp->gl.smp = (GLuint) desc->gl_sampler; + } else { + glGenSamplers(1, &smp->gl.smp); + SOKOL_ASSERT(smp->gl.smp); + + const GLenum gl_min_filter = _sg_gl_min_filter(smp->cmn.min_filter, smp->cmn.mipmap_filter); + const GLenum gl_mag_filter = _sg_gl_mag_filter(smp->cmn.mag_filter); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MIN_FILTER, (GLint)gl_min_filter); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MAG_FILTER, (GLint)gl_mag_filter); + // GL spec has strange defaults for mipmap min/max lod: -1000 to +1000 + const float min_lod = _sg_clamp(desc->min_lod, 0.0f, 1000.0f); + const float max_lod = _sg_clamp(desc->max_lod, 0.0f, 1000.0f); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MIN_LOD, min_lod); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MAX_LOD, max_lod); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_S, (GLint)_sg_gl_wrap(smp->cmn.wrap_u)); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_T, (GLint)_sg_gl_wrap(smp->cmn.wrap_v)); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_R, (GLint)_sg_gl_wrap(smp->cmn.wrap_w)); + #if defined(SOKOL_GLCORE33) + float border[4]; + switch (smp->cmn.border_color) { + case SG_BORDERCOLOR_TRANSPARENT_BLACK: + border[0] = 0.0f; border[1] = 0.0f; border[2] = 0.0f; border[3] = 0.0f; + break; + case SG_BORDERCOLOR_OPAQUE_WHITE: + border[0] = 1.0f; border[1] = 1.0f; border[2] = 1.0f; border[3] = 1.0f; + break; + default: + border[0] = 0.0f; border[1] = 0.0f; border[2] = 0.0f; border[3] = 1.0f; + break; + } + glSamplerParameterfv(smp->gl.smp, GL_TEXTURE_BORDER_COLOR, border); + #endif + if (smp->cmn.compare != SG_COMPAREFUNC_NEVER) { + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_COMPARE_FUNC, (GLint)_sg_gl_compare_func(smp->cmn.compare)); + } else { + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_COMPARE_MODE, GL_NONE); + } + if (_sg.gl.ext_anisotropic && (smp->cmn.max_anisotropy > 1)) { + GLint max_aniso = (GLint) smp->cmn.max_anisotropy; + if (max_aniso > _sg.gl.max_anisotropy) { + max_aniso = _sg.gl.max_anisotropy; + } + glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_aniso); + } + } + _SG_GL_CHECK_ERROR(); + return SG_RESOURCESTATE_VALID; +} + +_SOKOL_PRIVATE void _sg_gl_discard_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + _SG_GL_CHECK_ERROR(); + _sg_gl_cache_invalidate_sampler(smp->gl.smp); + if (!smp->gl.injected) { + glDeleteSamplers(1, &smp->gl.smp); + } + _SG_GL_CHECK_ERROR(); +} + _SOKOL_PRIVATE GLuint _sg_gl_compile_shader(sg_shader_stage stage, const char* src) { SOKOL_ASSERT(src); _SG_GL_CHECK_ERROR(); @@ -7330,14 +7384,14 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg pip->gl.attrs[attr_index].vb_index = -1; } for (int attr_index = 0; attr_index < _sg.limits.max_vertex_attrs; attr_index++) { - const sg_vertex_attr_desc* a_desc = &desc->layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - const sg_buffer_layout_desc* l_desc = &desc->layout.buffers[a_desc->buffer_index]; - const sg_vertex_step step_func = l_desc->step_func; - const int step_rate = l_desc->step_rate; + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); + const sg_vertex_buffer_layout_state* l_state = &desc->layout.buffers[a_state->buffer_index]; + const sg_vertex_step step_func = l_state->step_func; + const int step_rate = l_state->step_rate; GLint attr_loc = attr_index; if (!_sg_strempty(&shd->gl.attrs[attr_index].name)) { attr_loc = glGetAttribLocation(pip->shader->gl.prog, _sg_strptr(&shd->gl.attrs[attr_index].name)); @@ -7346,20 +7400,20 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg if (attr_loc != -1) { _sg_gl_attr_t* gl_attr = &pip->gl.attrs[attr_loc]; SOKOL_ASSERT(gl_attr->vb_index == -1); - gl_attr->vb_index = (int8_t) a_desc->buffer_index; + gl_attr->vb_index = (int8_t) a_state->buffer_index; if (step_func == SG_VERTEXSTEP_PER_VERTEX) { gl_attr->divisor = 0; } else { gl_attr->divisor = (int8_t) step_rate; pip->cmn.use_instanced_draw = true; } - SOKOL_ASSERT(l_desc->stride > 0); - gl_attr->stride = (uint8_t) l_desc->stride; - gl_attr->offset = a_desc->offset; - gl_attr->size = (uint8_t) _sg_gl_vertexformat_size(a_desc->format); - gl_attr->type = _sg_gl_vertexformat_type(a_desc->format); - gl_attr->normalized = _sg_gl_vertexformat_normalized(a_desc->format); - pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; + SOKOL_ASSERT(l_state->stride > 0); + gl_attr->stride = (uint8_t) l_state->stride; + gl_attr->offset = a_state->offset; + gl_attr->size = (uint8_t) _sg_gl_vertexformat_size(a_state->format); + gl_attr->type = _sg_gl_vertexformat_type(a_state->format); + gl_attr->normalized = _sg_gl_vertexformat_normalized(a_state->format); + pip->cmn.vertex_buffer_layout_active[a_state->buffer_index] = true; } else { _SG_ERROR(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER); _SG_LOGMSG(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, _sg_strptr(&shd->gl.attrs[attr_index].name)); From f3951b0e3fae2c99d6778e67ca522d8bbbd61c27 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 10 Jun 2023 16:47:29 +0200 Subject: [PATCH 020/292] sokol_gfx.h gl: separate sampler objects, more wip --- sokol_gfx.h | 194 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 119 insertions(+), 75 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 5db56476e..7eb73da42 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2454,9 +2454,12 @@ typedef struct sg_shader_sampler_desc { sg_sampler_type type; } sg_shader_sampler_desc; -typedef struct sg_shader_combined_image_sampler_desc { +// combined image samplers are only needed for GL +typedef struct sg_shader_image_sampler_desc { const char* name; // required for GLSL -} sg_shader_combined_image_sampler_desc; + int image_slot; // index into sg_shader_stage_desc.images + int sampler_slot; // index into sg_shader_stage_desc.samplers +} sg_shader_image_sampler_desc; typedef struct sg_shader_stage_desc { const char* source; @@ -2466,7 +2469,7 @@ typedef struct sg_shader_stage_desc { sg_shader_uniform_block_desc uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; sg_shader_image_desc images[SG_MAX_SHADERSTAGE_IMAGES]; sg_shader_sampler_desc samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; - sg_shader_combined_image_sampler_desc combined_image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; + sg_shader_image_sampler_desc image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; } sg_shader_stage_desc; typedef struct sg_shader_desc { @@ -4083,13 +4086,21 @@ typedef struct { sg_sampler_type type; } _sg_shader_sampler_t; +// combined image sampler mappings, only needed on GL +typedef struct { + int image_slot; + int sampler_slot; +} _sg_shader_image_sampler_t; + typedef struct { int num_uniform_blocks; int num_images; int num_samplers; + int num_image_samplers; _sg_shader_uniform_block_t uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; _sg_shader_image_t images[SG_MAX_SHADERSTAGE_IMAGES]; _sg_shader_sampler_t samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; + _sg_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; } _sg_shader_stage_t; typedef struct { @@ -4128,6 +4139,17 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh stage->samplers[smp_index].type = smp_desc->type; stage->num_samplers++; } + SOKOL_ASSERT(stage->num_image_samplers == 0); + for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { + const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + if (img_smp_desc->name == 0) { + break; + } + SOKOL_ASSERT((img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < stage->num_images)); + stage->image_samplers[img_smp_index].image_slot = img_smp_desc->image_slot; + SOKOL_ASSERT((img_smp_desc->sampler_slot >= 0) && (img_smp_desc->sampler_slot < stage->num_samplers)); + stage->image_samplers[img_smp_index].sampler_slot = img_smp_desc->sampler_slot; + } } } @@ -4304,7 +4326,7 @@ typedef struct { typedef struct { int gl_tex_slot; -} _sg_gl_shader_image_t; +} _sg_gl_shader_image_sampler_t; typedef struct { _sg_str_t name; @@ -4312,7 +4334,7 @@ typedef struct { typedef struct { _sg_gl_uniform_block_t uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; - _sg_gl_shader_image_t images[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_gl_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; } _sg_gl_shader_stage_t; typedef struct { @@ -4388,9 +4410,10 @@ typedef struct { typedef struct { GLenum target; GLuint texture; -} _sg_gl_texture_bind_slot; + GLuint sampler; +} _sg_gl_cache_texture_sampler_bind_slot; -#define _SG_GL_IMAGE_CACHE_SIZE (SG_MAX_SHADERSTAGE_IMAGES * SG_NUM_SHADER_STAGES) +#define _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE (SG_MAX_SHADERSTAGE_IMAGES * SG_NUM_SHADER_STAGES) typedef struct { sg_depth_state depth; @@ -4409,8 +4432,8 @@ typedef struct { GLuint stored_vertex_buffer; GLuint stored_index_buffer; GLuint prog; - _sg_gl_texture_bind_slot textures[_SG_GL_IMAGE_CACHE_SIZE]; - _sg_gl_texture_bind_slot stored_texture; + _sg_gl_cache_texture_sampler_bind_slot texture_samplers[_SG_GL_TEXTURE_SAMPLER_CACHE_SIZE]; + _sg_gl_cache_texture_sampler_bind_slot stored_texture_sampler; int cur_ib_offset; GLenum cur_primitive_type; GLenum cur_index_type; @@ -6750,77 +6773,87 @@ _SOKOL_PRIVATE void _sg_gl_cache_active_texture(GLenum texture) { } _SOKOL_PRIVATE void _sg_gl_cache_clear_texture_bindings(bool force) { - for (int i = 0; (i < _SG_GL_IMAGE_CACHE_SIZE) && (i < _sg.limits.gl_max_combined_texture_image_units); i++) { - if (force || (_sg.gl.cache.textures[i].texture != 0)) { - GLenum gl_texture_slot = (GLenum) (GL_TEXTURE0 + i); - glActiveTexture(gl_texture_slot); + for (int i = 0; (i < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE) && (i < _sg.limits.gl_max_combined_texture_image_units); i++) { + if (force || (_sg.gl.cache.texture_samplers[i].texture != 0)) { + GLenum gl_texture_unit = (GLenum) (GL_TEXTURE0 + i); + glActiveTexture(gl_texture_unit); glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_CUBE_MAP, 0); glBindTexture(GL_TEXTURE_3D, 0); glBindTexture(GL_TEXTURE_2D_ARRAY, 0); - _sg.gl.cache.textures[i].target = 0; - _sg.gl.cache.textures[i].texture = 0; - _sg.gl.cache.cur_active_texture = gl_texture_slot; + glBindSampler(gl_texture_unit, 0); + _sg.gl.cache.texture_samplers[i].target = 0; + _sg.gl.cache.texture_samplers[i].texture = 0; + _sg.gl.cache.texture_samplers[i].sampler = 0; + _sg.gl.cache.cur_active_texture = gl_texture_unit; } } } -_SOKOL_PRIVATE void _sg_gl_cache_bind_texture(int slot_index, GLenum target, GLuint texture) { +_SOKOL_PRIVATE void _sg_gl_cache_bind_texture_sampler(int slot_index, GLenum target, GLuint texture, GLuint sampler) { /* it's valid to call this function with target=0 and/or texture=0 target=0 will unbind the previous binding, texture=0 will clear the new binding */ - SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_IMAGE_CACHE_SIZE)); + SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE)); if (slot_index >= _sg.limits.gl_max_combined_texture_image_units) { return; } - _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.textures[slot_index]; - if ((slot->target != target) || (slot->texture != texture)) { + _sg_gl_cache_texture_sampler_bind_slot* slot = &_sg.gl.cache.texture_samplers[slot_index]; + if ((slot->target != target) || (slot->texture != texture) || (slot->sampler != sampler)) { _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + slot_index)); // if the target has changed, clear the previous binding on that target if ((target != slot->target) && (slot->target != 0)) { glBindTexture(slot->target, 0); } - // apply new binding (texture can be 0 to unbind) + // apply new binding (can be 0 to unbind) if (target != 0) { glBindTexture(target, texture); } + // apply new sampler (can be 0 to unbind) + glBindSampler((GLuint)slot_index, sampler); + slot->target = target; slot->texture = texture; + slot->sampler = sampler; } } -_SOKOL_PRIVATE void _sg_gl_cache_store_texture_binding(int slot_index) { - SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_IMAGE_CACHE_SIZE)); - _sg.gl.cache.stored_texture = _sg.gl.cache.textures[slot_index]; +_SOKOL_PRIVATE void _sg_gl_cache_store_texture_sampler_binding(int slot_index) { + SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE)); + _sg.gl.cache.stored_texture_sampler = _sg.gl.cache.texture_samplers[slot_index]; } -_SOKOL_PRIVATE void _sg_gl_cache_restore_texture_binding(int slot_index) { - SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_IMAGE_CACHE_SIZE)); - _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.stored_texture; +_SOKOL_PRIVATE void _sg_gl_cache_restore_texture_sampler_binding(int slot_index) { + SOKOL_ASSERT((slot_index >= 0) && (slot_index < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE)); + _sg_gl_cache_texture_sampler_bind_slot* slot = &_sg.gl.cache.stored_texture_sampler; if (slot->texture != 0) { - // we only care restoring valid ids + // we only care about restoring valid ids SOKOL_ASSERT(slot->target != 0); - _sg_gl_cache_bind_texture(slot_index, slot->target, slot->texture); + _sg_gl_cache_bind_texture_sampler(slot_index, slot->target, slot->texture, slot->sampler); slot->target = 0; slot->texture = 0; + slot->sampler = 0; } } -// called from _sg_gl_discard_texture() -_SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture(GLuint tex) { - for (int i = 0; i < _SG_GL_IMAGE_CACHE_SIZE; i++) { - _sg_gl_texture_bind_slot* slot = &_sg.gl.cache.textures[i]; - if (tex == slot->texture) { +// called from _sg_gl_discard_texture() and _sg_gl_discard_sampler() +_SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture_sampler(GLuint tex, GLuint smp) { + for (int i = 0; i < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE; i++) { + _sg_gl_cache_texture_sampler_bind_slot* slot = &_sg.gl.cache.texture_samplers[i]; + if ((tex == slot->texture) || (smp == slot->sampler)) { _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + i)); glBindTexture(slot->target, 0); + glBindSampler((GLuint)i, slot->sampler); slot->target = 0; slot->texture = 0; + slot->sampler = 0; } } - if (tex == _sg.gl.cache.stored_texture.texture) { - _sg.gl.cache.stored_texture.target = 0; - _sg.gl.cache.stored_texture.texture = 0; + if ((tex == _sg.gl.cache.stored_texture_sampler.texture) || (smp == _sg.gl.cache.stored_texture_sampler.sampler)) { + _sg.gl.cache.stored_texture_sampler.target = 0; + _sg.gl.cache.stored_texture_sampler.texture = 0; + _sg.gl.cache.stored_texture_sampler.sampler = 0; } } @@ -7070,8 +7103,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ for (int slot = 0; slot < img->cmn.num_slots; slot++) { glGenTextures(1, &img->gl.tex[slot]); SOKOL_ASSERT(img->gl.tex[slot]); - _sg_gl_cache_store_texture_binding(0); - _sg_gl_cache_bind_texture(0, img->gl.target, img->gl.tex[slot]); + _sg_gl_cache_store_texture_sampler_binding(0); + _sg_gl_cache_bind_texture_sampler(0, img->gl.target, img->gl.tex[slot], 0); const int num_faces = img->cmn.type == SG_IMAGETYPE_CUBE ? 6 : 1; int data_index = 0; for (int face_index = 0; face_index < num_faces; face_index++) { @@ -7119,7 +7152,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ } } } - _sg_gl_cache_restore_texture_binding(0); + _sg_gl_cache_restore_texture_sampler_binding(0); } } _SG_GL_CHECK_ERROR(); @@ -7131,7 +7164,7 @@ _SOKOL_PRIVATE void _sg_gl_discard_image(_sg_image_t* img) { _SG_GL_CHECK_ERROR(); for (int slot = 0; slot < img->cmn.num_slots; slot++) { if (img->gl.tex[slot]) { - _sg_gl_cache_invalidate_texture(img->gl.tex[slot]); + _sg_gl_cache_invalidate_texture_sampler(img->gl.tex[slot], 0); if (!img->gl.injected) { glDeleteTextures(1, &img->gl.tex[slot]); } @@ -7202,7 +7235,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_sampler(_sg_sampler_t* smp, const _SOKOL_PRIVATE void _sg_gl_discard_sampler(_sg_sampler_t* smp) { SOKOL_ASSERT(smp); _SG_GL_CHECK_ERROR(); - _sg_gl_cache_invalidate_sampler(smp->gl.smp); + _sg_gl_cache_invalidate_texture_sampler(0, smp->gl.smp); if (!smp->gl.injected) { glDeleteSamplers(1, &smp->gl.smp); } @@ -7218,7 +7251,7 @@ _SOKOL_PRIVATE GLuint _sg_gl_compile_shader(sg_shader_stage stage, const char* s GLint compile_status = 0; glGetShaderiv(gl_shd, GL_COMPILE_STATUS, &compile_status); if (!compile_status) { - /* compilation failed, log error and delete shader */ + // compilation failed, log error and delete shader GLint log_len = 0; glGetShaderiv(gl_shd, GL_INFO_LOG_LENGTH, &log_len); if (log_len > 0) { @@ -7242,7 +7275,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s _sg_shader_common_init(&shd->cmn, desc); - /* copy vertex attribute names over, these are used by, but optional on GLES3 and GL3.x */ + // copy the optional vertex attribute names over for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { _sg_strcpy(&shd->gl.attrs[i].name, desc->attrs[i].name); } @@ -7277,12 +7310,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s } shd->gl.prog = gl_prog; - /* resolve uniforms */ + // resolve uniforms _SG_GL_CHECK_ERROR(); for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS)? &desc->vs : &desc->fs; + const _sg_shader_stage_t* stage = &shd->cmn.stage[stage_index]; _sg_gl_shader_stage_t* gl_stage = &shd->gl.stage[stage_index]; - for (int ub_index = 0; ub_index < shd->cmn.stage[stage_index].num_uniform_blocks; ub_index++) { + for (int ub_index = 0; ub_index < stage->num_uniform_blocks; ub_index++) { const sg_shader_uniform_block_desc* ub_desc = &stage_desc->uniform_blocks[ub_index]; SOKOL_ASSERT(ub_desc->size > 0); _sg_gl_uniform_block_t* ub = &gl_stage->uniform_blocks[ub_index]; @@ -7316,7 +7350,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s } } - /* resolve image locations */ + // resolve combined image samplers _SG_GL_CHECK_ERROR(); GLuint cur_prog = 0; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&cur_prog); @@ -7324,26 +7358,24 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s int gl_tex_slot = 0; for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS)? &desc->vs : &desc->fs; + const _sg_shader_stage_t* stage = &shd->cmn.stage[stage_index]; _sg_gl_shader_stage_t* gl_stage = &shd->gl.stage[stage_index]; - for (int img_index = 0; img_index < shd->cmn.stage[stage_index].num_images; img_index++) { - const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; - SOKOL_ASSERT(img_desc->image_type != _SG_IMAGETYPE_DEFAULT); - _sg_gl_shader_image_t* gl_img = &gl_stage->images[img_index]; - GLint gl_loc = img_index; - if (img_desc->name) { - gl_loc = glGetUniformLocation(gl_prog, img_desc->name); - } + for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { + const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + _sg_gl_shader_image_sampler_t* gl_img_smp = &gl_stage->image_samplers[img_smp_index]; + SOKOL_ASSERT(img_smp_desc->name); + GLint gl_loc = glGetUniformLocation(gl_prog, img_smp_desc->name); if (gl_loc != -1) { - gl_img->gl_tex_slot = gl_tex_slot++; - glUniform1i(gl_loc, gl_img->gl_tex_slot); + gl_img_smp->gl_tex_slot = gl_tex_slot++; + glUniform1i(gl_loc, gl_img_smp->gl_tex_slot); } else { - gl_img->gl_tex_slot = -1; + gl_img_smp->gl_tex_slot = -1; _SG_ERROR(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER); - _SG_LOGMSG(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER, img_desc->name); + _SG_LOGMSG(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER, img_smp_desc->name); } } } - /* it's legal to call glUseProgram with 0 */ + // it's legal to call glUseProgram with 0 glUseProgram(cur_prog); _SG_GL_CHECK_ERROR(); return SG_RESOURCESTATE_VALID; @@ -7993,30 +8025,42 @@ _SOKOL_PRIVATE void _sg_gl_apply_bindings( _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(pip); _SOKOL_UNUSED(num_fs_imgs); _SOKOL_UNUSED(num_vs_imgs); + _SOKOL_UNUSED(num_fs_smps); + _SOKOL_UNUSED(num_vs_smps); _SOKOL_UNUSED(num_vbs); _SG_GL_CHECK_ERROR(); - // bind textures + // bind combined image-samplers _SG_GL_CHECK_ERROR(); for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[stage_index]; const _sg_gl_shader_stage_t* gl_stage = &pip->shader->gl.stage[stage_index]; - _sg_image_t** imgs = (stage_index == SG_SHADERSTAGE_VS)? vs_imgs : fs_imgs; - SOKOL_ASSERT(((stage_index == SG_SHADERSTAGE_VS) ? num_vs_imgs : num_fs_imgs) == stage->num_images); - for (int img_index = 0; img_index < stage->num_images; img_index++) { - const _sg_gl_shader_image_t* gl_shd_img = &gl_stage->images[img_index]; - if (gl_shd_img->gl_tex_slot != -1) { + _sg_image_t** imgs = (stage_index == SG_SHADERSTAGE_VS) ? vs_imgs : fs_imgs; + _sg_sampler_t** smps = (stage_index == SG_SHADERSTAGE_VS) ? vs_smps : fs_smps; + const int num_imgs = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_imgs : num_fs_imgs; + const int num_smps = (stage_index == SG_SHADERSTAGE_FS) ? num_vs_smps : num_fs_smps; + SOKOL_ASSERT(num_imgs == stage->num_images); + SOKOL_ASSERT(num_smps == stage->num_samplers); + for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { + const int gl_tex_slot = gl_stage->image_samplers[img_smp_index].gl_tex_slot; + if (gl_tex_slot != -1) { + const int img_index = stage->image_samplers[img_smp_index].image_slot; + const int smp_index = stage->image_samplers[img_smp_index].sampler_slot; + SOKOL_ASSERT(img_index < num_imgs); + SOKOL_ASSERT(smp_index < num_smps); _sg_image_t* img = imgs[img_index]; - SOKOL_ASSERT(img && img->gl.target); - SOKOL_ASSERT(img->gl.msaa_render_buffer == 0); + _sg_sampler_t* smp = smps[smp_index]; + const GLenum gl_tgt = img->gl.target; const GLuint gl_tex = img->gl.tex[img->cmn.active_slot]; - SOKOL_ASSERT((gl_shd_img->gl_tex_slot != -1) && gl_tex); - _sg_gl_cache_bind_texture(gl_shd_img->gl_tex_slot, img->gl.target, gl_tex); + const GLuint gl_smp = smp->gl.smp; + _sg_gl_cache_bind_texture_sampler(gl_tex_slot, gl_tgt, gl_tex, gl_smp); } } } @@ -8201,14 +8245,14 @@ _SOKOL_PRIVATE int _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* data) { SOKOL_ASSERT(img && data); - /* only one update per image per frame allowed */ + // only one update per image per frame allowed if (++img->cmn.active_slot >= img->cmn.num_slots) { img->cmn.active_slot = 0; } SOKOL_ASSERT(img->cmn.active_slot < SG_NUM_INFLIGHT_FRAMES); SOKOL_ASSERT(0 != img->gl.tex[img->cmn.active_slot]); - _sg_gl_cache_store_texture_binding(0); - _sg_gl_cache_bind_texture(0, img->gl.target, img->gl.tex[img->cmn.active_slot]); + _sg_gl_cache_store_texture_sampler_binding(0); + _sg_gl_cache_bind_texture_sampler(0, img->gl.target, img->gl.tex[img->cmn.active_slot], 0); const GLenum gl_img_format = _sg_gl_teximage_format(img->cmn.pixel_format); const GLenum gl_img_type = _sg_gl_teximage_type(img->cmn.pixel_format); const int num_faces = img->cmn.type == SG_IMAGETYPE_CUBE ? 6 : 1; @@ -8248,7 +8292,7 @@ _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* d } } } - _sg_gl_cache_restore_texture_binding(0); + _sg_gl_cache_restore_texture_sampler_binding(0); } // ██████ ██████ ██████ ██ ██ ██████ █████ ██████ ██ ██ ███████ ███ ██ ██████ From 15ae9b600a82ae96d3e6675e7e9def19d2dd16f2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 10 Jun 2023 17:43:42 +0200 Subject: [PATCH 021/292] sokol_gfx.h gl: shader-desc combined image sampler validation --- sokol_gfx.h | 68 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7eb73da42..a221c8647 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2948,8 +2948,13 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_SIZE_MISMATCH, "size of uniform block members doesn't match uniform block size") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_ARRAY_COUNT, "uniform array count must be >= 1") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_STD140_ARRAY_TYPE, "uniform arrays only allowed for FLOAT4, INT4, MAT4 in std140 layout") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMGS, "shader images must occupy continuous slots (sg_shader_desc.vs|fs.images[])") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_SMPS, "shader samplers must occupy continuous slots (sg_shader_desc.vs|fs.samplers[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGES, "shader stage images must occupy continuous slots (sg_shader_desc.vs|fs.images[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_SAMPLERS, "shader stage samplers must occupy continuous slots (sg_shader_desc.vs|fs.samplers[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_samplers[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_samplers[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLERS, "shader stage image-samplers: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_samplers[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLERS, "shader stage image-samplers: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_samplers[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLERS, "shader stage combined image samplers must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_SEMANTICS, "D3D11 backend requires vertex attribute semantics") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_STRING_TOO_LONG, "vertex attribute name/semantic string too long (max len 16)") \ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_CANARY, "sg_pipeline_desc not initialized") \ @@ -6772,7 +6777,8 @@ _SOKOL_PRIVATE void _sg_gl_cache_active_texture(GLenum texture) { } } -_SOKOL_PRIVATE void _sg_gl_cache_clear_texture_bindings(bool force) { +_SOKOL_PRIVATE void _sg_gl_cache_clear_texture_sampler_bindings(bool force) { + _SG_GL_CHECK_ERROR(); for (int i = 0; (i < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE) && (i < _sg.limits.gl_max_combined_texture_image_units); i++) { if (force || (_sg.gl.cache.texture_samplers[i].texture != 0)) { GLenum gl_texture_unit = (GLenum) (GL_TEXTURE0 + i); @@ -6781,13 +6787,14 @@ _SOKOL_PRIVATE void _sg_gl_cache_clear_texture_bindings(bool force) { glBindTexture(GL_TEXTURE_CUBE_MAP, 0); glBindTexture(GL_TEXTURE_3D, 0); glBindTexture(GL_TEXTURE_2D_ARRAY, 0); - glBindSampler(gl_texture_unit, 0); + glBindSampler((GLuint)i, 0); _sg.gl.cache.texture_samplers[i].target = 0; _sg.gl.cache.texture_samplers[i].texture = 0; _sg.gl.cache.texture_samplers[i].sampler = 0; _sg.gl.cache.cur_active_texture = gl_texture_unit; } } + _SG_GL_CHECK_ERROR(); } _SOKOL_PRIVATE void _sg_gl_cache_bind_texture_sampler(int slot_index, GLenum target, GLuint texture, GLuint sampler) { @@ -6888,7 +6895,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { _sg_clear(&_sg.gl.cache, sizeof(_sg.gl.cache)); _sg_gl_cache_clear_buffer_bindings(true); _SG_GL_CHECK_ERROR(); - _sg_gl_cache_clear_texture_bindings(true); + _sg_gl_cache_clear_texture_sampler_bindings(true); _SG_GL_CHECK_ERROR(); for (int i = 0; i < _sg.limits.max_vertex_attrs; i++) { _sg_gl_attr_t* attr = &_sg.gl.cache.attrs[i].gl_attr; @@ -6899,11 +6906,11 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { } _sg.gl.cache.cur_primitive_type = GL_TRIANGLES; - /* shader program */ + // shader program glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&_sg.gl.cache.prog); _SG_GL_CHECK_ERROR(); - /* depth and stencil state */ + // depth and stencil state _sg.gl.cache.depth.compare = SG_COMPAREFUNC_ALWAYS; _sg.gl.cache.stencil.front.compare = SG_COMPAREFUNC_ALWAYS; _sg.gl.cache.stencil.front.fail_op = SG_STENCILOP_KEEP; @@ -6921,7 +6928,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0); - /* blend state */ + // blend state _sg.gl.cache.blend.src_factor_rgb = SG_BLENDFACTOR_ONE; _sg.gl.cache.blend.dst_factor_rgb = SG_BLENDFACTOR_ZERO; _sg.gl.cache.blend.op_rgb = SG_BLENDOP_ADD; @@ -6933,7 +6940,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); glBlendColor(0.0f, 0.0f, 0.0f, 0.0f); - /* standalone state */ + // standalone state for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { _sg.gl.cache.color_write_mask[i] = SG_COLORMASK_RGBA; } @@ -6959,14 +6966,14 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { _SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) { _SOKOL_UNUSED(desc); - /* assumes that _sg.gl is already zero-initialized */ + // assumes that _sg.gl is already zero-initialized _sg.gl.valid = true; #if defined(_SOKOL_USE_WIN32_GL_LOADER) _sg_gl_load_opengl(); #endif - /* clear initial GL error state */ + // clear initial GL error state #if defined(SOKOL_DEBUG) while (glGetError() != GL_NO_ERROR); #endif @@ -8201,7 +8208,7 @@ _SOKOL_PRIVATE void _sg_gl_commit(void) { SOKOL_ASSERT(!_sg.gl.in_pass); /* "soft" clear bindings (only those that are actually bound) */ _sg_gl_cache_clear_buffer_bindings(false); - _sg_gl_cache_clear_texture_bindings(false); + _sg_gl_cache_clear_texture_sampler_bindings(false); } _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { @@ -14744,23 +14751,56 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { } } bool images_continuous = true; + int num_images = 0; for (int img_index = 0; img_index < SG_MAX_SHADERSTAGE_IMAGES; img_index++) { const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; if (img_desc->image_type != _SG_IMAGETYPE_DEFAULT) { - _SG_VALIDATE(images_continuous, VALIDATE_SHADERDESC_NO_CONT_IMGS); + _SG_VALIDATE(images_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGES); + num_images++; } else { images_continuous = false; } } bool samplers_continuous = true; + int num_samplers = 0; for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; if (smp_desc->type != _SG_SAMPLERTYPE_DEFAULT) { - _SG_VALIDATE(samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_SMPS); + _SG_VALIDATE(samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_SAMPLERS); + num_samplers++; } else { samplers_continuous = false; } } + #if defined(_SOKOL_ANY_GL) + bool image_samplers_continuous = true; + int num_image_samplers = 0; + for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { + const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + if (img_smp_desc->name != 0) { + _SG_VALIDATE(image_samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLERS); + num_image_samplers++; + const bool img_slot_in_range = (img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < SG_MAX_SHADERSTAGE_IMAGES); + const bool smp_slot_in_range = (img_smp_desc->sampler_slot >= 0) && (img_smp_desc->sampler_slot < SG_MAX_SHADERSTAGE_SAMPLERS); + _SG_VALIDATE(img_slot_in_range && (img_smp_desc->image_slot < num_images), VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE); + _SG_VALIDATE(smp_slot_in_range && (img_smp_desc->sampler_slot < num_samplers), VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE); + } else { + image_samplers_continuous = false; + } + } + // each image and sampler must be referenced by an image sampler + const uint32_t expected_img_slot_mask = (1 << num_images) - 1; + const uint32_t expected_smp_slot_mask = (1 << num_samplers) - 1; + uint32_t actual_img_slot_mask = 0; + uint32_t actual_smp_slot_mask = 0; + for (int img_smp_index = 0; img_smp_index < num_image_samplers; img_smp_index++) { + const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + actual_img_slot_mask |= (1 << ((uint32_t)img_smp_desc->image_slot & 31)); + actual_smp_slot_mask |= (1 << ((uint32_t)img_smp_desc->sampler_slot & 31)); + } + _SG_VALIDATE(expected_img_slot_mask == actual_img_slot_mask, VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLERS); + _SG_VALIDATE(expected_smp_slot_mask == actual_smp_slot_mask, VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLERS); + #endif } return _sg_validate_end(); #endif From cfd8e7a9fa6cd1ed9646ad6c44672d143cc7e7b2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 11 Jun 2023 12:15:04 +0200 Subject: [PATCH 022/292] sokol_gfx.h gl: sampler objects wip --- sokol_gfx.h | 127 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 36 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a221c8647..bf5220fb6 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1702,13 +1702,18 @@ typedef enum sg_primitive_type { 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. + used in the sg_sampler_desc.min_filter, sg_sampler_desc.mag_filter + and sg_sampler_desc.mipmap_filter members when creating a sampler object. - The default filter mode is SG_FILTER_NEAREST. + For min_filter and mag_filter the default is SG_FILTER_NEAREST. + + For mipmap_filter the default is SG_FILTER_NONE. + + NOTE: an image object with (num_mipmaps == 1) *must* use SG_MIPMAP_FILTER_NONE. */ typedef enum sg_filter { - _SG_FILTER_DEFAULT, /* value 0 reserved for default-init */ + _SG_FILTER_DEFAULT, // value 0 reserved for default-init + SG_FILTER_NONE, SG_FILTER_NEAREST, SG_FILTER_LINEAR, _SG_FILTER_NUM, @@ -2293,15 +2298,6 @@ typedef struct sg_image_data { .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 targets - .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 .data an sg_image_data struct to define the initial content .label 0 (optional string label for trace hooks) @@ -2368,6 +2364,18 @@ typedef struct sg_image_desc { sg_sampler_desc FIXME + + .min_filter: SG_FILTER_NEAREST + .mag_filter: SG_FILTER_NEAREST + .mipmap_filter SG_FILTER_NONE + .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 + */ typedef struct sg_sampler_desc { uint32_t _start_canary; @@ -2936,6 +2944,9 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_IMAGEDESC_INJECTED_NO_DATA, "images with injected textures cannot be initialized with data") \ _SG_LOGITEM_XMACRO(VALIDATE_IMAGEDESC_DYNAMIC_NO_DATA, "dynamic/stream images cannot be initialized with data") \ _SG_LOGITEM_XMACRO(VALIDATE_IMAGEDESC_COMPRESSED_IMMUTABLE, "compressed images must be immutable") \ + _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_CANARY, "sg_sampler_desc not initialized") \ + _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MINFILTER_NONE, "sg_sampler_desc.min_filter cannot be SG_FILTER_NONE") \ + _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MAGFILTER_NONE, "sg_sampler_desc.mag_filter cannot be SG_FILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_CANARY, "sg_shader_desc not initialized") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SOURCE, "shader source code required") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_BYTECODE, "shader byte code required") \ @@ -3029,6 +3040,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to vertex stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ @@ -3040,6 +3052,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to fragment stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_UB_AT_SLOT, "sg_apply_uniforms: no uniform block declaration at this shader stage UB slot") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_SIZE, "sg_apply_uniforms: data size exceeds declared uniform block size") \ @@ -4154,6 +4167,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh stage->image_samplers[img_smp_index].image_slot = img_smp_desc->image_slot; SOKOL_ASSERT((img_smp_desc->sampler_slot >= 0) && (img_smp_desc->sampler_slot < stage->num_samplers)); stage->image_samplers[img_smp_index].sampler_slot = img_smp_desc->sampler_slot; + stage->num_image_samplers++; } } } @@ -6097,17 +6111,21 @@ _SOKOL_PRIVATE GLenum _sg_gl_blend_op(sg_blend_op op) { _SOKOL_PRIVATE GLenum _sg_gl_min_filter(sg_filter min_f, sg_filter mipmap_f) { if (min_f == SG_FILTER_NEAREST) { - if (mipmap_f == SG_FILTER_NEAREST) { - return GL_NEAREST_MIPMAP_NEAREST; - } else { - return GL_NEAREST_MIPMAP_LINEAR; + switch (mipmap_f) { + case SG_FILTER_NONE: return GL_NEAREST; + case SG_FILTER_NEAREST: return GL_NEAREST_MIPMAP_NEAREST; + case SG_FILTER_LINEAR: return GL_NEAREST_MIPMAP_LINEAR; + default: SOKOL_UNREACHABLE; return (GLenum)0; + } + } else if (min_f == SG_FILTER_LINEAR) { + switch (mipmap_f) { + case SG_FILTER_NONE: return GL_LINEAR; + case SG_FILTER_NEAREST: return GL_LINEAR_MIPMAP_NEAREST; + case SG_FILTER_LINEAR: return GL_LINEAR_MIPMAP_LINEAR; + default: SOKOL_UNREACHABLE; return (GLenum)0; } } else { - if (mipmap_f == SG_FILTER_NEAREST) { - return GL_LINEAR_MIPMAP_NEAREST; - } else { - return GL_LINEAR_MIPMAP_LINEAR; - } + SOKOL_UNREACHABLE; return (GLenum)0; } } @@ -6771,10 +6789,12 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_buffer(GLuint buf) { } _SOKOL_PRIVATE void _sg_gl_cache_active_texture(GLenum texture) { + _SG_GL_CHECK_ERROR(); if (_sg.gl.cache.cur_active_texture != texture) { _sg.gl.cache.cur_active_texture = texture; glActiveTexture(texture); } + _SG_GL_CHECK_ERROR(); } _SOKOL_PRIVATE void _sg_gl_cache_clear_texture_sampler_bindings(bool force) { @@ -6806,19 +6826,23 @@ _SOKOL_PRIVATE void _sg_gl_cache_bind_texture_sampler(int slot_index, GLenum tar if (slot_index >= _sg.limits.gl_max_combined_texture_image_units) { return; } + _SG_GL_CHECK_ERROR(); _sg_gl_cache_texture_sampler_bind_slot* slot = &_sg.gl.cache.texture_samplers[slot_index]; if ((slot->target != target) || (slot->texture != texture) || (slot->sampler != sampler)) { _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + slot_index)); // if the target has changed, clear the previous binding on that target if ((target != slot->target) && (slot->target != 0)) { glBindTexture(slot->target, 0); + _SG_GL_CHECK_ERROR(); } // apply new binding (can be 0 to unbind) if (target != 0) { glBindTexture(target, texture); + _SG_GL_CHECK_ERROR(); } // apply new sampler (can be 0 to unbind) glBindSampler((GLuint)slot_index, sampler); + _SG_GL_CHECK_ERROR(); slot->target = target; slot->texture = texture; @@ -6846,12 +6870,15 @@ _SOKOL_PRIVATE void _sg_gl_cache_restore_texture_sampler_binding(int slot_index) // called from _sg_gl_discard_texture() and _sg_gl_discard_sampler() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture_sampler(GLuint tex, GLuint smp) { + _SG_GL_CHECK_ERROR(); for (int i = 0; i < _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE; i++) { _sg_gl_cache_texture_sampler_bind_slot* slot = &_sg.gl.cache.texture_samplers[i]; - if ((tex == slot->texture) || (smp == slot->sampler)) { + if ((0 != slot->target) && ((tex == slot->texture) || (smp == slot->sampler))) { _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + i)); glBindTexture(slot->target, 0); - glBindSampler((GLuint)i, slot->sampler); + _SG_GL_CHECK_ERROR(); + glBindSampler((GLuint)i, 0); + _SG_GL_CHECK_ERROR(); slot->target = 0; slot->texture = 0; slot->sampler = 0; @@ -8037,10 +8064,6 @@ _SOKOL_PRIVATE void _sg_gl_apply_bindings( _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(pip); - _SOKOL_UNUSED(num_fs_imgs); - _SOKOL_UNUSED(num_vs_imgs); - _SOKOL_UNUSED(num_fs_smps); - _SOKOL_UNUSED(num_vs_smps); _SOKOL_UNUSED(num_vbs); _SG_GL_CHECK_ERROR(); @@ -8052,7 +8075,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_bindings( _sg_image_t** imgs = (stage_index == SG_SHADERSTAGE_VS) ? vs_imgs : fs_imgs; _sg_sampler_t** smps = (stage_index == SG_SHADERSTAGE_VS) ? vs_smps : fs_smps; const int num_imgs = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_imgs : num_fs_imgs; - const int num_smps = (stage_index == SG_SHADERSTAGE_FS) ? num_vs_smps : num_fs_smps; + const int num_smps = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_smps : num_fs_smps; SOKOL_ASSERT(num_imgs == stage->num_images); SOKOL_ASSERT(num_smps == stage->num_samplers); for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { @@ -10500,8 +10523,8 @@ _SOKOL_PRIVATE MTLSamplerBorderColor _sg_mtl_border_color(sg_border_color c) { } #endif -_SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter minmag_filter) { - switch (minmag_filter) { +_SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter f) { + switch (f) { case SG_FILTER_NEAREST: return MTLSamplerMinMagFilterNearest; case SG_FILTER_LINEAR: @@ -10511,8 +10534,10 @@ _SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter minmag_fil } } -_SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mipmap_filter(sg_filter mipmap_filter) { - switch (mipmap_filter) { +_SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mipmap_filter(sg_filter f) { + switch (f) { + case SG_FILTER_NONE: + return MTLSamplerMipFilterNotMipmapped; case SG_FILTER_NEAREST: return MTLSamplerMipFilterNearest; case SG_FILTER_LINEAR: @@ -14654,8 +14679,10 @@ _SOKOL_PRIVATE bool _sg_validate_sampler_desc(const sg_sampler_desc* desc) { } SOKOL_ASSERT(desc); _sg_validate_begin(); - _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_IMAGEDESC_CANARY); - _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_IMAGEDESC_CANARY); + _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_SAMPLERDESC_CANARY); + _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_SAMPLERDESC_CANARY); + _SG_VALIDATE(desc->min_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MINFILTER_NONE); + _SG_VALIDATE(desc->mag_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MAGFILTER_NONE); return _sg_validate_end(); #endif } @@ -15166,6 +15193,34 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { _SG_VALIDATE(bindings->fs.samplers[i].id == SG_INVALID_ID, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING); } } + + // if image-sampler info was provided in shader desc, check that that the mipmap filter matches image num mipmaps + for (int img_smp_index = 0; img_smp_index < pip->shader->cmn.stage[SG_SHADERSTAGE_VS].num_image_samplers; img_smp_index++) { + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; + const int img_index = stage->image_samplers[img_smp_index].image_slot; + const int smp_index = stage->image_samplers[img_smp_index].sampler_slot; + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[img_index].id); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[smp_index].id); + if (img && smp) { + if (img->cmn.num_mipmaps == 1) { + _SG_VALIDATE(smp->cmn.mipmap_filter == SG_FILTER_NONE, VALIDATE_ABND_VS_IMG_SMP_MIPMAPS); + } + } + } + for (int img_smp_index = 0; img_smp_index < pip->shader->cmn.stage[SG_SHADERSTAGE_FS].num_image_samplers; img_smp_index++) { + const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; + const int img_index = stage->image_samplers[img_smp_index].image_slot; + const int smp_index = stage->image_samplers[img_smp_index].sampler_slot; + SOKOL_ASSERT(img_index < stage->num_images); + SOKOL_ASSERT(smp_index < stage->num_samplers); + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[img_index].id); + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[smp_index].id); + if (img && smp) { + if (img->cmn.num_mipmaps == 1) { + _SG_VALIDATE(smp->cmn.mipmap_filter == SG_FILTER_NONE, VALIDATE_ABND_FS_IMG_SMP_MIPMAPS); + } + } + } return _sg_validate_end(); #endif } @@ -15299,7 +15354,7 @@ _SOKOL_PRIVATE sg_sampler_desc _sg_sampler_desc_defaults(const sg_sampler_desc* sg_sampler_desc def = *desc; def.min_filter = _sg_def(def.min_filter, SG_FILTER_NEAREST); def.mag_filter = _sg_def(def.mag_filter, SG_FILTER_NEAREST); - def.mipmap_filter = _sg_def(def.mipmap_filter, SG_FILTER_NEAREST); + def.mipmap_filter = _sg_def(def.mipmap_filter, SG_FILTER_NONE); def.wrap_u = _sg_def(def.wrap_u, SG_WRAP_REPEAT); def.wrap_v = _sg_def(def.wrap_v, SG_WRAP_REPEAT); def.wrap_w = _sg_def(def.wrap_w, SG_WRAP_REPEAT); From 88c143a95bf7a9d02385b1a42a77d4096f761761 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 11 Jun 2023 12:56:08 +0200 Subject: [PATCH 023/292] sokol_gfx.h: rename image_sampler to image_sampler_pair and make them mandatory in all backends --- sokol_gfx.h | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index bf5220fb6..cfb7e8e3a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2462,12 +2462,12 @@ typedef struct sg_shader_sampler_desc { sg_sampler_type type; } sg_shader_sampler_desc; -// combined image samplers are only needed for GL -typedef struct sg_shader_image_sampler_desc { - const char* name; // required for GLSL +typedef struct sg_shader_image_sampler_pair_desc { + bool valid; int image_slot; // index into sg_shader_stage_desc.images int sampler_slot; // index into sg_shader_stage_desc.samplers -} sg_shader_image_sampler_desc; + const char* name; // only required for GLSL, ignored in D3D and Metal +} sg_shader_image_sampler_pair_desc; typedef struct sg_shader_stage_desc { const char* source; @@ -2477,7 +2477,7 @@ typedef struct sg_shader_stage_desc { sg_shader_uniform_block_desc uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; sg_shader_image_desc images[SG_MAX_SHADERSTAGE_IMAGES]; sg_shader_sampler_desc samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; - sg_shader_image_sampler_desc image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; + sg_shader_image_sampler_pair_desc image_sampler_pairs[SG_MAX_SHADERSTAGE_IMAGES]; } sg_shader_stage_desc; typedef struct sg_shader_desc { @@ -2961,11 +2961,15 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_STD140_ARRAY_TYPE, "uniform arrays only allowed for FLOAT4, INT4, MAT4 in std140 layout") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGES, "shader stage images must occupy continuous slots (sg_shader_desc.vs|fs.images[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_SAMPLERS, "shader stage samplers must occupy continuous slots (sg_shader_desc.vs|fs.samplers[])") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_samplers[].image_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_samplers[].sampler_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLERS, "shader stage image-samplers: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_samplers[].image_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLERS, "shader stage image-samplers: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_samplers[].sampler_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLERS, "shader stage combined image samplers must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL, "shader stage image-sampler pairs must be named in GL (sg_shader_desc.vs|fs.image_sampler_pairs[].name)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_VALID, "shader stage image-sampler pair has name but .valid field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_VALID, "shader stage image-sampler pair has .image_slot != 0 but .valid field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_VALID, "shader stage image-sampler pair .sampler_slot != 0 but .valid field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-samplers pairs: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image sampler pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_SEMANTICS, "D3D11 backend requires vertex attribute semantics") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_STRING_TOO_LONG, "vertex attribute name/semantic string too long (max len 16)") \ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_CANARY, "sg_pipeline_desc not initialized") \ @@ -4159,7 +4163,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh } SOKOL_ASSERT(stage->num_image_samplers == 0); for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { - const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; if (img_smp_desc->name == 0) { break; } @@ -7395,7 +7399,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s const _sg_shader_stage_t* stage = &shd->cmn.stage[stage_index]; _sg_gl_shader_stage_t* gl_stage = &shd->gl.stage[stage_index]; for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { - const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; _sg_gl_shader_image_sampler_t* gl_img_smp = &gl_stage->image_samplers[img_smp_index]; SOKOL_ASSERT(img_smp_desc->name); GLint gl_loc = glGetUniformLocation(gl_prog, img_smp_desc->name); @@ -14799,19 +14803,24 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { samplers_continuous = false; } } - #if defined(_SOKOL_ANY_GL) bool image_samplers_continuous = true; int num_image_samplers = 0; for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { - const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; - if (img_smp_desc->name != 0) { - _SG_VALIDATE(image_samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLERS); + const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; + if (img_smp_desc->valid) { + _SG_VALIDATE(image_samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS); num_image_samplers++; const bool img_slot_in_range = (img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < SG_MAX_SHADERSTAGE_IMAGES); const bool smp_slot_in_range = (img_smp_desc->sampler_slot >= 0) && (img_smp_desc->sampler_slot < SG_MAX_SHADERSTAGE_SAMPLERS); - _SG_VALIDATE(img_slot_in_range && (img_smp_desc->image_slot < num_images), VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE); - _SG_VALIDATE(smp_slot_in_range && (img_smp_desc->sampler_slot < num_samplers), VALIDATE_SHADERDESC_IMAGE_SAMPLER_IMAGE_SLOT_OUT_OF_RANGE); + _SG_VALIDATE(img_slot_in_range && (img_smp_desc->image_slot < num_images), VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE); + _SG_VALIDATE(smp_slot_in_range && (img_smp_desc->sampler_slot < num_samplers), VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE); + #if defined(_SOKOL_ANY_GL) + _SG_VALIDATE(img_smp_desc->name != 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL); + #endif } else { + _SG_VALIDATE(img_smp_desc->name == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_VALID); + _SG_VALIDATE(img_smp_desc->image_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_VALID); + _SG_VALIDATE(img_smp_desc->sampler_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_VALID); image_samplers_continuous = false; } } @@ -14821,13 +14830,12 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { uint32_t actual_img_slot_mask = 0; uint32_t actual_smp_slot_mask = 0; for (int img_smp_index = 0; img_smp_index < num_image_samplers; img_smp_index++) { - const sg_shader_image_sampler_desc* img_smp_desc = &stage_desc->image_samplers[img_smp_index]; + const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; actual_img_slot_mask |= (1 << ((uint32_t)img_smp_desc->image_slot & 31)); actual_smp_slot_mask |= (1 << ((uint32_t)img_smp_desc->sampler_slot & 31)); } - _SG_VALIDATE(expected_img_slot_mask == actual_img_slot_mask, VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLERS); - _SG_VALIDATE(expected_smp_slot_mask == actual_smp_slot_mask, VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLERS); - #endif + _SG_VALIDATE(expected_img_slot_mask == actual_img_slot_mask, VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS); + _SG_VALIDATE(expected_smp_slot_mask == actual_smp_slot_mask, VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS); } return _sg_validate_end(); #endif From 7577dfa0d2fa85b72adeb07617ac86e9e1c6d393 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 11 Jun 2023 13:06:28 +0200 Subject: [PATCH 024/292] sokol_gfx.h: image-sampler-pair fix --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index cfb7e8e3a..8c70ad884 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4164,7 +4164,7 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh SOKOL_ASSERT(stage->num_image_samplers == 0); for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; - if (img_smp_desc->name == 0) { + if (!img_smp_desc->valid) { break; } SOKOL_ASSERT((img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < stage->num_images)); From 5aef05dbd84efe12c749d78eef7ba4119d2d9402 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 12 Jun 2023 20:33:29 +0200 Subject: [PATCH 025/292] sokol_gfx.h: fix validation message typo --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 8c70ad884..3cabb158d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2967,7 +2967,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_VALID, "shader stage image-sampler pair has name but .valid field not true") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_VALID, "shader stage image-sampler pair has .image_slot != 0 but .valid field not true") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_VALID, "shader stage image-sampler pair .sampler_slot != 0 but .valid field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-samplers pairs: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image sampler pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_SEMANTICS, "D3D11 backend requires vertex attribute semantics") \ From facd53fdf15b5d893bcefd98f613d3ed27375215 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 13 Jun 2023 19:34:17 +0200 Subject: [PATCH 026/292] sokol_gfx.h: image vs sampler vs image-sampler-pairs code cleanup --- sokol_gfx.h | 83 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3cabb158d..811648e2e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1293,6 +1293,7 @@ enum { SG_MAX_VERTEX_BUFFERS = 8, SG_MAX_SHADERSTAGE_IMAGES = 12, SG_MAX_SHADERSTAGE_SAMPLERS = 8, + SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS = 12, SG_MAX_SHADERSTAGE_UBS = 4, SG_MAX_UB_MEMBERS = 16, SG_MAX_VERTEX_ATTRIBUTES = 16, @@ -2453,20 +2454,22 @@ typedef struct sg_shader_uniform_block_desc { } sg_shader_uniform_block_desc; typedef struct sg_shader_image_desc { + bool used; + bool multisampled; sg_image_type image_type; sg_image_sample_type sample_type; - bool multisampled; } sg_shader_image_desc; typedef struct sg_shader_sampler_desc { - sg_sampler_type type; + bool used; + sg_sampler_type sampler_type; } sg_shader_sampler_desc; typedef struct sg_shader_image_sampler_pair_desc { - bool valid; - int image_slot; // index into sg_shader_stage_desc.images - int sampler_slot; // index into sg_shader_stage_desc.samplers - const char* name; // only required for GLSL, ignored in D3D and Metal + bool used; + int image_slot; + int sampler_slot; + const char* glsl_name; } sg_shader_image_sampler_pair_desc; typedef struct sg_shader_stage_desc { @@ -2477,7 +2480,7 @@ typedef struct sg_shader_stage_desc { sg_shader_uniform_block_desc uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; sg_shader_image_desc images[SG_MAX_SHADERSTAGE_IMAGES]; sg_shader_sampler_desc samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; - sg_shader_image_sampler_pair_desc image_sampler_pairs[SG_MAX_SHADERSTAGE_IMAGES]; + sg_shader_image_sampler_pair_desc image_sampler_pairs[SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS]; } sg_shader_stage_desc; typedef struct sg_shader_desc { @@ -2964,9 +2967,9 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL, "shader stage image-sampler pairs must be named in GL (sg_shader_desc.vs|fs.image_sampler_pairs[].name)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_VALID, "shader stage image-sampler pair has name but .valid field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_VALID, "shader stage image-sampler pair has .image_slot != 0 but .valid field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_VALID, "shader stage image-sampler pair .sampler_slot != 0 but .valid field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED, "shader stage image-sampler pair has name but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED, "shader stage image-sampler pair has .image_slot != 0 but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_USED, "shader stage image-sampler pair .sampler_slot != 0 but .used field not true") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image sampler pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ @@ -4102,10 +4105,11 @@ typedef struct { typedef struct { sg_image_type image_type; sg_image_sample_type sample_type; + bool multisampled; } _sg_shader_image_t; typedef struct { - sg_sampler_type type; + sg_sampler_type sampler_type; } _sg_shader_sampler_t; // combined image sampler mappings, only needed on GL @@ -4122,7 +4126,7 @@ typedef struct { _sg_shader_uniform_block_t uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; _sg_shader_image_t images[SG_MAX_SHADERSTAGE_IMAGES]; _sg_shader_sampler_t samplers[SG_MAX_SHADERSTAGE_SAMPLERS]; - _sg_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS]; } _sg_shader_stage_t; typedef struct { @@ -4145,9 +4149,10 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh SOKOL_ASSERT(stage->num_images == 0); for (int img_index = 0; img_index < SG_MAX_SHADERSTAGE_IMAGES; img_index++) { const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; - if (img_desc->image_type == _SG_IMAGETYPE_DEFAULT) { + if (!img_desc->used) { break; } + stage->images[img_index].multisampled = img_desc->multisampled; stage->images[img_index].image_type = img_desc->image_type; stage->images[img_index].sample_type = img_desc->sample_type; stage->num_images++; @@ -4155,16 +4160,16 @@ _SOKOL_PRIVATE void _sg_shader_common_init(_sg_shader_common_t* cmn, const sg_sh SOKOL_ASSERT(stage->num_samplers == 0); for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; - if (smp_desc->type == _SG_SAMPLERTYPE_DEFAULT) { + if (!smp_desc->used) { break; } - stage->samplers[smp_index].type = smp_desc->type; + stage->samplers[smp_index].sampler_type = smp_desc->sampler_type; stage->num_samplers++; } SOKOL_ASSERT(stage->num_image_samplers == 0); - for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { + for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS; img_smp_index++) { const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; - if (!img_smp_desc->valid) { + if (!img_smp_desc->used) { break; } SOKOL_ASSERT((img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < stage->num_images)); @@ -4357,7 +4362,7 @@ typedef struct { typedef struct { _sg_gl_uniform_block_t uniform_blocks[SG_MAX_SHADERSTAGE_UBS]; - _sg_gl_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_gl_shader_image_sampler_t image_samplers[SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS]; } _sg_gl_shader_stage_t; typedef struct { @@ -4436,7 +4441,7 @@ typedef struct { GLuint sampler; } _sg_gl_cache_texture_sampler_bind_slot; -#define _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE (SG_MAX_SHADERSTAGE_IMAGES * SG_NUM_SHADER_STAGES) +#define _SG_GL_TEXTURE_SAMPLER_CACHE_SIZE (SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS * SG_NUM_SHADER_STAGES) typedef struct { sg_depth_state depth; @@ -7401,15 +7406,15 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; _sg_gl_shader_image_sampler_t* gl_img_smp = &gl_stage->image_samplers[img_smp_index]; - SOKOL_ASSERT(img_smp_desc->name); - GLint gl_loc = glGetUniformLocation(gl_prog, img_smp_desc->name); + SOKOL_ASSERT(img_smp_desc->glsl_name); + GLint gl_loc = glGetUniformLocation(gl_prog, img_smp_desc->glsl_name); if (gl_loc != -1) { gl_img_smp->gl_tex_slot = gl_tex_slot++; glUniform1i(gl_loc, gl_img_smp->gl_tex_slot); } else { gl_img_smp->gl_tex_slot = -1; _SG_ERROR(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER); - _SG_LOGMSG(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER, img_smp_desc->name); + _SG_LOGMSG(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER, img_smp_desc->glsl_name); } } } @@ -14785,7 +14790,7 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { int num_images = 0; for (int img_index = 0; img_index < SG_MAX_SHADERSTAGE_IMAGES; img_index++) { const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; - if (img_desc->image_type != _SG_IMAGETYPE_DEFAULT) { + if (img_desc->used) { _SG_VALIDATE(images_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGES); num_images++; } else { @@ -14796,7 +14801,7 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { int num_samplers = 0; for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; - if (smp_desc->type != _SG_SAMPLERTYPE_DEFAULT) { + if (smp_desc->used) { _SG_VALIDATE(samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_SAMPLERS); num_samplers++; } else { @@ -14805,9 +14810,9 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { } bool image_samplers_continuous = true; int num_image_samplers = 0; - for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGES; img_smp_index++) { + for (int img_smp_index = 0; img_smp_index < SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS; img_smp_index++) { const sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_index]; - if (img_smp_desc->valid) { + if (img_smp_desc->used) { _SG_VALIDATE(image_samplers_continuous, VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS); num_image_samplers++; const bool img_slot_in_range = (img_smp_desc->image_slot >= 0) && (img_smp_desc->image_slot < SG_MAX_SHADERSTAGE_IMAGES); @@ -14815,12 +14820,12 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { _SG_VALIDATE(img_slot_in_range && (img_smp_desc->image_slot < num_images), VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE); _SG_VALIDATE(smp_slot_in_range && (img_smp_desc->sampler_slot < num_samplers), VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE); #if defined(_SOKOL_ANY_GL) - _SG_VALIDATE(img_smp_desc->name != 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL); + _SG_VALIDATE(img_smp_desc->glsl_name != 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL); #endif } else { - _SG_VALIDATE(img_smp_desc->name == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_VALID); - _SG_VALIDATE(img_smp_desc->image_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_VALID); - _SG_VALIDATE(img_smp_desc->sampler_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_VALID); + _SG_VALIDATE(img_smp_desc->glsl_name == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED); + _SG_VALIDATE(img_smp_desc->image_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED); + _SG_VALIDATE(img_smp_desc->sampler_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_USED); image_samplers_continuous = false; } } @@ -15144,13 +15149,13 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected vertex shader image samplers for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; - if (stage->samplers[i].type != _SG_SAMPLERTYPE_DEFAULT) { + if (stage->samplers[i].sampler_type != _SG_SAMPLERTYPE_DEFAULT) { _SG_VALIDATE(bindings->vs.samplers[i].id != SG_INVALID_ID, VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING); if (bindings->vs.samplers[i].id != SG_INVALID_ID) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARE) { + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARE) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER); @@ -15184,13 +15189,13 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { // has expected fragment shader samplers for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; - if (stage->samplers[i].type != _SG_SAMPLERTYPE_DEFAULT) { + if (stage->samplers[i].sampler_type != _SG_SAMPLERTYPE_DEFAULT) { _SG_VALIDATE(bindings->fs.samplers[i].id != SG_INVALID_ID, VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING); if (bindings->fs.samplers[i].id != SG_INVALID_ID) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].type == SG_SAMPLERTYPE_COMPARE) { + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARE) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER); @@ -15408,11 +15413,19 @@ _SOKOL_PRIVATE sg_shader_desc _sg_shader_desc_defaults(const sg_shader_desc* des } for (int img_index = 0; img_index < SG_MAX_SHADERSTAGE_IMAGES; img_index++) { sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; - if (img_desc->image_type == _SG_IMAGETYPE_DEFAULT) { + if (!img_desc->used) { break; } + img_desc->image_type = _sg_def(img_desc->image_type, SG_IMAGETYPE_2D); img_desc->sample_type = _sg_def(img_desc->sample_type, SG_IMAGESAMPLETYPE_FLOAT); } + for (int smp_index = 0; smp_index < SG_MAX_SHADERSTAGE_SAMPLERS; smp_index++) { + sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; + if (!smp_desc->used) { + break; + } + smp_desc->sampler_type = _sg_def(smp_desc->sampler_type, SG_SAMPLERTYPE_SAMPLE); + } } return def; } From 532ef730d874c33068f67ead8e7b813de48642eb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 17 Jun 2023 13:47:27 +0200 Subject: [PATCH 027/292] sokol_shape.h: fixes for sokol_gfx.h struct name changes --- util/sokol_shape.h | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/util/sokol_shape.h b/util/sokol_shape.h index 419181fae..a02b43394 100644 --- a/util/sokol_shape.h +++ b/util/sokol_shape.h @@ -198,11 +198,11 @@ sshape_element_range_t sshape_element_range(const sshape_buffer_t* buf); sg_buffer_desc sshape_vertex_buffer_desc(const sshape_buffer_t* buf); sg_buffer_desc sshape_index_buffer_desc(const sshape_buffer_t* buf); - sg_buffer_layout_desc sshape_buffer_layout_desc(void); - sg_vertex_attr_desc sshape_position_attr_desc(void); - sg_vertex_attr_desc sshape_normal_attr_desc(void); - sg_vertex_attr_desc sshape_texcoord_attr_desc(void); - sg_vertex_attr_desc sshape_color_attr_desc(void); + sg_vertex_buffer_layout_state sshape_vertex_buffer_layout_state(void); + sg_vertex_attr_state sshape_position_vertex_attr_state(void); + sg_vertex_attr_state sshape_normal_vertex_attr_state(void); + sg_vertex_attr_state sshape_texcoord_vertex_attr_state(void); + sg_vertex_attr_state sshape_color_vertex_attr_state(void); ``` The sshape_element_range_t struct contains the base-index and number of @@ -234,12 +234,12 @@ ```c sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { - .buffers[0] = sshape_buffer_layout_desc(), + .buffers[0] = sshape_vertex_buffer_layout_state(), .attrs = { - [0] = sshape_position_attr_desc(), - [1] = ssape_normal_attr_desc(), - [2] = sshape_texcoord_attr_desc(), - [3] = sshape_color_attr_desc() + [0] = sshape_position_vertex_attr_state(), + [1] = ssape_normal_vertex_attr_state(), + [2] = sshape_texcoord_vertex_attr_state(), + [3] = sshape_color_vertex_attr_state() } }, ... @@ -247,8 +247,8 @@ ``` Note that you don't have to use all generated vertex attributes in the - pipeline's vertex layout, the sg_buffer_layout_desc struct returned - by sshape_buffer_layout_desc() contains the correct vertex stride + pipeline's vertex layout, the sg_vertex_buffer_layout_state struct returned + by sshape_vertex_buffer_layout_state() contains the correct vertex stride to skip vertex components. WRITING MULTIPLE SHAPES INTO THE SAME BUFFER @@ -522,11 +522,11 @@ SOKOL_SHAPE_API_DECL sshape_sizes_t sshape_torus_sizes(uint32_t sides, uint32_t SOKOL_SHAPE_API_DECL sshape_element_range_t sshape_element_range(const sshape_buffer_t* buf); SOKOL_SHAPE_API_DECL sg_buffer_desc sshape_vertex_buffer_desc(const sshape_buffer_t* buf); SOKOL_SHAPE_API_DECL sg_buffer_desc sshape_index_buffer_desc(const sshape_buffer_t* buf); -SOKOL_SHAPE_API_DECL sg_buffer_layout_desc sshape_buffer_layout_desc(void); -SOKOL_SHAPE_API_DECL sg_vertex_attr_desc sshape_position_attr_desc(void); -SOKOL_SHAPE_API_DECL sg_vertex_attr_desc sshape_normal_attr_desc(void); -SOKOL_SHAPE_API_DECL sg_vertex_attr_desc sshape_texcoord_attr_desc(void); -SOKOL_SHAPE_API_DECL sg_vertex_attr_desc sshape_color_attr_desc(void); +SOKOL_SHAPE_API_DECL sg_vertex_buffer_layout_state sshape_vertex_buffer_layout_state(void); +SOKOL_SHAPE_API_DECL sg_vertex_attr_state sshape_position_vertex_attr_state(void); +SOKOL_SHAPE_API_DECL sg_vertex_attr_state sshape_normal_vertex_attr_state(void); +SOKOL_SHAPE_API_DECL sg_vertex_attr_state sshape_texcoord_vertex_attr_state(void); +SOKOL_SHAPE_API_DECL sg_vertex_attr_state sshape_color_vertex_attr_state(void); /* helper functions to build packed color value from floats or bytes */ SOKOL_SHAPE_API_DECL uint32_t sshape_color_4f(float r, float g, float b, float a); @@ -1397,38 +1397,38 @@ SOKOL_SHAPE_API_DECL sshape_element_range_t sshape_element_range(const sshape_bu return range; } -SOKOL_API_IMPL sg_buffer_layout_desc sshape_buffer_layout_desc(void) { - sg_buffer_layout_desc desc = { 0 }; - desc.stride = sizeof(sshape_vertex_t); - return desc; +SOKOL_API_IMPL sg_vertex_buffer_layout_state sshape_vertex_buffer_layout_state(void) { + sg_vertex_buffer_layout_state state = { 0 }; + state.stride = sizeof(sshape_vertex_t); + return state; } -SOKOL_API_IMPL sg_vertex_attr_desc sshape_position_attr_desc(void) { - sg_vertex_attr_desc desc = { 0 }; - desc.offset = offsetof(sshape_vertex_t, x); - desc.format = SG_VERTEXFORMAT_FLOAT3; - return desc; +SOKOL_API_IMPL sg_vertex_attr_state sshape_position_vertex_attr_state(void) { + sg_vertex_attr_state state = { 0 }; + state.offset = offsetof(sshape_vertex_t, x); + state.format = SG_VERTEXFORMAT_FLOAT3; + return state; } -SOKOL_API_IMPL sg_vertex_attr_desc sshape_normal_attr_desc(void) { - sg_vertex_attr_desc desc = { 0 }; - desc.offset = offsetof(sshape_vertex_t, normal); - desc.format = SG_VERTEXFORMAT_BYTE4N; - return desc; +SOKOL_API_IMPL sg_vertex_attr_state sshape_normal_vertex_attr_state(void) { + sg_vertex_attr_state state = { 0 }; + state.offset = offsetof(sshape_vertex_t, normal); + state.format = SG_VERTEXFORMAT_BYTE4N; + return state; } -SOKOL_API_IMPL sg_vertex_attr_desc sshape_texcoord_attr_desc(void) { - sg_vertex_attr_desc desc = { 0 }; - desc.offset = offsetof(sshape_vertex_t, u); - desc.format = SG_VERTEXFORMAT_USHORT2N; - return desc; +SOKOL_API_IMPL sg_vertex_attr_state sshape_texcoord_vertex_attr_state(void) { + sg_vertex_attr_state state = { 0 }; + state.offset = offsetof(sshape_vertex_t, u); + state.format = SG_VERTEXFORMAT_USHORT2N; + return state; } -SOKOL_API_IMPL sg_vertex_attr_desc sshape_color_attr_desc(void) { - sg_vertex_attr_desc desc = { 0 }; - desc.offset = offsetof(sshape_vertex_t, color); - desc.format = SG_VERTEXFORMAT_UBYTE4N; - return desc; +SOKOL_API_IMPL sg_vertex_attr_state sshape_color_vertex_attr_state(void) { + sg_vertex_attr_state state = { 0 }; + state.offset = offsetof(sshape_vertex_t, color); + state.format = SG_VERTEXFORMAT_UBYTE4N; + return state; } #ifdef __clang__ From 8098f4563656c000c7c4057937b003b16f802210 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 17 Jun 2023 19:36:34 +0200 Subject: [PATCH 028/292] sokol_gl.h: fixes for separate images and samplers (fixme: HLSL and WGSL) --- util/sokol_gl.h | 1556 +++++++++++++++++++++++------------------------ 1 file changed, 778 insertions(+), 778 deletions(-) diff --git a/util/sokol_gl.h b/util/sokol_gl.h index 090df2189..386f4a9aa 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -847,7 +847,7 @@ SOKOL_GL_API_DECL void sgl_scissor_rect(int x, int y, int w, int h, bool origin_ SOKOL_GL_API_DECL void sgl_scissor_rectf(float x, float y, float w, float h, bool origin_top_left); SOKOL_GL_API_DECL void sgl_enable_texture(void); SOKOL_GL_API_DECL void sgl_disable_texture(void); -SOKOL_GL_API_DECL void sgl_texture(sg_image img); +SOKOL_GL_API_DECL void sgl_texture(sg_image img, sg_sampler smp); SOKOL_GL_API_DECL void sgl_layer(int layer_id); /* pipeline stack functions */ @@ -994,12 +994,13 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; in vec4 uv; in vec4 color; out vec4 frag_color; void main() { - frag_color = texture(tex, uv.xy) * color; + frag_color = texture(sampler2D(tex, smp), uv.xy) * color; } @end @@ -1039,18 +1040,19 @@ static const char _sgl_vs_source_glsl330[478] = { 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20, 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _sgl_fs_source_glsl330[172] = { +static const char _sgl_fs_source_glsl330[180] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, - 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a, - 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74, + 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20, + 0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_GLES3) static const char _sgl_vs_source_glsl300es[481] = { @@ -1086,185 +1088,185 @@ static const char _sgl_vs_source_glsl300es[481] = { 0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; -static const char _sgl_fs_source_glsl300es[245] = { +static const char _sgl_fs_source_glsl300es[253] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, - 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20, - 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69, - 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c, - 0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x00, + 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x75, + 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x20, + 0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _sgl_vs_bytecode_metal_macos[3321] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x06,0x00,0x00,0x81,0x0a,0x00,0x0b,0x00, - 0xf9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _sgl_vs_bytecode_metal_macos[3317] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf5,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x80,0x27,0x7a,0x67,0xc7,0xfc,0xfd, - 0xe3,0x47,0x44,0x1b,0xf3,0x40,0x18,0x72,0x5a,0xd3,0x6e,0xad,0xec,0x58,0x70,0xc5, - 0x20,0xfe,0x98,0x5e,0x82,0x7f,0xed,0xf9,0x89,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x76,0x25,0x5f,0x37,0x22,0xd0,0x3f, + 0x64,0xef,0xff,0xc3,0x45,0x1a,0x3d,0xb7,0x5e,0x83,0x13,0x96,0xd3,0x09,0xec,0x53, + 0x25,0xd5,0x7e,0x0c,0xed,0xb9,0x58,0x34,0x02,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03, - 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44, - 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0xc0,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0xed,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, - 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, - 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, - 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, - 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, - 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, - 0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80, - 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36, - 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0, - 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1, - 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e, - 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78, - 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08, - 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda, - 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81, - 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8, - 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87, - 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76, - 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30, - 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01, - 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c, - 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08, - 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36, - 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d, - 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca, - 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90, - 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07, - 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61, - 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e, - 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4, - 0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e, - 0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda, - 0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72, - 0x00,0x36,0x18,0x42,0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00, - 0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48, - 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, - 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04, - 0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2, - 0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0, - 0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44, - 0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28, - 0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80, - 0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70, - 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, - 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83, - 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78, - 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90, - 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e, - 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76, - 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a, - 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30, - 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07, - 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74, - 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, - 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71, - 0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20, - 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f, - 0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76, - 0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50, - 0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, - 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78, - 0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49,0x00,0x00,0x08,0x00, - 0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98, - 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, - 0x50,0x04,0x05,0x18,0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00, - 0x88,0x8d,0x25,0x30,0x00,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x01,0x01,0x00, - 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37, - 0xb7,0x21,0xc6,0x32,0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b, - 0xd3,0x2b,0x1b,0x62,0x2c,0x81,0x22,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c, - 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26, - 0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac, - 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x26,0x65,0x88,0xa0,0x10,0x43, - 0x8c,0x25,0x58,0x90,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25, - 0x58,0x82,0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6, - 0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36, - 0x44,0x50,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e, - 0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65, - 0x43,0x04,0x65,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95, - 0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1, - 0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58, - 0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d, - 0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72, - 0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc, - 0xd8,0xde,0xc2,0xe8,0x68,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85, - 0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42, - 0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6, - 0xf6,0x26,0x37,0x84,0x51,0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96, - 0x26,0xe7,0x02,0xf7,0x36,0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea, - 0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68, - 0x74,0xc2,0xd2,0xe4,0x5c,0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58, - 0x98,0xb1,0xbd,0x85,0xd1,0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a, - 0xd3,0x2b,0x1b,0xa2,0x28,0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14, - 0x4c,0xd9,0x94,0x8f,0x50,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57, - 0x9a,0x1b,0x5c,0x1d,0x1d,0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4, - 0x37,0xb7,0xaf,0x34,0x37,0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74, - 0x65,0x64,0x28,0x5f,0x5f,0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f, - 0x6c,0x64,0x65,0x72,0x5f,0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc, - 0x86,0x50,0x8b,0xa0,0x84,0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22, - 0x29,0x93,0x42,0x06,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d, - 0xbd,0xbd,0xc9,0x91,0xc1,0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09, - 0x94,0x31,0x50,0x22,0xc5,0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72, - 0x30,0x43,0xa8,0x65,0x50,0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48, - 0x91,0x94,0x49,0x49,0x03,0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2, - 0x40,0x11,0x83,0xc5,0x58,0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a, - 0x61,0x69,0x72,0x2e,0x62,0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4, - 0xea,0xcc,0xcc,0xca,0xe4,0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8, - 0x95,0x85,0x91,0x91,0x0a,0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2, - 0xcb,0x83,0x2b,0xfb,0x4a,0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83, - 0x47,0xc3,0xa1,0xcd,0x0e,0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94, - 0x38,0x50,0xe4,0x60,0x21,0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a, - 0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf, - 0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4, - 0x33,0xb7,0xaf,0xb9,0x34,0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x1c,0xbe,0x64,0x62,0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28, - 0x62,0xb0,0x08,0x4b,0xa0,0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a, - 0x1d,0x2c,0x89,0x12,0x29,0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0, - 0x40,0x51,0x03,0x85,0x0d,0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0, - 0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3, - 0x33,0x95,0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34, - 0x44,0x50,0xfa,0x60,0x88,0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40, - 0xf9,0x83,0x46,0x19,0x11,0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03, - 0x39,0xd4,0x03,0x3b,0x94,0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14, - 0x21,0x18,0x46,0x28,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e, - 0xee,0x40,0x0f,0x53,0x82,0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5, - 0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20, - 0x0f,0x6e,0xc0,0x0e,0xe1,0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b, - 0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1, - 0x90,0x0e,0xf2,0xe0,0x06,0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0, - 0x0b,0xef,0x00,0x0f,0xf4,0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67, - 0x84,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8, - 0x30,0x25,0xd8,0x03,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,0x80,0x56,0x41,0x54, + 0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, + 0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00, + 0x00,0xc4,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00, + 0x00,0xee,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00, + 0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84, + 0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b, + 0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90, + 0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8, + 0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x81,0x00,0x00, + 0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77, + 0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8, + 0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87, + 0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c, + 0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8, + 0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18, + 0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc, + 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21, + 0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e, + 0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06, + 0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77, + 0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68, + 0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87, + 0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d, + 0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca, + 0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36, + 0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0, + 0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6, + 0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61, + 0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07, + 0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, + 0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e, + 0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea, + 0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c, + 0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea, + 0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1, + 0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x18,0x42, + 0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40, + 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, + 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, + 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04,0x60,0x89,0x10,0x02, + 0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2,0x50,0x0f,0xe3,0x40, + 0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0,0x07,0xed,0x10,0x0e, + 0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44,0x09,0x93,0x5f,0x49, + 0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28,0x86,0x08,0x23,0x80, + 0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80,0xc2,0x20,0x42,0x20, + 0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, + 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87, + 0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38, + 0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0, + 0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0, + 0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07, + 0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73, + 0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, + 0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, + 0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0, + 0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72,0x50,0x07,0x76, + 0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x50, + 0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07, + 0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74, + 0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60, + 0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, + 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18, + 0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x34, + 0x01,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x02,0x01,0x00,0x00,0x1a,0x03,0x4c, + 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32, + 0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, + 0x2c,0x81,0x22,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, + 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25, + 0x58,0x90,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82, + 0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, + 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50, + 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, + 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04, + 0x65,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, + 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, + 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c, + 0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba, + 0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61, + 0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde, + 0xc2,0xe8,0x68,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95, + 0x51,0xa8,0xb3,0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9, + 0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26, + 0x37,0x84,0x51,0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7, + 0x02,0xf7,0x36,0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e, + 0x8d,0x2e,0xed,0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2, + 0xd2,0xe4,0x5c,0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1, + 0xbd,0x85,0xd1,0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b, + 0x1b,0xa2,0x28,0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9, + 0x94,0x8f,0x50,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b, + 0x5c,0x1d,0x1d,0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7, + 0xaf,0x34,0x37,0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64, + 0x28,0x5f,0x5f,0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64, + 0x65,0x72,0x5f,0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50, + 0x8b,0xa0,0x84,0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93, + 0x42,0x06,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd, + 0xc9,0x91,0xc1,0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31, + 0x50,0x22,0xc5,0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43, + 0xa8,0x65,0x50,0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94, + 0x49,0x49,0x03,0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11, + 0x83,0xc5,0x58,0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69, + 0x72,0x2e,0x62,0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc, + 0xcc,0xca,0xe4,0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85, + 0x91,0x91,0x0a,0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83, + 0x2b,0xfb,0x4a,0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3, + 0xa1,0xcd,0x0e,0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50, + 0xe4,0x60,0x21,0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b, + 0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34, + 0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7, + 0xaf,0xb9,0x34,0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c, + 0xbe,0x62,0x72,0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0, + 0x08,0x4b,0xa0,0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c, + 0x89,0x12,0x29,0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51, + 0x03,0x85,0x0d,0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b, + 0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95, + 0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50, + 0xfa,0x60,0x88,0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83, + 0x46,0x19,0x11,0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4, + 0x03,0x3b,0x94,0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18, + 0x46,0x28,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40, + 0x0f,0x53,0x82,0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f, + 0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e, + 0xc0,0x0e,0xe1,0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50, + 0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e, + 0xf2,0xe0,0x06,0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef, + 0x00,0x0f,0xf4,0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12, + 0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25, + 0xd8,0x03,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, @@ -1313,147 +1315,346 @@ static const uint8_t _sgl_vs_bytecode_metal_macos[3321] = { 0x00,0x5b,0x86,0x20,0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61, 0xcb,0xf0,0x04,0xa0,0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19, 0xba,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sgl_fs_bytecode_metal_macos[2829] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x06,0x00,0x00,0x81,0x0a,0x00,0x0b,0x00, - 0x0d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _sgl_fs_bytecode_metal_macos[2825] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x09,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x30,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xeb,0xd5,0xe5,0x1e,0x0a,0x10,0x1a, - 0x32,0xd3,0xbd,0xd9,0xe3,0x31,0x39,0x1e,0x13,0x0d,0xe0,0xb8,0x26,0xfa,0x4f,0x40, - 0xeb,0xf7,0x82,0x75,0x70,0x8a,0xc9,0x08,0x0c,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xb9,0x65,0x80,0x88,0xa2,0xc8,0x18, + 0x8d,0x2a,0x38,0xc1,0x87,0xa4,0x7f,0x35,0x83,0x69,0xdc,0x8c,0xcb,0x7b,0x11,0x67, + 0x89,0xc7,0xf0,0x8a,0x99,0x36,0x06,0xc5,0x90,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x82,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94, - 0x34,0x45,0x94,0x30,0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18, - 0x01,0x30,0x88,0x30,0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c, - 0x44,0xf4,0x4f,0x63,0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61, - 0x04,0x01,0x98,0x23,0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49, - 0x8a,0x29,0x40,0x6d,0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x10,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x81,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,0x34,0x45,0x94,0x30, + 0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,0x01,0x30,0x88,0x30, + 0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,0x44,0xf4,0x4f,0x63, + 0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,0x04,0x01,0x98,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, + 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87, + 0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38, + 0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0, + 0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0, + 0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07, + 0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73, + 0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, + 0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, + 0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0, + 0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72,0x50,0x07,0x76, + 0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x50, + 0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07, + 0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74, + 0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60, + 0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x41,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64,0x81,0x00,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, + 0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70, + 0x2c,0xa1,0x09,0x00,0x00,0x79,0x18,0x00,0x00,0xb7,0x00,0x00,0x00,0x1a,0x03,0x4c, + 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42, + 0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, + 0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, + 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45, + 0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84, + 0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, + 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78, + 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, + 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84, + 0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, + 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, + 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c, + 0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0, + 0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32, + 0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe, + 0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d, + 0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c, + 0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e, + 0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34, + 0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72, + 0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x14,0xea,0xec,0x86,0x48,0xcb,0xf0,0x58, + 0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae,0x4c,0x0e, + 0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10,0x69,0x11, + 0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84,0xa5,0xc9, + 0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,0x95,0x51,0x0a,0x4b,0x93,0x73,0x61,0x7b,0x1b, + 0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96,0x26,0xe7, + 0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae,0x4c,0x86, + 0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad,0xcc,0x87, + 0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,0x9e,0xef,0x01,0x83,0x65,0x58,0x84,0x27,0x0c, + 0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c,0x58,0x1b, + 0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x0e,0x73,0x6d,0x70, + 0x43,0xa4,0xe5,0x78,0xca,0xe0,0x01,0x83,0x65,0x58,0x84,0x07,0x7a,0xcc,0xe0,0x91, + 0x9e,0x33,0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64,0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e, + 0xea,0x49,0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90, + 0x43,0x3d,0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0,0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11, + 0x82,0x61,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0, + 0x0e,0xf4,0x30,0x25,0x28,0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e, + 0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2, + 0xe0,0x06,0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5,0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60, + 0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e, + 0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf, + 0xf0,0x0e,0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53,0x06,0x85,0x71,0x46, + 0x30,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20,0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e, + 0xee,0x40,0x0f,0x53,0x02,0x35,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00, + 0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84, + 0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed, + 0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66, + 0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c, + 0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70, + 0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90, + 0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4, + 0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83, + 0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14, + 0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70, + 0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80, + 0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0, + 0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1, + 0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d, + 0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39, + 0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc, + 0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70, + 0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53, + 0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e, + 0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c, + 0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38, + 0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37, + 0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33, + 0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4, + 0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0, + 0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3, + 0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07, + 0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23, + 0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59, + 0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b, + 0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00, + 0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, + 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, + 0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41, + 0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80, + 0xd4,0x08,0x40,0x0d,0x90,0x98,0x01,0xa0,0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00, + 0x00,0x83,0x0c,0x8b,0x60,0x8c,0x18,0x28,0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60, + 0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; +static const uint8_t _sgl_vs_bytecode_metal_ios[3317] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf5,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, + 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x17,0x11,0x57,0x16,0x94,0x42,0x52, + 0xfb,0x1e,0xd0,0x32,0xfd,0x87,0x16,0xb0,0xa4,0xd0,0xc2,0x43,0xbe,0x93,0x8c,0xe0, + 0x2d,0x7a,0x5c,0x3e,0x06,0x4c,0x57,0xeb,0x4b,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,0x80,0x56,0x41,0x54, + 0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, + 0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00, + 0x00,0xc0,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00, + 0x00,0xed,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00, + 0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84, + 0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b, + 0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90, + 0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8, + 0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x82,0x00,0x00, + 0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77, + 0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8, + 0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87, + 0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c, + 0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8, + 0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18, + 0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc, + 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21, + 0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e, + 0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06, + 0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77, + 0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68, + 0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87, + 0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d, + 0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca, + 0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36, + 0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0, + 0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6, + 0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61, + 0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07, + 0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, + 0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e, + 0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea, + 0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c, + 0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea, + 0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1, + 0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x20,0x42, + 0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00, + 0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48, + 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, + 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04, + 0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2, + 0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0, + 0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44, + 0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28, + 0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80, + 0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70, 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, - 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83, - 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78, - 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90, - 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e, - 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76, - 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a, - 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30, - 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07, - 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74, - 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, - 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71, - 0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20, - 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f, - 0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76, - 0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50, - 0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, - 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78, - 0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x41,0x00,0x00,0x08,0x00, - 0x00,0x00,0x00,0x00,0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64, - 0x81,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, - 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50, - 0x10,0x65,0x40,0x70,0x2c,0x81,0x01,0x00,0x00,0x79,0x18,0x00,0x00,0xb8,0x00,0x00, - 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37, - 0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b, - 0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c, - 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26, - 0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac, - 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65,0x66,0x46,0x26,0x65,0x88,0xf0,0x10,0x43, - 0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45, - 0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6, - 0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36, - 0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e, - 0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65, - 0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95, - 0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1, - 0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58, - 0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d, - 0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0, - 0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4, - 0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd, - 0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45, - 0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d, - 0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95, - 0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70, - 0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x14,0xea,0xec,0x86,0x48,0xcb, - 0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae, - 0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10, - 0x69,0x11,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84, - 0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,0x95,0x51,0x0a,0x4b,0x93,0x73,0x61, - 0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96, - 0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae, - 0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad, - 0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,0x9e,0xef,0x01,0x83,0x65,0x58,0x84, - 0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c, - 0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x22,0x74, - 0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x43,0xa4,0xe5,0x78,0xca,0xe0,0x01,0x83,0x65, - 0x58,0x84,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33,0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64, - 0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49,0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d, - 0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d,0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0, - 0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed, - 0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x28,0x46,0x2c,0xe1,0x90, - 0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25, - 0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5, - 0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0, - 0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e, - 0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e,0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee, - 0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20, - 0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40,0x0f,0x53,0x02,0x35,0x00,0x00,0x00, + 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51, + 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78, + 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60, + 0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07, + 0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, + 0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, + 0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76, + 0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0, + 0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6, + 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90, + 0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06, + 0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0, + 0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72, + 0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10, + 0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, + 0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73, + 0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x2c,0x10,0x00, + 0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, + 0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18,0x50,0x08,0x65,0x50, + 0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x40,0x02,0x00,0x00,0x00, + 0x00,0x79,0x18,0x00,0x00,0x02,0x01,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, + 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32,0x28,0x00,0xb3,0x50, + 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0x81,0x22,0x2c, + 0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae, + 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06, + 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5, + 0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x90,0x45,0x60, + 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82,0x45,0xe0,0x16,0x96, + 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, + 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72,0x61,0x69, + 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, + 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65,0x21,0x19,0x84, + 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, + 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, + 0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d, + 0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6, + 0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79, + 0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x68,0xc8,0x84, + 0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2, + 0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61, + 0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26,0x37,0x84,0x51,0x1e,0xc5, + 0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7,0x02,0xf7,0x36,0x97,0x46, + 0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x6d, + 0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2,0xd2,0xe4,0x5c,0xe0,0xde, + 0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1,0xbd,0x85,0xd1,0x91,0x39, + 0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b,0x1b,0xa2,0x28,0x9c,0x12, + 0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9,0x94,0x8f,0x50,0x58,0x9a, + 0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b,0x5c,0x1d,0x1d,0xa5,0xb0, + 0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7,0xaf,0x34,0x37,0xb2,0x32, + 0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x5f,0x5f,0x61,0x69, + 0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x5f,0x5f,0x29, + 0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50,0x8b,0xa0,0x84,0x81,0x22, + 0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93,0x42,0x06,0x34,0xcc,0xd8, + 0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd,0xc9,0x91,0xc1,0x0c,0xa1, + 0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31,0x50,0x22,0xc5,0x0c,0x94, + 0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65,0x50,0xc2,0x40, + 0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94,0x49,0x49,0x03,0x16,0x70, + 0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11,0x83,0xc5,0x58,0x02,0x65, + 0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69,0x72,0x2e,0x62,0x75,0x66, + 0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc,0xcc,0xca,0xe4,0xbe,0xe6, + 0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85,0x91,0x91,0x0a,0x4b,0x93, + 0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83,0x2b,0xfb,0x4a,0x73,0x33, + 0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3,0xa1,0xcd,0x0e,0x8e,0x02, + 0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50,0xe4,0x60,0x21,0x16,0x62, + 0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d, + 0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3, + 0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7,0xaf,0xb9,0x34,0xbd,0x32, + 0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c,0xbe,0x62,0x72,0x86,0x90, + 0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0,0x08,0x4b,0xa0,0xbc,0x81, + 0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c,0x89,0x12,0x29,0x77,0xa0, + 0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51,0x03,0x85,0x0d,0x94,0x3c, + 0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3, + 0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7,0x56,0x06, + 0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50,0xfa,0x60,0x88,0xa1,0xf0, + 0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83,0x46,0x19,0x11,0xb1,0x03, + 0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4,0x03,0x3b,0x94,0x83,0x1b, + 0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18,0x46,0x28,0xec,0xc0,0x0e, + 0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40,0x0f,0x53,0x82,0x62,0xc4, + 0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0, + 0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e,0xc0,0x0e,0xe1,0xe0,0x0e, + 0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9, + 0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe3,0xf0, + 0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef,0x00,0x0f,0xf4,0x90,0x0e, + 0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12,0x0e,0xe9,0x20,0x0f,0x6e, + 0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25,0xd8,0x03,0x00,0x00,0x00, 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, @@ -1485,174 +1686,164 @@ static const uint8_t _sgl_fs_bytecode_metal_macos[2829] = { 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, - 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, - 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, - 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, - 0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00, - 0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80,0xd4,0x08,0x40,0x0d,0x90,0x98,0x01,0xa0, - 0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00,0x00,0x83,0x0c,0x8b,0x60,0x8c,0x18,0x28, - 0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30, + 0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00,0x00,0x13,0x04,0x41, + 0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22,0x86,0x61,0x18,0xc6, + 0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40,0x19,0x14,0x01,0xbd, + 0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00,0x00,0xe3,0x15,0x4b, + 0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9,0x8c,0x57,0x3c,0x55, + 0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1, + 0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43,0x99,0x10,0xc8,0xc7, + 0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50,0x06,0x19,0xbe,0x48, + 0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68,0x03,0x36,0x20,0x03, + 0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b,0xc4,0x00,0x0d,0xe2, + 0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42,0x20,0x1f,0x0b,0x0a, + 0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05,0xc5,0x86,0x00,0x3e, + 0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d,0xc1,0x23,0xcc,0x36, + 0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00,0x00,0x5b,0x86,0x20, + 0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61,0xcb,0xf0,0x04,0xa0, + 0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19,0xba,0x00,0x14,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sgl_vs_bytecode_metal_ios[3305] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x06,0x00,0x00,0x82,0x09,0x00,0x00,0x00, - 0xe9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0xd0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sgl_fs_bytecode_metal_ios[2809] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf9,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x77,0x3d,0x05,0xbd,0x9f,0x26,0xc1, - 0xae,0x87,0x1d,0xc4,0x7e,0x6d,0x86,0xc6,0x23,0xd4,0x40,0x35,0xfc,0x64,0x3f,0x25, - 0xe4,0xe3,0x19,0x09,0x7d,0xba,0xe3,0x12,0x70,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xc1,0x98,0x28,0x2b,0x2b,0x1f,0x36, + 0x7c,0x5c,0xb0,0x69,0x3f,0xc3,0xd1,0x80,0x4b,0xcf,0xa1,0x10,0xfc,0x19,0x31,0x58, + 0xad,0x45,0xd3,0x5a,0x81,0x72,0x0d,0x8f,0x85,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03, - 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0xbc,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0xec,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x08,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x7f,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, - 0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80, - 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36, - 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0, - 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1, - 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e, - 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78, - 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08, - 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda, - 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81, - 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8, - 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87, - 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76, - 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30, - 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01, - 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c, - 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08, - 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36, - 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d, - 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca, - 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90, - 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07, - 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61, - 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e, - 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4, - 0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e, - 0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda, - 0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72, - 0x00,0x36,0x20,0x42,0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00,0x49,0x18,0x00, - 0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00, - 0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22, - 0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33, - 0x00,0xc3,0x08,0x04,0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51, - 0xf3,0x40,0x0f,0xf2,0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1, - 0xc0,0x0e,0x7a,0xa0,0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20, - 0x07,0x49,0x53,0x44,0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94, - 0x41,0x04,0x43,0x28,0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52, - 0x60,0xcd,0x11,0x80,0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00, - 0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78, - 0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80, - 0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, - 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07, - 0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76, - 0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0, - 0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73, - 0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, - 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, - 0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a, - 0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, - 0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, - 0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20, - 0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, - 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72, - 0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60, - 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f, - 0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72, - 0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40, - 0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07, - 0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00, - 0x80,0x2c,0x10,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, - 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18, - 0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x3c, - 0x00,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x01,0x01,0x00,0x00,0x1a,0x03,0x4c, - 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32, - 0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, - 0x2c,0x81,0x22,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, - 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, - 0x65,0x46,0xa6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, - 0x06,0x26,0xc6,0x65,0x46,0xa6,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x90, - 0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x84,0x45,0xe0, - 0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6, - 0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72, - 0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74, - 0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65,0x21, - 0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85, - 0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95, - 0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99, - 0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39, - 0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f, - 0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x68, - 0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3, - 0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b,0x2b,0x93, - 0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26,0x37,0x84,0x51, - 0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7,0x02,0xf7,0x36, - 0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e,0x8d,0x2e,0xed, - 0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2,0xd2,0xe4,0x5c, - 0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1,0xbd,0x85,0xd1, - 0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b,0x1b,0xa2,0x28, - 0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9,0x94,0x8f,0x50, - 0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b,0x5c,0x1d,0x1d, - 0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7,0xaf,0x34,0x37, - 0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x5f,0x5f, - 0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x5f, - 0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50,0x8b,0xa0,0x84, - 0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93,0x42,0x06,0x34, - 0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd,0xc9,0x91,0xc1, - 0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31,0x50,0x22,0xc5, - 0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65,0x50, - 0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94,0x49,0x49,0x03, - 0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11,0x83,0xc5,0x58, - 0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69,0x72,0x2e,0x62, - 0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc,0xcc,0xca,0xe4, - 0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85,0x91,0x91,0x0a, - 0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83,0x2b,0xfb,0x4a, - 0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3,0xa1,0xcd,0x0e, - 0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50,0xe4,0x60,0x21, - 0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9, - 0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34,0x39,0x97,0x30, - 0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7,0xaf,0xb9,0x34, - 0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c,0xbe,0x64,0x62, - 0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0,0x08,0x4b,0xa0, - 0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c,0x89,0x12,0x29, - 0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51,0x03,0x85,0x0d, - 0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83, - 0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7, - 0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50,0xfa,0x60,0x88, - 0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83,0x46,0x19,0x11, - 0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4,0x03,0x3b,0x94, - 0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18,0x46,0x28,0xec, - 0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40,0x0f,0x53,0x82, - 0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e, - 0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e,0xc0,0x0e,0xe1, - 0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50,0x0e,0xf2,0x30, - 0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e,0xf2,0xe0,0x06, - 0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef,0x00,0x0f,0xf4, - 0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12,0x0e,0xe9,0x20, - 0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25,0xd8,0x03,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,0x34,0x45,0x94,0x30, + 0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,0x01,0x30,0x88,0x30, + 0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,0x44,0xf4,0x4f,0x63, + 0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,0x04,0x01,0x98,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0, + 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87, + 0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f, + 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9, + 0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0, + 0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07, + 0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72, + 0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0, + 0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6, + 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20, + 0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78, + 0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07, + 0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72, + 0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60, + 0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07, + 0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a, + 0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10, + 0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07, + 0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74, + 0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x18, + 0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03,0x04,0x80,0x00,0x00, + 0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98, + 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, + 0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0x01,0x12,0x00,0x00,0x79,0x18,0x00, + 0x00,0xb7,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, + 0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b, + 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08, + 0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed, + 0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c, + 0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45, + 0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17, + 0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6, + 0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96, + 0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f, + 0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f, + 0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c, + 0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99, + 0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d, + 0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d, + 0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c, + 0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2, + 0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d, + 0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9, + 0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc, + 0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb, + 0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e, + 0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x14, + 0xea,0xec,0x86,0x48,0xcb,0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,0xf4,0x48, + 0x8f,0xc6,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,0xc5,0xd8, + 0x1b,0xdb,0x9b,0xdc,0x10,0x69,0x11,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,0xe8,0x89, + 0x1e,0xe9,0xe9,0xb8,0x84,0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,0x95,0x51, + 0x0a,0x4b,0x93,0x73,0x61,0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,0x73,0x23, + 0x2b,0xc3,0xa3,0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,0x8c,0xae, + 0x0c,0x8f,0xae,0x4e,0xae,0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,0x05,0x64, + 0x2e,0xac,0x0d,0x8e,0xad,0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,0x9e,0xef, + 0x01,0x83,0x65,0x58,0x84,0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,0x80,0x4b, + 0x58,0x9a,0x9c,0xcb,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,0x36,0x38, + 0xb6,0x32,0x39,0x0e,0x73,0x6d,0x70,0x43,0xa4,0xe5,0x78,0xca,0xe0,0x01,0x83,0x65, + 0x58,0x84,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33,0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64, + 0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49,0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d, + 0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d,0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0, + 0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed, + 0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x28,0x46,0x2c,0xe1,0x90, + 0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25, + 0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5, + 0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0, + 0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e, + 0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e,0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee, + 0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20, + 0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40,0x0f,0x53,0x02,0x35,0x00,0x00,0x00, 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, @@ -1684,204 +1875,16 @@ static const uint8_t _sgl_vs_bytecode_metal_ios[3305] = { 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, - 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30, - 0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00,0x00,0x13,0x04,0x41, - 0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22,0x86,0x61,0x18,0xc6, - 0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40,0x19,0x14,0x01,0xbd, - 0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00,0x00,0xe3,0x15,0x4b, - 0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9,0x8c,0x57,0x3c,0x55, - 0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1, - 0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43,0x99,0x10,0xc8,0xc7, - 0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50,0x06,0x19,0xbe,0x48, - 0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68,0x03,0x36,0x20,0x03, - 0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b,0xc4,0x00,0x0d,0xe2, - 0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42,0x20,0x1f,0x0b,0x0a, - 0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05,0xc5,0x86,0x00,0x3e, - 0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d,0xc1,0x23,0xcc,0x36, - 0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00,0x00,0x5b,0x86,0x20, - 0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61,0xcb,0xf0,0x04,0xa0, - 0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19,0xba,0x00,0x14,0x00, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, + 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, + 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, + 0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00, + 0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80,0xd4,0x08,0x40,0x0d,0x90,0x98,0x01,0xa0, + 0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00,0x00,0x83,0x0c,0x8b,0x60,0x8c,0x18,0x28, + 0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sgl_fs_bytecode_metal_ios[2813] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x06,0x00,0x00,0x82,0x09,0x00,0x00,0x00, - 0xfd,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, - 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xa2,0xfb,0x9e,0x58,0x9a,0x22,0x99, - 0x8e,0xdc,0x41,0x5a,0x15,0xf4,0x1f,0xbc,0xfa,0xdd,0xa2,0x32,0xf3,0xff,0x3e,0xe2, - 0x2c,0x7f,0x20,0x9e,0x14,0xb3,0xef,0x8e,0x56,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x08,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x7f,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94, - 0x34,0x45,0x94,0x30,0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18, - 0x01,0x30,0x88,0x30,0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c, - 0x44,0xf4,0x4f,0x63,0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61, - 0x04,0x01,0x98,0x23,0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49, - 0x8a,0x29,0x40,0x6d,0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70, - 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, - 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51, - 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78, - 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60, - 0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07, - 0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, - 0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, - 0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76, - 0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0, - 0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, - 0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6, - 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90, - 0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06, - 0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, - 0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0, - 0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07, - 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72, - 0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10, - 0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, - 0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73, - 0x20,0x07,0x43,0x18,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03, - 0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00, - 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43, - 0x5a,0x23,0x00,0x25,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0xe1,0x01,0x00, - 0x00,0x79,0x18,0x00,0x00,0xb7,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, - 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50, - 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc3,0x23,0x2c, - 0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae, - 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0x65,0x46,0xa6,0x06, - 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0x65, - 0x46,0xa6,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x65,0x58,0x8c,0x45,0x60,0xd1,0x54, - 0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x65,0x58,0x84,0x45,0xe0,0x16,0x96,0x26,0xe7, - 0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7, - 0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e, - 0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74, - 0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9, - 0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5, - 0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1, - 0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc, - 0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f, - 0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9, - 0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x11,0x1e,0xe8,0x89, - 0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac, - 0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a, - 0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32, - 0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76, - 0x65,0x14,0xea,0xec,0x86,0x48,0x8b,0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f, - 0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85, - 0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10,0x69,0x19,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e, - 0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84,0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9, - 0x95,0x51,0x0a,0x4b,0x93,0x73,0x61,0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a, - 0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46, - 0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae,0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e, - 0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad,0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21, - 0x9e,0xef,0x01,0x83,0x45,0x58,0x86,0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6, - 0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0, - 0x36,0x38,0xb6,0x32,0x39,0x22,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x43,0xa4, - 0xe5,0x78,0xca,0xe0,0x01,0x83,0x45,0x58,0x86,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33, - 0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64,0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49, - 0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d, - 0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0,0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61, - 0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4, - 0x30,0x25,0x28,0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30, - 0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06, - 0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5,0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5, - 0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20, - 0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e, - 0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1, - 0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20,0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40, - 0x0f,0x53,0x02,0x35,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, - 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, - 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, - 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, - 0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78, - 0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03, - 0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f, - 0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c, - 0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39, - 0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b, - 0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60, - 0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87, - 0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e, - 0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6, - 0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94, - 0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03, - 0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07, - 0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f, - 0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33, - 0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc, - 0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c, - 0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78, - 0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca, - 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21, - 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43, - 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87, - 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c, - 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e, - 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c, - 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c, - 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00, - 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, - 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00, - 0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, - 0x00,0x06,0x00,0x00,0x00,0xc4,0x46,0x00,0xc6,0x12,0x80,0x80,0xd4,0x08,0x40,0x0d, - 0x90,0x98,0x01,0xa0,0x30,0x03,0x40,0x60,0x04,0x00,0x00,0x00,0x00,0x83,0x0c,0x8b, - 0x60,0x8c,0x18,0x28,0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9, - 0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -static const char _sgl_vs_source_metal_sim[856] = { +static const char _sgl_vs_source_metal_sim[756] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1910,34 +1913,28 @@ static const char _sgl_vs_source_metal_sim[856] = { 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, 0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 0x61,0x74,0x20,0x70,0x73,0x69,0x7a,0x65,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, - 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73, - 0x6c,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, - 0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b,0x62,0x75, - 0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d, - 0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x73, - 0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74, - 0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f, - 0x32,0x31,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x38,0x20,0x22, - 0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, - 0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d, - 0x20,0x69,0x6e,0x2e,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65, - 0x20,0x31,0x39,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20, - 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x5f,0x32,0x31,0x2e, + 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, + 0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, + 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20, + 0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72, + 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a, + 0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69, + 0x7a,0x65,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e, 0x74,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x74, 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31, - 0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x32,0x30,0x20,0x22,0x73, - 0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74, - 0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f, - 0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f, - 0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; -static const char _sgl_fs_source_metal_sim[489] = { +static const char _sgl_fs_source_metal_sim[439] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1951,26 +1948,24 @@ static const char _sgl_fs_source_metal_sim[489] = { 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x31,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x66,0x72, - 0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74, - 0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20, - 0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c, - 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74, - 0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, - 0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65, - 0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, - 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, - 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, - 0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x31,0x20,0x22,0x73,0x67,0x6c,0x2e,0x67, - 0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69, - 0x6e,0x2e,0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65, + 0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65, + 0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d, + 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b, + 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e, + 0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f, + 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, + 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) +FIXME FIXME FIXME static const uint8_t _sgl_vs_bytecode_hlsl4[1032] = { 0x44,0x58,0x42,0x43,0x09,0x96,0xbb,0xbb,0xfc,0x44,0x44,0xa8,0xa4,0x1c,0x9e,0x45, 0x50,0x97,0xf1,0xde,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, @@ -2080,6 +2075,7 @@ static const uint8_t _sgl_fs_bytecode_hlsl4[620] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) +FIXME FIXME FIXME static const uint8_t _sgl_vs_bytecode_wgpu[1968] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, @@ -2344,6 +2340,7 @@ typedef enum { typedef struct { sg_pipeline pip; sg_image img; + sg_sampler smp; int base_vertex; int num_vertices; int uniform_index; @@ -2413,6 +2410,7 @@ typedef struct { float point_size; _sgl_primitive_type_t cur_prim_type; sg_image cur_img; + sg_sampler cur_smp; bool texturing_enabled; bool matrix_dirty; /* reset in sgl_end(), set in any of the matrix stack functions */ @@ -2440,6 +2438,7 @@ typedef struct { uint32_t init_cookie; sgl_desc_t desc; sg_image def_img; // a default white texture + sg_sampler def_smp; // a default sampler sg_shader shd; // same shader for all contexts sgl_context def_ctx_id; sgl_context cur_ctx_id; @@ -2479,8 +2478,7 @@ static void _sgl_log(sgl_log_item_t log_item, uint32_t log_level, uint32_t line_ const char* message = 0; #endif _sgl.desc.logger.func("sgl", log_level, log_item, message, line_nr, filename, _sgl.desc.logger.user_data); - } - else { + } else { // for log level PANIC it would be 'undefined behaviour' to continue if (log_level == 0) { abort(); @@ -2505,8 +2503,7 @@ static void* _sgl_malloc(size_t size) { void* ptr; if (_sgl.desc.allocator.alloc) { ptr = _sgl.desc.allocator.alloc(size, _sgl.desc.allocator.user_data); - } - else { + } else { ptr = malloc(size); } if (0 == ptr) { @@ -2524,8 +2521,7 @@ static void* _sgl_malloc_clear(size_t size) { static void _sgl_free(void* ptr) { if (_sgl.desc.allocator.free) { _sgl.desc.allocator.free(ptr, _sgl.desc.allocator.user_data); - } - else { + } else { free(ptr); } } @@ -2572,9 +2568,8 @@ static int _sgl_pool_alloc_index(_sgl_pool_t* pool) { int slot_index = pool->free_queue[--pool->queue_top]; SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); return slot_index; - } - else { - /* pool exhausted */ + } else { + // pool exhausted return _SGL_INVALID_SLOT_INDEX; } } @@ -2678,8 +2673,7 @@ static sgl_pipeline _sgl_alloc_pipeline(void) { int slot_index = _sgl_pool_alloc_index(&_sgl.pip_pool.pool); if (_SGL_INVALID_SLOT_INDEX != slot_index) { res = _sgl_make_pip_id(_sgl_slot_alloc(&_sgl.pip_pool.pool, &_sgl.pip_pool.pips[slot_index].slot, slot_index)); - } - else { + } else { /* pool is exhausted */ res = _sgl_make_pip_id(SG_INVALID_ID); } @@ -2693,22 +2687,22 @@ static void _sgl_init_pipeline(sgl_pipeline pip_id, const sg_pipeline_desc* in_d sg_pipeline_desc desc = *in_desc; desc.layout.buffers[0].stride = sizeof(_sgl_vertex_t); { - sg_vertex_attr_desc* pos = &desc.layout.attrs[0]; + sg_vertex_attr_state* pos = &desc.layout.attrs[0]; pos->offset = offsetof(_sgl_vertex_t, pos); pos->format = SG_VERTEXFORMAT_FLOAT3; } { - sg_vertex_attr_desc* uv = &desc.layout.attrs[1]; + sg_vertex_attr_state* uv = &desc.layout.attrs[1]; uv->offset = offsetof(_sgl_vertex_t, uv); uv->format = SG_VERTEXFORMAT_FLOAT2; } { - sg_vertex_attr_desc* rgba = &desc.layout.attrs[2]; + sg_vertex_attr_state* rgba = &desc.layout.attrs[2]; rgba->offset = offsetof(_sgl_vertex_t, rgba); rgba->format = SG_VERTEXFORMAT_UBYTE4N; } { - sg_vertex_attr_desc* psize = &desc.layout.attrs[3]; + sg_vertex_attr_state* psize = &desc.layout.attrs[3]; psize->offset = offsetof(_sgl_vertex_t, psize); psize->format = SG_VERTEXFORMAT_FLOAT; } @@ -2754,8 +2748,7 @@ static void _sgl_init_pipeline(sgl_pipeline pip_id, const sg_pipeline_desc* in_d if (SGL_PRIMITIVETYPE_QUADS == i) { /* quads are emulated via triangles, use the same pipeline object */ pip->pip[i] = pip->pip[SGL_PRIMITIVETYPE_TRIANGLES]; - } - else { + } else { pip->pip[i] = sg_make_pipeline(&desc); if (pip->pip[i].id == SG_INVALID_ID) { _SGL_ERROR(MAKE_PIPELINE_FAILED); @@ -2770,8 +2763,7 @@ static sgl_pipeline _sgl_make_pipeline(const sg_pipeline_desc* desc, const sgl_c sgl_pipeline pip_id = _sgl_alloc_pipeline(); if (pip_id.id != SG_INVALID_ID) { _sgl_init_pipeline(pip_id, desc, ctx_desc); - } - else { + } else { _SGL_ERROR(PIPELINE_POOL_EXHAUSTED); } return pip_id; @@ -2796,8 +2788,7 @@ static sg_pipeline _sgl_get_pipeline(sgl_pipeline pip_id, _sgl_primitive_type_t _sgl_pipeline_t* pip = _sgl_lookup_pipeline(pip_id.id); if (pip) { return pip->pip[prim_type]; - } - else { + } else { sg_pipeline dummy_id = { SG_INVALID_ID }; return dummy_id; } @@ -2862,8 +2853,7 @@ static sgl_context _sgl_alloc_context(void) { int slot_index = _sgl_pool_alloc_index(&_sgl.context_pool.pool); if (_SGL_INVALID_SLOT_INDEX != slot_index) { res = _sgl_make_ctx_id(_sgl_slot_alloc(&_sgl.context_pool.pool, &_sgl.context_pool.contexts[slot_index].slot, slot_index)); - } - else { + } else { // pool is exhausted res = _sgl_make_ctx_id(SG_INVALID_ID); } @@ -2888,6 +2878,7 @@ static void _sgl_init_context(sgl_context ctx_id, const sgl_context_desc_t* in_d // NOTE: frame_id must be non-zero, so that updates trigger in first frame ctx->frame_id = 1; ctx->cur_img = _sgl.def_img; + ctx->cur_smp = _sgl.def_smp; // allocate buffers and pools ctx->vertices.cap = ctx->desc.max_vertices; @@ -2933,8 +2924,7 @@ static sgl_context _sgl_make_context(const sgl_context_desc_t* desc) { sgl_context ctx_id = _sgl_alloc_context(); if (ctx_id.id != SG_INVALID_ID) { _sgl_init_context(ctx_id, desc); - } - else { + } else { _SGL_ERROR(CONTEXT_POOL_EXHAUSTED); } return ctx_id; @@ -3006,8 +2996,7 @@ static sg_commit_listener _sgl_make_commit_listener(_sgl_context_t* ctx) { static _sgl_vertex_t* _sgl_next_vertex(_sgl_context_t* ctx) { if (ctx->vertices.next < ctx->vertices.cap) { return &ctx->vertices.ptr[ctx->vertices.next++]; - } - else { + } else { ctx->error = SGL_ERROR_VERTICES_FULL; return 0; } @@ -3016,8 +3005,7 @@ static _sgl_vertex_t* _sgl_next_vertex(_sgl_context_t* ctx) { static _sgl_uniform_t* _sgl_next_uniform(_sgl_context_t* ctx) { if (ctx->uniforms.next < ctx->uniforms.cap) { return &ctx->uniforms.ptr[ctx->uniforms.next++]; - } - else { + } else { ctx->error = SGL_ERROR_UNIFORMS_FULL; return 0; } @@ -3026,8 +3014,7 @@ static _sgl_uniform_t* _sgl_next_uniform(_sgl_context_t* ctx) { static _sgl_command_t* _sgl_cur_command(_sgl_context_t* ctx) { if (ctx->commands.next > 0) { return &ctx->commands.ptr[ctx->commands.next - 1]; - } - else { + } else { return 0; } } @@ -3035,8 +3022,7 @@ static _sgl_command_t* _sgl_cur_command(_sgl_context_t* ctx) { static _sgl_command_t* _sgl_next_command(_sgl_context_t* ctx) { if (ctx->commands.next < ctx->commands.cap) { return &ctx->commands.ptr[ctx->commands.next++]; - } - else { + } else { ctx->error = SGL_ERROR_COMMANDS_FULL; return 0; } @@ -3320,13 +3306,18 @@ static void _sgl_setup_common(void) { img_desc.height = 8; img_desc.num_mipmaps = 1; img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; - img_desc.min_filter = SG_FILTER_NEAREST; - img_desc.mag_filter = SG_FILTER_NEAREST; img_desc.data.subimage[0][0] = SG_RANGE(pixels); img_desc.label = "sgl-default-texture"; _sgl.def_img = sg_make_image(&img_desc); SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_img.id); + sg_sampler_desc smp_desc; + _sgl_clear(&smp_desc, sizeof(smp_desc)); + smp_desc.min_filter = SG_FILTER_NEAREST; + smp_desc.mag_filter = SG_FILTER_NEAREST; + _sgl.def_smp = sg_make_sampler(&smp_desc); + SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_smp.id); + // one shader for all contexts sg_shader_desc shd_desc; _sgl_clear(&shd_desc, sizeof(shd_desc)); @@ -3347,9 +3338,15 @@ static void _sgl_setup_common(void) { ub->uniforms[0].name = "vs_params"; ub->uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; ub->uniforms[0].array_count = 8; - shd_desc.fs.images[0].name = "tex"; + shd_desc.fs.images[0].used = true; shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT; + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + shd_desc.fs.samplers[0].used = true; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.image_sampler_pairs[0].used = true; + shd_desc.fs.image_sampler_pairs[0].image_slot = 0; + shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; + shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; shd_desc.label = "sgl-shader"; #if defined(SOKOL_GLCORE33) shd_desc.vs.source = _sgl_vs_source_glsl330; @@ -3393,6 +3390,7 @@ static void _sgl_setup_common(void) { static void _sgl_discard_common(void) { sg_push_debug_group("sokol-gl"); sg_destroy_image(_sgl.def_img); + sg_destroy_sampler(_sgl.def_smp); sg_destroy_shader(_sgl.shd); sg_pop_debug_group(); } @@ -3408,6 +3406,7 @@ static void _sgl_draw(_sgl_context_t* ctx, int layer_id) { uint32_t cur_pip_id = SG_INVALID_ID; uint32_t cur_img_id = SG_INVALID_ID; + uint32_t cur_smp_id = SG_INVALID_ID; int cur_uniform_index = -1; if (ctx->update_frame_id != ctx->frame_id) { @@ -3442,12 +3441,15 @@ static void _sgl_draw(_sgl_context_t* ctx, int layer_id) { cur_pip_id = args->pip.id; /* when pipeline changes, also need to re-apply uniforms and bindings */ cur_img_id = SG_INVALID_ID; + cur_smp_id = SG_INVALID_ID; cur_uniform_index = -1; } - if (cur_img_id != args->img.id) { - ctx->bind.fs_images[0] = args->img; + if ((cur_img_id != args->img.id) || (cur_smp_id != args->smp.id)) { + ctx->bind.fs.images[0] = args->img; + ctx->bind.fs.samplers[0] = args->smp; sg_apply_bindings(&ctx->bind); cur_img_id = args->img.id; + cur_smp_id = args->smp.id; } if (cur_uniform_index != args->uniform_index) { const sg_range ub_range = { &ctx->uniforms.ptr[args->uniform_index], sizeof(_sgl_uniform_t) }; @@ -3519,8 +3521,7 @@ SOKOL_API_IMPL sgl_error_t sgl_error(void) { _sgl_context_t* ctx = _sgl.cur_ctx; if (ctx) { return ctx->error; - } - else { + } else { return SGL_ERROR_NO_CONTEXT; } } @@ -3529,8 +3530,7 @@ SOKOL_API_IMPL sgl_error_t sgl_context_error(sgl_context ctx_id) { const _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id); if (ctx) { return ctx->error; - } - else { + } else { return SGL_ERROR_NO_CONTEXT; } } @@ -3564,8 +3564,7 @@ SOKOL_API_IMPL void sgl_set_context(sgl_context ctx_id) { SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie); if (_sgl_is_default_context(ctx_id)) { _sgl.cur_ctx_id = _sgl.def_ctx_id; - } - else { + } else { _sgl.cur_ctx_id = ctx_id; } // this will return null if the handle isn't valid @@ -3586,8 +3585,7 @@ SOKOL_API_IMPL sgl_pipeline sgl_make_pipeline(const sg_pipeline_desc* desc) { _sgl_context_t* ctx = _sgl.cur_ctx; if (ctx) { return _sgl_make_pipeline(desc, &ctx->desc); - } - else { + } else { return _sgl_make_pip_id(SG_INVALID_ID); } } @@ -3597,8 +3595,7 @@ SOKOL_API_IMPL sgl_pipeline sgl_context_make_pipeline(sgl_context ctx_id, const const _sgl_context_t* ctx = _sgl_lookup_context(ctx_id.id); if (ctx) { return _sgl_make_pipeline(desc, &ctx->desc); - } - else { + } else { return _sgl_make_pip_id(SG_INVALID_ID); } } @@ -3637,8 +3634,7 @@ SOKOL_API_IMPL void sgl_push_pipeline(void) { if (ctx->pip_tos < (_SGL_MAX_STACK_DEPTH - 1)) { ctx->pip_tos++; ctx->pip_stack[ctx->pip_tos] = ctx->pip_stack[ctx->pip_tos-1]; - } - else { + } else { ctx->error = SGL_ERROR_STACK_OVERFLOW; } } @@ -3651,8 +3647,7 @@ SOKOL_API_IMPL void sgl_pop_pipeline(void) { } if (ctx->pip_tos > 0) { ctx->pip_tos--; - } - else { + } else { ctx->error = SGL_ERROR_STACK_UNDERFLOW; } } @@ -3669,6 +3664,7 @@ SOKOL_API_IMPL void sgl_defaults(void) { ctx->point_size = 1.0f; ctx->texturing_enabled = false; ctx->cur_img = _sgl.def_img; + ctx->cur_smp = _sgl.def_smp; sgl_load_default_pipeline(); _sgl_identity(_sgl_matrix_texture(ctx)); _sgl_identity(_sgl_matrix_modelview(ctx)); @@ -3753,7 +3749,7 @@ SOKOL_API_IMPL void sgl_disable_texture(void) { ctx->texturing_enabled = false; } -SOKOL_API_IMPL void sgl_texture(sg_image img) { +SOKOL_API_IMPL void sgl_texture(sg_image img, sg_sampler smp) { SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie); _sgl_context_t* ctx = _sgl.cur_ctx; if (!ctx) { @@ -3762,10 +3758,14 @@ SOKOL_API_IMPL void sgl_texture(sg_image img) { SOKOL_ASSERT(!ctx->in_begin); if (SG_INVALID_ID != img.id) { ctx->cur_img = img; - } - else { + } else { ctx->cur_img = _sgl.def_img; } + if (SG_INVALID_ID != smp.id) { + ctx->cur_smp = smp; + } else { + ctx->cur_smp = _sgl.def_smp; + } } SOKOL_API_IMPL void sgl_begin_points(void) { @@ -3846,9 +3846,10 @@ SOKOL_API_IMPL void sgl_end(void) { uni->tm = *_sgl_matrix_texture(ctx); } } - /* check if command can be merged with current command */ + // check if command can be merged with current command sg_pipeline pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type); sg_image img = ctx->texturing_enabled ? ctx->cur_img : _sgl.def_img; + sg_sampler smp = ctx->texturing_enabled ? ctx->cur_smp : _sgl.def_smp; _sgl_command_t* cur_cmd = _sgl_cur_command(ctx); bool merge_cmd = false; if (cur_cmd) { @@ -3858,23 +3859,24 @@ SOKOL_API_IMPL void sgl_end(void) { (ctx->cur_prim_type != SGL_PRIMITIVETYPE_TRIANGLE_STRIP) && !matrix_dirty && (cur_cmd->args.draw.img.id == img.id) && + (cur_cmd->args.draw.smp.id == smp.id) && (cur_cmd->args.draw.pip.id == pip.id)) { merge_cmd = true; } } if (merge_cmd) { - /* draw command can be merged with the previous command */ + // draw command can be merged with the previous command cur_cmd->args.draw.num_vertices += ctx->vertices.next - ctx->base_vertex; - } - else { - /* append a new draw command */ + } else { + // append a new draw command _sgl_command_t* cmd = _sgl_next_command(ctx); if (cmd) { SOKOL_ASSERT(ctx->uniforms.next > 0); cmd->cmd = SGL_COMMAND_DRAW; cmd->layer_id = ctx->layer_id; cmd->args.draw.img = img; + cmd->args.draw.smp = smp; cmd->args.draw.pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type); cmd->args.draw.base_vertex = ctx->base_vertex; cmd->args.draw.num_vertices = ctx->vertices.next - ctx->base_vertex; @@ -4261,8 +4263,7 @@ SOKOL_GL_API_DECL void sgl_push_matrix(void) { ctx->matrix_tos[ctx->cur_matrix_mode]++; _sgl_matrix_t* dst = _sgl_matrix(ctx); *dst = *src; - } - else { + } else { ctx->error = SGL_ERROR_STACK_OVERFLOW; } } @@ -4277,8 +4278,7 @@ SOKOL_GL_API_DECL void sgl_pop_matrix(void) { ctx->matrix_dirty = true; if (ctx->matrix_tos[ctx->cur_matrix_mode] > 0) { ctx->matrix_tos[ctx->cur_matrix_mode]--; - } - else { + } else { ctx->error = SGL_ERROR_STACK_UNDERFLOW; } } From f399fc981902bb7555897af54c356c74ff3bccc6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 18 Jun 2023 14:49:53 +0200 Subject: [PATCH 029/292] sokol_debugtext.h: fixes for separate images and samplers (fixme: HLSL and WGSL) --- util/sokol_debugtext.h | 1466 ++++++++++++++++++++-------------------- 1 file changed, 722 insertions(+), 744 deletions(-) diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index eed04361c..b505d0d8f 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -2374,7 +2374,7 @@ static const uint8_t _sdtx_font_oric[2048] = { /* Embedded source code compiled with: - sokol-shdc -i debugtext.glsl -o debugtext.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b + sokol-shdc -i debugtext.glsl -o debugtext.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b (not that for Metal and D3D11 byte code, sokol-shdc must be run on macOS and Windows) @@ -2393,19 +2393,20 @@ static const uint8_t _sdtx_font_oric[2048] = { @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; in vec2 uv; in vec4 color; out vec4 frag_color; void main() { - frag_color = texture(tex, uv).xxxx * color; + frag_color = texture(sampler2D(tex, smp), uv).xxxx * color; } @end @program debugtext vs fs */ #if defined(SOKOL_GLCORE33) -static const char _sdtx_vs_src_glsl330[300] = { +static const char _sdtx_vs_source_glsl330[298] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x6c,0x61, 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x69,0x74, @@ -2418,30 +2419,30 @@ static const char _sdtx_vs_src_glsl330[300] = { 0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a, 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a, - 0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x29, - 0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x31,0x2e,0x30,0x2c,0x20,0x31, - 0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, - 0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20, + 0x76,0x65,0x63,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x29,0x20, + 0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30, + 0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; - -static const char _sdtx_fs_src_glsl330[174] = { +static const char _sdtx_fs_source_glsl330[182] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, - 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x78,0x78,0x78, - 0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74, + 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20, + 0x75,0x76,0x29,0x2e,0x78,0x78,0x78,0x78,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_GLES3) -static const char _sdtx_vs_src_glsl300es[303] = { +static const char _sdtx_vs_source_glsl300es[301] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f, @@ -2454,283 +2455,276 @@ static const char _sdtx_vs_src_glsl300es[303] = { 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, 0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32, - 0x2e,0x30,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x31,0x2e,0x30, - 0x2c,0x20,0x31,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30, - 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e, + 0x30,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x31,0x2e,0x30,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f, + 0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _sdtx_fs_src_glsl300es[247] = { +static const char _sdtx_fs_source_glsl300es[255] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, - 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20, - 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69, - 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c, - 0x20,0x75,0x76,0x29,0x2e,0x78,0x78,0x78,0x78,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f, - 0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75, + 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x78,0x78, + 0x78,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _sdtx_vs_bytecode_metal_macos[2896] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x50,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x40,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sdtx_vs_bytecode_metal_macos[2796] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xdd,0xe8,0xa4,0x37,0x8a,0xdc,0xe6, - 0x75,0xeb,0x1f,0xc8,0x20,0x45,0xac,0xb2,0xcb,0x1e,0xd3,0x65,0x26,0x17,0x6c,0x41, - 0xce,0xd8,0x5c,0x1b,0x0b,0xf5,0x82,0x6a,0x2a,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xfe,0xa3,0xdd,0x3f,0xa3,0x19,0x66, + 0x48,0xdb,0x53,0x17,0xfa,0x47,0xab,0xcd,0x1c,0x32,0x10,0x34,0x47,0xde,0x1e,0x11, + 0x5c,0xfd,0x36,0x7a,0xb2,0xbe,0x26,0x50,0xa3,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x2c,0x0a,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x88,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x80,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x00,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00, - 0x01,0x00,0x00,0x00,0x13,0x82,0x00,0x00,0x89,0x20,0x00,0x00,0x14,0x00,0x00,0x00, - 0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3, - 0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c,0x10,0x2c,0x33,0x00, - 0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77,0x49,0x53,0x44,0x09,0x93,0xcf,0x00,0x48, - 0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28,0xc4,0x80,0x87,0x10,0x29,0xc4,0x44,0x08, - 0xd1,0x40,0xc0,0x1c,0x01,0x18,0xa4,0xc0,0x0d,0x23,0x10,0xc7,0x08,0x00,0x00,0x00, - 0x13,0xb2,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60, - 0x87,0x72,0x68,0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03, - 0x37,0x88,0x83,0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71, - 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80, - 0x07,0x6d,0x90,0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, - 0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d, - 0x90,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60, - 0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71, - 0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07, - 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a, - 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60, - 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07, - 0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78, - 0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10, - 0x07,0x79,0x20,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07, - 0x6d,0x60,0x0f,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72, - 0x50,0x07,0x76,0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20, - 0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07, - 0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d, - 0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x29,0x00, - 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x08,0x00,0x00,0x00, - 0x32,0x1e,0x98,0x0c,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xba, - 0x12,0x18,0x01,0x28,0x82,0x42,0x28,0x08,0xc2,0xb1,0x04,0xe5,0x01,0x00,0x00,0x00, - 0x79,0x18,0x00,0x00,0xdd,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25, - 0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x31,0x18,0x00,0x62,0x50,0xb9, - 0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x1c,0x81,0x21,0x1c,0x04, - 0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e, - 0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46,0xc6,0x25,0x26,0x06,0x04,0xa5,0xad,0x8c,0x2e, - 0x8c,0xcd,0xac,0xac,0x25,0x07,0x46,0xc6,0x25,0x26,0xc6,0x25,0x26,0x65,0x88,0x60, - 0x10,0x43,0x8c,0x23,0x38,0x8a,0x43,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x31, - 0x8e,0x23,0x38,0x82,0x43,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, - 0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6, - 0x56,0x36,0x44,0x30,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, - 0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62, - 0x6c,0x65,0x43,0x04,0x63,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5, - 0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99, - 0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x8c,0x86, - 0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46, - 0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26, - 0xc6,0x56,0x36,0x44,0x30,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c, - 0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17, - 0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0xc1,0x88,0x78, - 0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74, - 0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73, - 0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x04,0x63,0x62,0x14,0x96,0x26,0xe7, - 0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0xf5,0x56,0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e, - 0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x0d,0x26,0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98, - 0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0x97,0x5b,0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7, - 0x30,0x3a,0x19,0x32,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65, - 0x14,0xea,0xec,0x86,0x30,0x46,0x65,0x58,0xc6,0x65,0x60,0x46,0x66,0x68,0x5c,0xea, - 0xe6,0xca,0xe4,0x50,0xd8,0xde,0xc6,0xdc,0x62,0x52,0x68,0x98,0xb1,0xbd,0x85,0xd1, - 0xd1,0xb0,0x18,0x7b,0x63,0x7b,0x93,0x1b,0xc2,0x18,0x95,0xc1,0x19,0x97,0xd1,0x19, - 0x99,0xe1,0x91,0x09,0x4b,0x93,0x73,0x81,0x7b,0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0xe3, - 0x72,0xc6,0xf6,0x05,0xf5,0x36,0x97,0x46,0x97,0xf6,0xe6,0x36,0x44,0x31,0xc0,0xc0, - 0xb8,0x8c,0xce,0xc8,0x8c,0x30,0x18,0x62,0x18,0x9b,0xf1,0x19,0x62,0x40,0x28,0x2c, - 0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52, - 0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59, - 0x19,0x1e,0xb3,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x14,0x1c,0xb8,0xb7, - 0xb9,0x34,0xba,0xb4,0x37,0x37,0x22,0x3b,0x99,0x2f,0xb3,0x14,0x22,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x43,0x30,0xc8,0xc0,0x28,0x83,0x43,0x38,0x02, - 0xc3,0x0c,0x8c,0xcb,0xc0,0x8c,0xcc,0x38,0x03,0x6a,0x67,0x65,0x6e,0x65,0x72,0x61, - 0x74,0x65,0x64,0x28,0x39,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x44,0x76, - 0x32,0x5f,0x66,0x29,0x4c,0xe8,0xca,0xf0,0xc6,0xde,0xde,0xe4,0xc8,0x60,0x86,0x50, - 0x47,0x60,0x90,0x81,0x51,0x06,0x47,0x70,0x04,0x46,0x1a,0x18,0x97,0x81,0x19,0x99, - 0xa1,0x06,0xbc,0xce,0xca,0xdc,0xca,0xe4,0xc2,0xe8,0xca,0xc8,0x50,0x6c,0xc6,0xde, - 0xd8,0xde,0xe4,0x60,0x88,0xec,0x68,0xbe,0xcc,0x52,0x68,0x8c,0xbd,0xb1,0xbd,0xc9, - 0xc1,0x0c,0xa1,0x8e,0xc1,0x20,0x03,0xa3,0x0c,0x8e,0xe1,0x08,0x0c,0x36,0x30,0x2e, - 0xa3,0x33,0x32,0xa3,0x0d,0x86,0x18,0x06,0x1a,0x18,0x6b,0x60,0xb8,0xc1,0x10,0xa3, - 0x00,0x8c,0x31,0x30,0xde,0x60,0x44,0xc4,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xed, - 0xf0,0x0e,0xe4,0x50,0x0f,0xec,0x50,0x0e,0x6e,0x60,0x0e,0xec,0x10,0x0e,0xe7,0x30, - 0x0f,0x53,0x84,0x60,0x18,0xa1,0xb0,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3a,0x90, - 0x43,0x39,0xb8,0x03,0x3d,0x4c,0x09,0x8a,0x11,0x4b,0x38,0xa4,0x83,0x3c,0xb8,0x81, - 0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c,0x09,0x8c,0x11,0x54,0x38, - 0xa4,0x83,0x3c,0xb8,0x01,0x3b,0x84,0x83,0x3b,0x9c,0x43,0x3d,0x84,0xc3,0x39,0x94, - 0xc3,0x2f,0xd8,0x43,0x39,0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0x00,0x19, - 0x31,0x85,0x43,0x3a,0xc8,0x83,0x1b,0x8c,0xc3,0x3b,0xb4,0x03,0x3c,0xa4,0x03,0x3b, - 0x94,0xc3,0x2f,0xbc,0x03,0x3c,0xd0,0x43,0x3a,0xbc,0x83,0x3b,0xcc,0xc3,0x14,0x43, - 0x61,0x1c,0x48,0xa2,0x46,0x28,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2, - 0x40,0x0f,0xe5,0x80,0x0f,0x53,0x02,0x38,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, - 0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6, - 0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce, - 0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8, - 0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48, - 0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11, - 0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e, - 0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89, - 0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b, - 0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37, - 0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78, - 0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81, - 0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1, - 0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c, - 0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39, - 0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc, - 0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58, - 0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87, - 0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f, - 0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e, - 0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66, - 0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b, - 0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0, - 0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e, - 0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc, - 0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3, - 0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07, - 0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, - 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x94,0x63,0x11,0x40, - 0x60,0x1c,0x73,0x10,0x42,0xc0,0x30,0x74,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82, - 0x20,0x18,0x80,0x20,0x08,0x82,0xe0,0x30,0x96,0x00,0x82,0x20,0x88,0xff,0x02,0x08, - 0x82,0x20,0xfe,0xcd,0x00,0x90,0xcc,0x41,0x50,0xd4,0x24,0xd1,0xcc,0x00,0x10,0x8c, - 0x11,0x80,0x20,0x08,0xe2,0xdf,0x08,0xc0,0x0c,0x00,0x00,0x00,0xe6,0x20,0xf2,0xb1, - 0x00,0x81,0xcf,0x20,0x43,0x80,0x30,0x83,0x0c,0x01,0xe2,0xcc,0x36,0x20,0x11,0x30, - 0xdb,0x10,0x44,0xc1,0x6c,0x43,0x30,0x08,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xcc,0x09,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x70,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x00,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x18,0xc2,0xff,0xff,0xff,0xff,0x0f,0x80,0x04,0x50,0x00, + 0x49,0x18,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x82,0x60,0x42,0x20,0x00,0x00,0x00, + 0x89,0x20,0x00,0x00,0x11,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04, + 0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c, + 0x0b,0x84,0x84,0x4c,0x10,0x34,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76, + 0x08,0x91,0x42,0x4c,0x84,0x10,0x15,0x22,0x22,0x82,0x6c,0x20,0x60,0x8e,0x00,0x0c, + 0x52,0x20,0x87,0x11,0x88,0x64,0x04,0x00,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48, + 0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83, + 0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38, + 0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a, + 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0, + 0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e, + 0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73, + 0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40, + 0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07, + 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a, + 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10, + 0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72, + 0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07, + 0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a, + 0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20, + 0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07, + 0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72, + 0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0, + 0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07, + 0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70, + 0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0, + 0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x29,0x00,0x00,0x08,0x00,0x00, + 0x00,0x00,0x00,0x18,0xc2,0x1c,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64,0x81, + 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90, + 0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xca,0x12,0x18,0x01,0x28,0x82,0x42,0x28,0x08, + 0xd2,0xb1,0x84,0x26,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xb1,0x00,0x00,0x00, + 0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7, + 0x21,0x46,0x42,0x20,0x80,0x72,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, + 0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4, + 0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac, + 0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0x80,0x10, + 0x43,0x8c,0x44,0x48,0x8c,0x64,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e, + 0x44,0x48,0x84,0x64,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56, + 0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56, + 0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65, + 0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c, + 0x65,0x43,0x04,0x64,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1, + 0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95, + 0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x51, + 0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d, + 0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69, + 0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34, + 0xcc,0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9, + 0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20,0x0f,0x02,0x21,0x11,0x22,0x21,0x13, + 0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6, + 0xf6,0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08,0x83,0x3c,0x88,0x85, + 0x44,0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e, + 0xed,0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10, + 0x05,0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86,0x18,0x48,0x85,0x64,0x08,0x47,0x28, + 0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e, + 0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b, + 0x59,0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0xaf,0xaf, + 0xb0,0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf, + 0xaf,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x64,0x40,0x3c, + 0xe4,0x4b,0x86,0x44,0x40,0xc0,0x00,0x89,0x10,0x09,0x99,0x90,0x30,0x60,0x42,0x57, + 0x86,0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84,0x4a,0x04,0xc4,0x43,0xbe,0x44,0x48, + 0x04,0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72, + 0x30,0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88,0x44,0x40,0xc0,0x00,0x89,0x90,0x0b, + 0x99,0x90,0x32,0x18,0x62,0x20,0x62,0x80,0x90,0x01,0x62,0x06,0x43,0x8c,0x02,0x40, + 0x3a,0xe4,0x0c,0x46,0x44,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0xd0,0x0e,0xef,0x40, + 0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0,0x0e,0xe1,0x70,0x0e,0xf3,0x30,0x45, + 0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xa4,0x03,0x39,0x94,0x83, + 0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39, + 0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0xc0,0x18,0x41,0x85,0x43,0x3a,0xc8, + 0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4,0x43,0x38,0x9c,0x43,0x39,0xfc,0x82, + 0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c,0x09,0x90,0x11,0x53,0x38, + 0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b,0xc0,0x43,0x3a,0xb0,0x43,0x39,0xfc, + 0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x3c,0x4c,0x19,0x14,0xc6,0x19, + 0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8,0x03,0x3d,0x94,0x03,0x3e, + 0x4c,0x09,0xd0,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c, + 0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07, + 0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e, + 0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43, + 0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c, + 0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76, + 0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e, + 0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8, + 0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4, + 0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68, + 0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07, + 0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71, + 0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5, + 0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4, + 0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90, + 0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43, + 0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b, + 0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78, + 0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2, + 0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20, + 0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0, + 0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83, + 0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07, + 0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61, + 0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d, + 0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39, + 0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79, + 0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3, + 0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4, + 0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8, + 0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83, + 0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x05,0x00,0x00,0x00, + 0x06,0x50,0x30,0x00,0xd2,0xd0,0x16,0xd0,0x00,0x48,0xe4,0x17,0x0c,0xe0,0x57,0x76, + 0x71,0xdb,0x00,0x00,0x61,0x20,0x00,0x00,0x1b,0x00,0x00,0x00,0x13,0x04,0x41,0x2c, + 0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xb4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10, + 0x83,0xd0,0x34,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82,0x20,0x18,0x80,0x20, + 0x08,0x82,0xe0,0x30,0x96,0x00,0x82,0x20,0x88,0xff,0x02,0x08,0x82,0x20,0xfe,0xcd, + 0x00,0x90,0xcc,0x41,0x54,0x15,0x35,0xd1,0xcc,0x00,0x10,0x8c,0x11,0x80,0x20,0x08, + 0xe2,0xdf,0x08,0xc0,0x0c,0x00,0x00,0x00,0x23,0x06,0x86,0x10,0x54,0x0e,0x72,0x0c, + 0x32,0x04,0xc7,0x32,0xc8,0x10,0x1c,0xcd,0x6c,0xc3,0x01,0x01,0xb3,0x0d,0x01,0x14, + 0xcc,0x36,0x04,0x83,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sdtx_fs_bytecode_metal_macos[2925] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x90,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sdtx_fs_bytecode_metal_macos[2825] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x09,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x30,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xea,0x91,0xf4,0xf5,0xea,0xea,0x43, - 0x77,0xcf,0xab,0x49,0x97,0x29,0xd8,0x26,0x5d,0xff,0x05,0x61,0xc6,0x93,0xc7,0x6c, - 0xb2,0x20,0x78,0x63,0x91,0x45,0x5c,0xbe,0x1c,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xf6,0x61,0xa5,0x24,0x2e,0x8e,0x25, + 0x56,0xa9,0xb9,0xe4,0x35,0x58,0x0f,0xd8,0xb4,0x32,0x8b,0xbc,0x73,0xb0,0x70,0xbe, + 0x5d,0x66,0xf0,0xf4,0x12,0x93,0x26,0xe5,0xdd,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x70,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x99,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x21,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x14,0x58,0xc3,0x08,0xc4,0x32,0x02,0x00,0x00,0x00,0x13,0xb2,0x70, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x1c,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x84,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1e,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x30,0x02,0xb1,0x8c,0x00,0x00,0x00,0x00,0x00,0x13,0xb2,0x70, 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83, 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, @@ -2757,62 +2751,54 @@ static const uint8_t _sdtx_fs_bytecode_metal_macos[2925] = { 0x00,0x00,0x00,0x00,0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64, 0x81,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50, - 0x10,0x65,0x40,0x70,0x2c,0x41,0x79,0x00,0x00,0x79,0x18,0x00,0x00,0xd9,0x00,0x00, + 0x10,0x65,0x40,0x70,0x2c,0xa1,0x09,0x00,0x00,0x79,0x18,0x00,0x00,0xb9,0x00,0x00, 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37, 0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b, - 0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c, - 0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46, - 0xc6,0x25,0x26,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x25,0x07,0x46, - 0xc6,0x25,0x26,0xc6,0x25,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65, - 0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16, - 0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26, - 0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61, - 0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f, - 0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x61,0x19, - 0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5, - 0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5, - 0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6, - 0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56, - 0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x1e,0x92, - 0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d, - 0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda, - 0x5c,0x98,0x18,0x5b,0xd9,0x10,0xe1,0x89,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f, - 0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64, - 0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c, - 0x65,0x43,0x84,0x67,0x62,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46,0x56,0x26,0xf7, - 0x45,0x17,0x26,0x77,0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c,0xee,0xec,0x8b, - 0x2e,0x0f,0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b,0x18,0x1d,0x0d, - 0x99,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32,0x2a,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43,0x98,0xa7,0x5a,0x86,0xc7,0x7a,0xae, - 0x07,0x7b,0xb2,0x21,0xc2,0xa3,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93,0x0b,0x3b,0x6b, - 0x2b,0x73,0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57,0x26,0x87,0xc2, - 0xf6,0x36,0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc,0x8d,0xae,0x4c, - 0x8e,0x4f,0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18,0x5d,0x9a,0x5d, - 0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x0a,0x75,0x76,0x43,0xa4,0x65,0x78,0xb8, - 0xa7,0x7b,0xbc,0xe7,0x7b,0xac,0x07,0x0c,0x1e,0xec,0x09,0x03,0x2e,0x75,0x73,0x65, - 0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x2c,0xc6,0xde,0xd8,0xde,0xe4,0x86,0x48, - 0x8b,0xf0,0x70,0xcf,0x18,0x3c,0xde,0xf3,0x3d,0xd6,0x73,0x3d,0xd8,0x43,0x06,0x5c, - 0xc2,0xd2,0xe4,0x5c,0xe8,0xca,0xf0,0xe8,0xea,0xe4,0xca,0x28,0x85,0xa5,0xc9,0xb9, - 0xb0,0xbd,0x8d,0x85,0xd1,0xa5,0xbd,0xb9,0x7d,0xa5,0xb9,0x91,0x95,0xe1,0x51,0x09, - 0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x23,0x46,0x57,0x86,0x47,0x57,0x27, - 0x57,0x26,0x43,0xc6,0x63,0xc6,0xf6,0x16,0x46,0xc7,0x02,0x32,0x17,0xd6,0x06,0xc7, - 0x56,0xe6,0xc3,0x81,0xae,0x0c,0x6f,0x08,0xb5,0x10,0x8f,0x19,0x3c,0x67,0xb0,0x0c, - 0x8b,0xf0,0xa0,0xc1,0x63,0x3d,0x69,0xf0,0x60,0x8f,0x1a,0x70,0x09,0x4b,0x93,0x73, - 0x99,0x0b,0x6b,0x83,0x63,0x2b,0x93,0xe3,0x31,0x17,0xd6,0x06,0xc7,0x56,0x26,0x47, - 0x84,0xae,0x0c,0x6f,0xaa,0x0d,0x8e,0x4d,0x6e,0x88,0xb4,0x1c,0x0f,0x1b,0x3c,0x67, - 0xb0,0x0c,0x8b,0xf0,0x58,0x4f,0x1b,0x3c,0xd8,0xe3,0x06,0x43,0x90,0x47,0x0c,0x9e, - 0x32,0x78,0xd6,0xe0,0x79,0x83,0x21,0x46,0x02,0x3c,0xdb,0x03,0x07,0x23,0x22,0x76, - 0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77,0x20,0x87,0x7a,0x60,0x87,0x72,0x70, - 0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98,0x22,0x04,0xc3,0x08,0x85,0x1d,0xd8, - 0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d,0xe8,0x61,0x4a,0x50,0x8c, - 0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x61,0x1e,0xd2,0xe1,0x1d, - 0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xd8,0x21,0x1c,0xdc, - 0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e,0xca,0x41,0x1e,0xe6,0x21, - 0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2,0x41,0x1e,0xdc,0x60,0x1c, - 0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1,0x1d,0xe0,0x81,0x1e,0xd2, - 0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x18,0x0a,0xe3,0x40,0x12,0x35,0x82,0x09,0x87,0x74, - 0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70,0x07,0x7a,0x98, - 0x12,0xc4,0x01,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80, + 0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c, + 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26, + 0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac, + 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0, + 0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79, + 0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, + 0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6, + 0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62, + 0x6c,0x65,0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5, + 0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99, + 0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86, + 0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59, + 0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f, + 0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c, + 0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd, + 0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08, + 0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b, + 0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c, + 0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72, + 0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34,0xcc,0xd8,0xde, + 0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x96,0xe1,0xb1,0x9e,0xeb,0xc1,0x9e,0xec, + 0x81,0x1e,0xed,0x91,0x9e,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x5b, + 0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21,0xd2,0x22,0x3c,0xd6,0xd3,0x3d,0xd8, + 0x93,0x3d,0xd0,0x13,0x3d,0xd2,0xe3,0x71,0x09,0x4b,0x93,0x73,0xa1,0x2b,0xc3,0xa3, + 0xab,0x93,0x2b,0xa3,0x14,0x96,0x26,0xe7,0xc2,0xf6,0x36,0x16,0x46,0x97,0xf6,0xe6, + 0xf6,0x95,0xe6,0x46,0x56,0x86,0x47,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e, + 0xad,0x8c,0x18,0x5d,0x19,0x1e,0x5d,0x9d,0x5c,0x99,0x0c,0x19,0x8f,0x19,0xdb,0x5b, + 0x18,0x1d,0x0b,0xc8,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x0f,0x07,0xba,0x32,0xbc,0x21, + 0xd4,0x42,0x3c,0x60,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x23,0x06,0x0f,0xf4,0x8c,0xc1, + 0x23,0x3d,0x64,0xc0,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x4c,0x8e, + 0xc7,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x87,0xb9,0x36,0xb8,0x21,0xd2,0x72,0x3c, + 0x66,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x03,0x3d,0x67,0xf0,0x48,0x0f,0x1a,0x0c,0x41, + 0x1e,0xee,0xf9,0x9e,0x32,0x78,0xd2,0x60,0x88,0x91,0x00,0x4f,0xf5,0xa8,0xc1,0x88, + 0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1, + 0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61, + 0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12, + 0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74, + 0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08, + 0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87, + 0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74,0x90,0x07,0x37, + 0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0, + 0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x83,0xc2,0x38,0x23,0x98,0x70,0x48,0x07, + 0x79,0x70,0x03,0x73,0x90,0x87,0x70,0x38,0x87,0x76,0x28,0x07,0x77,0xa0,0x87,0x29, + 0xc1,0x1a,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, @@ -2839,266 +2825,262 @@ static const uint8_t _sdtx_fs_bytecode_metal_macos[2925] = { 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21, 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43, 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87, - 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00, - 0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00, - 0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d, - 0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00, - 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x14,0x47,0x00, - 0x88,0x8d,0x00,0x90,0x1a,0x01,0xa8,0x01,0x12,0x33,0x00,0x14,0x66,0x00,0x08,0x8c, - 0x00,0x00,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x4c,0x09,0xb2,0x10,0x46,0x11,0x0c, - 0x32,0x04,0x03,0x62,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c, + 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e, + 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c, + 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c, + 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00, + 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, + 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00, + 0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, + 0x00,0x06,0x00,0x00,0x00,0x14,0x47,0x00,0x88,0x8d,0x00,0x90,0x1a,0x01,0xa8,0x01, + 0x12,0x33,0x00,0x14,0x66,0x00,0x08,0x8c,0x00,0x00,0x00,0x00,0x00,0x23,0x06,0x8a, + 0x10,0x4c,0x09,0xb2,0x10,0x46,0x11,0x0c,0x32,0x04,0x03,0x62,0x01,0x23,0x9f,0xd9, + 0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sdtx_vs_bytecode_metal_ios[2896] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x50,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x40,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sdtx_vs_bytecode_metal_ios[2796] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xa2,0x1f,0xa0,0x5e,0xa1,0x48,0x8e, - 0x9f,0xa4,0xc2,0x68,0xf5,0x56,0xca,0xed,0xf9,0xdd,0x8a,0x35,0x42,0xe2,0x79,0x40, - 0xd7,0xab,0x99,0x96,0x7f,0x41,0x4c,0xde,0xb0,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xba,0x9f,0x15,0xc2,0x1c,0x90,0x81, + 0x14,0x52,0x1d,0xff,0x02,0xbe,0x84,0x58,0x4b,0x16,0xdb,0x77,0xe8,0xfc,0xb2,0x67, + 0xb1,0x23,0xf1,0x84,0xb0,0x8d,0xed,0xb3,0x81,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x20,0x0a,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x85,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x80,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x00,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00, - 0x01,0x00,0x00,0x00,0x13,0x82,0x00,0x00,0x89,0x20,0x00,0x00,0x14,0x00,0x00,0x00, - 0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3, - 0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c,0x10,0x2c,0x33,0x00, - 0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77,0x49,0x53,0x44,0x09,0x93,0xcf,0x00,0x48, - 0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28,0xc4,0x80,0x87,0x10,0x29,0xc4,0x44,0x08, - 0xd1,0x40,0xc0,0x1c,0x01,0x18,0xa4,0xc0,0x0d,0x23,0x10,0xc7,0x08,0x00,0x00,0x00, - 0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60, - 0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83, - 0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d, - 0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0, - 0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07, - 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76, - 0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a, - 0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, - 0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07, - 0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, - 0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0, - 0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07, - 0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a, - 0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50, - 0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07, - 0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75, - 0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0, - 0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07, - 0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76, - 0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x02,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80, - 0x2c,0x10,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x0c,0x19,0x11,0x4c,0x90, - 0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xba,0x12,0x18,0x01,0x28,0x82,0x42,0x28,0x08, - 0xc2,0xb1,0x84,0x46,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xdc,0x00,0x00,0x00, - 0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7, - 0x21,0xc6,0x31,0x18,0x00,0x62,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, - 0x2b,0x1b,0x62,0x1c,0x81,0x21,0x1c,0x04,0xd7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84, - 0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46,0xc6, - 0x25,0x07,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x25,0x07,0x46,0xc6,0x25, - 0xc7,0xc5,0x26,0x26,0x65,0x88,0x60,0x10,0x43,0x8c,0x23,0x38,0x8a,0x43,0x60,0xd1, - 0x54,0x46,0x17,0xc6,0x36,0x04,0x31,0x8e,0x23,0x38,0x84,0x43,0xe0,0x16,0x96,0x26, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xc4,0x09,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x6e,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x00,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x18,0xc2,0xff,0xff,0xff,0xff,0x0f,0x80,0x04,0x50,0x00, + 0x49,0x18,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x82,0x60,0x42,0x20,0x00,0x00,0x00, + 0x89,0x20,0x00,0x00,0x11,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04, + 0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c, + 0x0b,0x84,0x84,0x4c,0x10,0x34,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76, + 0x08,0x91,0x42,0x4c,0x84,0x10,0x15,0x22,0x22,0x82,0x6c,0x20,0x60,0x8e,0x00,0x0c, + 0x52,0x20,0x87,0x11,0x88,0x64,0x04,0x00,0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48, + 0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83, + 0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e, + 0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0, + 0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0, + 0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6, + 0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07, + 0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6, + 0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80, + 0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07, + 0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75, + 0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0, + 0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07, + 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70, + 0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20, + 0x07,0x43,0x98,0x02,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0xcc,0x01,0x04, + 0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00, + 0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xca, + 0x12,0x18,0x01,0x28,0x82,0x42,0x28,0x08,0xd2,0xb1,0x04,0x48,0x00,0x00,0x00,0x00, + 0x79,0x18,0x00,0x00,0xb1,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25, + 0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0x46,0x42,0x20,0x80,0x72,0x50,0xb9, + 0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x05, + 0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c, + 0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04, + 0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6, + 0xe6,0xc6,0x45,0x26,0x65,0x88,0x80,0x10,0x43,0x8c,0x44,0x48,0x8c,0x64,0x60,0xd1, + 0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e,0x44,0x48,0x84,0x64,0xe0,0x16,0x96,0x26, 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36, - 0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x30,0x12,0x72,0x61,0x69,0x72, + 0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72, 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61, - 0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x63,0x21,0x19,0x84,0xa5, + 0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x21,0x19,0x84,0xa5, 0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89, 0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89, - 0xb1,0x95,0x0d,0x11,0x8c,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97, - 0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6,0x56, - 0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x30,0x1e,0x92,0x41,0x58,0x9a, - 0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d,0xd9, - 0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98,0x18, - 0x5b,0xd9,0x10,0xc1,0x88,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69, - 0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f,0x76, - 0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x04, - 0x63,0x62,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0xf5,0x56,0x47, - 0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x0d,0x26,0x85, - 0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0x97,0x5b,0x58, - 0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x32,0x61,0x69,0x72,0x2e,0x61,0x72, - 0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86,0x30,0x46,0x65,0x58,0xc6,0x65, - 0x60,0x46,0x66,0x68,0x5c,0xea,0xe6,0xca,0xe4,0x50,0xd8,0xde,0xc6,0xdc,0x62,0x52, - 0x68,0x98,0xb1,0xbd,0x85,0xd1,0xd1,0xb0,0x18,0x7b,0x63,0x7b,0x93,0x1b,0xc2,0x18, - 0x95,0xc1,0x19,0x97,0xd1,0x19,0x99,0xe1,0x91,0x09,0x4b,0x93,0x73,0x81,0x7b,0x9b, - 0x4b,0xa3,0x4b,0x7b,0x73,0xe3,0x72,0xc6,0xf6,0x05,0xf5,0x36,0x97,0x46,0x97,0xf6, - 0xe6,0x36,0x44,0x31,0xc0,0xc0,0xb8,0x8c,0xce,0xc8,0x8c,0x30,0x18,0x62,0x18,0x9b, - 0xf1,0x19,0x62,0x40,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b, - 0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda, - 0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xb3,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba, - 0x32,0x32,0x14,0x1c,0xb8,0xb7,0xb9,0x34,0xba,0xb4,0x37,0x37,0x22,0x3b,0x99,0x2f, - 0xb3,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x43,0x30,0xc8, - 0xc0,0x28,0x83,0x43,0x38,0x02,0xc3,0x0c,0x8c,0xcb,0xc0,0x8c,0xcc,0x38,0x03,0x6a, - 0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x39,0x74,0x65,0x78,0x63,0x6f, - 0x6f,0x72,0x64,0x30,0x44,0x76,0x32,0x5f,0x66,0x29,0x4c,0xe8,0xca,0xf0,0xc6,0xde, - 0xde,0xe4,0xc8,0x60,0x86,0x50,0x47,0x60,0x90,0x81,0x51,0x06,0x47,0x70,0x04,0x46, - 0x1a,0x18,0x97,0x81,0x19,0x99,0xa1,0x06,0xbc,0xce,0xca,0xdc,0xca,0xe4,0xc2,0xe8, - 0xca,0xc8,0x50,0x6c,0xc6,0xde,0xd8,0xde,0xe4,0x60,0x88,0xec,0x68,0xbe,0xcc,0x52, - 0x68,0x8c,0xbd,0xb1,0xbd,0xc9,0xc1,0x0c,0xa1,0x8e,0xc1,0x20,0x03,0xa3,0x0c,0x8e, - 0xe1,0x08,0x0c,0x36,0x30,0x2e,0xa3,0x33,0x32,0xa3,0x0d,0x86,0x18,0x06,0x1a,0x18, - 0x6b,0x60,0xb8,0xc1,0x10,0xa3,0x00,0x8c,0x31,0x30,0xde,0x60,0x44,0xc4,0x0e,0xec, - 0x60,0x0f,0xed,0xe0,0x06,0xed,0xf0,0x0e,0xe4,0x50,0x0f,0xec,0x50,0x0e,0x6e,0x60, - 0x0e,0xec,0x10,0x0e,0xe7,0x30,0x0f,0x53,0x84,0x60,0x18,0xa1,0xb0,0x03,0x3b,0xd8, - 0x43,0x3b,0xb8,0x41,0x3a,0x90,0x43,0x39,0xb8,0x03,0x3d,0x4c,0x09,0x8a,0x11,0x4b, - 0x38,0xa4,0x83,0x3c,0xb8,0x81,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b, - 0x4c,0x09,0x8c,0x11,0x54,0x38,0xa4,0x83,0x3c,0xb8,0x01,0x3b,0x84,0x83,0x3b,0x9c, - 0x43,0x3d,0x84,0xc3,0x39,0x94,0xc3,0x2f,0xd8,0x43,0x39,0xc8,0xc3,0x3c,0xa4,0xc3, - 0x3b,0xb8,0xc3,0x94,0x00,0x19,0x31,0x85,0x43,0x3a,0xc8,0x83,0x1b,0x8c,0xc3,0x3b, - 0xb4,0x03,0x3c,0xa4,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x03,0x3c,0xd0,0x43,0x3a,0xbc, - 0x83,0x3b,0xcc,0xc3,0x14,0x43,0x61,0x1c,0x48,0xa2,0x46,0x28,0xe1,0x90,0x0e,0xf2, - 0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x40,0x0f,0xe5,0x80,0x0f,0x53,0x02,0x38,0x00,0x00, - 0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66, - 0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73, - 0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e, - 0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b, - 0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b, - 0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20, - 0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0, - 0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61, - 0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83, - 0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87, - 0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76, - 0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98, - 0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30, - 0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61, - 0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43, - 0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b, - 0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7, - 0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18, - 0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90, - 0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1, - 0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d, - 0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24, - 0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c, - 0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d, - 0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54, - 0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4, - 0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18, - 0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00, - 0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00, + 0xb1,0x95,0x0d,0x11,0x90,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19, + 0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7, + 0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70, + 0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5, + 0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20, + 0x0f,0x02,0x21,0x11,0x22,0x21,0x13,0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b, + 0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6,0xf6,0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed, + 0x4d,0x6e,0x08,0x83,0x3c,0x88,0x85,0x44,0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d, + 0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb, + 0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10,0x05,0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86, + 0x18,0x48,0x85,0x64,0x08,0x47,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c, + 0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18, + 0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9, + 0x30,0xba,0x32,0x32,0x94,0xaf,0xaf,0xb0,0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32, + 0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf,0xaf,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69, + 0x6f,0x6e,0x43,0xa8,0x64,0x40,0x3c,0xe4,0x4b,0x86,0x44,0x40,0xc0,0x00,0x89,0x10, + 0x09,0x99,0x90,0x30,0x60,0x42,0x57,0x86,0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84, + 0x4a,0x04,0xc4,0x43,0xbe,0x44,0x48,0x04,0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19, + 0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88, + 0x44,0x40,0xc0,0x00,0x89,0x90,0x0b,0x99,0x90,0x32,0x18,0x62,0x20,0x62,0x80,0x90, + 0x01,0x62,0x06,0x43,0x8c,0x02,0x40,0x3a,0xe4,0x0c,0x46,0x44,0xec,0xc0,0x0e,0xf6, + 0xd0,0x0e,0x6e,0xd0,0x0e,0xef,0x40,0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0, + 0x0e,0xe1,0x70,0x0e,0xf3,0x30,0x45,0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4, + 0x83,0x1b,0xa4,0x03,0x39,0x94,0x83,0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43, + 0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94, + 0xc0,0x18,0x41,0x85,0x43,0x3a,0xc8,0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4, + 0x43,0x38,0x9c,0x43,0x39,0xfc,0x82,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83, + 0x3b,0x4c,0x09,0x90,0x11,0x53,0x38,0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b, + 0xc0,0x43,0x3a,0xb0,0x43,0x39,0xfc,0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8, + 0xc3,0x3c,0x4c,0x19,0x14,0xc6,0x19,0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43, + 0x39,0xc8,0x03,0x3d,0x94,0x03,0x3e,0x4c,0x09,0xd0,0x00,0x00,0x79,0x18,0x00,0x00, + 0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, + 0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6, + 0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce, + 0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8, + 0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48, + 0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11, + 0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e, + 0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89, + 0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b, + 0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37, + 0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78, + 0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81, + 0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1, + 0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c, + 0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39, + 0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc, + 0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58, + 0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87, + 0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f, + 0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e, + 0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66, + 0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b, + 0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0, + 0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e, + 0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc, + 0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3, + 0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07, + 0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e, + 0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e, + 0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d, + 0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00, + 0x71,0x20,0x00,0x00,0x05,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x16,0xd0, + 0x00,0x48,0xe4,0x17,0x0c,0xe0,0x57,0x76,0x71,0xdb,0x00,0x00,0x61,0x20,0x00,0x00, 0x1b,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x94,0x63,0x11,0x40,0x60,0x1c,0x73,0x10,0x42,0xc0,0x30,0x74,0x33,0x00,0x14,0x63, + 0xb4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10,0x83,0xd0,0x34,0x94,0x33,0x00,0x14,0x63, 0x09,0x20,0x08,0x82,0x20,0x18,0x80,0x20,0x08,0x82,0xe0,0x30,0x96,0x00,0x82,0x20, - 0x88,0xff,0x02,0x08,0x82,0x20,0xfe,0xcd,0x00,0x90,0xcc,0x41,0x50,0xd4,0x24,0xd1, + 0x88,0xff,0x02,0x08,0x82,0x20,0xfe,0xcd,0x00,0x90,0xcc,0x41,0x54,0x15,0x35,0xd1, 0xcc,0x00,0x10,0x8c,0x11,0x80,0x20,0x08,0xe2,0xdf,0x08,0xc0,0x0c,0x00,0x00,0x00, - 0xe6,0x20,0xf2,0xb1,0x00,0x81,0xcf,0x20,0x43,0x80,0x30,0x83,0x0c,0x01,0xe2,0xcc, - 0x36,0x20,0x11,0x30,0xdb,0x10,0x44,0xc1,0x6c,0x43,0x30,0x08,0x19,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x23,0x06,0x86,0x10,0x54,0x0e,0x72,0x0c,0x32,0x04,0xc7,0x32,0xc8,0x10,0x1c,0xcd, + 0x6c,0xc3,0x01,0x01,0xb3,0x0d,0x01,0x14,0xcc,0x36,0x04,0x83,0x90,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sdtx_fs_bytecode_metal_ios[2909] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x5d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sdtx_fs_bytecode_metal_ios[2825] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x09,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x30,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x2e,0x61,0xb5,0x48,0xc0,0xda,0xe2, - 0xd5,0xd0,0xc4,0x03,0x62,0x19,0xb0,0xc7,0xd7,0x9e,0x78,0x2c,0x20,0x75,0xa7,0xa5, - 0x35,0x9c,0xa0,0x5a,0x3e,0x5d,0xbc,0x8f,0xc9,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x5c,0x3b,0x31,0x10,0xb3,0x9b,0xe2, + 0x6d,0x48,0xbf,0xdd,0x8e,0xac,0x5d,0xcc,0x7d,0x7b,0xba,0xe9,0xfb,0xe5,0xd0,0xdd, + 0xf7,0xec,0x82,0x0c,0xb9,0x6a,0xd2,0x30,0x4d,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x68,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x97,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x21,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x14,0x58,0xc3,0x08,0xc4,0x32,0x02,0x00,0x00,0x00,0x13,0xa8,0x70, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x14,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x82,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1e,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x30,0x02,0xb1,0x8c,0x00,0x00,0x00,0x00,0x00,0x13,0xa8,0x70, 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51, 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, @@ -3124,63 +3106,55 @@ static const uint8_t _sdtx_fs_bytecode_metal_ios[2909] = { 0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03, 0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00, 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43, - 0x5a,0x23,0x00,0x25,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0xa1,0x11,0x00, - 0x00,0x79,0x18,0x00,0x00,0xd9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, + 0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0x01,0x12,0x00, + 0x00,0x79,0x18,0x00,0x00,0xb9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50, - 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc3,0x23,0x2c, - 0x05,0xd7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c, - 0x6e,0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46,0xc6,0x25,0x07,0x04,0xa5,0xad,0x8c,0x2e, - 0x8c,0xcd,0xac,0xac,0x25,0x07,0x46,0xc6,0x25,0xc7,0xc5,0x26,0x26,0x65,0x88,0xf0, - 0x10,0x43,0x8c,0x65,0x58,0x8c,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79, - 0x8e,0x65,0x58,0x84,0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, - 0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6, - 0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, - 0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62, - 0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5, - 0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99, - 0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x61, - 0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97, - 0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6, - 0x56,0x36,0x44,0x78,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a, - 0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb, - 0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0xe1,0x89,0x78,0x06, - 0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69, - 0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f, - 0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x62,0x14,0x96,0x26,0xe7,0x22, - 0x57,0xe6,0x46,0x56,0x26,0xf7,0x45,0x17,0x26,0x77,0x56,0x46,0xc7,0x28,0x2c,0x4d, - 0xce,0x25,0x4c,0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c,0x86, - 0x19,0xdb,0x5b,0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xb7, - 0xb0,0xb6,0x32,0x2a,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43,0x98, - 0xa7,0x5a,0x84,0xc7,0x7a,0xae,0x07,0x7b,0xb2,0x21,0xc2,0xa3,0x51,0x0a,0x4b,0x93, - 0x73,0x31,0x93,0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3,0xe3, - 0x52,0x37,0x57,0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d,0xce, - 0x65,0xac,0xcc,0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc,0x1c, - 0x5c,0xd9,0x18,0x5d,0x9a,0x5d,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x0a,0x75, - 0x76,0x43,0xa4,0x45,0x78,0xb8,0xa7,0x7b,0xbc,0xe7,0x7b,0xac,0x07,0x0c,0x1e,0xec, - 0x09,0x03,0x2e,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x2c,0xc6, - 0xde,0xd8,0xde,0xe4,0x86,0x48,0xcb,0xf0,0x70,0xcf,0x18,0x3c,0xde,0xf3,0x3d,0xd6, - 0x73,0x3d,0xd8,0x43,0x06,0x5c,0xc2,0xd2,0xe4,0x5c,0xe8,0xca,0xf0,0xe8,0xea,0xe4, - 0xca,0x28,0x85,0xa5,0xc9,0xb9,0xb0,0xbd,0x8d,0x85,0xd1,0xa5,0xbd,0xb9,0x7d,0xa5, - 0xb9,0x91,0x95,0xe1,0x51,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x23, - 0x46,0x57,0x86,0x47,0x57,0x27,0x57,0x26,0x43,0xc6,0x63,0xc6,0xf6,0x16,0x46,0xc7, - 0x02,0x32,0x17,0xd6,0x06,0xc7,0x56,0xe6,0xc3,0x81,0xae,0x0c,0x6f,0x08,0xb5,0x10, - 0x8f,0x19,0x3c,0x67,0xb0,0x08,0xcb,0xf0,0xa0,0xc1,0x63,0x3d,0x69,0xf0,0x60,0x8f, - 0x1a,0x70,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x93,0xe3,0x31,0x17, - 0xd6,0x06,0xc7,0x56,0x26,0x47,0x84,0xae,0x0c,0x6f,0xaa,0x0d,0x8e,0x4d,0x6e,0x88, - 0xb4,0x1c,0x0f,0x1b,0x3c,0x67,0xb0,0x08,0xcb,0xf0,0x58,0x4f,0x1b,0x3c,0xd8,0xe3, - 0x06,0x43,0x90,0x47,0x0c,0x9e,0x32,0x78,0xd6,0xe0,0x79,0x83,0x21,0x46,0x02,0x3c, - 0xdb,0x03,0x07,0x23,0x22,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77,0x20, - 0x87,0x7a,0x60,0x87,0x72,0x70,0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98,0x22, - 0x04,0xc3,0x08,0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca,0xc1, - 0x1d,0xe8,0x61,0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c, - 0xe4,0x61,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d,0xe4, - 0xc1,0x0d,0xd8,0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e,0xc1, - 0x1e,0xca,0x41,0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29,0x1c, - 0xd2,0x41,0x1e,0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c,0x7e, - 0xe1,0x1d,0xe0,0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x18,0x0a,0xe3,0x40, - 0x12,0x35,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68, - 0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0xc4,0x01,0x00,0x00,0x00,0x00,0x79,0x18,0x00, - 0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, + 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c, + 0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae, + 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06, + 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5, + 0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60, + 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96, + 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, + 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69, + 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, + 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84, + 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, + 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, + 0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59, + 0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9, + 0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8, + 0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e, + 0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e, + 0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99, + 0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37, + 0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74, + 0x69,0x76,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x96, + 0xe1,0xb1,0x9e,0xeb,0xc1,0x9e,0xec,0x81,0x1e,0xed,0x91,0x9e,0x8d,0x4b,0xdd,0x5c, + 0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21, + 0xd2,0x22,0x3c,0xd6,0xd3,0x3d,0xd8,0x93,0x3d,0xd0,0x13,0x3d,0xd2,0xe3,0x71,0x09, + 0x4b,0x93,0x73,0xa1,0x2b,0xc3,0xa3,0xab,0x93,0x2b,0xa3,0x14,0x96,0x26,0xe7,0xc2, + 0xf6,0x36,0x16,0x46,0x97,0xf6,0xe6,0xf6,0x95,0xe6,0x46,0x56,0x86,0x47,0x25,0x2c, + 0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x8c,0x18,0x5d,0x19,0x1e,0x5d,0x9d,0x5c, + 0x99,0x0c,0x19,0x8f,0x19,0xdb,0x5b,0x18,0x1d,0x0b,0xc8,0x5c,0x58,0x1b,0x1c,0x5b, + 0x99,0x0f,0x07,0xba,0x32,0xbc,0x21,0xd4,0x42,0x3c,0x60,0xf0,0x84,0xc1,0x32,0x2c, + 0xc2,0x23,0x06,0x0f,0xf4,0x8c,0xc1,0x23,0x3d,0x64,0xc0,0x25,0x2c,0x4d,0xce,0x65, + 0x2e,0xac,0x0d,0x8e,0xad,0x4c,0x8e,0xc7,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x87, + 0xb9,0x36,0xb8,0x21,0xd2,0x72,0x3c,0x66,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x03,0x3d, + 0x67,0xf0,0x48,0x0f,0x1a,0x0c,0x41,0x1e,0xee,0xf9,0x9e,0x32,0x78,0xd2,0x60,0x88, + 0x91,0x00,0x4f,0xf5,0xa8,0xc1,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda, + 0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61, + 0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20, + 0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03, + 0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70, + 0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28, + 0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32, + 0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76, + 0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x83, + 0xc2,0x38,0x23,0x98,0x70,0x48,0x07,0x79,0x70,0x03,0x73,0x90,0x87,0x70,0x38,0x87, + 0x76,0x28,0x07,0x77,0xa0,0x87,0x29,0xc1,0x1a,0x00,0x00,0x00,0x00,0x79,0x18,0x00, + 0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, 0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c, 0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d, 0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d, @@ -3207,16 +3181,20 @@ static const uint8_t _sdtx_fs_bytecode_metal_ios[2909] = { 0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38, 0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88, 0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08, - 0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00, - 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, - 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00, - 0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, - 0x00,0x06,0x00,0x00,0x00,0x14,0x47,0x00,0x88,0x8d,0x00,0x90,0x1a,0x01,0xa8,0x01, - 0x12,0x33,0x00,0x14,0x66,0x00,0x08,0x8c,0x00,0x00,0x00,0x00,0x00,0x23,0x06,0x8a, - 0x10,0x4c,0x09,0xb2,0x10,0x46,0x11,0x0c,0x32,0x04,0x03,0x62,0x01,0x23,0x9f,0xd9, - 0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50, + 0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01, + 0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03, + 0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c, + 0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00, + 0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d, + 0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0f,0x00,0x00, + 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x14,0x47,0x00, + 0x88,0x8d,0x00,0x90,0x1a,0x01,0xa8,0x01,0x12,0x33,0x00,0x14,0x66,0x00,0x08,0x8c, + 0x00,0x00,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x4c,0x09,0xb2,0x10,0x46,0x11,0x0c, + 0x32,0x04,0x03,0x62,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const char _sdtx_vs_src_metal_sim[624] = { +static const char _sdtx_vs_source_metal_sim[577] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -3237,27 +3215,25 @@ static const char _sdtx_vs_src_metal_sim[624] = { 0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74, - 0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e, - 0x65,0x20,0x31,0x32,0x20,0x22,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b, - 0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x32,0x20,0x22,0x22,0x0a,0x20, - 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x69,0x6e,0x2e, - 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x29,0x29,0x20,0x2b,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30, - 0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c, - 0x69,0x6e,0x65,0x20,0x31,0x33,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, - 0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f, - 0x72,0x64,0x30,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x34,0x20,0x22,0x22, - 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, - 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74, + 0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, + 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x28,0x66,0x6d,0x61,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32,0x2e,0x30,0x2c, + 0x20,0x2d,0x32,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d, + 0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c, + 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75, + 0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20, + 0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, + 0x00, }; -static const char _sdtx_fs_src_metal_sim[475] = { +static const char _sdtx_fs_source_metal_sim[441] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -3271,25 +3247,24 @@ static const char _sdtx_fs_src_metal_sim[475] = { 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x31,0x20,0x22,0x22,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b, - 0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f, - 0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31, - 0x31,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69, - 0x6e,0x2e,0x75,0x76,0x29,0x2e,0x78,0x78,0x78,0x78,0x20,0x2a,0x20,0x69,0x6e,0x2e, - 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, - 0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65, + 0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65, + 0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d, + 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b, + 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e, + 0x75,0x76,0x29,0x2e,0x78,0x78,0x78,0x78,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f, + 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, + 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) +FIXME FIXME FIXME static const uint8_t _sdtx_vs_bytecode_d3d11[692] = { 0x44,0x58,0x42,0x43,0x07,0x05,0xa0,0xb3,0x53,0xc1,0x0a,0x0d,0x1e,0xf4,0xe4,0xa6, 0x91,0xaf,0x4c,0xca,0x01,0x00,0x00,0x00,0xb4,0x02,0x00,0x00,0x05,0x00,0x00,0x00, @@ -3378,6 +3353,7 @@ static const uint8_t _sdtx_fs_bytecode_d3d11[620] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) +FIXME FIXME FIXME static const uint8_t _sdtx_vs_bytecode_wgpu[1648] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x2e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, @@ -3622,6 +3598,7 @@ typedef struct { uint32_t init_cookie; sdtx_desc_t desc; sg_image font_img; + sg_sampler font_smp; sg_shader shader; uint32_t fmt_buf_size; char* fmt_buf; @@ -3663,8 +3640,7 @@ static void _sdtx_log(sdtx_log_item_t log_item, uint32_t log_level, uint32_t lin const char* message = 0; #endif _sdtx.desc.logger.func("sdtx", log_level, log_item, message, line_nr, filename, _sdtx.desc.logger.user_data); - } - else { + } else { // for log level PANIC it would be 'undefined behaviour' to continue if (log_level == 0) { abort(); @@ -3689,8 +3665,7 @@ static void* _sdtx_malloc(size_t size) { void* ptr; if (_sdtx.desc.allocator.alloc) { ptr = _sdtx.desc.allocator.alloc(size, _sdtx.desc.allocator.user_data); - } - else { + } else { ptr = malloc(size); } if (0 == ptr) { @@ -3708,8 +3683,7 @@ static void* _sdtx_malloc_clear(size_t size) { static void _sdtx_free(void* ptr) { if (_sdtx.desc.allocator.free) { _sdtx.desc.allocator.free(ptr, _sdtx.desc.allocator.user_data); - } - else { + } else { free(ptr); } } @@ -3723,15 +3697,15 @@ static void _sdtx_free(void* ptr) { // >>context pool static void _sdtx_init_pool(_sdtx_pool_t* pool, int num) { SOKOL_ASSERT(pool && (num >= 1)); - /* slot 0 is reserved for the 'invalid id', so bump the pool size by 1 */ + // slot 0 is reserved for the 'invalid id', so bump the pool size by 1 pool->size = num + 1; pool->queue_top = 0; - /* generation counters indexable by pool slot index, slot 0 is reserved */ + // generation counters indexable by pool slot index, slot 0 is reserved size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size; pool->gen_ctrs = (uint32_t*) _sdtx_malloc_clear(gen_ctrs_size); - /* it's not a bug to only reserve 'num' here */ + // it's not a bug to only reserve 'num' here pool->free_queue = (int*) _sdtx_malloc_clear(sizeof(int) * (size_t)num); - /* never allocate the zero-th pool item since the invalid id is 0 */ + // never allocate the zero-th pool item since the invalid id is 0 for (int i = pool->size-1; i >= 1; i--) { pool->free_queue[pool->queue_top++] = i; } @@ -3756,9 +3730,8 @@ static int _sdtx_pool_alloc_index(_sdtx_pool_t* pool) { int slot_index = pool->free_queue[--pool->queue_top]; SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); return slot_index; - } - else { - /* pool exhausted */ + } else { + // pool exhausted return _SDTX_INVALID_SLOT_INDEX; } } @@ -3769,7 +3742,7 @@ static void _sdtx_pool_free_index(_sdtx_pool_t* pool, int slot_index) { SOKOL_ASSERT(pool->free_queue); SOKOL_ASSERT(pool->queue_top < pool->size); #ifdef SOKOL_DEBUG - /* debug check against double-free */ + // debug check against double-free for (int i = 0; i < pool->queue_top; i++) { SOKOL_ASSERT(pool->free_queue[i] != slot_index); } @@ -3780,7 +3753,7 @@ static void _sdtx_pool_free_index(_sdtx_pool_t* pool, int slot_index) { static void _sdtx_setup_context_pool(const sdtx_desc_t* desc) { SOKOL_ASSERT(desc); - /* note: the pool will have an additional item, since slot 0 is reserved */ + // note: the pool will have an additional item, since slot 0 is reserved SOKOL_ASSERT((desc->context_pool_size > 0) && (desc->context_pool_size < _SDTX_MAX_POOL_SIZE)); _sdtx_init_pool(&_sdtx.context_pool.pool, desc->context_pool_size); size_t pool_byte_size = sizeof(_sdtx_context_t) * (size_t)_sdtx.context_pool.pool.size; @@ -3815,14 +3788,14 @@ static uint32_t _sdtx_slot_alloc(_sdtx_pool_t* pool, _sdtx_slot_t* slot, int slo return slot->id; } -/* extract slot index from id */ +// extract slot index from id static int _sdtx_slot_index(uint32_t id) { int slot_index = (int) (id & _SDTX_SLOT_MASK); SOKOL_ASSERT(_SDTX_INVALID_SLOT_INDEX != slot_index); return slot_index; } -/* get context pointer without id-check */ +// get context pointer without id-check static _sdtx_context_t* _sdtx_context_at(uint32_t ctx_id) { SOKOL_ASSERT(SG_INVALID_ID != ctx_id); int slot_index = _sdtx_slot_index(ctx_id); @@ -3830,7 +3803,7 @@ static _sdtx_context_t* _sdtx_context_at(uint32_t ctx_id) { return &_sdtx.context_pool.contexts[slot_index]; } -/* get context pointer with id-check, returns 0 if no match */ +// get context pointer with id-check, returns 0 if no match static _sdtx_context_t* _sdtx_lookup_context(uint32_t ctx_id) { if (SG_INVALID_ID != ctx_id) { _sdtx_context_t* ctx = _sdtx_context_at(ctx_id); @@ -3841,7 +3814,7 @@ static _sdtx_context_t* _sdtx_lookup_context(uint32_t ctx_id) { return 0; } -/* make context handle from raw uint32_t id */ +// make context handle from raw uint32_t id static sdtx_context _sdtx_make_ctx_id(uint32_t ctx_id) { sdtx_context ctx; ctx.id = ctx_id; @@ -3853,9 +3826,8 @@ static sdtx_context _sdtx_alloc_context(void) { int slot_index = _sdtx_pool_alloc_index(&_sdtx.context_pool.pool); if (_SDTX_INVALID_SLOT_INDEX != slot_index) { ctx_id = _sdtx_make_ctx_id(_sdtx_slot_alloc(&_sdtx.context_pool.pool, &_sdtx.context_pool.contexts[slot_index].slot, slot_index)); - } - else { - /* pool is exhausted */ + } else { + // pool is exhausted ctx_id = _sdtx_make_ctx_id(SG_INVALID_ID); } return ctx_id; @@ -3868,7 +3840,7 @@ static sdtx_context_desc_t _sdtx_context_desc_defaults(const sdtx_context_desc_t res.canvas_width = _sdtx_def(res.canvas_width, _SDTX_DEFAULT_CANVAS_WIDTH); res.canvas_height = _sdtx_def(res.canvas_height, _SDTX_DEFAULT_CANVAS_HEIGHT); res.tab_width = _sdtx_def(res.tab_width, _SDTX_DEFAULT_TAB_WIDTH); - /* keep pixel format attrs are passed as is into pipeline creation */ + // keep pixel format attrs are passed as is into pipeline creation SOKOL_ASSERT(res.char_buf_size > 0); SOKOL_ASSERT(res.canvas_width > 0.0f); SOKOL_ASSERT(res.canvas_height > 0.0f); @@ -3996,7 +3968,7 @@ static bool _sdtx_is_default_context(sdtx_context ctx_id) { // // >>misc -/* unpack linear 8x8 bits-per-pixel font data into 2D byte-per-pixel texture data */ +// unpack linear 8x8 bits-per-pixel font data into 2D byte-per-pixel texture data static void _sdtx_unpack_font(const sdtx_font_desc_t* font_desc, uint8_t* out_pixels) { SOKOL_ASSERT(font_desc->data.ptr); SOKOL_ASSERT((font_desc->data.size > 0) && ((font_desc->data.size % 8) == 0)); @@ -4015,13 +3987,13 @@ static void _sdtx_unpack_font(const sdtx_font_desc_t* font_desc, uint8_t* out_pi static void _sdtx_setup_common(void) { - /* common printf formatting buffer */ + // common printf formatting buffer _sdtx.fmt_buf_size = (uint32_t) _sdtx.desc.printf_buf_size + 1; _sdtx.fmt_buf = (char*) _sdtx_malloc_clear(_sdtx.fmt_buf_size); sg_push_debug_group("sokol-debugtext"); - /* common shader for all contexts */ + // common shader for all contexts sg_shader_desc shd_desc; _sdtx_clear(&shd_desc, sizeof(shd_desc)); shd_desc.label = "sokol-debugtext-shader"; @@ -4034,15 +4006,21 @@ static void _sdtx_setup_common(void) { shd_desc.attrs[1].sem_index = 1; shd_desc.attrs[2].sem_name = "TEXCOORD"; shd_desc.attrs[2].sem_index = 2; - shd_desc.fs.images[0].name = "tex"; + shd_desc.fs.images[0].used = true; shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT; + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + shd_desc.fs.samplers[0].used = true; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.image_sampler_pairs[0].used = true; + shd_desc.fs.image_sampler_pairs[0].image_slot = 0; + shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; + shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; #if defined(SOKOL_GLCORE33) - shd_desc.vs.source = _sdtx_vs_src_glsl330; - shd_desc.fs.source = _sdtx_fs_src_glsl330; + shd_desc.vs.source = _sdtx_vs_source_glsl330; + shd_desc.fs.source = _sdtx_fs_source_glsl330; #elif defined(SOKOL_GLES3) - shd_desc.vs.source = _sdtx_vs_src_glsl300es; - shd_desc.fs.source = _sdtx_fs_src_glsl300es; + shd_desc.vs.source = _sdtx_vs_source_glsl300es; + shd_desc.fs.source = _sdtx_fs_source_glsl300es; #elif defined(SOKOL_METAL) shd_desc.vs.entry = "main0"; shd_desc.fs.entry = "main0"; @@ -4056,8 +4034,8 @@ static void _sdtx_setup_common(void) { shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_metal_ios); break; default: - shd_desc.vs.source = _sdtx_vs_src_metal_sim; - shd_desc.fs.source = _sdtx_fs_src_metal_sim; + shd_desc.vs.source = _sdtx_vs_source_metal_sim; + shd_desc.fs.source = _sdtx_fs_source_metal_sim; break; } #elif defined(SOKOL_D3D11) @@ -4073,7 +4051,7 @@ static void _sdtx_setup_common(void) { _sdtx.shader = sg_make_shader(&shd_desc); SOKOL_ASSERT(SG_INVALID_ID != _sdtx.shader.id); - /* unpack font data */ + // unpack font data memset(_sdtx.font_pixels, 0xFF, sizeof(_sdtx.font_pixels)); const int unpacked_font_size = (int) (sizeof(_sdtx.font_pixels) / SDTX_MAX_FONTS); for (int i = 0; i < SDTX_MAX_FONTS; i++) { @@ -4082,26 +4060,33 @@ static void _sdtx_setup_common(void) { } } - /* create font texture */ + // create font texture and sampler sg_image_desc img_desc; _sdtx_clear(&img_desc, sizeof(img_desc)); img_desc.width = 256 * 8; img_desc.height = SDTX_MAX_FONTS * 8; img_desc.pixel_format = SG_PIXELFORMAT_R8; - img_desc.min_filter = SG_FILTER_NEAREST; - img_desc.mag_filter = SG_FILTER_NEAREST; - img_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - img_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; img_desc.data.subimage[0][0] = SG_RANGE(_sdtx.font_pixels); img_desc.label = "sdtx-font-texture"; _sdtx.font_img = sg_make_image(&img_desc); SOKOL_ASSERT(SG_INVALID_ID != _sdtx.font_img.id); + sg_sampler_desc smp_desc; + _sdtx_clear(&smp_desc, sizeof(smp_desc)); + smp_desc.min_filter = SG_FILTER_NEAREST; + smp_desc.mag_filter = SG_FILTER_NEAREST; + smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + smp_desc.label = "sdtx-font-sampler"; + _sdtx.font_smp = sg_make_sampler(&smp_desc); + SOKOL_ASSERT(SG_INVALID_ID != _sdtx.font_smp.id); + sg_pop_debug_group(); } static void _sdtx_discard_common(void) { sg_push_debug_group("sokol-debugtext"); + sg_destroy_sampler(_sdtx.font_smp); sg_destroy_image(_sdtx.font_img); sg_destroy_shader(_sdtx.shader); if (_sdtx.fmt_buf) { @@ -4152,8 +4137,7 @@ static _sdtx_vertex_t* _sdtx_next_vertex(_sdtx_context_t* ctx) { _sdtx_vertex_t* vx = &ctx->vertices.ptr[ctx->vertices.next]; ctx->vertices.next += 6; return vx; - } - else { + } else { return 0; } } @@ -4161,8 +4145,7 @@ static _sdtx_vertex_t* _sdtx_next_vertex(_sdtx_context_t* ctx) { static _sdtx_command_t* _sdtx_cur_command(_sdtx_context_t* ctx) { if (ctx->commands.next > 0) { return &ctx->commands.ptr[ctx->commands.next - 1]; - } - else { + } else { return 0; } } @@ -4170,8 +4153,7 @@ static _sdtx_command_t* _sdtx_cur_command(_sdtx_context_t* ctx) { static _sdtx_command_t* _sdtx_next_command(_sdtx_context_t* ctx) { if (ctx->commands.next < ctx->commands.cap) { return &ctx->commands.ptr[ctx->commands.next++]; - } - else { + } else { _SDTX_ERROR(COMMAND_BUFFER_FULL); return 0; } @@ -4184,8 +4166,7 @@ static void _sdtx_set_layer(_sdtx_context_t* ctx, int layer_id) { if ((cur_cmd->num_vertices == 0) || (cur_cmd->layer_id == layer_id)) { // no vertices recorded in current draw command, or layer hasn't changed, can just reuse this cur_cmd->layer_id = layer_id; - } - else { + } else { // layer has changed, need to start a new draw command _sdtx_command_t* next_cmd = _sdtx_next_command(ctx); if (next_cmd) { @@ -4194,8 +4175,7 @@ static void _sdtx_set_layer(_sdtx_context_t* ctx, int layer_id) { next_cmd->num_vertices = 0; } } - } - else { + } else { // first draw command in frame _sdtx_command_t* next_cmd = _sdtx_next_command(ctx); if (next_cmd) { @@ -4244,8 +4224,7 @@ static void _sdtx_put_char(_sdtx_context_t* ctx, char c) { uint8_t c_u8 = (uint8_t)c; if (c_u8 <= 32) { _sdtx_ctrl_char(ctx, c_u8); - } - else { + } else { _sdtx_render_char(ctx, c_u8); } } @@ -4266,7 +4245,8 @@ SOKOL_API_IMPL void _sdtx_draw_layer(_sdtx_context_t* ctx, int layer_id) { sg_bindings bindings; _sdtx_clear(&bindings, sizeof(bindings)); bindings.vertex_buffers[0] = ctx->vbuf; - bindings.fs_images[0] = _sdtx.font_img; + bindings.fs.images[0] = _sdtx.font_img; + bindings.fs.samplers[0] = _sdtx.font_smp; sg_apply_bindings(&bindings); for (int cmd_index = 0; cmd_index < ctx->commands.next; cmd_index++) { const _sdtx_command_t* cmd = &ctx->commands.ptr[cmd_index]; @@ -4364,8 +4344,7 @@ SOKOL_API_IMPL sdtx_context sdtx_make_context(const sdtx_context_desc_t* desc) { sdtx_context ctx_id = _sdtx_alloc_context(); if (ctx_id.id != SG_INVALID_ID) { _sdtx_init_context(ctx_id, desc); - } - else { + } else { _SDTX_ERROR(CONTEXT_POOL_EXHAUSTED); } return ctx_id; @@ -4387,8 +4366,7 @@ SOKOL_API_IMPL void sdtx_set_context(sdtx_context ctx_id) { SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie); if (_sdtx_is_default_context(ctx_id)) { _sdtx.cur_ctx_id = _sdtx.def_ctx_id; - } - else { + } else { _sdtx.cur_ctx_id = ctx_id; } // this may return a nullptr if the ctx_id handle is invalid @@ -4641,4 +4619,4 @@ SOKOL_API_IMPL void sdtx_context_draw_layer(sdtx_context ctx_id, int layer_id) { _sdtx_draw_layer(ctx, layer_id); } } -#endif /* SOKOL_DEBUGTEXT_IMPL */ +#endif // SOKOL_DEBUGTEXT_IMPL From fc62ffd09a15eca95ba711e87ea859f79cb7a38a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 19 Jun 2023 11:35:18 +0200 Subject: [PATCH 030/292] sokol_gfx.h gles3: fix framebuffer invalidation bug after msaa resolve (fixes #841) --- sokol_gfx.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7199fe571..9fca8c95c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7645,26 +7645,32 @@ _SOKOL_PRIVATE void _sg_gl_end_pass(void) { if (_sg.gl.cur_pass) { const _sg_pass_t* pass = _sg.gl.cur_pass; SOKOL_ASSERT(pass->slot.id == _sg.gl.cur_pass_id.id); - bool fb_bound = false; + bool fb_read_bound = false; + bool fb_draw_bound = true; const int num_atts = pass->cmn.num_color_atts; for (int i = 0; i < num_atts; i++) { // perform MSAA resolve if needed if (pass->gl.msaa_resolve_framebuffer[i] != 0) { - if (!fb_bound) { + if (!fb_read_bound) { SOKOL_ASSERT(pass->gl.fb); glBindFramebuffer(GL_READ_FRAMEBUFFER, pass->gl.fb); - fb_bound = true; + fb_read_bound = true; } const int w = pass->gl.color_atts[i].image->cmn.width; const int h = pass->gl.color_atts[i].image->cmn.height; glBindFramebuffer(GL_DRAW_FRAMEBUFFER, pass->gl.msaa_resolve_framebuffer[i]); glReadBuffer((GLenum)(GL_COLOR_ATTACHMENT0 + i)); glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST); + fb_draw_bound = true; } } // invalidate framebuffers #if defined(SOKOL_GLES3) + // need to restore framebuffer binding before invalidate if the MSAA resolve had changed the binding + if (fb_draw_bound) { + glBindFramebuffer(GL_FRAMEBUFFER, pass->gl.fb); + } GLenum invalidate_atts[SG_MAX_COLOR_ATTACHMENTS + 2] = { 0 }; int att_index = 0; for (int i = 0; i < num_atts; i++) { @@ -7679,7 +7685,7 @@ _SOKOL_PRIVATE void _sg_gl_end_pass(void) { invalidate_atts[att_index++] = GL_STENCIL_ATTACHMENT; } if (att_index > 0) { - glInvalidateFramebuffer(GL_FRAMEBUFFER, att_index, invalidate_atts); + glInvalidateFramebuffer(GL_DRAW_FRAMEBUFFER, att_index, invalidate_atts); } #endif } From 177e2c79bee74acebaeeb8d5b29f7f168858ff78 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 19 Jun 2023 11:41:26 +0200 Subject: [PATCH 031/292] sokol_gfx.h gl: fix unused variable error --- sokol_gfx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9fca8c95c..93acd8558 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7666,6 +7666,7 @@ _SOKOL_PRIVATE void _sg_gl_end_pass(void) { } // invalidate framebuffers + _SOKOL_UNUSED(fb_draw_bound); #if defined(SOKOL_GLES3) // need to restore framebuffer binding before invalidate if the MSAA resolve had changed the binding if (fb_draw_bound) { From 5ef5eca7c4e7106e4545e75c3e89802e000efdac Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 19 Jun 2023 14:36:16 +0200 Subject: [PATCH 032/292] sokol_imgui.h: fix for separate images/samplers, new helper function simgui_imtextureid() --- util/sokol_imgui.h | 1471 ++++++++++++++++++++++---------------------- 1 file changed, 741 insertions(+), 730 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 80ab5e03d..0da085e0c 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -208,6 +208,14 @@ simgui_shutdown() + --- use the following helper function to create an ImTextureID handle from + a sokol-gfx image and sampler handle: + + ImTextureID tex_id = simgui_imtextureid(img, smp); + + ...an invalid handle {SG_INVALID_ID} will be replaced with the + default font texture or default sampler object + MEMORY ALLOCATION OVERRIDE ========================== @@ -332,6 +340,7 @@ typedef struct simgui_frame_desc_t { SOKOL_IMGUI_API_DECL void simgui_setup(const simgui_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); +SOKOL_IMGUI_API_DECL void* simgui_imtextureid(sg_image img, sg_sampler smp); #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) SOKOL_IMGUI_API_DECL bool simgui_handle_event(const sapp_event* ev); SOKOL_IMGUI_API_DECL int simgui_map_keycode(sapp_keycode keycode); // returns ImGuiKey_* @@ -339,16 +348,16 @@ SOKOL_IMGUI_API_DECL int simgui_map_keycode(sapp_keycode keycode); // returns I SOKOL_IMGUI_API_DECL void simgui_shutdown(void); #ifdef __cplusplus -} /* extern "C" */ +} // extern "C" -/* reference-based equivalents for C++ */ +// reference-based equivalents for C++ inline void simgui_setup(const simgui_desc_t& desc) { return simgui_setup(&desc); } inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_new_frame(&desc); } #endif #endif /* SOKOL_IMGUI_INCLUDED */ -/*-- IMPLEMENTATION ----------------------------------------------------------*/ +//-- IMPLEMENTATION ------------------------------------------------------------ #ifdef SOKOL_IMGUI_IMPL #define SOKOL_IMGUI_IMPL_INCLUDED (1) @@ -393,7 +402,7 @@ inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_ne #endif #endif -/* helper macros and constants */ +// helper macros and constants #define _simgui_def(val, def) (((val) == 0) ? (def) : (val)) typedef struct { @@ -407,6 +416,7 @@ typedef struct { sg_buffer vbuf; sg_buffer ibuf; sg_image img; + sg_sampler smp; sg_shader shd; sg_pipeline pip; sg_range vertices; @@ -440,12 +450,13 @@ static _simgui_state_t _simgui; @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; in vec2 uv; in vec4 color; out vec4 frag_color; void main() { - frag_color = texture(tex, uv) * color; + frag_color = texture(sampler2D(tex, smp), uv) * color; } @end @@ -476,18 +487,19 @@ static const char _simgui_vs_source_glsl330[341] = { 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b, 0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _simgui_fs_source_glsl330[169] = { +static const char _simgui_fs_source_glsl330[177] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, - 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74, + 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20, + 0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a, + 0x00, }; #elif defined(SOKOL_GLES3) static const char _simgui_vs_source_glsl300es[344] = { @@ -514,189 +526,176 @@ static const char _simgui_vs_source_glsl300es[344] = { 0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _simgui_fs_source_glsl300es[242] = { +static const char _simgui_fs_source_glsl300es[250] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, - 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20, - 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69, - 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c, - 0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, + 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75, + 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _simgui_vs_bytecode_metal_macos[3216] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x90,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _simgui_vs_bytecode_metal_macos[3052] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xef,0xd7,0x24,0x0b,0xf0,0x26,0xba, - 0xcd,0xc3,0x6f,0x48,0x91,0x7a,0x7c,0x38,0xca,0xb8,0xf1,0xb1,0xe3,0xc7,0x99,0x8d, - 0xac,0x39,0x8e,0x2f,0xf8,0xa3,0x19,0x68,0x22,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x7b,0x12,0x23,0x17,0xd9,0x25,0x1c, + 0x1b,0x42,0x42,0x9f,0xbf,0x31,0xd2,0x2c,0x3a,0x55,0x22,0x1d,0x40,0xd8,0xc4,0xf8, + 0x20,0x49,0x60,0x6d,0x3c,0xea,0x4e,0x1c,0x34,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x60,0x0b,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xd5,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x18,0x02,0x01,0x2c,0x40,0x05,0x00, - 0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00, - 0x1b,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84, - 0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c, - 0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77,0x49,0x53,0x44,0x09, - 0x93,0xcf,0x00,0x48,0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28,0xc4,0x80,0x87,0x10, - 0x39,0x48,0x9a,0x22,0x4a,0x98,0xfc,0x4a,0xfa,0x1f,0x20,0x02,0x18,0x09,0x05,0x31, - 0x88,0x40,0x08,0xa5,0x98,0x08,0x29,0xb2,0x81,0x80,0x39,0x02,0x30,0xc8,0x81,0x9c, - 0x23,0x00,0x85,0x41,0x84,0x40,0x18,0x46,0x20,0x92,0x11,0x00,0x00,0x00,0x00,0x00, - 0x13,0xb2,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60, - 0x87,0x72,0x68,0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03, - 0x37,0x88,0x83,0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71, - 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80, - 0x07,0x6d,0x90,0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, - 0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d, - 0x90,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60, - 0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71, - 0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07, - 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a, - 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60, - 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07, - 0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78, - 0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10, - 0x07,0x79,0x20,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07, - 0x6d,0x60,0x0f,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72, - 0x50,0x07,0x76,0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20, - 0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07, - 0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d, - 0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x39,0x00, - 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xda, - 0x11,0x00,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0x20,0x1d,0x6b,0x50, - 0x1e,0x82,0x60,0x8c,0x00,0x04,0x41,0x50,0x04,0x03,0x00,0x00,0x79,0x18,0x00,0x00, - 0x16,0x01,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9, - 0xb9,0xb4,0x37,0xb7,0x21,0x46,0x52,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93, - 0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x06,0xd9,0x20,0x08,0x0e, - 0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d, - 0x24,0x07,0x46,0xc6,0x25,0x86,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac, - 0x25,0x07,0x46,0xc6,0x25,0x86,0xc6,0x25,0x27,0x65,0x88,0x80,0x10,0x43,0x8c,0x44, - 0x48,0x88,0x64,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e,0x44,0x48,0x84, - 0x64,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, - 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40, - 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, - 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04, - 0x64,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, - 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, - 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x61,0x10,0x96,0x26, - 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6, - 0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x40,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b, - 0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9, - 0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0x01,0x89,0x78,0x06,0x61,0x69,0x72, - 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f, - 0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73, - 0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x62,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47, - 0x57,0x86,0xf7,0xf5,0x56,0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85, - 0xed,0x6d,0xcc,0x0d,0x26,0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d, - 0x1e,0x5c,0xd9,0x97,0x5b,0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x32, - 0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86, - 0x30,0x48,0x85,0x58,0xc8,0x85,0x60,0x48,0x86,0x68,0x5c,0xea,0xe6,0xca,0xe4,0x50, - 0xd8,0xde,0xc6,0xdc,0x62,0x52,0x68,0x98,0xb1,0xbd,0x85,0xd1,0xd1,0xb0,0x18,0x7b, - 0x63,0x7b,0x93,0x1b,0xc2,0x20,0x15,0xc2,0x21,0x17,0xd2,0x21,0x19,0xe2,0x91,0x09, - 0x4b,0x93,0x73,0x81,0x7b,0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0xe3,0x72,0xc6,0xf6,0x05, - 0xf5,0x36,0x97,0x46,0x97,0xf6,0xe6,0x36,0x44,0x41,0xc0,0x00,0xb9,0x90,0x0e,0xc9, - 0x90,0x30,0x18,0x62,0x20,0x1b,0xf2,0x21,0x62,0x40,0x28,0x2c,0x4d,0xce,0xc5,0xae, - 0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b, - 0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xb3,0xb3, - 0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x14,0x1c,0xb8,0xb7,0xb9,0x34,0xba,0xb4, - 0x37,0x37,0x22,0x3b,0x99,0x2f,0xb3,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x43,0xa8,0x64,0x40,0xc8,0x00,0x29,0x83,0x64,0x48,0x04,0xc4,0x0c,0x90,0x0b, - 0xc1,0x90,0x0c,0x39,0x03,0x6a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28, - 0x39,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x44,0x76,0x32,0x5f,0x66,0x29, - 0x4c,0xe8,0xca,0xf0,0xc6,0xde,0xde,0xe4,0xc8,0x60,0x86,0x50,0x89,0x80,0x90,0x01, - 0x52,0x06,0x89,0x90,0x08,0x48,0x1a,0x20,0x17,0x82,0x21,0x19,0xa2,0x06,0xbc,0xce, - 0xca,0xdc,0xca,0xe4,0xc2,0xe8,0xca,0xc8,0x50,0x6c,0xc6,0xde,0xd8,0xde,0xe4,0x60, - 0x88,0xec,0x68,0xbe,0xcc,0x52,0x68,0x8c,0xbd,0xb1,0xbd,0xc9,0xc1,0x0c,0xa1,0x92, - 0x02,0x21,0x03,0xa4,0x0c,0x92,0x22,0x11,0x10,0x36,0x40,0x2e,0xa4,0x43,0x32,0xa4, - 0x0d,0xa8,0x84,0xa5,0xc9,0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9,0xf1,0x09,0x4b,0x93, - 0x73,0x11,0xab,0x33,0x33,0x2b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x23,0x12,0x96,0x26, - 0xe7,0x22,0x57,0x16,0x46,0x46,0x2a,0x2c,0x4d,0xce,0x65,0x8e,0x4e,0xae,0x6e,0x8c, - 0xee,0x8b,0x2e,0x0f,0xae,0xec,0x2b,0xcd,0xcd,0xec,0x8d,0x09,0x59,0xda,0x1c,0xdc, - 0xd7,0x5c,0x9a,0x5e,0xd9,0x10,0x25,0x19,0x12,0x22,0x19,0x10,0x0c,0x99,0x03,0x46, - 0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x73,0x69,0x7a, - 0x65,0xbc,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xc2, - 0xd8,0xd2,0xce,0xdc,0xbe,0xe6,0xd2,0xf4,0xca,0x98,0xd8,0xcd,0x7d,0xc1,0x85,0xc9, - 0x85,0xb5,0xcd,0x71,0xf8,0x92,0x99,0x19,0x42,0x06,0xc9,0x81,0xbc,0x01,0x02,0x07, - 0x09,0x81,0x94,0x41,0x32,0x24,0x02,0x12,0x07,0x88,0x1c,0x20,0x74,0x80,0xd4,0x41, - 0x42,0x20,0x76,0x90,0x10,0xc8,0x85,0xdc,0x01,0x92,0x21,0x78,0x30,0x04,0x41,0xd0, - 0x00,0x59,0x03,0xc4,0x0d,0x90,0x3c,0x18,0x62,0x1c,0x00,0x32,0x06,0x88,0x1e,0xf0, - 0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3, - 0x33,0x95,0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34, - 0x44,0x40,0xfa,0x60,0x88,0x81,0xf0,0x01,0xe2,0x07,0x4b,0x30,0xc4,0x40,0xfe,0x00, - 0xf9,0x83,0x25,0x18,0x22,0x00,0xc9,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d, - 0xda,0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce, - 0x61,0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74, - 0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70, - 0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8, - 0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73, - 0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01, - 0x32,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07, - 0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29, - 0x86,0xc2,0x38,0x90,0x44,0x8d,0x50,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c, - 0xe4,0x81,0x1e,0xca,0x01,0x1f,0xa6,0x04,0x7b,0x00,0x00,0x00,0x79,0x18,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xc8,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xaf,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x18,0x02,0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00, + 0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x16,0x00,0x00,0x00, + 0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3, + 0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c,0x10,0x3c,0x33,0x00, + 0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76,0x08,0x91,0x83,0xa4,0x29,0xa2,0x84,0xc9, + 0xaf,0xa4,0xff,0x01,0x22,0x80,0x91,0x50,0x10,0x83,0x08,0x84,0x50,0x8a,0x89,0x90, + 0x22,0x1b,0x08,0x98,0x23,0x00,0x83,0x14,0xc8,0x39,0x02,0x50,0x18,0x44,0x08,0x84, + 0x61,0x04,0x22,0x19,0x01,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0,0x03, + 0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87,0x71, + 0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38,0xd8, + 0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06, + 0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x71,0x60,0x07,0x7a, + 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a,0x30, + 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72, + 0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07, + 0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73, + 0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20, + 0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, + 0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d, + 0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80, + 0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07, + 0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07,0x7a,0x20,0x07,0x75, + 0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72,0x50,0x07,0x76,0xa0, + 0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x50,0x07, + 0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x6d, + 0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xa0, + 0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07, + 0x7a,0x30,0x07,0x72,0x30,0x84,0x39,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8, + 0x02,0x01,0x00,0x00,0x09,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90, + 0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84, + 0x32,0xa0,0x1d,0x01,0x20,0x1d,0x4b,0x68,0x02,0x00,0x00,0x00,0x79,0x18,0x00,0x00, + 0xea,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9, + 0xb9,0xb4,0x37,0xb7,0x21,0x46,0x42,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93, + 0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x24,0x01,0x22,0x24,0x05,0xe7,0x20,0x08,0x0e, + 0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd, + 0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e, + 0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26, + 0x65,0x88,0x80,0x10,0x43,0x8c,0x24,0x48,0x86,0x44,0x60,0xd1,0x54,0x46,0x17,0xc6, + 0x36,0x04,0x41,0x8e,0x24,0x48,0x82,0x44,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6, + 0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36, + 0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d, + 0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65, + 0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd, + 0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95, + 0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d, + 0x11,0x90,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b, + 0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98, + 0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e, + 0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84, + 0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20,0x0f,0x02,0x21, + 0x11,0x22,0x21,0x13,0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b, + 0x49,0xa1,0x61,0xc6,0xf6,0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08, + 0x83,0x3c,0x88,0x85,0x44,0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee, + 0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d, + 0xda,0x9b,0xdb,0x10,0x05,0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86,0x18,0x48,0x85, + 0x64,0x08,0x47,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd, + 0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b, + 0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32, + 0x32,0x94,0xaf,0xaf,0xb0,0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36, + 0xb2,0x32,0xb9,0xaf,0xaf,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43, + 0xa8,0x44,0x40,0x3c,0xe4,0x4b,0x84,0x24,0x40,0xc0,0x00,0x89,0x10,0x09,0x99,0x90, + 0x30,0x60,0x42,0x57,0x86,0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84,0x4a,0x02,0xc4, + 0x43,0xbe,0x24,0x48,0x02,0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19,0x03,0x1a,0x63, + 0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88,0x24,0x40,0xc0, + 0x00,0x89,0x90,0x0b,0x99,0x90,0x32,0xa0,0x12,0x96,0x26,0xe7,0x22,0x56,0x67,0x66, + 0x56,0x26,0xc7,0x27,0x2c,0x4d,0xce,0x45,0xac,0xce,0xcc,0xac,0x4c,0xee,0x6b,0x2e, + 0x4d,0xaf,0x8c,0x48,0x58,0x9a,0x9c,0x8b,0x5c,0x59,0x18,0x19,0xa9,0xb0,0x34,0x39, + 0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3, + 0x37,0x26,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x43,0x94,0x44,0x48,0x86, + 0x44,0x40,0x24,0x64,0x0d,0x18,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5, + 0xc1,0x95,0x7d,0xcd,0xa5,0xe9,0x95,0xf1,0x0a,0x4b,0x93,0x73,0x09,0x93,0x3b,0xfb, + 0xa2,0xcb,0x83,0x2b,0xfb,0x0a,0x63,0x4b,0x3b,0x73,0xfb,0x9a,0x4b,0xd3,0x2b,0x63, + 0x62,0x37,0xf7,0x05,0x17,0x26,0x17,0xd6,0x36,0xc7,0xe1,0x4b,0x46,0x66,0x08,0x19, + 0x24,0x06,0x72,0x06,0x08,0x1a,0x24,0x03,0xf2,0x25,0x42,0x12,0x20,0x69,0x80,0xa8, + 0x01,0xc2,0x06,0x48,0x1b,0x24,0x03,0xe2,0x06,0xc9,0x80,0x44,0xc8,0x1b,0x20,0x13, + 0x02,0x07,0x43,0x10,0x44,0x0c,0x10,0x32,0x40,0xcc,0x00,0x89,0x83,0x21,0xc6,0x01, + 0x20,0x1d,0x22,0x07,0x7c,0xde,0xda,0xdc,0xd2,0xe0,0xde,0xe8,0xca,0xdc,0xe8,0x40, + 0xc6,0xd0,0xc2,0xe4,0xf8,0x4c,0xa5,0xb5,0xc1,0xb1,0x95,0x81,0x0c,0xad,0xac,0x80, + 0x50,0x09,0x05,0x05,0x0d,0x11,0x90,0x3a,0x18,0x62,0x20,0x74,0x80,0xd8,0xc1,0x72, + 0x0c,0x31,0x90,0x3b,0x40,0xee,0x60,0x39,0x46,0x44,0xec,0xc0,0x0e,0xf6,0xd0,0x0e, + 0x6e,0xd0,0x0e,0xef,0x40,0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0,0x0e,0xe1, + 0x70,0x0e,0xf3,0x30,0x45,0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b, + 0xa4,0x03,0x39,0x94,0x83,0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43,0x3a,0xc8, + 0x83,0x1b,0xd8,0x43,0x39,0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0xc0,0x18, + 0x41,0x85,0x43,0x3a,0xc8,0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4,0x43,0x38, + 0x9c,0x43,0x39,0xfc,0x82,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c, + 0x09,0x90,0x11,0x53,0x38,0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b,0xc0,0x43, + 0x3a,0xb0,0x43,0x39,0xfc,0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x3c, + 0x4c,0x19,0x14,0xc6,0x19,0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8, + 0x03,0x3d,0x94,0x03,0x3e,0x4c,0x09,0xe6,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00, + 0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, 0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6, 0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce, 0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8, @@ -723,86 +722,88 @@ static const uint8_t _simgui_vs_bytecode_metal_macos[3216] = { 0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc, 0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3, 0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07, - 0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, - 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x24,0x00,0x00,0x00, - 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40, - 0x60,0x1c,0x73,0x10,0x83,0x00,0x41,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82, - 0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08, - 0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73,0x10,0x18,0x76,0x59,0x34,0x33,0x00,0x04, - 0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00, - 0xe3,0x0d,0x0c,0x66,0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9, - 0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41, - 0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x5b,0x86,0x20,0x00,0x85,0x2d,0x83,0x30,0x84,0x02,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e, + 0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e, + 0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d, + 0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00, + 0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00, + 0x61,0x20,0x00,0x00,0x23,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00, + 0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10,0x42,0xf0,0x3c,0x94, + 0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82,0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30, + 0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08,0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73, + 0x10,0xd7,0x65,0x55,0x34,0x33,0x00,0x04,0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46, + 0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00,0xe3,0x0d,0x4c,0x64,0x51,0x40,0x2c,0x0a, + 0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9,0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c, + 0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41,0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40, + 0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x5b,0x86,0x20,0xc0,0x03,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _simgui_fs_bytecode_metal_macos[2909] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x5d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _simgui_fs_bytecode_metal_macos[2809] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf9,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x17,0xe5,0xa2,0xb3,0x7d,0x00,0xfc, - 0xde,0x00,0x5f,0xbd,0x79,0x5e,0xd5,0x95,0xff,0xb6,0xf4,0xce,0x41,0x07,0xfb,0x8f, - 0x49,0x6b,0x95,0x79,0x7a,0xd1,0xcf,0x19,0xde,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xa1,0xce,0x6b,0xd1,0x1f,0x32,0x9e, + 0x8d,0x8d,0x1c,0xcc,0x19,0xcb,0xd3,0xb6,0x21,0x99,0x0b,0xb6,0x46,0x8b,0x87,0x98, + 0x8e,0x2d,0xb5,0x98,0x92,0x0a,0x81,0x7d,0xf3,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x60,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x95,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x1c,0x58,0x23,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x0c,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x80,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87, 0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38, 0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, @@ -829,62 +830,54 @@ static const uint8_t _simgui_fs_bytecode_metal_macos[2909] = { 0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64,0x81,0x00,0x00,0x00, 0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, 0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70, - 0xac,0x41,0x79,0x08,0x00,0x79,0x18,0x00,0x00,0xd9,0x00,0x00,0x00,0x1a,0x03,0x4c, + 0x2c,0xa1,0x09,0x00,0x00,0x79,0x18,0x00,0x00,0xb9,0x00,0x00,0x00,0x1a,0x03,0x4c, 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42, 0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, - 0x2c,0xc2,0x23,0x2c,0x05,0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa, - 0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46,0xc6,0x25,0x86,0x06, - 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x25,0x07,0x46,0xc6,0x25,0x86,0xc6, - 0x25,0x27,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46, - 0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32, - 0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45, - 0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63, - 0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68, - 0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9, - 0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99, - 0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1, - 0x95,0x0d,0x11,0x9e,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, - 0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6, - 0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x1e,0x92,0x41,0x58,0x9a,0x9c, - 0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17, - 0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98,0x18,0x5b, - 0xd9,0x10,0xe1,0x89,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, - 0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f,0x76,0x65, - 0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x84,0x67, - 0x62,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46,0x56,0x26,0xf7,0x45,0x17,0x26,0x77, - 0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c,0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec, - 0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b,0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39, - 0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32,0x2a,0x66,0x72,0x61,0x67,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x43,0x98,0xa7,0x5a,0x86,0xc7,0x7a,0xae,0x07,0x7b,0xb2,0x21, - 0xc2,0xa3,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93,0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb, - 0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57,0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06, - 0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc,0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a, - 0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18,0x5d,0x9a,0x5d,0x19,0x0d,0x33,0xb6, - 0xb7,0x30,0x3a,0x19,0x0a,0x75,0x76,0x43,0xa4,0x65,0x78,0xb8,0xa7,0x7b,0xbc,0xe7, - 0x7b,0xac,0x07,0x0c,0x1e,0xec,0x09,0x03,0x2e,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f, - 0x63,0x6e,0x31,0x29,0x2c,0xc6,0xde,0xd8,0xde,0xe4,0x86,0x48,0x8b,0xf0,0x70,0xcf, - 0x18,0x3c,0xde,0xf3,0x3d,0xd6,0x73,0x3d,0xd8,0x43,0x06,0x5c,0xc2,0xd2,0xe4,0x5c, - 0xe8,0xca,0xf0,0xe8,0xea,0xe4,0xca,0x28,0x85,0xa5,0xc9,0xb9,0xb0,0xbd,0x8d,0x85, - 0xd1,0xa5,0xbd,0xb9,0x7d,0xa5,0xb9,0x91,0x95,0xe1,0x51,0x09,0x4b,0x93,0x73,0x99, - 0x0b,0x6b,0x83,0x63,0x2b,0x23,0x46,0x57,0x86,0x47,0x57,0x27,0x57,0x26,0x43,0xc6, - 0x63,0xc6,0xf6,0x16,0x46,0xc7,0x02,0x32,0x17,0xd6,0x06,0xc7,0x56,0xe6,0xc3,0x81, - 0xae,0x0c,0x6f,0x08,0xb5,0x10,0x8f,0x19,0x3c,0x67,0xb0,0x0c,0x8b,0xf0,0xa0,0xc1, - 0x63,0x3d,0x69,0xf0,0x60,0x8f,0x1a,0x70,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83, - 0x63,0x2b,0x93,0xe3,0x31,0x17,0xd6,0x06,0xc7,0x56,0x26,0x47,0x84,0xae,0x0c,0x6f, - 0xaa,0x0d,0x8e,0x4d,0x6e,0x88,0xb4,0x1c,0x0f,0x1b,0x3c,0x67,0xb0,0x0c,0x8b,0xf0, - 0x58,0x4f,0x1b,0x3c,0xd8,0xe3,0x06,0x43,0x90,0x47,0x0c,0x9e,0x32,0x78,0xd6,0xe0, - 0x79,0x83,0x21,0x46,0x02,0x3c,0xdb,0x03,0x07,0x23,0x22,0x76,0x60,0x07,0x7b,0x68, - 0x07,0x37,0x68,0x87,0x77,0x20,0x87,0x7a,0x60,0x87,0x72,0x70,0x03,0x73,0x60,0x87, - 0x70,0x38,0x87,0x79,0x98,0x22,0x04,0xc3,0x08,0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1, - 0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d,0xe8,0x61,0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d, - 0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x61,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60, - 0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xd8,0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21, - 0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e,0xca,0x41,0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d, - 0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2,0x41,0x1e,0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0, - 0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1,0x1d,0xe0,0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61, - 0x1e,0xa6,0x18,0x0a,0xe3,0x40,0x12,0x35,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30, - 0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0xc4,0x01,0x00, - 0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, + 0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, + 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45, + 0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84, + 0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, + 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78, + 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, + 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84, + 0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, + 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, + 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c, + 0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0, + 0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32, + 0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe, + 0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d, + 0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c, + 0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e, + 0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34, + 0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72, + 0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28, + 0xd4,0xd9,0x0d,0x91,0x96,0xe1,0xb1,0x9e,0xeb,0xc1,0x9e,0xec,0x81,0x1e,0xed,0x91, + 0x9e,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1, + 0x37,0xb6,0x37,0xb9,0x21,0xd2,0x22,0x3c,0xd6,0xd3,0x3d,0xd8,0x93,0x3d,0xd0,0x13, + 0x3d,0xd2,0xe3,0x71,0x09,0x4b,0x93,0x73,0xa1,0x2b,0xc3,0xa3,0xab,0x93,0x2b,0xa3, + 0x14,0x96,0x26,0xe7,0xc2,0xf6,0x36,0x16,0x46,0x97,0xf6,0xe6,0xf6,0x95,0xe6,0x46, + 0x56,0x86,0x47,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x8c,0x18,0x5d, + 0x19,0x1e,0x5d,0x9d,0x5c,0x99,0x0c,0x19,0x8f,0x19,0xdb,0x5b,0x18,0x1d,0x0b,0xc8, + 0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x0f,0x07,0xba,0x32,0xbc,0x21,0xd4,0x42,0x3c,0x60, + 0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x23,0x06,0x0f,0xf4,0x8c,0xc1,0x23,0x3d,0x64,0xc0, + 0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x4c,0x8e,0xc7,0x5c,0x58,0x1b, + 0x1c,0x5b,0x99,0x1c,0x87,0xb9,0x36,0xb8,0x21,0xd2,0x72,0x3c,0x66,0xf0,0x84,0xc1, + 0x32,0x2c,0xc2,0x03,0x3d,0x67,0xf0,0x48,0x0f,0x1a,0x0c,0x41,0x1e,0xee,0xf9,0x9e, + 0x32,0x78,0xd2,0x60,0x88,0x91,0x00,0x4f,0xf5,0xa8,0xc1,0x88,0x88,0x1d,0xd8,0xc1, + 0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c, + 0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61,0x07,0x76,0xb0,0x87, + 0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x14,0x23,0x96,0x70, + 0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98, + 0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87, + 0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77, + 0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68, + 0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07, + 0x77,0x98,0x87,0x29,0x83,0xc2,0x38,0x23,0x98,0x70,0x48,0x07,0x79,0x70,0x03,0x73, + 0x90,0x87,0x70,0x38,0x87,0x76,0x28,0x07,0x77,0xa0,0x87,0x29,0xc1,0x1a,0x00,0x00, + 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83, @@ -911,284 +904,277 @@ static const uint8_t _simgui_fs_bytecode_metal_macos[2909] = { 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06, 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c, 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77, - 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00, - 0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, - 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, - 0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41, - 0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4, - 0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91, - 0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6,0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec, + 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, + 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, + 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, + 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, + 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, + 0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00, + 0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4,0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00, + 0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91,0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6, + 0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _simgui_vs_bytecode_metal_ios[3200] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _simgui_vs_bytecode_metal_ios[3052] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xcb,0xdd,0xe3,0x08,0x7a,0x87,0xef, - 0xdd,0xe0,0x68,0xe7,0xe8,0x6b,0xe6,0xea,0x8b,0x6d,0x4a,0xe0,0x3d,0x6a,0xfe,0xe4, - 0xfe,0x32,0x1d,0xbe,0xb6,0x10,0x11,0xee,0x75,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x69,0x97,0x6b,0xac,0xd8,0xa2,0x51, + 0x33,0x7c,0x5f,0x96,0xb2,0xb1,0x06,0x06,0x7c,0xbb,0x5f,0x88,0xa0,0xeb,0x9f,0xea, + 0x6e,0x6b,0x70,0xa9,0x6e,0xef,0xe6,0xa4,0xea,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x5c,0x0b,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xd4,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x20,0x02,0x01,0x24,0xc0,0x02,0x54, - 0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00, - 0x89,0x20,0x00,0x00,0x1b,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04, - 0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c, - 0x0b,0x84,0x84,0x4c,0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77, - 0x49,0x53,0x44,0x09,0x93,0xcf,0x00,0x48,0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28, - 0xc4,0x80,0x87,0x10,0x39,0x48,0x9a,0x22,0x4a,0x98,0xfc,0x4a,0xfa,0x1f,0x20,0x02, - 0x18,0x09,0x05,0x31,0x88,0x40,0x08,0xa5,0x98,0x08,0x29,0xb2,0x81,0x80,0x39,0x02, - 0x30,0x48,0x81,0x9c,0x23,0x00,0x85,0x41,0x84,0x40,0x18,0x46,0x20,0x92,0x11,0x00, - 0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70, - 0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80, - 0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07, - 0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9, - 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30, - 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07, - 0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72, - 0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07, - 0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73, - 0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, - 0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0, - 0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07, - 0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72, - 0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20, - 0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07, - 0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75, - 0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00, - 0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07, - 0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x03,0x00,0x80,0x00,0x00, - 0x00,0x00,0x00,0x80,0x2c,0x10,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10, - 0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xda,0x11,0x00,0xca,0x12, - 0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0x20,0x1d,0x4b,0x68,0x0a,0x82,0x31,0x02, - 0x10,0x04,0x41,0x11,0x0c,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x16,0x01,0x00,0x00, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xc0,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xad,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x20,0x02,0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00, + 0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00, + 0x16,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84, + 0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c, + 0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76,0x08,0x91,0x83,0xa4, + 0x29,0xa2,0x84,0xc9,0xaf,0xa4,0xff,0x01,0x22,0x80,0x91,0x50,0x10,0x83,0x08,0x84, + 0x50,0x8a,0x89,0x90,0x22,0x1b,0x08,0x98,0x23,0x00,0x83,0x14,0xc8,0x39,0x02,0x50, + 0x18,0x44,0x08,0x84,0x61,0x04,0x22,0x19,0x01,0x00,0x00,0x00,0x13,0xa8,0x70,0x48, + 0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83, + 0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e, + 0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0, + 0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0, + 0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6, + 0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07, + 0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6, + 0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80, + 0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07, + 0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75, + 0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0, + 0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07, + 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70, + 0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20, + 0x07,0x43,0x98,0x03,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x2c,0x10,0x00,0x00, + 0x09,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47, + 0xc6,0x04,0x43,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0xa0,0x1d,0x01, + 0x20,0x1d,0x4b,0x80,0x04,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xe9,0x00,0x00,0x00, 0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7, - 0x21,0x46,0x52,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, - 0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x06,0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84, - 0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x07,0x46, - 0xc6,0xc5,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x07, - 0x46,0xc6,0xc5,0xe6,0x26,0x65,0x88,0x80,0x10,0x43,0x8c,0x44,0x48,0x88,0x64,0x60, - 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e,0x44,0x48,0x86,0x64,0xe0,0x16,0x96, - 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, - 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x12,0x72,0x61,0x69, - 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, - 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x21,0x19,0x84, - 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, - 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, - 0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06, - 0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6, - 0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x1e,0x92,0x41,0x58, - 0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d, - 0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98, - 0x18,0x5b,0xd9,0x10,0x01,0x89,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70, - 0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f, - 0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x04,0x64,0x62,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0xf5,0x56, - 0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x0d,0x26, - 0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0x97,0x5b, - 0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x32,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86,0x30,0x48,0x85,0x58,0xc8, - 0x85,0x60,0x48,0x86,0x68,0x5c,0xea,0xe6,0xca,0xe4,0x50,0xd8,0xde,0xc6,0xdc,0x62, - 0x52,0x68,0x98,0xb1,0xbd,0x85,0xd1,0xd1,0xb0,0x18,0x7b,0x63,0x7b,0x93,0x1b,0xc2, - 0x20,0x15,0xc2,0x21,0x17,0xd2,0x21,0x19,0xe2,0x91,0x09,0x4b,0x93,0x73,0x81,0x7b, - 0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0xe3,0x72,0xc6,0xf6,0x05,0xf5,0x36,0x97,0x46,0x97, - 0xf6,0xe6,0x36,0x44,0x41,0xc0,0x00,0xb9,0x90,0x0e,0xc9,0x90,0x30,0x18,0x62,0x20, - 0x1b,0xf2,0x21,0x62,0x40,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef, - 0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d, - 0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xb3,0xb3,0x32,0xb7,0x32,0xb9,0x30, - 0xba,0x32,0x32,0x14,0x1c,0xb8,0xb7,0xb9,0x34,0xba,0xb4,0x37,0x37,0x22,0x3b,0x99, - 0x2f,0xb3,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x64,0x40, - 0xc8,0x00,0x29,0x83,0x64,0x48,0x04,0xc4,0x0c,0x90,0x0b,0xc1,0x90,0x0c,0x39,0x03, - 0x6a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x39,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x44,0x76,0x32,0x5f,0x66,0x29,0x4c,0xe8,0xca,0xf0,0xc6, - 0xde,0xde,0xe4,0xc8,0x60,0x86,0x50,0x89,0x80,0x90,0x01,0x52,0x06,0x89,0x90,0x08, - 0x48,0x1a,0x20,0x17,0x82,0x21,0x19,0xa2,0x06,0xbc,0xce,0xca,0xdc,0xca,0xe4,0xc2, - 0xe8,0xca,0xc8,0x50,0x6c,0xc6,0xde,0xd8,0xde,0xe4,0x60,0x88,0xec,0x68,0xbe,0xcc, - 0x52,0x68,0x8c,0xbd,0xb1,0xbd,0xc9,0xc1,0x0c,0xa1,0x92,0x02,0x21,0x03,0xa4,0x0c, - 0x92,0x22,0x11,0x10,0x36,0x40,0x2e,0xa4,0x43,0x32,0xa4,0x0d,0xa8,0x84,0xa5,0xc9, - 0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9,0xf1,0x09,0x4b,0x93,0x73,0x11,0xab,0x33,0x33, - 0x2b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x23,0x12,0x96,0x26,0xe7,0x22,0x57,0x16,0x46, - 0x46,0x2a,0x2c,0x4d,0xce,0x65,0x8e,0x4e,0xae,0x6e,0x8c,0xee,0x8b,0x2e,0x0f,0xae, - 0xec,0x2b,0xcd,0xcd,0xec,0x8d,0x09,0x59,0xda,0x1c,0xdc,0xd7,0x5c,0x9a,0x5e,0xd9, - 0x10,0x25,0x19,0x12,0x22,0x19,0x10,0x0c,0x99,0x03,0x46,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x73,0x69,0x7a,0x65,0xbc,0xc2,0xd2,0xe4, - 0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xc2,0xd8,0xd2,0xce,0xdc,0xbe, - 0xe6,0xd2,0xf4,0xca,0x98,0xd8,0xcd,0x7d,0xc1,0x85,0xc9,0x85,0xb5,0xcd,0x71,0xf8, - 0x92,0x99,0x19,0x42,0x06,0xc9,0x81,0xbc,0x01,0x02,0x07,0x09,0x81,0x94,0x41,0x32, - 0x24,0x02,0x12,0x07,0x88,0x1c,0x20,0x74,0x80,0xd4,0x41,0x42,0x20,0x76,0x90,0x10, - 0xc8,0x85,0xdc,0x01,0x92,0x21,0x78,0x30,0x04,0x41,0xd0,0x00,0x59,0x03,0xc4,0x0d, - 0x90,0x3c,0x18,0x62,0x1c,0x00,0x32,0x06,0x88,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83, - 0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7, - 0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x40,0xfa,0x60,0x88, - 0x81,0xf0,0x01,0xe2,0x07,0x4b,0x30,0xc4,0x40,0xfe,0x00,0xf9,0x83,0x25,0x18,0x22, - 0x00,0xc9,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1, - 0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1, - 0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07, - 0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79, - 0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70, - 0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87, - 0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74, - 0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78, - 0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x86,0xc2,0x38,0x90,0x44, - 0x8d,0x50,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x81,0x1e,0xca,0x01, - 0x1f,0xa6,0x04,0x7b,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00, - 0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3, - 0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10, - 0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30, - 0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03, - 0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07, - 0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e, - 0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d, - 0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b, - 0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76, - 0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90, - 0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87, - 0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e, - 0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c, - 0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca, - 0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8, - 0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82, - 0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83, - 0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f, - 0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec, - 0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc, - 0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0, - 0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60, - 0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e, - 0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1, - 0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43, - 0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c, - 0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72, - 0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00, - 0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x24,0x00,0x00,0x00,0x13,0x04,0x41,0x2c, - 0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10, - 0x83,0x00,0x41,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82,0xf0,0x2f,0x80,0x20, - 0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08,0x82,0x20,0x08,0x0e, - 0x33,0x00,0x24,0x73,0x10,0x18,0x76,0x59,0x34,0x33,0x00,0x04,0x63,0x04,0x20,0x08, - 0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00,0xe3,0x0d,0x0c,0x66, - 0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9,0x0c,0x32,0x04,0xcb, - 0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41,0x15,0xcc,0x36,0x04, - 0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x5b,0x86,0x20,0x00, - 0x85,0x2d,0x83,0x30,0x84,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x21,0x46,0x42,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, + 0x2b,0x1b,0x62,0x24,0x01,0x22,0x24,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4, + 0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac, + 0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0x80,0x10, + 0x43,0x8c,0x24,0x48,0x86,0x44,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e, + 0x24,0x48,0x82,0x44,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56, + 0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56, + 0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65, + 0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c, + 0x65,0x43,0x04,0x64,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1, + 0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95, + 0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x51,0x58, + 0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d, + 0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72, + 0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc, + 0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85, + 0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20,0x0f,0x02,0x21,0x11,0x22,0x21,0x13,0x42, + 0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6,0xf6, + 0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08,0x83,0x3c,0x88,0x85,0x44, + 0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e,0xed, + 0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10,0x05, + 0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86,0x18,0x48,0x85,0x64,0x08,0x47,0x28,0x2c, + 0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52, + 0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59, + 0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0xaf,0xaf,0xb0, + 0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf,0xaf, + 0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x44,0x40,0x3c,0xe4, + 0x4b,0x84,0x24,0x40,0xc0,0x00,0x89,0x10,0x09,0x99,0x90,0x30,0x60,0x42,0x57,0x86, + 0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84,0x4a,0x02,0xc4,0x43,0xbe,0x24,0x48,0x02, + 0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88,0x24,0x40,0xc0,0x00,0x89,0x90,0x0b,0x99, + 0x90,0x32,0xa0,0x12,0x96,0x26,0xe7,0x22,0x56,0x67,0x66,0x56,0x26,0xc7,0x27,0x2c, + 0x4d,0xce,0x45,0xac,0xce,0xcc,0xac,0x4c,0xee,0x6b,0x2e,0x4d,0xaf,0x8c,0x48,0x58, + 0x9a,0x9c,0x8b,0x5c,0x59,0x18,0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba, + 0x31,0xba,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3,0x37,0x26,0x64,0x69,0x73, + 0x70,0x5f,0x73,0x69,0x7a,0x65,0x43,0x94,0x44,0x48,0x86,0x44,0x40,0x24,0x64,0x0d, + 0x18,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0xcd,0xa5, + 0xe9,0x95,0xf1,0x0a,0x4b,0x93,0x73,0x09,0x93,0x3b,0xfb,0xa2,0xcb,0x83,0x2b,0xfb, + 0x0a,0x63,0x4b,0x3b,0x73,0xfb,0x9a,0x4b,0xd3,0x2b,0x63,0x62,0x37,0xf7,0x05,0x17, + 0x26,0x17,0xd6,0x36,0xc7,0xe1,0x4b,0x46,0x66,0x08,0x19,0x24,0x06,0x72,0x06,0x08, + 0x1a,0x24,0x03,0xf2,0x25,0x42,0x12,0x20,0x69,0x80,0xa8,0x01,0xc2,0x06,0x48,0x1b, + 0x24,0x03,0xe2,0x06,0xc9,0x80,0x44,0xc8,0x1b,0x20,0x13,0x02,0x07,0x43,0x10,0x44, + 0x0c,0x10,0x32,0x40,0xcc,0x00,0x89,0x83,0x21,0xc6,0x01,0x20,0x1d,0x22,0x07,0x7c, + 0xde,0xda,0xdc,0xd2,0xe0,0xde,0xe8,0xca,0xdc,0xe8,0x40,0xc6,0xd0,0xc2,0xe4,0xf8, + 0x4c,0xa5,0xb5,0xc1,0xb1,0x95,0x81,0x0c,0xad,0xac,0x80,0x50,0x09,0x05,0x05,0x0d, + 0x11,0x90,0x3a,0x18,0x62,0x20,0x74,0x80,0xd8,0xc1,0x72,0x0c,0x31,0x90,0x3b,0x40, + 0xee,0x60,0x39,0x46,0x44,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0xd0,0x0e,0xef,0x40, + 0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0,0x0e,0xe1,0x70,0x0e,0xf3,0x30,0x45, + 0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xa4,0x03,0x39,0x94,0x83, + 0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39, + 0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0xc0,0x18,0x41,0x85,0x43,0x3a,0xc8, + 0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4,0x43,0x38,0x9c,0x43,0x39,0xfc,0x82, + 0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c,0x09,0x90,0x11,0x53,0x38, + 0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b,0xc0,0x43,0x3a,0xb0,0x43,0x39,0xfc, + 0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x3c,0x4c,0x19,0x14,0xc6,0x19, + 0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8,0x03,0x3d,0x94,0x03,0x3e, + 0x4c,0x09,0xe6,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c, + 0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07, + 0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e, + 0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43, + 0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c, + 0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76, + 0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e, + 0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8, + 0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4, + 0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68, + 0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07, + 0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71, + 0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5, + 0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4, + 0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90, + 0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43, + 0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b, + 0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78, + 0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2, + 0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20, + 0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0, + 0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83, + 0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07, + 0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61, + 0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d, + 0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39, + 0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79, + 0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3, + 0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4, + 0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8, + 0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83, + 0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, + 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x23,0x00,0x00,0x00, + 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40, + 0x60,0x1c,0x73,0x10,0x42,0xf0,0x3c,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82, + 0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08, + 0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73,0x10,0xd7,0x65,0x55,0x34,0x33,0x00,0x04, + 0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00, + 0xe3,0x0d,0x4c,0x64,0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9, + 0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41, + 0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x5b,0x86,0x20,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _simgui_fs_bytecode_metal_ios[2893] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x4d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _simgui_fs_bytecode_metal_ios[2809] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf9,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xe9,0x4a,0xc6,0xd1,0xba,0x33,0x39, - 0x67,0xdf,0xcd,0xe3,0x58,0xde,0xd4,0xb8,0x81,0x4c,0x26,0x44,0xbc,0x9d,0x14,0xdc, - 0xa9,0x02,0x93,0x08,0x5a,0xcd,0x66,0x1c,0x30,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xf0,0xa4,0xb3,0x95,0x4b,0xab,0x64, + 0x94,0xe7,0xa9,0x8a,0x69,0x27,0x6d,0x28,0x77,0x84,0x8d,0x3f,0xaf,0x7d,0x3c,0x39, + 0x31,0xc4,0xcb,0x53,0x6d,0xc0,0x0d,0xdf,0x08,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x58,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x93,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x14,0x58,0x23,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x04,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x7e,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0, 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87, 0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f, 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9, @@ -1213,63 +1199,55 @@ static const uint8_t _simgui_fs_bytecode_metal_ios[2893] = { 0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98, 0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03,0x04,0x80,0x00,0x00, 0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98, - 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x23,0x00,0x25, - 0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0xa1,0x29,0x00,0x00,0x79,0x18,0x00, - 0x00,0xd9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, + 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, + 0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0x01,0x12,0x00,0x00,0x79,0x18,0x00, + 0x00,0xb9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, 0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b, - 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc3,0x23,0x2c,0x05,0xd9,0x20,0x08, - 0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd, - 0x0d,0x64,0x26,0x07,0x46,0xc6,0xc5,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd, - 0xac,0xac,0x65,0x26,0x07,0x46,0xc6,0xc5,0xe6,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c, - 0x65,0x58,0x8c,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x65,0x58, - 0x84,0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42, - 0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66, - 0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43, - 0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9, - 0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d, - 0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x61,0x10,0x96,0x26, - 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6, - 0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x78,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b, - 0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9, - 0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0xe1,0x89,0x78,0x06,0x61,0x69,0x72, - 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f, - 0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73, - 0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x62,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46, - 0x56,0x26,0xf7,0x45,0x17,0x26,0x77,0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c, - 0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b, - 0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32, - 0x2a,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43,0x98,0xa7,0x5a,0x84, - 0xc7,0x7a,0xae,0x07,0x7b,0xb2,0x21,0xc2,0xa3,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93, - 0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57, - 0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc, - 0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18, - 0x5d,0x9a,0x5d,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x0a,0x75,0x76,0x43,0xa4, - 0x45,0x78,0xb8,0xa7,0x7b,0xbc,0xe7,0x7b,0xac,0x07,0x0c,0x1e,0xec,0x09,0x03,0x2e, - 0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x2c,0xc6,0xde,0xd8,0xde, - 0xe4,0x86,0x48,0xcb,0xf0,0x70,0xcf,0x18,0x3c,0xde,0xf3,0x3d,0xd6,0x73,0x3d,0xd8, - 0x43,0x06,0x5c,0xc2,0xd2,0xe4,0x5c,0xe8,0xca,0xf0,0xe8,0xea,0xe4,0xca,0x28,0x85, - 0xa5,0xc9,0xb9,0xb0,0xbd,0x8d,0x85,0xd1,0xa5,0xbd,0xb9,0x7d,0xa5,0xb9,0x91,0x95, - 0xe1,0x51,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x23,0x46,0x57,0x86, - 0x47,0x57,0x27,0x57,0x26,0x43,0xc6,0x63,0xc6,0xf6,0x16,0x46,0xc7,0x02,0x32,0x17, - 0xd6,0x06,0xc7,0x56,0xe6,0xc3,0x81,0xae,0x0c,0x6f,0x08,0xb5,0x10,0x8f,0x19,0x3c, - 0x67,0xb0,0x08,0xcb,0xf0,0xa0,0xc1,0x63,0x3d,0x69,0xf0,0x60,0x8f,0x1a,0x70,0x09, - 0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x93,0xe3,0x31,0x17,0xd6,0x06,0xc7, - 0x56,0x26,0x47,0x84,0xae,0x0c,0x6f,0xaa,0x0d,0x8e,0x4d,0x6e,0x88,0xb4,0x1c,0x0f, - 0x1b,0x3c,0x67,0xb0,0x08,0xcb,0xf0,0x58,0x4f,0x1b,0x3c,0xd8,0xe3,0x06,0x43,0x90, - 0x47,0x0c,0x9e,0x32,0x78,0xd6,0xe0,0x79,0x83,0x21,0x46,0x02,0x3c,0xdb,0x03,0x07, - 0x23,0x22,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77,0x20,0x87,0x7a,0x60, - 0x87,0x72,0x70,0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98,0x22,0x04,0xc3,0x08, - 0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d,0xe8,0x61, - 0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x61,0x1e, - 0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xd8, - 0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e,0xca,0x41, - 0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2,0x41,0x1e, - 0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1,0x1d,0xe0, - 0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x18,0x0a,0xe3,0x40,0x12,0x35,0x82, - 0x09,0x87,0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70, - 0x07,0x7a,0x98,0x12,0xc4,0x01,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00, + 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08, + 0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed, + 0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c, + 0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45, + 0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17, + 0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6, + 0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96, + 0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f, + 0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f, + 0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c, + 0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99, + 0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d, + 0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d, + 0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c, + 0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2, + 0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d, + 0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9, + 0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc, + 0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb, + 0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e, + 0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34, + 0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x96,0xe1,0xb1,0x9e,0xeb, + 0xc1,0x9e,0xec,0x81,0x1e,0xed,0x91,0x9e,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb, + 0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21,0xd2,0x22,0x3c,0xd6, + 0xd3,0x3d,0xd8,0x93,0x3d,0xd0,0x13,0x3d,0xd2,0xe3,0x71,0x09,0x4b,0x93,0x73,0xa1, + 0x2b,0xc3,0xa3,0xab,0x93,0x2b,0xa3,0x14,0x96,0x26,0xe7,0xc2,0xf6,0x36,0x16,0x46, + 0x97,0xf6,0xe6,0xf6,0x95,0xe6,0x46,0x56,0x86,0x47,0x25,0x2c,0x4d,0xce,0x65,0x2e, + 0xac,0x0d,0x8e,0xad,0x8c,0x18,0x5d,0x19,0x1e,0x5d,0x9d,0x5c,0x99,0x0c,0x19,0x8f, + 0x19,0xdb,0x5b,0x18,0x1d,0x0b,0xc8,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x0f,0x07,0xba, + 0x32,0xbc,0x21,0xd4,0x42,0x3c,0x60,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x23,0x06,0x0f, + 0xf4,0x8c,0xc1,0x23,0x3d,0x64,0xc0,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e, + 0xad,0x4c,0x8e,0xc7,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x87,0xb9,0x36,0xb8,0x21, + 0xd2,0x72,0x3c,0x66,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x03,0x3d,0x67,0xf0,0x48,0x0f, + 0x1a,0x0c,0x41,0x1e,0xee,0xf9,0x9e,0x32,0x78,0xd2,0x60,0x88,0x91,0x00,0x4f,0xf5, + 0xa8,0xc1,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1, + 0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1, + 0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07, + 0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79, + 0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70, + 0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87, + 0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74, + 0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78, + 0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x83,0xc2,0x38,0x23,0x98, + 0x70,0x48,0x07,0x79,0x70,0x03,0x73,0x90,0x87,0x70,0x38,0x87,0x76,0x28,0x07,0x77, + 0xa0,0x87,0x29,0xc1,0x1a,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00, 0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84, 0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed, 0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66, @@ -1297,15 +1275,19 @@ static const uint8_t _simgui_fs_bytecode_metal_ios[2893] = { 0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0, 0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3, 0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07, - 0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, - 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, - 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, - 0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00, - 0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4,0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00, - 0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91,0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6, - 0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23, + 0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59, + 0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b, + 0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00, + 0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, + 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, + 0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41, + 0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4, + 0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91, + 0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6,0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const char _simgui_vs_source_metal_sim[720] = { +static const char _simgui_vs_source_metal_sim[672] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1329,30 +1311,28 @@ static const char _simgui_vs_source_metal_sim[720] = { 0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32, - 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31, - 0x35,0x20,0x22,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x33,0x20,0x5b,0x5b, - 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, - 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x35,0x20, - 0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28, - 0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2f,0x20, - 0x5f,0x32,0x33,0x2e,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x29,0x20,0x2d, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30, - 0x29,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c, - 0x69,0x6e,0x65,0x20,0x31,0x36,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, - 0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f, - 0x72,0x64,0x30,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x22, + 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61, + 0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32, + 0x32,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74, + 0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f, + 0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x20,0x2f,0x20,0x5f,0x32,0x32,0x2e,0x64,0x69,0x73,0x70, + 0x5f,0x73,0x69,0x7a,0x65,0x29,0x20,0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28, + 0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32, + 0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76, + 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + }; -static const char _simgui_fs_source_metal_sim[470] = { +static const char _simgui_fs_source_metal_sim[436] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1366,25 +1346,24 @@ static const char _simgui_fs_source_metal_sim[470] = { 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x31,0x20,0x22,0x22,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b, - 0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f, - 0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31, - 0x31,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69, - 0x6e,0x2e,0x75,0x76,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65, + 0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65, + 0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d, + 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b, + 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e, + 0x75,0x76,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) +FIXME FIXME FIXME static const uint8_t _simgui_vs_bytecode_hlsl4[892] = { 0x44,0x58,0x42,0x43,0x05,0xf8,0x0b,0x1e,0x7a,0x13,0x49,0x07,0x83,0x60,0x2e,0x88, 0x06,0xfa,0x10,0x2e,0x01,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, @@ -1485,6 +1464,7 @@ static const uint8_t _simgui_fs_bytecode_hlsl4[620] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) +FIXME FIXME FIXME static const uint8_t _simgui_vs_bytecode_wgpu[1868] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x34,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, @@ -1686,8 +1666,7 @@ static const char* _simgui_get_clipboard(void* user_data) { EM_JS(int, simgui_js_is_osx, (void), { if (navigator.userAgent.includes('Macintosh')) { return 1; - } - else { + } else { return 0; } }); @@ -1703,8 +1682,7 @@ static void* _simgui_malloc(size_t size) { void* ptr; if (_simgui.desc.allocator.alloc) { ptr = _simgui.desc.allocator.alloc(size, _simgui.desc.allocator.user_data); - } - else { + } else { ptr = malloc(size); } SOKOL_ASSERT(ptr); @@ -1714,8 +1692,7 @@ static void* _simgui_malloc(size_t size) { static void _simgui_free(void* ptr) { if (_simgui.desc.allocator.free) { _simgui.desc.allocator.free(ptr, _simgui.desc.allocator.user_data); - } - else { + } else { free(ptr); } } @@ -1739,6 +1716,22 @@ static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { return res; } +static uint32_t _simgui_imageid_from_texid(ImTextureID tex_id) { + uint32_t img_id = (uint32_t)(((uintptr_t)tex_id) & 0xFFFFFFFF); + if (0 == img_id) { + img_id = _simgui.img.id; + } + return img_id; +} + +static uint32_t _simgui_samplerid_from_texid(ImTextureID tex_id) { + uint32_t smp_id = (uint32_t)((((uintptr_t)tex_id) >> 32) & 0xFFFFFFFF); + if (0 == smp_id) { + smp_id = _simgui.smp.id; + } + return smp_id; +} + SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { SOKOL_ASSERT(desc); _simgui_clear(&_simgui, sizeof(_simgui)); @@ -1747,18 +1740,17 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) _simgui.is_osx = _simgui_is_osx(); #endif - /* can keep color_format, depth_format and sample_count as is, - since sokol_gfx.h will do its own default-value handling - */ + // can keep color_format, depth_format and sample_count as is, + // since sokol_gfx.h will do its own default-value handling - /* allocate an intermediate vertex- and index-buffer */ + // allocate an intermediate vertex- and index-buffer SOKOL_ASSERT(_simgui.desc.max_vertices > 0); _simgui.vertices.size = (size_t)_simgui.desc.max_vertices * sizeof(ImDrawVert); _simgui.vertices.ptr = _simgui_malloc(_simgui.vertices.size); _simgui.indices.size = (size_t)_simgui.desc.max_vertices * 3 * sizeof(ImDrawIdx); _simgui.indices.ptr = _simgui_malloc(_simgui.indices.size); - /* initialize Dear ImGui */ + // initialize Dear ImGui #if defined(__cplusplus) ImGui::CreateContext(); ImGui::StyleColorsDark(); @@ -1786,10 +1778,10 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { #endif io->ConfigWindowsResizeFromEdges = !_simgui.desc.disable_windows_resize_from_edges; - /* create sokol-gfx resources */ + // create sokol-gfx resources sg_push_debug_group("sokol-imgui"); - /* NOTE: since we're in C++ mode here we can't use C99 designated init */ + // NOTE: since we're in C++ mode here we can't use C99 designated init sg_buffer_desc vb_desc; _simgui_clear(&vb_desc, sizeof(vb_desc)); vb_desc.usage = SG_USAGE_STREAM; @@ -1805,7 +1797,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { ib_desc.label = "sokol-imgui-indices"; _simgui.ibuf = sg_make_buffer(&ib_desc); - /* default font texture */ + // default font texture if (!_simgui.desc.no_default_font) { unsigned char* font_pixels; int font_width, font_height; @@ -1820,10 +1812,6 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { img_desc.width = font_width; img_desc.height = font_height; img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; - img_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - img_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; - img_desc.min_filter = SG_FILTER_LINEAR; - img_desc.mag_filter = SG_FILTER_LINEAR; img_desc.data.subimage[0][0].ptr = font_pixels; img_desc.data.subimage[0][0].size = (size_t)(font_width * font_height) * sizeof(uint32_t); img_desc.label = "sokol-imgui-font"; @@ -1831,7 +1819,18 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { io->Fonts->TexID = (ImTextureID)(uintptr_t) _simgui.img.id; } - /* shader object for using the embedded shader source (or bytecode) */ + // a sampler for the font texture + sg_sampler_desc smp_desc; + _simgui_clear(&smp_desc, sizeof(smp_desc)); + smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + smp_desc.min_filter = SG_FILTER_LINEAR; + smp_desc.mag_filter = SG_FILTER_LINEAR; + smp_desc.mipmap_filter = SG_FILTER_NONE; + _simgui.smp = sg_make_sampler(&smp_desc); + io->Fonts->TexID = simgui_imtextureid(_simgui.img, _simgui.smp); + + // shader object for using the embedded shader source (or bytecode) sg_shader_desc shd_desc; _simgui_clear(&shd_desc, sizeof(shd_desc)); shd_desc.attrs[0].name = "position"; @@ -1848,9 +1847,15 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { ub->uniforms[0].name = "vs_params"; ub->uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; ub->uniforms[0].array_count = 1; - shd_desc.fs.images[0].name = "tex"; + shd_desc.fs.images[0].used = true; shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT; + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + shd_desc.fs.samplers[0].used = true; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.image_sampler_pairs[0].used = true; + shd_desc.fs.image_sampler_pairs[0].image_slot = 0; + shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; + shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; shd_desc.label = "sokol-imgui-shader"; #if defined(SOKOL_GLCORE33) shd_desc.vs.source = _simgui_vs_source_glsl330; @@ -1887,22 +1892,22 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { #endif _simgui.shd = sg_make_shader(&shd_desc); - /* pipeline object for imgui rendering */ + // pipeline object for imgui rendering sg_pipeline_desc pip_desc; _simgui_clear(&pip_desc, sizeof(pip_desc)); pip_desc.layout.buffers[0].stride = sizeof(ImDrawVert); { - sg_vertex_attr_desc* attr = &pip_desc.layout.attrs[0]; + sg_vertex_attr_state* attr = &pip_desc.layout.attrs[0]; attr->offset = offsetof(ImDrawVert, pos); attr->format = SG_VERTEXFORMAT_FLOAT2; } { - sg_vertex_attr_desc* attr = &pip_desc.layout.attrs[1]; + sg_vertex_attr_state* attr = &pip_desc.layout.attrs[1]; attr->offset = offsetof(ImDrawVert, uv); attr->format = SG_VERTEXFORMAT_FLOAT2; } { - sg_vertex_attr_desc* attr = &pip_desc.layout.attrs[2]; + sg_vertex_attr_state* attr = &pip_desc.layout.attrs[2]; attr->offset = offsetof(ImDrawVert, col); attr->format = SG_VERTEXFORMAT_UBYTE4N; } @@ -1931,10 +1936,11 @@ SOKOL_API_IMPL void simgui_shutdown(void) { #else igDestroyContext(0); #endif - /* NOTE: it's valid to call the destroy funcs with SG_INVALID_ID */ + // NOTE: it's valid to call the destroy funcs with SG_INVALID_ID sg_push_debug_group("sokol-imgui"); sg_destroy_pipeline(_simgui.pip); sg_destroy_shader(_simgui.shd); + sg_destroy_sampler(_simgui.smp); sg_destroy_image(_simgui.img); sg_destroy_buffer(_simgui.ibuf); sg_destroy_buffer(_simgui.vbuf); @@ -1945,6 +1951,10 @@ SOKOL_API_IMPL void simgui_shutdown(void) { _simgui_free((void*)_simgui.indices.ptr); } +SOKOL_API_IMPL void* simgui_imtextureid(sg_image img, sg_sampler smp) { + return (void*) ((((uint64_t)smp.id) << 32) | (img.id)); +} + SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->width > 0); @@ -2024,14 +2034,14 @@ SOKOL_API_IMPL void simgui_render(void) { const size_t vtx_size = (size_t)cl->VtxBuffer.Size * sizeof(ImDrawVert); const size_t idx_size = (size_t)cl->IdxBuffer.Size * sizeof(ImDrawIdx); - /* check for buffer overflow */ + // check for buffer overflow if (((all_vtx_size + vtx_size) > _simgui.vertices.size) || ((all_idx_size + idx_size) > _simgui.indices.size)) { break; } - /* copy vertices and indices into common buffers */ + // copy vertices and indices into common buffers if (vtx_size > 0) { const ImDrawVert* src_vtx_ptr = cl->VtxBuffer.Data; void* dst_vtx_ptr = (void*) (((uint8_t*)_simgui.vertices.ptr) + all_vtx_size); @@ -2049,7 +2059,7 @@ SOKOL_API_IMPL void simgui_render(void) { return; } - /* update the sokol-gfx vertex- and index-buffer */ + // update the sokol-gfx vertex- and index-buffer sg_push_debug_group("sokol-imgui"); if (all_vtx_size > 0) { sg_range vtx_data = _simgui.vertices; @@ -2062,7 +2072,7 @@ SOKOL_API_IMPL void simgui_render(void) { sg_update_buffer(_simgui.ibuf, &idx_data); } - /* render the ImGui command list */ + // render the ImGui command list const float dpi_scale = _simgui.cur_dpi_scale; const int fb_width = (int) (io->DisplaySize.x * dpi_scale); const int fb_height = (int) (io->DisplaySize.y * dpi_scale); @@ -2079,8 +2089,10 @@ SOKOL_API_IMPL void simgui_render(void) { _simgui_clear((void*)&bind, sizeof(bind)); bind.vertex_buffers[0] = _simgui.vbuf; bind.index_buffer = _simgui.ibuf; + bind.fs.samplers[0] = _simgui.smp; ImTextureID tex_id = io->Fonts->TexID; - bind.fs_images[0].id = (uint32_t)(uintptr_t)tex_id; + bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); + bind.fs.samplers[0].id = _simgui_samplerid_from_texid(tex_id); int vb_offset = 0; int ib_offset = 0; for (int cl_index = 0; cl_index < cmd_list_count; cl_index++) { @@ -2105,12 +2117,12 @@ SOKOL_API_IMPL void simgui_render(void) { sg_apply_pipeline(_simgui.pip); sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(vs_params)); sg_apply_bindings(&bind); - } - else { + } else { if ((tex_id != pcmd->TextureId) || (vtx_offset != pcmd->VtxOffset)) { tex_id = pcmd->TextureId; vtx_offset = pcmd->VtxOffset; - bind.fs_images[0].id = (uint32_t)(uintptr_t)tex_id; + bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); + bind.fs.samplers[0].id = _simgui_samplerid_from_texid(tex_id); bind.vertex_buffer_offsets[0] = vb_offset + (int)(pcmd->VtxOffset * sizeof(ImDrawVert)); sg_apply_bindings(&bind); } @@ -2141,8 +2153,7 @@ SOKOL_API_IMPL void simgui_render(void) { _SOKOL_PRIVATE bool _simgui_is_ctrl(uint32_t modifiers) { if (_simgui.is_osx) { return 0 != (modifiers & SAPP_MODIFIER_SUPER); - } - else { + } else { return 0 != (modifiers & SAPP_MODIFIER_CTRL); } } @@ -2438,13 +2449,13 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { break; case SAPP_EVENTTYPE_KEY_DOWN: _simgui_update_modifiers(io, ev->modifiers); - /* intercept Ctrl-V, this is handled via EVENTTYPE_CLIPBOARD_PASTED */ + // intercept Ctrl-V, this is handled via EVENTTYPE_CLIPBOARD_PASTED if (!_simgui.desc.disable_paste_override) { if (_simgui_is_ctrl(ev->modifiers) && (ev->key_code == SAPP_KEYCODE_V)) { break; } } - /* on web platform, don't forward Ctrl-X, Ctrl-V to the browser */ + // on web platform, don't forward Ctrl-X, Ctrl-V to the browser if (_simgui_is_ctrl(ev->modifiers) && (ev->key_code == SAPP_KEYCODE_X)) { sapp_consume_event(); } @@ -2456,11 +2467,11 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { break; case SAPP_EVENTTYPE_KEY_UP: _simgui_update_modifiers(io, ev->modifiers); - /* intercept Ctrl-V, this is handled via EVENTTYPE_CLIPBOARD_PASTED */ + // intercept Ctrl-V, this is handled via EVENTTYPE_CLIPBOARD_PASTED if (_simgui_is_ctrl(ev->modifiers) && (ev->key_code == SAPP_KEYCODE_V)) { break; } - /* on web platform, don't forward Ctrl-X, Ctrl-V to the browser */ + // on web platform, don't forward Ctrl-X, Ctrl-V to the browser if (_simgui_is_ctrl(ev->modifiers) && (ev->key_code == SAPP_KEYCODE_X)) { sapp_consume_event(); } @@ -2485,7 +2496,7 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { } break; case SAPP_EVENTTYPE_CLIPBOARD_PASTED: - /* simulate a Ctrl-V key down/up */ + // simulate a Ctrl-V key down/up if (!_simgui.desc.disable_paste_override) { _simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), true); _simgui_add_imgui_key_event(io, ImGuiKey_V, true); From 54b0ed7d67129e8a3725d17cae97c4fecbddabd9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 19 Jun 2023 15:59:13 +0200 Subject: [PATCH 033/292] sokol_nuklear.h: fixes for separate image/sampler, new helper function snk_nkhandle() --- util/sokol_nuklear.h | 1449 +++++++++++++++++++++--------------------- 1 file changed, 720 insertions(+), 729 deletions(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index a52f43e09..d53e24aea 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -155,6 +155,12 @@ nk_edit_string(...), called snk_edit_string(...) which will show and hide the onscreen keyboard as required. + --- NOTE: to create a Nuklear image handle, use the helper function + `nk_handle snk_nkhandle(sg_image img, sg_sampler smp)` together with + the Nuklear function nk_image_handle like this: + + nk_image_handle(snk_nkhandle(img, smp)) + LICENSE ======= @@ -221,10 +227,10 @@ typedef struct snk_desc_t { SOKOL_NUKLEAR_API_DECL void snk_setup(const snk_desc_t* desc); SOKOL_NUKLEAR_API_DECL struct nk_context* snk_new_frame(void); SOKOL_NUKLEAR_API_DECL void snk_render(int width, int height); +SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(sg_image img, sg_sampler smp); #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) SOKOL_NUKLEAR_API_DECL void snk_handle_event(const sapp_event* ev); -SOKOL_NUKLEAR_API_DECL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, - char *memory, int *len, int max, nk_plugin_filter filter); +SOKOL_NUKLEAR_API_DECL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter); #endif SOKOL_NUKLEAR_API_DECL void snk_shutdown(void); @@ -305,6 +311,7 @@ typedef struct { sg_buffer vbuf; sg_buffer ibuf; sg_image img; + sg_sampler smp; sg_shader shd; sg_pipeline pip; bool is_osx; /* return true if running on OSX (or HTML5 OSX), needed for copy/paste */ @@ -325,7 +332,7 @@ static _snk_state_t _snuklear; /* Embedded source code compiled with: - sokol-shdc -i snuk.glsl -o snuk.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b + sokol-shdc -i snuk.glsl -o snuk.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b (not that for Metal and D3D11 byte code, sokol-shdc must be run on macOS and Windows) @@ -347,12 +354,13 @@ static _snk_state_t _snuklear; @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; in vec2 uv; in vec4 color; out vec4 frag_color; void main() { - frag_color = texture(tex, uv) * color; + frag_color = texture(sampler2D(tex, smp), uv) * color; } @end @@ -383,18 +391,19 @@ static const char _snk_vs_source_glsl330[341] = { 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b, 0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _snk_fs_source_glsl330[169] = { +static const char fs_source_glsl330[177] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, - 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74, + 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20, + 0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a, + 0x00, }; #elif defined(SOKOL_GLES3) static const char _snk_vs_source_glsl300es[344] = { @@ -421,189 +430,176 @@ static const char _snk_vs_source_glsl300es[344] = { 0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _snk_fs_source_glsl300es[242] = { +static const char _snk_fs_source_glsl300es[250] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, - 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20, - 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69, - 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c, - 0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, + 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75, + 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _snk_vs_bytecode_metal_macos[3216] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x90,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _snk_vs_bytecode_metal_macos[3052] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xef,0xd7,0x24,0x0b,0xf0,0x26,0xba, - 0xcd,0xc3,0x6f,0x48,0x91,0x7a,0x7c,0x38,0xca,0xb8,0xf1,0xb1,0xe3,0xc7,0x99,0x8d, - 0xac,0x39,0x8e,0x2f,0xf8,0xa3,0x19,0x68,0x22,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x7b,0x12,0x23,0x17,0xd9,0x25,0x1c, + 0x1b,0x42,0x42,0x9f,0xbf,0x31,0xd2,0x2c,0x3a,0x55,0x22,0x1d,0x40,0xd8,0xc4,0xf8, + 0x20,0x49,0x60,0x6d,0x3c,0xea,0x4e,0x1c,0x34,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x60,0x0b,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xd5,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x18,0x02,0x01,0x2c,0x40,0x05,0x00, - 0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00, - 0x1b,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84, - 0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c, - 0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77,0x49,0x53,0x44,0x09, - 0x93,0xcf,0x00,0x48,0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28,0xc4,0x80,0x87,0x10, - 0x39,0x48,0x9a,0x22,0x4a,0x98,0xfc,0x4a,0xfa,0x1f,0x20,0x02,0x18,0x09,0x05,0x31, - 0x88,0x40,0x08,0xa5,0x98,0x08,0x29,0xb2,0x81,0x80,0x39,0x02,0x30,0xc8,0x81,0x9c, - 0x23,0x00,0x85,0x41,0x84,0x40,0x18,0x46,0x20,0x92,0x11,0x00,0x00,0x00,0x00,0x00, - 0x13,0xb2,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60, - 0x87,0x72,0x68,0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03, - 0x37,0x88,0x83,0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71, - 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80, - 0x07,0x6d,0x90,0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, - 0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d, - 0x90,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60, - 0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71, - 0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07, - 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a, - 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60, - 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07, - 0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78, - 0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10, - 0x07,0x79,0x20,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07, - 0x6d,0x60,0x0f,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72, - 0x50,0x07,0x76,0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20, - 0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07, - 0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d, - 0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x39,0x00, - 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xda, - 0x11,0x00,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0x20,0x1d,0x6b,0x50, - 0x1e,0x82,0x60,0x8c,0x00,0x04,0x41,0x50,0x04,0x03,0x00,0x00,0x79,0x18,0x00,0x00, - 0x16,0x01,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9, - 0xb9,0xb4,0x37,0xb7,0x21,0x46,0x52,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93, - 0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x06,0xd9,0x20,0x08,0x0e, - 0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d, - 0x24,0x07,0x46,0xc6,0x25,0x86,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac, - 0x25,0x07,0x46,0xc6,0x25,0x86,0xc6,0x25,0x27,0x65,0x88,0x80,0x10,0x43,0x8c,0x44, - 0x48,0x88,0x64,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e,0x44,0x48,0x84, - 0x64,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, - 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40, - 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, - 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04, - 0x64,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, - 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, - 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x61,0x10,0x96,0x26, - 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6, - 0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x40,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b, - 0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9, - 0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0x01,0x89,0x78,0x06,0x61,0x69,0x72, - 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f, - 0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73, - 0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x62,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47, - 0x57,0x86,0xf7,0xf5,0x56,0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85, - 0xed,0x6d,0xcc,0x0d,0x26,0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d, - 0x1e,0x5c,0xd9,0x97,0x5b,0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x32, - 0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86, - 0x30,0x48,0x85,0x58,0xc8,0x85,0x60,0x48,0x86,0x68,0x5c,0xea,0xe6,0xca,0xe4,0x50, - 0xd8,0xde,0xc6,0xdc,0x62,0x52,0x68,0x98,0xb1,0xbd,0x85,0xd1,0xd1,0xb0,0x18,0x7b, - 0x63,0x7b,0x93,0x1b,0xc2,0x20,0x15,0xc2,0x21,0x17,0xd2,0x21,0x19,0xe2,0x91,0x09, - 0x4b,0x93,0x73,0x81,0x7b,0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0xe3,0x72,0xc6,0xf6,0x05, - 0xf5,0x36,0x97,0x46,0x97,0xf6,0xe6,0x36,0x44,0x41,0xc0,0x00,0xb9,0x90,0x0e,0xc9, - 0x90,0x30,0x18,0x62,0x20,0x1b,0xf2,0x21,0x62,0x40,0x28,0x2c,0x4d,0xce,0xc5,0xae, - 0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b, - 0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xb3,0xb3, - 0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x14,0x1c,0xb8,0xb7,0xb9,0x34,0xba,0xb4, - 0x37,0x37,0x22,0x3b,0x99,0x2f,0xb3,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x43,0xa8,0x64,0x40,0xc8,0x00,0x29,0x83,0x64,0x48,0x04,0xc4,0x0c,0x90,0x0b, - 0xc1,0x90,0x0c,0x39,0x03,0x6a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28, - 0x39,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x44,0x76,0x32,0x5f,0x66,0x29, - 0x4c,0xe8,0xca,0xf0,0xc6,0xde,0xde,0xe4,0xc8,0x60,0x86,0x50,0x89,0x80,0x90,0x01, - 0x52,0x06,0x89,0x90,0x08,0x48,0x1a,0x20,0x17,0x82,0x21,0x19,0xa2,0x06,0xbc,0xce, - 0xca,0xdc,0xca,0xe4,0xc2,0xe8,0xca,0xc8,0x50,0x6c,0xc6,0xde,0xd8,0xde,0xe4,0x60, - 0x88,0xec,0x68,0xbe,0xcc,0x52,0x68,0x8c,0xbd,0xb1,0xbd,0xc9,0xc1,0x0c,0xa1,0x92, - 0x02,0x21,0x03,0xa4,0x0c,0x92,0x22,0x11,0x10,0x36,0x40,0x2e,0xa4,0x43,0x32,0xa4, - 0x0d,0xa8,0x84,0xa5,0xc9,0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9,0xf1,0x09,0x4b,0x93, - 0x73,0x11,0xab,0x33,0x33,0x2b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x23,0x12,0x96,0x26, - 0xe7,0x22,0x57,0x16,0x46,0x46,0x2a,0x2c,0x4d,0xce,0x65,0x8e,0x4e,0xae,0x6e,0x8c, - 0xee,0x8b,0x2e,0x0f,0xae,0xec,0x2b,0xcd,0xcd,0xec,0x8d,0x09,0x59,0xda,0x1c,0xdc, - 0xd7,0x5c,0x9a,0x5e,0xd9,0x10,0x25,0x19,0x12,0x22,0x19,0x10,0x0c,0x99,0x03,0x46, - 0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x73,0x69,0x7a, - 0x65,0xbc,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xc2, - 0xd8,0xd2,0xce,0xdc,0xbe,0xe6,0xd2,0xf4,0xca,0x98,0xd8,0xcd,0x7d,0xc1,0x85,0xc9, - 0x85,0xb5,0xcd,0x71,0xf8,0x92,0x99,0x19,0x42,0x06,0xc9,0x81,0xbc,0x01,0x02,0x07, - 0x09,0x81,0x94,0x41,0x32,0x24,0x02,0x12,0x07,0x88,0x1c,0x20,0x74,0x80,0xd4,0x41, - 0x42,0x20,0x76,0x90,0x10,0xc8,0x85,0xdc,0x01,0x92,0x21,0x78,0x30,0x04,0x41,0xd0, - 0x00,0x59,0x03,0xc4,0x0d,0x90,0x3c,0x18,0x62,0x1c,0x00,0x32,0x06,0x88,0x1e,0xf0, - 0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3, - 0x33,0x95,0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34, - 0x44,0x40,0xfa,0x60,0x88,0x81,0xf0,0x01,0xe2,0x07,0x4b,0x30,0xc4,0x40,0xfe,0x00, - 0xf9,0x83,0x25,0x18,0x22,0x00,0xc9,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d, - 0xda,0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce, - 0x61,0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74, - 0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70, - 0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8, - 0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73, - 0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01, - 0x32,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07, - 0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29, - 0x86,0xc2,0x38,0x90,0x44,0x8d,0x50,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c, - 0xe4,0x81,0x1e,0xca,0x01,0x1f,0xa6,0x04,0x7b,0x00,0x00,0x00,0x79,0x18,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xc8,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xaf,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x81,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x18,0x02,0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00, + 0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x16,0x00,0x00,0x00, + 0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3, + 0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c,0x10,0x3c,0x33,0x00, + 0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76,0x08,0x91,0x83,0xa4,0x29,0xa2,0x84,0xc9, + 0xaf,0xa4,0xff,0x01,0x22,0x80,0x91,0x50,0x10,0x83,0x08,0x84,0x50,0x8a,0x89,0x90, + 0x22,0x1b,0x08,0x98,0x23,0x00,0x83,0x14,0xc8,0x39,0x02,0x50,0x18,0x44,0x08,0x84, + 0x61,0x04,0x22,0x19,0x01,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0,0x03, + 0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87,0x71, + 0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38,0xd8, + 0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06, + 0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x71,0x60,0x07,0x7a, + 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a,0x30, + 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07,0x72, + 0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07, + 0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73, + 0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20, + 0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, + 0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d, + 0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80, + 0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07, + 0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07,0x7a,0x20,0x07,0x75, + 0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72,0x50,0x07,0x76,0xa0, + 0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x50,0x07, + 0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x6d, + 0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xa0, + 0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07, + 0x7a,0x30,0x07,0x72,0x30,0x84,0x39,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8, + 0x02,0x01,0x00,0x00,0x09,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90, + 0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84, + 0x32,0xa0,0x1d,0x01,0x20,0x1d,0x4b,0x68,0x02,0x00,0x00,0x00,0x79,0x18,0x00,0x00, + 0xea,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9, + 0xb9,0xb4,0x37,0xb7,0x21,0x46,0x42,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93, + 0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x24,0x01,0x22,0x24,0x05,0xe7,0x20,0x08,0x0e, + 0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd, + 0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e, + 0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26, + 0x65,0x88,0x80,0x10,0x43,0x8c,0x24,0x48,0x86,0x44,0x60,0xd1,0x54,0x46,0x17,0xc6, + 0x36,0x04,0x41,0x8e,0x24,0x48,0x82,0x44,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6, + 0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36, + 0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d, + 0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65, + 0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd, + 0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95, + 0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d, + 0x11,0x90,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b, + 0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98, + 0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e, + 0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84, + 0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20,0x0f,0x02,0x21, + 0x11,0x22,0x21,0x13,0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b, + 0x49,0xa1,0x61,0xc6,0xf6,0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08, + 0x83,0x3c,0x88,0x85,0x44,0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee, + 0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d, + 0xda,0x9b,0xdb,0x10,0x05,0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86,0x18,0x48,0x85, + 0x64,0x08,0x47,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd, + 0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b, + 0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32, + 0x32,0x94,0xaf,0xaf,0xb0,0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36, + 0xb2,0x32,0xb9,0xaf,0xaf,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43, + 0xa8,0x44,0x40,0x3c,0xe4,0x4b,0x84,0x24,0x40,0xc0,0x00,0x89,0x10,0x09,0x99,0x90, + 0x30,0x60,0x42,0x57,0x86,0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84,0x4a,0x02,0xc4, + 0x43,0xbe,0x24,0x48,0x02,0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19,0x03,0x1a,0x63, + 0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88,0x24,0x40,0xc0, + 0x00,0x89,0x90,0x0b,0x99,0x90,0x32,0xa0,0x12,0x96,0x26,0xe7,0x22,0x56,0x67,0x66, + 0x56,0x26,0xc7,0x27,0x2c,0x4d,0xce,0x45,0xac,0xce,0xcc,0xac,0x4c,0xee,0x6b,0x2e, + 0x4d,0xaf,0x8c,0x48,0x58,0x9a,0x9c,0x8b,0x5c,0x59,0x18,0x19,0xa9,0xb0,0x34,0x39, + 0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3, + 0x37,0x26,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x43,0x94,0x44,0x48,0x86, + 0x44,0x40,0x24,0x64,0x0d,0x18,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5, + 0xc1,0x95,0x7d,0xcd,0xa5,0xe9,0x95,0xf1,0x0a,0x4b,0x93,0x73,0x09,0x93,0x3b,0xfb, + 0xa2,0xcb,0x83,0x2b,0xfb,0x0a,0x63,0x4b,0x3b,0x73,0xfb,0x9a,0x4b,0xd3,0x2b,0x63, + 0x62,0x37,0xf7,0x05,0x17,0x26,0x17,0xd6,0x36,0xc7,0xe1,0x4b,0x46,0x66,0x08,0x19, + 0x24,0x06,0x72,0x06,0x08,0x1a,0x24,0x03,0xf2,0x25,0x42,0x12,0x20,0x69,0x80,0xa8, + 0x01,0xc2,0x06,0x48,0x1b,0x24,0x03,0xe2,0x06,0xc9,0x80,0x44,0xc8,0x1b,0x20,0x13, + 0x02,0x07,0x43,0x10,0x44,0x0c,0x10,0x32,0x40,0xcc,0x00,0x89,0x83,0x21,0xc6,0x01, + 0x20,0x1d,0x22,0x07,0x7c,0xde,0xda,0xdc,0xd2,0xe0,0xde,0xe8,0xca,0xdc,0xe8,0x40, + 0xc6,0xd0,0xc2,0xe4,0xf8,0x4c,0xa5,0xb5,0xc1,0xb1,0x95,0x81,0x0c,0xad,0xac,0x80, + 0x50,0x09,0x05,0x05,0x0d,0x11,0x90,0x3a,0x18,0x62,0x20,0x74,0x80,0xd8,0xc1,0x72, + 0x0c,0x31,0x90,0x3b,0x40,0xee,0x60,0x39,0x46,0x44,0xec,0xc0,0x0e,0xf6,0xd0,0x0e, + 0x6e,0xd0,0x0e,0xef,0x40,0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0,0x0e,0xe1, + 0x70,0x0e,0xf3,0x30,0x45,0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b, + 0xa4,0x03,0x39,0x94,0x83,0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43,0x3a,0xc8, + 0x83,0x1b,0xd8,0x43,0x39,0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0xc0,0x18, + 0x41,0x85,0x43,0x3a,0xc8,0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4,0x43,0x38, + 0x9c,0x43,0x39,0xfc,0x82,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c, + 0x09,0x90,0x11,0x53,0x38,0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b,0xc0,0x43, + 0x3a,0xb0,0x43,0x39,0xfc,0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x3c, + 0x4c,0x19,0x14,0xc6,0x19,0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8, + 0x03,0x3d,0x94,0x03,0x3e,0x4c,0x09,0xe6,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00, + 0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88, 0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6, 0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce, 0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8, @@ -630,86 +626,88 @@ static const uint8_t _snk_vs_bytecode_metal_macos[3216] = { 0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc, 0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3, 0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07, - 0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, - 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x24,0x00,0x00,0x00, - 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40, - 0x60,0x1c,0x73,0x10,0x83,0x00,0x41,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82, - 0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08, - 0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73,0x10,0x18,0x76,0x59,0x34,0x33,0x00,0x04, - 0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00, - 0xe3,0x0d,0x0c,0x66,0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9, - 0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41, - 0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x5b,0x86,0x20,0x00,0x85,0x2d,0x83,0x30,0x84,0x02,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e, + 0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e, + 0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d, + 0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00, + 0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00, + 0x61,0x20,0x00,0x00,0x23,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00, + 0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10,0x42,0xf0,0x3c,0x94, + 0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82,0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30, + 0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08,0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73, + 0x10,0xd7,0x65,0x55,0x34,0x33,0x00,0x04,0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46, + 0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00,0xe3,0x0d,0x4c,0x64,0x51,0x40,0x2c,0x0a, + 0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9,0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c, + 0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41,0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40, + 0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x5b,0x86,0x20,0xc0,0x03,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _snk_fs_bytecode_metal_macos[2909] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x5d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _snk_fs_bytecode_metal_macos[2809] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf9,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x17,0xe5,0xa2,0xb3,0x7d,0x00,0xfc, - 0xde,0x00,0x5f,0xbd,0x79,0x5e,0xd5,0x95,0xff,0xb6,0xf4,0xce,0x41,0x07,0xfb,0x8f, - 0x49,0x6b,0x95,0x79,0x7a,0xd1,0xcf,0x19,0xde,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xa1,0xce,0x6b,0xd1,0x1f,0x32,0x9e, + 0x8d,0x8d,0x1c,0xcc,0x19,0xcb,0xd3,0xb6,0x21,0x99,0x0b,0xb6,0x46,0x8b,0x87,0x98, + 0x8e,0x2d,0xb5,0x98,0x92,0x0a,0x81,0x7d,0xf3,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x60,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x95,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x1c,0x58,0x23,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x0c,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x80,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87, 0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38, 0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, @@ -736,62 +734,54 @@ static const uint8_t _snk_fs_bytecode_metal_macos[2909] = { 0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64,0x81,0x00,0x00,0x00, 0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, 0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70, - 0xac,0x41,0x79,0x08,0x00,0x79,0x18,0x00,0x00,0xd9,0x00,0x00,0x00,0x1a,0x03,0x4c, + 0x2c,0xa1,0x09,0x00,0x00,0x79,0x18,0x00,0x00,0xb9,0x00,0x00,0x00,0x1a,0x03,0x4c, 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42, 0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, - 0x2c,0xc2,0x23,0x2c,0x05,0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa, - 0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x24,0x07,0x46,0xc6,0x25,0x86,0x06, - 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x25,0x07,0x46,0xc6,0x25,0x86,0xc6, - 0x25,0x27,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46, - 0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32, - 0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45, - 0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63, - 0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68, - 0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9, - 0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99, - 0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1, - 0x95,0x0d,0x11,0x9e,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, - 0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6, - 0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x1e,0x92,0x41,0x58,0x9a,0x9c, - 0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17, - 0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98,0x18,0x5b, - 0xd9,0x10,0xe1,0x89,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, - 0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f,0x76,0x65, - 0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x84,0x67, - 0x62,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46,0x56,0x26,0xf7,0x45,0x17,0x26,0x77, - 0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c,0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec, - 0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b,0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39, - 0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32,0x2a,0x66,0x72,0x61,0x67,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x43,0x98,0xa7,0x5a,0x86,0xc7,0x7a,0xae,0x07,0x7b,0xb2,0x21, - 0xc2,0xa3,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93,0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb, - 0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57,0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06, - 0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc,0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a, - 0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18,0x5d,0x9a,0x5d,0x19,0x0d,0x33,0xb6, - 0xb7,0x30,0x3a,0x19,0x0a,0x75,0x76,0x43,0xa4,0x65,0x78,0xb8,0xa7,0x7b,0xbc,0xe7, - 0x7b,0xac,0x07,0x0c,0x1e,0xec,0x09,0x03,0x2e,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f, - 0x63,0x6e,0x31,0x29,0x2c,0xc6,0xde,0xd8,0xde,0xe4,0x86,0x48,0x8b,0xf0,0x70,0xcf, - 0x18,0x3c,0xde,0xf3,0x3d,0xd6,0x73,0x3d,0xd8,0x43,0x06,0x5c,0xc2,0xd2,0xe4,0x5c, - 0xe8,0xca,0xf0,0xe8,0xea,0xe4,0xca,0x28,0x85,0xa5,0xc9,0xb9,0xb0,0xbd,0x8d,0x85, - 0xd1,0xa5,0xbd,0xb9,0x7d,0xa5,0xb9,0x91,0x95,0xe1,0x51,0x09,0x4b,0x93,0x73,0x99, - 0x0b,0x6b,0x83,0x63,0x2b,0x23,0x46,0x57,0x86,0x47,0x57,0x27,0x57,0x26,0x43,0xc6, - 0x63,0xc6,0xf6,0x16,0x46,0xc7,0x02,0x32,0x17,0xd6,0x06,0xc7,0x56,0xe6,0xc3,0x81, - 0xae,0x0c,0x6f,0x08,0xb5,0x10,0x8f,0x19,0x3c,0x67,0xb0,0x0c,0x8b,0xf0,0xa0,0xc1, - 0x63,0x3d,0x69,0xf0,0x60,0x8f,0x1a,0x70,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83, - 0x63,0x2b,0x93,0xe3,0x31,0x17,0xd6,0x06,0xc7,0x56,0x26,0x47,0x84,0xae,0x0c,0x6f, - 0xaa,0x0d,0x8e,0x4d,0x6e,0x88,0xb4,0x1c,0x0f,0x1b,0x3c,0x67,0xb0,0x0c,0x8b,0xf0, - 0x58,0x4f,0x1b,0x3c,0xd8,0xe3,0x06,0x43,0x90,0x47,0x0c,0x9e,0x32,0x78,0xd6,0xe0, - 0x79,0x83,0x21,0x46,0x02,0x3c,0xdb,0x03,0x07,0x23,0x22,0x76,0x60,0x07,0x7b,0x68, - 0x07,0x37,0x68,0x87,0x77,0x20,0x87,0x7a,0x60,0x87,0x72,0x70,0x03,0x73,0x60,0x87, - 0x70,0x38,0x87,0x79,0x98,0x22,0x04,0xc3,0x08,0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1, - 0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d,0xe8,0x61,0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d, - 0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x61,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60, - 0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xd8,0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21, - 0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e,0xca,0x41,0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d, - 0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2,0x41,0x1e,0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0, - 0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1,0x1d,0xe0,0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61, - 0x1e,0xa6,0x18,0x0a,0xe3,0x40,0x12,0x35,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30, - 0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0xc4,0x01,0x00, - 0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, + 0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, + 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45, + 0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84, + 0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, + 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78, + 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, + 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84, + 0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, + 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, + 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c, + 0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0, + 0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32, + 0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe, + 0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d, + 0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c, + 0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e, + 0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34, + 0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72, + 0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28, + 0xd4,0xd9,0x0d,0x91,0x96,0xe1,0xb1,0x9e,0xeb,0xc1,0x9e,0xec,0x81,0x1e,0xed,0x91, + 0x9e,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1, + 0x37,0xb6,0x37,0xb9,0x21,0xd2,0x22,0x3c,0xd6,0xd3,0x3d,0xd8,0x93,0x3d,0xd0,0x13, + 0x3d,0xd2,0xe3,0x71,0x09,0x4b,0x93,0x73,0xa1,0x2b,0xc3,0xa3,0xab,0x93,0x2b,0xa3, + 0x14,0x96,0x26,0xe7,0xc2,0xf6,0x36,0x16,0x46,0x97,0xf6,0xe6,0xf6,0x95,0xe6,0x46, + 0x56,0x86,0x47,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x8c,0x18,0x5d, + 0x19,0x1e,0x5d,0x9d,0x5c,0x99,0x0c,0x19,0x8f,0x19,0xdb,0x5b,0x18,0x1d,0x0b,0xc8, + 0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x0f,0x07,0xba,0x32,0xbc,0x21,0xd4,0x42,0x3c,0x60, + 0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x23,0x06,0x0f,0xf4,0x8c,0xc1,0x23,0x3d,0x64,0xc0, + 0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e,0xad,0x4c,0x8e,0xc7,0x5c,0x58,0x1b, + 0x1c,0x5b,0x99,0x1c,0x87,0xb9,0x36,0xb8,0x21,0xd2,0x72,0x3c,0x66,0xf0,0x84,0xc1, + 0x32,0x2c,0xc2,0x03,0x3d,0x67,0xf0,0x48,0x0f,0x1a,0x0c,0x41,0x1e,0xee,0xf9,0x9e, + 0x32,0x78,0xd2,0x60,0x88,0x91,0x00,0x4f,0xf5,0xa8,0xc1,0x88,0x88,0x1d,0xd8,0xc1, + 0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1,0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c, + 0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1,0x30,0x42,0x61,0x07,0x76,0xb0,0x87, + 0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x14,0x23,0x96,0x70, + 0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98, + 0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87, + 0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77, + 0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68, + 0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07, + 0x77,0x98,0x87,0x29,0x83,0xc2,0x38,0x23,0x98,0x70,0x48,0x07,0x79,0x70,0x03,0x73, + 0x90,0x87,0x70,0x38,0x87,0x76,0x28,0x07,0x77,0xa0,0x87,0x29,0xc1,0x1a,0x00,0x00, + 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83, @@ -818,284 +808,277 @@ static const uint8_t _snk_fs_bytecode_metal_macos[2909] = { 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06, 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c, 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77, - 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00, - 0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, - 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, - 0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41, - 0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4, - 0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91, - 0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6,0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec, + 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, + 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, + 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, + 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, + 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, + 0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00, + 0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4,0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00, + 0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91,0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6, + 0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _snk_vs_bytecode_metal_ios[3200] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x80,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _snk_vs_bytecode_metal_ios[3052] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xec,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0xcb,0xdd,0xe3,0x08,0x7a,0x87,0xef, - 0xdd,0xe0,0x68,0xe7,0xe8,0x6b,0xe6,0xea,0x8b,0x6d,0x4a,0xe0,0x3d,0x6a,0xfe,0xe4, - 0xfe,0x32,0x1d,0xbe,0xb6,0x10,0x11,0xee,0x75,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x69,0x97,0x6b,0xac,0xd8,0xa2,0x51, + 0x33,0x7c,0x5f,0x96,0xb2,0xb1,0x06,0x06,0x7c,0xbb,0x5f,0x88,0xa0,0xeb,0x9f,0xea, + 0x6e,0x6b,0x70,0xa9,0x6e,0xef,0xe6,0xa4,0xea,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x37,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03, - 0x00,0x04,0x04,0x06,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54, - 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x5c,0x0b,0x00,0x00, - 0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xd4,0x02,0x00,0x00, - 0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91, - 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19, - 0x1e,0x04,0x8b,0x62,0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14, - 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80, - 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0, - 0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8, - 0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87, - 0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72, - 0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88, - 0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41, - 0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c, - 0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87, - 0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72, - 0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e, - 0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda, - 0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21, - 0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30, - 0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87, - 0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77, - 0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70, - 0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07, - 0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1, - 0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08, - 0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87, - 0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, - 0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d, - 0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0, - 0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80, - 0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38, - 0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00, - 0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1, - 0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87, - 0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a, - 0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d, - 0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00, - 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x20,0x02,0x01,0x24,0xc0,0x02,0x54, - 0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00, - 0x89,0x20,0x00,0x00,0x1b,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04, - 0x13,0x22,0xa4,0x84,0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c, - 0x0b,0x84,0x84,0x4c,0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x77, - 0x49,0x53,0x44,0x09,0x93,0xcf,0x00,0x48,0x43,0xff,0x0e,0x35,0xf9,0x0f,0x20,0x28, - 0xc4,0x80,0x87,0x10,0x39,0x48,0x9a,0x22,0x4a,0x98,0xfc,0x4a,0xfa,0x1f,0x20,0x02, - 0x18,0x09,0x05,0x31,0x88,0x40,0x08,0xa5,0x98,0x08,0x29,0xb2,0x81,0x80,0x39,0x02, - 0x30,0x48,0x81,0x9c,0x23,0x00,0x85,0x41,0x84,0x40,0x18,0x46,0x20,0x92,0x11,0x00, - 0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70, - 0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80, - 0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07, - 0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9, - 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30, - 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07, - 0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72, - 0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0, - 0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07, - 0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73, - 0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, - 0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0, - 0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07, - 0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72, - 0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20, - 0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07, - 0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75, - 0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00, - 0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07, - 0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x03,0x00,0x80,0x00,0x00, - 0x00,0x00,0x00,0x80,0x2c,0x10,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10, - 0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0xda,0x11,0x00,0xca,0x12, - 0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0x20,0x1d,0x4b,0x68,0x0a,0x82,0x31,0x02, - 0x10,0x04,0x41,0x11,0x0c,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x16,0x01,0x00,0x00, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, + 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xc0,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xad,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, + 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, + 0x80,0x10,0x45,0x02,0x42,0x92,0x0b,0x42,0x84,0x10,0x32,0x14,0x38,0x08,0x18,0x49, + 0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72, + 0x24,0x07,0xc8,0x08,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00, + 0x51,0x18,0x00,0x00,0x82,0x00,0x00,0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff, + 0x01,0x90,0x80,0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76, + 0xc8,0x87,0x36,0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20, + 0x87,0x74,0xb0,0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81, + 0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c, + 0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6, + 0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79, + 0x68,0x03,0x78,0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80, + 0x87,0x76,0x08,0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc, + 0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21, + 0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0, + 0x07,0x79,0xa8,0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87, + 0x76,0x28,0x87,0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36, + 0x28,0x07,0x76,0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28, + 0x87,0x70,0x30,0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87, + 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, + 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d, + 0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87, + 0x72,0x00,0x08,0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73, + 0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c, + 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda, + 0x40,0x1f,0xca,0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21, + 0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68, + 0x03,0x7a,0x90,0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87, + 0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21, + 0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e, + 0xde,0x41,0x1e,0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6, + 0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c,0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73, + 0x28,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e, + 0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea,0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc, + 0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1,0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76, + 0x98,0x87,0x72,0x00,0x36,0x20,0x02,0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00, + 0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00, + 0x16,0x00,0x00,0x00,0x32,0x22,0x08,0x09,0x20,0x64,0x85,0x04,0x13,0x22,0xa4,0x84, + 0x04,0x13,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x88,0x8c,0x0b,0x84,0x84,0x4c, + 0x10,0x3c,0x33,0x00,0xc3,0x08,0x02,0x30,0x8c,0x40,0x00,0x76,0x08,0x91,0x83,0xa4, + 0x29,0xa2,0x84,0xc9,0xaf,0xa4,0xff,0x01,0x22,0x80,0x91,0x50,0x10,0x83,0x08,0x84, + 0x50,0x8a,0x89,0x90,0x22,0x1b,0x08,0x98,0x23,0x00,0x83,0x14,0xc8,0x39,0x02,0x50, + 0x18,0x44,0x08,0x84,0x61,0x04,0x22,0x19,0x01,0x00,0x00,0x00,0x13,0xa8,0x70,0x48, + 0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83, + 0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e, + 0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0, + 0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0, + 0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6, + 0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90,0x07, + 0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6, + 0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80, + 0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07, + 0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75, + 0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72,0xa0, + 0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10,0x07, + 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70, + 0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20, + 0x07,0x43,0x98,0x03,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x2c,0x10,0x00,0x00, + 0x09,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47, + 0xc6,0x04,0x43,0xca,0x12,0x18,0x01,0x28,0x88,0x22,0x28,0x84,0x32,0xa0,0x1d,0x01, + 0x20,0x1d,0x4b,0x80,0x04,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xe9,0x00,0x00,0x00, 0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7, - 0x21,0x46,0x52,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, - 0x2b,0x1b,0x62,0x24,0x02,0x22,0x24,0x06,0xd9,0x20,0x08,0x0e,0x8e,0xad,0x0c,0x84, - 0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x07,0x46, - 0xc6,0xc5,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x07, - 0x46,0xc6,0xc5,0xe6,0x26,0x65,0x88,0x80,0x10,0x43,0x8c,0x44,0x48,0x88,0x64,0x60, - 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e,0x44,0x48,0x86,0x64,0xe0,0x16,0x96, - 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, - 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x12,0x72,0x61,0x69, - 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, - 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x64,0x21,0x19,0x84, - 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, - 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, - 0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x61,0x10,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06, - 0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6,0x45,0xf6,0x56,0x27,0xc6, - 0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x40,0x1e,0x92,0x41,0x58, - 0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x5b,0x18,0x5d,0x9a,0x5d, - 0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0x59,0xda,0x5c,0x98, - 0x18,0x5b,0xd9,0x10,0x01,0x89,0x78,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70, - 0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x77,0x69,0x64,0x65,0x5f, - 0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x04,0x64,0x62,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0xf5,0x56, - 0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x0d,0x26, - 0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0x97,0x5b, - 0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x32,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86,0x30,0x48,0x85,0x58,0xc8, - 0x85,0x60,0x48,0x86,0x68,0x5c,0xea,0xe6,0xca,0xe4,0x50,0xd8,0xde,0xc6,0xdc,0x62, - 0x52,0x68,0x98,0xb1,0xbd,0x85,0xd1,0xd1,0xb0,0x18,0x7b,0x63,0x7b,0x93,0x1b,0xc2, - 0x20,0x15,0xc2,0x21,0x17,0xd2,0x21,0x19,0xe2,0x91,0x09,0x4b,0x93,0x73,0x81,0x7b, - 0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0xe3,0x72,0xc6,0xf6,0x05,0xf5,0x36,0x97,0x46,0x97, - 0xf6,0xe6,0x36,0x44,0x41,0xc0,0x00,0xb9,0x90,0x0e,0xc9,0x90,0x30,0x18,0x62,0x20, - 0x1b,0xf2,0x21,0x62,0x40,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef, - 0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d, - 0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xb3,0xb3,0x32,0xb7,0x32,0xb9,0x30, - 0xba,0x32,0x32,0x14,0x1c,0xb8,0xb7,0xb9,0x34,0xba,0xb4,0x37,0x37,0x22,0x3b,0x99, - 0x2f,0xb3,0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x64,0x40, - 0xc8,0x00,0x29,0x83,0x64,0x48,0x04,0xc4,0x0c,0x90,0x0b,0xc1,0x90,0x0c,0x39,0x03, - 0x6a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x39,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x44,0x76,0x32,0x5f,0x66,0x29,0x4c,0xe8,0xca,0xf0,0xc6, - 0xde,0xde,0xe4,0xc8,0x60,0x86,0x50,0x89,0x80,0x90,0x01,0x52,0x06,0x89,0x90,0x08, - 0x48,0x1a,0x20,0x17,0x82,0x21,0x19,0xa2,0x06,0xbc,0xce,0xca,0xdc,0xca,0xe4,0xc2, - 0xe8,0xca,0xc8,0x50,0x6c,0xc6,0xde,0xd8,0xde,0xe4,0x60,0x88,0xec,0x68,0xbe,0xcc, - 0x52,0x68,0x8c,0xbd,0xb1,0xbd,0xc9,0xc1,0x0c,0xa1,0x92,0x02,0x21,0x03,0xa4,0x0c, - 0x92,0x22,0x11,0x10,0x36,0x40,0x2e,0xa4,0x43,0x32,0xa4,0x0d,0xa8,0x84,0xa5,0xc9, - 0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9,0xf1,0x09,0x4b,0x93,0x73,0x11,0xab,0x33,0x33, - 0x2b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x23,0x12,0x96,0x26,0xe7,0x22,0x57,0x16,0x46, - 0x46,0x2a,0x2c,0x4d,0xce,0x65,0x8e,0x4e,0xae,0x6e,0x8c,0xee,0x8b,0x2e,0x0f,0xae, - 0xec,0x2b,0xcd,0xcd,0xec,0x8d,0x09,0x59,0xda,0x1c,0xdc,0xd7,0x5c,0x9a,0x5e,0xd9, - 0x10,0x25,0x19,0x12,0x22,0x19,0x10,0x0c,0x99,0x03,0x46,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x73,0x69,0x7a,0x65,0xbc,0xc2,0xd2,0xe4, - 0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xc2,0xd8,0xd2,0xce,0xdc,0xbe, - 0xe6,0xd2,0xf4,0xca,0x98,0xd8,0xcd,0x7d,0xc1,0x85,0xc9,0x85,0xb5,0xcd,0x71,0xf8, - 0x92,0x99,0x19,0x42,0x06,0xc9,0x81,0xbc,0x01,0x02,0x07,0x09,0x81,0x94,0x41,0x32, - 0x24,0x02,0x12,0x07,0x88,0x1c,0x20,0x74,0x80,0xd4,0x41,0x42,0x20,0x76,0x90,0x10, - 0xc8,0x85,0xdc,0x01,0x92,0x21,0x78,0x30,0x04,0x41,0xd0,0x00,0x59,0x03,0xc4,0x0d, - 0x90,0x3c,0x18,0x62,0x1c,0x00,0x32,0x06,0x88,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83, - 0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7, - 0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x40,0xfa,0x60,0x88, - 0x81,0xf0,0x01,0xe2,0x07,0x4b,0x30,0xc4,0x40,0xfe,0x00,0xf9,0x83,0x25,0x18,0x22, - 0x00,0xc9,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1, - 0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1, - 0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07, - 0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79, - 0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70, - 0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87, - 0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74, - 0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78, - 0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x86,0xc2,0x38,0x90,0x44, - 0x8d,0x50,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x81,0x1e,0xca,0x01, - 0x1f,0xa6,0x04,0x7b,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00, - 0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3, - 0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10, - 0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30, - 0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03, - 0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07, - 0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e, - 0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d, - 0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b, - 0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76, - 0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90, - 0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87, - 0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e, - 0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c, - 0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca, - 0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8, - 0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82, - 0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83, - 0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f, - 0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec, - 0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc, - 0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0, - 0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60, - 0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e, - 0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1, - 0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43, - 0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c, - 0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72, - 0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00, - 0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x24,0x00,0x00,0x00,0x13,0x04,0x41,0x2c, - 0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40,0x60,0x1c,0x73,0x10, - 0x83,0x00,0x41,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82,0xf0,0x2f,0x80,0x20, - 0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08,0x82,0x20,0x08,0x0e, - 0x33,0x00,0x24,0x73,0x10,0x18,0x76,0x59,0x34,0x33,0x00,0x04,0x63,0x04,0x20,0x08, - 0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00,0xe3,0x0d,0x0c,0x66, - 0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9,0x0c,0x32,0x04,0xcb, - 0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41,0x15,0xcc,0x36,0x04, - 0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x5b,0x86,0x20,0x00, - 0x85,0x2d,0x83,0x30,0x84,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x21,0x46,0x42,0x20,0x80,0x82,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3, + 0x2b,0x1b,0x62,0x24,0x01,0x22,0x24,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4, + 0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac, + 0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0x80,0x10, + 0x43,0x8c,0x24,0x48,0x86,0x44,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x41,0x8e, + 0x24,0x48,0x82,0x44,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56, + 0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56, + 0x36,0x44,0x40,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65, + 0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c, + 0x65,0x43,0x04,0x64,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1, + 0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95, + 0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x90,0x86,0x51,0x58, + 0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d, + 0x97,0xba,0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72, + 0x2e,0x61,0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc, + 0xd8,0xde,0xc2,0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85, + 0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2,0x20,0x0f,0x02,0x21,0x11,0x22,0x21,0x13,0x42, + 0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6,0xf6, + 0x16,0x46,0x47,0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08,0x83,0x3c,0x88,0x85,0x44, + 0xc8,0x85,0x4c,0x08,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e,0xed, + 0xcd,0x8d,0xcb,0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10,0x05, + 0xd1,0x90,0x08,0xb9,0x90,0x09,0xd9,0x86,0x18,0x48,0x85,0x64,0x08,0x47,0x28,0x2c, + 0x4d,0xce,0xc5,0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52, + 0x58,0x9a,0x9c,0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59, + 0x19,0x1e,0xbd,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0xaf,0xaf,0xb0, + 0x34,0xb9,0x2f,0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf,0xaf, + 0x14,0x22,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x44,0x40,0x3c,0xe4, + 0x4b,0x84,0x24,0x40,0xc0,0x00,0x89,0x10,0x09,0x99,0x90,0x30,0x60,0x42,0x57,0x86, + 0x37,0xf6,0xf6,0x26,0x47,0x06,0x33,0x84,0x4a,0x02,0xc4,0x43,0xbe,0x24,0x48,0x02, + 0x04,0x0c,0x90,0x08,0x91,0x90,0x09,0x19,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x43,0xa8,0x84,0x40,0x3c,0xe4,0x4b,0x88,0x24,0x40,0xc0,0x00,0x89,0x90,0x0b,0x99, + 0x90,0x32,0xa0,0x12,0x96,0x26,0xe7,0x22,0x56,0x67,0x66,0x56,0x26,0xc7,0x27,0x2c, + 0x4d,0xce,0x45,0xac,0xce,0xcc,0xac,0x4c,0xee,0x6b,0x2e,0x4d,0xaf,0x8c,0x48,0x58, + 0x9a,0x9c,0x8b,0x5c,0x59,0x18,0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba, + 0x31,0xba,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3,0x37,0x26,0x64,0x69,0x73, + 0x70,0x5f,0x73,0x69,0x7a,0x65,0x43,0x94,0x44,0x48,0x86,0x44,0x40,0x24,0x64,0x0d, + 0x18,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0xcd,0xa5, + 0xe9,0x95,0xf1,0x0a,0x4b,0x93,0x73,0x09,0x93,0x3b,0xfb,0xa2,0xcb,0x83,0x2b,0xfb, + 0x0a,0x63,0x4b,0x3b,0x73,0xfb,0x9a,0x4b,0xd3,0x2b,0x63,0x62,0x37,0xf7,0x05,0x17, + 0x26,0x17,0xd6,0x36,0xc7,0xe1,0x4b,0x46,0x66,0x08,0x19,0x24,0x06,0x72,0x06,0x08, + 0x1a,0x24,0x03,0xf2,0x25,0x42,0x12,0x20,0x69,0x80,0xa8,0x01,0xc2,0x06,0x48,0x1b, + 0x24,0x03,0xe2,0x06,0xc9,0x80,0x44,0xc8,0x1b,0x20,0x13,0x02,0x07,0x43,0x10,0x44, + 0x0c,0x10,0x32,0x40,0xcc,0x00,0x89,0x83,0x21,0xc6,0x01,0x20,0x1d,0x22,0x07,0x7c, + 0xde,0xda,0xdc,0xd2,0xe0,0xde,0xe8,0xca,0xdc,0xe8,0x40,0xc6,0xd0,0xc2,0xe4,0xf8, + 0x4c,0xa5,0xb5,0xc1,0xb1,0x95,0x81,0x0c,0xad,0xac,0x80,0x50,0x09,0x05,0x05,0x0d, + 0x11,0x90,0x3a,0x18,0x62,0x20,0x74,0x80,0xd8,0xc1,0x72,0x0c,0x31,0x90,0x3b,0x40, + 0xee,0x60,0x39,0x46,0x44,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0xd0,0x0e,0xef,0x40, + 0x0e,0xf5,0xc0,0x0e,0xe5,0xe0,0x06,0xe6,0xc0,0x0e,0xe1,0x70,0x0e,0xf3,0x30,0x45, + 0x08,0x86,0x11,0x0a,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xa4,0x03,0x39,0x94,0x83, + 0x3b,0xd0,0xc3,0x94,0xa0,0x18,0xb1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39, + 0xc8,0xc3,0x3c,0xa4,0xc3,0x3b,0xb8,0xc3,0x94,0xc0,0x18,0x41,0x85,0x43,0x3a,0xc8, + 0x83,0x1b,0xb0,0x43,0x38,0xb8,0xc3,0x39,0xd4,0x43,0x38,0x9c,0x43,0x39,0xfc,0x82, + 0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x4c,0x09,0x90,0x11,0x53,0x38, + 0xa4,0x83,0x3c,0xb8,0xc1,0x38,0xbc,0x43,0x3b,0xc0,0x43,0x3a,0xb0,0x43,0x39,0xfc, + 0xc2,0x3b,0xc0,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x3c,0x4c,0x19,0x14,0xc6,0x19, + 0xa1,0x84,0x43,0x3a,0xc8,0x83,0x1b,0xd8,0x43,0x39,0xc8,0x03,0x3d,0x94,0x03,0x3e, + 0x4c,0x09,0xe6,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c, + 0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07, + 0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e, + 0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43, + 0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c, + 0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76, + 0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e, + 0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8, + 0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4, + 0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68, + 0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07, + 0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71, + 0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5, + 0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4, + 0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90, + 0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43, + 0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b, + 0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78, + 0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2, + 0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20, + 0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0, + 0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83, + 0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07, + 0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61, + 0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d, + 0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39, + 0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79, + 0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3, + 0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4, + 0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8, + 0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83, + 0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, + 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x23,0x00,0x00,0x00, + 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0xd4,0x63,0x11,0x40, + 0x60,0x1c,0x73,0x10,0x42,0xf0,0x3c,0x94,0x33,0x00,0x14,0x63,0x09,0x20,0x08,0x82, + 0xf0,0x2f,0x80,0x20,0x08,0xc2,0xbf,0x30,0x96,0x00,0x82,0x20,0x08,0x82,0x01,0x08, + 0x82,0x20,0x08,0x0e,0x33,0x00,0x24,0x73,0x10,0xd7,0x65,0x55,0x34,0x33,0x00,0x04, + 0x63,0x04,0x20,0x08,0x82,0xf8,0x37,0x46,0x00,0x82,0x20,0x08,0x7f,0x33,0x00,0x00, + 0xe3,0x0d,0x4c,0x64,0x51,0x40,0x2c,0x0a,0xe8,0x63,0xc1,0x02,0x1f,0x0b,0x16,0xf9, + 0x0c,0x32,0x04,0xcb,0x33,0xc8,0x10,0x2c,0xd1,0x6c,0xc3,0x52,0x01,0xb3,0x0d,0x41, + 0x15,0xcc,0x36,0x04,0x83,0x90,0x41,0x40,0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x5b,0x86,0x20,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _snk_fs_bytecode_metal_ios[2893] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x4d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _snk_fs_bytecode_metal_ios[2809] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf9,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xe9,0x4a,0xc6,0xd1,0xba,0x33,0x39, - 0x67,0xdf,0xcd,0xe3,0x58,0xde,0xd4,0xb8,0x81,0x4c,0x26,0x44,0xbc,0x9d,0x14,0xdc, - 0xa9,0x02,0x93,0x08,0x5a,0xcd,0x66,0x1c,0x30,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xf0,0xa4,0xb3,0x95,0x4b,0xab,0x64, + 0x94,0xe7,0xa9,0x8a,0x69,0x27,0x6d,0x28,0x77,0x84,0x8d,0x3f,0xaf,0x7d,0x3c,0x39, + 0x31,0xc4,0xcb,0x53,0x6d,0xc0,0x0d,0xdf,0x08,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x58,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x93,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87, - 0x70,0x30,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74, - 0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e, - 0xde,0xc1,0x1c,0xe8,0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81, - 0x00,0x16,0xa0,0xda,0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5, - 0x06,0xa3,0x08,0x80,0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00, - 0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00, - 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, - 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, - 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x70,0x90,0x34,0x45, - 0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2,0x30,0x82,0x00,0x1c, - 0x25,0x4d,0x11,0x25,0x4c,0xfe,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0xff,0x34, - 0x46,0x00,0x0c,0x22,0x10,0xc1,0x45,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x12,0xc0,0x3c, - 0x0b,0x11,0xfd,0xd3,0x18,0x01,0x30,0x88,0x60,0x08,0xa5,0x10,0x23,0x94,0x43,0x68, - 0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x28,0x67,0x28,0xa6,0x00, - 0xb5,0x81,0x80,0x14,0x58,0x23,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x04,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x7e,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, + 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, + 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, + 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, + 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1d,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x30,0x8c,0x20,0x00,0x47,0x49, + 0x53,0x44,0x09,0x93,0xff,0x4f,0xc4,0x35,0x51,0x11,0xf1,0xdb,0xc3,0x3f,0x8d,0x11, + 0x00,0x83,0x08,0x44,0x70,0x91,0x34,0x45,0x94,0x30,0xf9,0xbf,0x04,0x30,0xcf,0x42, + 0x44,0xff,0x34,0x46,0x00,0x0c,0x22,0x18,0x42,0x29,0xc4,0x08,0xe5,0x10,0x9a,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0xca,0x19,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0, 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87, 0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51,0x0e,0x6d,0x00,0x0f, 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9, @@ -1120,63 +1103,55 @@ static const uint8_t _snk_fs_bytecode_metal_ios[2893] = { 0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98, 0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03,0x04,0x80,0x00,0x00, 0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98, - 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x23,0x00,0x25, - 0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0xa1,0x29,0x00,0x00,0x79,0x18,0x00, - 0x00,0xd9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, + 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, + 0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0x01,0x12,0x00,0x00,0x79,0x18,0x00, + 0x00,0xb9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, 0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b, - 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc3,0x23,0x2c,0x05,0xd9,0x20,0x08, - 0x0e,0x8e,0xad,0x0c,0x84,0x89,0xc9,0xaa,0x09,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd, - 0x0d,0x64,0x26,0x07,0x46,0xc6,0xc5,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd, - 0xac,0xac,0x65,0x26,0x07,0x46,0xc6,0xc5,0xe6,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c, - 0x65,0x58,0x8c,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x65,0x58, - 0x84,0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42, - 0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66, - 0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43, - 0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9, - 0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d, - 0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x61,0x10,0x96,0x26, - 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0xe2,0x16,0x46,0x97,0x66,0x57,0xf6, - 0x45,0xf6,0x56,0x27,0xc6,0x56,0xf6,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44, - 0x78,0x1e,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b, - 0x5b,0x18,0x5d,0x9a,0x5d,0xd9,0x17,0xdb,0x9b,0xdb,0xd9,0x17,0xdb,0x9b,0xdb,0xd9, - 0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0xe1,0x89,0x78,0x06,0x61,0x69,0x72, - 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f, - 0x77,0x69,0x64,0x65,0x5f,0x76,0x65,0x63,0x74,0x6f,0x72,0x73,0x5f,0x64,0x69,0x73, - 0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x62,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46, - 0x56,0x26,0xf7,0x45,0x17,0x26,0x77,0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c, - 0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b, - 0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32, - 0x2a,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43,0x98,0xa7,0x5a,0x84, - 0xc7,0x7a,0xae,0x07,0x7b,0xb2,0x21,0xc2,0xa3,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93, - 0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57, - 0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc, - 0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18, - 0x5d,0x9a,0x5d,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x19,0x0a,0x75,0x76,0x43,0xa4, - 0x45,0x78,0xb8,0xa7,0x7b,0xbc,0xe7,0x7b,0xac,0x07,0x0c,0x1e,0xec,0x09,0x03,0x2e, - 0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x2c,0xc6,0xde,0xd8,0xde, - 0xe4,0x86,0x48,0xcb,0xf0,0x70,0xcf,0x18,0x3c,0xde,0xf3,0x3d,0xd6,0x73,0x3d,0xd8, - 0x43,0x06,0x5c,0xc2,0xd2,0xe4,0x5c,0xe8,0xca,0xf0,0xe8,0xea,0xe4,0xca,0x28,0x85, - 0xa5,0xc9,0xb9,0xb0,0xbd,0x8d,0x85,0xd1,0xa5,0xbd,0xb9,0x7d,0xa5,0xb9,0x91,0x95, - 0xe1,0x51,0x09,0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x23,0x46,0x57,0x86, - 0x47,0x57,0x27,0x57,0x26,0x43,0xc6,0x63,0xc6,0xf6,0x16,0x46,0xc7,0x02,0x32,0x17, - 0xd6,0x06,0xc7,0x56,0xe6,0xc3,0x81,0xae,0x0c,0x6f,0x08,0xb5,0x10,0x8f,0x19,0x3c, - 0x67,0xb0,0x08,0xcb,0xf0,0xa0,0xc1,0x63,0x3d,0x69,0xf0,0x60,0x8f,0x1a,0x70,0x09, - 0x4b,0x93,0x73,0x99,0x0b,0x6b,0x83,0x63,0x2b,0x93,0xe3,0x31,0x17,0xd6,0x06,0xc7, - 0x56,0x26,0x47,0x84,0xae,0x0c,0x6f,0xaa,0x0d,0x8e,0x4d,0x6e,0x88,0xb4,0x1c,0x0f, - 0x1b,0x3c,0x67,0xb0,0x08,0xcb,0xf0,0x58,0x4f,0x1b,0x3c,0xd8,0xe3,0x06,0x43,0x90, - 0x47,0x0c,0x9e,0x32,0x78,0xd6,0xe0,0x79,0x83,0x21,0x46,0x02,0x3c,0xdb,0x03,0x07, - 0x23,0x22,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77,0x20,0x87,0x7a,0x60, - 0x87,0x72,0x70,0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98,0x22,0x04,0xc3,0x08, - 0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d,0xe8,0x61, - 0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x61,0x1e, - 0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xd8, - 0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e,0xca,0x41, - 0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2,0x41,0x1e, - 0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1,0x1d,0xe0, - 0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x18,0x0a,0xe3,0x40,0x12,0x35,0x82, - 0x09,0x87,0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70, - 0x07,0x7a,0x98,0x12,0xc4,0x01,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00, + 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08, + 0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed, + 0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c, + 0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45, + 0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17, + 0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6, + 0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96, + 0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f, + 0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f, + 0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84,0xa5,0xc9,0xb9,0x8c, + 0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99, + 0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85,0x89,0xb1,0x95,0x0d, + 0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d, + 0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c, + 0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2, + 0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d, + 0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9, + 0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc, + 0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb, + 0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e, + 0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34, + 0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x96,0xe1,0xb1,0x9e,0xeb, + 0xc1,0x9e,0xec,0x81,0x1e,0xed,0x91,0x9e,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb, + 0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21,0xd2,0x22,0x3c,0xd6, + 0xd3,0x3d,0xd8,0x93,0x3d,0xd0,0x13,0x3d,0xd2,0xe3,0x71,0x09,0x4b,0x93,0x73,0xa1, + 0x2b,0xc3,0xa3,0xab,0x93,0x2b,0xa3,0x14,0x96,0x26,0xe7,0xc2,0xf6,0x36,0x16,0x46, + 0x97,0xf6,0xe6,0xf6,0x95,0xe6,0x46,0x56,0x86,0x47,0x25,0x2c,0x4d,0xce,0x65,0x2e, + 0xac,0x0d,0x8e,0xad,0x8c,0x18,0x5d,0x19,0x1e,0x5d,0x9d,0x5c,0x99,0x0c,0x19,0x8f, + 0x19,0xdb,0x5b,0x18,0x1d,0x0b,0xc8,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x0f,0x07,0xba, + 0x32,0xbc,0x21,0xd4,0x42,0x3c,0x60,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x23,0x06,0x0f, + 0xf4,0x8c,0xc1,0x23,0x3d,0x64,0xc0,0x25,0x2c,0x4d,0xce,0x65,0x2e,0xac,0x0d,0x8e, + 0xad,0x4c,0x8e,0xc7,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x87,0xb9,0x36,0xb8,0x21, + 0xd2,0x72,0x3c,0x66,0xf0,0x84,0xc1,0x32,0x2c,0xc2,0x03,0x3d,0x67,0xf0,0x48,0x0f, + 0x1a,0x0c,0x41,0x1e,0xee,0xf9,0x9e,0x32,0x78,0xd2,0x60,0x88,0x91,0x00,0x4f,0xf5, + 0xa8,0xc1,0x88,0x88,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xda,0xe1,0x1d,0xc8,0xa1, + 0x1e,0xd8,0xa1,0x1c,0xdc,0xc0,0x1c,0xd8,0x21,0x1c,0xce,0x61,0x1e,0xa6,0x08,0xc1, + 0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07, + 0x7a,0x98,0x12,0x14,0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79, + 0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x18,0x23,0xa8,0x70,0x48,0x07,0x79,0x70, + 0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87, + 0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x01,0x32,0x62,0x0a,0x87,0x74, + 0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78, + 0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x83,0xc2,0x38,0x23,0x98, + 0x70,0x48,0x07,0x79,0x70,0x03,0x73,0x90,0x87,0x70,0x38,0x87,0x76,0x28,0x07,0x77, + 0xa0,0x87,0x29,0xc1,0x1a,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00, 0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84, 0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed, 0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66, @@ -1204,15 +1179,19 @@ static const uint8_t _snk_fs_bytecode_metal_ios[2893] = { 0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0, 0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3, 0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07, - 0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01, - 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, - 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, - 0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00, - 0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4,0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00, - 0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91,0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6, - 0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23, + 0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59, + 0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b, + 0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00, + 0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, + 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, + 0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x0c,0x00,0x00,0x00,0x13,0x04,0x41, + 0x2c,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xc4,0x46,0x00,0x48,0x8d,0x00,0xd4, + 0x00,0x89,0x19,0x00,0x02,0x23,0x00,0x00,0x00,0x23,0x06,0x8a,0x10,0x44,0x87,0x91, + 0x0c,0x05,0x11,0x58,0x90,0xc8,0x67,0xb6,0x81,0x08,0x80,0x0c,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const char _snk_vs_source_metal_sim[720] = { +static const char _snk_vs_source_metal_sim[672] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1236,30 +1215,28 @@ static const char _snk_vs_source_metal_sim[720] = { 0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32, - 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31, - 0x35,0x20,0x22,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x33,0x20,0x5b,0x5b, - 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, - 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x35,0x20, - 0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28, - 0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2f,0x20, - 0x5f,0x32,0x33,0x2e,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x29,0x20,0x2d, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32,0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30, - 0x29,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c, - 0x69,0x6e,0x65,0x20,0x31,0x36,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, - 0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f, - 0x72,0x64,0x30,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x22, + 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61, + 0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32, + 0x32,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74, + 0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f, + 0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x20,0x2f,0x20,0x5f,0x32,0x32,0x2e,0x64,0x69,0x73,0x70, + 0x5f,0x73,0x69,0x7a,0x65,0x29,0x20,0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28, + 0x30,0x2e,0x35,0x29,0x29,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32, + 0x2e,0x30,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76, + 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + }; -static const char _snk_fs_source_metal_sim[470] = { +static const char _snk_fs_source_metal_sim[436] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1273,23 +1250,21 @@ static const char _snk_fs_source_metal_sim[470] = { 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x31,0x20,0x22,0x22,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b, - 0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f, - 0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31, - 0x31,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69, - 0x6e,0x2e,0x75,0x76,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65, + 0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65, + 0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d, + 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b, + 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e, + 0x75,0x76,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) static const uint8_t _snk_vs_bytecode_hlsl4[892] = { @@ -1641,8 +1616,7 @@ static void _snk_clipboard_paste(nk_handle usr, struct nk_text_edit *edit) { EM_JS(int, snk_js_is_osx, (void), { if (navigator.userAgent.includes('Macintosh')) { return 1; - } - else { + } else { return 0; } }); @@ -1670,11 +1644,10 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) _snuklear.is_osx = _snk_is_osx(); #endif - /* can keep color_format, depth_format and sample_count as is, - since sokol_gfx.h will do its own default-value handling - */ + // can keep color_format, depth_format and sample_count as is, + // since sokol_gfx.h will do its own default-value handling - /* initialize Nuklear */ + // initialize Nuklear nk_bool init_res = nk_init_default(&_snuklear.ctx, 0); SOKOL_ASSERT(1 == init_res); (void)init_res; // silence unused warning in release mode #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) @@ -1682,10 +1655,10 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { _snuklear.ctx.clip.paste = _snk_clipboard_paste; #endif - /* create sokol-gfx resources */ + // create sokol-gfx resources sg_push_debug_group("sokol-nuklear"); - /* Vertex Buffer */ + // vertex buffer _snuklear.vertex_buffer_size = (size_t)_snuklear.desc.max_vertices * sizeof(_snk_vertex_t); _snuklear.vbuf = sg_make_buffer(&(sg_buffer_desc){ .usage = SG_USAGE_STREAM, @@ -1693,7 +1666,7 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .label = "sokol-nuklear-vertices" }); - /* Index Buffer */ + // index buffer _snuklear.index_buffer_size = (size_t)_snuklear.desc.max_vertices * 3 * sizeof(uint16_t); _snuklear.ibuf = sg_make_buffer(&(sg_buffer_desc){ .type = SG_BUFFERTYPE_INDEXBUFFER, @@ -1702,7 +1675,7 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .label = "sokol-nuklear-indices" }); - /* Font Texture */ + // default font texture if (!_snuklear.desc.no_default_font) { nk_font_atlas_init_default(&_snuklear.atlas); nk_font_atlas_begin(&_snuklear.atlas); @@ -1713,10 +1686,6 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .width = font_width, .height = font_height, .pixel_format = SG_PIXELFORMAT_RGBA8, - .wrap_u = SG_WRAP_CLAMP_TO_EDGE, - .wrap_v = SG_WRAP_CLAMP_TO_EDGE, - .min_filter = SG_FILTER_LINEAR, - .mag_filter = SG_FILTER_LINEAR, .data.subimage[0][0] = { .ptr = pixels, .size = (size_t)(font_width * font_height) * sizeof(uint32_t) @@ -1730,7 +1699,15 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { } } - /* Shader */ + // default font sampler + _snuklear.smp = sg_make_sampler(&(sg_sampler_desc){ + .wrap_u = SG_WRAP_CLAMP_TO_EDGE, + .wrap_v = SG_WRAP_CLAMP_TO_EDGE, + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + }); + + // shader #if defined SOKOL_METAL const char* vs_entry = "main0"; const char* fs_entry = "main0"; @@ -1773,8 +1750,6 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { vs_source = _snk_vs_source_dummy; fs_source = _snk_fs_source_dummy; #endif - - /* Shader */ _snuklear.shd = sg_make_shader(&(sg_shader_desc){ .attrs = { [0] = { .name = "position", .sem_name = "TEXCOORD", .sem_index = 0 }, @@ -1800,12 +1775,14 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .bytecode = fs_bytecode, .entry = fs_entry, .d3d11_target = "ps_4_0", - .images[0] = { .name = "tex", .image_type = SG_IMAGETYPE_2D, .sampler_type = SG_SAMPLERTYPE_FLOAT }, + .images[0] = { .used = true, .image_type = SG_IMAGETYPE_2D, .sample_type = SG_IMAGESAMPLETYPE_FLOAT }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, + .image_sampler_pairs[0] = { .used = true, .glsl_name = "tex_smp", .image_slot = 0, .sampler_slot = 0 }, }, .label = "sokol-nuklear-shader" }); - /* Pipeline */ + // pipeline object _snuklear.pip = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .attrs = { @@ -1837,10 +1814,11 @@ SOKOL_API_IMPL void snk_shutdown(void) { nk_free(&_snuklear.ctx); nk_font_atlas_clear(&_snuklear.atlas); - /* NOTE: it's valid to call the destroy funcs with SG_INVALID_ID */ + // NOTE: it's valid to call the destroy funcs with SG_INVALID_ID sg_push_debug_group("sokol-nuklear"); sg_destroy_pipeline(_snuklear.pip); sg_destroy_shader(_snuklear.shd); + sg_destroy_sampler(_snuklear.smp); sg_destroy_image(_snuklear.img); sg_destroy_buffer(_snuklear.ibuf); sg_destroy_buffer(_snuklear.vbuf); @@ -1862,8 +1840,7 @@ SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { if (_snuklear.btn_down[i]) { _snuklear.btn_down[i] = false; nk_input_button(&_snuklear.ctx, (enum nk_buttons)i, _snuklear.mouse_pos[0], _snuklear.mouse_pos[1], 1); - } - else if (_snuklear.btn_up[i]) { + } else if (_snuklear.btn_up[i]) { _snuklear.btn_up[i] = false; nk_input_button(&_snuklear.ctx, (enum nk_buttons)i, _snuklear.mouse_pos[0], _snuklear.mouse_pos[1], 0); } @@ -1892,6 +1869,28 @@ SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { return &_snuklear.ctx; } +SOKOL_API_IMPL nk_handle snk_nkhandle(sg_image img, sg_sampler smp) { + return (nk_handle) { + .ptr = (void*)(uintptr_t)(((uint64_t)img.id << 32) | smp.id) + }; +} + +_SOKOL_PRIVATE uint32_t _snk_imageid_from_nkhandle(nk_handle h) { + uint32_t img_id = (uint32_t)(((uintptr_t)h.ptr) & 0xFFFFFFFF); + if (0 == img_id) { + img_id = _snuklear.img.id; + } + return img_id; +} + +_SOKOL_PRIVATE uint32_t _snk_samplerid_from_nkhandle(nk_handle h) { + uint32_t smp_id = (uint32_t)((((uintptr_t)h.ptr) >> 32) & 0xFFFFFFFF); + if (0 == smp_id) { + smp_id = _snuklear.smp.id; + } + return smp_id; +} + SOKOL_API_IMPL void snk_render(int width, int height) { static const struct nk_draw_vertex_layout_element vertex_layout[] = { {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct _snk_vertex_t, pos)}, @@ -1914,22 +1913,23 @@ SOKOL_API_IMPL void snk_render(int width, int height) { _snuklear.vs_params.disp_size[0] = (float)width; _snuklear.vs_params.disp_size[1] = (float)height; - /* Setup vert/index buffers and convert */ + // Setup vert/index buffers and convert struct nk_buffer cmds, verts, idx; nk_buffer_init_default(&cmds); nk_buffer_init_default(&verts); nk_buffer_init_default(&idx); nk_convert(&_snuklear.ctx, &cmds, &verts, &idx, &cfg); - /* Check for vertex- and index-buffer overflow, assert in debug-mode, - otherwise silently skip rendering - */ + // Check for vertex- and index-buffer overflow, assert in debug-mode, + // otherwise silently skip rendering const bool vertex_buffer_overflow = nk_buffer_total(&verts) > _snuklear.vertex_buffer_size; const bool index_buffer_overflow = nk_buffer_total(&idx) > _snuklear.index_buffer_size; SOKOL_ASSERT(!vertex_buffer_overflow && !index_buffer_overflow); if (!vertex_buffer_overflow && !index_buffer_overflow) { - /* Setup rendering */ + // Setup rendering + sg_update_buffer(_snuklear.vbuf, &(sg_range){ nk_buffer_memory_const(&verts), nk_buffer_total(&verts) }); + sg_update_buffer(_snuklear.ibuf, &(sg_range){ nk_buffer_memory_const(&idx), nk_buffer_total(&idx) }); const float dpi_scale = _snuklear.desc.dpi_scale; const int fb_width = (int)(_snuklear.vs_params.disp_size[0] * dpi_scale); const int fb_height = (int)(_snuklear.vs_params.disp_size[1] * dpi_scale); @@ -1937,23 +1937,15 @@ SOKOL_API_IMPL void snk_render(int width, int height) { sg_apply_scissor_rect(0, 0, fb_width, fb_height, true); sg_apply_pipeline(_snuklear.pip); sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &SG_RANGE(_snuklear.vs_params)); - sg_update_buffer(_snuklear.vbuf, &(sg_range){ nk_buffer_memory_const(&verts), nk_buffer_total(&verts) }); - sg_update_buffer(_snuklear.ibuf, &(sg_range){ nk_buffer_memory_const(&idx), nk_buffer_total(&idx) }); - /* Iterate through the command list, rendering each one */ + // Iterate through the command list, rendering each one const struct nk_draw_command* cmd = NULL; int idx_offset = 0; nk_draw_foreach(cmd, &_snuklear.ctx, &cmds) { if (cmd->elem_count > 0) { - sg_image img; - if (cmd->texture.id != 0) { - img = (sg_image){ .id = (uint32_t) cmd->texture.id }; - } - else { - img = _snuklear.img; - } sg_apply_bindings(&(sg_bindings){ - .fs_images[0] = img, + .fs.images[0].id = _snk_imageid_from_nkhandle(cmd->texture), + .fs.samplers[0].id = _snk_samplerid_from_nkhandle(cmd->texture), .vertex_buffers[0] = _snuklear.vbuf, .index_buffer = _snuklear.ibuf, .vertex_buffer_offsets[0] = 0, @@ -1971,7 +1963,7 @@ SOKOL_API_IMPL void snk_render(int width, int height) { sg_apply_scissor_rect(0, 0, fb_width, fb_height, true); } - /* Cleanup */ + // Cleanup nk_buffer_free(&cmds); nk_buffer_free(&verts); nk_buffer_free(&idx); @@ -1981,8 +1973,7 @@ SOKOL_API_IMPL void snk_render(int width, int height) { _SOKOL_PRIVATE bool _snk_is_ctrl(uint32_t modifiers) { if (_snuklear.is_osx) { return 0 != (modifiers & SAPP_MODIFIER_SUPER); - } - else { + } else { return 0 != (modifiers & SAPP_MODIFIER_CTRL); } } From 798975885f96fa6a1acba31a616a09c5d853400b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 19 Jun 2023 16:20:29 +0200 Subject: [PATCH 034/292] sokol_fontstash.h: fix for separate image/sampler (todo: hlsl/wgsl shaders) --- util/sokol_fontstash.h | 1624 +++++++++++++++++++--------------------- 1 file changed, 788 insertions(+), 836 deletions(-) diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 9bf406fc4..12181032b 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -282,7 +282,7 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui /* Embedded source code compiled with: - sokol-shdc -i sfons.glsl -o sfons.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b + sokol-shdc -i sfons.glsl -o sfons.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b (not that for Metal and D3D11 byte code, sokol-shdc must be run on macOS and Windows) @@ -307,12 +307,13 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; in vec4 uv; in vec4 color; out vec4 frag_color; void main() { - frag_color = vec4(1.0, 1.0, 1.0, texture(tex, uv.xy).r) * color; + frag_color = vec4(1.0, 1.0, 1.0, texture(sampler2D(tex, smp), uv.xy).r) * color; } @end @@ -350,20 +351,20 @@ static const char _sfons_vs_source_glsl330[478] = { 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20, 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char _sfons_fs_source_glsl330[195] = { +static const char _sfons_fs_source_glsl330[203] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, - 0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, - 0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x74, - 0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x2e,0x78, - 0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, + 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, + 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a, + 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76, + 0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e, + 0x30,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73, + 0x6d,0x70,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_GLES3) static const char _sfons_vs_source_glsl300es[481] = { @@ -399,388 +400,377 @@ static const char _sfons_vs_source_glsl300es[481] = { 0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; -static const char _sfons_fs_source_glsl300es[268] = { +static const char _sfons_fs_source_glsl300es[276] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x6c,0x61,0x79, - 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, - 0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20, - 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x69, - 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e, - 0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, - 0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x2e,0x78,0x29,0x20,0x2a, - 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, + 0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x75, + 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30, + 0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x2e, + 0x78,0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _sfons_vs_bytecode_metal_macos[3417] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x59,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x40,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sfons_vs_bytecode_metal_macos[3317] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf5,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x0a,0x16,0x9b,0x1c,0x17,0xd6,0x38, - 0xd5,0x49,0x10,0x98,0x04,0x66,0x15,0xf9,0x7e,0x49,0x87,0x6c,0x57,0x88,0x31,0x1d, - 0xab,0xb6,0x09,0x92,0x56,0xe2,0x6f,0x4d,0x48,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x76,0x25,0x5f,0x37,0x22,0xd0,0x3f, + 0x64,0xef,0xff,0xc3,0x45,0x1a,0x3d,0xb7,0x5e,0x83,0x13,0x96,0xd3,0x09,0xec,0x53, + 0x25,0xd5,0x7e,0x0c,0xed,0xb9,0x58,0x34,0x02,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03, - 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,0x80,0x56,0x41,0x54, + 0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, + 0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00, + 0x00,0xc4,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00, + 0x00,0xee,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00, + 0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84, + 0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b, + 0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90, + 0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8, + 0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x81,0x00,0x00, + 0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77, + 0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8, + 0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87, + 0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c, + 0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8, + 0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18, + 0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc, + 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21, + 0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e, + 0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06, + 0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77, + 0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68, + 0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87, + 0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d, + 0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca, + 0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36, + 0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0, + 0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6, + 0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61, + 0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07, + 0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, + 0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e, + 0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea, + 0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c, + 0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea, + 0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1, + 0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x18,0x42, + 0x01,0x2c,0x40,0x05,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40, + 0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85, + 0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a, + 0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04,0x60,0x89,0x10,0x02, + 0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2,0x50,0x0f,0xe3,0x40, + 0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0,0x07,0xed,0x10,0x0e, + 0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44,0x09,0x93,0x5f,0x49, + 0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28,0x86,0x08,0x23,0x80, + 0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80,0xc2,0x20,0x42,0x20, + 0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xb2,0x70,0x48,0x07,0x79,0xb0, + 0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68,0x83,0x76,0x08,0x87, + 0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83,0x38,0x70,0x03,0x38, + 0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0, + 0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x71,0x60,0x07, + 0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e,0x73,0x20,0x07,0x7a, + 0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76,0x40,0x07,0x7a,0x60, + 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0, + 0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07, + 0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73, + 0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, + 0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07, + 0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0, + 0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x72,0x50,0x07,0x76, + 0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x50, + 0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07, + 0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74, + 0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60, + 0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 0xc8,0x02,0x01,0x00,0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, + 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18, + 0x50,0x08,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x34, + 0x01,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x02,0x01,0x00,0x00,0x1a,0x03,0x4c, + 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32, + 0x28,0x00,0xb3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, + 0x2c,0x81,0x22,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, + 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25, + 0x58,0x90,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82, + 0x45,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, + 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50, + 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, + 0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04, + 0x65,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98, + 0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1, + 0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c, + 0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba, + 0xb9,0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61, + 0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde, + 0xc2,0xe8,0x68,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95, + 0x51,0xa8,0xb3,0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9, + 0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26, + 0x37,0x84,0x51,0x1e,0xc5,0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7, + 0x02,0xf7,0x36,0x97,0x46,0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e, + 0x8d,0x2e,0xed,0xcd,0x6d,0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2, + 0xd2,0xe4,0x5c,0xe0,0xde,0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1, + 0xbd,0x85,0xd1,0x91,0x39,0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b, + 0x1b,0xa2,0x28,0x9c,0x12,0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9, + 0x94,0x8f,0x50,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b, + 0x5c,0x1d,0x1d,0xa5,0xb0,0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7, + 0xaf,0x34,0x37,0xb2,0x32,0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64, + 0x28,0x5f,0x5f,0x61,0x69,0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64, + 0x65,0x72,0x5f,0x5f,0x29,0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50, + 0x8b,0xa0,0x84,0x81,0x22,0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93, + 0x42,0x06,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd, + 0xc9,0x91,0xc1,0x0c,0xa1,0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31, + 0x50,0x22,0xc5,0x0c,0x94,0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43, + 0xa8,0x65,0x50,0xc2,0x40,0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94, + 0x49,0x49,0x03,0x16,0x70,0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11, + 0x83,0xc5,0x58,0x02,0x65,0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69, + 0x72,0x2e,0x62,0x75,0x66,0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc, + 0xcc,0xca,0xe4,0xbe,0xe6,0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85, + 0x91,0x91,0x0a,0x4b,0x93,0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83, + 0x2b,0xfb,0x4a,0x73,0x33,0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3, + 0xa1,0xcd,0x0e,0x8e,0x02,0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50, + 0xe4,0x60,0x21,0x16,0x62,0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b, + 0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34, + 0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7, + 0xaf,0xb9,0x34,0xbd,0x32,0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c, + 0xbe,0x62,0x72,0x86,0x90,0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0, + 0x08,0x4b,0xa0,0xbc,0x81,0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c, + 0x89,0x12,0x29,0x77,0xa0,0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51, + 0x03,0x85,0x0d,0x94,0x3c,0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b, + 0x73,0x4b,0x83,0x7b,0xa3,0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95, + 0xd6,0x06,0xc7,0x56,0x06,0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50, + 0xfa,0x60,0x88,0xa1,0xf0,0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83, + 0x46,0x19,0x11,0xb1,0x03,0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4, + 0x03,0x3b,0x94,0x83,0x1b,0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18, + 0x46,0x28,0xec,0xc0,0x0e,0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40, + 0x0f,0x53,0x82,0x62,0xc4,0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f, + 0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e, + 0xc0,0x0e,0xe1,0xe0,0x0e,0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50, + 0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e, + 0xf2,0xe0,0x06,0xe3,0xf0,0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef, + 0x00,0x0f,0xf4,0x90,0x0e,0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12, + 0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25, + 0xd8,0x03,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, + 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, + 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, + 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, + 0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78, + 0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03, + 0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f, + 0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c, + 0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39, + 0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b, + 0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60, + 0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87, + 0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e, + 0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c, + 0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6, + 0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94, + 0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03, + 0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07, + 0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f, + 0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33, + 0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc, + 0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c, + 0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78, + 0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca, + 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21, + 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43, + 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87, + 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c, + 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e, + 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c, + 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c, + 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00, + 0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00, + 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22, + 0x86,0x61,0x18,0xc6,0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40, + 0x19,0x14,0x01,0xbd,0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00, + 0x00,0xe3,0x15,0x4b,0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9, + 0x8c,0x57,0x3c,0x55,0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63, + 0x41,0x01,0x9f,0xf1,0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43, + 0x99,0x10,0xc8,0xc7,0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50, + 0x06,0x19,0xbe,0x48,0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68, + 0x03,0x36,0x20,0x03,0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b, + 0xc4,0x00,0x0d,0xe2,0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42, + 0x20,0x1f,0x0b,0x0a,0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05, + 0xc5,0x86,0x00,0x3e,0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d, + 0xc1,0x23,0xcc,0x36,0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00, + 0x00,0x5b,0x86,0x20,0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61, + 0xcb,0xf0,0x04,0xa0,0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19, + 0xba,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, +}; +static const uint8_t _sfons_fs_bytecode_metal_macos[2857] = { + 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x29,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x50,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, + 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x38,0x3c,0x07,0x7d,0xe0,0x21,0x6b, + 0x04,0x03,0x36,0x12,0x1d,0xbc,0x24,0x12,0xc4,0x27,0xab,0xef,0x84,0x17,0xbe,0x12, + 0x8d,0xc7,0xbc,0x06,0xbc,0x98,0x53,0xdb,0x0b,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0x24,0x0c,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0x06,0x03,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x30,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x89,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, - 0x00,0x89,0x00,0x00,0x00,0x1b,0xf6,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80, - 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36, - 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0, - 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1, - 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e, - 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78, - 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08, - 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda, - 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81, - 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8, - 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87, - 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76, - 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30, - 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01, - 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c, - 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08, - 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36, - 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d, - 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca, - 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90, - 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07, - 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61, - 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e, - 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4, - 0xa1,0x1c,0x00,0x3c,0x00,0x08,0x7a,0x08,0x07,0x79,0x38,0x87,0x72,0xa0,0x87,0x36, - 0x30,0x87,0x72,0x08,0x07,0x7a,0xa8,0x07,0x79,0x28,0x87,0x79,0x00,0xda,0xc0,0x1c, - 0xe0,0x21,0x0e,0xec,0x00,0x20,0xea,0xc1,0x1d,0xe6,0x21,0x1c,0xcc,0xa1,0x1c,0xda, - 0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a, - 0x28,0x07,0x80,0xa8,0x87,0x79,0x28,0x87,0x36,0x98,0x87,0x77,0x30,0x07,0x7a,0x68, - 0x03,0x73,0x60,0x87,0x77,0x08,0x07,0x7a,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca, - 0x01,0xd8,0x60,0x08,0x05,0xb0,0x00,0x15,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00, - 0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x24,0x00,0x00,0x00,0x32,0x22,0x48, - 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, - 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x40,0x33,0x00,0xc3,0x08,0x04, - 0x70,0x97,0x34,0x45,0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x93,0xff,0x00, - 0x82,0x42,0x0c,0x98,0x08,0x21,0x80,0x61,0x04,0x01,0x48,0x82,0x30,0x13,0x35,0x0f, - 0xf4,0x20,0x0f,0xf5,0x30,0x0e,0xf4,0xe0,0x06,0xed,0x50,0x0e,0xf4,0x10,0x0e,0xec, - 0xa0,0x07,0x7a,0xd0,0x0e,0xe1,0x40,0x0f,0xf2,0x90,0x0e,0xf8,0x80,0x02,0x72,0x90, - 0x34,0x45,0x94,0x30,0xf9,0x95,0xf4,0x3f,0x40,0x04,0x30,0x12,0x12,0x4a,0x19,0x44, - 0x30,0x84,0x62,0x88,0x30,0x02,0x38,0x84,0x06,0x02,0xe6,0x08,0xc0,0x60,0x8e,0x00, - 0x14,0x06,0x11,0x02,0x61,0x18,0x81,0x58,0x46,0x00,0x00,0x00,0x00,0x13,0xb2,0x70, - 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, - 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83, - 0x38,0x70,0x03,0x38,0xd8,0xf0,0x1e,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78, - 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90, - 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e, - 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76, - 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x78,0x00,0x07,0x7a, - 0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x60, - 0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07, - 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a, - 0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60, - 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72, - 0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0, - 0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07, - 0x79,0x20,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d, - 0x60,0x0f,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50, - 0x07,0x76,0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07, - 0x7a,0x50,0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a, - 0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0x60, - 0x0e,0x78,0x00,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, - 0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49, - 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x09,0x00,0x00, - 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43, - 0x5a,0x25,0x30,0x02,0x50,0x80,0x01,0x85,0x50,0x04,0x65,0x50,0x80,0x02,0x05,0x51, - 0x20,0xc4,0x46,0x00,0x00,0x79,0x18,0x00,0x00,0x15,0x01,0x00,0x00,0x1a,0x03,0x4c, - 0x10,0x95,0xbb,0x31,0xb4,0x30,0xb9,0xaf,0xb9,0x34,0xbd,0xb2,0x21,0xc6,0x12,0x28, - 0xc0,0x42,0x70,0x0d,0x82,0xe0,0xe0,0xd8,0xca,0x40,0x98,0x98,0xac,0x9a,0x40,0xec, - 0xca,0xe4,0xe6,0xd2,0xde,0xdc,0x40,0x72,0x60,0x64,0x5c,0x62,0x40,0x50,0xda,0xca, - 0xe8,0xc2,0xd8,0xcc,0xca,0x5a,0x72,0x60,0x64,0x5c,0x62,0x5c,0x68,0x72,0x52,0x86, - 0x08,0x8a,0x30,0xc4,0x58,0x82,0x05,0x59,0x04,0x16,0x4d,0x65,0x74,0x61,0x6c,0x43, - 0x10,0xa5,0x58,0x82,0x25,0x58,0x04,0x6e,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70, - 0x69,0x6c,0x65,0x2e,0x64,0x65,0x6e,0x6f,0x72,0x6d,0x73,0x5f,0x64,0x69,0x73,0x61, - 0x62,0x6c,0x65,0x43,0x04,0xe5,0x20,0x17,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97, - 0xc6,0x56,0xe6,0x62,0x16,0x36,0x47,0xf7,0xd5,0x16,0x46,0x87,0xf6,0x55,0xe6,0x16, - 0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x96,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b, - 0x5c,0x1a,0x5b,0x99,0x8b,0x99,0x5c,0x58,0x5b,0x99,0x58,0x9d,0x99,0x59,0x99,0xdc, - 0x97,0x59,0x19,0xdd,0x18,0xda,0x17,0x59,0xda,0x5c,0x98,0x18,0x5b,0xd9,0x10,0x41, - 0x59,0x18,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e, - 0x61,0x74,0x69,0x76,0x65,0x5f,0x64,0x6f,0x75,0x62,0x6c,0x65,0x5f,0x64,0x69,0x73, - 0x61,0x62,0x6c,0x65,0x43,0x04,0xa5,0x61,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47, - 0x57,0x86,0xf7,0xf5,0x56,0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85, - 0xed,0x6d,0xcc,0x0d,0x26,0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d, - 0x1e,0x5c,0xd9,0x97,0x5b,0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x1a,0x32, - 0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86, - 0x30,0xca,0xa3,0x40,0x4a,0xa4,0x48,0xca,0xa4,0x50,0x5c,0xea,0xe6,0xca,0xe4,0x50, - 0xd8,0xde,0xc6,0xdc,0x62,0x52,0x58,0x8c,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x94,0x47, - 0xb1,0x94,0x48,0x91,0x94,0x49,0xb9,0xc8,0x84,0xa5,0xc9,0xb9,0xc0,0xbd,0xcd,0xa5, - 0xd1,0xa5,0xbd,0xb9,0x71,0x39,0x63,0xfb,0x82,0x7a,0x9b,0x4b,0xa3,0x4b,0x7b,0x73, - 0x1b,0xa2,0x28,0x99,0x12,0x29,0x92,0x32,0x29,0x1a,0x9d,0xb0,0x34,0x39,0x17,0xb8, - 0xb7,0x34,0x37,0xba,0xaf,0xb9,0x34,0xbd,0x32,0x16,0x66,0x6c,0x6f,0x61,0x74,0x64, - 0xce,0xd8,0xbe,0xa0,0xde,0xd2,0xdc,0xe8,0xa6,0xd2,0xf4,0xca,0x86,0x28,0x0a,0xa7, - 0x44,0x4a,0xa7,0x4c,0x8a,0x37,0x04,0x51,0x2a,0x05,0x53,0x36,0xe5,0x23,0x14,0x96, - 0x26,0xe7,0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0x95,0xe6,0x06,0x57,0x47,0x47,0x29, - 0x2c,0x4d,0xce,0x85,0xed,0x6d,0x2c,0x8c,0x2e,0xed,0xcd,0xed,0x2b,0xcd,0x8d,0xac, - 0x0c,0x8f,0xd9,0x59,0x99,0x5b,0x99,0x5c,0x18,0x5d,0x19,0x19,0x0a,0x0e,0xdc,0xdb, - 0x5c,0x1a,0x5d,0xda,0x9b,0x1b,0x91,0x1d,0xcd,0x97,0x59,0x0a,0x11,0xb8,0xb7,0xb9, - 0x34,0xba,0xb4,0x37,0xb7,0x21,0xd4,0x22,0x28,0x61,0xa0,0x88,0xc1,0x22,0x2c,0x81, - 0x32,0x06,0x4a,0xa4,0x48,0xca,0xa4,0x90,0x01,0xb5,0xb3,0x32,0xb7,0x32,0xb9,0x30, - 0xba,0x32,0x32,0x94,0x1c,0xba,0x32,0xbc,0xb1,0xb7,0x37,0x39,0x32,0x18,0x22,0x3b, - 0x99,0x2f,0xb3,0x14,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x4c,0xe8,0xca,0xf0,0xc6, - 0xde,0xde,0xe4,0xc8,0x60,0x86,0x50,0x4b,0xa0,0x84,0x81,0x22,0x06,0x4b,0xb0,0x04, - 0x8a,0x19,0x28,0x91,0x72,0x06,0xca,0xa4,0xa0,0x01,0xaf,0xb3,0x32,0xb7,0x32,0xb9, - 0x30,0xba,0x32,0x32,0x14,0x9b,0xb1,0x37,0xb6,0x37,0x39,0x18,0x22,0x3b,0x9a,0x2f, - 0xb3,0x14,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0xa5,0x50,0xc2,0x40,0x11, - 0x83,0xa5,0x58,0x02,0x45,0x0d,0x94,0x48,0x91,0x94,0x49,0x59,0x03,0x4a,0x67,0x65, - 0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x35,0x70,0x73,0x69,0x7a,0x65,0x66,0x29, - 0x2c,0xe0,0xe6,0xd2,0xf4,0xca,0x86,0x50,0x8b,0xa1,0x84,0x81,0x22,0x06,0x8b,0xb1, - 0x04,0x4a,0x1b,0x28,0x91,0xd2,0x29,0x93,0xe2,0x06,0x54,0xc2,0xd2,0xe4,0x5c,0xc4, - 0xea,0xcc,0xcc,0xca,0xe4,0xf8,0x84,0xa5,0xc9,0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9, - 0x7d,0xcd,0xa5,0xe9,0x95,0x11,0x09,0x4b,0x93,0x73,0x91,0x2b,0x0b,0x23,0x23,0x15, - 0x96,0x26,0xe7,0x32,0x47,0x27,0x57,0x37,0x46,0xf7,0x45,0x97,0x07,0x57,0xf6,0x95, - 0xe6,0x66,0xf6,0x46,0xc4,0x8c,0xed,0x2d,0x8c,0x8e,0x06,0x8f,0x86,0x43,0x9b,0x1d, - 0x1c,0x05,0xba,0xb6,0x21,0xd4,0x22,0x2c,0xc3,0x22,0x28,0x74,0xa0,0xd4,0xc1,0x32, - 0x2c,0xc3,0x22,0x28,0x74,0xa0,0xd8,0x01,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3, - 0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0xb9,0x34,0xbd,0x32,0x5e,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x61,0x6c,0x69,0x67,0x6e,0x5f,0x73,0x69, - 0x7a,0x65,0x4c,0xec,0xe6,0xbe,0xe0,0xc2,0xe4,0xc2,0xda,0xe6,0x38,0x7c,0xc9,0xc4, - 0x0c,0x21,0x83,0x85,0x50,0xe0,0x40,0x89,0x83,0xe5,0x50,0xc4,0x60,0x11,0x96,0x40, - 0x91,0x03,0x65,0x0e,0x94,0x3b,0x50,0xf0,0x60,0x39,0x94,0x3c,0x58,0x12,0x25,0x52, - 0xf4,0x40,0x99,0x94,0x3d,0x18,0xa2,0x28,0x65,0xa0,0xa4,0x81,0xc2,0x06,0xca,0x1b, - 0x28,0x7c,0x30,0xc4,0x48,0x00,0x05,0x0c,0x94,0x3e,0xe0,0xf3,0xd6,0xe6,0x96,0x06, - 0xf7,0x46,0x57,0xe6,0x46,0x07,0x32,0x86,0x16,0x26,0xc7,0x67,0x2a,0xad,0x0d,0x8e, - 0xad,0x0c,0x64,0x68,0x65,0x05,0x84,0x4a,0x28,0x28,0x68,0x88,0xa0,0x80,0xc2,0x10, - 0x43,0xf9,0x03,0x25,0x14,0x18,0x65,0x88,0xa1,0x88,0x82,0x22,0x0a,0x8c,0x32,0x22, - 0x62,0x07,0x76,0xb0,0x87,0x76,0x70,0x83,0x76,0x78,0x07,0x72,0xa8,0x07,0x76,0x28, - 0x07,0x37,0x30,0x07,0x76,0x08,0x87,0x73,0x98,0x87,0x29,0x41,0x30,0x42,0x61,0x07, - 0x76,0xb0,0x87,0x76,0x70,0x83,0x74,0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x0c, - 0x23,0x96,0x70,0x48,0x07,0x79,0x70,0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78, - 0x07,0x77,0x98,0x12,0x10,0x23,0xa8,0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07, - 0x77,0x38,0x87,0x7a,0x08,0x87,0x73,0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79, - 0x48,0x87,0x77,0x70,0x87,0x29,0x81,0x31,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18, - 0x87,0x77,0x68,0x07,0x78,0x48,0x07,0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87, - 0x74,0x78,0x07,0x77,0x98,0x87,0x29,0x04,0xa2,0x30,0xce,0x08,0x25,0x1c,0xd2,0x41, - 0x1e,0xdc,0xc0,0x1e,0xca,0x41,0x1e,0xe8,0xa1,0x1c,0xf0,0x61,0x4a,0xe0,0x07,0x00, - 0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, - 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, - 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, - 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83, - 0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07, - 0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70, - 0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3, - 0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2, - 0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc, - 0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68, - 0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07, - 0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72, - 0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec, - 0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc, - 0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8, - 0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03, - 0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c, - 0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74, - 0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4, - 0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc, - 0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1, - 0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50, - 0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51, - 0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21, - 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06, - 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c, - 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77, - 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00, - 0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00, - 0x00,0x3e,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00, - 0x00,0xe4,0xc6,0x22,0x86,0x61,0x18,0xc6,0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20, - 0x08,0x88,0x95,0x40,0x19,0x14,0x01,0xb9,0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00, - 0x28,0xcc,0x00,0x00,0x00,0xe3,0x15,0x0b,0x84,0x61,0x10,0x05,0x65,0x90,0x21,0x1a, - 0x0c,0x13,0x02,0xf9,0x8c,0x57,0x3c,0x14,0xc7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70, - 0x4c,0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1,0x0a,0x2a,0x0b,0x83,0x30,0x70,0x28,0x28, - 0x83,0x0c,0x1a,0x43,0x99,0x10,0xc8,0xc7,0x8a,0x00,0x3e,0xe3,0x15,0x99,0x67,0x06, - 0x66,0x40,0x51,0x50,0x06,0x19,0xbe,0x48,0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6, - 0x2b,0xbc,0x31,0x60,0x83,0x35,0x18,0x03,0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09, - 0x81,0x7c,0xc6,0x2b,0xc4,0xe0,0x0c,0xe0,0xe0,0x0d,0x3c,0x0a,0xca,0x20,0xc3,0x19, - 0x70,0x61,0x60,0x42,0x20,0x1f,0x0b,0x0a,0xf8,0x8c,0x57,0x9c,0x01,0x1b,0xd4,0x01, - 0x1d,0x88,0x01,0x05,0xc5,0x86,0x00,0x3e,0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41, - 0x1b,0x04,0xb3,0x0d,0xc1,0x23,0xcc,0x36,0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00, - 0x00,0x09,0x00,0x00,0x00,0x5b,0x86,0x20,0x18,0x85,0x2d,0x43,0x11,0x8c,0xc2,0x96, - 0x41,0x09,0x46,0x61,0xcb,0xf0,0x04,0xa3,0xb0,0x65,0xa0,0x82,0x51,0xd8,0x32,0x60, - 0xc1,0x28,0x6c,0x19,0xba,0x60,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -static const uint8_t _sfons_fs_bytecode_metal_macos[2893] = { - 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x4d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x70,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, - 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xb6,0x8b,0xa9,0x7e,0x5a,0xee,0x89, - 0x6e,0x6c,0x22,0x2c,0x4b,0xad,0x03,0xda,0xe6,0xd7,0x2e,0x88,0x05,0x1f,0x44,0x92, - 0x88,0x08,0xa6,0x2c,0x57,0xb7,0x10,0x8a,0x6e,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x54,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x92,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x92,0x00,0x00,0x00,0x1b,0xfa,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa0,0x87,0x70,0x90,0x87, - 0x73,0x28,0x07,0x7a,0x68,0x03,0x73,0x28,0x87,0x70,0xa0,0x87,0x7a,0x90,0x87,0x72, - 0x98,0x07,0xa0,0x0d,0xcc,0x01,0x1e,0xe2,0xc0,0x0e,0x00,0xa2,0x1e,0xdc,0x61,0x1e, - 0xc2,0xc1,0x1c,0xca,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81,0x1e,0xd0, - 0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x88,0x7a,0x98,0x87,0x72,0x68,0x83,0x79, - 0x78,0x07,0x73,0xa0,0x87,0x36,0x30,0x07,0x76,0x78,0x87,0x70,0xa0,0x07,0xc0,0x1c, - 0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x80,0x0d,0x86,0x30,0x00,0x0b,0x50,0x6d,0x30,0x06, - 0x02,0x58,0x80,0x6a,0x03,0x42,0xfc,0xff,0xff,0xff,0xff,0x00,0x30,0x80,0x04,0x54, - 0x1b,0x8c,0x22,0x00,0x16,0xa0,0xda,0x60,0x18,0x02,0xb0,0x00,0x15,0x00,0x00,0x00, - 0x00,0x49,0x18,0x00,0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44, - 0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48, - 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, - 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04, - 0x70,0x90,0x34,0x45,0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2, - 0x51,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x13,0x71,0x4d,0x54,0x44,0xfc,0xf6,0xf0,0x4f, - 0x63,0x04,0xc0,0x20,0xc2,0x10,0x5c,0x24,0x4d,0x11,0x25,0x4c,0xfe,0x2f,0x01,0xcc, - 0xb3,0x10,0xd1,0x3f,0x8d,0x11,0x00,0x83,0x08,0x85,0x50,0x0a,0x11,0x02,0x31,0x74, - 0x86,0x11,0x04,0x60,0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x20, - 0x26,0x29,0xa6,0x00,0xb5,0x81,0x80,0x61,0x04,0x62,0x19,0x01,0x00,0x13,0xb2,0x70, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1e,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,0x34,0x45,0x94,0x30, + 0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,0x01,0x30,0x88,0x30, + 0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,0x44,0xf4,0x4f,0x63, + 0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,0x04,0x01,0x98,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x30,0x02,0xb1,0x8c,0x00,0x00,0x00,0x00,0x00,0x13,0xb2,0x70, 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, 0x83,0x76,0x08,0x87,0x71,0x78,0x87,0x79,0xc0,0x87,0x38,0x80,0x03,0x37,0x88,0x83, - 0x38,0x70,0x03,0x38,0xd8,0xf0,0x1e,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, + 0x38,0x70,0x03,0x38,0xd8,0x70,0x1b,0xe5,0xd0,0x06,0xf0,0xa0,0x07,0x76,0x40,0x07, 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x90,0x0e,0x71,0xa0,0x07,0x78, 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x80,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90, 0x0e,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x90,0x0e, 0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x90,0x0e,0x76, 0x40,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x73,0x20, 0x07,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0e,0x76,0x40,0x07, - 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0e,0x78,0x00,0x07,0x7a, - 0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x60, - 0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07, - 0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a, - 0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60, - 0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72, - 0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0, - 0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07, - 0x79,0x20,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d, - 0x60,0x0f,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50, - 0x07,0x76,0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07, - 0x7a,0x50,0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a, - 0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0x60, - 0x0e,0x78,0x00,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, - 0x6d,0xe0,0x0e,0x78,0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x41, - 0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00, - 0x00,0x00,0x00,0x64,0x81,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x32,0x1e,0x98, - 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, - 0x50,0x08,0x05,0x51,0x04,0x65,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xbb,0x00,0x00, - 0x00,0x1a,0x03,0x4c,0x10,0x95,0xbb,0x31,0xb4,0x30,0xb9,0xaf,0xb9,0x34,0xbd,0xb2, - 0x21,0xc6,0x22,0x3c,0xc0,0x42,0x70,0x0d,0x82,0xe0,0xe0,0xd8,0xca,0x40,0x98,0x98, - 0xac,0x9a,0x40,0xec,0xca,0xe4,0xe6,0xd2,0xde,0xdc,0x40,0x72,0x60,0x64,0x5c,0x62, - 0x40,0x50,0xda,0xca,0xe8,0xc2,0xd8,0xcc,0xca,0x5a,0x72,0x60,0x64,0x5c,0x62,0x5c, - 0x68,0x72,0x52,0x86,0x08,0x8f,0x30,0xc4,0x58,0x84,0xa5,0x58,0x06,0x16,0x4d,0x65, - 0x74,0x61,0x6c,0x43,0x90,0xa7,0x58,0x84,0x45,0x58,0x06,0x6e,0x61,0x69,0x72,0x2e, - 0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x64,0x65,0x6e,0x6f,0x72,0x6d,0x73,0x5f, - 0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x84,0xe7,0x20,0x17,0x96,0x26,0xe7,0x32, - 0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x62,0x16,0x36,0x47,0xf7,0xd5,0x16,0x46,0x87, - 0xf6,0x55,0xe6,0x16,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x96,0x41,0x58,0x9a,0x9c, - 0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99,0x8b,0x99,0x5c,0x58,0x5b,0x99,0x58,0x9d, - 0x99,0x59,0x99,0xdc,0x97,0x59,0x19,0xdd,0x18,0xda,0x17,0x59,0xda,0x5c,0x98,0x18, - 0x5b,0xd9,0x10,0xe1,0x59,0x18,0x06,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69, - 0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65,0x5f,0x64,0x6f,0x75,0x62,0x6c,0x65, - 0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43,0x84,0xa7,0x61,0x14,0x96,0x26,0xe7, - 0x22,0x57,0xe6,0x46,0x56,0x26,0xf7,0x45,0x17,0x26,0x77,0x56,0x46,0xc7,0x28,0x2c, - 0x4d,0xce,0x25,0x4c,0xee,0xec,0x8b,0x2e,0x0f,0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c, - 0x86,0x19,0xdb,0x5b,0x18,0x1d,0x0d,0x99,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f, - 0xb7,0xb0,0xb6,0x32,0x2a,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43, - 0x98,0xe7,0x59,0x86,0x07,0x7a,0xa2,0x47,0x7a,0xa6,0x21,0xc2,0x43,0x51,0x0a,0x4b, - 0x93,0x73,0x31,0x93,0x0b,0x3b,0x6b,0x2b,0x73,0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3, - 0xe3,0x52,0x37,0x57,0x26,0x87,0xc2,0xf6,0x36,0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d, - 0xce,0x65,0xac,0xcc,0x8d,0xae,0x4c,0x8e,0x4f,0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc, - 0x1c,0x5c,0xd9,0x18,0x5d,0x9a,0x5d,0x19,0x85,0x3a,0xbb,0x21,0xd2,0x32,0x3c,0xd6, - 0x73,0x3d,0xd8,0x93,0x3d,0xd0,0x13,0x3d,0xd2,0xa3,0x71,0xa9,0x9b,0x2b,0x93,0x43, - 0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26,0x37,0x44,0x5a,0x84, - 0xc7,0x7a,0xb8,0x07,0x7b,0xb2,0x07,0x7a,0xa2,0x47,0x7a,0x3a,0x2e,0x61,0x69,0x72, - 0x2e,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x94,0xc2,0xd2,0xe4,0x5c,0xd8,0xde,0xc6, - 0xc2,0xe8,0xd2,0xde,0xdc,0xbe,0xd2,0xdc,0xc8,0xca,0xf0,0xa8,0x84,0xa5,0xc9,0xb9, - 0xcc,0x85,0xb5,0xc1,0xb1,0x95,0x11,0xa3,0x2b,0xc3,0xa3,0xab,0x93,0x2b,0x93,0x21, - 0xe3,0x31,0x63,0x7b,0x0b,0xa3,0x63,0x01,0x99,0x0b,0x6b,0x83,0x63,0x2b,0xf3,0xe1, - 0x40,0x57,0x86,0x37,0x84,0x5a,0x8c,0xe7,0x7b,0xc0,0x60,0x19,0x16,0xe1,0x09,0x83, - 0x07,0x7a,0xc4,0xe0,0x91,0x9e,0x31,0xe0,0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06, - 0xc7,0x56,0x26,0xc7,0x63,0x2e,0xac,0x0d,0x8e,0xad,0x4c,0x8e,0x08,0x5d,0x19,0xde, - 0x54,0x1b,0x1c,0x9b,0xdc,0x10,0x69,0x39,0x9e,0x32,0x78,0xc0,0x60,0x19,0x16,0xe1, - 0x81,0x1e,0x33,0x78,0xa4,0xe7,0x0c,0x86,0x20,0xcf,0xf6,0x78,0x0f,0x19,0x3c,0x68, - 0x30,0xc4,0x40,0x80,0xa7,0x7a,0xd2,0x60,0x44,0xc4,0x0e,0xec,0x60,0x0f,0xed,0xe0, - 0x06,0xed,0xf0,0x0e,0xe4,0x50,0x0f,0xec,0x50,0x0e,0x6e,0x60,0x0e,0xec,0x10,0x0e, - 0xe7,0x30,0x0f,0x53,0x82,0x60,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9, - 0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x18,0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0, - 0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x20,0x46,0x50, + 0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x71,0x60,0x07,0x7a, + 0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x6d,0x60,0x0f,0x72,0x40,0x07,0x7a,0x30, + 0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x73,0x20,0x07,0x7a,0x30,0x07, + 0x72,0xa0,0x07,0x73,0x20,0x07,0x6d,0x60,0x0f,0x74,0x80,0x07,0x7a,0x60,0x07,0x74, + 0xa0,0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xa0, + 0x07,0x76,0x40,0x07,0x6d,0x60,0x0f,0x79,0x60,0x07,0x7a,0x10,0x07,0x72,0x80,0x07, + 0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x20,0x07,0x78,0xa0,0x07,0x71, + 0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x79,0x20, + 0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f, + 0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76, + 0xd0,0x06,0xf6,0x50,0x07,0x71,0x20,0x07,0x7a,0x50,0x07,0x71,0x20,0x07,0x7a,0x50, + 0x07,0x71,0x20,0x07,0x6d,0x60,0x0f,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, + 0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x6d,0xe0,0x0e,0x78, + 0xa0,0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x41,0x00,0x00,0x08,0x00, + 0x00,0x00,0x00,0x00,0x18,0xc2,0x38,0x40,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x64, + 0x81,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, + 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50, + 0x10,0x65,0x40,0x70,0x2c,0xa1,0x09,0x00,0x00,0x79,0x18,0x00,0x00,0xb7,0x00,0x00, + 0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37, + 0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b, + 0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c, + 0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26, + 0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac, + 0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0, + 0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79, + 0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6, + 0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6, + 0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62, + 0x6c,0x65,0x43,0x84,0x67,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5, + 0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99, + 0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86, + 0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59, + 0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f, + 0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c, + 0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd, + 0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e,0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08, + 0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b, + 0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c, + 0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61,0x69,0x72, + 0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x14,0xea,0xec,0x86, + 0x48,0xcb,0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6,0x40,0x4f,0xf4,0x48,0x8f,0xc6,0xa5, + 0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d,0x26,0x85,0xc5,0xd8,0x1b,0xdb,0x9b, + 0xdc,0x10,0x69,0x11,0x1e,0xeb,0xe1,0x1e,0xec,0xc9,0x1e,0xe8,0x89,0x1e,0xe9,0xe9, + 0xb8,0x84,0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1,0xd5,0xc9,0x95,0x51,0x0a,0x4b,0x93, + 0x73,0x61,0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73,0xfb,0x4a,0x73,0x23,0x2b,0xc3,0xa3, + 0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x46,0x8c,0xae,0x0c,0x8f,0xae, + 0x4e,0xae,0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d,0x8c,0x8e,0x05,0x64,0x2e,0xac,0x0d, + 0x8e,0xad,0xcc,0x87,0x03,0x5d,0x19,0xde,0x10,0x6a,0x21,0x9e,0xef,0x01,0x83,0x65, + 0x58,0x84,0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47,0x7a,0xc6,0x80,0x4b,0x58,0x9a,0x9c, + 0xcb,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39, + 0x0e,0x73,0x6d,0x70,0x43,0xa4,0xe5,0x78,0xca,0xe0,0x01,0x83,0x65,0x58,0x84,0x07, + 0x7a,0xcc,0xe0,0x91,0x9e,0x33,0x18,0x82,0x3c,0xdb,0xe3,0x3d,0x64,0xf0,0xa0,0xc1, + 0x10,0x03,0x01,0x9e,0xea,0x49,0x83,0x11,0x11,0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b, + 0xb4,0xc3,0x3b,0x90,0x43,0x3d,0xb0,0x43,0x39,0xb8,0x81,0x39,0xb0,0x43,0x38,0x9c, + 0xc3,0x3c,0x4c,0x11,0x82,0x61,0x84,0xc2,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9, + 0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x28,0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0, + 0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x25,0x30,0x46,0x50, 0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e,0xee,0x70,0x0e,0xf5,0x10,0x0e,0xe7, 0x50,0x0e,0xbf,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02, - 0x63,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e, + 0x64,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30,0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e, 0xec,0x50,0x0e,0xbf,0xf0,0x0e,0xf0,0x40,0x0f,0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53, - 0x08,0x44,0x61,0x9c,0x11,0x4c,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xc8,0x43,0x38, - 0x9c,0x43,0x3b,0x94,0x83,0x3b,0xd0,0xc3,0x94,0x40,0x0d,0x00,0x00,0x79,0x18,0x00, - 0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, + 0x06,0x85,0x71,0x46,0x30,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe6,0x20,0x0f,0xe1,0x70, + 0x0e,0xed,0x50,0x0e,0xee,0x40,0x0f,0x53,0x02,0x35,0x00,0x00,0x00,0x79,0x18,0x00, + 0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, 0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c, 0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d, 0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d, @@ -807,304 +797,299 @@ static const uint8_t _sfons_fs_bytecode_metal_macos[2893] = { 0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38, 0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88, 0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08, - 0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00, - 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, - 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00, - 0x00,0x61,0x20,0x00,0x00,0x16,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, - 0x00,0x0b,0x00,0x00,0x00,0x04,0xc7,0x22,0x80,0x40,0x20,0x88,0x8d,0x00,0x8c,0x25, - 0x00,0x01,0xa9,0x11,0x80,0x1a,0x20,0x31,0x03,0x40,0x61,0x0e,0xc2,0xb2,0x2c,0x6a, - 0x06,0x80,0xc0,0x0c,0xc0,0x08,0xc0,0x18,0x01,0x08,0x82,0x20,0xfe,0x01,0x00,0x00, - 0x00,0x83,0x0c,0x0f,0x91,0x8c,0x18,0x28,0x42,0x70,0x39,0x4d,0x80,0x2c,0xc9,0x30, - 0xc8,0x70,0x04,0x8d,0x05,0x91,0x7c,0x66,0x1b,0x94,0x00,0xc8,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50, + 0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01, + 0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03, + 0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c, + 0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00, + 0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d, + 0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x16,0x00,0x00, + 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x14,0xc7,0x22, + 0x80,0x40,0x20,0x88,0x8d,0x00,0x8c,0x25,0x00,0x01,0xa9,0x11,0x80,0x1a,0x20,0x31, + 0x03,0x40,0x61,0x0e,0xe2,0xba,0xae,0x6a,0x06,0x80,0xc0,0x0c,0xc0,0x08,0xc0,0x18, + 0x01,0x08,0x82,0x20,0xfe,0x01,0x00,0x00,0x00,0x83,0x0c,0x0f,0x91,0x8c,0x18,0x28, + 0x42,0x80,0x39,0x4d,0x80,0x2c,0xc9,0x30,0xc8,0x70,0x04,0x8d,0x05,0x91,0x7c,0x66, + 0x1b,0x94,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; +static const uint8_t _sfons_vs_bytecode_metal_ios[3317] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf5,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, + 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x17,0x11,0x57,0x16,0x94,0x42,0x52, + 0xfb,0x1e,0xd0,0x32,0xfd,0x87,0x16,0xb0,0xa4,0xd0,0xc2,0x43,0xbe,0x93,0x8c,0xe0, + 0x2d,0x7a,0x5c,0x3e,0x06,0x4c,0x57,0xeb,0x4b,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x40,0x00,0x00,0x00,0x56,0x41,0x54, + 0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, + 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, + 0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03,0x80,0x56,0x41,0x54, + 0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, + 0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00, + 0x00,0xc0,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00, + 0x00,0xed,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00, + 0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84, + 0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b, + 0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90, + 0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8, + 0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00,0x00,0x82,0x00,0x00, + 0x00,0x1b,0xc8,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80,0x8a,0x18,0x87,0x77, + 0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36,0x90,0x87,0x77,0xa8, + 0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0,0x87,0x74,0x20,0x87, + 0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0x82,0x1c, + 0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e,0xc2,0x21,0x1d,0xd8, + 0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78,0x90,0x87,0x72,0x18, + 0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08,0x07,0x72,0x00,0xcc, + 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0xc0,0x1c,0xe4,0x21, + 0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81,0x1e,0xca,0x41,0x1e, + 0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x06, + 0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87,0x36,0x80,0x87,0x77, + 0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76,0x48,0x87,0x76,0x68, + 0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30,0x07,0x80,0x70,0x87, + 0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07,0x78,0x68,0x83,0x76, + 0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d, + 0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c,0xc4,0x81,0x1d,0xca, + 0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36, + 0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0, + 0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xe6, + 0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca,0x41,0x1e,0xde,0x61, + 0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90,0x87,0x70,0x80,0x07, + 0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41, + 0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61,0x1d,0xda,0x00,0x1e, + 0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e,0xda,0x40,0x1c,0xea, + 0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4,0xa1,0x1c,0x00,0x3c, + 0x00,0x88,0x7a,0x70,0x87,0x79,0x08,0x07,0x73,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xea, + 0x61,0x1e,0xca,0xa1,0x0d,0xe6,0xe1,0x1d,0xcc,0x81,0x1e,0xda,0xc0,0x1c,0xd8,0xe1, + 0x1d,0xc2,0x81,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x36,0x20,0x42, + 0x01,0x24,0xc0,0x02,0x54,0x00,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x01,0x00,0x00, + 0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48, + 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, + 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x44,0x33,0x00,0xc3,0x08,0x04, + 0x60,0x89,0x10,0x02,0x18,0x46,0x10,0x80,0x24,0x08,0x33,0x51,0xf3,0x40,0x0f,0xf2, + 0x50,0x0f,0xe3,0x40,0x0f,0x6e,0xd0,0x0e,0xe5,0x40,0x0f,0xe1,0xc0,0x0e,0x7a,0xa0, + 0x07,0xed,0x10,0x0e,0xf4,0x20,0x0f,0xe9,0x80,0x0f,0x28,0x20,0x07,0x49,0x53,0x44, + 0x09,0x93,0x5f,0x49,0xff,0x03,0x44,0x00,0x23,0x21,0xa1,0x94,0x41,0x04,0x43,0x28, + 0x86,0x08,0x23,0x80,0x43,0x68,0x20,0x60,0x8e,0x00,0x0c,0x52,0x60,0xcd,0x11,0x80, + 0xc2,0x20,0x42,0x20,0x0c,0x23,0x10,0xcb,0x08,0x00,0x00,0x00,0x00,0x13,0xa8,0x70, + 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, + 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51, + 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78, + 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60, + 0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07, + 0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, + 0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, + 0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, + 0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76, + 0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0, + 0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6, + 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90, + 0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06, + 0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0, + 0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72, + 0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10, + 0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, + 0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73, + 0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x2c,0x10,0x00, + 0x00,0x0b,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, + 0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18,0x50,0x08,0x65,0x50, + 0x80,0x02,0x05,0x51,0x20,0xd4,0x46,0x00,0x88,0x8d,0x25,0x40,0x02,0x00,0x00,0x00, + 0x00,0x79,0x18,0x00,0x00,0x02,0x01,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, + 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32,0x28,0x00,0xb3,0x50, + 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0x81,0x22,0x2c, + 0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae, + 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06, + 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5, + 0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x90,0x45,0x60, + 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82,0x45,0xe0,0x16,0x96, + 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, + 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72,0x61,0x69, + 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, + 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65,0x21,0x19,0x84, + 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, + 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, + 0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99,0x1c,0x5d, + 0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39,0x14,0xb6, + 0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79, + 0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x68,0xc8,0x84, + 0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3,0x1b,0xc2, + 0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61, + 0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6,0xc6,0xf6,0x26,0x37,0x84,0x51,0x1e,0xc5, + 0x52,0x22,0x45,0x52,0x26,0xe5,0x22,0x13,0x96,0x26,0xe7,0x02,0xf7,0x36,0x97,0x46, + 0x97,0xf6,0xe6,0xc6,0xe5,0x8c,0xed,0x0b,0xea,0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x6d, + 0x88,0xa2,0x64,0x4a,0xa4,0x48,0xca,0xa4,0x68,0x74,0xc2,0xd2,0xe4,0x5c,0xe0,0xde, + 0xd2,0xdc,0xe8,0xbe,0xe6,0xd2,0xf4,0xca,0x58,0x98,0xb1,0xbd,0x85,0xd1,0x91,0x39, + 0x63,0xfb,0x82,0x7a,0x4b,0x73,0xa3,0x9b,0x4a,0xd3,0x2b,0x1b,0xa2,0x28,0x9c,0x12, + 0x29,0x9d,0x32,0x29,0xde,0x10,0x44,0xa9,0x14,0x4c,0xd9,0x94,0x8f,0x50,0x58,0x9a, + 0x9c,0x8b,0x5d,0x99,0x1c,0x5d,0x19,0xde,0x57,0x9a,0x1b,0x5c,0x1d,0x1d,0xa5,0xb0, + 0x34,0x39,0x17,0xb6,0xb7,0xb1,0x30,0xba,0xb4,0x37,0xb7,0xaf,0x34,0x37,0xb2,0x32, + 0x3c,0x7a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x28,0x5f,0x5f,0x61,0x69, + 0x72,0x5f,0x70,0x6c,0x61,0x63,0x65,0x68,0x6f,0x6c,0x64,0x65,0x72,0x5f,0x5f,0x29, + 0x44,0xe0,0xde,0xe6,0xd2,0xe8,0xd2,0xde,0xdc,0x86,0x50,0x8b,0xa0,0x84,0x81,0x22, + 0x06,0x8b,0xb0,0x04,0xca,0x18,0x28,0x91,0x22,0x29,0x93,0x42,0x06,0x34,0xcc,0xd8, + 0xde,0xc2,0xe8,0x64,0x98,0xd0,0x95,0xe1,0x8d,0xbd,0xbd,0xc9,0x91,0xc1,0x0c,0xa1, + 0x96,0x40,0x09,0x03,0x45,0x0c,0x96,0x60,0x09,0x94,0x31,0x50,0x22,0xc5,0x0c,0x94, + 0x49,0x39,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65,0x50,0xc2,0x40, + 0x11,0x83,0x65,0x58,0x02,0x65,0x0c,0x94,0x48,0x91,0x94,0x49,0x49,0x03,0x16,0x70, + 0x73,0x69,0x7a,0x65,0x43,0xa8,0xc5,0x50,0xc2,0x40,0x11,0x83,0xc5,0x58,0x02,0x65, + 0x0c,0x94,0x48,0xe9,0x94,0x49,0x59,0x03,0x2a,0x61,0x69,0x72,0x2e,0x62,0x75,0x66, + 0x66,0x65,0x72,0x7c,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc,0xcc,0xca,0xe4,0xbe,0xe6, + 0xd2,0xf4,0xca,0x88,0x84,0xa5,0xc9,0xb9,0xc8,0x95,0x85,0x91,0x91,0x0a,0x4b,0x93, + 0x73,0x99,0xa3,0x93,0xab,0x1b,0xa3,0xfb,0xa2,0xcb,0x83,0x2b,0xfb,0x4a,0x73,0x33, + 0x7b,0x23,0x62,0xc6,0xf6,0x16,0x46,0x47,0x83,0x47,0xc3,0xa1,0xcd,0x0e,0x8e,0x02, + 0x5d,0xdb,0x10,0x6a,0x11,0x16,0x62,0x11,0x94,0x38,0x50,0xe4,0x60,0x21,0x16,0x62, + 0x11,0x94,0x38,0x50,0xe6,0x80,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d, + 0x1e,0x5c,0xd9,0xd7,0x5c,0x9a,0x5e,0x19,0xaf,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3, + 0x2f,0xba,0x3c,0xb8,0xb2,0xaf,0x30,0xb6,0xb4,0x33,0xb7,0xaf,0xb9,0x34,0xbd,0x32, + 0x26,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x1c,0xbe,0x62,0x72,0x86,0x90, + 0xc1,0x52,0x28,0x6d,0xa0,0xb8,0xc1,0x72,0x28,0x62,0xb0,0x08,0x4b,0xa0,0xbc,0x81, + 0x02,0x07,0x0a,0x1d,0x28,0x75,0xb0,0x1c,0x8a,0x1d,0x2c,0x89,0x12,0x29,0x77,0xa0, + 0x4c,0x0a,0x1e,0x0c,0x51,0x94,0x32,0x50,0xd0,0x40,0x51,0x03,0x85,0x0d,0x94,0x3c, + 0x18,0x62,0x24,0x80,0x02,0x06,0x8a,0x1e,0xf0,0x79,0x6b,0x73,0x4b,0x83,0x7b,0xa3, + 0x2b,0x73,0xa3,0x03,0x19,0x43,0x0b,0x93,0xe3,0x33,0x95,0xd6,0x06,0xc7,0x56,0x06, + 0x32,0xb4,0xb2,0x02,0x42,0x25,0x14,0x14,0x34,0x44,0x50,0xfa,0x60,0x88,0xa1,0xf0, + 0x81,0xe2,0x07,0x8d,0x32,0xc4,0x50,0xfe,0x40,0xf9,0x83,0x46,0x19,0x11,0xb1,0x03, + 0x3b,0xd8,0x43,0x3b,0xb8,0x41,0x3b,0xbc,0x03,0x39,0xd4,0x03,0x3b,0x94,0x83,0x1b, + 0x98,0x03,0x3b,0x84,0xc3,0x39,0xcc,0xc3,0x14,0x21,0x18,0x46,0x28,0xec,0xc0,0x0e, + 0xf6,0xd0,0x0e,0x6e,0x90,0x0e,0xe4,0x50,0x0e,0xee,0x40,0x0f,0x53,0x82,0x62,0xc4, + 0x12,0x0e,0xe9,0x20,0x0f,0x6e,0x60,0x0f,0xe5,0x20,0x0f,0xf3,0x90,0x0e,0xef,0xe0, + 0x0e,0x53,0x02,0x63,0x04,0x15,0x0e,0xe9,0x20,0x0f,0x6e,0xc0,0x0e,0xe1,0xe0,0x0e, + 0xe7,0x50,0x0f,0xe1,0x70,0x0e,0xe5,0xf0,0x0b,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9, + 0xf0,0x0e,0xee,0x30,0x25,0x40,0x46,0x4c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xe3,0xf0, + 0x0e,0xed,0x00,0x0f,0xe9,0xc0,0x0e,0xe5,0xf0,0x0b,0xef,0x00,0x0f,0xf4,0x90,0x0e, + 0xef,0xe0,0x0e,0xf3,0x30,0x65,0x50,0x18,0x67,0x84,0x12,0x0e,0xe9,0x20,0x0f,0x6e, + 0x60,0x0f,0xe5,0x20,0x0f,0xf4,0x50,0x0e,0xf8,0x30,0x25,0xd8,0x03,0x00,0x00,0x00, + 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, + 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, + 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, + 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83, + 0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07, + 0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70, + 0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3, + 0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2, + 0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc, + 0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68, + 0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07, + 0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72, + 0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec, + 0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc, + 0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8, + 0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03, + 0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c, + 0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74, + 0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4, + 0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc, + 0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1, + 0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50, + 0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51, + 0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21, + 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06, + 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c, + 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77, + 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec, + 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, + 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, + 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x06,0x50,0x30, + 0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00,0x00,0x13,0x04,0x41, + 0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xf4,0xc6,0x22,0x86,0x61,0x18,0xc6, + 0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0xa8,0x95,0x40,0x19,0x14,0x01,0xbd, + 0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00,0x00,0xe3,0x15,0x4b, + 0x94,0x65,0x11,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9,0x8c,0x57,0x3c,0x55, + 0xd7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1, + 0x0a,0x4a,0x13,0x03,0x31,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43,0x99,0x10,0xc8,0xc7, + 0x8a,0x00,0x3e,0xe3,0x15,0xd9,0x77,0x06,0x67,0x40,0x51,0x50,0x06,0x19,0xbe,0x48, + 0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0x3c,0x32,0x68,0x03,0x36,0x20,0x03, + 0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b,0xc4,0x00,0x0d,0xe2, + 0x00,0x0e,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42,0x20,0x1f,0x0b,0x0a, + 0xf8,0x8c,0x57,0x9c,0x41,0x1b,0xd8,0x41,0x1d,0x88,0x01,0x05,0xc5,0x86,0x00,0x3e, + 0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d,0xc1,0x23,0xcc,0x36, + 0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00,0x00,0x5b,0x86,0x20, + 0x00,0x85,0x2d,0x43,0x11,0x80,0xc2,0x96,0x41,0x09,0x40,0x61,0xcb,0xf0,0x04,0xa0, + 0xb0,0x65,0xa0,0x02,0x50,0xd8,0x32,0x60,0x01,0x28,0x6c,0x19,0xba,0x00,0x14,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sfons_vs_bytecode_metal_ios[3417] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x59,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0x40,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, +static const uint8_t _sfons_fs_bytecode_metal_ios[2841] = { + 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x19,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x40,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x53,0xd2,0x06,0xf6,0xae,0x63,0x48, - 0x79,0x19,0x71,0xbe,0x11,0x2a,0xc0,0x72,0x90,0x9c,0xd4,0x1c,0xf2,0xfa,0xd7,0x02, - 0x09,0x76,0xb9,0xee,0x24,0x42,0xd7,0xbd,0x99,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x7c,0x59,0x61,0x85,0x8c,0x08,0x62, + 0xf6,0xd0,0x45,0x0a,0x3a,0xcb,0xa8,0xa5,0x3c,0x2d,0x6c,0x6b,0x9c,0x3d,0xf0,0xf5, + 0xc4,0xdc,0xb5,0x90,0xdc,0xee,0x5a,0x9f,0x63,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x40,0x00,0x00, - 0x00,0x56,0x41,0x54,0x54,0x2a,0x00,0x04,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x00,0x00,0x80,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x02,0x80,0x70,0x73,0x69,0x7a,0x65,0x00,0x03, - 0x80,0x56,0x41,0x54,0x59,0x06,0x00,0x04,0x00,0x06,0x04,0x06,0x03,0x45,0x4e,0x44, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0x20,0x0c,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0x05,0x03,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0x28,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0x87,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, 0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21,0x72,0x24,0x07,0xc8, 0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00,0x00,0x51,0x18,0x00, - 0x00,0x8a,0x00,0x00,0x00,0x1b,0xf6,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x90,0x80, - 0x8a,0x18,0x87,0x77,0x90,0x07,0x79,0x28,0x87,0x71,0xa0,0x07,0x76,0xc8,0x87,0x36, - 0x90,0x87,0x77,0xa8,0x07,0x77,0x20,0x87,0x72,0x20,0x87,0x36,0x20,0x87,0x74,0xb0, - 0x87,0x74,0x20,0x87,0x72,0x68,0x83,0x79,0x88,0x07,0x79,0xa0,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1, - 0x1c,0x00,0x82,0x1c,0xd2,0x61,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xda,0x80,0x1e, - 0xc2,0x21,0x1d,0xd8,0xa1,0x0d,0xc6,0x21,0x1c,0xd8,0x81,0x1d,0xe6,0x01,0x30,0x87, - 0x70,0x60,0x87,0x79,0x28,0x07,0x80,0x60,0x87,0x72,0x98,0x87,0x79,0x68,0x03,0x78, - 0x90,0x87,0x72,0x18,0x87,0x74,0x98,0x87,0x72,0x68,0x03,0x73,0x80,0x87,0x76,0x08, - 0x07,0x72,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda, - 0xc0,0x1c,0xe4,0x21,0x1c,0xda,0xa1,0x1c,0xda,0x00,0x1e,0xde,0x21,0x1d,0xdc,0x81, - 0x1e,0xca,0x41,0x1e,0xda,0xa0,0x1c,0xd8,0x21,0x1d,0xda,0x01,0xa0,0x07,0x79,0xa8, - 0x87,0x72,0x00,0x06,0x77,0x78,0x87,0x36,0x30,0x07,0x79,0x08,0x87,0x76,0x28,0x87, - 0x36,0x80,0x87,0x77,0x48,0x07,0x77,0xa0,0x87,0x72,0x90,0x87,0x36,0x28,0x07,0x76, - 0x48,0x87,0x76,0x68,0x03,0x77,0x78,0x07,0x77,0x68,0x03,0x76,0x28,0x87,0x70,0x30, - 0x07,0x80,0x70,0x87,0x77,0x68,0x83,0x74,0x70,0x07,0x73,0x98,0x87,0x36,0x30,0x07, - 0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01, - 0x20,0xdc,0xe1,0x1d,0xda,0x40,0x1d,0xea,0xa1,0x1d,0xe0,0xa1,0x0d,0xe8,0x21,0x1c, - 0xc4,0x81,0x1d,0xca,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08, - 0x77,0x78,0x87,0x36,0x70,0x87,0x70,0x70,0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36, - 0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d, - 0xde,0xa1,0x0d,0xe6,0x21,0x1d,0xce,0xc1,0x1d,0xca,0x81,0x1c,0xda,0x40,0x1f,0xca, - 0x41,0x1e,0xde,0x61,0x1e,0xda,0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x7a,0x90, - 0x87,0x70,0x80,0x07,0x78,0x48,0x07,0x77,0x38,0x87,0x36,0x68,0x87,0x70,0xa0,0x07, - 0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1,0x1c,0x00,0x62,0x1e,0xe8,0x21,0x1c,0xc6,0x61, - 0x1d,0xda,0x00,0x1e,0xe4,0xe1,0x1d,0xe8,0xa1,0x1c,0xc6,0x81,0x1e,0xde,0x41,0x1e, - 0xda,0x40,0x1c,0xea,0xc1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x0d,0xe6,0x21,0x1d,0xf4, - 0xa1,0x1c,0x00,0x3c,0x00,0x08,0x7a,0x08,0x07,0x79,0x38,0x87,0x72,0xa0,0x87,0x36, - 0x30,0x87,0x72,0x08,0x07,0x7a,0xa8,0x07,0x79,0x28,0x87,0x79,0x00,0xda,0xc0,0x1c, - 0xe0,0x21,0x0e,0xec,0x00,0x20,0xea,0xc1,0x1d,0xe6,0x21,0x1c,0xcc,0xa1,0x1c,0xda, - 0xc0,0x1c,0xe0,0xa1,0x0d,0xda,0x21,0x1c,0xe8,0x01,0x1d,0x00,0x7a,0x90,0x87,0x7a, - 0x28,0x07,0x80,0xa8,0x87,0x79,0x28,0x87,0x36,0x98,0x87,0x77,0x30,0x07,0x7a,0x68, - 0x03,0x73,0x60,0x87,0x77,0x08,0x07,0x7a,0x00,0xcc,0x21,0x1c,0xd8,0x61,0x1e,0xca, - 0x01,0xd8,0x80,0x08,0x05,0x90,0x00,0x0b,0x50,0x01,0x00,0x00,0x00,0x49,0x18,0x00, - 0x00,0x01,0x00,0x00,0x00,0x13,0x84,0x40,0x00,0x89,0x20,0x00,0x00,0x24,0x00,0x00, - 0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22, - 0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x40,0x33, - 0x00,0xc3,0x08,0x04,0x70,0x97,0x34,0x45,0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef, - 0x50,0x93,0xff,0x00,0x82,0x42,0x0c,0x98,0x08,0x21,0x80,0x61,0x04,0x01,0x48,0x82, - 0x30,0x13,0x35,0x0f,0xf4,0x20,0x0f,0xf5,0x30,0x0e,0xf4,0xe0,0x06,0xed,0x50,0x0e, - 0xf4,0x10,0x0e,0xec,0xa0,0x07,0x7a,0xd0,0x0e,0xe1,0x40,0x0f,0xf2,0x90,0x0e,0xf8, - 0x80,0x02,0x72,0x90,0x34,0x45,0x94,0x30,0xf9,0x95,0xf4,0x3f,0x40,0x04,0x30,0x12, - 0x12,0x4a,0x19,0x44,0x30,0x84,0x62,0x88,0x30,0x02,0x38,0x84,0x06,0x02,0xe6,0x08, - 0xc0,0x60,0x8e,0x00,0x14,0x06,0x11,0x02,0x61,0x18,0x81,0x58,0x46,0x00,0x00,0x00, - 0x00,0x13,0xa8,0x70,0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78, - 0x60,0x87,0x72,0x68,0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80, - 0x83,0x0d,0xef,0x51,0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, - 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07, - 0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76, - 0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0, - 0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07, - 0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73, - 0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40, - 0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xe6,0x80,0x07,0x70,0xa0,0x07,0x71,0x20,0x07, - 0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71, - 0x60,0x07,0x7a,0x10,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20, - 0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07, - 0x7a,0x30,0x07,0x72,0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a, - 0x60,0x07,0x74,0xd0,0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60, - 0x07,0x74,0xd0,0x06,0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07, - 0x71,0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, - 0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0, - 0x07,0x72,0x50,0x07,0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07, - 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d, - 0x60,0x0f,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10, - 0x07,0x72,0xd0,0x06,0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07, - 0x72,0x40,0x07,0x7a,0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xe6,0x80,0x07,0x70, - 0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xee,0x80, - 0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00, - 0x00,0x00,0x00,0x00,0x80,0x2c,0x10,0x00,0x00,0x09,0x00,0x00,0x00,0x32,0x1e,0x98, - 0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02, - 0x50,0x80,0x01,0x85,0x50,0x04,0x65,0x50,0x80,0x02,0x05,0x51,0x20,0xc4,0x46,0x00, - 0x00,0x79,0x18,0x00,0x00,0x15,0x01,0x00,0x00,0x1a,0x03,0x4c,0x10,0x95,0xbb,0x31, - 0xb4,0x30,0xb9,0xaf,0xb9,0x34,0xbd,0xb2,0x21,0xc6,0x12,0x28,0xc0,0x42,0x70,0x0d, - 0x82,0xe0,0xe0,0xd8,0xca,0x40,0x98,0x98,0xac,0x9a,0x40,0xec,0xca,0xe4,0xe6,0xd2, - 0xde,0xdc,0x40,0x72,0x60,0x64,0x5c,0x62,0x40,0x50,0xda,0xca,0xe8,0xc2,0xd8,0xcc, - 0xca,0x5a,0x72,0x60,0x64,0x5c,0x62,0x5c,0x6a,0x60,0x52,0x86,0x08,0x8a,0x30,0xc4, - 0x58,0x82,0x05,0x59,0x04,0x16,0x4d,0x65,0x74,0x61,0x6c,0x43,0x10,0xa5,0x58,0x82, - 0x45,0x58,0x04,0x6e,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e, - 0x64,0x65,0x6e,0x6f,0x72,0x6d,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x04,0xe5,0x20,0x17,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x62, - 0x16,0x36,0x47,0xf7,0xd5,0x16,0x46,0x87,0xf6,0x55,0xe6,0x16,0x26,0xc6,0x56,0x36, - 0x44,0x50,0x12,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99, - 0x8b,0x99,0x5c,0x58,0x5b,0x99,0x58,0x9d,0x99,0x59,0x99,0xdc,0x97,0x59,0x19,0xdd, - 0x18,0xda,0x57,0x99,0x5b,0x98,0x18,0x5b,0xd9,0x10,0x41,0x59,0x18,0x06,0x61,0x69, - 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65, - 0x5f,0x64,0x6f,0x75,0x62,0x6c,0x65,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x04,0xa5,0x61,0x14,0x96,0x26,0xe7,0x62,0x57,0x26,0x47,0x57,0x86,0xf7,0xf5,0x56, - 0x47,0x07,0x57,0x47,0xc7,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x0d,0x26, - 0x85,0x51,0x58,0x9a,0x9c,0x4b,0x98,0xdc,0xd9,0x17,0x5d,0x1e,0x5c,0xd9,0x97,0x5b, - 0x58,0x5b,0x19,0x0d,0x33,0xb6,0xb7,0x30,0x3a,0x1a,0x32,0x61,0x69,0x72,0x2e,0x61, - 0x72,0x67,0x5f,0x6e,0x61,0x6d,0x65,0x14,0xea,0xec,0x86,0x30,0xca,0xa3,0x40,0x4a, - 0xa4,0x48,0xca,0xa4,0x50,0x5c,0xea,0xe6,0xca,0xe4,0x50,0xd8,0xde,0xc6,0xdc,0x62, - 0x52,0x58,0x8c,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x94,0x47,0xb1,0x94,0x48,0x91,0x94, - 0x49,0xb9,0xc8,0x84,0xa5,0xc9,0xb9,0xc0,0xbd,0xcd,0xa5,0xd1,0xa5,0xbd,0xb9,0x71, - 0x39,0x63,0xfb,0x82,0x7a,0x9b,0x4b,0xa3,0x4b,0x7b,0x73,0x1b,0xa2,0x28,0x99,0x12, - 0x29,0x92,0x32,0x29,0x1a,0x9d,0xb0,0x34,0x39,0x17,0xb8,0xb7,0x34,0x37,0xba,0xaf, - 0xb9,0x34,0xbd,0x32,0x16,0x66,0x6c,0x6f,0x61,0x74,0x64,0xce,0xd8,0xbe,0xa0,0xde, - 0xd2,0xdc,0xe8,0xa6,0xd2,0xf4,0xca,0x86,0x28,0x0a,0xa7,0x44,0x4a,0xa7,0x4c,0x8a, - 0x37,0x04,0x51,0x2a,0x05,0x53,0x36,0xe5,0x23,0x14,0x96,0x26,0xe7,0x62,0x57,0x26, - 0x47,0x57,0x86,0xf7,0x95,0xe6,0x06,0x57,0x47,0x47,0x29,0x2c,0x4d,0xce,0x85,0xed, - 0x6d,0x2c,0x8c,0x2e,0xed,0xcd,0xed,0x2b,0xcd,0x8d,0xac,0x0c,0x8f,0xd9,0x59,0x99, - 0x5b,0x99,0x5c,0x18,0x5d,0x19,0x19,0x0a,0x0e,0xdc,0xdb,0x5c,0x1a,0x5d,0xda,0x9b, - 0x1b,0x91,0x1d,0xcd,0x97,0x59,0x0a,0x11,0xb8,0xb7,0xb9,0x34,0xba,0xb4,0x37,0xb7, - 0x21,0xd4,0x22,0x28,0x61,0xa0,0x88,0xc1,0x22,0x2c,0x81,0x32,0x06,0x4a,0xa4,0x48, - 0xca,0xa4,0x90,0x01,0xb5,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0x1c, - 0xba,0x32,0xbc,0xb1,0xb7,0x37,0x39,0x32,0x18,0x22,0x3b,0x99,0x2f,0xb3,0x14,0x1a, - 0x66,0x6c,0x6f,0x61,0x74,0x32,0x4c,0xe8,0xca,0xf0,0xc6,0xde,0xde,0xe4,0xc8,0x60, - 0x86,0x50,0x4b,0xa0,0x84,0x81,0x22,0x06,0x4b,0xb0,0x04,0x8a,0x19,0x28,0x91,0x72, - 0x06,0xca,0xa4,0xa0,0x01,0xaf,0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x14, - 0x9b,0xb1,0x37,0xb6,0x37,0x39,0x18,0x22,0x3b,0x9a,0x2f,0xb3,0x14,0x1a,0x63,0x6f, - 0x6c,0x6f,0x72,0x30,0x43,0xa8,0xa5,0x50,0xc2,0x40,0x11,0x83,0xa5,0x58,0x02,0x45, - 0x0d,0x94,0x48,0x91,0x94,0x49,0x59,0x03,0x4a,0x67,0x65,0x6e,0x65,0x72,0x61,0x74, - 0x65,0x64,0x28,0x35,0x70,0x73,0x69,0x7a,0x65,0x66,0x29,0x2c,0xe0,0xe6,0xd2,0xf4, - 0xca,0x86,0x50,0x8b,0xa1,0x84,0x81,0x22,0x06,0x8b,0xb1,0x04,0x4a,0x1b,0x28,0x91, - 0xd2,0x29,0x93,0xe2,0x06,0x54,0xc2,0xd2,0xe4,0x5c,0xc4,0xea,0xcc,0xcc,0xca,0xe4, - 0xf8,0x84,0xa5,0xc9,0xb9,0x88,0xd5,0x99,0x99,0x95,0xc9,0x7d,0xcd,0xa5,0xe9,0x95, - 0x11,0x09,0x4b,0x93,0x73,0x91,0x2b,0x0b,0x23,0x23,0x15,0x96,0x26,0xe7,0x32,0x47, - 0x27,0x57,0x37,0x46,0xf7,0x45,0x97,0x07,0x57,0xf6,0x95,0xe6,0x66,0xf6,0x46,0xc4, - 0x8c,0xed,0x2d,0x8c,0x8e,0x06,0x8f,0x86,0x43,0x9b,0x1d,0x1c,0x05,0xba,0xb6,0x21, - 0xd4,0x22,0x2c,0xc3,0x22,0x28,0x74,0xa0,0xd4,0xc1,0x32,0x2c,0xc3,0x22,0x28,0x74, - 0xa0,0xd8,0x01,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8,0xb2, - 0xaf,0xb9,0x34,0xbd,0x32,0x5e,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f,0x74,0x79, - 0x70,0x65,0x5f,0x61,0x6c,0x69,0x67,0x6e,0x5f,0x73,0x69,0x7a,0x65,0x4c,0xec,0xe6, - 0xbe,0xe0,0xc2,0xe4,0xc2,0xda,0xe6,0x38,0x7c,0xc9,0xc4,0x0c,0x21,0x83,0x85,0x50, - 0xe0,0x40,0x89,0x83,0xe5,0x50,0xc4,0x60,0x11,0x96,0x40,0x91,0x03,0x65,0x0e,0x94, - 0x3b,0x50,0xf0,0x60,0x39,0x94,0x3c,0x58,0x12,0x25,0x52,0xf4,0x40,0x99,0x94,0x3d, - 0x18,0xa2,0x28,0x65,0xa0,0xa4,0x81,0xc2,0x06,0xca,0x1b,0x28,0x7c,0x30,0xc4,0x48, - 0x00,0x05,0x0c,0x94,0x3e,0xe0,0xf3,0xd6,0xe6,0x96,0x06,0xf7,0x46,0x57,0xe6,0x46, - 0x07,0x32,0x86,0x16,0x26,0xc7,0x67,0x2a,0xad,0x0d,0x8e,0xad,0x0c,0x64,0x68,0x65, - 0x05,0x84,0x4a,0x28,0x28,0x68,0x88,0xa0,0x80,0xc2,0x10,0x43,0xf9,0x03,0x25,0x14, - 0x18,0x65,0x88,0xa1,0x88,0x82,0x22,0x0a,0x8c,0x32,0x22,0x62,0x07,0x76,0xb0,0x87, - 0x76,0x70,0x83,0x76,0x78,0x07,0x72,0xa8,0x07,0x76,0x28,0x07,0x37,0x30,0x07,0x76, - 0x08,0x87,0x73,0x98,0x87,0x29,0x41,0x30,0x42,0x61,0x07,0x76,0xb0,0x87,0x76,0x70, - 0x83,0x74,0x20,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0x0c,0x23,0x96,0x70,0x48,0x07, - 0x79,0x70,0x03,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x10, - 0x23,0xa8,0x70,0x48,0x07,0x79,0x70,0x03,0x76,0x08,0x07,0x77,0x38,0x87,0x7a,0x08, - 0x87,0x73,0x28,0x87,0x5f,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87, - 0x29,0x81,0x31,0x62,0x0a,0x87,0x74,0x90,0x07,0x37,0x18,0x87,0x77,0x68,0x07,0x78, - 0x48,0x07,0x76,0x28,0x87,0x5f,0x78,0x07,0x78,0xa0,0x87,0x74,0x78,0x07,0x77,0x98, - 0x87,0x29,0x04,0xa2,0x30,0xce,0x08,0x25,0x1c,0xd2,0x41,0x1e,0xdc,0xc0,0x1e,0xca, - 0x41,0x1e,0xe8,0xa1,0x1c,0xf0,0x61,0x4a,0xe0,0x07,0x00,0x00,0x00,0x79,0x18,0x00, - 0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, - 0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c, - 0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d, - 0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d, - 0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79, - 0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc, - 0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50, - 0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30, - 0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03, - 0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07, - 0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76, - 0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98, - 0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8, - 0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21, - 0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43, - 0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f, - 0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70, - 0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0, - 0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40, - 0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41, - 0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e, - 0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07, - 0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f, - 0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d, - 0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38, - 0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88, - 0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08, - 0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00, - 0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x3e,0x00,0x00, - 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xe4,0xc6,0x22, - 0x86,0x61,0x18,0xc6,0x22,0x04,0x41,0x10,0xc6,0x22,0x82,0x20,0x08,0x88,0x95,0x40, - 0x19,0x14,0x01,0xb9,0x11,0x00,0x1a,0x33,0x00,0x24,0x66,0x00,0x28,0xcc,0x00,0x00, - 0x00,0xe3,0x15,0x0b,0x84,0x61,0x10,0x05,0x65,0x90,0x21,0x1a,0x0c,0x13,0x02,0xf9, - 0x8c,0x57,0x3c,0x14,0xc7,0x2d,0x14,0x94,0x41,0x86,0xea,0x70,0x4c,0x08,0xe4,0x63, - 0x41,0x01,0x9f,0xf1,0x0a,0x2a,0x0b,0x83,0x30,0x70,0x28,0x28,0x83,0x0c,0x1a,0x43, - 0x99,0x10,0xc8,0xc7,0x8a,0x00,0x3e,0xe3,0x15,0x99,0x67,0x06,0x66,0x40,0x51,0x50, - 0x06,0x19,0xbe,0x48,0x33,0x21,0x90,0x8f,0x15,0x01,0x7c,0xc6,0x2b,0xbc,0x31,0x60, - 0x83,0x35,0x18,0x03,0x0a,0xca,0x20,0xc3,0x18,0x60,0x99,0x09,0x81,0x7c,0xc6,0x2b, - 0xc4,0xe0,0x0c,0xe0,0xe0,0x0d,0x3c,0x0a,0xca,0x20,0xc3,0x19,0x70,0x61,0x60,0x42, - 0x20,0x1f,0x0b,0x0a,0xf8,0x8c,0x57,0x9c,0x01,0x1b,0xd4,0x01,0x1d,0x88,0x01,0x05, - 0xc5,0x86,0x00,0x3e,0xb3,0x0d,0x61,0x10,0x00,0xb3,0x0d,0x41,0x1b,0x04,0xb3,0x0d, - 0xc1,0x23,0xcc,0x36,0x04,0x6e,0x30,0x64,0x10,0x10,0x03,0x00,0x00,0x09,0x00,0x00, - 0x00,0x5b,0x86,0x20,0x18,0x85,0x2d,0x43,0x11,0x8c,0xc2,0x96,0x41,0x09,0x46,0x61, - 0xcb,0xf0,0x04,0xa3,0xb0,0x65,0xa0,0x82,0x51,0xd8,0x32,0x60,0xc1,0x28,0x6c,0x19, - 0xba,0x60,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -static const uint8_t _sfons_fs_bytecode_metal_ios[2877] = { - 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3d,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x60,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, - 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x54,0xcb,0x23,0xc1,0x79,0xec,0x33, - 0x7a,0x1d,0x12,0x8c,0x7c,0xe5,0x11,0xa5,0xdb,0xc5,0x1c,0x52,0xd5,0x69,0x04,0xe6, - 0x72,0x3d,0xdb,0xf1,0xf1,0xf4,0x44,0xa4,0xb5,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x45,0x4e,0x44,0x54,0x04,0x00,0x00, - 0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17, - 0x0b,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x4c,0x0a,0x00,0x00,0xff,0xff,0xff, - 0xff,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0x90,0x02,0x00,0x00,0x0b,0x82,0x20, - 0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04, - 0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b, - 0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18, - 0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,0x0c,0x19,0x21, - 0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,0x01,0x00,0x00, - 0x00,0x51,0x18,0x00,0x00,0x92,0x00,0x00,0x00,0x1b,0xfa,0x25,0xf8,0xff,0xff,0xff, - 0xff,0x01,0x60,0x00,0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07, - 0x7a,0x60,0x87,0x7c,0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72, - 0x68,0x03,0x72,0x48,0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90, - 0x07,0x7a,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc, - 0x21,0x1c,0xd8,0x61,0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81, - 0x1d,0xca,0xa1,0x0d,0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d, - 0xd8,0x61,0x1e,0x00,0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87, - 0x79,0x98,0x87,0x36,0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36, - 0x30,0x07,0x78,0x68,0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c, - 0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0, - 0xe1,0x1d,0xd2,0xc1,0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1, - 0x1d,0x00,0x7a,0x90,0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90, - 0x87,0x70,0x68,0x87,0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07, - 0x79,0x68,0x83,0x72,0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36, - 0x60,0x87,0x72,0x08,0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30, - 0x87,0x79,0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8, - 0x41,0x1e,0xea,0xa1,0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01, - 0x1e,0xda,0x80,0x1e,0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60, - 0x87,0x79,0x28,0x07,0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87, - 0x36,0x30,0x07,0x78,0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1, - 0x1e,0xca,0x01,0x20,0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c, - 0xc8,0xa1,0x0d,0xf4,0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda, - 0xa0,0x1d,0xc2,0x81,0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77, - 0x78,0x87,0x36,0xa0,0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68, - 0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6, - 0x81,0x1e,0xc2,0x61,0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61, - 0x1c,0xe8,0xe1,0x1d,0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e, - 0xda,0x60,0x1e,0xd2,0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa0,0x87,0x70,0x90,0x87, - 0x73,0x28,0x07,0x7a,0x68,0x03,0x73,0x28,0x87,0x70,0xa0,0x87,0x7a,0x90,0x87,0x72, - 0x98,0x07,0xa0,0x0d,0xcc,0x01,0x1e,0xe2,0xc0,0x0e,0x00,0xa2,0x1e,0xdc,0x61,0x1e, - 0xc2,0xc1,0x1c,0xca,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81,0x1e,0xd0, - 0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x88,0x7a,0x98,0x87,0x72,0x68,0x83,0x79, - 0x78,0x07,0x73,0xa0,0x87,0x36,0x30,0x07,0x76,0x78,0x87,0x70,0xa0,0x07,0xc0,0x1c, - 0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x80,0x0d,0x86,0x30,0x00,0x0b,0x50,0x6d,0x30,0x06, - 0x02,0x58,0x80,0x6a,0x03,0x42,0xfc,0xff,0xff,0xff,0xff,0x00,0x30,0x80,0x04,0x54, - 0x1b,0x8c,0x22,0x00,0x16,0xa0,0xda,0x60,0x18,0x02,0xb0,0x00,0x15,0x00,0x00,0x00, - 0x00,0x49,0x18,0x00,0x00,0x03,0x00,0x00,0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44, - 0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00,0x00,0x20,0x00,0x00,0x00,0x32,0x22,0x48, - 0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90, - 0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,0x10,0x48,0x33,0x00,0xc3,0x08,0x04, - 0x70,0x90,0x34,0x45,0x94,0x30,0xf9,0x0c,0x80,0x34,0xf4,0xef,0x50,0x13,0x0a,0xc2, - 0x51,0xd2,0x14,0x51,0xc2,0xe4,0xff,0x13,0x71,0x4d,0x54,0x44,0xfc,0xf6,0xf0,0x4f, - 0x63,0x04,0xc0,0x20,0xc2,0x10,0x5c,0x24,0x4d,0x11,0x25,0x4c,0xfe,0x2f,0x01,0xcc, - 0xb3,0x10,0xd1,0x3f,0x8d,0x11,0x00,0x83,0x08,0x85,0x50,0x0a,0x11,0x02,0x31,0x74, - 0x86,0x11,0x04,0x60,0x8e,0x20,0x98,0x23,0x00,0x83,0x61,0x04,0x61,0x29,0x48,0x20, - 0x26,0x29,0xa6,0x00,0xb5,0x81,0x80,0x61,0x04,0x62,0x19,0x01,0x00,0x13,0xa8,0x70, + 0x00,0x89,0x00,0x00,0x00,0x1b,0xcc,0x25,0xf8,0xff,0xff,0xff,0xff,0x01,0x60,0x00, + 0x09,0xa8,0x88,0x71,0x78,0x07,0x79,0x90,0x87,0x72,0x18,0x07,0x7a,0x60,0x87,0x7c, + 0x68,0x03,0x79,0x78,0x87,0x7a,0x70,0x07,0x72,0x28,0x07,0x72,0x68,0x03,0x72,0x48, + 0x07,0x7b,0x48,0x07,0x72,0x28,0x87,0x36,0x98,0x87,0x78,0x90,0x07,0x7a,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xcc,0x21,0x1c,0xd8,0x61, + 0x1e,0xca,0x01,0x20,0xc8,0x21,0x1d,0xe6,0x21,0x1c,0xc4,0x81,0x1d,0xca,0xa1,0x0d, + 0xe8,0x21,0x1c,0xd2,0x81,0x1d,0xda,0x60,0x1c,0xc2,0x81,0x1d,0xd8,0x61,0x1e,0x00, + 0x73,0x08,0x07,0x76,0x98,0x87,0x72,0x00,0x08,0x76,0x28,0x87,0x79,0x98,0x87,0x36, + 0x80,0x07,0x79,0x28,0x87,0x71,0x48,0x87,0x79,0x28,0x87,0x36,0x30,0x07,0x78,0x68, + 0x87,0x70,0x20,0x07,0xc0,0x1c,0xc2,0x81,0x1d,0xe6,0xa1,0x1c,0x00,0xc2,0x1d,0xde, + 0xa1,0x0d,0xcc,0x41,0x1e,0xc2,0xa1,0x1d,0xca,0xa1,0x0d,0xe0,0xe1,0x1d,0xd2,0xc1, + 0x1d,0xe8,0xa1,0x1c,0xe4,0xa1,0x0d,0xca,0x81,0x1d,0xd2,0xa1,0x1d,0x00,0x7a,0x90, + 0x87,0x7a,0x28,0x07,0x60,0x70,0x87,0x77,0x68,0x03,0x73,0x90,0x87,0x70,0x68,0x87, + 0x72,0x68,0x03,0x78,0x78,0x87,0x74,0x70,0x07,0x7a,0x28,0x07,0x79,0x68,0x83,0x72, + 0x60,0x87,0x74,0x68,0x87,0x36,0x70,0x87,0x77,0x70,0x87,0x36,0x60,0x87,0x72,0x08, + 0x07,0x73,0x00,0x08,0x77,0x78,0x87,0x36,0x48,0x07,0x77,0x30,0x87,0x79,0x68,0x03, + 0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e,0xea,0xa1, + 0x1c,0x00,0xc2,0x1d,0xde,0xa1,0x0d,0xd4,0xa1,0x1e,0xda,0x01,0x1e,0xda,0x80,0x1e, + 0xc2,0x41,0x1c,0xd8,0xa1,0x1c,0xe6,0x01,0x30,0x87,0x70,0x60,0x87,0x79,0x28,0x07, + 0x80,0x70,0x87,0x77,0x68,0x03,0x77,0x08,0x07,0x77,0x98,0x87,0x36,0x30,0x07,0x78, + 0x68,0x83,0x76,0x08,0x07,0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20, + 0xdc,0xe1,0x1d,0xda,0x60,0x1e,0xd2,0xe1,0x1c,0xdc,0xa1,0x1c,0xc8,0xa1,0x0d,0xf4, + 0xa1,0x1c,0xe4,0xe1,0x1d,0xe6,0xa1,0x0d,0xcc,0x01,0x1e,0xda,0xa0,0x1d,0xc2,0x81, + 0x1e,0xd0,0x01,0xa0,0x07,0x79,0xa8,0x87,0x72,0x00,0x08,0x77,0x78,0x87,0x36,0xa0, + 0x07,0x79,0x08,0x07,0x78,0x80,0x87,0x74,0x70,0x87,0x73,0x68,0x83,0x76,0x08,0x07, + 0x7a,0x40,0x07,0x80,0x1e,0xe4,0xa1,0x1e,0xca,0x01,0x20,0xe6,0x81,0x1e,0xc2,0x61, + 0x1c,0xd6,0xa1,0x0d,0xe0,0x41,0x1e,0xde,0x81,0x1e,0xca,0x61,0x1c,0xe8,0xe1,0x1d, + 0xe4,0xa1,0x0d,0xc4,0xa1,0x1e,0xcc,0xc1,0x1c,0xca,0x41,0x1e,0xda,0x60,0x1e,0xd2, + 0x41,0x1f,0xca,0x01,0xc0,0x03,0x80,0xa8,0x07,0x77,0x98,0x87,0x70,0x30,0x87,0x72, + 0x68,0x03,0x73,0x80,0x87,0x36,0x68,0x87,0x70,0xa0,0x07,0x74,0x00,0xe8,0x41,0x1e, + 0xea,0xa1,0x1c,0x00,0xa2,0x1e,0xe6,0xa1,0x1c,0xda,0x60,0x1e,0xde,0xc1,0x1c,0xe8, + 0xa1,0x0d,0xcc,0x81,0x1d,0xde,0x21,0x1c,0xe8,0x01,0x30,0x87,0x70,0x60,0x87,0x79, + 0x28,0x07,0x60,0x83,0x21,0x0c,0xc0,0x02,0x54,0x1b,0x8c,0x81,0x00,0x16,0xa0,0xda, + 0x80,0x10,0xff,0xff,0xff,0xff,0x3f,0x00,0x0c,0x20,0x01,0xd5,0x06,0xa3,0x08,0x80, + 0x05,0xa8,0x36,0x18,0x86,0x00,0x2c,0x40,0x05,0x49,0x18,0x00,0x00,0x03,0x00,0x00, + 0x00,0x13,0x86,0x40,0x18,0x26,0x0c,0x44,0x61,0x00,0x00,0x00,0x00,0x89,0x20,0x00, + 0x00,0x1e,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4, + 0x84,0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4, + 0x4c,0x10,0x4c,0x33,0x00,0xc3,0x08,0x04,0x60,0x83,0x70,0x94,0x34,0x45,0x94,0x30, + 0xf9,0xff,0x44,0x5c,0x13,0x15,0x11,0xbf,0x3d,0xfc,0xd3,0x18,0x01,0x30,0x88,0x30, + 0x04,0x17,0x49,0x53,0x44,0x09,0x93,0xff,0x4b,0x00,0xf3,0x2c,0x44,0xf4,0x4f,0x63, + 0x04,0xc0,0x20,0x42,0x21,0x94,0x42,0x84,0x40,0x0c,0x9d,0x61,0x04,0x01,0x98,0x23, + 0x08,0xe6,0x08,0xc0,0x60,0x18,0x41,0x58,0x0a,0x12,0x88,0x49,0x8a,0x29,0x40,0x6d, + 0x20,0x20,0x05,0xd6,0x30,0x02,0xb1,0x8c,0x00,0x00,0x00,0x00,0x00,0x13,0xa8,0x70, 0x48,0x07,0x79,0xb0,0x03,0x3a,0x68,0x83,0x70,0x80,0x07,0x78,0x60,0x87,0x72,0x68, - 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xef,0x51, + 0x83,0x74,0x78,0x87,0x79,0xc8,0x03,0x37,0x80,0x03,0x37,0x80,0x83,0x0d,0xb7,0x51, 0x0e,0x6d,0x00,0x0f,0x7a,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, 0x74,0xd0,0x06,0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78, 0xa0,0x07,0x78,0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60, @@ -1112,73 +1097,70 @@ static const uint8_t _sfons_fs_bytecode_metal_ios[2877] = { 0x7a,0x30,0x07,0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a, 0x60,0x07,0x74,0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30, 0x07,0x72,0xd0,0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07, - 0x74,0xd0,0x06,0xe6,0x80,0x07,0x70,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71, - 0x20,0x07,0x78,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10, - 0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07, - 0x72,0xd0,0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72, - 0xd0,0x06,0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0, - 0x06,0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06, - 0xf6,0x90,0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78, - 0xd0,0x06,0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10, - 0x07,0x72,0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07, - 0x76,0xa0,0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a, - 0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10, - 0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06, - 0xf6,0x10,0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a, - 0x10,0x07,0x70,0x20,0x07,0x74,0xd0,0x06,0xe6,0x80,0x07,0x70,0xa0,0x07,0x71,0x20, - 0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07, - 0x76,0xa0,0x07,0x73,0x20,0x07,0x43,0x18,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00, - 0x80,0x21,0x8c,0x03,0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00, - 0x00,0x07,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26, - 0x47,0xc6,0x04,0x43,0x5a,0x23,0x00,0x25,0x50,0x08,0x05,0x51,0x04,0x65,0x00,0x00, - 0x00,0x79,0x18,0x00,0x00,0xbb,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x95,0xbb,0x31, - 0xb4,0x30,0xb9,0xaf,0xb9,0x34,0xbd,0xb2,0x21,0xc6,0x32,0x3c,0xc0,0x42,0x70,0x0d, - 0x82,0xe0,0xe0,0xd8,0xca,0x40,0x98,0x98,0xac,0x9a,0x40,0xec,0xca,0xe4,0xe6,0xd2, - 0xde,0xdc,0x40,0x72,0x60,0x64,0x5c,0x62,0x40,0x50,0xda,0xca,0xe8,0xc2,0xd8,0xcc, - 0xca,0x5a,0x72,0x60,0x64,0x5c,0x62,0x5c,0x6a,0x60,0x52,0x86,0x08,0x8f,0x30,0xc4, - 0x58,0x86,0xa5,0x58,0x04,0x16,0x4d,0x65,0x74,0x61,0x6c,0x43,0x90,0xa7,0x58,0x86, - 0x45,0x58,0x04,0x6e,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e, - 0x64,0x65,0x6e,0x6f,0x72,0x6d,0x73,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x84,0xe7,0x20,0x17,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x62, - 0x16,0x36,0x47,0xf7,0xd5,0x16,0x46,0x87,0xf6,0x55,0xe6,0x16,0x26,0xc6,0x56,0x36, - 0x44,0x78,0x12,0x92,0x41,0x58,0x9a,0x9c,0xcb,0xd8,0x5b,0x1b,0x5c,0x1a,0x5b,0x99, - 0x8b,0x99,0x5c,0x58,0x5b,0x99,0x58,0x9d,0x99,0x59,0x99,0xdc,0x97,0x59,0x19,0xdd, - 0x18,0xda,0x57,0x99,0x5b,0x98,0x18,0x5b,0xd9,0x10,0xe1,0x59,0x18,0x06,0x61,0x69, - 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x6e,0x61,0x74,0x69,0x76,0x65, - 0x5f,0x64,0x6f,0x75,0x62,0x6c,0x65,0x5f,0x64,0x69,0x73,0x61,0x62,0x6c,0x65,0x43, - 0x84,0xa7,0x61,0x14,0x96,0x26,0xe7,0x22,0x57,0xe6,0x46,0x56,0x26,0xf7,0x45,0x17, - 0x26,0x77,0x56,0x46,0xc7,0x28,0x2c,0x4d,0xce,0x25,0x4c,0xee,0xec,0x8b,0x2e,0x0f, - 0xae,0xec,0xcb,0x2d,0xac,0xad,0x8c,0x86,0x19,0xdb,0x5b,0x18,0x1d,0x0d,0x99,0xb0, - 0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xb7,0xb0,0xb6,0x32,0x2a,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x43,0x98,0xe7,0x59,0x84,0x07,0x7a,0xa2,0x47,0x7a, - 0xa6,0x21,0xc2,0x43,0x51,0x0a,0x4b,0x93,0x73,0x31,0x93,0x0b,0x3b,0x6b,0x2b,0x73, - 0xa3,0xfb,0x4a,0x73,0x83,0xab,0xa3,0xe3,0x52,0x37,0x57,0x26,0x87,0xc2,0xf6,0x36, - 0xe6,0x06,0x93,0x42,0x25,0x2c,0x4d,0xce,0x65,0xac,0xcc,0x8d,0xae,0x4c,0x8e,0x4f, - 0x58,0x9a,0x9c,0x0b,0x5c,0x99,0xdc,0x1c,0x5c,0xd9,0x18,0x5d,0x9a,0x5d,0x19,0x85, - 0x3a,0xbb,0x21,0xd2,0x22,0x3c,0xd6,0x73,0x3d,0xd8,0x93,0x3d,0xd0,0x13,0x3d,0xd2, - 0xa3,0x71,0xa9,0x9b,0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0x61,0x31,0xf6, - 0xc6,0xf6,0x26,0x37,0x44,0x5a,0x86,0xc7,0x7a,0xb8,0x07,0x7b,0xb2,0x07,0x7a,0xa2, - 0x47,0x7a,0x3a,0x2e,0x61,0x69,0x72,0x2e,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x94, - 0xc2,0xd2,0xe4,0x5c,0xd8,0xde,0xc6,0xc2,0xe8,0xd2,0xde,0xdc,0xbe,0xd2,0xdc,0xc8, - 0xca,0xf0,0xa8,0x84,0xa5,0xc9,0xb9,0xcc,0x85,0xb5,0xc1,0xb1,0x95,0x11,0xa3,0x2b, - 0xc3,0xa3,0xab,0x93,0x2b,0x93,0x21,0xe3,0x31,0x63,0x7b,0x0b,0xa3,0x63,0x01,0x99, - 0x0b,0x6b,0x83,0x63,0x2b,0xf3,0xe1,0x40,0x57,0x86,0x37,0x84,0x5a,0x8c,0xe7,0x7b, - 0xc0,0x60,0x11,0x96,0xe1,0x09,0x83,0x07,0x7a,0xc4,0xe0,0x91,0x9e,0x31,0xe0,0x12, - 0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7,0x56,0x26,0xc7,0x63,0x2e,0xac,0x0d,0x8e, - 0xad,0x4c,0x8e,0x08,0x5d,0x19,0xde,0x54,0x1b,0x1c,0x9b,0xdc,0x10,0x69,0x39,0x9e, - 0x32,0x78,0xc0,0x60,0x11,0x96,0xe1,0x81,0x1e,0x33,0x78,0xa4,0xe7,0x0c,0x86,0x20, - 0xcf,0xf6,0x78,0x0f,0x19,0x3c,0x68,0x30,0xc4,0x40,0x80,0xa7,0x7a,0xd2,0x60,0x44, - 0xc4,0x0e,0xec,0x60,0x0f,0xed,0xe0,0x06,0xed,0xf0,0x0e,0xe4,0x50,0x0f,0xec,0x50, - 0x0e,0x6e,0x60,0x0e,0xec,0x10,0x0e,0xe7,0x30,0x0f,0x53,0x82,0x60,0x84,0xc2,0x0e, - 0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x18, + 0x74,0xd0,0x06,0xf6,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,0x07,0x76, + 0xd0,0x06,0xf6,0x20,0x07,0x74,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0, + 0x06,0xf6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06, + 0xf6,0x40,0x07,0x78,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6, + 0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,0x90, + 0x07,0x76,0xa0,0x07,0x71,0x20,0x07,0x78,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,0x06, + 0xf6,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72,0x80,0x07,0x7a,0x10,0x07,0x72, + 0x80,0x07,0x6d,0x60,0x0f,0x71,0x90,0x07,0x72,0xa0,0x07,0x72,0x50,0x07,0x76,0xa0, + 0x07,0x72,0x50,0x07,0x76,0xd0,0x06,0xf6,0x20,0x07,0x75,0x60,0x07,0x7a,0x20,0x07, + 0x75,0x60,0x07,0x7a,0x20,0x07,0x75,0x60,0x07,0x6d,0x60,0x0f,0x75,0x10,0x07,0x72, + 0xa0,0x07,0x75,0x10,0x07,0x72,0xa0,0x07,0x75,0x10,0x07,0x72,0xd0,0x06,0xf6,0x10, + 0x07,0x70,0x20,0x07,0x74,0xa0,0x07,0x71,0x00,0x07,0x72,0x40,0x07,0x7a,0x10,0x07, + 0x70,0x20,0x07,0x74,0xd0,0x06,0xee,0x80,0x07,0x7a,0x10,0x07,0x76,0xa0,0x07,0x73, + 0x20,0x07,0x43,0x18,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x21,0x8c,0x03, + 0x04,0x80,0x00,0x00,0x00,0x00,0x00,0x40,0x16,0x08,0x00,0x00,0x00,0x08,0x00,0x00, + 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43, + 0x5a,0x25,0x30,0x02,0x50,0x04,0x85,0x50,0x10,0x65,0x40,0x70,0x2c,0x01,0x12,0x00, + 0x00,0x79,0x18,0x00,0x00,0xb7,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2, + 0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x42,0x3c,0x00,0x84,0x50, + 0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0xc2,0x23,0x2c, + 0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae, + 0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06, + 0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5, + 0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xf0,0x10,0x43,0x8c,0x45,0x58,0x8c,0x65,0x60, + 0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x79,0x8e,0x45,0x58,0x84,0x65,0xe0,0x16,0x96, + 0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7, + 0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x78,0x12,0x72,0x61,0x69, + 0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d, + 0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x67,0x21,0x19,0x84, + 0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95, + 0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x95,0xb9,0x85, + 0x89,0xb1,0x95,0x0d,0x11,0x9e,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59, + 0x99,0xdc,0x17,0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9, + 0xb3,0x2f,0xba,0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x64,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8, + 0x98,0xc9,0x85,0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0x9e,0x67,0x19,0x1e, + 0xe8,0x89,0x1e,0xe9,0x99,0x86,0x08,0x0f,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e, + 0xec,0xac,0xad,0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99, + 0x1c,0x0a,0xdb,0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37, + 0xba,0x32,0x39,0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74, + 0x69,0x76,0x65,0x14,0xea,0xec,0x86,0x48,0xcb,0xf0,0x58,0xcf,0xf5,0x60,0x4f,0xf6, + 0x40,0x4f,0xf4,0x48,0x8f,0xc6,0xa5,0x6e,0xae,0x4c,0x0e,0x85,0xed,0x6d,0xcc,0x2d, + 0x26,0x85,0xc5,0xd8,0x1b,0xdb,0x9b,0xdc,0x10,0x69,0x11,0x1e,0xeb,0xe1,0x1e,0xec, + 0xc9,0x1e,0xe8,0x89,0x1e,0xe9,0xe9,0xb8,0x84,0xa5,0xc9,0xb9,0xd0,0x95,0xe1,0xd1, + 0xd5,0xc9,0x95,0x51,0x0a,0x4b,0x93,0x73,0x61,0x7b,0x1b,0x0b,0xa3,0x4b,0x7b,0x73, + 0xfb,0x4a,0x73,0x23,0x2b,0xc3,0xa3,0x12,0x96,0x26,0xe7,0x32,0x17,0xd6,0x06,0xc7, + 0x56,0x46,0x8c,0xae,0x0c,0x8f,0xae,0x4e,0xae,0x4c,0x86,0x8c,0xc7,0x8c,0xed,0x2d, + 0x8c,0x8e,0x05,0x64,0x2e,0xac,0x0d,0x8e,0xad,0xcc,0x87,0x03,0x5d,0x19,0xde,0x10, + 0x6a,0x21,0x9e,0xef,0x01,0x83,0x65,0x58,0x84,0x27,0x0c,0x1e,0xe8,0x11,0x83,0x47, + 0x7a,0xc6,0x80,0x4b,0x58,0x9a,0x9c,0xcb,0x5c,0x58,0x1b,0x1c,0x5b,0x99,0x1c,0x8f, + 0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x0e,0x73,0x6d,0x70,0x43,0xa4,0xe5,0x78,0xca, + 0xe0,0x01,0x83,0x65,0x58,0x84,0x07,0x7a,0xcc,0xe0,0x91,0x9e,0x33,0x18,0x82,0x3c, + 0xdb,0xe3,0x3d,0x64,0xf0,0xa0,0xc1,0x10,0x03,0x01,0x9e,0xea,0x49,0x83,0x11,0x11, + 0x3b,0xb0,0x83,0x3d,0xb4,0x83,0x1b,0xb4,0xc3,0x3b,0x90,0x43,0x3d,0xb0,0x43,0x39, + 0xb8,0x81,0x39,0xb0,0x43,0x38,0x9c,0xc3,0x3c,0x4c,0x11,0x82,0x61,0x84,0xc2,0x0e, + 0xec,0x60,0x0f,0xed,0xe0,0x06,0xe9,0x40,0x0e,0xe5,0xe0,0x0e,0xf4,0x30,0x25,0x28, 0x46,0x2c,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xf6,0x50,0x0e,0xf2,0x30,0x0f,0xe9,0xf0, - 0x0e,0xee,0x30,0x25,0x20,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e, + 0x0e,0xee,0x30,0x25,0x30,0x46,0x50,0xe1,0x90,0x0e,0xf2,0xe0,0x06,0xec,0x10,0x0e, 0xee,0x70,0x0e,0xf5,0x10,0x0e,0xe7,0x50,0x0e,0xbf,0x60,0x0f,0xe5,0x20,0x0f,0xf3, - 0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x63,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30, + 0x90,0x0e,0xef,0xe0,0x0e,0x53,0x02,0x64,0xc4,0x14,0x0e,0xe9,0x20,0x0f,0x6e,0x30, 0x0e,0xef,0xd0,0x0e,0xf0,0x90,0x0e,0xec,0x50,0x0e,0xbf,0xf0,0x0e,0xf0,0x40,0x0f, - 0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53,0x08,0x44,0x61,0x9c,0x11,0x4c,0x38,0xa4,0x83, - 0x3c,0xb8,0x81,0x39,0xc8,0x43,0x38,0x9c,0x43,0x3b,0x94,0x83,0x3b,0xd0,0xc3,0x94, - 0x40,0x0d,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x6d,0x00,0x00,0x00,0x33,0x08,0x80, + 0xe9,0xf0,0x0e,0xee,0x30,0x0f,0x53,0x06,0x85,0x71,0x46,0x30,0xe1,0x90,0x0e,0xf2, + 0xe0,0x06,0xe6,0x20,0x0f,0xe1,0x70,0x0e,0xed,0x50,0x0e,0xee,0x40,0x0f,0x53,0x02, + 0x35,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, @@ -1205,18 +1187,22 @@ static const uint8_t _sfons_fs_bytecode_metal_ios[2877] = { 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21, 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43, 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87, - 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x00,0x00,0x00, - 0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00, - 0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d, - 0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x16,0x00,0x00, - 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0xc7,0x22, - 0x80,0x40,0x20,0x88,0x8d,0x00,0x8c,0x25,0x00,0x01,0xa9,0x11,0x80,0x1a,0x20,0x31, - 0x03,0x40,0x61,0x0e,0xc2,0xb2,0x2c,0x6a,0x06,0x80,0xc0,0x0c,0xc0,0x08,0xc0,0x18, - 0x01,0x08,0x82,0x20,0xfe,0x01,0x00,0x00,0x00,0x83,0x0c,0x0f,0x91,0x8c,0x18,0x28, - 0x42,0x70,0x39,0x4d,0x80,0x2c,0xc9,0x30,0xc8,0x70,0x04,0x8d,0x05,0x91,0x7c,0x66, - 0x1b,0x94,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c, + 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e, + 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c, + 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c, + 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x08,0x00,0x00, + 0x00,0x16,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, + 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x0d,0x00,0x00, + 0x00,0x61,0x20,0x00,0x00,0x16,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, + 0x00,0x0b,0x00,0x00,0x00,0x14,0xc7,0x22,0x80,0x40,0x20,0x88,0x8d,0x00,0x8c,0x25, + 0x00,0x01,0xa9,0x11,0x80,0x1a,0x20,0x31,0x03,0x40,0x61,0x0e,0xe2,0xba,0xae,0x6a, + 0x06,0x80,0xc0,0x0c,0xc0,0x08,0xc0,0x18,0x01,0x08,0x82,0x20,0xfe,0x01,0x00,0x00, + 0x00,0x83,0x0c,0x0f,0x91,0x8c,0x18,0x28,0x42,0x80,0x39,0x4d,0x80,0x2c,0xc9,0x30, + 0xc8,0x70,0x04,0x8d,0x05,0x91,0x7c,0x66,0x1b,0x94,0x00,0xc8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const char _sfons_vs_source_metal_sim[866] = { +static const char _sfons_vs_source_metal_sim[756] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1245,35 +1231,28 @@ static const char _sfons_vs_source_metal_sim[866] = { 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, 0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 0x61,0x74,0x20,0x70,0x73,0x69,0x7a,0x65,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, - 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67, - 0x6c,0x73,0x6c,0x22,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b, - 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, - 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20, - 0x22,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20, - 0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x5f,0x32,0x31,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x69,0x6e,0x2e, - 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x38,0x20,0x22,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a, - 0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x70,0x73,0x69,0x7a,0x65,0x3b, - 0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x39,0x20,0x22,0x73,0x66,0x6f,0x6e,0x73, - 0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75, - 0x76,0x20,0x3d,0x20,0x5f,0x32,0x31,0x2e,0x74,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, - 0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x23,0x6c,0x69, - 0x6e,0x65,0x20,0x32,0x30,0x20,0x22,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73, - 0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, + 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, + 0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, + 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20, + 0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72, + 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a, + 0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,0x69, + 0x7a,0x65,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e, + 0x74,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x74, + 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31, + 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; -static const char _sfons_fs_source_metal_sim[518] = { +static const char _sfons_fs_source_metal_sim[464] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1287,28 +1266,26 @@ static const char _sfons_fs_source_metal_sim[518] = { 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20, - 0x31,0x31,0x20,0x22,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a, - 0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f, - 0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69, - 0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d, - 0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f, - 0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72, - 0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20, - 0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b, - 0x7d,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x31,0x20,0x22,0x73,0x66,0x6f, - 0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74, - 0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31, - 0x2e,0x30,0x2c,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74, - 0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x2e,0x78, - 0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65, + 0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, + 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65, + 0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d, + 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b, + 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, + 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e, + 0x30,0x2c,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d, + 0x70,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x2e,0x78,0x79,0x29,0x2e,0x78,0x29,0x20, + 0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + }; #elif defined(SOKOL_D3D11) +FIXME FIXME FIXME static const uint8_t _sfons_vs_bytecode_hlsl4[1032] = { 0x44,0x58,0x42,0x43,0x09,0x96,0xbb,0xbb,0xfc,0x44,0x44,0xa8,0xa4,0x1c,0x9e,0x45, 0x50,0x97,0xf1,0xde,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, @@ -1419,49 +1396,7 @@ static const uint8_t _sfons_fs_bytecode_hlsl4[640] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -/* - WebGPU shader blobs: - - Vertex shader source: - - #version 450 - - layout(set = 0, binding = 0, std140) uniform vs_params - { - mat4 mvp; - mat4 tm; - } _21; - - layout(location = 0) in vec4 position; - layout(location = 3) in float psize; - layout(location = 0) out vec4 uv; - layout(location = 1) in vec2 texcoord0; - layout(location = 1) out vec4 color; - layout(location = 2) in vec4 color0; - - void main() - { - gl_Position = _21.mvp * position; - gl_PointSize = psize; - uv = _21.tm * vec4(texcoord0, 0.0, 1.0); - color = color0; - } - - Fragment shader source: - - #version 450 - - layout(location = 0, set = 2, binding = 0) uniform sampler2D tex; - - layout(location = 0) out vec4 frag_color; - layout(location = 0) in vec4 uv; - layout(location = 1) in vec4 color; - - void main() - { - frag_color = vec4(1.0, 1.0, 1.0, texture(tex, uv.xy).x) * color; - } -*/ +FIXME FIXME FIXME static const uint8_t _sfons_vs_bytecode_wgpu[1968] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, @@ -1664,6 +1599,7 @@ typedef struct _sfons_t { sg_shader shd; sgl_pipeline pip; sg_image img; + sg_sampler smp; int cur_width, cur_height; bool img_dirty; } _sfons_t; @@ -1678,8 +1614,7 @@ static void* _sfons_malloc(const sfons_allocator_t* allocator, size_t size) { void* ptr; if (allocator->alloc) { ptr = allocator->alloc(size, allocator->user_data); - } - else { + } else { ptr = malloc(size); } SOKOL_ASSERT(ptr); @@ -1696,8 +1631,7 @@ static void _sfons_free(const sfons_allocator_t* allocator, void* ptr) { SOKOL_ASSERT(allocator); if (allocator->free) { allocator->free(ptr, allocator->user_data); - } - else { + } else { free(ptr); } } @@ -1706,7 +1640,7 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { SOKOL_ASSERT(user_ptr && (width > 8) && (height > 8)); _sfons_t* sfons = (_sfons_t*) user_ptr; - /* sokol-gl compatible shader which treats RED channel as alpha */ + // sokol-gl compatible shader which treats RED channel as alpha if (sfons->shd.id == SG_INVALID_ID) { sg_shader_desc shd_desc; _sfons_clear(&shd_desc, sizeof(shd_desc)); @@ -1727,9 +1661,15 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { ub->uniforms[0].name = "vs_params"; ub->uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; ub->uniforms[0].array_count = 8; - shd_desc.fs.images[0].name = "tex"; + shd_desc.fs.images[0].used = true; shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT; + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + shd_desc.fs.samplers[0].used = true; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.image_sampler_pairs[0].used = true; + shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; + shd_desc.fs.image_sampler_pairs[0].image_slot = 0; + shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; shd_desc.label = "sokol-fontstash-shader"; #if defined(SOKOL_GLCORE33) shd_desc.vs.source = _sfons_vs_source_glsl330; @@ -1770,7 +1710,7 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { sfons->shd = sg_make_shader(&shd_desc); } - /* sokol-gl pipeline object */ + // sokol-gl pipeline object if (sfons->pip.id == SG_INVALID_ID) { sg_pipeline_desc pip_desc; _sfons_clear(&pip_desc, sizeof(pip_desc)); @@ -1781,7 +1721,17 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { sfons->pip = sgl_make_pipeline(&pip_desc); } - /* create or re-create font atlas texture */ + // a sampler object + if (sfons->smp.id == SG_INVALID_ID) { + sg_sampler_desc smp_desc; + _sfons_clear(&smp_desc, sizeof(smp_desc)); + smp_desc.min_filter = SG_FILTER_LINEAR; + smp_desc.mag_filter = SG_FILTER_LINEAR; + smp_desc.mipmap_filter = SG_FILTER_NONE; + sfons->smp = sg_make_sampler(&smp_desc); + } + + // create or re-create font atlas texture if (sfons->img.id != SG_INVALID_ID) { sg_destroy_image(sfons->img); sfons->img.id = SG_INVALID_ID; @@ -1794,8 +1744,6 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { _sfons_clear(&img_desc, sizeof(img_desc)); img_desc.width = sfons->cur_width; img_desc.height = sfons->cur_height; - img_desc.min_filter = SG_FILTER_LINEAR; - img_desc.mag_filter = SG_FILTER_LINEAR; img_desc.usage = SG_USAGE_DYNAMIC; img_desc.pixel_format = SG_PIXELFORMAT_R8; sfons->img = sg_make_image(&img_desc); @@ -1818,7 +1766,7 @@ static void _sfons_render_draw(void* user_ptr, const float* verts, const float* SOKOL_ASSERT(user_ptr && verts && tcoords && colors && (nverts > 0)); _sfons_t* sfons = (_sfons_t*) user_ptr; sgl_enable_texture(); - sgl_texture(sfons->img); + sgl_texture(sfons->img, sfons->smp); sgl_push_pipeline(); sgl_load_pipeline(sfons->pip); sgl_begin_triangles(); @@ -1837,6 +1785,10 @@ static void _sfons_render_delete(void* user_ptr) { sg_destroy_image(sfons->img); sfons->img.id = SG_INVALID_ID; } + if (sfons->smp.id != SG_INVALID_ID) { + sg_destroy_sampler(sfons->smp); + sfons->smp.id = SG_INVALID_ID; + } if (sfons->pip.id != SG_INVALID_ID) { sgl_destroy_pipeline(sfons->pip); sfons->pip.id = SG_INVALID_ID; @@ -1901,4 +1853,4 @@ SOKOL_API_IMPL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { return ((uint32_t)r) | ((uint32_t)g<<8) | ((uint32_t)b<<16) | ((uint32_t)a<<24); } -#endif /* SOKOL_FONTSTASH_IMPL */ +#endif // SOKOL_FONTSTASH_IMPL From 4768bcb0c207e4c4228d85d079dd768fa8c10d70 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 20 Jun 2023 19:37:16 +0200 Subject: [PATCH 035/292] sokol_gfx.h: add missing sg_init_sampler function --- sokol_gfx.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 811648e2e..0985c963a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2903,6 +2903,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(DEALLOC_PASS_INVALID_STATE, "sg_dealloc_pass(): pass must be in ALLOC state") \ _SG_LOGITEM_XMACRO(INIT_BUFFER_INVALID_STATE, "sg_init_buffer(): buffer must be in ALLOC state") \ _SG_LOGITEM_XMACRO(INIT_IMAGE_INVALID_STATE, "sg_init_image(): image must be in ALLOC state") \ + _SG_LOGITEM_XMACRO(INIT_SAMPLER_INVALID_STATE, "sg_init_sampler(): sampler must be in ALLOC state") \ _SG_LOGITEM_XMACRO(INIT_SHADER_INVALID_STATE, "sg_init_shader(): shader must be in ALLOC state") \ _SG_LOGITEM_XMACRO(INIT_PIPELINE_INVALID_STATE, "sg_init_pipeline(): pipeline must be in ALLOC state") \ _SG_LOGITEM_XMACRO(INIT_PASS_INVALID_STATE, "sg_init_pass(): pass must be in ALLOC state") \ @@ -16178,6 +16179,21 @@ SOKOL_API_IMPL void sg_init_image(sg_image img_id, const sg_image_desc* desc) { _SG_TRACE_ARGS(init_image, img_id, &desc_def); } +SOKOL_API_IMPL void sg_init_sampler(sg_sampler smp_id, const sg_sampler_desc* desc) { + SOKOL_ASSERT(_sg.valid); + sg_sampler_desc desc_def = _sg_sampler_desc_defaults(desc); + _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if (smp->slot.state == SG_RESOURCESTATE_ALLOC) { + _sg_init_sampler(smp, &desc_def); + SOKOL_ASSERT((smp->slot.state == SG_RESOURCESTATE_VALID) || (smp->slot.state == SG_RESOURCESTATE_FAILED)); + } else { + _SG_ERROR(INIT_SAMPLER_INVALID_STATE); + } + } + _SG_TRACE_ARGS(init_sampler, smp_id, &desc_def); +} + SOKOL_API_IMPL void sg_init_shader(sg_shader shd_id, const sg_shader_desc* desc) { SOKOL_ASSERT(_sg.valid); sg_shader_desc desc_def = _sg_shader_desc_defaults(desc); From 5c8c8e74a78934f03e8569e96d47fdc4ec1f9382 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 20 Jun 2023 19:53:29 +0200 Subject: [PATCH 036/292] sokol_spine.h: fixes for separate images/samplers (fixme: hlsl4 shaders) --- util/sokol_spine.h | 1057 +++++++++++++++++++++++--------------------- 1 file changed, 547 insertions(+), 510 deletions(-) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 2fd62c8d2..2d6841e6e 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -236,6 +236,7 @@ .overrides = { .min_filter = SG_FILTER_NEAREST, .mag_filter = SG_FILTER_NEAREST, + .mipmap_filter = SG_FILTER_NONE, .wrap_u = SG_WRAP_MIRROR, .wrap_v = SG_WRAP_MIRROR, .premul_alpha_enabled = ..., @@ -245,8 +246,8 @@ - The atlas file itself doesn't contain any texture data, it only contains filenames of the required textures. Sokol-spine has already allocated - a sokol-gfx sg_image handle for each required texture, but the actual - texture loading and initialization must be performed by user code: + a sokol-gfx sg_image and sg_sample handle for each required texture, but the + actual loading and initialization must be performed by user code: // iterate over atlas textures and initialize sokol-gfx image objects // with existing handles @@ -265,15 +266,20 @@ .width = ..., .height = ..., .pixel_format = ..., - .min_filter = img_info.min_filter, - .mag_filter = img_info.mag_filter, - .wrap_u = img_info.wrap_u, - .wrap_v = img_info.wrap_v, .data.subimage[0][0] = { .ptr = ..., // pointer to decoded image pixel data .size = ..., // size of decoded image pixel data in bytes } }); + + // ...and same procedure for the sampler object + sg_init_sampler(img_info.sgsampler, &(sg_image_desc){ + .min_filter = img_info.min_filter, + .mag_filter = img_info.mag_filter, + .mipmap_filter = img_info.mipmap_filter, + .wrap_u = img_info.wrap_u, + .wrap_v = img_info.wrap_v, + }); } If you load the image data asynchronously, you can still simply start rendering @@ -1021,6 +1027,7 @@ typedef enum sspine_resource_state { _SSPINE_LOGITEM_XMACRO(ATLAS_DESC_NO_DATA, "no data provided in sspine_atlas_desc.data")\ _SSPINE_LOGITEM_XMACRO(SPINE_ATLAS_CREATION_FAILED, "spAtlas_create() failed")\ _SSPINE_LOGITEM_XMACRO(SG_ALLOC_IMAGE_FAILED, "sg_alloc_image() failed")\ + _SSPINE_LOGITEM_XMACRO(SG_ALLOC_SAMPLER_FAILED, "sg_alloc_sampler() failed")\ _SSPINE_LOGITEM_XMACRO(SKELETON_DESC_NO_DATA, "no data provided in sspine_skeleton_desc.json_data or .binary_data")\ _SSPINE_LOGITEM_XMACRO(SKELETON_DESC_NO_ATLAS, "no atlas object provided in sspine_skeleton_desc.atlas")\ _SSPINE_LOGITEM_XMACRO(SKELETON_ATLAS_NOT_VALID, "sspine_skeleton_desc.atlas is not in valid state")\ @@ -1077,8 +1084,10 @@ typedef struct sspine_context_info { typedef struct sspine_image_info { bool valid; sg_image sgimage; + sg_sampler sgsampler; sg_filter min_filter; sg_filter mag_filter; + sg_filter mipmap_filter; sg_wrap wrap_u; sg_wrap wrap_v; int width; @@ -1090,6 +1099,7 @@ typedef struct sspine_image_info { typedef struct sspine_atlas_overrides { sg_filter min_filter; sg_filter mag_filter; + sg_filter mipmap_filter; sg_wrap wrap_u; sg_wrap wrap_v; bool premul_alpha_enabled; @@ -1426,7 +1436,7 @@ SOKOL_SPINE_API_DECL void sspine_set_skin(sspine_instance instance, sspine_skin /* Embedded source compiled with: - sokol-shdc -i sspine.glsl -o sspine.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b + sokol-shdc -i sspine.glsl -o sspine.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b @vs vs uniform vs_params { @@ -1445,7 +1455,8 @@ SOKOL_SPINE_API_DECL void sspine_set_skin(sspine_instance instance, sspine_skin @end @fs fs - uniform sampler2D tex; + uniform texture2D tex; + uniform sampler smp; uniform fs_params { float pma; }; @@ -1453,13 +1464,15 @@ SOKOL_SPINE_API_DECL void sspine_set_skin(sspine_instance instance, sspine_skin in vec4 color; out vec4 frag_color; void main() { - vec4 c0 = texture(tex, uv) * color; + vec4 c0 = texture(sampler2D(tex, smp), uv) * color; vec4 c1 = vec4(c0.rgb * c0.a, c0.a) * color; frag_color = mix(c0, c1, pma); } @end @program sspine vs fs + + @program sspine vs fs */ #if defined(SOKOL_GLCORE33) static const char _sspine_vs_source_glsl330[352] = { @@ -1485,27 +1498,29 @@ static const char _sspine_vs_source_glsl330[352] = { 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78, 0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f, 0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + }; -static const char _sspine_fs_source_glsl330[300] = { +static const char _sspine_fs_source_glsl330[308] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x70,0x61, 0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d, - 0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a, - 0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20, - 0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f, - 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29, - 0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, - 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32, - 0x35,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x2c, - 0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32, - 0x35,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x5f,0x32,0x35,0x2c,0x20,0x76, - 0x65,0x63,0x34,0x28,0x5f,0x32,0x35,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x5f,0x33, - 0x34,0x2c,0x20,0x5f,0x33,0x34,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2c, - 0x20,0x76,0x65,0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, - 0x30,0x5d,0x2e,0x78,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73, + 0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b, + 0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20, + 0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, + 0x34,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, + 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, + 0x5f,0x33,0x37,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69, + 0x78,0x28,0x5f,0x32,0x38,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x32,0x38,0x2e, + 0x78,0x79,0x7a,0x20,0x2a,0x20,0x5f,0x33,0x37,0x2c,0x20,0x5f,0x33,0x37,0x29,0x20, + 0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x66,0x73, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x29,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_GLES3) static const char _sspine_vs_source_glsl300es[355] = { @@ -1533,7 +1548,7 @@ static const char _sspine_vs_source_glsl300es[355] = { 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d, 0x0a,0x0a,0x00, }; -static const char _sspine_fs_source_glsl300es[391] = { +static const char _sspine_fs_source_glsl300es[399] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, @@ -1541,26 +1556,27 @@ static const char _sspine_fs_source_glsl300es[391] = { 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, 0x34,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a, 0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61, - 0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x3b,0x0a,0x0a,0x69,0x6e, - 0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, - 0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61, - 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69, - 0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28, - 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, - 0x63,0x34,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x28,0x74,0x65,0x78,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f, - 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32,0x35,0x2e,0x77,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, - 0x20,0x6d,0x69,0x78,0x28,0x5f,0x32,0x35,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x5f, - 0x32,0x35,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x5f,0x33,0x34,0x2c,0x20,0x5f,0x33, - 0x34,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x76,0x65,0x63,0x34, - 0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29, - 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b, + 0x0a,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20, + 0x75,0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, + 0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75, + 0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61, + 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, + 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68, + 0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76, + 0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68, + 0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x37,0x20,0x3d, + 0x20,0x5f,0x32,0x38,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, + 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x5f,0x32,0x38, + 0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x32,0x38,0x2e,0x78,0x79,0x7a,0x20,0x2a, + 0x20,0x5f,0x33,0x37,0x2c,0x20,0x5f,0x33,0x37,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c, + 0x6f,0x72,0x2c,0x20,0x76,0x65,0x63,0x34,0x28,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) +FIXME FIXME FIXME static const uint8_t _sspine_vs_bytecode_hlsl4[844] = { 0x44,0x58,0x42,0x43,0xb2,0xdb,0x57,0x6f,0x29,0xa5,0x26,0x49,0xa3,0x0e,0xb4,0x9e, 0x0f,0x0d,0x7f,0xcd,0x01,0x00,0x00,0x00,0x4c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, @@ -1674,17 +1690,17 @@ static const uint8_t _sspine_fs_bytecode_hlsl4[876] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_METAL) -static const uint8_t _sspine_vs_bytecode_metal_macos[3068] = { +static const uint8_t _sspine_vs_bytecode_metal_macos[3084] = { 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xfc,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, - 0xf0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, + 0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x00,0x1c,0x82,0xf4,0xbb,0x79,0xa7, - 0x30,0x7f,0x4a,0xbc,0xb6,0x93,0x11,0x29,0xf6,0x24,0x44,0x87,0xfa,0x98,0x7e,0xd3, - 0x73,0xca,0x18,0xc6,0xe1,0x22,0x50,0x45,0x09,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x1d,0x26,0xf7,0xce,0x5d,0x78,0x21, + 0x2f,0xa7,0x97,0xe1,0xbd,0x15,0x30,0xfb,0xa6,0x98,0xcc,0x1d,0xba,0x1d,0x0d,0x92, + 0xaa,0x4e,0x3d,0x75,0xee,0x73,0x36,0x7c,0x99,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, @@ -1692,8 +1708,8 @@ static const uint8_t _sspine_vs_bytecode_metal_macos[3068] = { 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, 0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b, - 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xdc,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, - 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xb4,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, + 0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xe0,0x0a,0x00,0x00,0xff,0xff,0xff,0xff, + 0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,0xb5,0x02,0x00,0x00,0x0b,0x82,0x20,0x00, 0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49, 0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62, 0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49, @@ -1766,107 +1782,108 @@ static const uint8_t _sspine_vs_bytecode_metal_macos[3068] = { 0x07,0x71,0x60,0x07,0x7a,0x30,0x07,0x72,0x30,0x84,0x49,0x00,0x00,0x08,0x00,0x00, 0x00,0x00,0x00,0xc8,0x02,0x01,0x00,0x00,0x0a,0x00,0x00,0x00,0x32,0x1e,0x98,0x10, 0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50, - 0x04,0x05,0x18,0x50,0x08,0x05,0x51,0x06,0x05,0x42,0x6d,0x04,0x80,0xd8,0x58,0x02, - 0x33,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xea,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10, + 0x04,0x05,0x18,0x50,0x08,0x05,0x51,0x06,0x05,0x42,0x6d,0x04,0x80,0xd8,0x58,0x42, + 0x13,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xeb,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10, 0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32,0x28, 0x00,0xa3,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c, - 0x81,0x22,0x2c,0x05,0xe3,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c, - 0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xa5, - 0x46,0x46,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06, - 0x26,0xc6,0xa5,0x46,0x46,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x8c,0x45, - 0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82,0x45,0xe0,0x16, - 0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26, - 0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72,0x61, - 0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f, - 0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65,0x61,0x19, - 0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5, - 0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5, - 0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5d,0x99, - 0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9,0x32,0x39, - 0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72,0x67,0x5f, - 0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64, - 0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51,0xa8,0xb3, - 0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b,0x2b,0x93, - 0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6,0xf6,0x16,0x46,0x47,0xc3,0x62, - 0xec,0x8d,0xed,0x4d,0x6e,0x08,0xa3,0x3c,0x8a,0xa5,0x44,0xca,0xa5,0x4c,0x0a,0x46, - 0x26,0x2c,0x4d,0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x8d,0xcb,0x19,0xdb, - 0x17,0xd4,0xdb,0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10,0x45,0xd1,0x94,0x48,0xb9,0x94, - 0x49,0xd9,0x86,0x18,0x4a,0xa5,0x64,0x0a,0x47,0x28,0x2c,0x4d,0xce,0xc5,0xae,0x4c, - 0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c,0x0b,0xdb, - 0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xbd,0xb3,0x32, - 0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0xaf,0xaf,0xb0,0x34,0xb9,0x2f,0x38,0xb6, - 0xb0,0xb1,0x32,0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf,0xaf,0x14,0x22,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x45,0x50,0x3c,0xe5,0x5b,0x84,0x25,0x50,0xc0, - 0x40,0x89,0x14,0x49,0x99,0x94,0x30,0x60,0x42,0x57,0x86,0x37,0xf6,0xf6,0x26,0x47, - 0x06,0x33,0x84,0x5a,0x02,0xc5,0x53,0xbe,0x25,0x58,0x02,0x05,0x0c,0x94,0x48,0x91, - 0x94,0x49,0x19,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65,0x50,0x3c, - 0xe5,0x5b,0x86,0x25,0x50,0xc0,0x40,0x89,0x94,0x4b,0x99,0x94,0x32,0xa0,0x12,0x96, - 0x26,0xe7,0x22,0x56,0x67,0x66,0x56,0x26,0xc7,0x27,0x2c,0x4d,0xce,0x45,0xac,0xce, - 0xcc,0xac,0x4c,0xee,0x6b,0x2e,0x4d,0xaf,0x8c,0x48,0x58,0x9a,0x9c,0x8b,0x5c,0x59, - 0x18,0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f,0xba,0x3c, - 0xb8,0xb2,0xaf,0x34,0x37,0xb3,0x37,0x22,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34, - 0x1c,0xda,0xec,0xe0,0x86,0x28,0x8b,0xb0,0x10,0x8b,0xa0,0xac,0x81,0xc2,0x06,0x8c, - 0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xe6,0xd2,0xf4, - 0xca,0x78,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0x85, - 0xb1,0xa5,0x9d,0xb9,0x7d,0xcd,0xa5,0xe9,0x95,0x31,0xb1,0x9b,0xfb,0x82,0x0b,0x93, - 0x0b,0x6b,0x9b,0xe3,0xf0,0x25,0x13,0x33,0x84,0x0c,0x96,0x43,0x39,0x03,0x05,0x0d, - 0x16,0x42,0xf9,0x16,0x61,0x09,0x94,0x34,0x50,0xd4,0x40,0x69,0x03,0xc5,0x0d,0x16, - 0x42,0x79,0x83,0x05,0x51,0x22,0x05,0x0e,0x94,0x49,0x89,0x83,0x21,0x88,0x22,0x06, - 0x0a,0x19,0x28,0x66,0xa0,0xc8,0xc1,0x10,0x23,0x01,0x94,0x4e,0x99,0x03,0x3e,0x6f, - 0x6d,0x6e,0x69,0x70,0x6f,0x74,0x65,0x6e,0x74,0x20,0x63,0x68,0x61,0x72,0x7c,0xa6, - 0xd2,0xda,0xe0,0xd8,0xca,0x40,0x86,0x56,0x56,0x40,0xa8,0x84,0x82,0x82,0x86,0x08, - 0x8a,0x1d,0x0c,0x31,0x94,0x3a,0x50,0xee,0xa0,0x49,0x86,0x18,0x0a,0x1e,0x28,0x78, - 0xd0,0x24,0x23,0x22,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77,0x20,0x87, - 0x7a,0x60,0x87,0x72,0x70,0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98,0x22,0x04, - 0xc3,0x08,0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca,0xc1,0x1d, - 0xe8,0x61,0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4, - 0x61,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d,0xe4,0xc1, - 0x0d,0xd8,0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e,0xc1,0x1e, - 0xca,0x41,0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29,0x1c,0xd2, - 0x41,0x1e,0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c,0x7e,0xe1, - 0x1d,0xe0,0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x0c,0x0a,0xe3,0x8c,0x50, - 0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x81,0x1e,0xca,0x01,0x1f,0xa6, - 0x04,0x74,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c, - 0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07, - 0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e, - 0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43, - 0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c, - 0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76, - 0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e, - 0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8, - 0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4, - 0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68, - 0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07, - 0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71, - 0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5, - 0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4, - 0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90, - 0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43, - 0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b, - 0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78, - 0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2, - 0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20, - 0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0, - 0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83, - 0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07, - 0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61, - 0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d, - 0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39, - 0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79, - 0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3, - 0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4, - 0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8, - 0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83, - 0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x02,0x00,0x00,0x00, - 0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xf4,0xc6,0x22,0x82, - 0x20,0x08,0x46,0x00,0xa8,0x95,0x40,0x19,0xd0,0x98,0x01,0xa0,0x30,0x03,0x00,0x00, - 0xe3,0x15,0x07,0x33,0x4d,0x0c,0x05,0x65,0x90,0x81,0x19,0x0e,0x13,0x02,0xf9,0x8c, - 0x57,0x2c,0xd0,0x75,0x21,0x14,0x94,0x41,0x06,0xe8,0x60,0x4c,0x08,0xe4,0x63,0x41, - 0x01,0x9f,0xf1,0x0a,0xa8,0xe2,0x38,0x86,0x82,0x62,0x43,0x00,0x9f,0xd9,0x06,0xa7, - 0x02,0x66,0x1b,0x82,0x2a,0x98,0x6d,0x08,0x06,0x21,0x83,0x80,0x18,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0x5b,0x86,0x20,0xc8,0x83,0x2d,0x43,0x11,0xe4,0xc1,0x96,0x41, - 0x09,0xf2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x81,0x22,0x2c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c, + 0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5, + 0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06, + 0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58, + 0x8c,0x45,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82,0x45, + 0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6, + 0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12, + 0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73, + 0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x04,0x65, + 0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9, + 0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d, + 0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11,0x94,0x86,0x51,0x58,0x9a,0x9c,0x8b, + 0x5d,0x99,0x1c,0x5d,0x19,0xde,0xd7,0x5b,0x1d,0x1d,0x5c,0x1d,0x1d,0x97,0xba,0xb9, + 0x32,0x39,0x14,0xb6,0xb7,0x31,0x37,0x98,0x14,0x46,0x61,0x69,0x72,0x2e,0x61,0x72, + 0x67,0x5f,0x74,0x79,0x70,0x65,0x5f,0x6e,0x61,0x6d,0x65,0x34,0xcc,0xd8,0xde,0xc2, + 0xe8,0x64,0xc8,0x84,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xb9,0x85,0xb5,0x95,0x51, + 0xa8,0xb3,0x1b,0xc2,0x28,0x8f,0x02,0x29,0x91,0x22,0x29,0x93,0x42,0x71,0xa9,0x9b, + 0x2b,0x93,0x43,0x61,0x7b,0x1b,0x73,0x8b,0x49,0xa1,0x61,0xc6,0xf6,0x16,0x46,0x47, + 0xc3,0x62,0xec,0x8d,0xed,0x4d,0x6e,0x08,0xa3,0x3c,0x8a,0xa5,0x44,0xca,0xa5,0x4c, + 0x0a,0x46,0x26,0x2c,0x4d,0xce,0x05,0xee,0x6d,0x2e,0x8d,0x2e,0xed,0xcd,0x8d,0xcb, + 0x19,0xdb,0x17,0xd4,0xdb,0x5c,0x1a,0x5d,0xda,0x9b,0xdb,0x10,0x45,0xd1,0x94,0x48, + 0xb9,0x94,0x49,0xd9,0x86,0x18,0x4a,0xa5,0x64,0x0a,0x47,0x28,0x2c,0x4d,0xce,0xc5, + 0xae,0x4c,0x8e,0xae,0x0c,0xef,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x52,0x58,0x9a,0x9c, + 0x0b,0xdb,0xdb,0x58,0x18,0x5d,0xda,0x9b,0xdb,0x57,0x9a,0x1b,0x59,0x19,0x1e,0xbd, + 0xb3,0x32,0xb7,0x32,0xb9,0x30,0xba,0x32,0x32,0x94,0xaf,0xaf,0xb0,0x34,0xb9,0x2f, + 0x38,0xb6,0xb0,0xb1,0x32,0xb4,0x37,0x36,0xb2,0x32,0xb9,0xaf,0xaf,0x14,0x22,0x70, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x43,0xa8,0x45,0x50,0x3c,0xe5,0x5b,0x84,0x25, + 0x50,0xc0,0x40,0x89,0x14,0x49,0x99,0x94,0x30,0x60,0x42,0x57,0x86,0x37,0xf6,0xf6, + 0x26,0x47,0x06,0x33,0x84,0x5a,0x02,0xc5,0x53,0xbe,0x25,0x58,0x02,0x05,0x0c,0x94, + 0x48,0x91,0x94,0x49,0x19,0x03,0x1a,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x43,0xa8,0x65, + 0x50,0x3c,0xe5,0x5b,0x86,0x25,0x50,0xc0,0x40,0x89,0x94,0x4b,0x99,0x94,0x32,0xa0, + 0x12,0x96,0x26,0xe7,0x22,0x56,0x67,0x66,0x56,0x26,0xc7,0x27,0x2c,0x4d,0xce,0x45, + 0xac,0xce,0xcc,0xac,0x4c,0xee,0x6b,0x2e,0x4d,0xaf,0x8c,0x48,0x58,0x9a,0x9c,0x8b, + 0x5c,0x59,0x18,0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f, + 0xba,0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3,0x37,0x22,0x66,0x6c,0x6f,0x61,0x74,0x34, + 0x78,0x34,0x1c,0xda,0xec,0xe0,0x86,0x28,0x8b,0xb0,0x10,0x8b,0xa0,0xac,0x81,0xc2, + 0x06,0x8c,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xe6, + 0xd2,0xf4,0xca,0x78,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95, + 0x7d,0x85,0xb1,0xa5,0x9d,0xb9,0x7d,0xcd,0xa5,0xe9,0x95,0x31,0xb1,0x9b,0xfb,0x82, + 0x0b,0x93,0x0b,0x6b,0x9b,0xe3,0xf0,0x15,0x93,0x33,0x84,0x0c,0x96,0x43,0x39,0x03, + 0x05,0x0d,0x16,0x42,0xf9,0x16,0x61,0x09,0x94,0x34,0x50,0xd4,0x40,0x69,0x03,0xc5, + 0x0d,0x16,0x42,0x79,0x83,0x05,0x51,0x22,0x05,0x0e,0x94,0x49,0x89,0x83,0x21,0x88, + 0x22,0x06,0x0a,0x19,0x28,0x66,0xa0,0xc8,0xc1,0x10,0x23,0x01,0x94,0x4e,0x99,0x03, + 0x3e,0x6f,0x6d,0x6e,0x69,0x70,0x6f,0x74,0x65,0x6e,0x74,0x20,0x63,0x68,0x61,0x72, + 0x7c,0xa6,0xd2,0xda,0xe0,0xd8,0xca,0x40,0x86,0x56,0x56,0x40,0xa8,0x84,0x82,0x82, + 0x86,0x08,0x8a,0x1d,0x0c,0x31,0x94,0x3a,0x50,0xee,0xa0,0x49,0x86,0x18,0x0a,0x1e, + 0x28,0x78,0xd0,0x24,0x23,0x22,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x77, + 0x20,0x87,0x7a,0x60,0x87,0x72,0x70,0x03,0x73,0x60,0x87,0x70,0x38,0x87,0x79,0x98, + 0x22,0x04,0xc3,0x08,0x85,0x1d,0xd8,0xc1,0x1e,0xda,0xc1,0x0d,0xd2,0x81,0x1c,0xca, + 0xc1,0x1d,0xe8,0x61,0x4a,0x50,0x8c,0x58,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1, + 0x1c,0xe4,0x61,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x4a,0x60,0x8c,0xa0,0xc2,0x21,0x1d, + 0xe4,0xc1,0x0d,0xd8,0x21,0x1c,0xdc,0xe1,0x1c,0xea,0x21,0x1c,0xce,0xa1,0x1c,0x7e, + 0xc1,0x1e,0xca,0x41,0x1e,0xe6,0x21,0x1d,0xde,0xc1,0x1d,0xa6,0x04,0xc8,0x88,0x29, + 0x1c,0xd2,0x41,0x1e,0xdc,0x60,0x1c,0xde,0xa1,0x1d,0xe0,0x21,0x1d,0xd8,0xa1,0x1c, + 0x7e,0xe1,0x1d,0xe0,0x81,0x1e,0xd2,0xe1,0x1d,0xdc,0x61,0x1e,0xa6,0x0c,0x0a,0xe3, + 0x8c,0x50,0xc2,0x21,0x1d,0xe4,0xc1,0x0d,0xec,0xa1,0x1c,0xe4,0x81,0x1e,0xca,0x01, + 0x1f,0xa6,0x04,0x74,0x00,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00, + 0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3, + 0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10, + 0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30, + 0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03, + 0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07, + 0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e, + 0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d, + 0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b, + 0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76, + 0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90, + 0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87, + 0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e, + 0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c, + 0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca, + 0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8, + 0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82, + 0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83, + 0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f, + 0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec, + 0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc, + 0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0, + 0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60, + 0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e, + 0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1, + 0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43, + 0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c, + 0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72, + 0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1, + 0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38, + 0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8, + 0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00, + 0x02,0x00,0x00,0x00,0x06,0x50,0x30,0x00,0xd2,0xd0,0x00,0x00,0x61,0x20,0x00,0x00, + 0x1e,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x05,0x00,0x00,0x00, + 0xf4,0xc6,0x22,0x82,0x20,0x08,0x46,0x00,0xa8,0x95,0x40,0x19,0xd0,0x98,0x01,0xa0, + 0x30,0x03,0x00,0x00,0xe3,0x15,0x07,0x33,0x4d,0x0c,0x05,0x65,0x90,0x81,0x19,0x0e, + 0x13,0x02,0xf9,0x8c,0x57,0x2c,0xd0,0x75,0x21,0x14,0x94,0x41,0x06,0xe8,0x60,0x4c, + 0x08,0xe4,0x63,0x41,0x01,0x9f,0xf1,0x0a,0xa8,0xe2,0x38,0x86,0x82,0x62,0x43,0x00, + 0x9f,0xd9,0x06,0xa7,0x02,0x66,0x1b,0x82,0x2a,0x98,0x6d,0x08,0x06,0x21,0x83,0x80, + 0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5b,0x86,0x20,0xc8,0x83,0x2d,0x43,0x11, + 0xe4,0xc1,0x96,0x41,0x09,0xf2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; static const uint8_t _sspine_fs_bytecode_metal_macos[3257] = { 0x4d,0x54,0x4c,0x42,0x01,0x80,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -1876,15 +1893,15 @@ static const uint8_t _sspine_fs_bytecode_metal_macos[3257] = { 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xeb,0x62,0x74,0xda,0xdc,0xfb,0x51, - 0x12,0x89,0xbd,0xc2,0xa1,0xdc,0x89,0x67,0x5f,0x96,0x17,0x50,0xd6,0x8b,0xbc,0x5d, - 0xa9,0xe9,0x5d,0xef,0xeb,0x59,0xe4,0x51,0x64,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0x47,0xc7,0x1e,0x49,0x53,0x1c,0xe5, + 0x90,0x01,0xa5,0x57,0x9a,0x30,0x01,0x5c,0x39,0x85,0x9f,0xb2,0x71,0x51,0xe1,0x73, + 0x0c,0xa4,0x4d,0xb1,0x81,0x33,0x8d,0x17,0x1e,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0xc8,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0xef,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0xc4,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0xee,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, @@ -1964,114 +1981,114 @@ static const uint8_t _sspine_fs_bytecode_metal_macos[3257] = { 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x0c,0x61,0x24,0x20,0x00,0x06,0x00,0x00,0x00, 0x00,0x00,0xb2,0x40,0x00,0x09,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c, 0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x7a,0x23,0x00,0x25,0x50,0x08,0x45,0x50, - 0x10,0x65,0x40,0x78,0x04,0x80,0xe8,0x58,0x02,0x33,0x00,0x00,0x00,0x79,0x18,0x00, - 0x00,0xfa,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, + 0x10,0x65,0x40,0x78,0x04,0x80,0xe8,0x58,0x42,0x13,0x00,0x00,0x00,0x79,0x18,0x00, + 0x00,0xf9,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32, 0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x63,0x4c,0x00,0xa5,0x50,0xb9,0x1b,0x43,0x0b, - 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x3c,0xc4,0x24,0x3c,0x05,0xe3,0x20,0x08, + 0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x3c,0xc4,0x24,0x3c,0x05,0xe7,0x20,0x08, 0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed, - 0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xa5,0x46,0x46,0x06,0x04,0xa5,0xad,0x8c, - 0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xa5,0x46,0x46,0x26,0x65, - 0x88,0x30,0x11,0x43,0x8c,0x87,0x78,0x8e,0x67,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36, - 0x04,0x99,0x8e,0x87,0x78,0x88,0x67,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06, - 0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17, - 0x26,0xc6,0x56,0x36,0x44,0x98,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70, - 0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f,0x65,0x6e, - 0x61,0x62,0x6c,0x65,0x43,0x84,0x69,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c,0xbd,0xb5, - 0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99,0x95,0xc9, - 0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95,0x0d,0x11, - 0xa6,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17,0x5d,0x98, - 0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba,0x3c,0xb8, - 0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64,0xc2,0xd2, - 0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85,0x9d,0x7d, - 0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0xa6,0xe7,0x19,0x26,0x68,0x8a,0x26,0x69,0x9a, - 0x86,0x08,0x13,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad,0xcc,0x8d, - 0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb,0x98, - 0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39,0x3e,0x61, - 0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65,0x34,0xcc, - 0xd8,0xde,0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x9e,0x61,0xb2,0xa6,0x6b,0xc2, - 0xa6,0x6c,0x82,0x26,0x6d,0x92,0xa6,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb,0xdb, - 0x98,0x5b,0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21,0xd2,0x43,0x4c,0xd6,0xd4, - 0x4d,0xd8,0x94,0x4d,0xd0,0x14,0x4d,0xd2,0xe4,0x51,0x09,0x4b,0x93,0x73,0x11,0xab, - 0x33,0x33,0x2b,0x93,0xe3,0x13,0x96,0x26,0xe7,0x22,0x56,0x67,0x66,0x56,0x26,0xf7, - 0x35,0x97,0xa6,0x57,0x46,0x29,0x2c,0x4d,0xce,0x85,0xed,0x6d,0x2c,0x8c,0x2e,0xed, - 0xcd,0xed,0x2b,0xcd,0x8d,0xac,0x0c,0x8f,0x48,0x58,0x9a,0x9c,0x8b,0x5c,0x59,0x18, - 0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f,0xba,0x3c,0xb8, - 0xb2,0xaf,0x34,0x37,0xb3,0x37,0x16,0x66,0x6c,0x6f,0x61,0x74,0x1c,0xe0,0xda,0xc2, - 0x86,0x28,0xcf,0xf0,0x14,0xcf,0x30,0x95,0xc1,0x64,0x06,0x8c,0xc2,0xd2,0xe4,0x5c, - 0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xe6,0xd2,0xf4,0xca,0x78,0x85,0xa5, - 0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0x85,0xb1,0xa5,0x9d,0xb9, - 0x7d,0xcd,0xa5,0xe9,0x95,0x31,0x31,0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b,0xe3, - 0xf0,0x55,0x03,0x33,0x84,0x0c,0x1e,0x63,0x02,0x83,0x29,0x0c,0x9e,0x62,0x12,0x83, - 0x67,0x78,0x88,0x69,0x0c,0x26,0x32,0x98,0xce,0x60,0x42,0x83,0xa7,0x98,0xd2,0xe0, - 0x29,0x26,0x68,0x52,0x83,0x49,0x9a,0xd6,0x80,0x4b,0x58,0x9a,0x9c,0x0b,0x5d,0x19, - 0x1e,0x5d,0x9d,0x5c,0x19,0x95,0xb0,0x34,0x39,0x97,0xb9,0xb0,0x36,0x38,0xb6,0x32, - 0x62,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74, - 0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3e,0x1c,0xe8,0xca,0xf0,0x86,0x50,0x0f, - 0x32,0xb5,0xc1,0x24,0x06,0xcf,0xf0,0x10,0x93,0x1b,0x4c,0xd0,0xf4,0x06,0x93,0x34, - 0xc1,0x01,0x97,0xb0,0x34,0x39,0x97,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x1e,0x73, - 0x61,0x6d,0x70,0x6c,0x65,0x72,0x44,0xe8,0xca,0xf0,0xa6,0xda,0xe0,0xd8,0xe4,0x86, - 0x48,0x4f,0x31,0xc9,0xc1,0x24,0x06,0xcf,0xf0,0x10,0x13,0x34,0xcd,0xc1,0x24,0x4d, - 0x74,0x30,0x44,0x99,0xb8,0xe9,0x9b,0xd8,0x60,0x8a,0x83,0xa9,0x0e,0x86,0x18,0x0b, - 0x30,0x55,0x93,0x1d,0xd0,0xf9,0xd2,0xa2,0x9a,0xca,0x31,0x9b,0xfb,0x82,0x0b,0x93, - 0x0b,0x6b,0x9b,0xe3,0xf3,0xd6,0xe6,0x96,0x06,0xf7,0x46,0x57,0xe6,0x46,0x07,0x32, - 0x86,0x16,0x26,0xc7,0x67,0x2a,0xad,0x0d,0x8e,0xad,0x0c,0x64,0x68,0x65,0x05,0x84, - 0x4a,0x28,0x28,0x68,0x88,0x30,0xe9,0xc1,0x10,0x63,0xca,0x83,0x69,0x0f,0xb0,0x64, - 0x88,0x31,0x95,0xc1,0xc4,0x07,0x58,0x32,0xc4,0x98,0xf0,0x60,0xea,0x03,0x2c,0x19, - 0x62,0x4c,0x7e,0x30,0xf5,0x01,0x96,0x8c,0x88,0xd8,0x81,0x1d,0xec,0xa1,0x1d,0xdc, - 0xa0,0x1d,0xde,0x81,0x1c,0xea,0x81,0x1d,0xca,0xc1,0x0d,0xcc,0x81,0x1d,0xc2,0xe1, - 0x1c,0xe6,0x61,0x8a,0x10,0x0c,0x23,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x48, - 0x07,0x72,0x28,0x07,0x77,0xa0,0x87,0x29,0x41,0x31,0x62,0x09,0x87,0x74,0x90,0x07, - 0x37,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x81,0x31,0x82, - 0x0a,0x87,0x74,0x90,0x07,0x37,0x60,0x87,0x70,0x70,0x87,0x73,0xa8,0x87,0x70,0x38, - 0x87,0x72,0xf8,0x05,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12, - 0x20,0x23,0xa6,0x70,0x48,0x07,0x79,0x70,0x83,0x71,0x78,0x87,0x76,0x80,0x87,0x74, - 0x60,0x87,0x72,0xf8,0x85,0x77,0x80,0x07,0x7a,0x48,0x87,0x77,0x70,0x87,0x79,0x98, - 0x32,0x28,0x8c,0x33,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87, - 0x73,0x68,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0xdc,0x01,0x00,0x00,0x79,0x18,0x00, - 0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d, - 0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c, - 0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d, - 0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d, - 0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79, - 0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc, - 0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50, - 0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30, - 0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03, - 0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07, - 0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76, - 0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98, - 0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8, - 0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21, - 0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43, - 0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f, - 0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70, - 0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0, - 0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40, - 0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41, - 0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e, - 0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07, - 0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f, - 0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d, - 0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38, - 0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88, - 0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08, - 0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50, - 0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01, - 0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03, - 0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c, - 0x00,0x71,0x20,0x00,0x00,0x0b,0x00,0x00,0x00,0x26,0xb0,0x01,0x48,0xe4,0x4b,0x00, - 0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d, - 0x00,0x05,0x03,0x20,0x0d,0x6d,0x01,0x0d,0x80,0x44,0x3e,0x83,0x5c,0x7e,0x85,0x17, - 0xb7,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x25,0x00,0x00,0x00,0x13,0x04,0x41, - 0x2c,0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x74,0x47,0x00,0xc6,0x22,0x80,0x40, - 0x38,0xe6,0x20,0x06,0xc2,0xa8,0xc8,0xd5,0xc0,0x08,0x00,0xbd,0x19,0x00,0x82,0x23, - 0x00,0x54,0xc7,0x1a,0x80,0x40,0x18,0x6b,0x18,0x86,0x81,0xec,0x0c,0x00,0x89,0x19, - 0x00,0x0a,0x33,0x00,0x04,0x46,0x00,0x00,0x00,0x23,0x06,0xca,0x10,0x6c,0x8f,0x23, - 0x29,0x47,0x12,0x58,0x20,0xc9,0x67,0x90,0x21,0x20,0x90,0x41,0x06,0xa1,0x40,0x4c, - 0x08,0xe4,0x33,0xc8,0x10,0x24,0xd0,0x20,0x43,0x50,0x48,0x16,0x60,0xf2,0x19,0x6f, - 0xc0,0x38,0x31,0xa0,0x60,0xcc,0x31,0x30,0x01,0x19,0x0c,0x32,0x04,0x0d,0x36,0x62, - 0x60,0x08,0x01,0x1a,0x2c,0x45,0x30,0xdb,0x00,0x05,0x40,0x06,0x01,0x31,0x00,0x00, - 0x00,0x02,0x00,0x00,0x00,0x5b,0x86,0x24,0xf8,0x03,0x00,0x00,0x00,0x00,0x00,0x00, + 0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c, + 0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45, + 0x26,0x65,0x88,0x30,0x11,0x43,0x8c,0x87,0x78,0x8e,0x67,0x60,0xd1,0x54,0x46,0x17, + 0xc6,0x36,0x04,0x99,0x8e,0x87,0x78,0x88,0x67,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6, + 0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96, + 0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x98,0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f, + 0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61,0x74,0x68,0x5f, + 0x65,0x6e,0x61,0x62,0x6c,0x65,0x43,0x84,0x69,0x61,0x19,0x84,0xa5,0xc9,0xb9,0x8c, + 0xbd,0xb5,0xc1,0xa5,0xb1,0x95,0xb9,0x98,0xc9,0x85,0xb5,0x95,0x89,0xd5,0x99,0x99, + 0x95,0xc9,0x7d,0x99,0x95,0xd1,0x8d,0xa1,0x7d,0x91,0xa5,0xcd,0x85,0x89,0xb1,0x95, + 0x0d,0x11,0xa6,0x86,0x51,0x58,0x9a,0x9c,0x8b,0x5c,0x99,0x1b,0x59,0x99,0xdc,0x17, + 0x5d,0x98,0xdc,0x59,0x19,0x1d,0xa3,0xb0,0x34,0x39,0x97,0x30,0xb9,0xb3,0x2f,0xba, + 0x3c,0xb8,0xb2,0x2f,0xb7,0xb0,0xb6,0x32,0x1a,0x66,0x6c,0x6f,0x61,0x74,0x34,0x64, + 0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xdc,0xc2,0xda,0xca,0xa8,0x98,0xc9,0x85, + 0x9d,0x7d,0x8d,0xbd,0xb1,0xbd,0xc9,0x0d,0x61,0xa6,0xe7,0x19,0x26,0x68,0x8a,0x26, + 0x69,0x9a,0x86,0x08,0x13,0x45,0x29,0x2c,0x4d,0xce,0xc5,0x4c,0x2e,0xec,0xac,0xad, + 0xcc,0x8d,0xee,0x2b,0xcd,0x0d,0xae,0x8e,0x8e,0x4b,0xdd,0x5c,0x99,0x1c,0x0a,0xdb, + 0xdb,0x98,0x1b,0x4c,0x0a,0x95,0xb0,0x34,0x39,0x97,0xb1,0x32,0x37,0xba,0x32,0x39, + 0x3e,0x61,0x69,0x72,0x2e,0x70,0x65,0x72,0x73,0x70,0x65,0x63,0x74,0x69,0x76,0x65, + 0x34,0xcc,0xd8,0xde,0xc2,0xe8,0x64,0x28,0xd4,0xd9,0x0d,0x91,0x9e,0x61,0xb2,0xa6, + 0x6b,0xc2,0xa6,0x6c,0x82,0x26,0x6d,0x92,0xa6,0x8d,0x4b,0xdd,0x5c,0x99,0x1c,0x0a, + 0xdb,0xdb,0x98,0x5b,0x4c,0x0a,0x8b,0xb1,0x37,0xb6,0x37,0xb9,0x21,0xd2,0x43,0x4c, + 0xd6,0xd4,0x4d,0xd8,0x94,0x4d,0xd0,0x14,0x4d,0xd2,0xe4,0x51,0x09,0x4b,0x93,0x73, + 0x11,0xab,0x33,0x33,0x2b,0x93,0xe3,0x13,0x96,0x26,0xe7,0x22,0x56,0x67,0x66,0x56, + 0x26,0xf7,0x35,0x97,0xa6,0x57,0x46,0x29,0x2c,0x4d,0xce,0x85,0xed,0x6d,0x2c,0x8c, + 0x2e,0xed,0xcd,0xed,0x2b,0xcd,0x8d,0xac,0x0c,0x8f,0x48,0x58,0x9a,0x9c,0x8b,0x5c, + 0x59,0x18,0x19,0xa9,0xb0,0x34,0x39,0x97,0x39,0x3a,0xb9,0xba,0x31,0xba,0x2f,0xba, + 0x3c,0xb8,0xb2,0xaf,0x34,0x37,0xb3,0x37,0x16,0x66,0x6c,0x6f,0x61,0x74,0x1c,0xe0, + 0xda,0xc2,0x86,0x28,0xcf,0xf0,0x14,0xcf,0x30,0x95,0xc1,0x64,0x06,0x8c,0xc2,0xd2, + 0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xe6,0xd2,0xf4,0xca,0x78, + 0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0x85,0xb1,0xa5, + 0x9d,0xb9,0x7d,0xcd,0xa5,0xe9,0x95,0x31,0x31,0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b, + 0x9b,0xe3,0xf0,0x55,0x33,0x33,0x84,0x0c,0x1e,0x63,0x02,0x83,0x29,0x0c,0x9e,0x62, + 0x12,0x83,0x67,0x78,0x88,0x69,0x0c,0x26,0x32,0x98,0xce,0x60,0x42,0x83,0xa7,0x98, + 0xd2,0xe0,0x29,0x26,0x68,0x52,0x83,0x49,0x9a,0xd6,0x80,0x4b,0x58,0x9a,0x9c,0x0b, + 0x5d,0x19,0x1e,0x5d,0x9d,0x5c,0x19,0x95,0xb0,0x34,0x39,0x97,0xb9,0xb0,0x36,0x38, + 0xb6,0x32,0x62,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f, + 0x61,0x74,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x3e,0x1c,0xe8,0xca,0xf0,0x86, + 0x50,0x0f,0x32,0xb5,0xc1,0x24,0x06,0xcf,0xf0,0x10,0x93,0x1b,0x4c,0xd0,0xf4,0x06, + 0x93,0x34,0xc1,0x01,0x97,0xb0,0x34,0x39,0x97,0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39, + 0x1e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x1c,0xe6,0xda,0xe0,0x86,0x48,0x4f,0x31, + 0xc9,0xc1,0x24,0x06,0xcf,0xf0,0x10,0x13,0x34,0xcd,0xc1,0x24,0x4d,0x74,0x30,0x44, + 0x99,0xb8,0xe9,0x9b,0xd8,0x60,0x8a,0x83,0xa9,0x0e,0x86,0x18,0x0b,0x30,0x55,0x93, + 0x1d,0xd0,0xf9,0xd2,0xa2,0x9a,0xca,0x31,0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b, + 0xe3,0xf3,0xd6,0xe6,0x96,0x06,0xf7,0x46,0x57,0xe6,0x46,0x07,0x32,0x86,0x16,0x26, + 0xc7,0x67,0x2a,0xad,0x0d,0x8e,0xad,0x0c,0x64,0x68,0x65,0x05,0x84,0x4a,0x28,0x28, + 0x68,0x88,0x30,0xe9,0xc1,0x10,0x63,0xca,0x83,0x69,0x0f,0xb0,0x64,0x88,0x31,0x95, + 0xc1,0xc4,0x07,0x58,0x32,0xc4,0x98,0xf0,0x60,0xea,0x03,0x2c,0x19,0x62,0x4c,0x7e, + 0x30,0xf5,0x01,0x96,0x8c,0x88,0xd8,0x81,0x1d,0xec,0xa1,0x1d,0xdc,0xa0,0x1d,0xde, + 0x81,0x1c,0xea,0x81,0x1d,0xca,0xc1,0x0d,0xcc,0x81,0x1d,0xc2,0xe1,0x1c,0xe6,0x61, + 0x8a,0x10,0x0c,0x23,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x48,0x07,0x72,0x28, + 0x07,0x77,0xa0,0x87,0x29,0x41,0x31,0x62,0x09,0x87,0x74,0x90,0x07,0x37,0xb0,0x87, + 0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87,0x29,0x81,0x31,0x82,0x0a,0x87,0x74, + 0x90,0x07,0x37,0x60,0x87,0x70,0x70,0x87,0x73,0xa8,0x87,0x70,0x38,0x87,0x72,0xf8, + 0x05,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x20,0x23,0xa6, + 0x70,0x48,0x07,0x79,0x70,0x83,0x71,0x78,0x87,0x76,0x80,0x87,0x74,0x60,0x87,0x72, + 0xf8,0x85,0x77,0x80,0x07,0x7a,0x48,0x87,0x77,0x70,0x87,0x79,0x98,0x32,0x28,0x8c, + 0x33,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68,0x87, + 0x72,0x70,0x07,0x7a,0x98,0x12,0xdc,0x01,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00, + 0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84, + 0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed, + 0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66, + 0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c, + 0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70, + 0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90, + 0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4, + 0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83, + 0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14, + 0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70, + 0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80, + 0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0, + 0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1, + 0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d, + 0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39, + 0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc, + 0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70, + 0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53, + 0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e, + 0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c, + 0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38, + 0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37, + 0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33, + 0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4, + 0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0, + 0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3, + 0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07, + 0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23, + 0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59, + 0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b, + 0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00, + 0x00,0x0b,0x00,0x00,0x00,0x26,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f, + 0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20, + 0x0d,0x6d,0x01,0x0d,0x80,0x44,0x3e,0x83,0x5c,0x7e,0x85,0x17,0xb7,0x0d,0x00,0x00, + 0x00,0x61,0x20,0x00,0x00,0x25,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00, + 0x00,0x0c,0x00,0x00,0x00,0x74,0x47,0x00,0xc6,0x22,0x80,0x40,0x38,0xe6,0x20,0x06, + 0xc2,0xa8,0xc8,0xd5,0xc0,0x08,0x00,0xbd,0x19,0x00,0x82,0x23,0x00,0x54,0xc7,0x1a, + 0x80,0x40,0x18,0x6b,0x18,0x86,0x81,0xec,0x0c,0x00,0x89,0x19,0x00,0x0a,0x33,0x00, + 0x04,0x46,0x00,0x00,0x00,0x23,0x06,0xca,0x10,0x6c,0x8f,0x23,0x29,0x47,0x12,0x58, + 0x20,0xc9,0x67,0x90,0x21,0x20,0x90,0x41,0x06,0xa1,0x40,0x4c,0x08,0xe4,0x33,0xc8, + 0x10,0x24,0xd0,0x20,0x43,0x50,0x48,0x16,0x60,0xf2,0x19,0x6f,0xc0,0x38,0x31,0xa0, + 0x60,0xcc,0x31,0x30,0x01,0x19,0x0c,0x32,0x04,0x0d,0x36,0x62,0x60,0x08,0x01,0x1a, + 0x2c,0x45,0x30,0xdb,0x00,0x05,0x40,0x06,0x01,0x31,0x00,0x00,0x00,0x02,0x00,0x00, + 0x00,0x5b,0x86,0x24,0xf8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; static const uint8_t _sspine_vs_bytecode_metal_ios[3068] = { @@ -2082,12 +2099,12 @@ static const uint8_t _sspine_vs_bytecode_metal_ios[3068] = { 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0xf0,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x0e,0xe2,0x38,0x0e,0x18,0xad,0x5b, - 0x54,0x49,0xaf,0x95,0xc9,0xab,0xf7,0xda,0x83,0x18,0xe7,0x3c,0xff,0xd0,0x8d,0x85, - 0x65,0x82,0x6c,0xdb,0x0b,0x02,0x06,0x0c,0x04,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x00,0x48,0x41,0x53,0x48,0x20,0x00,0x93,0xd6,0x91,0x34,0xa6,0x5a,0xef, + 0xf4,0xa9,0x2b,0xc7,0x55,0x75,0x4a,0x7f,0xc5,0x46,0xc0,0x95,0x92,0x61,0x00,0x3e, + 0x6d,0x53,0x68,0xee,0xb6,0x8e,0xc8,0x26,0x6c,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x37,0x00,0x00,0x00,0x56,0x41,0x54, 0x54,0x22,0x00,0x03,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x80, 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x01,0x80,0x63,0x6f,0x6c,0x6f, 0x72,0x30,0x00,0x02,0x80,0x56,0x41,0x54,0x59,0x05,0x00,0x03,0x00,0x04,0x04,0x06, @@ -2166,15 +2183,15 @@ static const uint8_t _sspine_vs_bytecode_metal_ios[3068] = { 0xa0,0x07,0x73,0x20,0x07,0x43,0x98,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80, 0x2c,0x10,0x00,0x00,0x0a,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90, 0x8c,0x09,0x26,0x47,0xc6,0x04,0x43,0x5a,0x25,0x30,0x02,0x50,0x04,0x05,0x18,0x50, - 0x08,0x05,0x51,0x06,0x05,0x42,0x6d,0x04,0x80,0xd8,0x58,0x02,0x04,0x00,0x00,0x00, + 0x08,0x05,0x51,0x06,0x05,0x42,0x6d,0x04,0x80,0xd8,0x58,0x02,0x24,0x00,0x00,0x00, 0x79,0x18,0x00,0x00,0xea,0x00,0x00,0x00,0x1a,0x03,0x4c,0x10,0x97,0x29,0xa2,0x25, 0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x32,0x28,0x00,0xa3,0x50,0xb9, 0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62,0x2c,0x81,0x22,0x2c,0x05, 0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e,0x8c,0x0d,0xc4,0xae,0x4c, - 0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0x86,0x66,0x06,0x04, - 0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0x86, - 0x66,0xc6,0x85,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x8c,0x45,0x60,0xd1, - 0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x84,0x45,0xe0,0x16,0x96,0x26, + 0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6,0xe6,0x06,0x04, + 0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06,0x06,0x26,0xc6,0xc5,0xc6, + 0xe6,0xc6,0x45,0x26,0x65,0x88,0xa0,0x10,0x43,0x8c,0x25,0x58,0x8c,0x45,0x60,0xd1, + 0x54,0x46,0x17,0xc6,0x36,0x04,0x51,0x8e,0x25,0x58,0x82,0x45,0xe0,0x16,0x96,0x26, 0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56,0xe6,0xf6,0x26,0xd7,0x36, 0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x50,0x12,0x72,0x61,0x69,0x72, 0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61,0x73,0x74,0x5f,0x6d,0x61, @@ -2209,7 +2226,7 @@ static const uint8_t _sspine_vs_bytecode_metal_ios[3068] = { 0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0,0xca,0xbe,0xe6,0xd2,0xf4,0xca,0x78,0x85, 0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1,0xe5,0xc1,0x95,0x7d,0x85,0xb1,0xa5,0x9d, 0xb9,0x7d,0xcd,0xa5,0xe9,0x95,0x31,0xb1,0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b, - 0xe3,0xf0,0x25,0x13,0x33,0x84,0x0c,0x96,0x43,0x39,0x03,0x05,0x0d,0x16,0x42,0xf9, + 0xe3,0xf0,0x15,0x93,0x33,0x84,0x0c,0x96,0x43,0x39,0x03,0x05,0x0d,0x16,0x42,0xf9, 0x16,0x61,0x09,0x94,0x34,0x50,0xd4,0x40,0x69,0x03,0xc5,0x0d,0x16,0x42,0x79,0x83, 0x05,0x51,0x22,0x05,0x0e,0x94,0x49,0x89,0x83,0x21,0x88,0x22,0x06,0x0a,0x19,0x28, 0x66,0xa0,0xc8,0xc1,0x10,0x23,0x01,0x94,0x4e,0x99,0x03,0x3e,0x6f,0x6d,0x6e,0x69, @@ -2268,23 +2285,23 @@ static const uint8_t _sspine_vs_bytecode_metal_ios[3068] = { 0x5b,0x86,0x20,0xc8,0x83,0x2d,0x43,0x11,0xe4,0xc1,0x96,0x41,0x09,0xf2,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sspine_fs_bytecode_metal_ios[3257] = { +static const uint8_t _sspine_fs_bytecode_metal_ios[3241] = { 0x4d,0x54,0x4c,0x42,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xb9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xa9,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd9,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xe0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, + 0xd0,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x6d,0x00,0x00,0x00, 0x4e,0x41,0x4d,0x45,0x06,0x00,0x6d,0x61,0x69,0x6e,0x30,0x00,0x54,0x59,0x50,0x45, - 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xf9,0x30,0x1b,0xe4,0xb2,0x62,0xda, - 0x23,0x88,0x1d,0xd4,0x13,0xb5,0x57,0x53,0xb9,0x44,0x7f,0x7f,0xe5,0xf3,0xc1,0xe4, - 0x19,0x37,0x0b,0xd8,0xef,0xc5,0x9b,0xf1,0x0b,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, + 0x01,0x00,0x01,0x48,0x41,0x53,0x48,0x20,0x00,0xf2,0xd8,0x54,0xd8,0x76,0x28,0x3c, + 0xc1,0x24,0xd6,0xe7,0xb5,0xc4,0xbc,0x0f,0x0f,0x5a,0x55,0xdc,0x0c,0x24,0xa5,0x96, + 0x04,0x74,0x34,0x10,0x4e,0xdf,0x2e,0x1d,0xee,0x4f,0x46,0x46,0x54,0x18,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x56,0x45,0x52,0x53,0x08,0x00,0x01,0x00,0x08, - 0x00,0x01,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, + 0x00,0x01,0x00,0x01,0x00,0x45,0x4e,0x44,0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44, 0x54,0x04,0x00,0x00,0x00,0x45,0x4e,0x44,0x54,0xde,0xc0,0x17,0x0b,0x00,0x00,0x00, - 0x00,0x14,0x00,0x00,0x00,0xc0,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, - 0xde,0x21,0x0c,0x00,0x00,0xed,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, + 0x00,0x14,0x00,0x00,0x00,0xbc,0x0b,0x00,0x00,0xff,0xff,0xff,0xff,0x42,0x43,0xc0, + 0xde,0x21,0x0c,0x00,0x00,0xec,0x02,0x00,0x00,0x0b,0x82,0x20,0x00,0x02,0x00,0x00, 0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,0x41,0xc8,0x04,0x49,0x06,0x10,0x32, 0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,0x1e,0x04,0x8b,0x62,0x80,0x14,0x45, 0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,0x38,0x08,0x18,0x49,0x0a,0x32,0x44, @@ -2364,14 +2381,14 @@ static const uint8_t _sspine_fs_bytecode_metal_ios[3257] = { 0x10,0x46,0x02,0x02,0x60,0x00,0x00,0x00,0x00,0x00,0x20,0x0b,0x04,0x09,0x00,0x00, 0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,0xc6,0x04,0x43, 0x7a,0x23,0x00,0x25,0x50,0x08,0x45,0x50,0x10,0x65,0x40,0x78,0x04,0x80,0xe8,0x58, - 0x02,0x04,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xfa,0x00,0x00,0x00,0x1a,0x03,0x4c, + 0x02,0x24,0x00,0x00,0x00,0x79,0x18,0x00,0x00,0xf9,0x00,0x00,0x00,0x1a,0x03,0x4c, 0x10,0x97,0x29,0xa2,0x25,0x10,0xab,0x32,0xb9,0xb9,0xb4,0x37,0xb7,0x21,0xc6,0x63, 0x4c,0x00,0xa5,0x50,0xb9,0x1b,0x43,0x0b,0x93,0xfb,0x9a,0x4b,0xd3,0x2b,0x1b,0x62, 0x3c,0xc4,0x24,0x3c,0x05,0xe7,0x20,0x08,0x0e,0x8e,0xad,0x0c,0xa4,0xad,0x8c,0x2e, 0x8c,0x0d,0xc4,0xae,0x4c,0x6e,0x2e,0xed,0xcd,0x0d,0x64,0x26,0x06,0x06,0x26,0xc6, - 0xc5,0x86,0x66,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, - 0x06,0x26,0xc6,0xc5,0x86,0x66,0xc6,0x85,0x26,0x65,0x88,0x30,0x11,0x43,0x8c,0x87, - 0x78,0x8e,0x67,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x99,0x8e,0x87,0x78,0x86, + 0xc5,0xc6,0xe6,0x06,0x04,0xa5,0xad,0x8c,0x2e,0x8c,0xcd,0xac,0xac,0x65,0x26,0x06, + 0x06,0x26,0xc6,0xc5,0xc6,0xe6,0xc6,0x45,0x26,0x65,0x88,0x30,0x11,0x43,0x8c,0x87, + 0x78,0x8e,0x67,0x60,0xd1,0x54,0x46,0x17,0xc6,0x36,0x04,0x99,0x8e,0x87,0x78,0x88, 0x67,0xe0,0x16,0x96,0x26,0xe7,0x32,0xf6,0xd6,0x06,0x97,0xc6,0x56,0xe6,0x42,0x56, 0xe6,0xf6,0x26,0xd7,0x36,0xf7,0x45,0x96,0x36,0x17,0x26,0xc6,0x56,0x36,0x44,0x98, 0x12,0x72,0x61,0x69,0x72,0x2e,0x63,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x2e,0x66,0x61, @@ -2400,7 +2417,7 @@ static const uint8_t _sspine_fs_bytecode_metal_ios[3257] = { 0x95,0xc1,0x64,0x06,0x8c,0xc2,0xd2,0xe4,0x5c,0xc2,0xe4,0xce,0xbe,0xe8,0xf2,0xe0, 0xca,0xbe,0xe6,0xd2,0xf4,0xca,0x78,0x85,0xa5,0xc9,0xb9,0x84,0xc9,0x9d,0x7d,0xd1, 0xe5,0xc1,0x95,0x7d,0x85,0xb1,0xa5,0x9d,0xb9,0x7d,0xcd,0xa5,0xe9,0x95,0x31,0x31, - 0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b,0xe3,0xf0,0x55,0x03,0x33,0x84,0x0c,0x1e, + 0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b,0xe3,0xf0,0x55,0x33,0x33,0x84,0x0c,0x1e, 0x63,0x02,0x83,0x29,0x0c,0x9e,0x62,0x12,0x83,0x67,0x78,0x88,0x69,0x0c,0x26,0x32, 0x98,0xce,0x60,0x42,0x83,0xa7,0x98,0xd2,0xe0,0x29,0x26,0x68,0x52,0x83,0x49,0x9a, 0xd6,0x80,0x4b,0x58,0x9a,0x9c,0x0b,0x5d,0x19,0x1e,0x5d,0x9d,0x5c,0x19,0x95,0xb0, @@ -2408,73 +2425,72 @@ static const uint8_t _sspine_fs_bytecode_metal_ios[3257] = { 0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c, 0x65,0x3e,0x1c,0xe8,0xca,0xf0,0x86,0x50,0x0f,0x32,0xb5,0xc1,0x24,0x06,0xcf,0xf0, 0x10,0x93,0x1b,0x4c,0xd0,0xf4,0x06,0x93,0x34,0xc1,0x01,0x97,0xb0,0x34,0x39,0x97, - 0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x1e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x44, - 0xe8,0xca,0xf0,0xa6,0xda,0xe0,0xd8,0xe4,0x86,0x48,0x4f,0x31,0xc9,0xc1,0x24,0x06, - 0xcf,0xf0,0x10,0x13,0x34,0xcd,0xc1,0x24,0x4d,0x74,0x30,0x44,0x99,0xb8,0xe9,0x9b, - 0xd8,0x60,0x8a,0x83,0xa9,0x0e,0x86,0x18,0x0b,0x30,0x55,0x93,0x1d,0xd0,0xf9,0xd2, - 0xa2,0x9a,0xca,0x31,0x9b,0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b,0xe3,0xf3,0xd6,0xe6, - 0x96,0x06,0xf7,0x46,0x57,0xe6,0x46,0x07,0x32,0x86,0x16,0x26,0xc7,0x67,0x2a,0xad, - 0x0d,0x8e,0xad,0x0c,0x64,0x68,0x65,0x05,0x84,0x4a,0x28,0x28,0x68,0x88,0x30,0xe9, - 0xc1,0x10,0x63,0xca,0x83,0x69,0x0f,0xb0,0x64,0x88,0x31,0x95,0xc1,0xc4,0x07,0x58, - 0x32,0xc4,0x98,0xf0,0x60,0xea,0x03,0x2c,0x19,0x62,0x4c,0x7e,0x30,0xf5,0x01,0x96, - 0x8c,0x88,0xd8,0x81,0x1d,0xec,0xa1,0x1d,0xdc,0xa0,0x1d,0xde,0x81,0x1c,0xea,0x81, - 0x1d,0xca,0xc1,0x0d,0xcc,0x81,0x1d,0xc2,0xe1,0x1c,0xe6,0x61,0x8a,0x10,0x0c,0x23, - 0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x48,0x07,0x72,0x28,0x07,0x77,0xa0,0x87, - 0x29,0x41,0x31,0x62,0x09,0x87,0x74,0x90,0x07,0x37,0xb0,0x87,0x72,0x90,0x87,0x79, - 0x48,0x87,0x77,0x70,0x87,0x29,0x81,0x31,0x82,0x0a,0x87,0x74,0x90,0x07,0x37,0x60, - 0x87,0x70,0x70,0x87,0x73,0xa8,0x87,0x70,0x38,0x87,0x72,0xf8,0x05,0x7b,0x28,0x07, - 0x79,0x98,0x87,0x74,0x78,0x07,0x77,0x98,0x12,0x20,0x23,0xa6,0x70,0x48,0x07,0x79, - 0x70,0x83,0x71,0x78,0x87,0x76,0x80,0x87,0x74,0x60,0x87,0x72,0xf8,0x85,0x77,0x80, - 0x07,0x7a,0x48,0x87,0x77,0x70,0x87,0x79,0x98,0x32,0x28,0x8c,0x33,0x82,0x09,0x87, - 0x74,0x90,0x07,0x37,0x30,0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70,0x07,0x7a, - 0x98,0x12,0xdc,0x01,0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80, - 0x1c,0xc4,0xe1,0x1c,0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80, - 0x07,0x79,0x78,0x07,0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80, - 0x0e,0x33,0x0c,0x42,0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88, - 0x43,0x38,0x84,0x83,0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78, - 0x8c,0x74,0x70,0x07,0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03, - 0x76,0x78,0x87,0x70,0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f, - 0x6e,0x30,0x0f,0xe3,0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c, - 0xd8,0x21,0x1d,0xc2,0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39, - 0xb4,0x03,0x3c,0xbc,0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b, - 0x68,0x07,0x37,0x68,0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60, - 0x07,0x76,0x28,0x07,0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87, - 0x71,0x18,0x87,0x72,0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e, - 0xf5,0xc0,0x0e,0xec,0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c, - 0xe4,0xa1,0x1c,0xdc,0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6, - 0x90,0x43,0x39,0xc8,0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94, - 0x43,0x38,0x88,0x03,0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03, - 0x3b,0xb0,0xc3,0x0c,0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07, - 0x78,0x60,0x87,0x74,0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f, - 0xf2,0x50,0x0e,0xe4,0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33, - 0x20,0x28,0x1d,0xdc,0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc, - 0xe0,0x1c,0xe4,0xe1,0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c, - 0x83,0x3b,0xcc,0x50,0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78, - 0x07,0x78,0x98,0x51,0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca, - 0x61,0x1c,0xe8,0x21,0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21, - 0x1d,0xf0,0x61,0x06,0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43, - 0x39,0xfc,0xc2,0x3c,0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87, - 0x79,0x98,0x87,0x77,0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c, - 0xe3,0x10,0x0e,0xec,0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e, - 0xe4,0xe1,0x17,0xd8,0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c, - 0xb8,0x81,0x39,0xd4,0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c, - 0x83,0x3c,0xbc,0x43,0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x0b,0x00,0x00, - 0x00,0x26,0xb0,0x01,0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45, - 0xc4,0x6f,0x0f,0x7e,0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x6d,0x01,0x0d, - 0x80,0x44,0x3e,0x83,0x5c,0x7e,0x85,0x17,0xb7,0x0d,0x00,0x00,0x00,0x61,0x20,0x00, - 0x00,0x25,0x00,0x00,0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x0c,0x00,0x00, - 0x00,0x74,0x47,0x00,0xc6,0x22,0x80,0x40,0x38,0xe6,0x20,0x06,0xc2,0xa8,0xc8,0xd5, - 0xc0,0x08,0x00,0xbd,0x19,0x00,0x82,0x23,0x00,0x54,0xc7,0x1a,0x80,0x40,0x18,0x6b, - 0x18,0x86,0x81,0xec,0x0c,0x00,0x89,0x19,0x00,0x0a,0x33,0x00,0x04,0x46,0x00,0x00, - 0x00,0x23,0x06,0xca,0x10,0x6c,0x8f,0x23,0x29,0x47,0x12,0x58,0x20,0xc9,0x67,0x90, - 0x21,0x20,0x90,0x41,0x06,0xa1,0x40,0x4c,0x08,0xe4,0x33,0xc8,0x10,0x24,0xd0,0x20, - 0x43,0x50,0x48,0x16,0x60,0xf2,0x19,0x6f,0xc0,0x38,0x31,0xa0,0x60,0xcc,0x31,0x30, - 0x01,0x19,0x0c,0x32,0x04,0x0d,0x36,0x62,0x60,0x08,0x01,0x1a,0x2c,0x45,0x30,0xdb, - 0x00,0x05,0x40,0x06,0x01,0x31,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x5b,0x86,0x24, - 0xf8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xb9,0xb0,0x36,0x38,0xb6,0x32,0x39,0x1e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x1c, + 0xe6,0xda,0xe0,0x86,0x48,0x4f,0x31,0xc9,0xc1,0x24,0x06,0xcf,0xf0,0x10,0x13,0x34, + 0xcd,0xc1,0x24,0x4d,0x74,0x30,0x44,0x99,0xb8,0xe9,0x9b,0xd8,0x60,0x8a,0x83,0xa9, + 0x0e,0x86,0x18,0x0b,0x30,0x55,0x93,0x1d,0xd0,0xf9,0xd2,0xa2,0x9a,0xca,0x31,0x9b, + 0xfb,0x82,0x0b,0x93,0x0b,0x6b,0x9b,0xe3,0xf3,0xd6,0xe6,0x96,0x06,0xf7,0x46,0x57, + 0xe6,0x46,0x07,0x32,0x86,0x16,0x26,0xc7,0x67,0x2a,0xad,0x0d,0x8e,0xad,0x0c,0x64, + 0x68,0x65,0x05,0x84,0x4a,0x28,0x28,0x68,0x88,0x30,0xe9,0xc1,0x10,0x63,0xca,0x83, + 0x69,0x0f,0xb0,0x64,0x88,0x31,0x95,0xc1,0xc4,0x07,0x58,0x32,0xc4,0x98,0xf0,0x60, + 0xea,0x03,0x2c,0x19,0x62,0x4c,0x7e,0x30,0xf5,0x01,0x96,0x8c,0x88,0xd8,0x81,0x1d, + 0xec,0xa1,0x1d,0xdc,0xa0,0x1d,0xde,0x81,0x1c,0xea,0x81,0x1d,0xca,0xc1,0x0d,0xcc, + 0x81,0x1d,0xc2,0xe1,0x1c,0xe6,0x61,0x8a,0x10,0x0c,0x23,0x14,0x76,0x60,0x07,0x7b, + 0x68,0x07,0x37,0x48,0x07,0x72,0x28,0x07,0x77,0xa0,0x87,0x29,0x41,0x31,0x62,0x09, + 0x87,0x74,0x90,0x07,0x37,0xb0,0x87,0x72,0x90,0x87,0x79,0x48,0x87,0x77,0x70,0x87, + 0x29,0x81,0x31,0x82,0x0a,0x87,0x74,0x90,0x07,0x37,0x60,0x87,0x70,0x70,0x87,0x73, + 0xa8,0x87,0x70,0x38,0x87,0x72,0xf8,0x05,0x7b,0x28,0x07,0x79,0x98,0x87,0x74,0x78, + 0x07,0x77,0x98,0x12,0x20,0x23,0xa6,0x70,0x48,0x07,0x79,0x70,0x83,0x71,0x78,0x87, + 0x76,0x80,0x87,0x74,0x60,0x87,0x72,0xf8,0x85,0x77,0x80,0x07,0x7a,0x48,0x87,0x77, + 0x70,0x87,0x79,0x98,0x32,0x28,0x8c,0x33,0x82,0x09,0x87,0x74,0x90,0x07,0x37,0x30, + 0x07,0x79,0x08,0x87,0x73,0x68,0x87,0x72,0x70,0x07,0x7a,0x98,0x12,0xdc,0x01,0x00, + 0x00,0x79,0x18,0x00,0x00,0x7b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c, + 0x66,0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07, + 0x73,0x98,0x71,0x0c,0xe6,0x00,0x0f,0xed,0x10,0x0e,0xf4,0x80,0x0e,0x33,0x0c,0x42, + 0x1e,0xc2,0xc1,0x1d,0xce,0xa1,0x1c,0x66,0x30,0x05,0x3d,0x88,0x43,0x38,0x84,0x83, + 0x1b,0xcc,0x03,0x3d,0xc8,0x43,0x3d,0x8c,0x03,0x3d,0xcc,0x78,0x8c,0x74,0x70,0x07, + 0x7b,0x08,0x07,0x79,0x48,0x87,0x70,0x70,0x07,0x7a,0x70,0x03,0x76,0x78,0x87,0x70, + 0x20,0x87,0x19,0xcc,0x11,0x0e,0xec,0x90,0x0e,0xe1,0x30,0x0f,0x6e,0x30,0x0f,0xe3, + 0xf0,0x0e,0xf0,0x50,0x0e,0x33,0x10,0xc4,0x1d,0xde,0x21,0x1c,0xd8,0x21,0x1d,0xc2, + 0x61,0x1e,0x66,0x30,0x89,0x3b,0xbc,0x83,0x3b,0xd0,0x43,0x39,0xb4,0x03,0x3c,0xbc, + 0x83,0x3c,0x84,0x03,0x3b,0xcc,0xf0,0x14,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x68, + 0x87,0x72,0x68,0x07,0x37,0x80,0x87,0x70,0x90,0x87,0x70,0x60,0x07,0x76,0x28,0x07, + 0x76,0xf8,0x05,0x76,0x78,0x87,0x77,0x80,0x87,0x5f,0x08,0x87,0x71,0x18,0x87,0x72, + 0x98,0x87,0x79,0x98,0x81,0x2c,0xee,0xf0,0x0e,0xee,0xe0,0x0e,0xf5,0xc0,0x0e,0xec, + 0x30,0x03,0x62,0xc8,0xa1,0x1c,0xe4,0xa1,0x1c,0xcc,0xa1,0x1c,0xe4,0xa1,0x1c,0xdc, + 0x61,0x1c,0xca,0x21,0x1c,0xc4,0x81,0x1d,0xca,0x61,0x06,0xd6,0x90,0x43,0x39,0xc8, + 0x43,0x39,0x98,0x43,0x39,0xc8,0x43,0x39,0xb8,0xc3,0x38,0x94,0x43,0x38,0x88,0x03, + 0x3b,0x94,0xc3,0x2f,0xbc,0x83,0x3c,0xfc,0x82,0x3b,0xd4,0x03,0x3b,0xb0,0xc3,0x0c, + 0xc7,0x69,0x87,0x70,0x58,0x87,0x72,0x70,0x83,0x74,0x68,0x07,0x78,0x60,0x87,0x74, + 0x18,0x87,0x74,0xa0,0x87,0x19,0xce,0x53,0x0f,0xee,0x00,0x0f,0xf2,0x50,0x0e,0xe4, + 0x90,0x0e,0xe3,0x40,0x0f,0xe1,0x20,0x0e,0xec,0x50,0x0e,0x33,0x20,0x28,0x1d,0xdc, + 0xc1,0x1e,0xc2,0x41,0x1e,0xd2,0x21,0x1c,0xdc,0x81,0x1e,0xdc,0xe0,0x1c,0xe4,0xe1, + 0x1d,0xea,0x01,0x1e,0x66,0x18,0x51,0x38,0xb0,0x43,0x3a,0x9c,0x83,0x3b,0xcc,0x50, + 0x24,0x76,0x60,0x07,0x7b,0x68,0x07,0x37,0x60,0x87,0x77,0x78,0x07,0x78,0x98,0x51, + 0x4c,0xf4,0x90,0x0f,0xf0,0x50,0x0e,0x33,0x1e,0x6a,0x1e,0xca,0x61,0x1c,0xe8,0x21, + 0x1d,0xde,0xc1,0x1d,0x7e,0x01,0x1e,0xe4,0xa1,0x1c,0xcc,0x21,0x1d,0xf0,0x61,0x06, + 0x54,0x85,0x83,0x38,0xcc,0xc3,0x3b,0xb0,0x43,0x3d,0xd0,0x43,0x39,0xfc,0xc2,0x3c, + 0xe4,0x43,0x3b,0x88,0xc3,0x3b,0xb0,0xc3,0x8c,0xc5,0x0a,0x87,0x79,0x98,0x87,0x77, + 0x18,0x87,0x74,0x08,0x07,0x7a,0x28,0x07,0x72,0x98,0x81,0x5c,0xe3,0x10,0x0e,0xec, + 0xc0,0x0e,0xe5,0x50,0x0e,0xf3,0x30,0x23,0xc1,0xd2,0x41,0x1e,0xe4,0xe1,0x17,0xd8, + 0xe1,0x1d,0xde,0x01,0x1e,0x66,0x50,0x59,0x38,0xa4,0x83,0x3c,0xb8,0x81,0x39,0xd4, + 0x83,0x3b,0x8c,0x03,0x3d,0xa4,0xc3,0x3b,0xb8,0xc3,0x2f,0x9c,0x83,0x3c,0xbc,0x43, + 0x3d,0xc0,0xc3,0x3c,0x00,0x71,0x20,0x00,0x00,0x0b,0x00,0x00,0x00,0x26,0xb0,0x01, + 0x48,0xe4,0x4b,0x00,0xf3,0x2c,0xc4,0x3f,0x11,0xd7,0x44,0x45,0xc4,0x6f,0x0f,0x7e, + 0x85,0x17,0xb7,0x6d,0x00,0x05,0x03,0x20,0x0d,0x6d,0x01,0x0d,0x80,0x44,0x3e,0x83, + 0x5c,0x7e,0x85,0x17,0xb7,0x0d,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x25,0x00,0x00, + 0x00,0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x74,0x47,0x00, + 0xc6,0x22,0x80,0x40,0x38,0xe6,0x20,0x06,0xc2,0xa8,0xc8,0xd5,0xc0,0x08,0x00,0xbd, + 0x19,0x00,0x82,0x23,0x00,0x54,0xc7,0x1a,0x80,0x40,0x18,0x6b,0x18,0x86,0x81,0xec, + 0x0c,0x00,0x89,0x19,0x00,0x0a,0x33,0x00,0x04,0x46,0x00,0x00,0x00,0x23,0x06,0xca, + 0x10,0x6c,0x8f,0x23,0x29,0x47,0x12,0x58,0x20,0xc9,0x67,0x90,0x21,0x20,0x90,0x41, + 0x06,0xa1,0x40,0x4c,0x08,0xe4,0x33,0xc8,0x10,0x24,0xd0,0x20,0x43,0x50,0x48,0x16, + 0x60,0xf2,0x19,0x6f,0xc0,0x38,0x31,0xa0,0x60,0xcc,0x31,0x30,0x01,0x19,0x0c,0x32, + 0x04,0x0d,0x36,0x62,0x60,0x08,0x01,0x1a,0x2c,0x45,0x30,0xdb,0x00,0x05,0x40,0x06, + 0x01,0x31,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x5b,0x86,0x24,0xf8,0x03,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const char _sspine_vs_source_metal_sim[716] = { +static const char _sspine_vs_source_metal_sim[624] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -2498,30 +2514,25 @@ static const char _sspine_vs_source_metal_sim[716] = { 0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b, 0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b, - 0x0a,0x7d,0x3b,0x0a,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x35,0x20,0x22,0x73, - 0x73,0x70,0x69,0x6e,0x65,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x76,0x65,0x72,0x74, - 0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, - 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, - 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e, - 0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26, - 0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29, - 0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x23,0x6c, - 0x69,0x6e,0x65,0x20,0x31,0x35,0x20,0x22,0x73,0x73,0x70,0x69,0x6e,0x65,0x2e,0x67, - 0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f, - 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x32,0x31,0x2e,0x6d, - 0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e, - 0x30,0x29,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x36,0x20,0x22,0x73,0x73, - 0x70,0x69,0x6e,0x65,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f, - 0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f, - 0x6f,0x72,0x64,0x30,0x3b,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x37,0x20,0x22, - 0x73,0x73,0x70,0x69,0x6e,0x65,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20, - 0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, - 0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e, + 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e, + 0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f, + 0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b, + 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, + 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39, + 0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e, + 0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76, + 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, + 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + }; -static const char _sspine_fs_source_metal_sim[721] = { +static const char _sspine_fs_source_metal_sim[619] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -2538,36 +2549,29 @@ static const char _sspine_fs_source_metal_sim[721] = { 0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, 0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65, 0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a, - 0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x34,0x20,0x22,0x73,0x73,0x70,0x69,0x6e,0x65, - 0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20, - 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28, - 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61, - 0x6e,0x74,0x20,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x35, - 0x30,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c, - 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74, - 0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, - 0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x65, - 0x78,0x53,0x6d,0x70,0x6c,0x72,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, - 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, - 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, - 0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x34,0x20,0x22,0x73,0x73,0x70,0x69,0x6e, - 0x65,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x53,0x6d,0x70,0x6c,0x72,0x2c,0x20,0x69,0x6e, - 0x2e,0x75,0x76,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b, - 0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x35,0x20,0x22,0x73,0x73,0x70,0x69,0x6e, - 0x65,0x2e,0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x20,0x5f,0x33,0x34,0x20,0x3d,0x20,0x5f,0x32,0x35,0x2e,0x77,0x3b,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x36,0x20,0x22,0x73,0x73,0x70,0x69,0x6e,0x65,0x2e, - 0x67,0x6c,0x73,0x6c,0x22,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x5f, - 0x32,0x35,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x32,0x35,0x2e,0x78, - 0x79,0x7a,0x20,0x2a,0x20,0x5f,0x33,0x34,0x2c,0x20,0x5f,0x33,0x34,0x29,0x20,0x2a, - 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x34,0x28,0x5f,0x35,0x30,0x2e,0x70,0x6d,0x61,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x00, + 0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f, + 0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69, + 0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d, + 0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x66,0x73,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x35,0x33,0x20,0x5b,0x5b,0x62,0x75,0x66, + 0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72, + 0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b, + 0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d, + 0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d, + 0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, + 0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65, + 0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x75,0x76,0x29,0x20,0x2a,0x20,0x69, + 0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x5f,0x33,0x37,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x77,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x5f,0x32,0x38,0x2c,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x28,0x5f,0x32,0x38,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x5f, + 0x33,0x37,0x2c,0x20,0x5f,0x33,0x37,0x29,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x63,0x6f, + 0x6c,0x6f,0x72,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x35,0x33,0x2e, + 0x70,0x6d,0x61,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, + 0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_WGPU) #error "FIXME: wgpu shaders" @@ -2713,6 +2717,7 @@ typedef struct { int layer; sg_pipeline pip; sg_image img; + sg_sampler smp; float pma; // pma = 0.0: use texture color as is, pma = 1.0: multiply texture rgb by texture alpha in fragment shader int base_element; int num_elements; @@ -2779,11 +2784,9 @@ void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) { (void)self; (void)path; } +static void _sspine_destroy_atlas_image_sampler(spAtlasPage* p); void _spAtlasPage_disposeTexture(spAtlasPage* self) { - if (self->rendererObject != 0) { - const sg_image img = { (uint32_t)(uintptr_t)self->rendererObject }; - sg_destroy_image(img); - } + _sspine_destroy_atlas_image_sampler(self); } char* _spUtil_readFile(const char* path, int* length) { @@ -2825,8 +2828,7 @@ static void _sspine_log(sspine_log_item log_item, uint32_t log_level, uint32_t l const char* message = 0; #endif _sspine.desc.logger.func("sspine", log_level, log_item, message, line_nr, filename, _sspine.desc.logger.user_data); - } - else { + } else { // for log level PANIC it would be 'undefined behaviour' to continue if (log_level == 0) { abort(); @@ -2870,8 +2872,7 @@ static bool _sspine_strcpy(const char* src, char* dst, int max_len) { if (c != 0) { *end = 0; return false; - } - else { + } else { return true; } } @@ -2892,8 +2893,7 @@ static void* _sspine_malloc(size_t size) { void* ptr; if (_sspine.desc.allocator.alloc) { ptr = _sspine.desc.allocator.alloc(size, _sspine.desc.allocator.user_data); - } - else { + } else { ptr = malloc(size); } if (0 == ptr) { @@ -2911,8 +2911,7 @@ static void* _sspine_malloc_clear(size_t size) { static void _sspine_free(void* ptr) { if (_sspine.desc.allocator.free) { _sspine.desc.allocator.free(ptr, _sspine.desc.allocator.user_data); - } - else { + } else { free(ptr); } } @@ -3033,8 +3032,7 @@ static int _sspine_pool_alloc_index(_sspine_pool_t* pool) { int slot_index = pool->free_queue[--pool->queue_top]; SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); return slot_index; - } - else { + } else { // pool exhausted return _SSPINE_INVALID_SLOT_INDEX; } @@ -3147,8 +3145,7 @@ static sspine_context _sspine_alloc_context(void) { if (_SSPINE_INVALID_SLOT_INDEX != slot_index) { uint32_t id = _sspine_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); return _sspine_make_context_handle(id); - } - else { + } else { // pool exhausted return _sspine_make_context_handle(SSPINE_INVALID_ID); } @@ -3319,13 +3316,29 @@ static sspine_atlas _sspine_alloc_atlas(void) { if (_SSPINE_INVALID_SLOT_INDEX != slot_index) { uint32_t id = _sspine_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); return _sspine_make_atlas_handle(id); - } - else { + } else { // pool exhausted return _sspine_make_atlas_handle(SSPINE_INVALID_ID); } } +static void* _sspine_renderobject_handle(sg_image img, sg_sampler smp) { + return (void*) ((((uint64_t)smp.id) << 32) | (img.id)); +} + +static sg_image _sspine_image_from_renderobject_handle(void* render_object) { + SOKOL_ASSERT(render_object); + uint32_t img_id = (uint32_t)(((uintptr_t)render_object) & 0xFFFFFFFF); + sg_image img = { img_id }; + return img; +} + +static sg_sampler _sspine_sampler_from_renderobject_handle(void* render_object) { + uint32_t smp_id = (uint32_t)((((uintptr_t)render_object) >> 32) & 0xFFFFFFFF); + sg_sampler smp = { smp_id }; + return smp; +} + static sspine_resource_state _sspine_init_atlas(_sspine_atlas_t* atlas, const sspine_atlas_desc* desc) { SOKOL_ASSERT(atlas && (atlas->slot.state == SSPINE_RESOURCESTATE_ALLOC)); SOKOL_ASSERT(desc); @@ -3345,8 +3358,8 @@ static sspine_resource_state _sspine_init_atlas(_sspine_atlas_t* atlas, const ss return SSPINE_RESOURCESTATE_FAILED; } - // allocate a sokol-gfx image handle for each page, but the actual image initialization - // needs to be delegated to the application + // allocate a sokol-gfx image and sampler object for each page, but the actual + // initialization needs to be delegated to the application for (spAtlasPage* page = atlas->sp_atlas->pages; page != 0; page = page->next) { atlas->num_pages++; const sg_image img = sg_alloc_image(); @@ -3354,12 +3367,16 @@ static sspine_resource_state _sspine_init_atlas(_sspine_atlas_t* atlas, const ss _SSPINE_ERROR(SG_ALLOC_IMAGE_FAILED); return SSPINE_RESOURCESTATE_FAILED; } - page->rendererObject = (void*)(uintptr_t)img.id; + const sg_sampler smp = sg_alloc_sampler(); + if (sg_query_sampler_state(smp) != SG_RESOURCESTATE_ALLOC) { + _SSPINE_ERROR(SG_ALLOC_SAMPLER_FAILED); + return SSPINE_RESOURCESTATE_FAILED; + } + page->rendererObject = _sspine_renderobject_handle(img, smp); if (desc->override.premul_alpha_enabled) { // NOTE: -1 is spine-c convention for 'true' page->pma = -1; - } - else if (desc->override.premul_alpha_disabled) { + } else if (desc->override.premul_alpha_disabled) { page->pma = 0; } } @@ -3411,6 +3428,16 @@ static spAtlasPage* _sspine_lookup_atlas_page(uint32_t atlas_id, int page_index) return 0; } +static void _sspine_destroy_atlas_image_sampler(spAtlasPage* p) { + SOKOL_ASSERT(p); + if (p->rendererObject != 0) { + const sg_image img = _sspine_image_from_renderobject_handle(p->rendererObject); + const sg_sampler smp = _sspine_sampler_from_renderobject_handle(p->rendererObject); + sg_destroy_image(img); + sg_destroy_sampler(smp); + } +} + // ███████ ██ ██ ███████ ██ ███████ ████████ ██████ ███ ██ // ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ // ███████ █████ █████ ██ █████ ██ ██ ██ ██ ██ ██ @@ -3457,8 +3484,7 @@ static sspine_skeleton _sspine_alloc_skeleton(void) { if (_SSPINE_INVALID_SLOT_INDEX != slot_index) { uint32_t id = _sspine_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); return _sspine_make_skeleton_handle(id); - } - else { + } else { // pool exhausted return _sspine_make_skeleton_handle(SSPINE_INVALID_ID); } @@ -3500,8 +3526,7 @@ static sspine_resource_state _sspine_init_skeleton(_sspine_skeleton_t* skeleton, _SSPINE_ERROR(CREATE_SKELETON_DATA_FROM_JSON_FAILED); return SSPINE_RESOURCESTATE_FAILED; } - } - else { + } else { spSkeletonBinary* skel_bin = spSkeletonBinary_create(atlas->sp_atlas); SOKOL_ASSERT(skel_bin); skel_bin->scale = desc->prescale; @@ -3687,8 +3712,7 @@ static sspine_skinset _sspine_alloc_skinset(void) { if (_SSPINE_INVALID_SLOT_INDEX != slot_index) { uint32_t id = _sspine_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); return _sspine_make_skinset_handle(id); - } - else { + } else { // pool exhausted return _sspine_make_skinset_handle(SSPINE_INVALID_ID); } @@ -3806,8 +3830,7 @@ static sspine_instance _sspine_alloc_instance(void) { if (_SSPINE_INVALID_SLOT_INDEX != slot_index) { uint32_t id = _sspine_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); res = _sspine_make_instance_handle(id); - } - else { + } else { // pool exhausted res = _sspine_make_instance_handle(SSPINE_INVALID_ID); } @@ -3822,8 +3845,7 @@ static void _sspine_rewind_triggered_events(_sspine_instance_t* instance) { static sspine_triggered_event_info* _sspine_next_triggered_event_info(_sspine_instance_t* instance) { if (instance->cur_triggered_event_index < _SSPINE_MAX_TRIGGERED_EVENTS) { return &instance->triggered_events[instance->cur_triggered_event_index++]; - } - else { + } else { return 0; } } @@ -4031,8 +4053,7 @@ static _sspine_command_t* _sspine_next_command(_sspine_context_t* ctx) { _sspine_check_rewind_commands(ctx); if (ctx->commands.next < ctx->commands.cap) { return &(ctx->commands.ptr[ctx->commands.next++]); - } - else { + } else { _SSPINE_ERROR(COMMAND_BUFFER_FULL); return 0; } @@ -4042,8 +4063,7 @@ static _sspine_command_t* _sspine_cur_command(_sspine_context_t* ctx) { _sspine_check_rewind_commands(ctx); if (ctx->commands.next > 0) { return &ctx->commands.ptr[ctx->commands.next - 1]; - } - else { + } else { return 0; } } @@ -4063,8 +4083,7 @@ static _sspine_alloc_vertices_result_t _sspine_alloc_vertices(_sspine_context_t* res.ptr = &(ctx->vertices.ptr[ctx->vertices.next]); res.index = ctx->vertices.next; ctx->vertices.next += num; - } - else { + } else { _SSPINE_ERROR(VERTEX_BUFFER_FULL); } return res; @@ -4085,8 +4104,7 @@ static _sspine_alloc_indices_result_t _sspine_alloc_indices(_sspine_context_t* c res.ptr = &(ctx->indices.ptr[ctx->indices.next]); res.index = ctx->indices.next; ctx->indices.next += num; - } - else { + } else { _SSPINE_ERROR(INDEX_BUFFER_FULL); } return res; @@ -4126,6 +4144,7 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in const uint16_t* indices = 0; const spColor* att_color = 0; sg_image img = { SG_INVALID_ID }; + sg_sampler smp = { SG_INVALID_ID }; bool premul_alpha = false; if (sp_slot->attachment->type == SP_ATTACHMENT_REGION) { static const uint16_t quad_indices[] = { 0, 1, 2, 2, 3, 0 }; @@ -4143,10 +4162,10 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in num_indices = 6; uvs = region->uvs; const spAtlasPage* sp_page = ((spAtlasRegion*)region->rendererObject)->page; - img.id = (uint32_t)(uintptr_t)sp_page->rendererObject; + img = _sspine_image_from_renderobject_handle(sp_page->rendererObject); + smp = _sspine_sampler_from_renderobject_handle(sp_page->rendererObject); premul_alpha = sp_page->pma != 0; - } - else if (sp_slot->attachment->type == SP_ATTACHMENT_MESH) { + } else if (sp_slot->attachment->type == SP_ATTACHMENT_MESH) { spMeshAttachment* mesh = (spMeshAttachment*)sp_slot->attachment; att_color = &mesh->color; // FIXME(?) early out if the slot alpha is 0 @@ -4154,7 +4173,6 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in spSkeletonClipping_clipEnd(sp_clip, sp_slot); continue; } - const int num_floats = mesh->super.worldVerticesLength; num_vertices = num_floats / 2; SOKOL_ASSERT(num_vertices <= max_tform_buf_verts); @@ -4164,15 +4182,14 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in num_indices = mesh->trianglesCount; // actually indicesCount??? uvs = mesh->uvs; const spAtlasPage* sp_page = ((spAtlasRegion*)mesh->rendererObject)->page; - img.id = (uint32_t)(uintptr_t)sp_page->rendererObject; + img = _sspine_image_from_renderobject_handle(sp_page->rendererObject); + smp = _sspine_sampler_from_renderobject_handle(sp_page->rendererObject); premul_alpha = sp_page->pma != 0; - } - else if (sp_slot->attachment->type == SP_ATTACHMENT_CLIPPING) { + } else if (sp_slot->attachment->type == SP_ATTACHMENT_CLIPPING) { spClippingAttachment* clip_attachment = (spClippingAttachment*) sp_slot->attachment; spSkeletonClipping_clipStart(sp_clip, sp_slot, clip_attachment); continue; - } - else { + } else { spSkeletonClipping_clipEnd(sp_clip, sp_slot); continue; } @@ -4180,6 +4197,7 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in SOKOL_ASSERT(indices && (num_indices > 0)); SOKOL_ASSERT(uvs); SOKOL_ASSERT(img.id != SG_INVALID_ID); + SOKOL_ASSERT(smp.id != SG_INVALID_ID); if (spSkeletonClipping_isClipping(sp_clip)) { spSkeletonClipping_clipTriangles(sp_clip, tform_buf, num_vertices * 2, (uint16_t*)indices, num_indices, uvs, tform_buf_stride); @@ -4192,7 +4210,6 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in SOKOL_ASSERT(vertices); SOKOL_ASSERT(indices); SOKOL_ASSERT(uvs); - SOKOL_ASSERT(img.id != SG_INVALID_ID); // there might be no geometry to render after clipping if ((0 == num_vertices) || (0 == num_indices)) { @@ -4243,17 +4260,23 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in // write new draw command, or merge with current draw command _sspine_command_t* cur_cmd = _sspine_cur_command(ctx); - if (cur_cmd && (cur_cmd->layer == layer) && (cur_cmd->pip.id == pip.id) && (cur_cmd->img.id == img.id) && (cur_cmd->pma == pma)) { + if (cur_cmd + && (cur_cmd->layer == layer) + && (cur_cmd->pip.id == pip.id) + && (cur_cmd->img.id == img.id) + && (cur_cmd->smp.id == smp.id) + && (cur_cmd->pma == pma)) + { // merge with current command cur_cmd->num_elements += num_indices; - } - else { + } else { // record a new command _sspine_command_t* cmd_ptr = _sspine_next_command(ctx); if (cmd_ptr) { cmd_ptr->layer = layer; cmd_ptr->pip = pip; cmd_ptr->img = img; + cmd_ptr->smp = smp; cmd_ptr->pma = pma; cmd_ptr->base_element = dst_indices.index; cmd_ptr->num_elements = num_indices; @@ -4317,20 +4340,25 @@ static void _sspine_draw_layer(_sspine_context_t* ctx, int layer, const sspine_l uint32_t cur_pip_id = SG_INVALID_ID; uint32_t cur_img_id = SG_INVALID_ID; + uint32_t cur_smp_id = SG_INVALID_ID; float cur_pma = -1.0f; for (int i = 0; i < ctx->commands.next; i++) { const _sspine_command_t* cmd = &ctx->commands.ptr[i]; - if ((layer == cmd->layer) && (sg_query_image_state(cmd->img) == SG_RESOURCESTATE_VALID)) { + const bool img_valid = sg_query_image_state(cmd->img) == SG_RESOURCESTATE_VALID; + const bool smp_valid = sg_query_sampler_state(cmd->smp) == SG_RESOURCESTATE_VALID; + if ((layer == cmd->layer) && img_valid && smp_valid) { if (cur_pip_id != cmd->pip.id) { sg_apply_pipeline(cmd->pip); cur_pip_id = cmd->pip.id; sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &vsparams_range); cur_img_id = SG_INVALID_ID; } - if (cur_img_id != cmd->img.id) { - ctx->bind.fs_images[0] = cmd->img; + if ((cur_img_id != cmd->img.id) || (cur_smp_id != cmd->smp.id)) { + ctx->bind.fs.images[0] = cmd->img; + ctx->bind.fs.samplers[0] = cmd->smp; sg_apply_bindings(&ctx->bind); cur_img_id = cmd->img.id; + cur_smp_id = cmd->smp.id; } if (cur_pma != cmd->pma) { fsparams.pma = cmd->pma; @@ -4380,21 +4408,35 @@ static sspine_context_desc _sspine_as_context_desc(const sspine_desc* desc) { return ctx_desc; } -static sg_filter _sspine_as_image_filter(spAtlasFilter filter) { +static sg_filter _sspine_as_sampler_filter(spAtlasFilter filter) { switch (filter) { case SP_ATLAS_UNKNOWN_FILTER: return _SG_FILTER_DEFAULT; case SP_ATLAS_NEAREST: return SG_FILTER_NEAREST; case SP_ATLAS_LINEAR: return SG_FILTER_LINEAR; - case SP_ATLAS_MIPMAP: return SG_FILTER_LINEAR_MIPMAP_NEAREST; - case SP_ATLAS_MIPMAP_NEAREST_NEAREST: return SG_FILTER_NEAREST_MIPMAP_NEAREST; - case SP_ATLAS_MIPMAP_LINEAR_NEAREST: return SG_FILTER_LINEAR_MIPMAP_NEAREST; - case SP_ATLAS_MIPMAP_NEAREST_LINEAR: return SG_FILTER_NEAREST_MIPMAP_LINEAR; - case SP_ATLAS_MIPMAP_LINEAR_LINEAR: return SG_FILTER_LINEAR_MIPMAP_LINEAR; - default: return _SG_FILTER_DEFAULT; + case SP_ATLAS_MIPMAP: return SG_FILTER_LINEAR; + case SP_ATLAS_MIPMAP_NEAREST_NEAREST: return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_LINEAR_NEAREST: return SG_FILTER_LINEAR; + case SP_ATLAS_MIPMAP_NEAREST_LINEAR: return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_LINEAR_LINEAR: return SG_FILTER_LINEAR; + default: return SG_FILTER_LINEAR; } } -static sg_wrap _sspine_as_image_wrap(spAtlasWrap wrap) { +static sg_filter _sspine_as_sampler_mipmap_filter(spAtlasFilter filter) { + switch (filter) { + case SP_ATLAS_UNKNOWN_FILTER: return _SG_FILTER_DEFAULT; + case SP_ATLAS_NEAREST: return SG_FILTER_NONE; + case SP_ATLAS_LINEAR: return SG_FILTER_NONE; + case SP_ATLAS_MIPMAP: return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_NEAREST_NEAREST: return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_LINEAR_NEAREST: return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_NEAREST_LINEAR: return SG_FILTER_LINEAR; + case SP_ATLAS_MIPMAP_LINEAR_LINEAR: return SG_FILTER_LINEAR; + default: return SG_FILTER_NEAREST; + } +} + +static sg_wrap _sspine_as_sampler_wrap(spAtlasWrap wrap) { switch (wrap) { case SP_ATLAS_MIRROREDREPEAT: return SG_WRAP_MIRRORED_REPEAT; case SP_ATLAS_CLAMPTOEDGE: return SG_WRAP_CLAMP_TO_EDGE; @@ -4408,30 +4450,32 @@ static void _sspine_init_image_info(const _sspine_atlas_t* atlas, int index, ssp SOKOL_ASSERT(page); SOKOL_ASSERT(page->name); info->valid = true; - info->sgimage.id = (uint32_t)(uintptr_t)page->rendererObject; + info->sgimage = _sspine_image_from_renderobject_handle(page->rendererObject); + info->sgsampler = _sspine_sampler_from_renderobject_handle(page->rendererObject); if (with_overrides && (atlas->overrides.min_filter != _SG_FILTER_DEFAULT)) { info->min_filter = atlas->overrides.min_filter; - } - else { - info->min_filter = _sspine_as_image_filter(page->minFilter); + } else { + info->min_filter = _sspine_as_sampler_filter(page->minFilter); } if (with_overrides && (atlas->overrides.mag_filter != _SG_FILTER_DEFAULT)) { info->mag_filter = atlas->overrides.mag_filter; + } else { + info->mag_filter = _sspine_as_sampler_filter(page->magFilter); } - else { - info->mag_filter = _sspine_as_image_filter(page->magFilter); + if (with_overrides && (atlas->overrides.mipmap_filter != _SG_FILTER_DEFAULT)) { + info->mipmap_filter = atlas->overrides.mipmap_filter; + } else { + info->mipmap_filter = _sspine_as_sampler_mipmap_filter(page->minFilter); } if (with_overrides && (atlas->overrides.wrap_u != _SG_WRAP_DEFAULT)) { info->wrap_u = atlas->overrides.wrap_u; - } - else { - info->wrap_u = _sspine_as_image_wrap(page->uWrap); + } else { + info->wrap_u = _sspine_as_sampler_wrap(page->uWrap); } if (with_overrides && (atlas->overrides.wrap_v != _SG_WRAP_DEFAULT)) { info->wrap_v = atlas->overrides.wrap_v; - } - else { - info->wrap_v = _sspine_as_image_wrap(page->vWrap); + } else { + info->wrap_v = _sspine_as_sampler_wrap(page->vWrap); } info->width = page->width; info->height = page->height; @@ -4465,9 +4509,15 @@ static void _sspine_init_shared(void) { shd_desc.fs.uniform_blocks[0].uniforms[0].name = "fs_params"; shd_desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; shd_desc.fs.uniform_blocks[0].uniforms[0].array_count = 1; - shd_desc.fs.images[0].name = "tex"; + shd_desc.fs.images[0].used = true; shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - shd_desc.fs.images[0].sampler_type = SG_SAMPLERTYPE_FLOAT; + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + shd_desc.fs.samplers[0].used = true; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.image_sampler_pairs[0].used = true; + shd_desc.fs.image_sampler_pairs[0].image_slot = 0; + shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; + shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; shd_desc.label = "sspine-shader"; #if defined(SOKOL_GLCORE33) shd_desc.vs.source = _sspine_vs_source_glsl330; @@ -4581,8 +4631,7 @@ SOKOL_API_IMPL sspine_context sspine_make_context(const sspine_context_desc* des if (ctx->slot.state == SSPINE_RESOURCESTATE_FAILED) { _sspine_deinit_context(ctx); } - } - else { + } else { ctx->slot.state = SSPINE_RESOURCESTATE_FAILED; _SSPINE_ERROR(CONTEXT_POOL_EXHAUSTED); } @@ -4605,8 +4654,7 @@ SOKOL_API_IMPL void sspine_set_context(sspine_context ctx_id) { SOKOL_ASSERT(_SSPINE_INIT_COOKIE == _sspine.init_cookie); if (_sspine_is_default_context(ctx_id)) { _sspine.cur_ctx_id = _sspine.def_ctx_id; - } - else { + } else { _sspine.cur_ctx_id = ctx_id; } // this will return null if the handle isn't valid @@ -4742,8 +4790,7 @@ SOKOL_API_IMPL sspine_atlas sspine_make_atlas(const sspine_atlas_desc* desc) { if (atlas->slot.state == SSPINE_RESOURCESTATE_FAILED) { _sspine_deinit_atlas(atlas); } - } - else { + } else { _SSPINE_ERROR(ATLAS_POOL_EXHAUSTED); } return atlas_id; @@ -4766,8 +4813,7 @@ SOKOL_API_IMPL sspine_skeleton sspine_make_skeleton(const sspine_skeleton_desc* if (skeleton->slot.state == SSPINE_RESOURCESTATE_FAILED) { _sspine_deinit_skeleton(skeleton); } - } - else { + } else { _SSPINE_ERROR(SKELETON_POOL_EXHAUSTED); } return skeleton_id; @@ -4790,8 +4836,7 @@ SOKOL_API_IMPL sspine_skinset sspine_make_skinset(const sspine_skinset_desc* des if (skinset->slot.state == SSPINE_RESOURCESTATE_FAILED) { _sspine_deinit_skinset(skinset); } - } - else { + } else { _SSPINE_ERROR(SKINSET_POOL_EXHAUSTED); } return skinset_id; @@ -4814,8 +4859,7 @@ SOKOL_API_IMPL sspine_instance sspine_make_instance(const sspine_instance_desc* if (instance->slot.state == SSPINE_RESOURCESTATE_FAILED) { _sspine_deinit_instance(instance); } - } - else { + } else { _SSPINE_ERROR(INSTANCE_POOL_EXHAUSTED); } return instance_id; @@ -4831,8 +4875,7 @@ SOKOL_API_IMPL sspine_resource_state sspine_get_context_resource_state(sspine_co const _sspine_context_t* ctx = _sspine_lookup_context(ctx_id.id); if (ctx) { return ctx->slot.state; - } - else { + } else { return SSPINE_RESOURCESTATE_INVALID; } } @@ -4842,8 +4885,7 @@ SOKOL_API_IMPL sspine_resource_state sspine_get_atlas_resource_state(sspine_atla const _sspine_atlas_t* atlas = _sspine_lookup_atlas(atlas_id.id); if (atlas) { return atlas->slot.state; - } - else { + } else { return SSPINE_RESOURCESTATE_INVALID; } } @@ -4853,8 +4895,7 @@ SOKOL_API_IMPL sspine_resource_state sspine_get_skeleton_resource_state(sspine_s const _sspine_skeleton_t* skeleton = _sspine_lookup_skeleton(skeleton_id.id); if (skeleton) { return skeleton->slot.state; - } - else { + } else { return SSPINE_RESOURCESTATE_INVALID; } } @@ -4864,8 +4905,7 @@ SOKOL_API_IMPL sspine_resource_state sspine_get_skinset_resource_state(sspine_sk const _sspine_skinset_t* skinset = _sspine_lookup_skinset(skinset_id.id); if (skinset) { return skinset->slot.state; - } - else { + } else { return SSPINE_RESOURCESTATE_INVALID; } } @@ -4875,8 +4915,7 @@ SOKOL_API_IMPL sspine_resource_state sspine_get_instance_resource_state(sspine_i const _sspine_instance_t* instance = _sspine_lookup_instance(instance_id.id); if (instance) { return instance->slot.state; - } - else { + } else { return SSPINE_RESOURCESTATE_INVALID; } } @@ -4967,8 +5006,7 @@ SOKOL_API_IMPL int sspine_num_atlas_pages(sspine_atlas atlas_id) { _sspine_atlas_t* atlas = _sspine_lookup_atlas(atlas_id.id); if (atlas) { return atlas->num_pages; - } - else { + } else { return 0; } } @@ -5363,8 +5401,7 @@ SOKOL_API_IMPL float sspine_get_bone_rotation(sspine_instance instance_id, sspin spBone* sp_bone = _sspine_lookup_bone(instance_id.id, bone.skeleton_id, bone.index); if (sp_bone) { return sp_bone->rotation; - } - else { + } else { return 0.0f; } } From 7273069799077786c3f13361f4667c61afe41157 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 21 Jun 2023 19:54:09 +0200 Subject: [PATCH 037/292] sokol_gfx.h: remove err_ trace hooks (redundant with new error logging) --- sokol_gfx.h | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0985c963a..a9ab928e5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2759,16 +2759,6 @@ typedef struct sg_trace_hooks { void (*fail_pass)(sg_pass pass_id, void* user_data); void (*push_debug_group)(const char* name, void* user_data); void (*pop_debug_group)(void* user_data); - void (*err_buffer_pool_exhausted)(void* user_data); - void (*err_image_pool_exhausted)(void* user_data); - void (*err_sampler_pool_exhausted)(void* user_data); - void (*err_shader_pool_exhausted)(void* user_data); - void (*err_pipeline_pool_exhausted)(void* user_data); - void (*err_pass_pool_exhausted)(void* user_data); - void (*err_context_mismatch)(void* user_data); - void (*err_pass_invalid)(void* user_data); - void (*err_draw_invalid)(void* user_data); - void (*err_bindings_invalid)(void* user_data); } sg_trace_hooks; /* @@ -15525,7 +15515,6 @@ _SOKOL_PRIVATE sg_buffer _sg_alloc_buffer(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(BUFFER_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_buffer_pool_exhausted); } return res; } @@ -15538,7 +15527,6 @@ _SOKOL_PRIVATE sg_image _sg_alloc_image(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(IMAGE_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_image_pool_exhausted); } return res; } @@ -15551,7 +15539,6 @@ _SOKOL_PRIVATE sg_sampler _sg_alloc_sampler(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(SAMPLER_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_sampler_pool_exhausted); } return res; } @@ -15564,7 +15551,6 @@ _SOKOL_PRIVATE sg_shader _sg_alloc_shader(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(SHADER_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_shader_pool_exhausted); } return res; } @@ -15577,7 +15563,6 @@ _SOKOL_PRIVATE sg_pipeline _sg_alloc_pipeline(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(PIPELINE_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_pipeline_pool_exhausted); } return res; } @@ -15590,7 +15575,6 @@ _SOKOL_PRIVATE sg_pass _sg_alloc_pass(void) { } else { res.id = SG_INVALID_ID; _SG_ERROR(PASS_POOL_EXHAUSTED); - _SG_TRACE_NOARGS(err_pass_pool_exhausted); } return res; } @@ -15742,7 +15726,6 @@ _SOKOL_PRIVATE void _sg_uninit_buffer(_sg_buffer_t* buf) { _sg_reset_buffer_to_alloc_state(buf); } else { _SG_WARN(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -15753,7 +15736,6 @@ _SOKOL_PRIVATE void _sg_uninit_image(_sg_image_t* img) { _sg_reset_image_to_alloc_state(img); } else { _SG_WARN(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -15764,7 +15746,6 @@ _SOKOL_PRIVATE void _sg_uninit_sampler(_sg_sampler_t* smp) { _sg_reset_sampler_to_alloc_state(smp); } else { _SG_WARN(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -15775,7 +15756,6 @@ _SOKOL_PRIVATE void _sg_uninit_shader(_sg_shader_t* shd) { _sg_reset_shader_to_alloc_state(shd); } else { _SG_WARN(UNINIT_SHADER_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -15786,7 +15766,6 @@ _SOKOL_PRIVATE void _sg_uninit_pipeline(_sg_pipeline_t* pip) { _sg_reset_pipeline_to_alloc_state(pip); } else { _SG_WARN(UNINIT_PIPELINE_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -15797,7 +15776,6 @@ _SOKOL_PRIVATE void _sg_uninit_pass(_sg_pass_t* pass) { _sg_reset_pass_to_alloc_state(pass); } else { _SG_WARN(UNINIT_PASS_ACTIVE_CONTEXT_MISMATCH); - _SG_TRACE_NOARGS(err_context_mismatch); } } @@ -16673,14 +16651,12 @@ SOKOL_API_IMPL void sg_begin_pass(sg_pass pass_id, const sg_pass_action* pass_ac _SG_TRACE_ARGS(begin_pass, pass_id, &pa); } else { _sg.pass_valid = false; - _SG_TRACE_NOARGS(err_pass_invalid); } } SOKOL_API_IMPL void sg_apply_viewport(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } _sg_apply_viewport(x, y, width, height, origin_top_left); @@ -16694,7 +16670,6 @@ SOKOL_API_IMPL void sg_apply_viewportf(float x, float y, float width, float heig SOKOL_API_IMPL void sg_apply_scissor_rect(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } _sg_apply_scissor_rect(x, y, width, height, origin_top_left); @@ -16710,11 +16685,9 @@ SOKOL_API_IMPL void sg_apply_pipeline(sg_pipeline pip_id) { _sg.bindings_valid = false; if (!_sg_validate_apply_pipeline(pip_id)) { _sg.next_draw_valid = false; - _SG_TRACE_NOARGS(err_draw_invalid); return; } if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } _sg.cur_pipeline = pip_id; @@ -16732,7 +16705,6 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { SOKOL_ASSERT((bindings->_start_canary == 0) && (bindings->_end_canary==0)); if (!_sg_validate_apply_bindings(bindings)) { _sg.next_draw_valid = false; - _SG_TRACE_NOARGS(err_draw_invalid); return; } _sg.bindings_valid = true; @@ -16814,8 +16786,6 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { int ib_offset = bindings->index_buffer_offset; _sg_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); _SG_TRACE_ARGS(apply_bindings, bindings); - } else { - _SG_TRACE_NOARGS(err_draw_invalid); } } @@ -16826,15 +16796,12 @@ SOKOL_API_IMPL void sg_apply_uniforms(sg_shader_stage stage, int ub_index, const SOKOL_ASSERT(data && data->ptr && (data->size > 0)); if (!_sg_validate_apply_uniforms(stage, ub_index, data)) { _sg.next_draw_valid = false; - _SG_TRACE_NOARGS(err_draw_invalid); return; } if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } if (!_sg.next_draw_valid) { - _SG_TRACE_NOARGS(err_draw_invalid); return; } _sg_apply_uniforms(stage, ub_index, data); @@ -16852,22 +16819,18 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance } #endif if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } if (!_sg.next_draw_valid) { - _SG_TRACE_NOARGS(err_draw_invalid); return; } if (!_sg.bindings_valid) { - _SG_TRACE_NOARGS(err_bindings_invalid); return; } /* attempting to draw with zero elements or instances is not technically an error, but might be handled as an error in the backend API (e.g. on Metal) */ if ((0 == num_elements) || (0 == num_instances)) { - _SG_TRACE_NOARGS(err_draw_invalid); return; } _sg_draw(base_element, num_elements, num_instances); @@ -16877,7 +16840,6 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_API_IMPL void sg_end_pass(void) { SOKOL_ASSERT(_sg.valid); if (!_sg.pass_valid) { - _SG_TRACE_NOARGS(err_pass_invalid); return; } _sg_end_pass(); From 6ad7fc31e45e0c159d686f06b04e0aa05498d70c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 21 Jun 2023 19:54:37 +0200 Subject: [PATCH 038/292] sokol_gfx_imgui.h: fix for separate images/samplers --- util/sokol_gfx_imgui.h | 810 ++++++++++++++++++++++++++--------------- 1 file changed, 512 insertions(+), 298 deletions(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 6999b4367..ec9c5063e 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -89,6 +89,7 @@ sg_imgui.buffers.open = true; sg_imgui.images.open = true; + sg_imgui.samplers.open = true; sg_imgui.shaders.open = true; sg_imgui.pipelines.open = true; sg_imgui.passes.open = true; @@ -101,6 +102,7 @@ if (ImGui::BeginMenu("sokol-gfx")) { ImGui::MenuItem("Buffers", 0, &sg_imgui.buffers.open); ImGui::MenuItem("Images", 0, &sg_imgui.images.open); + ImGui::MenuItem("Samplers", 0, &sg_imgui.samplers.open); ImGui::MenuItem("Shaders", 0, &sg_imgui.shaders.open); ImGui::MenuItem("Pipelines", 0, &sg_imgui.pipelines.open); ImGui::MenuItem("Passes", 0, &sg_imgui.passes.open); @@ -131,6 +133,7 @@ void sg_imgui_draw_buffers_content(sg_imgui_t* ctx); void sg_imgui_draw_images_content(sg_imgui_t* ctx); + void sg_imgui_draw_samplers_content(sg_imgui_t* ctx); void sg_imgui_draw_shaders_content(sg_imgui_t* ctx); void sg_imgui_draw_pipelines_content(sg_imgui_t* ctx); void sg_imgui_draw_passes_content(sg_imgui_t* ctx); @@ -140,6 +143,7 @@ void sg_imgui_draw_buffers_window(sg_imgui_t* ctx); void sg_imgui_draw_images_window(sg_imgui_t* ctx); + void sg_imgui_draw_samplers_window(sg_imgui_t* ctx); void sg_imgui_draw_shaders_window(sg_imgui_t* ctx); void sg_imgui_draw_pipelines_window(sg_imgui_t* ctx); void sg_imgui_draw_passes_window(sg_imgui_t* ctx); @@ -248,16 +252,22 @@ typedef struct sg_imgui_image_t { sg_image_desc desc; } sg_imgui_image_t; +typedef struct sg_imgui_sampler_t { + sg_sampler res_id; + sg_imgui_str_t label; + sg_sampler_desc desc; +} sg_imgui_sampler_t; + typedef struct sg_imgui_shader_t { sg_shader res_id; sg_imgui_str_t label; sg_imgui_str_t vs_entry; sg_imgui_str_t vs_d3d11_target; - sg_imgui_str_t vs_image_name[SG_MAX_SHADERSTAGE_IMAGES]; + sg_imgui_str_t vs_image_sampler_name[SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS]; sg_imgui_str_t vs_uniform_name[SG_MAX_SHADERSTAGE_UBS][SG_MAX_UB_MEMBERS]; sg_imgui_str_t fs_entry; sg_imgui_str_t fs_d3d11_target; - sg_imgui_str_t fs_image_name[SG_MAX_SHADERSTAGE_IMAGES]; + sg_imgui_str_t fs_image_sampler_name[SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS]; sg_imgui_str_t fs_uniform_name[SG_MAX_SHADERSTAGE_UBS][SG_MAX_UB_MEMBERS]; sg_imgui_str_t attr_name[SG_MAX_VERTEX_ATTRIBUTES]; sg_imgui_str_t attr_sem_name[SG_MAX_VERTEX_ATTRIBUTES]; @@ -293,6 +303,13 @@ typedef struct sg_imgui_images_t { sg_imgui_image_t* slots; } sg_imgui_images_t; +typedef struct sg_imgui_samplers_t { + bool open; + int num_slots; + sg_sampler sel_smp; + sg_imgui_sampler_t* slots; +} sg_imgui_samplers_t; + typedef struct sg_imgui_shaders_t { bool open; int num_slots; @@ -319,11 +336,13 @@ typedef enum sg_imgui_cmd_t { SG_IMGUI_CMD_RESET_STATE_CACHE, SG_IMGUI_CMD_MAKE_BUFFER, SG_IMGUI_CMD_MAKE_IMAGE, + SG_IMGUI_CMD_MAKE_SAMPLER, SG_IMGUI_CMD_MAKE_SHADER, SG_IMGUI_CMD_MAKE_PIPELINE, SG_IMGUI_CMD_MAKE_PASS, SG_IMGUI_CMD_DESTROY_BUFFER, SG_IMGUI_CMD_DESTROY_IMAGE, + SG_IMGUI_CMD_DESTROY_SAMPLER, SG_IMGUI_CMD_DESTROY_SHADER, SG_IMGUI_CMD_DESTROY_PIPELINE, SG_IMGUI_CMD_DESTROY_PASS, @@ -342,40 +361,36 @@ typedef enum sg_imgui_cmd_t { SG_IMGUI_CMD_COMMIT, SG_IMGUI_CMD_ALLOC_BUFFER, SG_IMGUI_CMD_ALLOC_IMAGE, + SG_IMGUI_CMD_ALLOC_SAMPLER, SG_IMGUI_CMD_ALLOC_SHADER, SG_IMGUI_CMD_ALLOC_PIPELINE, SG_IMGUI_CMD_ALLOC_PASS, SG_IMGUI_CMD_DEALLOC_BUFFER, SG_IMGUI_CMD_DEALLOC_IMAGE, + SG_IMGUI_CMD_DEALLOC_SAMPLER, SG_IMGUI_CMD_DEALLOC_SHADER, SG_IMGUI_CMD_DEALLOC_PIPELINE, SG_IMGUI_CMD_DEALLOC_PASS, SG_IMGUI_CMD_INIT_BUFFER, SG_IMGUI_CMD_INIT_IMAGE, + SG_IMGUI_CMD_INIT_SAMPLER, SG_IMGUI_CMD_INIT_SHADER, SG_IMGUI_CMD_INIT_PIPELINE, SG_IMGUI_CMD_INIT_PASS, SG_IMGUI_CMD_UNINIT_BUFFER, SG_IMGUI_CMD_UNINIT_IMAGE, + SG_IMGUI_CMD_UNINIT_SAMPLER, SG_IMGUI_CMD_UNINIT_SHADER, SG_IMGUI_CMD_UNINIT_PIPELINE, SG_IMGUI_CMD_UNINIT_PASS, SG_IMGUI_CMD_FAIL_BUFFER, SG_IMGUI_CMD_FAIL_IMAGE, + SG_IMGUI_CMD_FAIL_SAMPLER, SG_IMGUI_CMD_FAIL_SHADER, SG_IMGUI_CMD_FAIL_PIPELINE, SG_IMGUI_CMD_FAIL_PASS, SG_IMGUI_CMD_PUSH_DEBUG_GROUP, SG_IMGUI_CMD_POP_DEBUG_GROUP, - SG_IMGUI_CMD_ERR_BUFFER_POOL_EXHAUSTED, - SG_IMGUI_CMD_ERR_IMAGE_POOL_EXHAUSTED, - SG_IMGUI_CMD_ERR_SHADER_POOL_EXHAUSTED, - SG_IMGUI_CMD_ERR_PIPELINE_POOL_EXHAUSTED, - SG_IMGUI_CMD_ERR_PASS_POOL_EXHAUSTED, - SG_IMGUI_CMD_ERR_CONTEXT_MISMATCH, - SG_IMGUI_CMD_ERR_PASS_INVALID, - SG_IMGUI_CMD_ERR_DRAW_INVALID, - SG_IMGUI_CMD_ERR_BINDINGS_INVALID, } sg_imgui_cmd_t; typedef struct sg_imgui_args_make_buffer_t { @@ -386,6 +401,10 @@ typedef struct sg_imgui_args_make_image_t { sg_image result; } sg_imgui_args_make_image_t; +typedef struct sg_imgui_args_make_sampler_t { + sg_sampler result; +} sg_imgui_args_make_sampler_t; + typedef struct sg_imgui_args_make_shader_t { sg_shader result; } sg_imgui_args_make_shader_t; @@ -406,6 +425,10 @@ typedef struct sg_imgui_args_destroy_image_t { sg_image image; } sg_imgui_args_destroy_image_t; +typedef struct sg_imgui_args_destroy_sampler_t { + sg_sampler sampler; +} sg_imgui_args_destroy_sampler_t; + typedef struct sg_imgui_args_destroy_shader_t { sg_shader shader; } sg_imgui_args_destroy_shader_t; @@ -484,6 +507,10 @@ typedef struct sg_imgui_args_alloc_image_t { sg_image result; } sg_imgui_args_alloc_image_t; +typedef struct sg_imgui_args_alloc_sampler_t { + sg_sampler result; +} sg_imgui_args_alloc_sampler_t; + typedef struct sg_imgui_args_alloc_shader_t { sg_shader result; } sg_imgui_args_alloc_shader_t; @@ -504,6 +531,10 @@ typedef struct sg_imgui_args_dealloc_image_t { sg_image image; } sg_imgui_args_dealloc_image_t; +typedef struct sg_imgui_args_dealloc_sampler_t { + sg_sampler sampler; +} sg_imgui_args_dealloc_sampler_t; + typedef struct sg_imgui_args_dealloc_shader_t { sg_shader shader; } sg_imgui_args_dealloc_shader_t; @@ -524,6 +555,10 @@ typedef struct sg_imgui_args_init_image_t { sg_image image; } sg_imgui_args_init_image_t; +typedef struct sg_imgui_args_init_sampler_t { + sg_sampler sampler; +} sg_imgui_args_init_sampler_t; + typedef struct sg_imgui_args_init_shader_t { sg_shader shader; } sg_imgui_args_init_shader_t; @@ -544,6 +579,10 @@ typedef struct sg_imgui_args_uninit_image_t { sg_image image; } sg_imgui_args_uninit_image_t; +typedef struct sg_imgui_args_uninit_sampler_t { + sg_sampler sampler; +} sg_imgui_args_uninit_sampler_t; + typedef struct sg_imgui_args_uninit_shader_t { sg_shader shader; } sg_imgui_args_uninit_shader_t; @@ -564,6 +603,10 @@ typedef struct sg_imgui_args_fail_image_t { sg_image image; } sg_imgui_args_fail_image_t; +typedef struct sg_imgui_args_fail_sampler_t { + sg_sampler sampler; +} sg_imgui_args_fail_sampler_t; + typedef struct sg_imgui_args_fail_shader_t { sg_shader shader; } sg_imgui_args_fail_shader_t; @@ -583,11 +626,13 @@ typedef struct sg_imgui_args_push_debug_group_t { typedef union sg_imgui_args_t { sg_imgui_args_make_buffer_t make_buffer; sg_imgui_args_make_image_t make_image; + sg_imgui_args_make_sampler_t make_sampler; sg_imgui_args_make_shader_t make_shader; sg_imgui_args_make_pipeline_t make_pipeline; sg_imgui_args_make_pass_t make_pass; sg_imgui_args_destroy_buffer_t destroy_buffer; sg_imgui_args_destroy_image_t destroy_image; + sg_imgui_args_destroy_sampler_t destroy_sampler; sg_imgui_args_destroy_shader_t destroy_shader; sg_imgui_args_destroy_pipeline_t destroy_pipeline; sg_imgui_args_destroy_pass_t destroy_pass; @@ -604,26 +649,31 @@ typedef union sg_imgui_args_t { sg_imgui_args_draw_t draw; sg_imgui_args_alloc_buffer_t alloc_buffer; sg_imgui_args_alloc_image_t alloc_image; + sg_imgui_args_alloc_sampler_t alloc_sampler; sg_imgui_args_alloc_shader_t alloc_shader; sg_imgui_args_alloc_pipeline_t alloc_pipeline; sg_imgui_args_alloc_pass_t alloc_pass; sg_imgui_args_dealloc_buffer_t dealloc_buffer; sg_imgui_args_dealloc_image_t dealloc_image; + sg_imgui_args_dealloc_sampler_t dealloc_sampler; sg_imgui_args_dealloc_shader_t dealloc_shader; sg_imgui_args_dealloc_pipeline_t dealloc_pipeline; sg_imgui_args_dealloc_pass_t dealloc_pass; sg_imgui_args_init_buffer_t init_buffer; sg_imgui_args_init_image_t init_image; + sg_imgui_args_init_sampler_t init_sampler; sg_imgui_args_init_shader_t init_shader; sg_imgui_args_init_pipeline_t init_pipeline; sg_imgui_args_init_pass_t init_pass; sg_imgui_args_uninit_buffer_t uninit_buffer; sg_imgui_args_uninit_image_t uninit_image; + sg_imgui_args_uninit_sampler_t uninit_sampler; sg_imgui_args_uninit_shader_t uninit_shader; sg_imgui_args_uninit_pipeline_t uninit_pipeline; sg_imgui_args_uninit_pass_t uninit_pass; sg_imgui_args_fail_buffer_t fail_buffer; sg_imgui_args_fail_image_t fail_image; + sg_imgui_args_fail_sampler_t fail_sampler; sg_imgui_args_fail_shader_t fail_shader; sg_imgui_args_fail_pipeline_t fail_pipeline; sg_imgui_args_fail_pass_t fail_pass; @@ -686,6 +736,7 @@ typedef struct sg_imgui_t { sg_imgui_desc_t desc; sg_imgui_buffers_t buffers; sg_imgui_images_t images; + sg_imgui_samplers_t samplers; sg_imgui_shaders_t shaders; sg_imgui_pipelines_t pipelines; sg_imgui_passes_t passes; @@ -701,6 +752,7 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_buffers_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_images_content(sg_imgui_t* ctx); +SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_samplers_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_shaders_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_pipelines_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_passes_content(sg_imgui_t* ctx); @@ -709,6 +761,7 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capabilities_content(sg_imgui_t* ctx SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_buffers_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_images_window(sg_imgui_t* ctx); +SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_samplers_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_shaders_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_pipelines_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_passes_window(sg_imgui_t* ctx); @@ -862,8 +915,7 @@ _SOKOL_PRIVATE void* _sg_imgui_malloc(const sg_imgui_allocator_t* allocator, siz void* ptr; if (allocator->alloc) { ptr = allocator->alloc(size, allocator->user_data); - } - else { + } else { ptr = malloc(size); } SOKOL_ASSERT(ptr); @@ -880,8 +932,7 @@ _SOKOL_PRIVATE void _sg_imgui_free(const sg_imgui_allocator_t* allocator, void* SOKOL_ASSERT(allocator); if (allocator->free) { allocator->free(ptr, allocator->user_data); - } - else { + } else { free(ptr); } } @@ -930,8 +981,7 @@ _SOKOL_PRIVATE uint32_t _sg_imgui_std140_uniform_alignment(sg_uniform_type type, SOKOL_UNREACHABLE; return 1; } - } - else { + } else { return 16; } } @@ -958,8 +1008,7 @@ _SOKOL_PRIVATE uint32_t _sg_imgui_std140_uniform_size(sg_uniform_type type, int SOKOL_UNREACHABLE; return 0; } - } - else { + } else { switch (type) { case SG_UNIFORMTYPE_FLOAT: case SG_UNIFORMTYPE_FLOAT2: @@ -988,8 +1037,7 @@ _SOKOL_PRIVATE void _sg_imgui_strcpy(sg_imgui_str_t* dst, const char* src) { strncpy(dst->buf, src, SG_IMGUI_STRBUF_LEN); #endif dst->buf[SG_IMGUI_STRBUF_LEN-1] = 0; - } - else { + } else { _sg_imgui_clear(dst->buf, SG_IMGUI_STRBUF_LEN); } } @@ -1081,12 +1129,29 @@ _SOKOL_PRIVATE const char* _sg_imgui_imagetype_string(sg_image_type t) { } } +_SOKOL_PRIVATE const char* _sg_imgui_imagesampletype_string(sg_image_sample_type t) { + switch (t) { + case SG_IMAGESAMPLETYPE_FLOAT: return "SG_IMAGESAMPLETYPE_FLOAT"; + case SG_IMAGESAMPLETYPE_DEPTH: return "SG_IMAGESAMPLETYPE_DEPTH"; + case SG_IMAGESAMPLETYPE_SINT: return "SG_IMAGESAMPLETYPE_SINT"; + case SG_IMAGESAMPLETYPE_UINT: return "SG_IMAGESAMPLETYPE_UINT"; + default: return "???"; + } +} + _SOKOL_PRIVATE const char* _sg_imgui_samplertype_string(sg_sampler_type t) { switch (t) { - case SG_SAMPLERTYPE_FLOAT: return "SG_SAMPLERTYPE_FLOAT"; - case SG_SAMPLERTYPE_SINT: return "SG_SAMPLERTYPE_SINT"; - case SG_SAMPLERTYPE_UINT: return "SG_SAMPLERTYPE_UINT"; - default: return "???"; + case SG_SAMPLERTYPE_SAMPLE: return "SG_SAMPLERTYPE_SAMPLE"; + case SG_SAMPLERTYPE_COMPARE: return "SG_SAMPLERTYPE_COMPARE"; + default: return "???"; + } +} + +_SOKOL_PRIVATE const char* _sg_imgui_uniformlayout_string(sg_uniform_layout l) { + switch (l) { + case SG_UNIFORMLAYOUT_NATIVE: return "SG_UNIFORMLAYOUT_NATIVE"; + case SG_UNIFORMLAYOUT_STD140: return "SG_UNIFORMLAYOUT_STD140"; + default: return "???"; } } @@ -1161,13 +1226,10 @@ _SOKOL_PRIVATE const char* _sg_imgui_pixelformat_string(sg_pixel_format fmt) { _SOKOL_PRIVATE const char* _sg_imgui_filter_string(sg_filter f) { switch (f) { - case SG_FILTER_NEAREST: return "SG_FILTER_NEAREST"; - case SG_FILTER_LINEAR: return "SG_FILTER_LINEAR"; - case SG_FILTER_NEAREST_MIPMAP_NEAREST: return "SG_FILTER_NEAREST_MIPMAP_NEAREST"; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: return "SG_FILTER_NEAREST_MIPMAP_LINEAR"; - case SG_FILTER_LINEAR_MIPMAP_NEAREST: return "SG_FILTER_LINEAR_MIPMAP_NEAREST"; - case SG_FILTER_LINEAR_MIPMAP_LINEAR: return "SG_FILTER_LINEAR_MIPMAP_LINEAR"; - default: return "???"; + case SG_FILTER_NONE: return "SG_FILTER_NONE"; + case SG_FILTER_NEAREST: return "SG_FILTER_NEAREST"; + case SG_FILTER_LINEAR: return "SG_FILTER_LINEAR"; + default: return "???"; } } @@ -1373,8 +1435,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_res_id_string(uint32_t res_id, const cha sg_imgui_str_t res; if (label[0]) { _sg_imgui_snprintf(&res, "'%s'", label); - } - else { + } else { _sg_imgui_snprintf(&res, "0x%08X", res_id); } return res; @@ -1384,8 +1445,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_buffer_id_string(sg_imgui_t* ctx, sg_buf if (buf_id.id != SG_INVALID_ID) { const sg_imgui_buffer_t* buf_ui = &ctx->buffers.slots[_sg_imgui_slot_index(buf_id.id)]; return _sg_imgui_res_id_string(buf_id.id, buf_ui->label.buf); - } - else { + } else { return _sg_imgui_make_str(""); } } @@ -1394,8 +1454,16 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_image_id_string(sg_imgui_t* ctx, sg_imag if (img_id.id != SG_INVALID_ID) { const sg_imgui_image_t* img_ui = &ctx->images.slots[_sg_imgui_slot_index(img_id.id)]; return _sg_imgui_res_id_string(img_id.id, img_ui->label.buf); + } else { + return _sg_imgui_make_str(""); } - else { +} + +_SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_sampler_id_string(sg_imgui_t* ctx, sg_sampler smp_id) { + if (smp_id.id != SG_INVALID_ID) { + const sg_imgui_sampler_t* smp_ui = &ctx->samplers.slots[_sg_imgui_slot_index(smp_id.id)]; + return _sg_imgui_res_id_string(smp_id.id, smp_ui->label.buf); + } else { return _sg_imgui_make_str(""); } } @@ -1404,8 +1472,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_shader_id_string(sg_imgui_t* ctx, sg_sha if (shd_id.id != SG_INVALID_ID) { const sg_imgui_shader_t* shd_ui = &ctx->shaders.slots[_sg_imgui_slot_index(shd_id.id)]; return _sg_imgui_res_id_string(shd_id.id, shd_ui->label.buf); - } - else { + } else { return _sg_imgui_make_str(""); } } @@ -1414,8 +1481,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_pipeline_id_string(sg_imgui_t* ctx, sg_p if (pip_id.id != SG_INVALID_ID) { const sg_imgui_pipeline_t* pip_ui = &ctx->pipelines.slots[_sg_imgui_slot_index(pip_id.id)]; return _sg_imgui_res_id_string(pip_id.id, pip_ui->label.buf); - } - else { + } else { return _sg_imgui_make_str(""); } } @@ -1424,8 +1490,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_pass_id_string(sg_imgui_t* ctx, sg_pass if (pass_id.id != SG_INVALID_ID) { const sg_imgui_pass_t* pass_ui = &ctx->passes.slots[_sg_imgui_slot_index(pass_id.id)]; return _sg_imgui_res_id_string(pass_id.id, pass_ui->label.buf); - } - else { + } else { return _sg_imgui_make_str(""); } } @@ -1460,6 +1525,20 @@ _SOKOL_PRIVATE void _sg_imgui_image_destroyed(sg_imgui_t* ctx, int slot_index) { img->res_id.id = SG_INVALID_ID; } +_SOKOL_PRIVATE void _sg_imgui_sampler_created(sg_imgui_t* ctx, sg_sampler res_id, int slot_index, const sg_sampler_desc* desc) { + SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->samplers.num_slots)); + sg_imgui_sampler_t* smp = &ctx->samplers.slots[slot_index]; + smp->res_id = res_id; + smp->desc = *desc; + smp->label = _sg_imgui_make_str(desc->label); +} + +_SOKOL_PRIVATE void _sg_imgui_sampler_destroyed(sg_imgui_t* ctx, int slot_index) { + SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->samplers.num_slots)); + sg_imgui_sampler_t* smp = &ctx->samplers.slots[slot_index]; + smp->res_id.id = SG_INVALID_ID; +} + _SOKOL_PRIVATE void _sg_imgui_shader_created(sg_imgui_t* ctx, sg_shader res_id, int slot_index, const sg_shader_desc* desc) { SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->shaders.num_slots)); sg_imgui_shader_t* shd = &ctx->shaders.slots[slot_index]; @@ -1500,16 +1579,16 @@ _SOKOL_PRIVATE void _sg_imgui_shader_created(sg_imgui_t* ctx, sg_shader res_id, } } } - for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - if (shd->desc.vs.images[i].name) { - shd->vs_image_name[i] = _sg_imgui_make_str(shd->desc.vs.images[i].name); - shd->desc.vs.images[i].name = shd->vs_image_name[i].buf; + for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS; i++) { + if (shd->desc.vs.image_sampler_pairs[i].glsl_name) { + shd->vs_image_sampler_name[i] = _sg_imgui_make_str(shd->desc.vs.image_sampler_pairs[i].glsl_name); + shd->desc.vs.image_sampler_pairs[i].glsl_name = shd->vs_image_sampler_name[i].buf; } } - for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - if (shd->desc.fs.images[i].name) { - shd->fs_image_name[i] = _sg_imgui_make_str(shd->desc.fs.images[i].name); - shd->desc.fs.images[i].name = shd->fs_image_name[i].buf; + for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS; i++) { + if (shd->desc.fs.image_sampler_pairs[i].glsl_name) { + shd->fs_image_sampler_name[i] = _sg_imgui_make_str(shd->desc.fs.image_sampler_pairs[i].glsl_name); + shd->desc.fs.image_sampler_pairs[i].glsl_name = shd->fs_image_sampler_name[i].buf; } } if (shd->desc.vs.source) { @@ -1641,8 +1720,7 @@ _SOKOL_PRIVATE sg_imgui_capture_item_t* _sg_imgui_capture_next_write_item(sg_img if (bucket->num_items < SG_IMGUI_MAX_FRAMECAPTURE_ITEMS) { sg_imgui_capture_item_t* item = &bucket->items[bucket->num_items++]; return item; - } - else { + } else { return 0; } } @@ -1693,6 +1771,12 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_MAKE_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.make_sampler.result); + _sg_imgui_snprintf(&str, "%d: sg_make_sampler(desc=..) => %s", index, res_id.buf); + } + break; case SG_IMGUI_CMD_MAKE_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.make_shader.result); @@ -1728,6 +1812,12 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_DESTROY_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.destroy_sampler.sampler); + _sg_imgui_snprintf(&str, "%d: sg_destroy_sampler(smp=%s)", index, res_id.buf); + } + case SG_IMGUI_CMD_DESTROY_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.destroy_shader.shader); @@ -1858,6 +1948,12 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_ALLOC_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.alloc_sampler.result); + _sg_imgui_snprintf(&str, "%d: sg_alloc_sampler() => %s", index, res_id.buf); + } + case SG_IMGUI_CMD_ALLOC_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.alloc_shader.result); @@ -1893,6 +1989,13 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_DEALLOC_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.dealloc_sampler.sampler); + _sg_imgui_snprintf(&str, "%d: sg_dealloc_sampler() => %s", index, res_id.buf); + } + break; + case SG_IMGUI_CMD_DEALLOC_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.dealloc_shader.shader); @@ -1928,6 +2031,13 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_INIT_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.init_sampler.sampler); + _sg_imgui_snprintf(&str, "%d: sg_init_sampler(smp=%s, desc=..)", index, res_id.buf); + } + break; + case SG_IMGUI_CMD_INIT_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.init_shader.shader); @@ -1952,35 +2062,42 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int case SG_IMGUI_CMD_UNINIT_BUFFER: { sg_imgui_str_t res_id = _sg_imgui_buffer_id_string(ctx, item->args.uninit_buffer.buffer); - _sg_imgui_snprintf(&str, "%d: sg_uninit_buffer(buf=%s, desc=..)", index, res_id.buf); + _sg_imgui_snprintf(&str, "%d: sg_uninit_buffer(buf=%s)", index, res_id.buf); } break; case SG_IMGUI_CMD_UNINIT_IMAGE: { sg_imgui_str_t res_id = _sg_imgui_image_id_string(ctx, item->args.uninit_image.image); - _sg_imgui_snprintf(&str, "%d: sg_uninit_image(img=%s, desc=..)", index, res_id.buf); + _sg_imgui_snprintf(&str, "%d: sg_uninit_image(img=%s)", index, res_id.buf); + } + break; + + case SG_IMGUI_CMD_UNINIT_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.uninit_sampler.sampler); + _sg_imgui_snprintf(&str, "%d: sg_uninit_sampler(smp=%s)", index, res_id.buf); } break; case SG_IMGUI_CMD_UNINIT_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.uninit_shader.shader); - _sg_imgui_snprintf(&str, "%d: sg_uninit_shader(shd=%s, desc=..)", index, res_id.buf); + _sg_imgui_snprintf(&str, "%d: sg_uninit_shader(shd=%s)", index, res_id.buf); } break; case SG_IMGUI_CMD_UNINIT_PIPELINE: { sg_imgui_str_t res_id = _sg_imgui_pipeline_id_string(ctx, item->args.uninit_pipeline.pipeline); - _sg_imgui_snprintf(&str, "%d: sg_uninit_pipeline(pip=%s, desc=..)", index, res_id.buf); + _sg_imgui_snprintf(&str, "%d: sg_uninit_pipeline(pip=%s)", index, res_id.buf); } break; case SG_IMGUI_CMD_UNINIT_PASS: { sg_imgui_str_t res_id = _sg_imgui_pass_id_string(ctx, item->args.uninit_pass.pass); - _sg_imgui_snprintf(&str, "%d: sg_uninit_pass(pass=%s, desc=..)", index, res_id.buf); + _sg_imgui_snprintf(&str, "%d: sg_uninit_pass(pass=%s)", index, res_id.buf); } break; @@ -1998,6 +2115,13 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int } break; + case SG_IMGUI_CMD_FAIL_SAMPLER: + { + sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.fail_sampler.sampler); + _sg_imgui_snprintf(&str, "%d: sg_fail_sampler(smp=%s)", index, res_id.buf); + } + break; + case SG_IMGUI_CMD_FAIL_SHADER: { sg_imgui_str_t res_id = _sg_imgui_shader_id_string(ctx, item->args.fail_shader.shader); @@ -2028,42 +2152,6 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int _sg_imgui_snprintf(&str, "%d: sg_pop_debug_group()", index); break; - case SG_IMGUI_CMD_ERR_BUFFER_POOL_EXHAUSTED: - _sg_imgui_snprintf(&str, "%d: sg_err_buffer_pool_exhausted()", index); - break; - - case SG_IMGUI_CMD_ERR_IMAGE_POOL_EXHAUSTED: - _sg_imgui_snprintf(&str, "%d: sg_err_image_pool_exhausted()", index); - break; - - case SG_IMGUI_CMD_ERR_SHADER_POOL_EXHAUSTED: - _sg_imgui_snprintf(&str, "%d: sg_err_shader_pool_exhausted()", index); - break; - - case SG_IMGUI_CMD_ERR_PIPELINE_POOL_EXHAUSTED: - _sg_imgui_snprintf(&str, "%d: sg_err_pipeline_pool_exhausted()", index); - break; - - case SG_IMGUI_CMD_ERR_PASS_POOL_EXHAUSTED: - _sg_imgui_snprintf(&str, "%d: sg_err_pass_pool_exhausted()", index); - break; - - case SG_IMGUI_CMD_ERR_CONTEXT_MISMATCH: - _sg_imgui_snprintf(&str, "%d: sg_err_context_mismatch()", index); - break; - - case SG_IMGUI_CMD_ERR_PASS_INVALID: - _sg_imgui_snprintf(&str, "%d: sg_err_pass_invalid()", index); - break; - - case SG_IMGUI_CMD_ERR_DRAW_INVALID: - _sg_imgui_snprintf(&str, "%d: sg_err_draw_invalid()", index); - break; - - case SG_IMGUI_CMD_ERR_BINDINGS_INVALID: - _sg_imgui_snprintf(&str, "%d: sg_err_bindings_invalid()", index); - break; - default: _sg_imgui_snprintf(&str, "%d: ???", index); break; @@ -2119,6 +2207,23 @@ _SOKOL_PRIVATE void _sg_imgui_make_image(const sg_image_desc* desc, sg_image img } } +_SOKOL_PRIVATE void _sg_imgui_make_sampler(const sg_sampler_desc* desc, sg_sampler smp_id, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_MAKE_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.make_sampler.result = smp_id; + } + if (ctx->hooks.make_sampler) { + ctx->hooks.make_sampler(desc, smp_id, ctx->hooks.user_data); + } + if (smp_id.id != SG_INVALID_ID) { + _sg_imgui_sampler_created(ctx, smp_id, _sg_imgui_slot_index(smp_id.id), desc); + } +} + _SOKOL_PRIVATE void _sg_imgui_make_shader(const sg_shader_desc* desc, sg_shader shd_id, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2204,6 +2309,23 @@ _SOKOL_PRIVATE void _sg_imgui_destroy_image(sg_image img, void* user_data) { } } +_SOKOL_PRIVATE void _sg_imgui_destroy_sampler(sg_sampler smp, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_DESTROY_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.destroy_sampler.sampler = smp; + } + if (ctx->hooks.destroy_sampler) { + ctx->hooks.destroy_sampler(smp, ctx->hooks.user_data); + } + if (smp.id != SG_INVALID_ID) { + _sg_imgui_sampler_destroyed(ctx, _sg_imgui_slot_index(smp.id)); + } +} + _SOKOL_PRIVATE void _sg_imgui_destroy_shader(sg_shader shd, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2491,6 +2613,20 @@ _SOKOL_PRIVATE void _sg_imgui_alloc_image(sg_image result, void* user_data) { } } +_SOKOL_PRIVATE void _sg_imgui_alloc_sampler(sg_sampler result, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_ALLOC_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.alloc_sampler.result = result; + } + if (ctx->hooks.alloc_sampler) { + ctx->hooks.alloc_sampler(result, ctx->hooks.user_data); + } +} + _SOKOL_PRIVATE void _sg_imgui_alloc_shader(sg_shader result, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2561,6 +2697,20 @@ _SOKOL_PRIVATE void _sg_imgui_dealloc_image(sg_image img_id, void* user_data) { } } +_SOKOL_PRIVATE void _sg_imgui_dealloc_sampler(sg_sampler smp_id, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_DEALLOC_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.dealloc_sampler.sampler = smp_id; + } + if (ctx->hooks.dealloc_sampler) { + ctx->hooks.dealloc_sampler(smp_id, ctx->hooks.user_data); + } +} + _SOKOL_PRIVATE void _sg_imgui_dealloc_shader(sg_shader shd_id, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2637,6 +2787,23 @@ _SOKOL_PRIVATE void _sg_imgui_init_image(sg_image img_id, const sg_image_desc* d } } +_SOKOL_PRIVATE void _sg_imgui_init_sampler(sg_sampler smp_id, const sg_sampler_desc* desc, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_INIT_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.init_sampler.sampler = smp_id; + } + if (ctx->hooks.init_sampler) { + ctx->hooks.init_sampler(smp_id, desc, ctx->hooks.user_data); + } + if (smp_id.id != SG_INVALID_ID) { + _sg_imgui_sampler_created(ctx, smp_id, _sg_imgui_slot_index(smp_id.id), desc); + } +} + _SOKOL_PRIVATE void _sg_imgui_init_shader(sg_shader shd_id, const sg_shader_desc* desc, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2722,6 +2889,23 @@ _SOKOL_PRIVATE void _sg_imgui_uninit_image(sg_image img, void* user_data) { } } +_SOKOL_PRIVATE void _sg_imgui_uninit_sampler(sg_sampler smp, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_UNINIT_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.uninit_sampler.sampler = smp; + } + if (ctx->hooks.uninit_sampler) { + ctx->hooks.uninit_sampler(smp, ctx->hooks.user_data); + } + if (smp.id != SG_INVALID_ID) { + _sg_imgui_sampler_destroyed(ctx, _sg_imgui_slot_index(smp.id)); + } +} + _SOKOL_PRIVATE void _sg_imgui_uninit_shader(sg_shader shd, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2801,6 +2985,20 @@ _SOKOL_PRIVATE void _sg_imgui_fail_image(sg_image img_id, void* user_data) { } } +_SOKOL_PRIVATE void _sg_imgui_fail_sampler(sg_sampler smp_id, void* user_data) { + sg_imgui_t* ctx = (sg_imgui_t*) user_data; + SOKOL_ASSERT(ctx); + sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); + if (item) { + item->cmd = SG_IMGUI_CMD_FAIL_SAMPLER; + item->color = _SG_IMGUI_COLOR_RSRC; + item->args.fail_sampler.sampler = smp_id; + } + if (ctx->hooks.fail_sampler) { + ctx->hooks.fail_sampler(smp_id, ctx->hooks.user_data); + } +} + _SOKOL_PRIVATE void _sg_imgui_fail_shader(sg_shader shd_id, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); @@ -2870,131 +3068,13 @@ _SOKOL_PRIVATE void _sg_imgui_pop_debug_group(void* user_data) { } } -_SOKOL_PRIVATE void _sg_imgui_err_buffer_pool_exhausted(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_BUFFER_POOL_EXHAUSTED; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_buffer_pool_exhausted) { - ctx->hooks.err_buffer_pool_exhausted(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_image_pool_exhausted(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_IMAGE_POOL_EXHAUSTED; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_image_pool_exhausted) { - ctx->hooks.err_image_pool_exhausted(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_shader_pool_exhausted(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_SHADER_POOL_EXHAUSTED; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_shader_pool_exhausted) { - ctx->hooks.err_shader_pool_exhausted(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_pipeline_pool_exhausted(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_PIPELINE_POOL_EXHAUSTED; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_pipeline_pool_exhausted) { - ctx->hooks.err_pipeline_pool_exhausted(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_pass_pool_exhausted(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_PASS_POOL_EXHAUSTED; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_pass_pool_exhausted) { - ctx->hooks.err_pass_pool_exhausted(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_context_mismatch(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_CONTEXT_MISMATCH; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_context_mismatch) { - ctx->hooks.err_context_mismatch(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_pass_invalid(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_PASS_INVALID; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_pass_invalid) { - ctx->hooks.err_pass_invalid(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_draw_invalid(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_DRAW_INVALID; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_draw_invalid) { - ctx->hooks.err_draw_invalid(ctx->hooks.user_data); - } -} - -_SOKOL_PRIVATE void _sg_imgui_err_bindings_invalid(void* user_data) { - sg_imgui_t* ctx = (sg_imgui_t*) user_data; - SOKOL_ASSERT(ctx); - sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); - if (item) { - item->cmd = SG_IMGUI_CMD_ERR_BINDINGS_INVALID; - item->color = _SG_IMGUI_COLOR_ERR; - } - if (ctx->hooks.err_bindings_invalid) { - ctx->hooks.err_bindings_invalid(ctx->hooks.user_data); - } -} - /*--- IMGUI HELPERS ----------------------------------------------------------*/ _SOKOL_PRIVATE bool _sg_imgui_draw_resid_list_item(uint32_t res_id, const char* label, bool selected) { igPushID_Int((int)res_id); bool res; if (label[0]) { res = igSelectable_Bool(label, selected, 0, IMVEC2(0,0)); - } - else { + } else { sg_imgui_str_t str; _sg_imgui_snprintf(&str, "0x%08X", res_id); res = igSelectable_Bool(str.buf, selected, 0, IMVEC2(0,0)); @@ -3009,8 +3089,7 @@ _SOKOL_PRIVATE bool _sg_imgui_draw_resid_link(uint32_t res_type, uint32_t res_id const char* str; if (label[0]) { str = label; - } - else { + } else { _sg_imgui_snprintf(&str_buf, "0x%08X", res_id); str = str_buf.buf; } @@ -3038,6 +3117,15 @@ _SOKOL_PRIVATE bool _sg_imgui_draw_image_link(sg_imgui_t* ctx, sg_image img) { return retval; } +_SOKOL_PRIVATE bool _sg_imgui_draw_sampler_link(sg_imgui_t* ctx, sg_sampler smp) { + bool retval = false; + if (smp.id != SG_INVALID_ID) { + const sg_imgui_sampler_t* smp_ui = &ctx->samplers.slots[_sg_imgui_slot_index(smp.id)]; + retval = _sg_imgui_draw_resid_link(2, smp.id, smp_ui->label.buf); + } + return retval; +} + _SOKOL_PRIVATE bool _sg_imgui_draw_shader_link(sg_imgui_t* ctx, sg_shader shd) { bool retval = false; if (shd.id != SG_INVALID_ID) { @@ -3057,6 +3145,11 @@ _SOKOL_PRIVATE void _sg_imgui_show_image(sg_imgui_t* ctx, sg_image img) { ctx->images.sel_img = img; } +_SOKOL_PRIVATE void _sg_imgui_show_sampler(sg_imgui_t* ctx, sg_sampler smp) { + ctx->samplers.open = true; + ctx->samplers.sel_smp = smp; +} + _SOKOL_PRIVATE void _sg_imgui_show_shader(sg_imgui_t* ctx, sg_shader shd) { ctx->shaders.open = true; ctx->shaders.sel_shd = shd; @@ -3092,6 +3185,21 @@ _SOKOL_PRIVATE void _sg_imgui_draw_image_list(sg_imgui_t* ctx) { igEndChild(); } +_SOKOL_PRIVATE void _sg_imgui_draw_sampler_list(sg_imgui_t* ctx) { + igBeginChild_Str("sampler_list", IMVEC2(_SG_IMGUI_LIST_WIDTH,0), true, 0); + for (int i = 0; i < ctx->samplers.num_slots; i++) { + sg_sampler smp = ctx->samplers.slots[i].res_id; + sg_resource_state state = sg_query_sampler_state(smp); + if ((state != SG_RESOURCESTATE_INVALID) && (state != SG_RESOURCESTATE_INITIAL)) { + bool selected = ctx->samplers.sel_smp.id == smp.id; + if (_sg_imgui_draw_resid_list_item(smp.id, ctx->samplers.slots[i].label.buf, selected)) { + ctx->samplers.sel_smp.id = smp.id; + } + } + } + igEndChild(); +} + _SOKOL_PRIVATE void _sg_imgui_draw_shader_list(sg_imgui_t* ctx) { igBeginChild_Str("shader_list", IMVEC2(_SG_IMGUI_LIST_WIDTH,0), true, 0); for (int i = 0; i < ctx->shaders.num_slots; i++) { @@ -3153,18 +3261,15 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_list(sg_imgui_t* ctx) { if (igTreeNode_StrStr(group_name, "Group: %s", group_name)) { group_stack |= 1; } - } - else { + } else { group_stack <<= 1; } - } - else if (item->cmd == SG_IMGUI_CMD_POP_DEBUG_GROUP) { + } else if (item->cmd == SG_IMGUI_CMD_POP_DEBUG_GROUP) { if (group_stack & 1) { igTreePop(); } group_stack >>= 1; - } - else if (group_stack & 1) { + } else if (group_stack & 1) { if (igSelectable_Bool(item_string.buf, ctx->capture.sel_item == i, 0, IMVEC2(0,0))) { ctx->capture.sel_item = i; } @@ -3199,8 +3304,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_buffer_panel(sg_imgui_t* ctx, sg_buffer buf) igText("Append Pos: %d", info.append_pos); igText("Append Overflow: %s", _sg_imgui_bool_string(info.append_overflow)); } - } - else { + } else { igText("Buffer 0x%08X not valid.", buf.id); } igEndChild(); @@ -3224,8 +3328,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_embedded_image(sg_imgui_t* ctx, sg_image img, float h = (float)img_ui->desc.height * (*scale); igImage((ImTextureID)(intptr_t)img.id, IMVEC2(w, h), IMVEC2(0,0), IMVEC2(1,1), IMVEC4(1,1,1,1), IMVEC4(0,0,0,0)); igPopID(); - } - else { + } else { igText("Image not renderable."); } } @@ -3252,29 +3355,47 @@ _SOKOL_PRIVATE void _sg_imgui_draw_image_panel(sg_imgui_t* ctx, sg_image img) { igText("Num Mipmaps: %d", desc->num_mipmaps); igText("Pixel Format: %s", _sg_imgui_pixelformat_string(desc->pixel_format)); igText("Sample Count: %d", desc->sample_count); - igText("Min Filter: %s", _sg_imgui_filter_string(desc->min_filter)); - igText("Mag Filter: %s", _sg_imgui_filter_string(desc->mag_filter)); - igText("Wrap U: %s", _sg_imgui_wrap_string(desc->wrap_u)); - igText("Wrap V: %s", _sg_imgui_wrap_string(desc->wrap_v)); - igText("Wrap W: %s", _sg_imgui_wrap_string(desc->wrap_w)); - igText("Border Color: %s", _sg_imgui_bordercolor_string(desc->border_color)); - igText("Max Anisotropy: %d", desc->max_anisotropy); - igText("Min LOD: %.3f", desc->min_lod); - igText("Max LOD: %.3f", desc->max_lod); if (desc->usage != SG_USAGE_IMMUTABLE) { igSeparator(); igText("Num Slots: %d", info.num_slots); igText("Active Slot: %d", info.active_slot); igText("Update Frame Index: %d", info.upd_frame_index); } - } - else { + } else { igText("Image 0x%08X not valid.", img.id); } igEndChild(); } } +_SOKOL_PRIVATE void _sg_imgui_draw_sampler_panel(sg_imgui_t* ctx, sg_sampler smp) { + if (smp.id != SG_INVALID_ID) { + igBeginChild_Str("sampler", IMVEC2(0,0), false, 0); + sg_sampler_info info = sg_query_sampler_info(smp); + if (info.slot.state == SG_RESOURCESTATE_VALID) { + sg_imgui_sampler_t* smp_ui = &ctx->samplers.slots[_sg_imgui_slot_index(smp.id)]; + const sg_sampler_desc* desc = &smp_ui->desc; + igText("Label: %s", smp_ui->label.buf[0] ? smp_ui->label.buf : "---"); + _sg_imgui_draw_resource_slot(&info.slot); + igSeparator(); + igText("Min Filter: %s", _sg_imgui_filter_string(desc->min_filter)); + igText("Mag Filter: %s", _sg_imgui_filter_string(desc->mag_filter)); + igText("Mipmap Filter: %s", _sg_imgui_filter_string(desc->mipmap_filter)); + igText("Wrap U: %s", _sg_imgui_wrap_string(desc->wrap_u)); + igText("Wrap V: %s", _sg_imgui_wrap_string(desc->wrap_v)); + igText("Wrap W: %s", _sg_imgui_wrap_string(desc->wrap_w)); + igText("Min LOD: %.3f", desc->min_lod); + igText("Max LOD: %.3f", desc->max_lod); + igText("Border Color: %s", _sg_imgui_bordercolor_string(desc->border_color)); + igText("Compare: %s", _sg_imgui_comparefunc_string(desc->compare)); + igText("Max Anisotropy: %d", desc->max_anisotropy); + } else { + igText("Sampler 0x%08X not valid.", smp.id); + } + igEndChild(); + } +} + _SOKOL_PRIVATE void _sg_imgui_draw_shader_stage(const sg_shader_stage_desc* stage) { int num_valid_ubs = 0; for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { @@ -3289,25 +3410,39 @@ _SOKOL_PRIVATE void _sg_imgui_draw_shader_stage(const sg_shader_stage_desc* stag } int num_valid_images = 0; for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - if (_SG_IMAGETYPE_DEFAULT != stage->images[i].image_type) { + if (stage->images[i].used) { num_valid_images++; + } else { + break; + } + } + int num_valid_samplers = 0; + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { + if (stage->samplers[i].used) { + num_valid_samplers++; + } else { + break; } - else { + } + int num_valid_image_sampler_pairs = 0; + for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGESAMPLERPAIRS; i++) { + if (stage->image_sampler_pairs[i].used) { + num_valid_image_sampler_pairs++; + } else { break; } } if (num_valid_ubs > 0) { if (igTreeNode_Str("Uniform Blocks")) { for (int i = 0; i < num_valid_ubs; i++) { - igText("#%d:", i); const sg_shader_uniform_block_desc* ub = &stage->uniform_blocks[i]; + igText("#%d: (size: %d layout: %s)\n", i, ub->size, _sg_imgui_uniformlayout_string(ub->layout)); for (int j = 0; j < SG_MAX_UB_MEMBERS; j++) { const sg_shader_uniform_desc* u = &ub->uniforms[j]; if (SG_UNIFORMTYPE_INVALID != u->type) { if (u->array_count <= 1) { igText(" %s %s", _sg_imgui_uniformtype_string(u->type), u->name ? u->name : ""); - } - else { + } else { igText(" %s[%d] %s", _sg_imgui_uniformtype_string(u->type), u->array_count, u->name ? u->name : ""); } } @@ -3318,17 +3453,35 @@ _SOKOL_PRIVATE void _sg_imgui_draw_shader_stage(const sg_shader_stage_desc* stag } if (num_valid_images > 0) { if (igTreeNode_Str("Images")) { - for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { + for (int i = 0; i < num_valid_images; i++) { const sg_shader_image_desc* sid = &stage->images[i]; - if (sid->image_type != _SG_IMAGETYPE_DEFAULT) { - igText("slot: %d\n name: %s\n image_type: %s\n sampler_type: %s", - i, sid->name ? sid->name : "NONE", - _sg_imgui_imagetype_string(sid->image_type), - _sg_imgui_samplertype_string(sid->sampler_type)); - } - else { - break; - } + igText("slot: %d\n multisampled: %s\n image_type: %s\n sample_type: %s", + i, + sid->multisampled ? "true" : "false", + _sg_imgui_imagetype_string(sid->image_type), + _sg_imgui_imagesampletype_string(sid->sample_type)); + } + igTreePop(); + } + } + if (num_valid_samplers > 0) { + if (igTreeNode_Str("Samplers")) { + for (int i = 0; i < num_valid_samplers; i++) { + const sg_shader_sampler_desc* ssd = &stage->samplers[i]; + igText("slot: %d\n sampler_type: %s", i, _sg_imgui_samplertype_string(ssd->sampler_type)); + } + igTreePop(); + } + } + if (num_valid_image_sampler_pairs > 0) { + if (igTreeNode_Str("Image Sampler Pairs")) { + for (int i = 0; i < num_valid_image_sampler_pairs; i++) { + const sg_shader_image_sampler_pair_desc* sispd = &stage->image_sampler_pairs[i]; + igText("slot: %d\n image_slot: %d\n sampler_slot: %d\n glsl_name: %s\n", + i, + sispd->image_slot, + sispd->sampler_slot, + sispd->glsl_name ? sispd->glsl_name : "---"); } igTreePop(); } @@ -3344,8 +3497,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_shader_stage(const sg_shader_stage_desc* stag igText("%s", stage->source); igTreePop(); } - } - else if (stage->bytecode.ptr) { + } else if (stage->bytecode.ptr) { if (igTreeNode_Str("Byte Code")) { igText("Byte-code display currently not supported."); igTreePop(); @@ -3382,35 +3534,34 @@ _SOKOL_PRIVATE void _sg_imgui_draw_shader_panel(sg_imgui_t* ctx, sg_shader shd) _sg_imgui_draw_shader_stage(&shd_ui->desc.fs); igTreePop(); } - } - else { + } else { igText("Shader 0x%08X not valid!", shd.id); } igEndChild(); } } -_SOKOL_PRIVATE void _sg_imgui_draw_vertex_layout(const sg_layout_desc* layout) { +_SOKOL_PRIVATE void _sg_imgui_draw_vertex_layout_state(const sg_vertex_layout_state* layout) { if (igTreeNode_Str("Buffers")) { - for (int i = 0; i < SG_MAX_SHADERSTAGE_BUFFERS; i++) { - const sg_buffer_layout_desc* l_desc = &layout->buffers[i]; - if (l_desc->stride > 0) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { + const sg_vertex_buffer_layout_state* l_state = &layout->buffers[i]; + if (l_state->stride > 0) { igText("#%d:", i); - igText(" Stride: %d", l_desc->stride); - igText(" Step Func: %s", _sg_imgui_vertexstep_string(l_desc->step_func)); - igText(" Step Rate: %d", l_desc->step_rate); + igText(" Stride: %d", l_state->stride); + igText(" Step Func: %s", _sg_imgui_vertexstep_string(l_state->step_func)); + igText(" Step Rate: %d", l_state->step_rate); } } igTreePop(); } if (igTreeNode_Str("Attrs")) { for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { - const sg_vertex_attr_desc* a_desc = &layout->attrs[i]; - if (a_desc->format != SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &layout->attrs[i]; + if (a_state->format != SG_VERTEXFORMAT_INVALID) { igText("#%d:", i); - igText(" Format: %s", _sg_imgui_vertexformat_string(a_desc->format)); - igText(" Offset: %d", a_desc->offset); - igText(" Buffer Index: %d", a_desc->buffer_index); + igText(" Format: %s", _sg_imgui_vertexformat_string(a_state->format)); + igText(" Offset: %d", a_state->offset); + igText(" Buffer Index: %d", a_state->buffer_index); } } igTreePop(); @@ -3458,7 +3609,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_blend_state(const sg_blend_state* bs) { igText("Op Alpha: %s", _sg_imgui_blendop_string(bs->op_alpha)); } -_SOKOL_PRIVATE void _sg_imgui_draw_color_state(const sg_color_state* cs) { +_SOKOL_PRIVATE void _sg_imgui_draw_color_target_state(const sg_color_target_state* cs) { igText("Pixel Format: %s", _sg_imgui_pixelformat_string(cs->pixel_format)); igText("Write Mask: %s", _sg_imgui_colormask_string(cs->write_mask)); if (igTreeNode_Str("Blend State:")) { @@ -3480,8 +3631,8 @@ _SOKOL_PRIVATE void _sg_imgui_draw_pipeline_panel(sg_imgui_t* ctx, sg_pipeline p if (_sg_imgui_draw_shader_link(ctx, pip_ui->desc.shader)) { _sg_imgui_show_shader(ctx, pip_ui->desc.shader); } - if (igTreeNode_Str("Vertex Layout")) { - _sg_imgui_draw_vertex_layout(&pip_ui->desc.layout); + if (igTreeNode_Str("Vertex Layout State")) { + _sg_imgui_draw_vertex_layout_state(&pip_ui->desc.layout); igTreePop(); } if (igTreeNode_Str("Depth State")) { @@ -3495,9 +3646,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_pipeline_panel(sg_imgui_t* ctx, sg_pipeline p igText("Color Count: %d", pip_ui->desc.color_count); for (int i = 0; i < pip_ui->desc.color_count; i++) { sg_imgui_str_t str; - _sg_imgui_snprintf(&str, "Color %d", i); + _sg_imgui_snprintf(&str, "Color Target %d", i); if (igTreeNode_Str(str.buf)) { - _sg_imgui_draw_color_state(&pip_ui->desc.colors[i]); + _sg_imgui_draw_color_target_state(&pip_ui->desc.colors[i]); igTreePop(); } } @@ -3509,8 +3660,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_pipeline_panel(sg_imgui_t* ctx, sg_pipeline p sg_imgui_str_t blend_color_str; igText("Blend Color: %.3f %.3f %.3f %.3f", _sg_imgui_color_string(&blend_color_str, pip_ui->desc.blend_color)); igText("Alpha To Coverage: %s", _sg_imgui_bool_string(pip_ui->desc.alpha_to_coverage_enabled)); - } - else { + } else { igText("Pipeline 0x%08X not valid.", pip.id); } igEndChild(); @@ -3556,8 +3706,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_pass_panel(sg_imgui_t* ctx, sg_pass pass) { igText("Depth-Stencil Attachemnt:"); _sg_imgui_draw_pass_attachment(ctx, &pass_ui->desc.depth_stencil_attachment, &pass_ui->ds_image_scale); } - } - else { + } else { igText("Pass 0x%08X not valid.", pass.id); } igEndChild(); @@ -3565,7 +3714,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_pass_panel(sg_imgui_t* ctx, sg_pass pass) { } _SOKOL_PRIVATE void _sg_imgui_draw_bindings_panel(sg_imgui_t* ctx, const sg_bindings* bnd) { - for (int i = 0; i < SG_MAX_SHADERSTAGE_BUFFERS; i++) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { sg_buffer buf = bnd->vertex_buffers[i]; if (buf.id != SG_INVALID_ID) { igSeparator(); @@ -3575,8 +3724,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_bindings_panel(sg_imgui_t* ctx, const sg_bind _sg_imgui_show_buffer(ctx, buf); } igText(" Offset: %d", bnd->vertex_buffer_offsets[i]); - } - else { + } else { break; } } @@ -3593,7 +3741,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_bindings_panel(sg_imgui_t* ctx, const sg_bind } } for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - sg_image img = bnd->vs_images[i]; + sg_image img = bnd->vs.images[i]; if (img.id != SG_INVALID_ID) { igSeparator(); igText("Vertex Stage Image Slot #%d:", i); @@ -3601,13 +3749,25 @@ _SOKOL_PRIVATE void _sg_imgui_draw_bindings_panel(sg_imgui_t* ctx, const sg_bind if (_sg_imgui_draw_image_link(ctx, img)) { _sg_imgui_show_image(ctx, img); } + } else { + break; } - else { + } + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { + sg_sampler smp = bnd->vs.samplers[i]; + if (smp.id != SG_INVALID_ID) { + igSeparator(); + igText("Vertex Stage Sampler Slot #%d:", i); + igText(" Sampler: "); igSameLine(0,-1); + if (_sg_imgui_draw_sampler_link(ctx, smp)) { + _sg_imgui_show_sampler(ctx, smp); + } + } else { break; } } for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) { - sg_image img = bnd->fs_images[i]; + sg_image img = bnd->fs.images[i]; if (img.id != SG_INVALID_ID) { igSeparator(); igText("Fragment Stage Image Slot #%d:", i); @@ -3617,10 +3777,21 @@ _SOKOL_PRIVATE void _sg_imgui_draw_bindings_panel(sg_imgui_t* ctx, const sg_bind } } } + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++) { + sg_sampler smp = bnd->fs.samplers[i]; + if (smp.id != SG_INVALID_ID) { + igSeparator(); + igText("Fragment Stage Sampler Slot #%d:", i); + igText(" Sampler: "); igSameLine(0,-1); + if (_sg_imgui_draw_sampler_link(ctx, smp)) { + _sg_imgui_show_sampler(ctx, smp); + } + } + } } _SOKOL_PRIVATE void _sg_imgui_draw_uniforms_panel(sg_imgui_t* ctx, const sg_imgui_args_apply_uniforms_t* args) { - SOKOL_ASSERT(args->ub_index < SG_MAX_SHADERSTAGE_BUFFERS); + SOKOL_ASSERT(args->ub_index < SG_MAX_VERTEX_BUFFERS); /* check if all the required information for drawing the structured uniform block content is available, otherwise just render a generic hexdump @@ -3659,8 +3830,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_uniforms_panel(sg_imgui_t* ctx, const sg_imgu int num_items = (ud->array_count > 1) ? ud->array_count : 1; if (num_items > 1) { igText("%d: %s %s[%d] =", i, _sg_imgui_uniformtype_string(ud->type), ud->name?ud->name:"", ud->array_count); - } - else { + } else { igText("%d: %s %s =", i, _sg_imgui_uniformtype_string(ud->type), ud->name?ud->name:""); } for (int item_index = 0; item_index < num_items; item_index++) { @@ -3709,8 +3879,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_uniforms_panel(sg_imgui_t* ctx, const sg_imgu u_off += u_size; } } - } - else { + } else { // FIXME: float vs int const size_t num_floats = ub_desc->size / sizeof(float); for (uint32_t i = 0; i < num_floats; i++) { @@ -3728,8 +3897,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_passaction_panel(sg_imgui_t* ctx, sg_pass pas if (SG_INVALID_ID == pass.id) { /* default pass: one color attachment */ num_color_atts = 1; - } - else { + } else { const sg_imgui_pass_t* pass_ui = &ctx->passes.slots[_sg_imgui_slot_index(pass.id)]; for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { if (pass_ui->desc.color_attachments[i].image.id != SG_INVALID_ID) { @@ -3805,6 +3973,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_panel(sg_imgui_t* ctx) { case SG_IMGUI_CMD_MAKE_IMAGE: _sg_imgui_draw_image_panel(ctx, item->args.make_image.result); break; + case SG_IMGUI_CMD_MAKE_SAMPLER: + _sg_imgui_draw_sampler_panel(ctx, item->args.make_sampler.result); + break; case SG_IMGUI_CMD_MAKE_SHADER: _sg_imgui_draw_shader_panel(ctx, item->args.make_shader.result); break; @@ -3820,6 +3991,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_panel(sg_imgui_t* ctx) { case SG_IMGUI_CMD_DESTROY_IMAGE: _sg_imgui_draw_image_panel(ctx, item->args.destroy_image.image); break; + case SG_IMGUI_CMD_DESTROY_SAMPLER: + _sg_imgui_draw_sampler_panel(ctx, item->args.destroy_sampler.sampler); + break; case SG_IMGUI_CMD_DESTROY_SHADER: _sg_imgui_draw_shader_panel(ctx, item->args.destroy_shader.shader); break; @@ -3871,6 +4045,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_panel(sg_imgui_t* ctx) { case SG_IMGUI_CMD_ALLOC_IMAGE: _sg_imgui_draw_image_panel(ctx, item->args.alloc_image.result); break; + case SG_IMGUI_CMD_ALLOC_SAMPLER: + _sg_imgui_draw_sampler_panel(ctx, item->args.alloc_sampler.result); + break; case SG_IMGUI_CMD_ALLOC_SHADER: _sg_imgui_draw_shader_panel(ctx, item->args.alloc_shader.result); break; @@ -3886,6 +4063,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_panel(sg_imgui_t* ctx) { case SG_IMGUI_CMD_INIT_IMAGE: _sg_imgui_draw_image_panel(ctx, item->args.init_image.image); break; + case SG_IMGUI_CMD_INIT_SAMPLER: + _sg_imgui_draw_sampler_panel(ctx, item->args.init_sampler.sampler); + break; case SG_IMGUI_CMD_INIT_SHADER: _sg_imgui_draw_shader_panel(ctx, item->args.init_shader.shader); break; @@ -3901,6 +4081,9 @@ _SOKOL_PRIVATE void _sg_imgui_draw_capture_panel(sg_imgui_t* ctx) { case SG_IMGUI_CMD_FAIL_IMAGE: _sg_imgui_draw_image_panel(ctx, item->args.fail_image.image); break; + case SG_IMGUI_CMD_FAIL_SAMPLER: + _sg_imgui_draw_sampler_panel(ctx, item->args.fail_sampler.sampler); + break; case SG_IMGUI_CMD_FAIL_SHADER: _sg_imgui_draw_shader_panel(ctx, item->args.fail_shader.shader); break; @@ -3975,11 +4158,13 @@ SOKOL_API_IMPL void sg_imgui_init(sg_imgui_t* ctx, const sg_imgui_desc_t* desc) hooks.reset_state_cache = _sg_imgui_reset_state_cache; hooks.make_buffer = _sg_imgui_make_buffer; hooks.make_image = _sg_imgui_make_image; + hooks.make_sampler = _sg_imgui_make_sampler; hooks.make_shader = _sg_imgui_make_shader; hooks.make_pipeline = _sg_imgui_make_pipeline; hooks.make_pass = _sg_imgui_make_pass; hooks.destroy_buffer = _sg_imgui_destroy_buffer; hooks.destroy_image = _sg_imgui_destroy_image; + hooks.destroy_sampler = _sg_imgui_destroy_sampler; hooks.destroy_shader = _sg_imgui_destroy_shader; hooks.destroy_pipeline = _sg_imgui_destroy_pipeline; hooks.destroy_pass = _sg_imgui_destroy_pass; @@ -3998,46 +4183,43 @@ SOKOL_API_IMPL void sg_imgui_init(sg_imgui_t* ctx, const sg_imgui_desc_t* desc) hooks.commit = _sg_imgui_commit; hooks.alloc_buffer = _sg_imgui_alloc_buffer; hooks.alloc_image = _sg_imgui_alloc_image; + hooks.alloc_sampler = _sg_imgui_alloc_sampler; hooks.alloc_shader = _sg_imgui_alloc_shader; hooks.alloc_pipeline = _sg_imgui_alloc_pipeline; hooks.alloc_pass = _sg_imgui_alloc_pass; hooks.dealloc_buffer = _sg_imgui_dealloc_buffer; hooks.dealloc_image = _sg_imgui_dealloc_image; + hooks.dealloc_sampler = _sg_imgui_dealloc_sampler; hooks.dealloc_shader = _sg_imgui_dealloc_shader; hooks.dealloc_pipeline = _sg_imgui_dealloc_pipeline; hooks.dealloc_pass = _sg_imgui_dealloc_pass; hooks.init_buffer = _sg_imgui_init_buffer; hooks.init_image = _sg_imgui_init_image; + hooks.init_sampler = _sg_imgui_init_sampler; hooks.init_shader = _sg_imgui_init_shader; hooks.init_pipeline = _sg_imgui_init_pipeline; hooks.init_pass = _sg_imgui_init_pass; hooks.uninit_buffer = _sg_imgui_uninit_buffer; hooks.uninit_image = _sg_imgui_uninit_image; + hooks.uninit_sampler = _sg_imgui_uninit_sampler; hooks.uninit_shader = _sg_imgui_uninit_shader; hooks.uninit_pipeline = _sg_imgui_uninit_pipeline; hooks.uninit_pass = _sg_imgui_uninit_pass; hooks.fail_buffer = _sg_imgui_fail_buffer; hooks.fail_image = _sg_imgui_fail_image; + hooks.fail_sampler = _sg_imgui_fail_sampler; hooks.fail_shader = _sg_imgui_fail_shader; hooks.fail_pipeline = _sg_imgui_fail_pipeline; hooks.fail_pass = _sg_imgui_fail_pass; hooks.push_debug_group = _sg_imgui_push_debug_group; hooks.pop_debug_group = _sg_imgui_pop_debug_group; - hooks.err_buffer_pool_exhausted = _sg_imgui_err_buffer_pool_exhausted; - hooks.err_image_pool_exhausted = _sg_imgui_err_image_pool_exhausted; - hooks.err_shader_pool_exhausted = _sg_imgui_err_shader_pool_exhausted; - hooks.err_pipeline_pool_exhausted = _sg_imgui_err_pipeline_pool_exhausted; - hooks.err_pass_pool_exhausted = _sg_imgui_err_pass_pool_exhausted; - hooks.err_context_mismatch = _sg_imgui_err_context_mismatch; - hooks.err_pass_invalid = _sg_imgui_err_pass_invalid; - hooks.err_draw_invalid = _sg_imgui_err_draw_invalid; - hooks.err_bindings_invalid = _sg_imgui_err_bindings_invalid; ctx->hooks = sg_install_trace_hooks(&hooks); /* allocate resource debug-info slots */ const sg_desc sgdesc = sg_query_desc(); ctx->buffers.num_slots = sgdesc.buffer_pool_size; ctx->images.num_slots = sgdesc.image_pool_size; + ctx->samplers.num_slots = sgdesc.sampler_pool_size; ctx->shaders.num_slots = sgdesc.shader_pool_size; ctx->pipelines.num_slots = sgdesc.pipeline_pool_size; ctx->passes.num_slots = sgdesc.pass_pool_size; @@ -4048,6 +4230,9 @@ SOKOL_API_IMPL void sg_imgui_init(sg_imgui_t* ctx, const sg_imgui_desc_t* desc) const size_t image_pool_size = (size_t)ctx->images.num_slots * sizeof(sg_imgui_image_t); ctx->images.slots = (sg_imgui_image_t*) _sg_imgui_malloc_clear(&ctx->desc.allocator, image_pool_size); + const size_t sampler_pool_size = (size_t)ctx->samplers.num_slots * sizeof(sg_imgui_sampler_t); + ctx->samplers.slots = (sg_imgui_sampler_t*) _sg_imgui_malloc_clear(&ctx->desc.allocator, sampler_pool_size); + const size_t shader_pool_size = (size_t)ctx->shaders.num_slots * sizeof(sg_imgui_shader_t); ctx->shaders.slots = (sg_imgui_shader_t*) _sg_imgui_malloc_clear(&ctx->desc.allocator, shader_pool_size); @@ -4082,6 +4267,15 @@ SOKOL_API_IMPL void sg_imgui_discard(sg_imgui_t* ctx) { _sg_imgui_free(&ctx->desc.allocator, (void*)ctx->images.slots); ctx->images.slots = 0; } + if (ctx->samplers.slots) { + for (int i = 0; i < ctx->samplers.num_slots; i++) { + if (ctx->samplers.slots[i].res_id.id != SG_INVALID_ID) { + _sg_imgui_sampler_destroyed(ctx, i); + } + } + _sg_imgui_free(&ctx->desc.allocator, (void*)ctx->samplers.slots); + ctx->samplers.slots = 0; + } if (ctx->shaders.slots) { for (int i = 0; i < ctx->shaders.num_slots; i++) { if (ctx->shaders.slots[i].res_id.id != SG_INVALID_ID) { @@ -4115,6 +4309,7 @@ SOKOL_API_IMPL void sg_imgui_draw(sg_imgui_t* ctx) { SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); sg_imgui_draw_buffers_window(ctx); sg_imgui_draw_images_window(ctx); + sg_imgui_draw_samplers_window(ctx); sg_imgui_draw_shaders_window(ctx); sg_imgui_draw_pipelines_window(ctx); sg_imgui_draw_passes_window(ctx); @@ -4146,6 +4341,18 @@ SOKOL_API_IMPL void sg_imgui_draw_images_window(sg_imgui_t* ctx) { igEnd(); } +SOKOL_API_IMPL void sg_imgui_draw_samplers_window(sg_imgui_t* ctx) { + SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); + if (!ctx->samplers.open) { + return; + } + igSetNextWindowSize(IMVEC2(440, 400), ImGuiCond_Once); + if (igBegin("Samplers", &ctx->samplers.open, 0)) { + sg_imgui_draw_samplers_content(ctx); + } + igEnd(); +} + SOKOL_API_IMPL void sg_imgui_draw_shaders_window(sg_imgui_t* ctx) { SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); if (!ctx->shaders.open) { @@ -4220,6 +4427,13 @@ SOKOL_API_IMPL void sg_imgui_draw_images_content(sg_imgui_t* ctx) { _sg_imgui_draw_image_panel(ctx, ctx->images.sel_img); } +SOKOL_API_IMPL void sg_imgui_draw_samplers_content(sg_imgui_t* ctx) { + SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); + _sg_imgui_draw_sampler_list(ctx); + igSameLine(0,-1); + _sg_imgui_draw_sampler_panel(ctx, ctx->samplers.sel_smp); +} + SOKOL_API_IMPL void sg_imgui_draw_shaders_content(sg_imgui_t* ctx) { SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); _sg_imgui_draw_shader_list(ctx); From 2b252847dee74e3c909e3aa6e280befb46a09c01 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 22 Jun 2023 19:42:14 +0200 Subject: [PATCH 039/292] sokol_gfx.h fix a couple of places which used the old combined-image-sampler instead of image-sampler-pair --- sokol_gfx.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a9ab928e5..7c6f87548 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2955,15 +2955,15 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_UB_STD140_ARRAY_TYPE, "uniform arrays only allowed for FLOAT4, INT4, MAT4 in std140 layout") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGES, "shader stage images must occupy continuous slots (sg_shader_desc.vs|fs.images[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_SAMPLERS, "shader stage samplers must occupy continuous slots (sg_shader_desc.vs|fs.samplers[])") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage image-samplers: image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL, "shader stage image-sampler pairs must be named in GL (sg_shader_desc.vs|fs.image_sampler_pairs[].name)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED, "shader stage image-sampler pair has name but .used field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED, "shader stage image-sampler pair has .image_slot != 0 but .used field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_USED, "shader stage image-sampler pair .sampler_slot != 0 but .used field not true") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more images are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler pairs: one or more samplers are note referenced by combined image-samplers (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ - _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image sampler pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_IMAGE_SLOT_OUT_OF_RANGE, "shader stage: image-sampler-pair image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_SAMPLER_SLOT_OUT_OF_RANGE, "shader stage: image-sampler-pair image slot index is out of range (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL, "shader stage: image-sampler-pairs must be named in GL (sg_shader_desc.vs|fs.image_sampler_pairs[].name)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED, "shader stage: image-sampler-pair has name but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED, "shader stage: image-sampler-pair has .image_slot != 0 but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_USED, "shader stage: image-sampler-pair .sampler_slot != 0 but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage: one or more images are note referenced by (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage: one or more samplers are not referenced by image-sampler-pairs (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler-pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_SEMANTICS, "D3D11 backend requires vertex attribute semantics") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_ATTR_STRING_TOO_LONG, "vertex attribute name/semantic string too long (max len 16)") \ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_CANARY, "sg_pipeline_desc not initialized") \ @@ -15198,7 +15198,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { } } - // if image-sampler info was provided in shader desc, check that that the mipmap filter matches image num mipmaps + // if image-sampler-pair info was provided in shader desc, check that that the mipmap filter matches image num mipmaps for (int img_smp_index = 0; img_smp_index < pip->shader->cmn.stage[SG_SHADERSTAGE_VS].num_image_samplers; img_smp_index++) { const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; const int img_index = stage->image_samplers[img_smp_index].image_slot; From 2562db4890c554ab20d2373290c3abbaa481f4f5 Mon Sep 17 00:00:00 2001 From: Pixeller Date: Fri, 23 Jun 2023 22:47:08 +0800 Subject: [PATCH 040/292] use addr instead warning:: `unsafeAddr` is a deprecated alias for `addr`, use `addr` instead. --- bindgen/gen_nim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindgen/gen_nim.py b/bindgen/gen_nim.py index f99f4b02b..14d6297d1 100644 --- a/bindgen/gen_nim.py +++ b/bindgen/gen_nim.py @@ -437,7 +437,7 @@ def gen_func_nim(decl, prefix): arg_name = param_decl['name'] arg_type = param_decl['type'] if is_const_struct_ptr(arg_type): - s += f"unsafeAddr({arg_name})" + s += f"addr({arg_name})" else: s += arg_name s += ")" @@ -562,7 +562,7 @@ def gen_extra(inp): #if inp['prefix'] in ['sg_', 'sdtx_', 'sshape_']: # l('# helper function to convert "anything" into a Range') # l('converter to_Range*[T](source: T): Range =') - # l(' Range(addr: source.unsafeAddr, size: source.sizeof.uint)') + # l(' Range(addr: source.addr, size: source.sizeof.uint)') # l('') c_source_path = '/'.join(c_source_paths[inp['prefix']].split('/')[3:]) l('{.passc:"-DSOKOL_NIM_IMPL".}') From 9762a5cbc2e175e4b5b57f036f391b381e595efc Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 18:50:28 +0200 Subject: [PATCH 041/292] sokol_debugtext.h: update embedded hlsl4 shaders --- util/sokol_debugtext.h | 71 ++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index b505d0d8f..c3954de77 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -3264,8 +3264,7 @@ static const char _sdtx_fs_source_metal_sim[441] = { 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) -FIXME FIXME FIXME -static const uint8_t _sdtx_vs_bytecode_d3d11[692] = { +static const uint8_t _sdtx_vs_bytecode_hlsl4[692] = { 0x44,0x58,0x42,0x43,0x07,0x05,0xa0,0xb3,0x53,0xc1,0x0a,0x0d,0x1e,0xf4,0xe4,0xa6, 0x91,0xaf,0x4c,0xca,0x01,0x00,0x00,0x00,0xb4,0x02,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xe4,0x00,0x00,0x00,0x54,0x01,0x00,0x00, @@ -3311,49 +3310,47 @@ static const uint8_t _sdtx_vs_bytecode_d3d11[692] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, }; -static const uint8_t _sdtx_fs_bytecode_d3d11[620] = { - 0x44,0x58,0x42,0x43,0xcf,0x30,0x5f,0x26,0xe7,0xba,0x36,0x97,0xf8,0x97,0x06,0x8d, - 0x92,0xcc,0x4b,0x8a,0x01,0x00,0x00,0x00,0x6c,0x02,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00, - 0xf0,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _sdtx_fs_bytecode_hlsl4[608] = { + 0x44,0x58,0x42,0x43,0xb7,0xcd,0xbd,0xb1,0x6f,0x85,0x5d,0x59,0x07,0x7e,0xa3,0x6e, + 0xe2,0x23,0x68,0xa0,0x01,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x48,0x01,0x00,0x00, + 0xe4,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x10,0x81,0x00,0x00,0x64,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f, - 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64, - 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31, - 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x38,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c, + 0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00, + 0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54, + 0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00, + 0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + 0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, + 0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, + 0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x10,0x00, - 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01, - 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -FIXME FIXME FIXME static const uint8_t _sdtx_vs_bytecode_wgpu[1648] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x2e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, @@ -4039,8 +4036,8 @@ static void _sdtx_setup_common(void) { break; } #elif defined(SOKOL_D3D11) - shd_desc.vs.bytecode = SG_RANGE(_sdtx_vs_bytecode_d3d11); - shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_d3d11); + shd_desc.vs.bytecode = SG_RANGE(_sdtx_vs_bytecode_hlsl4); + shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) shd_desc.vs.bytecode = SG_RANGE(_sdtx_vs_bytecode_wgpu); shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_wgpu); From fb2e944696339614209fd66421f563581dcd7ac3 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 18:53:53 +0200 Subject: [PATCH 042/292] sokol_gl.h: update embedded hlsl4 shaders --- util/sokol_gl.h | 74 ++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/util/sokol_gl.h b/util/sokol_gl.h index 386f4a9aa..c7693f781 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -1965,10 +1965,9 @@ static const char _sgl_fs_source_metal_sim[439] = { 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) -FIXME FIXME FIXME static const uint8_t _sgl_vs_bytecode_hlsl4[1032] = { - 0x44,0x58,0x42,0x43,0x09,0x96,0xbb,0xbb,0xfc,0x44,0x44,0xa8,0xa4,0x1c,0x9e,0x45, - 0x50,0x97,0xf1,0xde,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, + 0x44,0x58,0x42,0x43,0x74,0x7f,0x01,0xd9,0xf4,0xd5,0xed,0x1d,0x74,0xc1,0x30,0x27, + 0xd8,0xe9,0x9d,0x50,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x02,0x00,0x00, 0x8c,0x03,0x00,0x00,0x52,0x44,0x45,0x46,0xd8,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff, @@ -1979,9 +1978,9 @@ static const uint8_t _sgl_vs_bytecode_hlsl4[1032] = { 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f, + 0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x31,0x39,0x5f, 0x6d,0x76,0x70,0x00,0x02,0x00,0x03,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f,0x74,0x6d,0x00,0x4d,0x69,0x63,0x72,0x6f, + 0x00,0x00,0x00,0x00,0x5f,0x31,0x39,0x5f,0x74,0x6d,0x00,0x4d,0x69,0x63,0x72,0x6f, 0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68, 0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30, 0x2e,0x31,0x00,0xab,0x49,0x53,0x47,0x4e,0x74,0x00,0x00,0x00,0x04,0x00,0x00,0x00, @@ -2033,49 +2032,48 @@ static const uint8_t _sgl_vs_bytecode_hlsl4[1032] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sgl_fs_bytecode_hlsl4[620] = { - 0x44,0x58,0x42,0x43,0x4f,0x7a,0xe1,0xcf,0x0c,0x89,0xc0,0x09,0x50,0x5a,0xca,0xe9, - 0x75,0x77,0xd1,0x26,0x01,0x00,0x00,0x00,0x6c,0x02,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00, - 0xf0,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _sgl_fs_bytecode_hlsl4[608] = { + 0x44,0x58,0x42,0x43,0xc8,0x9b,0x66,0x64,0x80,0x2f,0xbe,0x14,0xd9,0x88,0xa0,0x97, + 0x64,0x14,0x66,0xff,0x01,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x48,0x01,0x00,0x00, + 0xe4,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x10,0x81,0x00,0x00,0x64,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f, - 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64, - 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31, - 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x03,0x00,0x00,0x38,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c, + 0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x03,0x00,0x00, + 0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54, + 0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00, + 0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + 0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, + 0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, + 0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, - 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01, - 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + }; #elif defined(SOKOL_WGPU) -FIXME FIXME FIXME static const uint8_t _sgl_vs_bytecode_wgpu[1968] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, From 14a6f7d59ede2df9da18d6d2ccbf2fb33b374213 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 18:56:58 +0200 Subject: [PATCH 043/292] sokol_fontstash.h: update embedded hlsl4 shaders --- util/sokol_fontstash.h | 78 ++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 12181032b..9719e3802 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -1285,10 +1285,9 @@ static const char _sfons_fs_source_metal_sim[464] = { }; #elif defined(SOKOL_D3D11) -FIXME FIXME FIXME static const uint8_t _sfons_vs_bytecode_hlsl4[1032] = { - 0x44,0x58,0x42,0x43,0x09,0x96,0xbb,0xbb,0xfc,0x44,0x44,0xa8,0xa4,0x1c,0x9e,0x45, - 0x50,0x97,0xf1,0xde,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, + 0x44,0x58,0x42,0x43,0x74,0x7f,0x01,0xd9,0xf4,0xd5,0xed,0x1d,0x74,0xc1,0x30,0x27, + 0xd8,0xe9,0x9d,0x50,0x01,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x02,0x00,0x00, 0x8c,0x03,0x00,0x00,0x52,0x44,0x45,0x46,0xd8,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff, @@ -1299,9 +1298,9 @@ static const uint8_t _sfons_vs_bytecode_hlsl4[1032] = { 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f, + 0x02,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x31,0x39,0x5f, 0x6d,0x76,0x70,0x00,0x02,0x00,0x03,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f,0x74,0x6d,0x00,0x4d,0x69,0x63,0x72,0x6f, + 0x00,0x00,0x00,0x00,0x5f,0x31,0x39,0x5f,0x74,0x6d,0x00,0x4d,0x69,0x63,0x72,0x6f, 0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68, 0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30, 0x2e,0x31,0x00,0xab,0x49,0x53,0x47,0x4e,0x74,0x00,0x00,0x00,0x04,0x00,0x00,0x00, @@ -1353,50 +1352,49 @@ static const uint8_t _sfons_vs_bytecode_hlsl4[1032] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sfons_fs_bytecode_hlsl4[640] = { - 0x44,0x58,0x42,0x43,0x5e,0xbc,0x77,0xd9,0xc9,0xdf,0x7d,0x8e,0x0c,0x24,0x18,0x66, - 0x36,0xd3,0xf4,0x78,0x01,0x00,0x00,0x00,0x80,0x02,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00, - 0x04,0x02,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _sfons_fs_bytecode_hlsl4[628] = { + 0x44,0x58,0x42,0x43,0xb6,0x66,0xf0,0xfc,0x09,0x54,0x2a,0x35,0x84,0x1d,0x27,0xd2, + 0xff,0xb3,0x2e,0xdb,0x01,0x00,0x00,0x00,0x74,0x02,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x48,0x01,0x00,0x00, + 0xf8,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x10,0x81,0x00,0x00,0x64,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f, - 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64, - 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31, - 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x03,0x00,0x00,0x38,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0xa8,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x2a,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x96,0x73,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x36,0x00,0x00,0x05,0x12,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x00,0x00, - 0x00,0x00,0x80,0x3f,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, - 0x06,0x0c,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, - 0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c, + 0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x03,0x00,0x00, + 0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54, + 0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0xa8,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00, + 0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + 0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x96,0x73,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x05,0x12,0x00,0x10,0x00,0x00,0x00,0x00,0x00, + 0x01,0x40,0x00,0x00,0x00,0x00,0x80,0x3f,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00, + 0x00,0x00,0x00,0x00,0x06,0x0c,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00, + 0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00, + 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -FIXME FIXME FIXME static const uint8_t _sfons_vs_bytecode_wgpu[1968] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, From 6df3bb10bebe6da54fa448830058a91218eb3ae6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 19:00:45 +0200 Subject: [PATCH 044/292] sokol_imgui.h: update embedded hlsl4 shaders --- util/sokol_imgui.h | 72 ++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 0da085e0c..5edb834ba 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -1363,10 +1363,9 @@ static const char _simgui_fs_source_metal_sim[436] = { 0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) -FIXME FIXME FIXME static const uint8_t _simgui_vs_bytecode_hlsl4[892] = { - 0x44,0x58,0x42,0x43,0x05,0xf8,0x0b,0x1e,0x7a,0x13,0x49,0x07,0x83,0x60,0x2e,0x88, - 0x06,0xfa,0x10,0x2e,0x01,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, + 0x44,0x58,0x42,0x43,0x0d,0xbd,0x9e,0x9e,0x7d,0xc0,0x2b,0x54,0x88,0xf9,0xca,0x89, + 0x32,0xe4,0x0c,0x59,0x01,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0xd0,0x01,0x00,0x00, 0x00,0x03,0x00,0x00,0x52,0x44,0x45,0x46,0xc0,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff, @@ -1376,7 +1375,7 @@ static const uint8_t _simgui_vs_bytecode_hlsl4[892] = { 0x73,0x00,0xab,0xab,0x3c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00, 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x88,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x32,0x33,0x5f,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a, + 0x00,0x00,0x00,0x00,0x5f,0x32,0x32,0x5f,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a, 0x65,0x00,0xab,0xab,0x01,0x00,0x03,0x00,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52, 0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f, @@ -1422,49 +1421,48 @@ static const uint8_t _simgui_vs_bytecode_hlsl4[892] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _simgui_fs_bytecode_hlsl4[620] = { - 0x44,0x58,0x42,0x43,0xd1,0x93,0x1f,0x1b,0x9d,0x70,0x90,0xeb,0xc2,0x7c,0x26,0x07, - 0xdf,0x52,0xda,0x49,0x01,0x00,0x00,0x00,0x6c,0x02,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00, - 0xf0,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _simgui_fs_bytecode_hlsl4[608] = { + 0x44,0x58,0x42,0x43,0x3a,0xa7,0x41,0x21,0xb4,0x2d,0xa7,0x6e,0xfe,0x31,0xb0,0xe0, + 0x14,0xe0,0xdf,0x5a,0x01,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x48,0x01,0x00,0x00, + 0xe4,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x10,0x81,0x00,0x00,0x64,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f, - 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64, - 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31, - 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x38,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c, + 0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00, + 0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54, + 0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00, + 0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + 0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, + 0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, + 0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, - 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01, - 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + }; #elif defined(SOKOL_WGPU) -FIXME FIXME FIXME static const uint8_t _simgui_vs_bytecode_wgpu[1868] = { 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x34,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, From 9505d667d3397947beb1ac846656c8a3dfecc37a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 19:07:37 +0200 Subject: [PATCH 045/292] sokol_nuklear.h: update embedded hlsl4 shaders --- util/sokol_nuklear.h | 112 +++++++++++++------------------------------ 1 file changed, 34 insertions(+), 78 deletions(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index d53e24aea..af166080d 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -1268,8 +1268,8 @@ static const char _snk_fs_source_metal_sim[436] = { }; #elif defined(SOKOL_D3D11) static const uint8_t _snk_vs_bytecode_hlsl4[892] = { - 0x44,0x58,0x42,0x43,0x05,0xf8,0x0b,0x1e,0x7a,0x13,0x49,0x07,0x83,0x60,0x2e,0x88, - 0x06,0xfa,0x10,0x2e,0x01,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, + 0x44,0x58,0x42,0x43,0x0d,0xbd,0x9e,0x9e,0x7d,0xc0,0x2b,0x54,0x88,0xf9,0xca,0x89, + 0x32,0xe4,0x0c,0x59,0x01,0x00,0x00,0x00,0x7c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0xd0,0x01,0x00,0x00, 0x00,0x03,0x00,0x00,0x52,0x44,0x45,0x46,0xc0,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff, @@ -1279,7 +1279,7 @@ static const uint8_t _snk_vs_bytecode_hlsl4[892] = { 0x73,0x00,0xab,0xab,0x3c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00, 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x88,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x32,0x33,0x5f,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a, + 0x00,0x00,0x00,0x00,0x5f,0x32,0x32,0x5f,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a, 0x65,0x00,0xab,0xab,0x01,0x00,0x03,0x00,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52, 0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f, @@ -1325,89 +1325,45 @@ static const uint8_t _snk_vs_bytecode_hlsl4[892] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _snk_fs_bytecode_hlsl4[620] = { - 0x44,0x58,0x42,0x43,0xd1,0x93,0x1f,0x1b,0x9d,0x70,0x90,0xeb,0xc2,0x7c,0x26,0x07, - 0xdf,0x52,0xda,0x49,0x01,0x00,0x00,0x00,0x6c,0x02,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0xd4,0x00,0x00,0x00,0x20,0x01,0x00,0x00,0x54,0x01,0x00,0x00, - 0xf0,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x98,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const uint8_t _snk_fs_bytecode_hlsl4[608] = { + 0x44,0x58,0x42,0x43,0x3a,0xa7,0x41,0x21,0xb4,0x2d,0xa7,0x6e,0xfe,0x31,0xb0,0xe0, + 0x14,0xe0,0xdf,0x5a,0x01,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x14,0x01,0x00,0x00,0x48,0x01,0x00,0x00, + 0xe4,0x01,0x00,0x00,0x52,0x44,0x45,0x46,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0x6d,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x10,0x81,0x00,0x00,0x64,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f, - 0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64, - 0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31, - 0x00,0xab,0xab,0xab,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x38,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c, + 0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c, + 0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00, + 0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54, + 0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00, + 0x40,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00, + 0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + 0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00, + 0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, + 0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, + 0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x94,0x00,0x00,0x00,0x40,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x38,0x00,0x00,0x07,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, - 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x3e,0x00,0x00,0x01, - 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -static const char _snk_fs_source_hlsl4[641] = { - 0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72, - 0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61, - 0x74,0x65,0x20,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20, - 0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x73,0x30,0x29,0x3b,0x0a, - 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66, - 0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69, - 0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45, - 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, - 0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, - 0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, - 0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53, - 0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x31,0x20,0x22,0x22,0x0a,0x76,0x6f,0x69,0x64,0x20, - 0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x23,0x6c, - 0x69,0x6e,0x65,0x20,0x31,0x31,0x20,0x22,0x22,0x0a,0x20,0x20,0x20,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53, - 0x61,0x6d,0x70,0x6c,0x65,0x28,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, - 0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52, - 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75, - 0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20, - 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a, - 0x00, }; #elif defined(SOKOL_WGPU) static const uint8_t _snk_vs_bytecode_wgpu[1520] = { From b8c66bfdf872e6aa8b1e2f8efe1cdb83cdaf4a1b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 23 Jun 2023 19:11:19 +0200 Subject: [PATCH 046/292] sokol_spine.h: update embedded hlsl4 shaders --- util/sokol_spine.h | 111 ++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 57 deletions(-) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 2d6841e6e..d599e106b 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -1471,8 +1471,6 @@ SOKOL_SPINE_API_DECL void sspine_set_skin(sspine_instance instance, sspine_skin @end @program sspine vs fs - - @program sspine vs fs */ #if defined(SOKOL_GLCORE33) static const char _sspine_vs_source_glsl330[352] = { @@ -1576,10 +1574,9 @@ static const char _sspine_fs_source_glsl300es[399] = { 0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_D3D11) -FIXME FIXME FIXME static const uint8_t _sspine_vs_bytecode_hlsl4[844] = { - 0x44,0x58,0x42,0x43,0xb2,0xdb,0x57,0x6f,0x29,0xa5,0x26,0x49,0xa3,0x0e,0xb4,0x9e, - 0x0f,0x0d,0x7f,0xcd,0x01,0x00,0x00,0x00,0x4c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, + 0x44,0x58,0x42,0x43,0x2a,0xc9,0x57,0x52,0x4b,0x3d,0x3e,0x89,0x00,0xf4,0xfa,0x41, + 0xfd,0xd7,0x63,0xc3,0x01,0x00,0x00,0x00,0x4c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, 0x34,0x00,0x00,0x00,0xf4,0x00,0x00,0x00,0x58,0x01,0x00,0x00,0xc8,0x01,0x00,0x00, 0xd0,0x02,0x00,0x00,0x52,0x44,0x45,0x46,0xb8,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xfe,0xff, @@ -1589,7 +1586,7 @@ static const uint8_t _sspine_vs_bytecode_hlsl4[844] = { 0x73,0x00,0xab,0xab,0x3c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x00,0x00,0x00, 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x32,0x31,0x5f,0x6d,0x76,0x70,0x00,0x02,0x00,0x03,0x00, + 0x00,0x00,0x00,0x00,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x00,0x02,0x00,0x03,0x00, 0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4d,0x69,0x63,0x72, 0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53, 0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31, @@ -1632,62 +1629,62 @@ static const uint8_t _sspine_vs_bytecode_hlsl4[844] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static const uint8_t _sspine_fs_bytecode_hlsl4[876] = { - 0x44,0x58,0x42,0x43,0xd8,0xf3,0x35,0x5e,0xf6,0xd6,0x61,0x80,0x71,0x85,0x56,0x46, - 0x08,0x09,0x74,0xcd,0x01,0x00,0x00,0x00,0x6c,0x03,0x00,0x00,0x05,0x00,0x00,0x00, - 0x34,0x00,0x00,0x00,0x44,0x01,0x00,0x00,0x90,0x01,0x00,0x00,0xc4,0x01,0x00,0x00, - 0xf0,0x02,0x00,0x00,0x52,0x44,0x45,0x46,0x08,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x98,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, - 0x10,0x81,0x00,0x00,0xe0,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +static const uint8_t _sspine_fs_bytecode_hlsl4[868] = { + 0x44,0x58,0x42,0x43,0xfb,0x9d,0xdb,0x19,0x85,0xbc,0x50,0x5d,0x6b,0x03,0xd4,0xc8, + 0x1b,0xea,0x59,0xf5,0x01,0x00,0x00,0x00,0x64,0x03,0x00,0x00,0x05,0x00,0x00,0x00, + 0x34,0x00,0x00,0x00,0x3c,0x01,0x00,0x00,0x88,0x01,0x00,0x00,0xbc,0x01,0x00,0x00, + 0xe8,0x02,0x00,0x00,0x52,0x44,0x45,0x46,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00, + 0x90,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x04,0xff,0xff, + 0x10,0x81,0x00,0x00,0xd8,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x89,0x00,0x00,0x00,0x02,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00, 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x8d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x00,0x74,0x65,0x78,0x00,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x73,0x00,0xab,0x8d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xb0,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xd0,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x5f,0x35,0x30,0x5f,0x70,0x6d,0x61,0x00,0x00,0x00,0x03,0x00, - 0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4d,0x69,0x63,0x72, - 0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52,0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53, - 0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f,0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31, - 0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e,0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x38,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab, - 0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52,0x24,0x01,0x00,0x00,0x40,0x00,0x00,0x00, - 0x49,0x00,0x00,0x00,0x59,0x00,0x00,0x04,0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x5a,0x00,0x00,0x03,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00,0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00, - 0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03, - 0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00, - 0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x45,0x00,0x00,0x09, - 0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00, - 0x38,0x00,0x00,0x07,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, - 0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x07, - 0x72,0x00,0x10,0x00,0x01,0x00,0x00,0x00,0xf6,0x0f,0x10,0x00,0x00,0x00,0x00,0x00, - 0x46,0x02,0x10,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x05,0x82,0x00,0x10,0x00, - 0x01,0x00,0x00,0x00,0x3a,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x0a, - 0xf2,0x00,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x01,0x00,0x00,0x00, - 0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x0e,0x10,0x80,0x41,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x0a,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00, - 0x06,0x80,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, - 0x01,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x01, - 0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x73,0x6d,0x70,0x00,0x74,0x65,0x78,0x00, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x00,0xab,0xab,0x84,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x35,0x33,0x5f, + 0x70,0x6d,0x61,0x00,0x00,0x00,0x03,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,0x20,0x28,0x52, + 0x29,0x20,0x48,0x4c,0x53,0x4c,0x20,0x53,0x68,0x61,0x64,0x65,0x72,0x20,0x43,0x6f, + 0x6d,0x70,0x69,0x6c,0x65,0x72,0x20,0x31,0x30,0x2e,0x31,0x00,0x49,0x53,0x47,0x4e, + 0x44,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x38,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x03,0x00,0x00,0x38,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0f,0x0f,0x00,0x00,0x54,0x45,0x58,0x43, + 0x4f,0x4f,0x52,0x44,0x00,0xab,0xab,0xab,0x4f,0x53,0x47,0x4e,0x2c,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00, + 0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x00,0xab,0xab,0x53,0x48,0x44,0x52, + 0x24,0x01,0x00,0x00,0x40,0x00,0x00,0x00,0x49,0x00,0x00,0x00,0x59,0x00,0x00,0x04, + 0x46,0x8e,0x20,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x5a,0x00,0x00,0x03, + 0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x58,0x18,0x00,0x04,0x00,0x70,0x10,0x00, + 0x00,0x00,0x00,0x00,0x55,0x55,0x00,0x00,0x62,0x10,0x00,0x03,0x32,0x10,0x10,0x00, + 0x00,0x00,0x00,0x00,0x62,0x10,0x00,0x03,0xf2,0x10,0x10,0x00,0x01,0x00,0x00,0x00, + 0x65,0x00,0x00,0x03,0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x68,0x00,0x00,0x02, + 0x02,0x00,0x00,0x00,0x45,0x00,0x00,0x09,0xf2,0x00,0x10,0x00,0x00,0x00,0x00,0x00, + 0x46,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x7e,0x10,0x00,0x00,0x00,0x00,0x00, + 0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0xf2,0x00,0x10,0x00, + 0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x1e,0x10,0x00, + 0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x07,0x72,0x00,0x10,0x00,0x01,0x00,0x00,0x00, + 0xf6,0x0f,0x10,0x00,0x00,0x00,0x00,0x00,0x46,0x02,0x10,0x00,0x00,0x00,0x00,0x00, + 0x36,0x00,0x00,0x05,0x82,0x00,0x10,0x00,0x01,0x00,0x00,0x00,0x3a,0x00,0x10,0x00, + 0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x0a,0xf2,0x00,0x10,0x00,0x01,0x00,0x00,0x00, + 0x46,0x0e,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x1e,0x10,0x00,0x01,0x00,0x00,0x00, + 0x46,0x0e,0x10,0x80,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x0a, + 0xf2,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x06,0x80,0x20,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x46,0x0e,0x10,0x00,0x01,0x00,0x00,0x00,0x46,0x0e,0x10,0x00, + 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x01,0x53,0x54,0x41,0x54,0x74,0x00,0x00,0x00, + 0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_METAL) static const uint8_t _sspine_vs_bytecode_metal_macos[3084] = { From fead8da93de365c60f982ad981832fddc341923d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 14:52:41 +0200 Subject: [PATCH 047/292] sokol_gfx.h: clean up comment style, remove obsolete UWP leftovers --- sokol_gfx.h | 574 ++++++++++++++++++++++++---------------------------- 1 file changed, 267 insertions(+), 307 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7c6f87548..e0381e4e0 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1273,8 +1273,8 @@ typedef struct sg_range { // disabling this for every includer isn't great, but the warnings are also quite pointless #if defined(_MSC_VER) -#pragma warning(disable:4221) /* /W4 only: nonstandard extension used: 'x': cannot be initialized using address of automatic variable 'y' */ -#pragma warning(disable:4204) /* VS2015: nonstandard extension used: non-constant aggregate initializer */ +#pragma warning(disable:4221) // /W4 only: nonstandard extension used: 'x': cannot be initialized using address of automatic variable 'y' +#pragma warning(disable:4204) // VS2015: nonstandard extension used: non-constant aggregate initializer #endif #if defined(__cplusplus) #define SG_RANGE(x) sg_range{ &x, sizeof(x) } @@ -1371,7 +1371,7 @@ typedef enum sg_backend { use whatever renderable pixel format is convenient for you. */ typedef enum sg_pixel_format { - _SG_PIXELFORMAT_DEFAULT, /* value 0 reserved for default-init */ + _SG_PIXELFORMAT_DEFAULT, // value 0 reserved for default-init SG_PIXELFORMAT_NONE, SG_PIXELFORMAT_R8, @@ -1554,7 +1554,7 @@ typedef enum sg_resource_state { The default usage is SG_USAGE_IMMUTABLE. */ typedef enum sg_usage { - _SG_USAGE_DEFAULT, /* value 0 reserved for default-init */ + _SG_USAGE_DEFAULT, // value 0 reserved for default-init SG_USAGE_IMMUTABLE, SG_USAGE_DYNAMIC, SG_USAGE_STREAM, @@ -1571,7 +1571,7 @@ typedef enum sg_usage { The default value is SG_BUFFERTYPE_VERTEXBUFFER. */ typedef enum sg_buffer_type { - _SG_BUFFERTYPE_DEFAULT, /* value 0 reserved for default-init */ + _SG_BUFFERTYPE_DEFAULT, // value 0 reserved for default-init SG_BUFFERTYPE_VERTEXBUFFER, SG_BUFFERTYPE_INDEXBUFFER, _SG_BUFFERTYPE_NUM, @@ -1589,7 +1589,7 @@ typedef enum sg_buffer_type { The default index type is SG_INDEXTYPE_NONE. */ typedef enum sg_index_type { - _SG_INDEXTYPE_DEFAULT, /* value 0 reserved for default-init */ + _SG_INDEXTYPE_DEFAULT, // value 0 reserved for default-init SG_INDEXTYPE_NONE, SG_INDEXTYPE_UINT16, SG_INDEXTYPE_UINT32, @@ -1608,7 +1608,7 @@ typedef enum sg_index_type { The default image type when creating an image is SG_IMAGETYPE_2D. */ typedef enum sg_image_type { - _SG_IMAGETYPE_DEFAULT, /* value 0 reserved for default-init */ + _SG_IMAGETYPE_DEFAULT, // value 0 reserved for default-init SG_IMAGETYPE_2D, SG_IMAGETYPE_CUBE, SG_IMAGETYPE_3D, @@ -1689,7 +1689,7 @@ typedef enum sg_shader_stage { The default primitive type is SG_PRIMITIVETYPE_TRIANGLES. */ typedef enum sg_primitive_type { - _SG_PRIMITIVETYPE_DEFAULT, /* value 0 reserved for default-init */ + _SG_PRIMITIVETYPE_DEFAULT, // value 0 reserved for default-init SG_PRIMITIVETYPE_POINTS, SG_PRIMITIVETYPE_LINES, SG_PRIMITIVETYPE_LINE_STRIP, @@ -1750,7 +1750,7 @@ typedef enum sg_filter { - Metal on iOS */ typedef enum sg_wrap { - _SG_WRAP_DEFAULT, /* value 0 reserved for default-init */ + _SG_WRAP_DEFAULT, // value 0 reserved for default-init SG_WRAP_REPEAT, SG_WRAP_CLAMP_TO_EDGE, SG_WRAP_CLAMP_TO_BORDER, @@ -1768,7 +1768,7 @@ typedef enum sg_wrap { The default border color is SG_BORDERCOLOR_OPAQUE_BLACK */ typedef enum sg_border_color { - _SG_BORDERCOLOR_DEFAULT, /* value 0 reserved for default-init */ + _SG_BORDERCOLOR_DEFAULT, // value 0 reserved for default-init SG_BORDERCOLOR_TRANSPARENT_BLACK, SG_BORDERCOLOR_OPAQUE_BLACK, SG_BORDERCOLOR_OPAQUE_WHITE, @@ -1817,7 +1817,7 @@ typedef enum sg_vertex_format { when creating pipeline objects. */ typedef enum sg_vertex_step { - _SG_VERTEXSTEP_DEFAULT, /* value 0 reserved for default-init */ + _SG_VERTEXSTEP_DEFAULT, // value 0 reserved for default-init SG_VERTEXSTEP_PER_VERTEX, SG_VERTEXSTEP_PER_INSTANCE, _SG_VERTEXSTEP_NUM, @@ -1881,9 +1881,9 @@ typedef enum sg_uniform_type { at the start of the header. */ typedef enum sg_uniform_layout { - _SG_UNIFORMLAYOUT_DEFAULT, /* value 0 reserved for default-init */ - SG_UNIFORMLAYOUT_NATIVE, /* default: layout depends on currently active backend */ - SG_UNIFORMLAYOUT_STD140, /* std140: memory layout according to std140 */ + _SG_UNIFORMLAYOUT_DEFAULT, // value 0 reserved for default-init + SG_UNIFORMLAYOUT_NATIVE, // default: layout depends on currently active backend + SG_UNIFORMLAYOUT_STD140, // std140: memory layout according to std140 _SG_UNIFORMLAYOUT_NUM, _SG_UNIFORMLAYOUT_FORCE_U32 = 0x7FFFFFFF } sg_uniform_layout; @@ -1898,7 +1898,7 @@ typedef enum sg_uniform_layout { The default cull mode is SG_CULLMODE_NONE */ typedef enum sg_cull_mode { - _SG_CULLMODE_DEFAULT, /* value 0 reserved for default-init */ + _SG_CULLMODE_DEFAULT, // value 0 reserved for default-init SG_CULLMODE_NONE, SG_CULLMODE_FRONT, SG_CULLMODE_BACK, @@ -1916,7 +1916,7 @@ typedef enum sg_cull_mode { The default winding is SG_FACEWINDING_CW (clockwise) */ typedef enum sg_face_winding { - _SG_FACEWINDING_DEFAULT, /* value 0 reserved for default-init */ + _SG_FACEWINDING_DEFAULT, // value 0 reserved for default-init SG_FACEWINDING_CCW, SG_FACEWINDING_CW, _SG_FACEWINDING_NUM, @@ -1940,7 +1940,7 @@ typedef enum sg_face_winding { SG_COMPAREFUNC_ALWAYS. */ typedef enum sg_compare_func { - _SG_COMPAREFUNC_DEFAULT, /* value 0 reserved for default-init */ + _SG_COMPAREFUNC_DEFAULT, // value 0 reserved for default-init SG_COMPAREFUNC_NEVER, SG_COMPAREFUNC_LESS, SG_COMPAREFUNC_EQUAL, @@ -1974,7 +1974,7 @@ typedef enum sg_compare_func { The default value is SG_STENCILOP_KEEP. */ typedef enum sg_stencil_op { - _SG_STENCILOP_DEFAULT, /* value 0 reserved for default-init */ + _SG_STENCILOP_DEFAULT, // value 0 reserved for default-init SG_STENCILOP_KEEP, SG_STENCILOP_ZERO, SG_STENCILOP_REPLACE, @@ -2005,7 +2005,7 @@ typedef enum sg_stencil_op { factors, and SG_BLENDFACTOR_ZERO for destination factors. */ typedef enum sg_blend_factor { - _SG_BLENDFACTOR_DEFAULT, /* value 0 reserved for default-init */ + _SG_BLENDFACTOR_DEFAULT, // value 0 reserved for default-init SG_BLENDFACTOR_ZERO, SG_BLENDFACTOR_ONE, SG_BLENDFACTOR_SRC_COLOR, @@ -2041,7 +2041,7 @@ typedef enum sg_blend_factor { The default value is SG_BLENDOP_ADD. */ typedef enum sg_blend_op { - _SG_BLENDOP_DEFAULT, /* value 0 reserved for default-init */ + _SG_BLENDOP_DEFAULT, // value 0 reserved for default-init SG_BLENDOP_ADD, SG_BLENDOP_SUBTRACT, SG_BLENDOP_REVERSE_SUBTRACT, @@ -2063,8 +2063,8 @@ typedef enum sg_blend_op { should be disabled. */ typedef enum sg_color_mask { - _SG_COLORMASK_DEFAULT = 0, /* value 0 reserved for default-init */ - SG_COLORMASK_NONE = 0x10, /* special value for 'all channels disabled */ + _SG_COLORMASK_DEFAULT = 0, // value 0 reserved for default-init + SG_COLORMASK_NONE = 0x10, // special value for 'all channels disabled SG_COLORMASK_R = 0x1, SG_COLORMASK_G = 0x2, SG_COLORMASK_RG = 0x3, @@ -3202,12 +3202,12 @@ typedef struct sg_d3d11_context_desc { } sg_d3d11_context_desc; typedef struct sg_wgpu_context_desc { - const void* device; /* WGPUDevice */ - const void* (*render_view_cb)(void); /* returns WGPUTextureView */ + const void* device; // WGPUDevice + const void* (*render_view_cb)(void); // returns WGPUTextureView const void* (*render_view_userdata_cb)(void*); - const void* (*resolve_view_cb)(void); /* returns WGPUTextureView */ + const void* (*resolve_view_cb)(void); // returns WGPUTextureView const void* (*resolve_view_userdata_cb)(void*); - const void* (*depth_stencil_view_cb)(void); /* returns WGPUTextureView, must be WGPUTextureFormat_Depth24Plus8 */ + const void* (*depth_stencil_view_cb)(void); // returns WGPUTextureView, must be WGPUTextureFormat_Depth24Plus8 const void* (*depth_stencil_view_userdata_cb)(void*); void* user_data; } sg_wgpu_context_desc; @@ -3291,7 +3291,7 @@ typedef struct sg_desc { uint32_t _end_canary; } sg_desc; -/* setup and misc functions */ +// setup and misc functions SOKOL_GFX_API_DECL void sg_setup(const sg_desc* desc); SOKOL_GFX_API_DECL void sg_shutdown(void); SOKOL_GFX_API_DECL bool sg_isvalid(void); @@ -3302,7 +3302,7 @@ SOKOL_GFX_API_DECL void sg_pop_debug_group(void); SOKOL_GFX_API_DECL bool sg_add_commit_listener(sg_commit_listener listener); SOKOL_GFX_API_DECL bool sg_remove_commit_listener(sg_commit_listener listener); -/* resource creation, destruction and updating */ +// resource creation, destruction and updating SOKOL_GFX_API_DECL sg_buffer sg_make_buffer(const sg_buffer_desc* desc); SOKOL_GFX_API_DECL sg_image sg_make_image(const sg_image_desc* desc); SOKOL_GFX_API_DECL sg_sampler sg_make_sampler(const sg_sampler_desc* desc); @@ -3321,7 +3321,7 @@ SOKOL_GFX_API_DECL int sg_append_buffer(sg_buffer buf, const sg_range* data); SOKOL_GFX_API_DECL bool sg_query_buffer_overflow(sg_buffer buf); SOKOL_GFX_API_DECL bool sg_query_buffer_will_overflow(sg_buffer buf, size_t size); -/* rendering functions */ +// rendering functions SOKOL_GFX_API_DECL void sg_begin_default_pass(const sg_pass_action* pass_action, int width, int height); SOKOL_GFX_API_DECL void sg_begin_default_passf(const sg_pass_action* pass_action, float width, float height); SOKOL_GFX_API_DECL void sg_begin_pass(sg_pass pass, const sg_pass_action* pass_action); @@ -3336,34 +3336,34 @@ SOKOL_GFX_API_DECL void sg_draw(int base_element, int num_elements, int num_inst SOKOL_GFX_API_DECL void sg_end_pass(void); SOKOL_GFX_API_DECL void sg_commit(void); -/* getting information */ +// getting information SOKOL_GFX_API_DECL sg_desc sg_query_desc(void); SOKOL_GFX_API_DECL sg_backend sg_query_backend(void); SOKOL_GFX_API_DECL sg_features sg_query_features(void); SOKOL_GFX_API_DECL sg_limits sg_query_limits(void); SOKOL_GFX_API_DECL sg_pixelformat_info sg_query_pixelformat(sg_pixel_format fmt); -/* get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) */ +// get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) SOKOL_GFX_API_DECL sg_resource_state sg_query_buffer_state(sg_buffer buf); SOKOL_GFX_API_DECL sg_resource_state sg_query_image_state(sg_image img); SOKOL_GFX_API_DECL sg_resource_state sg_query_sampler_state(sg_sampler smp); SOKOL_GFX_API_DECL sg_resource_state sg_query_shader_state(sg_shader shd); SOKOL_GFX_API_DECL sg_resource_state sg_query_pipeline_state(sg_pipeline pip); SOKOL_GFX_API_DECL sg_resource_state sg_query_pass_state(sg_pass pass); -/* get runtime information about a resource */ +// get runtime information about a resource SOKOL_GFX_API_DECL sg_buffer_info sg_query_buffer_info(sg_buffer buf); SOKOL_GFX_API_DECL sg_image_info sg_query_image_info(sg_image img); SOKOL_GFX_API_DECL sg_sampler_info sg_query_sampler_info(sg_sampler smp); SOKOL_GFX_API_DECL sg_shader_info sg_query_shader_info(sg_shader shd); SOKOL_GFX_API_DECL sg_pipeline_info sg_query_pipeline_info(sg_pipeline pip); SOKOL_GFX_API_DECL sg_pass_info sg_query_pass_info(sg_pass pass); -/* get desc structs matching a specific resource (NOTE that not all creation attributes may be provided) */ +// get desc structs matching a specific resource (NOTE that not all creation attributes may be provided) SOKOL_GFX_API_DECL sg_buffer_desc sg_query_buffer_desc(sg_buffer buf); SOKOL_GFX_API_DECL sg_image_desc sg_query_image_desc(sg_image img); SOKOL_GFX_API_DECL sg_sampler_desc sg_query_sampler_desc(sg_sampler smp); SOKOL_GFX_API_DECL sg_shader_desc sg_query_shader_desc(sg_shader shd); SOKOL_GFX_API_DECL sg_pipeline_desc sg_query_pipeline_desc(sg_pipeline pip); SOKOL_GFX_API_DECL sg_pass_desc sg_query_pass_desc(sg_pass pass); -/* get resource creation desc struct with their default values replaced */ +// get resource creation desc struct with their default values replaced SOKOL_GFX_API_DECL sg_buffer_desc sg_query_buffer_defaults(const sg_buffer_desc* desc); SOKOL_GFX_API_DECL sg_image_desc sg_query_image_defaults(const sg_image_desc* desc); SOKOL_GFX_API_DECL sg_sampler_desc sg_query_sampler_defaults(const sg_sampler_desc* desc); @@ -3371,7 +3371,7 @@ SOKOL_GFX_API_DECL sg_shader_desc sg_query_shader_defaults(const sg_shader_desc* SOKOL_GFX_API_DECL sg_pipeline_desc sg_query_pipeline_defaults(const sg_pipeline_desc* desc); SOKOL_GFX_API_DECL sg_pass_desc sg_query_pass_defaults(const sg_pass_desc* desc); -/* separate resource allocation and initialization (for async setup) */ +// separate resource allocation and initialization (for async setup) SOKOL_GFX_API_DECL sg_buffer sg_alloc_buffer(void); SOKOL_GFX_API_DECL sg_image sg_alloc_image(void); SOKOL_GFX_API_DECL sg_sampler sg_alloc_sampler(void); @@ -3403,7 +3403,7 @@ SOKOL_GFX_API_DECL void sg_fail_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_fail_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_fail_pass(sg_pass pass); -/* rendering contexts (optional) */ +// rendering contexts (optional) SOKOL_GFX_API_DECL sg_context sg_setup_context(void); SOKOL_GFX_API_DECL void sg_activate_context(sg_context ctx_id); SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); @@ -3414,19 +3414,19 @@ SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); This group of functions will be expanded as needed. */ -/* D3D11: return ID3D11Device */ +// D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); -/* Metal: return __bridge-casted MTLDevice */ +// Metal: return __bridge-casted MTLDevice SOKOL_GFX_API_DECL const void* sg_mtl_device(void); -/* Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) */ +// Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) SOKOL_GFX_API_DECL const void* sg_mtl_render_command_encoder(void); #ifdef __cplusplus -} /* extern "C" */ +} // extern "C" -/* reference-based equivalents for c++ */ +// reference-based equivalents for c++ inline void sg_setup(const sg_desc& desc) { return sg_setup(&desc); } inline sg_buffer sg_make_buffer(const sg_buffer_desc& desc) { return sg_make_buffer(&desc); } @@ -3519,7 +3519,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define _SG_TRACE_NOARGS(fn) #endif -/* default clear values */ +// default clear values #ifndef SG_DEFAULT_CLEAR_RED #define SG_DEFAULT_CLEAR_RED (0.5f) #endif @@ -3541,11 +3541,11 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4115) /* named type definition in parentheses */ -#pragma warning(disable:4505) /* unreferenced local function has been removed */ -#pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union (needed by d3d11.h) */ -#pragma warning(disable:4054) /* 'type cast': from function pointer */ -#pragma warning(disable:4055) /* 'type cast': from data pointer */ +#pragma warning(disable:4115) // named type definition in parentheses +#pragma warning(disable:4505) // unreferenced local function has been removed +#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union (needed by d3d11.h) +#pragma warning(disable:4054) // 'type cast': from function pointer +#pragma warning(disable:4055) // 'type cast': from data pointer #endif #if defined(SOKOL_D3D11) @@ -3561,13 +3561,10 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #include #include #ifdef _MSC_VER - #if (defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) - #pragma comment (lib, "WindowsApp") - #else - #pragma comment (lib, "kernel32") - #pragma comment (lib, "user32") - #pragma comment (lib, "dxgi") - #pragma comment (lib, "d3d11") + #pragma comment (lib, "kernel32") + #pragma comment (lib, "user32") + #pragma comment (lib, "dxgi") + #pragma comment (lib, "d3d11") #endif #endif #elif defined(SOKOL_METAL) @@ -3965,14 +3962,14 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ // ███████ ██ ██ ██ ██████ ██████ ██ ███████ // // >>structs -/* resource pool slots */ +// resource pool slots typedef struct { uint32_t id; uint32_t ctx_id; sg_resource_state state; } _sg_slot_t; -/* constants */ +// constants enum { _SG_STRING_SIZE = 16, _SG_SLOT_SHIFT = 16, @@ -3990,12 +3987,12 @@ enum { _SG_DEFAULT_MAX_COMMIT_LISTENERS = 1024, }; -/* fixed-size string */ +// fixed-size string typedef struct { char buf[_SG_STRING_SIZE]; } _sg_str_t; -/* helper macros */ +// helper macros #define _sg_def(val, def) (((val) == 0) ? (def) : (val)) #define _sg_def_flt(val, def) (((val) == 0.0f) ? (def) : (val)) #define _sg_min(a,b) (((a)<(b))?(a):(b)) @@ -4368,8 +4365,8 @@ typedef struct { typedef _sg_gl_shader_t _sg_shader_t; typedef struct { - int8_t vb_index; /* -1 if attr is not enabled */ - int8_t divisor; /* -1 if not initialized */ + int8_t vb_index; // -1 if attr is not enabled + int8_t divisor; // -1 if not initialized uint8_t stride; uint8_t size; uint8_t normalized; @@ -4599,11 +4596,11 @@ typedef struct { sg_pipeline cur_pipeline_id; ID3D11RenderTargetView* cur_rtvs[SG_MAX_COLOR_ATTACHMENTS]; ID3D11DepthStencilView* cur_dsv; - /* on-demand loaded d3dcompiler_47.dll handles */ + // on-demand loaded d3dcompiler_47.dll handles HINSTANCE d3dcompiler_dll; bool d3dcompiler_dll_load_failed; pD3DCompile D3DCompile_func; - /* global subresourcedata array for texture updates */ + // global subresourcedata array for texture updates D3D11_SUBRESOURCE_DATA subres_data[SG_MAX_MIPMAPS * SG_MAX_TEXTUREARRAY_LAYERS]; } _sg_d3d11_backend_t; @@ -4617,7 +4614,7 @@ typedef struct { #define _SG_MTL_INVALID_SLOT_INDEX (0) typedef struct { - uint32_t frame_index; /* frame index at which it is safe to release this resource */ + uint32_t frame_index; // frame index at which it is safe to release this resource int slot_index; } _sg_mtl_release_item_t; @@ -4635,7 +4632,7 @@ typedef struct { _sg_slot_t slot; _sg_buffer_common_t cmn; struct { - int buf[SG_NUM_INFLIGHT_FRAMES]; /* index into _sg_mtl_pool */ + int buf[SG_NUM_INFLIGHT_FRAMES]; // index into _sg_mtl_pool } mtl; } _sg_mtl_buffer_t; typedef _sg_mtl_buffer_t _sg_buffer_t; @@ -4710,7 +4707,7 @@ typedef struct { } _sg_mtl_context_t; typedef _sg_mtl_context_t _sg_context_t; -/* resouce binding state cache */ +// resouce binding state cache typedef struct { const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; @@ -4836,33 +4833,33 @@ typedef struct { } _sg_wgpu_context_t; typedef _sg_wgpu_context_t _sg_context_t; -/* a pool of per-frame uniform buffers */ +// a pool of per-frame uniform buffers typedef struct { WGPUBindGroupLayout bindgroup_layout; uint32_t num_bytes; - uint32_t offset; /* current offset into current frame's mapped uniform buffer */ + uint32_t offset; // current offset into current frame's mapped uniform buffer uint32_t bind_offsets[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; - WGPUBuffer buf; /* the GPU-side uniform buffer */ + WGPUBuffer buf; // the GPU-side uniform buffer WGPUBindGroup bindgroup; struct { int num; int cur; - WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; /* CPU-side staging buffers */ - uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; /* if != 0, staging buffer currently mapped */ + WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; // CPU-side staging buffers + uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // if != 0, staging buffer currently mapped } stage; } _sg_wgpu_ubpool_t; -/* ...a similar pool (like uniform buffer pool) of dynamic-resource staging buffers */ +// ...a similar pool (like uniform buffer pool) of dynamic-resource staging buffers typedef struct { uint32_t num_bytes; - uint32_t offset; /* current offset into current frame's staging buffer */ - int num; /* number of staging buffers */ - int cur; /* this frame's staging buffer */ - WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; /* CPU-side staging buffers */ - uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; /* if != 0, staging buffer currently mapped */ + uint32_t offset; // current offset into current frame's staging buffer + int num; // number of staging buffers + int cur; // this frame's staging buffer + WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; // CPU-side staging buffers + uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // if != 0, staging buffer currently mapped } _sg_wgpu_stagingpool_t; -/* the WGPU backend state */ +// the WGPU backend state typedef struct { bool valid; bool in_pass; @@ -4891,8 +4888,7 @@ typedef struct { // POOL STRUCTS - -/* this *MUST* remain 0 */ +// this *MUST* remain 0 #define _SG_INVALID_SLOT_INDEX (0) typedef struct { @@ -4927,7 +4923,7 @@ typedef struct { typedef struct { bool valid; - sg_desc desc; /* original desc with default values patched in */ + sg_desc desc; // original desc with default values patched in uint32_t frame_index; sg_context active_context; sg_pass cur_pass; @@ -5085,7 +5081,6 @@ _SOKOL_PRIVATE uint32_t _sg_align_u32(uint32_t val, uint32_t align) { return (val + (align - 1)) & ~(align - 1); } -/* return byte size of a vertex format */ _SOKOL_PRIVATE int _sg_vertexformat_bytesize(sg_vertex_format fmt) { switch (fmt) { case SG_VERTEXFORMAT_FLOAT: return 4; @@ -5206,7 +5201,6 @@ _SOKOL_PRIVATE uint32_t _sg_uniform_size(sg_uniform_type type, int array_count, } } -/* return true if pixel format is a compressed format */ _SOKOL_PRIVATE bool _sg_is_compressed_pixel_format(sg_pixel_format fmt) { switch (fmt) { case SG_PIXELFORMAT_BC1_RGBA: @@ -5234,31 +5228,26 @@ _SOKOL_PRIVATE bool _sg_is_compressed_pixel_format(sg_pixel_format fmt) { } } -/* return true if pixel format is a valid render target format */ _SOKOL_PRIVATE bool _sg_is_valid_rendertarget_color_format(sg_pixel_format fmt) { const int fmt_index = (int) fmt; SOKOL_ASSERT((fmt_index >= 0) && (fmt_index < _SG_PIXELFORMAT_NUM)); return _sg.formats[fmt_index].render && !_sg.formats[fmt_index].depth; } -/* return true if pixel format is a valid depth format */ _SOKOL_PRIVATE bool _sg_is_valid_rendertarget_depth_format(sg_pixel_format fmt) { const int fmt_index = (int) fmt; SOKOL_ASSERT((fmt_index >= 0) && (fmt_index < _SG_PIXELFORMAT_NUM)); return _sg.formats[fmt_index].render && _sg.formats[fmt_index].depth; } -// return true if pixel format is a depth- or depth-stencil format _SOKOL_PRIVATE bool _sg_is_depth_or_depth_stencil_format(sg_pixel_format fmt) { return (SG_PIXELFORMAT_DEPTH == fmt) || (SG_PIXELFORMAT_DEPTH_STENCIL == fmt); } -/* return true if pixel format is a depth-stencil format */ _SOKOL_PRIVATE bool _sg_is_depth_stencil_format(sg_pixel_format fmt) { return (SG_PIXELFORMAT_DEPTH_STENCIL == fmt); } -/* return the bytes-per-pixel for a pixel format */ _SOKOL_PRIVATE int _sg_pixelformat_bytesize(sg_pixel_format fmt) { switch (fmt) { case SG_PIXELFORMAT_R8: @@ -5266,7 +5255,6 @@ _SOKOL_PRIVATE int _sg_pixelformat_bytesize(sg_pixel_format fmt) { case SG_PIXELFORMAT_R8UI: case SG_PIXELFORMAT_R8SI: return 1; - case SG_PIXELFORMAT_R16: case SG_PIXELFORMAT_R16SN: case SG_PIXELFORMAT_R16UI: @@ -5277,7 +5265,6 @@ _SOKOL_PRIVATE int _sg_pixelformat_bytesize(sg_pixel_format fmt) { case SG_PIXELFORMAT_RG8UI: case SG_PIXELFORMAT_RG8SI: return 2; - case SG_PIXELFORMAT_R32UI: case SG_PIXELFORMAT_R32SI: case SG_PIXELFORMAT_R32F: @@ -5296,7 +5283,6 @@ _SOKOL_PRIVATE int _sg_pixelformat_bytesize(sg_pixel_format fmt) { case SG_PIXELFORMAT_RG11B10F: case SG_PIXELFORMAT_RGB9E5: return 4; - case SG_PIXELFORMAT_RG32UI: case SG_PIXELFORMAT_RG32SI: case SG_PIXELFORMAT_RG32F: @@ -5306,12 +5292,10 @@ _SOKOL_PRIVATE int _sg_pixelformat_bytesize(sg_pixel_format fmt) { case SG_PIXELFORMAT_RGBA16SI: case SG_PIXELFORMAT_RGBA16F: return 8; - case SG_PIXELFORMAT_RGBA32UI: case SG_PIXELFORMAT_RGBA32SI: case SG_PIXELFORMAT_RGBA32F: return 16; - default: SOKOL_UNREACHABLE; return 0; @@ -5379,7 +5363,7 @@ _SOKOL_PRIVATE int _sg_row_pitch(sg_pixel_format fmt, int width, int row_align) return pitch; } -/* compute the number of rows in a surface depending on pixel format */ +// compute the number of rows in a surface depending on pixel format _SOKOL_PRIVATE int _sg_num_rows(sg_pixel_format fmt, int height) { int num_rows; switch (fmt) { @@ -5430,7 +5414,7 @@ _SOKOL_PRIVATE int _sg_surface_pitch(sg_pixel_format fmt, int width, int height, return num_rows * _sg_row_pitch(fmt, width, row_align); } -/* capability table pixel format helper functions */ +// capability table pixel format helper functions _SOKOL_PRIVATE void _sg_pixelformat_all(sg_pixelformat_info* pfi) { pfi->sample = true; pfi->filter = true; @@ -5492,7 +5476,6 @@ _SOKOL_PRIVATE void _sg_pixelformat_sfbr(sg_pixelformat_info* pfi) { pfi->render = true; } -/* resolve pass action defaults into a new pass action struct */ _SOKOL_PRIVATE void _sg_resolve_default_pass_action(const sg_pass_action* from, sg_pass_action* to) { SOKOL_ASSERT(from && to); *to = *from; @@ -5549,11 +5532,11 @@ _SOKOL_PRIVATE void _sg_dummy_setup_backend(const sg_desc* desc) { } _SOKOL_PRIVATE void _sg_dummy_discard_backend(void) { - /* empty */ + // empty } _SOKOL_PRIVATE void _sg_dummy_reset_state_cache(void) { - /* empty*/ + // empty } _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_context(_sg_context_t* ctx) { @@ -5688,11 +5671,11 @@ _SOKOL_PRIVATE void _sg_dummy_begin_pass(_sg_pass_t* pass, const sg_pass_action* } _SOKOL_PRIVATE void _sg_dummy_end_pass(void) { - /* empty */ + // empty } _SOKOL_PRIVATE void _sg_dummy_commit(void) { - /* empty */ + // empty } _SOKOL_PRIVATE void _sg_dummy_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { @@ -5762,7 +5745,7 @@ _SOKOL_PRIVATE int _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* da buf->cmn.active_slot = 0; } } - /* NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend */ + // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend return _sg_roundup((int)data->size, 4); } @@ -5926,7 +5909,7 @@ _SOKOL_PRIVATE void _sg_gl_unload_opengl(void) { } #endif // _SOKOL_USE_WIN32_GL_LOADER -/*-- type translation --------------------------------------------------------*/ +//-- type translation ---------------------------------------------------------- _SOKOL_PRIVATE GLenum _sg_gl_buffer_target(sg_buffer_type t) { switch (t) { case SG_BUFFERTYPE_VERTEXBUFFER: return GL_ARRAY_BUFFER; @@ -6395,7 +6378,7 @@ _SOKOL_PRIVATE GLenum _sg_gl_cubeface_target(int face_index) { } } -/* see: https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml */ +// see: https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml _SOKOL_PRIVATE void _sg_gl_init_pixelformats(bool has_bgra) { _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_R8SN]); @@ -6444,7 +6427,7 @@ _SOKOL_PRIVATE void _sg_gl_init_pixelformats(bool has_bgra) { _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH_STENCIL]); } -/* FIXME: OES_half_float_blend */ +// FIXME: OES_half_float_blend _SOKOL_PRIVATE void _sg_gl_init_pixelformats_half_float(bool has_colorbuffer_half_float) { if (has_colorbuffer_half_float) { _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); @@ -6567,10 +6550,10 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_glcore33(void) { _sg.features.mrt_independent_blend_state = false; _sg.features.mrt_independent_write_mask = true; - /* scan extensions */ - bool has_s3tc = false; /* BC1..BC3 */ - bool has_rgtc = false; /* BC4 and BC5 */ - bool has_bptc = false; /* BC6H and BC7 */ + // scan extensions + bool has_s3tc = false; // BC1..BC3 + bool has_rgtc = false; // BC4 and BC5 + bool has_bptc = false; // BC6H and BC7 bool has_pvrtc = false; bool has_etc2 = false; GLint num_ext = 0; @@ -6594,14 +6577,14 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_glcore33(void) { } } - /* limits */ + // limits _sg_gl_init_limits(); - /* pixel formats */ - const bool has_bgra = false; /* not a bug */ + // pixel formats + const bool has_bgra = false; // not a bug const bool has_colorbuffer_float = true; const bool has_colorbuffer_half_float = true; - const bool has_texture_float_linear = true; /* FIXME??? */ + const bool has_texture_float_linear = true; // FIXME??? const bool has_float_blend = true; _sg_gl_init_pixelformats(has_bgra); _sg_gl_init_pixelformats_float(has_colorbuffer_float, has_texture_float_linear, has_float_blend); @@ -6633,9 +6616,9 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) { _sg.features.mrt_independent_blend_state = false; _sg.features.mrt_independent_write_mask = false; - bool has_s3tc = false; /* BC1..BC3 */ - bool has_rgtc = false; /* BC4 and BC5 */ - bool has_bptc = false; /* BC6H and BC7 */ + bool has_s3tc = false; // BC1..BC3 + bool has_rgtc = false; // BC4 and BC5 + bool has_bptc = false; // BC6H and BC7 bool has_pvrtc = false; #if defined(__EMSCRIPTEN__) bool has_etc2 = false; @@ -6688,11 +6671,11 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) { } #endif - /* limits */ + // limits _sg_gl_init_limits(); - /* pixel formats */ - const bool has_bgra = false; /* not a bug */ + // pixel formats + const bool has_bgra = false; // not a bug _sg_gl_init_pixelformats(has_bgra); _sg_gl_init_pixelformats_float(has_colorbuffer_float, has_texture_float_linear, has_float_blend); _sg_gl_init_pixelformats_half_float(has_colorbuffer_half_float); @@ -6714,7 +6697,7 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) { } #endif -/*-- state cache implementation ----------------------------------------------*/ +//-- state cache implementation ------------------------------------------------ _SOKOL_PRIVATE void _sg_gl_cache_clear_buffer_bindings(bool force) { if (force || (_sg.gl.cache.vertex_buffer != 0)) { glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -6898,7 +6881,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_sampler(GLuint smp) { SOKOL_ASSERT(false); } -/* called from _sg_gl_discard_shader() */ +// called from _sg_gl_discard_shader() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_program(GLuint prog) { if (prog == _sg.gl.cache.prog) { _sg.gl.cache.prog = 0; @@ -6906,7 +6889,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_program(GLuint prog) { } } -/* called from _sg_gl_discard_pipeline() */ +// called from _sg_gl_discard_pipeline() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_pipeline(_sg_pipeline_t* pip) { if (pip == _sg.gl.cache.cur_pipeline) { _sg.gl.cache.cur_pipeline = 0; @@ -7021,12 +7004,12 @@ _SOKOL_PRIVATE void _sg_gl_discard_backend(void) { _SOKOL_PRIVATE void _sg_gl_activate_context(_sg_context_t* ctx) { SOKOL_ASSERT(_sg.gl.valid); - /* NOTE: ctx can be 0 to unset the current context */ + // NOTE: ctx can be 0 to unset the current context _sg.gl.cur_context = ctx; _sg_gl_reset_state_cache(); } -/*-- GL backend resource creation and destruction ----------------------------*/ +//-- GL backend resource creation and destruction ------------------------------ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_context(_sg_context_t* ctx) { SOKOL_ASSERT(ctx); SOKOL_ASSERT(0 == ctx->default_framebuffer); @@ -7445,7 +7428,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg pip->gl.sample_count = desc->sample_count; pip->gl.alpha_to_coverage_enabled = desc->alpha_to_coverage_enabled; - /* resolve vertex attributes */ + // resolve vertex attributes for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { pip->gl.attrs[attr_index].vb_index = -1; } @@ -7858,7 +7841,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _sg.gl.cache.cur_primitive_type = _sg_gl_primitive_type(pip->gl.primitive_type); _sg.gl.cache.cur_index_type = _sg_gl_index_type(pip->cmn.index_type); - /* update depth state */ + // update depth state { const sg_depth_state* state_ds = &pip->gl.depth; sg_depth_state* cache_ds = &_sg.gl.cache.depth; @@ -7898,7 +7881,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } } - /* update stencil state */ + // update stencil state { const sg_stencil_state* state_ss = &pip->gl.stencil; sg_stencil_state* cache_ss = &_sg.gl.cache.stencil; @@ -7945,9 +7928,8 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { cache_ss->ref = state_ss->ref; } - /* update blend state - FIXME: separate blend state per color attachment not support, needs GL4 - */ + // update blend state + // FIXME: separate blend state per color attachment not support, needs GL4 { const sg_blend_state* state_bs = &pip->gl.blend; sg_blend_state* cache_bs = &_sg.gl.cache.blend; @@ -7980,7 +7962,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } } - /* standalone state */ + // standalone state for (GLuint i = 0; i < (GLuint)pip->cmn.color_count; i++) { if (pip->gl.color_write_mask[i] != _sg.gl.cache.color_write_mask[i]) { const sg_color_mask cm = pip->gl.color_write_mask[i]; @@ -8045,7 +8027,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } #endif - /* bind shader program */ + // bind shader program if (pip->shader->gl.prog != _sg.gl.cache.prog) { _sg.gl.cache.prog = pip->shader->gl.prog; glUseProgram(pip->shader->gl.prog); @@ -8208,7 +8190,7 @@ _SOKOL_PRIVATE void _sg_gl_draw(int base_element, int num_elements, int num_inst const GLenum i_type = _sg.gl.cache.cur_index_type; const GLenum p_type = _sg.gl.cache.cur_primitive_type; if (0 != i_type) { - /* indexed rendering */ + // indexed rendering const int i_size = (i_type == GL_UNSIGNED_SHORT) ? 2 : 4; const int ib_offset = _sg.gl.cache.cur_ib_offset; const GLvoid* indices = (const GLvoid*)(GLintptr)(base_element*i_size+ib_offset); @@ -8218,7 +8200,7 @@ _SOKOL_PRIVATE void _sg_gl_draw(int base_element, int num_elements, int num_inst glDrawElements(p_type, num_elements, i_type, indices); } } else { - /* non-indexed rendering */ + // non-indexed rendering if (_sg.gl.cache.cur_pipeline->cmn.use_instanced_draw) { glDrawArraysInstanced(p_type, base_element, num_elements, num_instances); } else { @@ -8229,14 +8211,14 @@ _SOKOL_PRIVATE void _sg_gl_draw(int base_element, int num_elements, int num_inst _SOKOL_PRIVATE void _sg_gl_commit(void) { SOKOL_ASSERT(!_sg.gl.in_pass); - /* "soft" clear bindings (only those that are actually bound) */ + // "soft" clear bindings (only those that are actually bound) _sg_gl_cache_clear_buffer_bindings(false); _sg_gl_cache_clear_texture_sampler_bindings(false); } _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - /* only one update per buffer per frame allowed */ + // only one update per buffer per frame allowed if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; } @@ -8269,7 +8251,7 @@ _SOKOL_PRIVATE int _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, glBufferSubData(gl_tgt, buf->cmn.append_pos, (GLsizeiptr)data->size, data->ptr); _sg_gl_cache_restore_buffer_binding(gl_tgt); _SG_GL_CHECK_ERROR(); - /* NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend */ + // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend return _sg_roundup((int)data->size, 4); } @@ -8346,7 +8328,7 @@ _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* d #define _sg_d3d11_Release(self) (self)->lpVtbl->Release(self) #endif -/*-- D3D11 C/C++ wrappers ----------------------------------------------------*/ +//-- D3D11 C/C++ wrappers ------------------------------------------------------ static inline HRESULT _sg_d3d11_CheckFormatSupport(ID3D11Device* self, DXGI_FORMAT Format, UINT* pFormatSupport) { #if defined(__cplusplus) return self->CheckFormatSupport(Format, pFormatSupport); @@ -8715,7 +8697,7 @@ static inline void _sg_d3d11_ClearState(ID3D11DeviceContext* self) { #endif } -/*-- enum translation functions ----------------------------------------------*/ +//-- enum translation functions ------------------------------------------------ _SOKOL_PRIVATE D3D11_USAGE _sg_d3d11_usage(sg_usage usg) { switch (usg) { case SG_USAGE_IMMUTABLE: @@ -8985,7 +8967,7 @@ _SOKOL_PRIVATE UINT8 _sg_d3d11_color_write_mask(sg_color_mask m) { return res; } -/* see: https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-resources-limits#resource-limits-for-feature-level-11-hardware */ +// see: https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-resources-limits#resource-limits-for-feature-level-11-hardware _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { _sg.backend = SG_BACKEND_D3D11; @@ -9001,7 +8983,7 @@ _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { _sg.limits.max_image_array_layers = 2 * 1024; _sg.limits.max_vertex_attrs = SG_MAX_VERTEX_ATTRIBUTES; - /* see: https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_format_support */ + // see: https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_format_support for (int fmt = (SG_PIXELFORMAT_NONE+1); fmt < _SG_PIXELFORMAT_NUM; fmt++) { UINT dxgi_fmt_caps = 0; const DXGI_FORMAT dxgi_fmt = _sg_d3d11_pixel_format((sg_pixel_format)fmt); @@ -9026,7 +9008,7 @@ _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { } _SOKOL_PRIVATE void _sg_d3d11_setup_backend(const sg_desc* desc) { - /* assume _sg.d3d11 already is zero-initialized */ + // assume _sg.d3d11 already is zero-initialized SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.d3d11.device); SOKOL_ASSERT(desc->context.d3d11.device_context); @@ -9049,12 +9031,12 @@ _SOKOL_PRIVATE void _sg_d3d11_discard_backend(void) { } _SOKOL_PRIVATE void _sg_d3d11_clear_state(void) { - /* clear all the device context state, so that resource refs don't keep stuck in the d3d device context */ + // clear all the device context state, so that resource refs don't keep stuck in the d3d device context _sg_d3d11_ClearState(_sg.d3d11.ctx); } _SOKOL_PRIVATE void _sg_d3d11_reset_state_cache(void) { - /* just clear the d3d11 device context state */ + // just clear the d3d11 device context state _sg_d3d11_clear_state(); } @@ -9072,7 +9054,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_context(_sg_context_t* ctx) { _SOKOL_PRIVATE void _sg_d3d11_discard_context(_sg_context_t* ctx) { SOKOL_ASSERT(ctx); _SOKOL_UNUSED(ctx); - /* empty */ + // empty } _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { @@ -9132,7 +9114,7 @@ _SOKOL_PRIVATE void _sg_d3d11_fill_subres_data(const _sg_image_t* img, const sg_ subres_data->pSysMem = ptr + slice_offset; subres_data->SysMemPitch = (UINT)_sg_row_pitch(img->cmn.pixel_format, mip_width, 1); if (img->cmn.type == SG_IMAGETYPE_3D) { - /* FIXME? const int mip_depth = ((img->depth>>mip_index)>0) ? img->depth>>mip_index : 1; */ + // FIXME? const int mip_depth = ((img->depth>>mip_index)>0) ? img->depth>>mip_index : 1; subres_data->SysMemSlicePitch = (UINT)_sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, 1); } else { subres_data->SysMemSlicePitch = 0; @@ -9385,33 +9367,21 @@ _SOKOL_PRIVATE void _sg_d3d11_discard_sampler(_sg_sampler_t* smp) { } _SOKOL_PRIVATE bool _sg_d3d11_load_d3dcompiler_dll(void) { - /* on UWP, don't do anything (not tested) */ - #if (defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) - return true; - #else - /* load DLL on demand */ - if ((0 == _sg.d3d11.d3dcompiler_dll) && !_sg.d3d11.d3dcompiler_dll_load_failed) { - _sg.d3d11.d3dcompiler_dll = LoadLibraryA("d3dcompiler_47.dll"); - if (0 == _sg.d3d11.d3dcompiler_dll) { - /* don't attempt to load missing DLL in the future */ - _SG_ERROR(D3D11_LOAD_D3DCOMPILER_47_DLL_FAILED); - _sg.d3d11.d3dcompiler_dll_load_failed = true; - return false; - } - /* look up function pointers */ - _sg.d3d11.D3DCompile_func = (pD3DCompile)(void*) GetProcAddress(_sg.d3d11.d3dcompiler_dll, "D3DCompile"); - SOKOL_ASSERT(_sg.d3d11.D3DCompile_func); + if ((0 == _sg.d3d11.d3dcompiler_dll) && !_sg.d3d11.d3dcompiler_dll_load_failed) { + _sg.d3d11.d3dcompiler_dll = LoadLibraryA("d3dcompiler_47.dll"); + if (0 == _sg.d3d11.d3dcompiler_dll) { + // don't attempt to load missing DLL in the future + _SG_ERROR(D3D11_LOAD_D3DCOMPILER_47_DLL_FAILED); + _sg.d3d11.d3dcompiler_dll_load_failed = true; + return false; } - return 0 != _sg.d3d11.d3dcompiler_dll; - #endif + // look up function pointers + _sg.d3d11.D3DCompile_func = (pD3DCompile)(void*) GetProcAddress(_sg.d3d11.d3dcompiler_dll, "D3DCompile"); + SOKOL_ASSERT(_sg.d3d11.D3DCompile_func); + } + return 0 != _sg.d3d11.d3dcompiler_dll; } -#if (defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) -#define _sg_d3d11_D3DCompile D3DCompile -#else -#define _sg_d3d11_D3DCompile _sg.d3d11.D3DCompile_func -#endif - _SOKOL_PRIVATE ID3DBlob* _sg_d3d11_compile_shader(const sg_shader_stage_desc* stage_desc) { if (!_sg_d3d11_load_d3dcompiler_dll()) { return NULL; @@ -9419,18 +9389,18 @@ _SOKOL_PRIVATE ID3DBlob* _sg_d3d11_compile_shader(const sg_shader_stage_desc* st SOKOL_ASSERT(stage_desc->d3d11_target); ID3DBlob* output = NULL; ID3DBlob* errors_or_warnings = NULL; - HRESULT hr = _sg_d3d11_D3DCompile( - stage_desc->source, /* pSrcData */ - strlen(stage_desc->source), /* SrcDataSize */ - NULL, /* pSourceName */ - NULL, /* pDefines */ - NULL, /* pInclude */ - stage_desc->entry ? stage_desc->entry : "main", /* pEntryPoint */ - stage_desc->d3d11_target, /* pTarget (vs_5_0 or ps_5_0) */ - D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR | D3DCOMPILE_OPTIMIZATION_LEVEL3, /* Flags1 */ - 0, /* Flags2 */ - &output, /* ppCode */ - &errors_or_warnings); /* ppErrorMsgs */ + HRESULT hr = _sg.d3d11.D3DCompile_func( + stage_desc->source, // pSrcData + strlen(stage_desc->source), // SrcDataSize + NULL, // pSourceName + NULL, // pDefines + NULL, // pInclude + stage_desc->entry ? stage_desc->entry : "main", // pEntryPoint + stage_desc->d3d11_target, // pTarget + D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR | D3DCOMPILE_OPTIMIZATION_LEVEL3, // Flags1 + 0, // Flags2 + &output, // ppCode + &errors_or_warnings); // ppErrorMsgs if (FAILED(hr)) { _SG_ERROR(D3D11_SHADER_COMPILATION_FAILED); } @@ -9440,7 +9410,7 @@ _SOKOL_PRIVATE ID3DBlob* _sg_d3d11_compile_shader(const sg_shader_stage_desc* st _sg_d3d11_Release(errors_or_warnings); errors_or_warnings = NULL; } if (FAILED(hr)) { - /* just in case, usually output is NULL here */ + // just in case, usually output is NULL here if (output) { _sg_d3d11_Release(output); output = NULL; @@ -9456,20 +9426,20 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_shader(_sg_shader_t* shd, cons _sg_shader_common_init(&shd->cmn, desc); - /* copy vertex attribute semantic names and indices */ + // copy vertex attribute semantic names and indices for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { _sg_strcpy(&shd->d3d11.attrs[i].sem_name, desc->attrs[i].sem_name); shd->d3d11.attrs[i].sem_index = desc->attrs[i].sem_index; } - /* shader stage uniform blocks and image slots */ + // shader stage uniform blocks and image slots for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { _sg_shader_stage_t* cmn_stage = &shd->cmn.stage[stage_index]; _sg_d3d11_shader_stage_t* d3d11_stage = &shd->d3d11.stage[stage_index]; for (int ub_index = 0; ub_index < cmn_stage->num_uniform_blocks; ub_index++) { const _sg_shader_uniform_block_t* ub = &cmn_stage->uniform_blocks[ub_index]; - /* create a D3D constant buffer for each uniform block */ + // create a D3D constant buffer for each uniform block SOKOL_ASSERT(0 == d3d11_stage->cbufs[ub_index]); D3D11_BUFFER_DESC cb_desc; _sg_clear(&cb_desc, sizeof(cb_desc)); @@ -9488,13 +9458,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_shader(_sg_shader_t* shd, cons SIZE_T vs_length = 0, fs_length = 0; ID3DBlob* vs_blob = 0, *fs_blob = 0; if (desc->vs.bytecode.ptr && desc->fs.bytecode.ptr) { - /* create from shader byte code */ + // create from shader byte code vs_ptr = desc->vs.bytecode.ptr; fs_ptr = desc->fs.bytecode.ptr; vs_length = desc->vs.bytecode.size; fs_length = desc->fs.bytecode.size; } else { - /* compile from shader source code */ + // compile from shader source code vs_blob = _sg_d3d11_compile_shader(&desc->vs); fs_blob = _sg_d3d11_compile_shader(&desc->fs); if (vs_blob && fs_blob) { @@ -9506,13 +9476,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_shader(_sg_shader_t* shd, cons } sg_resource_state result = SG_RESOURCESTATE_FAILED; if (vs_ptr && fs_ptr && (vs_length > 0) && (fs_length > 0)) { - /* create the D3D vertex- and pixel-shader objects */ + // create the D3D vertex- and pixel-shader objects hr = _sg_d3d11_CreateVertexShader(_sg.d3d11.dev, vs_ptr, vs_length, NULL, &shd->d3d11.vs); bool vs_succeeded = SUCCEEDED(hr) && shd->d3d11.vs; hr = _sg_d3d11_CreatePixelShader(_sg.d3d11.dev, fs_ptr, fs_length, NULL, &shd->d3d11.fs); bool fs_succeeded = SUCCEEDED(hr) && shd->d3d11.fs; - /* need to store the vertex shader byte code, this is needed later in sg_create_pipeline */ + // need to store the vertex shader byte code, this is needed later in sg_create_pipeline if (vs_succeeded && fs_succeeded) { shd->d3d11.vs_blob_length = vs_length; shd->d3d11.vs_blob = _sg_malloc((size_t)vs_length); @@ -9929,7 +9899,7 @@ _SOKOL_PRIVATE void _sg_d3d11_begin_pass(_sg_pass_t* pass, const sg_pass_action* } } -/* D3D11CalcSubresource only exists for C++ */ +// D3D11CalcSubresource only exists for C++ _SOKOL_PRIVATE UINT _sg_d3d11_calcsubresource(UINT mip_slice, UINT array_slice, UINT mip_levels) { return mip_slice + array_slice * mip_levels; } @@ -10137,7 +10107,7 @@ _SOKOL_PRIVATE int _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* da } else { _SG_ERROR(D3D11_MAP_FOR_APPEND_BUFFER_FAILED); } - /* NOTE: this alignment is a requirement from WebGPU, but we want identical behaviour across all backend */ + // NOTE: this alignment is a requirement from WebGPU, but we want identical behaviour across all backend return _sg_roundup((int)data->size, 4); } @@ -10163,7 +10133,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data const uint8_t* slice_ptr = ((const uint8_t*)subimg_data->ptr) + slice_offset; hr = _sg_d3d11_Map(_sg.d3d11.ctx, img->d3d11.res, subres_index, D3D11_MAP_WRITE_DISCARD, 0, &d3d11_msr); if (SUCCEEDED(hr)) { - /* FIXME: need to handle difference in depth-pitch for 3D textures as well! */ + // FIXME: need to handle difference in depth-pitch for 3D textures as well! if (src_pitch == (int)d3d11_msr.RowPitch) { memcpy(d3d11_msr.pData, slice_ptr, slice_size); } else { @@ -10202,7 +10172,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data #define _SG_OBJC_RELEASE(obj) { [obj release]; obj = nil; } #endif -/*-- enum translation functions ----------------------------------------------*/ +//-- enum translation functions ------------------------------------------------ _SOKOL_PRIVATE MTLLoadAction _sg_mtl_load_action(sg_load_action a) { switch (a) { case SG_LOADACTION_CLEAR: return MTLLoadActionClear; @@ -10504,7 +10474,7 @@ _SOKOL_PRIVATE MTLSamplerAddressMode _sg_mtl_address_mode(sg_wrap w) { #if defined(_SG_TARGET_MACOS) case SG_WRAP_CLAMP_TO_BORDER: return MTLSamplerAddressModeClampToBorderColor; #else - /* clamp-to-border not supported on iOS, fall back to clamp-to-edge */ + // clamp-to-border not supported on iOS, fall back to clamp-to-edge case SG_WRAP_CLAMP_TO_BORDER: return MTLSamplerAddressModeClampToEdge; #endif case SG_WRAP_MIRRORED_REPEAT: return MTLSamplerAddressModeMirrorRepeat; @@ -10547,8 +10517,7 @@ _SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mipmap_filter(sg_filter f) { } } -/*-- a pool for all Metal resource objects, with deferred release queue -------*/ - +//-- a pool for all Metal resource objects, with deferred release queue --------- _SOKOL_PRIVATE void _sg_mtl_init_pool(const sg_desc* desc) { _sg.mtl.idpool.num_slots = 2 * ( @@ -10566,17 +10535,14 @@ _SOKOL_PRIVATE void _sg_mtl_init_pool(const sg_desc* desc) { [_sg.mtl.idpool.pool addObject:null]; } SOKOL_ASSERT([_sg.mtl.idpool.pool count] == (NSUInteger)_sg.mtl.idpool.num_slots); - /* a queue of currently free slot indices */ + // a queue of currently free slot indices _sg.mtl.idpool.free_queue_top = 0; _sg.mtl.idpool.free_queue = (int*)_sg_malloc_clear((size_t)_sg.mtl.idpool.num_slots * sizeof(int)); - /* pool slot 0 is reserved! */ + // pool slot 0 is reserved! for (int i = _sg.mtl.idpool.num_slots-1; i >= 1; i--) { _sg.mtl.idpool.free_queue[_sg.mtl.idpool.free_queue_top++] = i; } - /* a circular queue which holds release items (frame index - when a resource is to be released, and the resource's - pool index - */ + // a circular queue which holds release items (frame index when a resource is to be released, and the resource's pool index _sg.mtl.idpool.release_queue_front = 0; _sg.mtl.idpool.release_queue_back = 0; _sg.mtl.idpool.release_queue = (_sg_mtl_release_item_t*)_sg_malloc_clear((size_t)_sg.mtl.idpool.num_slots * sizeof(_sg_mtl_release_item_t)); @@ -10592,7 +10558,7 @@ _SOKOL_PRIVATE void _sg_mtl_destroy_pool(void) { _SG_OBJC_RELEASE(_sg.mtl.idpool.pool); } -/* get a new free resource pool slot */ +// get a new free resource pool slot _SOKOL_PRIVATE int _sg_mtl_alloc_pool_slot(void) { SOKOL_ASSERT(_sg.mtl.idpool.free_queue_top > 0); const int slot_index = _sg.mtl.idpool.free_queue[--_sg.mtl.idpool.free_queue_top]; @@ -10600,14 +10566,14 @@ _SOKOL_PRIVATE int _sg_mtl_alloc_pool_slot(void) { return slot_index; } -/* put a free resource pool slot back into the free-queue */ +// put a free resource pool slot back into the free-queue _SOKOL_PRIVATE void _sg_mtl_free_pool_slot(int slot_index) { SOKOL_ASSERT(_sg.mtl.idpool.free_queue_top < _sg.mtl.idpool.num_slots); SOKOL_ASSERT((slot_index > 0) && (slot_index < _sg.mtl.idpool.num_slots)); _sg.mtl.idpool.free_queue[_sg.mtl.idpool.free_queue_top++] = slot_index; } -/* add an MTLResource to the pool, return pool index or 0 if input was 'nil' */ +// add an MTLResource to the pool, return pool index or 0 if input was 'nil' _SOKOL_PRIVATE int _sg_mtl_add_resource(id res) { if (nil == res) { return _SG_MTL_INVALID_SLOT_INDEX; @@ -10632,10 +10598,10 @@ _SOKOL_PRIVATE void _sg_mtl_release_resource(uint32_t frame_index, int slot_inde SOKOL_ASSERT([NSNull null] != _sg.mtl.idpool.pool[(NSUInteger)slot_index]); int release_index = _sg.mtl.idpool.release_queue_front++; if (_sg.mtl.idpool.release_queue_front >= _sg.mtl.idpool.num_slots) { - /* wrap-around */ + // wrap-around _sg.mtl.idpool.release_queue_front = 0; } - /* release queue full? */ + // release queue full? SOKOL_ASSERT(_sg.mtl.idpool.release_queue_front != _sg.mtl.idpool.release_queue_back); SOKOL_ASSERT(0 == _sg.mtl.idpool.release_queue[release_index].frame_index); const uint32_t safe_to_release_frame_index = frame_index + SG_NUM_INFLIGHT_FRAMES + 1; @@ -10643,29 +10609,28 @@ _SOKOL_PRIVATE void _sg_mtl_release_resource(uint32_t frame_index, int slot_inde _sg.mtl.idpool.release_queue[release_index].slot_index = slot_index; } -/* run garbage-collection pass on all resources in the release-queue */ +// run garbage-collection pass on all resources in the release-queue _SOKOL_PRIVATE void _sg_mtl_garbage_collect(uint32_t frame_index) { while (_sg.mtl.idpool.release_queue_back != _sg.mtl.idpool.release_queue_front) { if (frame_index < _sg.mtl.idpool.release_queue[_sg.mtl.idpool.release_queue_back].frame_index) { - /* don't need to check further, release-items past this are too young */ + // don't need to check further, release-items past this are too young break; } - /* safe to release this resource */ + // safe to release this resource const int slot_index = _sg.mtl.idpool.release_queue[_sg.mtl.idpool.release_queue_back].slot_index; SOKOL_ASSERT((slot_index > 0) && (slot_index < _sg.mtl.idpool.num_slots)); - /* note: the NSMutableArray takes ownership of its items, assigning an NSNull object will - release the object, no matter if using ARC or not - */ + // note: the NSMutableArray takes ownership of its items, assigning an NSNull object will + // release the object, no matter if using ARC or not SOKOL_ASSERT(_sg.mtl.idpool.pool[(NSUInteger)slot_index] != [NSNull null]); _sg.mtl.idpool.pool[(NSUInteger)slot_index] = [NSNull null]; - /* put the now free pool index back on the free queue */ + // put the now free pool index back on the free queue _sg_mtl_free_pool_slot(slot_index); - /* reset the release queue slot and advance the back index */ + // reset the release queue slot and advance the back index _sg.mtl.idpool.release_queue[_sg.mtl.idpool.release_queue_back].frame_index = 0; _sg.mtl.idpool.release_queue[_sg.mtl.idpool.release_queue_back].slot_index = _SG_MTL_INVALID_SLOT_INDEX; _sg.mtl.idpool.release_queue_back++; if (_sg.mtl.idpool.release_queue_back >= _sg.mtl.idpool.num_slots) { - /* wrap-around */ + // wrap-around _sg.mtl.idpool.release_queue_back = 0; } } @@ -10679,7 +10644,7 @@ _SOKOL_PRIVATE void _sg_mtl_clear_state_cache(void) { _sg_clear(&_sg.mtl.state_cache, sizeof(_sg.mtl.state_cache)); } -/* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ +// https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { #if defined(_SG_TARGET_MACOS) _sg.backend = SG_BACKEND_METAL_MACOS; @@ -10817,9 +10782,9 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { #endif } -/*-- main Metal backend state and functions ----------------------------------*/ +//-- main Metal backend state and functions ------------------------------------ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { - /* assume already zero-initialized */ + // assume already zero-initialized SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.metal.device); SOKOL_ASSERT(desc->context.metal.renderpass_descriptor_cb || desc->context.metal.renderpass_descriptor_userdata_cb); @@ -10859,11 +10824,11 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { _SOKOL_PRIVATE void _sg_mtl_discard_backend(void) { SOKOL_ASSERT(_sg.mtl.valid); - /* wait for the last frame to finish */ + // wait for the last frame to finish for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { dispatch_semaphore_wait(_sg.mtl.sem, DISPATCH_TIME_FOREVER); } - /* semaphore must be "relinquished" before destruction */ + // semaphore must be "relinquished" before destruction for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { dispatch_semaphore_signal(_sg.mtl.sem); } @@ -10877,7 +10842,7 @@ _SOKOL_PRIVATE void _sg_mtl_discard_backend(void) { for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { _SG_OBJC_RELEASE(_sg.mtl.uniform_buffers[i]); } - /* NOTE: MTLCommandBuffer and MTLRenderCommandEncoder are auto-released */ + // NOTE: MTLCommandBuffer and MTLRenderCommandEncoder are auto-released _sg.mtl.cmd_buffer = nil; _sg.mtl.present_cmd_buffer = nil; _sg.mtl.cmd_encoder = nil; @@ -10914,7 +10879,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_context(_sg_context_t* ctx) { _SOKOL_PRIVATE void _sg_mtl_discard_context(_sg_context_t* ctx) { SOKOL_ASSERT(ctx); _SOKOL_UNUSED(ctx); - /* empty */ + // empty } _SOKOL_PRIVATE void _sg_mtl_activate_context(_sg_context_t* ctx) { @@ -10949,7 +10914,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_buffer(_sg_buffer_t* buf, const _SOKOL_PRIVATE void _sg_mtl_discard_buffer(_sg_buffer_t* buf) { SOKOL_ASSERT(buf); for (int slot = 0; slot < buf->cmn.num_slots; slot++) { - /* it's valid to call release resource with '0' */ + // it's valid to call release resource with '0' _sg_mtl_release_resource(_sg.mtl.frame_index, buf->mtl.buf[slot]); } } @@ -10964,7 +10929,7 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr const uint8_t* data_ptr = (const uint8_t*)data->subimage[face_index][mip_index].ptr; const int mip_width = _sg_max(img->cmn.width >> mip_index, 1); const int mip_height = _sg_max(img->cmn.height >> mip_index, 1); - /* special case PVRTC formats: bytePerRow and bytesPerImage must be 0 */ + // special case PVRTC formats: bytePerRow and bytesPerImage must be 0 int bytes_per_row = 0; int bytes_per_slice = 0; if (!_sg_mtl_is_pvrtc(img->cmn.pixel_format)) { @@ -10981,8 +10946,7 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr const int mip_depth = _sg_max(img->cmn.num_slices >> mip_index, 1); region = MTLRegionMake3D(0, 0, 0, (NSUInteger)mip_width, (NSUInteger)mip_height, (NSUInteger)mip_depth); bytes_per_image = bytes_per_slice; - /* FIXME: apparently the minimal bytes_per_image size for 3D texture - is 4 KByte... somehow need to handle this */ + // FIXME: apparently the minimal bytes_per_image size for 3D texture is 4 KByte... somehow need to handle this } else { region = MTLRegionMake2D(0, 0, (NSUInteger)mip_width, (NSUInteger)mip_height); bytes_per_image = 0; @@ -11234,7 +11198,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const _SOKOL_PRIVATE void _sg_mtl_discard_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd); - /* it is valid to call _sg_mtl_release_resource with a 'null resource' */ + // it is valid to call _sg_mtl_release_resource with a 'null resource' _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func); _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib); _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func); @@ -11366,7 +11330,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s _SOKOL_PRIVATE void _sg_mtl_discard_pipeline(_sg_pipeline_t* pip) { SOKOL_ASSERT(pip); - /* it's valid to call release resource with a 'null resource' */ + // it's valid to call release resource with a 'null resource' _sg_mtl_release_resource(_sg.mtl.frame_index, pip->mtl.rps); _sg_mtl_release_resource(_sg.mtl.frame_index, pip->mtl.dss); } @@ -11615,7 +11579,7 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { SOKOL_ASSERT(nil != _sg.mtl.cmd_buffer); SOKOL_ASSERT(nil != _sg.mtl.present_cmd_buffer); - /* present, commit and signal semaphore when done */ + // present, commit and signal semaphore when done id cur_drawable = nil; if (_sg.mtl.drawable_cb) { cur_drawable = (__bridge id) _sg.mtl.drawable_cb(); @@ -11628,17 +11592,17 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { [_sg.mtl.cmd_buffer commit]; [_sg.mtl.present_cmd_buffer commit]; - /* garbage-collect resources pending for release */ + // garbage-collect resources pending for release _sg_mtl_garbage_collect(_sg.mtl.frame_index); - /* rotate uniform buffer slot */ + // rotate uniform buffer slot if (++_sg.mtl.cur_frame_rotate_index >= SG_NUM_INFLIGHT_FRAMES) { _sg.mtl.cur_frame_rotate_index = 0; } _sg.mtl.frame_index++; _sg.mtl.cur_ub_offset = 0; _sg.mtl.cur_ub_base_ptr = 0; - /* NOTE: MTLCommandBuffer is autoreleased */ + // NOTE: MTLCommandBuffer is autoreleased _sg.mtl.cmd_buffer = nil; _sg.mtl.present_cmd_buffer = nil; } @@ -11665,7 +11629,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_scissor_rect(int x, int y, int w, int h, bool return; } SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); - /* clip against framebuffer rect */ + // clip against framebuffer rect x = _sg_min(_sg_max(0, x), _sg.mtl.cur_width-1); y = _sg_min(_sg_max(0, y), _sg.mtl.cur_height-1); if ((x + w) > _sg.mtl.cur_width) { @@ -11813,7 +11777,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_i SOKOL_ASSERT(ub_index < _sg.mtl.state_cache.cur_pipeline->shader->cmn.stage[stage_index].num_uniform_blocks); SOKOL_ASSERT(data->size == _sg.mtl.state_cache.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); - /* copy to global uniform buffer, record offset into cmd encoder, and advance offset */ + // copy to global uniform buffer, record offset into cmd encoder, and advance offset uint8_t* dst = &_sg.mtl.cur_ub_base_ptr[_sg.mtl.cur_ub_offset]; memcpy(dst, data->ptr, data->size); if (stage_index == SG_SHADERSTAGE_VS) { @@ -11832,7 +11796,7 @@ _SOKOL_PRIVATE void _sg_mtl_draw(int base_element, int num_elements, int num_ins SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); SOKOL_ASSERT(_sg.mtl.state_cache.cur_pipeline && (_sg.mtl.state_cache.cur_pipeline->slot.id == _sg.mtl.state_cache.cur_pipeline_id.id)); if (SG_INDEXTYPE_NONE != _sg.mtl.state_cache.cur_pipeline->cmn.index_type) { - /* indexed rendering */ + // indexed rendering SOKOL_ASSERT(_sg.mtl.state_cache.cur_indexbuffer && (_sg.mtl.state_cache.cur_indexbuffer->slot.id == _sg.mtl.state_cache.cur_indexbuffer_id.id)); const _sg_buffer_t* ib = _sg.mtl.state_cache.cur_indexbuffer; SOKOL_ASSERT(ib->mtl.buf[ib->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); @@ -11844,7 +11808,7 @@ _SOKOL_PRIVATE void _sg_mtl_draw(int base_element, int num_elements, int num_ins indexBufferOffset:index_buffer_offset instanceCount:(NSUInteger)num_instances]; } else { - /* non-indexed rendering */ + // non-indexed rendering [_sg.mtl.cmd_encoder drawPrimitives:_sg.mtl.state_cache.cur_pipeline->mtl.prim_type vertexStart:(NSUInteger)base_element vertexCount:(NSUInteger)num_elements @@ -11879,7 +11843,7 @@ _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; } - /* NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backends */ + // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backends return _sg_roundup((int)data->size, 4); } @@ -12003,7 +11967,7 @@ _SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_mipfilter(sg_filter f) { } _SOKOL_PRIVATE WGPUIndexFormat _sg_wgpu_indexformat(sg_index_type t) { - /* NOTE: there's no WGPUIndexFormat_None */ + // NOTE: there's no WGPUIndexFormat_None return (t == SG_INDEXTYPE_UINT16) ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32; } @@ -12029,7 +11993,7 @@ _SOKOL_PRIVATE WGPUVertexFormat _sg_wgpu_vertexformat(sg_vertex_format f) { case SG_VERTEXFORMAT_USHORT4N: return WGPUVertexFormat_UShort4Norm; case SG_VERTEXFORMAT_HALF2: return WGPUVertexFormat_Half2; case SG_VERTEXFORMAT_HALF3: return WGPUVertexFormat_Half4; - /* FIXME! UINT10_N2 */ + // FIXME! UINT10_N2 case SG_VERTEXFORMAT_UINT10_N2: default: SOKOL_UNREACHABLE; @@ -12110,7 +12074,7 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_BC6H_RGBUF: return WGPUTextureFormat_BC6HRGBUfloat; case SG_PIXELFORMAT_BC7_RGBA: return WGPUTextureFormat_BC7RGBAUnorm; - /* NOT SUPPORTED */ + // NOT SUPPORTED case SG_PIXELFORMAT_R16: case SG_PIXELFORMAT_R16SN: case SG_PIXELFORMAT_RG16: @@ -12198,7 +12162,7 @@ _SOKOL_PRIVATE WGPUBlendFactor _sg_wgpu_blendfactor(sg_blend_factor f) { case SG_BLENDFACTOR_SRC_ALPHA_SATURATED: return WGPUBlendFactor_SrcAlphaSaturated; case SG_BLENDFACTOR_BLEND_COLOR: return WGPUBlendFactor_BlendColor; case SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR: return WGPUBlendFactor_OneMinusBlendColor; - /* FIXME: separate blend alpha value not supported? */ + // FIXME: separate blend alpha value not supported? case SG_BLENDFACTOR_BLEND_ALPHA: return WGPUBlendFactor_BlendColor; case SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA: return WGPUBlendFactor_OneMinusBlendColor; default: @@ -12230,7 +12194,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; - /* FIXME: max images size??? */ + // FIXME: max images size??? _sg.limits.max_image_size_2d = 8 * 1024; _sg.limits.max_image_size_cube = 8 * 1024; _sg.limits.max_image_size_3d = 2 * 1024; @@ -12261,7 +12225,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA8SI]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_BGRA8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGB10A2]); - /* FIXME: missing SG_PIXELFORMAT_RG11B10F */ + // FIXME: missing SG_PIXELFORMAT_RG11B10F _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32UI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32SI]); _sg_pixelformat_sbr(&_sg.formats[SG_PIXELFORMAT_RG32F]); @@ -12385,7 +12349,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus sta if (!_sg.wgpu.valid) { return; } - /* FIXME: better handling for this */ + // FIXME: better handling for this if (WGPUBufferMapAsyncStatus_Success != status) { _SG_ERROR(WGPU_MAP_UNIFORM_BUFFER_FAILED); SOKOL_ASSERT(false); @@ -12399,17 +12363,17 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus sta _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { - /* immediately request a new mapping for the last frame's current staging buffer */ + // immediately request a new mapping for the last frame's current staging buffer if (!first_frame) { WGPUBuffer ub_src = _sg.wgpu.ub.stage.buf[_sg.wgpu.ub.stage.cur]; wgpuBufferMapWriteAsync(ub_src, _sg_wgpu_ubpool_mapped_callback, (void*)(intptr_t)_sg.wgpu.ub.stage.cur); } - /* rewind per-frame offsets */ + // rewind per-frame offsets _sg.wgpu.ub.offset = 0; _sg_clear(&_sg.wgpu.ub.bind_offsets, sizeof(_sg.wgpu.ub.bind_offsets)); - /* check if a mapped staging buffer is available, otherwise create one */ + // check if a mapped staging buffer is available, otherwise create one for (int i = 0; i < _sg.wgpu.ub.stage.num; i++) { if (_sg.wgpu.ub.stage.ptr[i]) { _sg.wgpu.ub.stage.cur = i; @@ -12417,7 +12381,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { } } - /* no mapped uniform buffer available, create one */ + // no mapped uniform buffer available, create one SOKOL_ASSERT(_sg.wgpu.ub.stage.num < _SG_WGPU_STAGING_PIPELINE_SIZE); _sg.wgpu.ub.stage.cur = _sg.wgpu.ub.stage.num++; const int cur = _sg.wgpu.ub.stage.cur; @@ -12435,7 +12399,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { } _SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { - /* unmap staging buffer and copy to uniform buffer */ + // unmap staging buffer and copy to uniform buffer const int cur = _sg.wgpu.ub.stage.cur; SOKOL_ASSERT(_sg.wgpu.ub.stage.ptr[cur]); _sg.wgpu.ub.stage.ptr[cur] = 0; @@ -12447,7 +12411,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { } } -/* helper function to compute number of bytes needed in staging buffer to copy image data */ +// helper function to compute number of bytes needed in staging buffer to copy image data _SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) { uint32_t num_bytes = 0; const uint32_t num_faces = (img->cmn.type == SG_IMAGETYPE_CUBE) ? 6:1; @@ -12455,7 +12419,7 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++) { const uint32_t mip_width = _sg_max(img->cmn.width >> mip_index, 1); const uint32_t mip_height = _sg_max(img->cmn.height >> mip_index, 1); - /* row-pitch must be 256-aligend */ + // row-pitch must be 256-aligend const uint32_t bytes_per_slice = _sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, _SG_WGPU_ROWPITCH_ALIGN); num_bytes += bytes_per_slice * num_slices * num_faces; } @@ -12505,13 +12469,13 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st SOKOL_ASSERT(dst_bytes_per_slice == (dst_bytes_per_row * num_rows)); _SOKOL_UNUSED(src_bytes_per_slice); - /* copy data into mapped staging buffer */ + // copy data into mapped staging buffer if (src_bytes_per_row == dst_bytes_per_row) { - /* can do a single memcpy */ + // can do a single memcpy uint32_t num_bytes = data->subimage[face_index][mip_index].size; memcpy(dst_base_ptr, src_base_ptr, num_bytes); } else { - /* src/dst pitch doesn't match, need to copy row by row */ + // src/dst pitch doesn't match, need to copy row by row uint8_t* dst_ptr = dst_base_ptr; const uint8_t* src_ptr = src_base_ptr; for (uint32_t slice_index = 0; slice_index < num_slices; slice_index++) { @@ -12524,7 +12488,7 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st } } - /* record the staging copy operation into command encoder */ + // record the staging copy operation into command encoder src_view.imageHeight = mip_height; src_view.rowPitch = dst_bytes_per_row; dst_view.mipLevel = mip_index; @@ -12566,7 +12530,7 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st _SOKOL_PRIVATE void _sg_wgpu_staging_init(const sg_desc* desc) { SOKOL_ASSERT(desc && (desc->staging_buffer_size > 0)); _sg.wgpu.staging.num_bytes = desc->staging_buffer_size; - /* there's actually nothing more to do here */ + // there's actually nothing more to do here } _SOKOL_PRIVATE void _sg_wgpu_staging_discard(void) { @@ -12583,7 +12547,7 @@ _SOKOL_PRIVATE void _sg_wgpu_staging_mapped_callback(WGPUBufferMapAsyncStatus st if (!_sg.wgpu.valid) { return; } - /* FIXME: better handling for this */ + // FIXME: better handling for this if (WGPUBufferMapAsyncStatus_Success != status) { SOKOL_ASSERT("Mapping staging buffer failed!\n"); SOKOL_ASSERT(false); @@ -12597,16 +12561,16 @@ _SOKOL_PRIVATE void _sg_wgpu_staging_mapped_callback(WGPUBufferMapAsyncStatus st _SOKOL_PRIVATE void _sg_wgpu_staging_next_frame(bool first_frame) { - /* immediately request a new mapping for the last frame's current staging buffer */ + // immediately request a new mapping for the last frame's current staging buffer if (!first_frame) { WGPUBuffer cur_buf = _sg.wgpu.staging.buf[_sg.wgpu.staging.cur]; wgpuBufferMapWriteAsync(cur_buf, _sg_wgpu_staging_mapped_callback, (void*)(intptr_t)_sg.wgpu.staging.cur); } - /* rewind staging-buffer offset */ + // rewind staging-buffer offset _sg.wgpu.staging.offset = 0; - /* check if mapped staging buffer is available, otherwise create one */ + // check if mapped staging buffer is available, otherwise create one for (int i = 0; i < _sg.wgpu.staging.num; i++) { if (_sg.wgpu.staging.ptr[i]) { _sg.wgpu.staging.cur = i; @@ -12614,7 +12578,7 @@ _SOKOL_PRIVATE void _sg_wgpu_staging_next_frame(bool first_frame) { } } - /* no mapped buffer available, create one */ + // no mapped buffer available, create one SOKOL_ASSERT(_sg.wgpu.staging.num < _SG_WGPU_STAGING_PIPELINE_SIZE); _sg.wgpu.staging.cur = _sg.wgpu.staging.num++; const int cur = _sg.wgpu.staging.cur; @@ -12660,7 +12624,7 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_staging_copy_to_buffer(WGPUBuffer dst_buf, uint } _SOKOL_PRIVATE bool _sg_wgpu_staging_copy_to_texture(_sg_image_t* img, const sg_image_data* data) { - /* similar to _sg_wgpu_staging_copy_to_buffer(), but with image data instead */ + // similar to _sg_wgpu_staging_copy_to_buffer(), but with image data instead SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); uint32_t num_bytes = _sg_wgpu_image_data_buffer_size(img); if ((_sg.wgpu.staging.offset + num_bytes) >= _sg.wgpu.staging.num_bytes) { @@ -12680,7 +12644,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_staging_copy_to_texture(_sg_image_t* img, const sg_ } _SOKOL_PRIVATE void _sg_wgpu_staging_unmap(void) { - /* called at end of frame before queue-submit */ + // called at end of frame before queue-submit const int cur = _sg.wgpu.staging.cur; SOKOL_ASSERT(_sg.wgpu.staging.ptr[cur]); _sg.wgpu.staging.ptr[cur] = 0; @@ -12689,8 +12653,8 @@ _SOKOL_PRIVATE void _sg_wgpu_staging_unmap(void) { _SOKOL_PRIVATE WGPUSampler _sg_wgpu_create_sampler(const sg_image_desc* img_desc) { SOKOL_ASSERT(img_desc); - /* create a new WGPU sampler */ - /* FIXME: anisotropic filtering not supported? */ + // create a new WGPU sampler + // FIXME: anisotropic filtering not supported? WGPUSamplerDescriptor smp_desc; _sg_clear(&smp_desc, sizeof(smp_desc)); smp_desc.addressModeU = _sg_wgpu_sampler_addrmode(img_desc->wrap_u); @@ -12706,7 +12670,7 @@ _SOKOL_PRIVATE WGPUSampler _sg_wgpu_create_sampler(const sg_image_desc* img_desc return smp; } -/*--- WGPU backend API functions ---*/ +//--- WGPU backend API functions --- _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.wgpu.device); @@ -12728,16 +12692,16 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.queue = wgpuDeviceCreateQueue(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.queue); - /* setup WebGPU features and limits */ + // setup WebGPU features and limits _sg_wgpu_init_caps(); - /* setup the uniform and staging buffer pools */ + // setup the uniform and staging buffer pools _sg_wgpu_ubpool_init(desc); _sg_wgpu_ubpool_next_frame(true); _sg_wgpu_staging_init(desc); _sg_wgpu_staging_next_frame(true); - /* create an empty bind group for shader stages without bound images */ + // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; _sg_clear(&bgl_desc, sizeof(bgl_desc)); WGPUBindGroupLayout empty_bgl = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &bgl_desc); @@ -12749,7 +12713,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(_sg.wgpu.empty_bind_group); wgpuBindGroupLayoutRelease(empty_bgl); - /* create initial per-frame command encoders */ + // create initial per-frame command encoders WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); @@ -12888,7 +12852,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); SOKOL_ASSERT(img->wgpu.tex); - /* copy content into texture via a throw-away staging buffer */ + // copy content into texture via a throw-away staging buffer if (desc->usage == SG_USAGE_IMMUTABLE && !desc->render_target) { WGPUBufferDescriptor wgpu_buf_desc; _sg_clear(&wgpu_buf_desc, sizeof(wgpu_buf_desc)); @@ -12904,7 +12868,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s } } - /* create texture view object */ + // create texture view object WGPUTextureViewDescriptor wgpu_view_desc; _sg_clear(&wgpu_view_desc, sizeof(wgpu_view_desc)); wgpu_view_desc.dimension = _sg_wgpu_tex_viewdim(desc->type); @@ -12925,7 +12889,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s SOKOL_ASSERT(img->wgpu.msaa_tex); } - /* create sampler via shared-sampler-cache */ + // create sampler via shared-sampler-cache img->wgpu.sampler = _sg_wgpu_create_sampler(desc); SOKOL_ASSERT(img->wgpu.sampler); } @@ -12946,7 +12910,7 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { wgpuTextureRelease(img->wgpu.msaa_tex); img->wgpu.msaa_tex = 0; } - /* NOTE: do *not* destroy the sampler from the shared-sampler-cache */ + // NOTE: do *not* destroy the sampler from the shared-sampler-cache img->wgpu.sampler = 0; } @@ -13000,7 +12964,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const success = false; } - /* create image/sampler bind group for the shader stage */ + // create image/sampler bind group for the shader stage WGPUShaderStage vis = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; int num_imgs = cmn_stage->num_images; if (num_imgs > _SG_WGPU_MAX_SHADERSTAGE_IMAGES) { @@ -13009,7 +12973,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const WGPUBindGroupLayoutBinding bglb_desc[_SG_WGPU_MAX_SHADERSTAGE_IMAGES * 2]; _sg_clear(bglb_desc, sizeof(bglb_desc)); for (int img_index = 0; img_index < num_imgs; img_index++) { - /* texture- and sampler-bindings */ + // texture- and sampler-bindings WGPUBindGroupLayoutBinding* tex_desc = &bglb_desc[img_index*2 + 0]; WGPUBindGroupLayoutBinding* smp_desc = &bglb_desc[img_index*2 + 1]; @@ -13164,7 +13128,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ } pip_desc.colorStateCount = desc->color_count; pip_desc.colorStates = cs_desc; - pip_desc.sampleMask = 0xFFFFFFFF; /* FIXME: ??? */ + pip_desc.sampleMask = 0xFFFFFFFF; // FIXME: ??? pip->wgpu.pip = wgpuDeviceCreateRenderPipeline(_sg.wgpu.dev, &pip_desc); SOKOL_ASSERT(0 != pip->wgpu.pip); wgpuPipelineLayoutRelease(pip_layout); @@ -13189,7 +13153,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_imag SOKOL_ASSERT(att_images && att_images[0]); _sg_pass_common_init(&pass->cmn, desc); - /* copy image pointers and create render-texture views */ + // copy image pointers and create render-texture views const sg_pass_attachment_desc* att_desc; for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { att_desc = &desc->color_attachments[i]; @@ -13200,7 +13164,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_imag SOKOL_ASSERT(img && (img->slot.id == att_desc->image.id)); SOKOL_ASSERT(_sg_is_valid_rendertarget_color_format(img->cmn.pixel_format)); pass->wgpu.color_atts[i].image = img; - /* create a render-texture-view to render into the right sub-surface */ + // create a render-texture-view to render into the right sub-surface const bool is_msaa = img->cmn.sample_count > 1; WGPUTextureViewDescriptor view_desc; _sg_clear(&view_desc, sizeof(view_desc)); @@ -13212,7 +13176,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_imag SOKOL_ASSERT(wgpu_tex); pass->wgpu.color_atts[i].render_tex_view = wgpuTextureCreateView(wgpu_tex, &view_desc); SOKOL_ASSERT(pass->wgpu.color_atts[i].render_tex_view); - /* ... and if needed a separate resolve texture view */ + // ... and if needed a separate resolve texture view if (is_msaa) { view_desc.baseMipLevel = att_desc->mip_level; view_desc.baseArrayLayer = att_desc->slice; @@ -13230,7 +13194,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_imag SOKOL_ASSERT(_sg_is_valid_rendertarget_depth_format(att_images[ds_img_index]->cmn.pixel_format)); _sg_image_t* ds_img = att_images[ds_img_index]; pass->wgpu.ds_att.image = ds_img; - /* create a render-texture view */ + // create a render-texture view SOKOL_ASSERT(0 == att_desc->mip_level); SOKOL_ASSERT(0 == att_desc->slice); WGPUTextureViewDescriptor view_desc; @@ -13263,12 +13227,12 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_pass(_sg_pass_t* pass) { _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_color_image(const _sg_pass_t* pass, int index) { SOKOL_ASSERT(pass && (index >= 0) && (index < SG_MAX_COLOR_ATTACHMENTS)); - /* NOTE: may return null */ + // NOTE: may return null return pass->wgpu.color_atts[index].image; } _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_ds_image(const _sg_pass_t* pass) { - /* NOTE: may return null */ + // NOTE: may return null SOKOL_ASSERT(pass); return pass->wgpu.ds_att.image; } @@ -13321,7 +13285,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &wgpu_pass_desc); } } else { - /* default render pass */ + // default render pass WGPUTextureView wgpu_render_view = _sg.wgpu.render_view_cb ? _sg.wgpu.render_view_cb() : _sg.wgpu.render_view_userdata_cb(_sg.wgpu.user_data); WGPUTextureView wgpu_resolve_view = _sg.wgpu.resolve_view_cb ? _sg.wgpu.resolve_view_cb() : _sg.wgpu.resolve_view_userdata_cb(_sg.wgpu.user_data); WGPUTextureView wgpu_depth_stencil_view = _sg.wgpu.depth_stencil_view_cb ? _sg.wgpu.depth_stencil_view_cb() : _sg.wgpu.depth_stencil_view_userdata_cb(_sg.wgpu.user_data); @@ -13336,7 +13300,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* color_att_desc.clearColor.b = action->colors[0].value.b; color_att_desc.clearColor.a = action->colors[0].value.a; color_att_desc.attachment = wgpu_render_view; - color_att_desc.resolveTarget = wgpu_resolve_view; /* null if no MSAA rendering */ + color_att_desc.resolveTarget = wgpu_resolve_view; // null if no MSAA rendering pass_desc.colorAttachmentCount = 1; pass_desc.colorAttachments = &color_att_desc; WGPURenderPassDepthStencilAttachmentDescriptor ds_att_desc; @@ -13352,9 +13316,9 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* } SOKOL_ASSERT(_sg.wgpu.pass_enc); - /* initial uniform buffer binding (required even if no uniforms are set in the frame) */ + // initial uniform buffer binding (required even if no uniforms are set in the frame) wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, - 0, /* groupIndex 0 is reserved for uniform buffers */ + 0, // groupIndex 0 is reserved for uniform buffers _sg.wgpu.ub.bindgroup, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.ub.bind_offsets[0][0]); @@ -13375,7 +13339,7 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - /* finish and submit this frame's work */ + // finish and submit this frame's work _sg_wgpu_ubpool_flush(); _sg_wgpu_staging_unmap(); @@ -13398,13 +13362,13 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { wgpuCommandBufferRelease(cmd_bufs[0]); wgpuCommandBufferRelease(cmd_bufs[1]); - /* create a new render- and staging-command-encoders for next frame */ + // create a new render- and staging-command-encoders for next frame WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.staging_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); - /* grab new staging buffers for uniform- and vertex/image-updates */ + // grab new staging buffers for uniform- and vertex/image-updates _sg_wgpu_ubpool_next_frame(false); _sg_wgpu_staging_next_frame(false); } @@ -13425,7 +13389,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_scissor_rect(int x, int y, int w, int h, bool SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - /* clip against framebuffer rect */ + // clip against framebuffer rect x = _sg_min(_sg_max(0, x), _sg.wgpu.cur_width-1); y = _sg_min(_sg_max(0, y), _sg.wgpu.cur_height-1); if ((x + w) > _sg.wgpu.cur_width) { @@ -13491,17 +13455,17 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( SOKOL_ASSERT(_sg.wgpu.pass_enc); SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); - /* index buffer */ + // index buffer if (ib) { wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, ib_offset); } - /* vertex buffers */ + // vertex buffers for (uint32_t slot = 0; slot < (uint32_t)num_vbs; slot++) { wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, slot, vbs[slot]->wgpu.buf, (uint64_t)vb_offsets[slot]); } - /* need to create throw-away bind groups for images */ + // need to create throw-away bind groups for images if (num_vs_imgs > 0) { if (num_vs_imgs > _SG_WGPU_MAX_SHADERSTAGE_IMAGES) { num_vs_imgs = _SG_WGPU_MAX_SHADERSTAGE_IMAGES; @@ -13545,7 +13509,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ memcpy(dst_ptr, data->ptr, data->size); _sg.wgpu.ub.bind_offsets[stage_index][ub_index] = _sg.wgpu.ub.offset; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, - 0, /* groupIndex 0 is reserved for uniform buffers */ + 0, // groupIndex 0 is reserved for uniform buffers _sg.wgpu.ub.bindgroup, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.ub.bind_offsets[0][0]); @@ -15247,11 +15211,11 @@ _SOKOL_PRIVATE bool _sg_validate_apply_uniforms(sg_shader_stage stage_index, int SOKOL_ASSERT(pip && (pip->slot.id == _sg.cur_pipeline.id)); SOKOL_ASSERT(pip->shader && (pip->shader->slot.id == pip->cmn.shader_id.id)); - /* check that there is a uniform block at 'stage' and 'ub_index' */ + // check that there is a uniform block at 'stage' and 'ub_index' const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[stage_index]; _SG_VALIDATE(ub_index < stage->num_uniform_blocks, VALIDATE_AUB_NO_UB_AT_SLOT); - /* check that the provided data size doesn't exceed the uniform block size */ + // check that the provided data size doesn't exceed the uniform block size _SG_VALIDATE(data->size == stage->uniform_blocks[ub_index].size, VALIDATE_AUB_SIZE); return _sg_validate_end(); @@ -15469,12 +15433,12 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des l_state->step_rate = _sg_def(l_state->step_rate, 1); } - /* resolve vertex layout strides and offsets */ + // resolve vertex layout strides and offsets int auto_offset[SG_MAX_VERTEX_BUFFERS]; _sg_clear(auto_offset, sizeof(auto_offset)); bool use_auto_offset = true; for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - /* to use computed offsets, *all* attr offsets must be 0 */ + // to use computed offsets, *all* attr offsets must be 0 if (def.layout.attrs[attr_index].offset != 0) { use_auto_offset = false; } @@ -15490,7 +15454,7 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des } auto_offset[a_state->buffer_index] += _sg_vertexformat_bytesize(a_state->format); } - /* compute vertex strides if needed */ + // compute vertex strides if needed for (int buf_index = 0; buf_index < SG_MAX_VERTEX_BUFFERS; buf_index++) { sg_vertex_buffer_layout_state* l_state = &def.layout.buffers[buf_index]; if (l_state->stride == 0) { @@ -15964,7 +15928,7 @@ SOKOL_API_IMPL sg_context sg_setup_context(void) { SOKOL_ASSERT(ctx->slot.state == SG_RESOURCESTATE_VALID); _sg_activate_context(ctx); } else { - /* pool is exhausted */ + // pool is exhausted res.id = SG_INVALID_ID; } _sg.active_context = res; @@ -15989,7 +15953,7 @@ SOKOL_API_IMPL void sg_activate_context(sg_context ctx_id) { SOKOL_ASSERT(_sg.valid); _sg.active_context = ctx_id; _sg_context_t* ctx = _sg_lookup_context(&_sg.pools, ctx_id.id); - /* NOTE: ctx can be 0 here if the context is no longer valid */ + // NOTE: ctx can be 0 here if the context is no longer valid _sg_activate_context(ctx); } @@ -16301,7 +16265,6 @@ SOKOL_API_IMPL void sg_uninit_pass(sg_pass pass_id) { _SG_TRACE_ARGS(uninit_pass, pass_id); } -/*-- set allocated resource to failed state ----------------------------------*/ SOKOL_API_IMPL void sg_fail_buffer(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); @@ -16386,7 +16349,6 @@ SOKOL_API_IMPL void sg_fail_pass(sg_pass pass_id) { _SG_TRACE_ARGS(fail_pass, pass_id); } -/*-- get resource state */ SOKOL_API_IMPL sg_resource_state sg_query_buffer_state(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); @@ -16429,7 +16391,6 @@ SOKOL_API_IMPL sg_resource_state sg_query_pass_state(sg_pass pass_id) { return res; } -/*-- allocate and initialize resource ----------------------------------------*/ SOKOL_API_IMPL sg_buffer sg_make_buffer(const sg_buffer_desc* desc) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(desc); @@ -16520,7 +16481,6 @@ SOKOL_API_IMPL sg_pass sg_make_pass(const sg_pass_desc* desc) { return pass_id; } -/*-- destroy resource --------------------------------------------------------*/ SOKOL_API_IMPL void sg_destroy_buffer(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); _SG_TRACE_ARGS(destroy_buffer, buf_id); @@ -17259,4 +17219,4 @@ SOKOL_API_IMPL const void* sg_mtl_render_command_encoder(void) { #pragma warning(pop) #endif -#endif /* SOKOL_GFX_IMPL */ +#endif // SOKOL_GFX_IMPL From 527f9ea1853e218efed89f9d5f5d3bca361075e7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 15:24:16 +0200 Subject: [PATCH 048/292] sokol_gfx.h: fix dummy backend, fix sg_query_shader_desc --- sokol_gfx.h | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index e0381e4e0..a78cac632 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3566,7 +3566,6 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #pragma comment (lib, "dxgi") #pragma comment (lib, "d3d11") #endif - #endif #elif defined(SOKOL_METAL) // see https://clang.llvm.org/docs/LanguageExtensions.html#automatic-reference-counting #if !defined(__cplusplus) @@ -5577,6 +5576,17 @@ _SOKOL_PRIVATE void _sg_dummy_discard_image(_sg_image_t* img) { _SOKOL_UNUSED(img); } +_SOKOL_PRIVATE sg_resource_state _sg_dummy_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && desc); + _sg_sampler_common_init(&smp->cmn, desc); + return SG_RESOURCESTATE_VALID; +} + +_SOKOL_PRIVATE void _sg_dummy_discard_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + _SOKOL_UNUSED(smp); +} + _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); _sg_shader_common_init(&shd->cmn, desc); @@ -5593,12 +5603,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, pip->shader = shd; _sg_pipeline_common_init(&pip->cmn, desc); for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { - const sg_vertex_attr_desc* a_desc = &desc->layout.attrs[attr_index]; - if (a_desc->format == SG_VERTEXFORMAT_INVALID) { + const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; + if (a_state->format == SG_VERTEXFORMAT_INVALID) { break; } - SOKOL_ASSERT(a_desc->buffer_index < SG_MAX_VERTEX_BUFFERS); - pip->cmn.vertex_buffer_layout_active[a_desc->buffer_index] = true; + SOKOL_ASSERT(a_state->buffer_index < SG_MAX_VERTEX_BUFFERS); + pip->cmn.vertex_buffer_layout_active[a_state->buffer_index] = true; } return SG_RESOURCESTATE_VALID; } @@ -5704,17 +5714,23 @@ _SOKOL_PRIVATE void _sg_dummy_apply_bindings( _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(pip); SOKOL_ASSERT(vbs && vb_offsets); SOKOL_ASSERT(vs_imgs); SOKOL_ASSERT(fs_imgs); + SOKOL_ASSERT(vs_smps); + SOKOL_ASSERT(fs_smps); _SOKOL_UNUSED(pip); _SOKOL_UNUSED(vbs); _SOKOL_UNUSED(vb_offsets); _SOKOL_UNUSED(num_vbs); _SOKOL_UNUSED(ib); _SOKOL_UNUSED(ib_offset); _SOKOL_UNUSED(vs_imgs); _SOKOL_UNUSED(num_vs_imgs); _SOKOL_UNUSED(fs_imgs); _SOKOL_UNUSED(num_fs_imgs); + _SOKOL_UNUSED(vs_smps); _SOKOL_UNUSED(num_vs_smps); + _SOKOL_UNUSED(fs_smps); _SOKOL_UNUSED(num_fs_smps); } _SOKOL_PRIVATE void _sg_dummy_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -17102,8 +17118,24 @@ SOKOL_API_IMPL sg_shader_desc sg_query_shader_desc(sg_shader shd_id) { for (int img_idx = 0; img_idx < stage->num_images; img_idx++) { sg_shader_image_desc* img_desc = &stage_desc->images[img_idx]; const _sg_shader_image_t* img = &stage->images[img_idx]; + img_desc->used = true; img_desc->image_type = img->image_type; img_desc->sample_type = img->sample_type; + img_desc->multisampled = img->multisampled; + } + for (int smp_idx = 0; smp_idx < stage->num_samplers; smp_idx++) { + sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_idx]; + const _sg_shader_sampler_t* smp = &stage->samplers[smp_idx]; + smp_desc->used = true; + smp_desc->sampler_type = smp->sampler_type; + } + for (int img_smp_idx = 0; img_smp_idx < stage->num_image_samplers; img_smp_idx++) { + sg_shader_image_sampler_pair_desc* img_smp_desc = &stage_desc->image_sampler_pairs[img_smp_idx]; + const _sg_shader_image_sampler_t* img_smp = &stage->image_samplers[img_smp_idx]; + img_smp_desc->used = true; + img_smp_desc->image_slot = img_smp->image_slot; + img_smp_desc->sampler_slot = img_smp->sampler_slot; + img_smp_desc->glsl_name = 0; } } } From e6f5691805e055357f6dfe0e68926253383f6261 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 15:25:04 +0200 Subject: [PATCH 049/292] fix sokol_gfx_test.c --- tests/functional/sokol_gfx_test.c | 97 ++++++++++++++++++------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index c5c95bf90..fc2f5f34a 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -93,18 +93,19 @@ UTEST(sokol_gfx, init_shutdown) { UTEST(sokol_gfx, query_desc) { setup(&(sg_desc){ .buffer_pool_size = 1024, + .sampler_pool_size = 8, .shader_pool_size = 128, .pass_pool_size = 64, }); const sg_desc desc = sg_query_desc(); T(desc.buffer_pool_size == 1024); T(desc.image_pool_size == _SG_DEFAULT_IMAGE_POOL_SIZE); + T(desc.sampler_pool_size == 8); T(desc.shader_pool_size == 128); T(desc.pipeline_pool_size == _SG_DEFAULT_PIPELINE_POOL_SIZE); T(desc.pass_pool_size == 64); T(desc.context_pool_size == _SG_DEFAULT_CONTEXT_POOL_SIZE); T(desc.uniform_buffer_size == _SG_DEFAULT_UB_SIZE); - T(desc.sampler_cache_size == _SG_DEFAULT_SAMPLER_CACHE_CAPACITY); sg_shutdown(); } @@ -370,17 +371,11 @@ UTEST(sokol_gfx, make_destroy_images) { T(imgptr->cmn.usage == SG_USAGE_IMMUTABLE); T(imgptr->cmn.pixel_format == SG_PIXELFORMAT_RGBA8); T(imgptr->cmn.sample_count == 1); - T(imgptr->cmn.min_filter == SG_FILTER_NEAREST); - T(imgptr->cmn.mag_filter == SG_FILTER_NEAREST); - T(imgptr->cmn.wrap_u == SG_WRAP_REPEAT); - T(imgptr->cmn.wrap_v == SG_WRAP_REPEAT); - T(imgptr->cmn.wrap_w == SG_WRAP_REPEAT); - T(imgptr->cmn.max_anisotropy == 1); T(imgptr->cmn.upd_frame_index == 0); T(imgptr->cmn.num_slots == 1); T(imgptr->cmn.active_slot == 0); } - /* trying to create another one fails because buffer is exhausted */ + // trying to create another one fails because buffer is exhausted T(sg_make_image(&desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -463,8 +458,8 @@ UTEST(sokol_gfx, make_destroy_pipelines) { T(pipptr->cmn.depth.pixel_format == SG_PIXELFORMAT_DEPTH_STENCIL); T(pipptr->cmn.sample_count == 1); T(pipptr->cmn.index_type == SG_INDEXTYPE_NONE); - T(pipptr->cmn.vertex_layout_valid[0]); - T(!pipptr->cmn.vertex_layout_valid[1]); + T(pipptr->cmn.vertex_buffer_layout_active[0]); + T(!pipptr->cmn.vertex_buffer_layout_active[1]); } /* trying to create another one fails because buffer is exhausted */ T(sg_make_pipeline(&desc).id == SG_INVALID_ID); @@ -571,13 +566,6 @@ UTEST(sokol_gfx, query_image_defaults) { T(desc.usage == SG_USAGE_IMMUTABLE); T(desc.pixel_format == SG_PIXELFORMAT_RGBA8); T(desc.sample_count == 1); - T(desc.min_filter == SG_FILTER_NEAREST); - T(desc.mag_filter == SG_FILTER_NEAREST); - T(desc.wrap_u == SG_WRAP_REPEAT); - T(desc.wrap_v == SG_WRAP_REPEAT); - T(desc.wrap_w == SG_WRAP_REPEAT); - T(desc.max_anisotropy == 1); - T(desc.max_lod >= FLT_MAX); sg_shutdown(); } @@ -885,13 +873,7 @@ UTEST(sokol_gfx, query_image_desc) { .width = 256, .height = 512, .pixel_format = SG_PIXELFORMAT_R8, - .mag_filter = SG_FILTER_LINEAR, - .wrap_v = SG_WRAP_CLAMP_TO_EDGE, .usage = SG_USAGE_DYNAMIC, - .border_color = SG_BORDERCOLOR_OPAQUE_WHITE, - .max_anisotropy = 4, - .min_lod = 0.5f, - .max_lod = 0.75f, }); const sg_image_desc i0_desc = sg_query_image_desc(i0); T(i0_desc.type == SG_IMAGETYPE_2D); @@ -903,15 +885,6 @@ UTEST(sokol_gfx, query_image_desc) { T(i0_desc.usage == SG_USAGE_DYNAMIC); T(i0_desc.pixel_format == SG_PIXELFORMAT_R8); T(i0_desc.sample_count == 1); - T(i0_desc.min_filter == SG_FILTER_NEAREST); - T(i0_desc.mag_filter == SG_FILTER_LINEAR); - T(i0_desc.wrap_u == SG_WRAP_REPEAT); - T(i0_desc.wrap_v == SG_WRAP_CLAMP_TO_EDGE); - T(i0_desc.wrap_w == SG_WRAP_REPEAT); - T(i0_desc.border_color == SG_BORDERCOLOR_OPAQUE_WHITE); - T(i0_desc.max_anisotropy == 4); - T(i0_desc.min_lod == 0.5f); - T(i0_desc.max_lod == 0.75f); T(i0_desc.data.subimage[0][0].ptr == 0); T(i0_desc.data.subimage[0][0].size == 0); T(i0_desc.gl_textures[0] == 0); @@ -955,15 +928,21 @@ UTEST(sokol_gfx, query_shader_desc) { } } }, - .images = { - [0] = { .name = "img0", .image_type = SG_IMAGETYPE_2D, .sampler_type = SG_SAMPLERTYPE_FLOAT }, - } + .images[0] = { .used = true, .image_type = SG_IMAGETYPE_2D, .sample_type = SG_IMAGESAMPLETYPE_FLOAT, .multisampled = true }, + .images[1] = { .used = true, .image_type = SG_IMAGETYPE_3D, .sample_type = SG_IMAGESAMPLETYPE_SINT }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, + .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARE }, + .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 1, .glsl_name = "img0" }, + .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 0, .glsl_name = "img1" }, }, .fs = { .source = "fs_source", - .images = { - [0] = { .name = "img1", .image_type = SG_IMAGETYPE_ARRAY, .sampler_type = SG_SAMPLERTYPE_UINT }, - } + .images[0] = { .used = true, .image_type = SG_IMAGETYPE_ARRAY, .sample_type = SG_IMAGESAMPLETYPE_DEPTH }, + .images[1] = { .used = true, .image_type = SG_IMAGETYPE_CUBE, .sample_type = SG_IMAGESAMPLETYPE_FLOAT }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARE }, + .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, + .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 0, .glsl_name = "img3" }, + .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 1, .glsl_name = "img4" }, }, .label = "label", }); @@ -977,18 +956,52 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.vs.uniform_blocks[0].uniforms[0].name == 0); T(s0_desc.vs.uniform_blocks[0].uniforms[0].type == 0); T(s0_desc.vs.uniform_blocks[0].uniforms[0].array_count == 0); - T(s0_desc.vs.images[0].name == 0); + T(s0_desc.vs.images[0].used); T(s0_desc.vs.images[0].image_type == SG_IMAGETYPE_2D); - T(s0_desc.vs.images[0].sampler_type == SG_SAMPLERTYPE_FLOAT); + T(s0_desc.vs.images[0].sample_type == SG_IMAGESAMPLETYPE_FLOAT); + T(s0_desc.vs.images[0].multisampled); + T(s0_desc.vs.images[1].used); + T(s0_desc.vs.images[1].image_type == SG_IMAGETYPE_3D); + T(s0_desc.vs.images[1].sample_type == SG_IMAGESAMPLETYPE_SINT); + T(s0_desc.vs.images[1].multisampled == false); + T(s0_desc.vs.samplers[0].used); + T(s0_desc.vs.samplers[0].sampler_type == SG_SAMPLERTYPE_SAMPLE); + T(s0_desc.vs.samplers[1].used); + T(s0_desc.vs.samplers[1].sampler_type == SG_SAMPLERTYPE_COMPARE); + T(s0_desc.vs.image_sampler_pairs[0].used); + T(s0_desc.vs.image_sampler_pairs[0].image_slot == 0); + T(s0_desc.vs.image_sampler_pairs[0].sampler_slot == 1); + T(s0_desc.vs.image_sampler_pairs[0].glsl_name == 0); + T(s0_desc.vs.image_sampler_pairs[1].used); + T(s0_desc.vs.image_sampler_pairs[1].image_slot == 1); + T(s0_desc.vs.image_sampler_pairs[1].sampler_slot == 0); + T(s0_desc.vs.image_sampler_pairs[1].glsl_name == 0); T(s0_desc.fs.source == 0); T(s0_desc.fs.uniform_blocks[0].size == 0); T(s0_desc.fs.uniform_blocks[0].layout == 0); T(s0_desc.fs.uniform_blocks[0].uniforms[0].name == 0); T(s0_desc.fs.uniform_blocks[0].uniforms[0].type == 0); T(s0_desc.fs.uniform_blocks[0].uniforms[0].array_count == 0); - T(s0_desc.fs.images[0].name == 0); + T(s0_desc.fs.images[0].used); T(s0_desc.fs.images[0].image_type == SG_IMAGETYPE_ARRAY); - T(s0_desc.fs.images[0].sampler_type == SG_SAMPLERTYPE_UINT); + T(s0_desc.fs.images[0].sample_type == SG_IMAGESAMPLETYPE_DEPTH); + T(s0_desc.fs.images[0].multisampled == false); + T(s0_desc.fs.images[1].used); + T(s0_desc.fs.images[1].image_type == SG_IMAGETYPE_CUBE); + T(s0_desc.fs.images[1].sample_type == SG_IMAGESAMPLETYPE_FLOAT); + T(s0_desc.fs.images[1].multisampled == false); + T(s0_desc.fs.samplers[0].used); + T(s0_desc.fs.samplers[0].sampler_type == SG_SAMPLERTYPE_COMPARE); + T(s0_desc.fs.samplers[1].used); + T(s0_desc.fs.samplers[1].sampler_type == SG_SAMPLERTYPE_SAMPLE); + T(s0_desc.fs.image_sampler_pairs[0].used); + T(s0_desc.fs.image_sampler_pairs[0].image_slot == 0); + T(s0_desc.fs.image_sampler_pairs[0].sampler_slot == 0); + T(s0_desc.fs.image_sampler_pairs[0].glsl_name == 0); + T(s0_desc.fs.image_sampler_pairs[1].used); + T(s0_desc.fs.image_sampler_pairs[1].image_slot == 1); + T(s0_desc.fs.image_sampler_pairs[1].sampler_slot == 1); + T(s0_desc.fs.image_sampler_pairs[1].glsl_name == 0); sg_shutdown(); } From c24e8a4085e49ce2966f5f8d4d5a6415d8ec0122 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:02:28 +0200 Subject: [PATCH 050/292] add sampler tests to sokol_gfx_test.c --- tests/functional/sokol_gfx_test.c | 223 ++++++++++++++++++++++++++++-- 1 file changed, 208 insertions(+), 15 deletions(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index fc2f5f34a..3e7c862af 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -203,6 +203,36 @@ UTEST(sokol_gfx, alloc_fail_destroy_images) { sg_shutdown(); } +UTEST(sokol_gfx, alloc_fail_destroy_samplers) { + setup(&(sg_desc){ + .sampler_pool_size = 3, + }); + + sg_sampler smp[3] = { {0} }; + for (int i = 0; i < 3; i++) { + smp[i] = sg_alloc_sampler(); + T(smp[i].id != SG_INVALID_ID); + T((2-i) == _sg.pools.sampler_pool.queue_top); + T(sg_query_sampler_state(smp[i]) == SG_RESOURCESTATE_ALLOC); + } + // the next alloc will fail because the pool is exhausted + sg_sampler s3 = sg_alloc_sampler(); + T(s3.id == SG_INVALID_ID); + T(sg_query_sampler_state(s3) == SG_RESOURCESTATE_INVALID); + + // before destroying, the resources must be either in valid or failed state + for (int i = 0; i < 3; i++) { + sg_fail_sampler(smp[i]); + T(sg_query_sampler_state(smp[i]) == SG_RESOURCESTATE_FAILED); + } + for (int i = 0; i < 3; i++) { + sg_destroy_sampler(smp[i]); + T(sg_query_sampler_state(smp[i]) == SG_RESOURCESTATE_INVALID); + T((i+1) == _sg.pools.sampler_pool.queue_top); + } + sg_shutdown(); +} + UTEST(sokol_gfx, alloc_fail_destroy_shaders) { setup(&(sg_desc){ .shader_pool_size = 3 @@ -327,7 +357,7 @@ UTEST(sokol_gfx, make_destroy_buffers) { T(bufptr->cmn.num_slots == 1); T(bufptr->cmn.active_slot == 0); } - /* trying to create another one fails because buffer is exhausted */ + /* trying to create another one fails because pool is exhausted */ T(sg_make_buffer(&desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -375,7 +405,7 @@ UTEST(sokol_gfx, make_destroy_images) { T(imgptr->cmn.num_slots == 1); T(imgptr->cmn.active_slot == 0); } - // trying to create another one fails because buffer is exhausted + // trying to create another one fails because pool is exhausted T(sg_make_image(&desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -386,6 +416,47 @@ UTEST(sokol_gfx, make_destroy_images) { sg_shutdown(); } +UTEST(sokol_gfx, make_destroy_samplers) { + setup(&(sg_desc){ + .sampler_pool_size = 3 + }); + T(sg_isvalid()); + + sg_sampler smp[3] = { {0} }; + sg_sampler_desc desc = { 0 }; + for (int i = 0; i < 3; i++) { + smp[i] = sg_make_sampler(&desc); + T(smp[i].id != SG_INVALID_ID); + T((2-i) == _sg.pools.sampler_pool.queue_top); + T(sg_query_sampler_state(smp[i]) == SG_RESOURCESTATE_VALID); + const _sg_sampler_t* smpptr = _sg_lookup_sampler(&_sg.pools, smp[i].id); + T(smpptr); + T(smpptr->slot.id == smp[i].id); + T(smpptr->slot.ctx_id == _sg.active_context.id); + T(smpptr->slot.state == SG_RESOURCESTATE_VALID); + T(smpptr->cmn.min_filter == SG_FILTER_NEAREST); + T(smpptr->cmn.mag_filter == SG_FILTER_NEAREST); + T(smpptr->cmn.mipmap_filter == SG_FILTER_NONE); + T(smpptr->cmn.wrap_u == SG_WRAP_REPEAT); + T(smpptr->cmn.wrap_v == SG_WRAP_REPEAT); + T(smpptr->cmn.wrap_w == SG_WRAP_REPEAT); + T(smpptr->cmn.min_lod == 0.0f); + T(smpptr->cmn.max_lod == FLT_MAX); + T(smpptr->cmn.border_color == SG_BORDERCOLOR_OPAQUE_BLACK); + T(smpptr->cmn.compare == SG_COMPAREFUNC_NEVER); + T(smpptr->cmn.max_anisotropy == 1); + } + // trying to create another one fails because pool is exhausted + T(sg_make_sampler(&desc).id == SG_INVALID_ID); + + for (int i = 0; i < 3; i++) { + sg_destroy_sampler(smp[i]); + T(sg_query_sampler_state(smp[i]) == SG_RESOURCESTATE_INVALID); + T((i+1) == _sg.pools.sampler_pool.queue_top); + } + sg_shutdown(); +} + UTEST(sokol_gfx, make_destroy_shaders) { setup(&(sg_desc){ .shader_pool_size = 3 @@ -414,7 +485,7 @@ UTEST(sokol_gfx, make_destroy_shaders) { T(shdptr->cmn.stage[SG_SHADERSTAGE_FS].num_uniform_blocks == 0); T(shdptr->cmn.stage[SG_SHADERSTAGE_FS].num_images == 0); } - /* trying to create another one fails because buffer is exhausted */ + /* trying to create another one fails because pool is exhausted */ T(sg_make_shader(&desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -461,7 +532,7 @@ UTEST(sokol_gfx, make_destroy_pipelines) { T(pipptr->cmn.vertex_buffer_layout_active[0]); T(!pipptr->cmn.vertex_buffer_layout_active[1]); } - /* trying to create another one fails because buffer is exhausted */ + /* trying to create another one fails because pool is exhausted */ T(sg_make_pipeline(&desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -509,7 +580,7 @@ UTEST(sokol_gfx, make_destroy_passes) { T(passptr->cmn.color_atts[ai].image_id.id == pass_desc.color_attachments[ai].image.id); } } - /* trying to create another one fails because buffer is exhausted */ + /* trying to create another one fails because pool is exhausted */ T(sg_make_pass(&pass_desc).id == SG_INVALID_ID); for (int i = 0; i < 3; i++) { @@ -569,6 +640,23 @@ UTEST(sokol_gfx, query_image_defaults) { sg_shutdown(); } +UTEST(sokol_gfx, query_sampler_defaults) { + setup(&(sg_desc){0}); + const sg_sampler_desc desc = sg_query_sampler_defaults(&(sg_sampler_desc){0}); + T(desc.min_filter == SG_FILTER_NEAREST); + T(desc.mag_filter == SG_FILTER_NEAREST); + T(desc.mipmap_filter == SG_FILTER_NONE); + T(desc.wrap_u == SG_WRAP_REPEAT); + T(desc.wrap_v == SG_WRAP_REPEAT); + T(desc.wrap_w == SG_WRAP_REPEAT); + T(desc.min_lod == 0.0f); + T(desc.max_lod == FLT_MAX); + T(desc.border_color == SG_BORDERCOLOR_OPAQUE_BLACK); + T(desc.compare == SG_COMPAREFUNC_NEVER); + T(desc.max_anisotropy == 1); + sg_shutdown(); +} + UTEST(sokol_gfx, query_shader_defaults) { setup(&(sg_desc){0}); const sg_shader_desc desc = sg_query_shader_defaults(&(sg_shader_desc){0}); @@ -740,6 +828,7 @@ UTEST(sokol_gfx, query_buffer_info) { T(buf.id != SG_INVALID_ID); const sg_buffer_info info = sg_query_buffer_info(buf); T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == buf.id); sg_shutdown(); } @@ -753,10 +842,21 @@ UTEST(sokol_gfx, query_image_info) { T(img.id != SG_INVALID_ID); const sg_image_info info = sg_query_image_info(img); T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == img.id); T(info.num_slots == 1); sg_shutdown(); } +UTEST(sokoL_gfx, query_sampler_info) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ 0 }); + T(smp.id != SG_INVALID_ID); + const sg_sampler_info info = sg_query_sampler_info(smp); + T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == smp.id); + sg_shutdown(); +} + UTEST(sokol_gfx, query_shader_info) { setup(&(sg_desc){0}); sg_shader shd = sg_make_shader(&(sg_shader_desc){ @@ -768,6 +868,7 @@ UTEST(sokol_gfx, query_shader_info) { }); const sg_shader_info info = sg_query_shader_info(shd); T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == shd.id); sg_shutdown(); } @@ -787,6 +888,7 @@ UTEST(sokol_gfx, query_pipeline_info) { }); const sg_pipeline_info info = sg_query_pipeline_info(pip); T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == pip.id); sg_shutdown(); } @@ -806,6 +908,7 @@ UTEST(sokol_gfx, query_pass_info) { }); const sg_pass_info info = sg_query_pass_info(pass); T(info.slot.state == SG_RESOURCESTATE_VALID); + T(info.slot.res_id == pass.id); sg_shutdown(); } @@ -895,16 +998,47 @@ UTEST(sokol_gfx, query_image_desc) { T(i0_desc.wgpu_texture == 0); sg_destroy_image(i0); - const sg_image_desc i1_desc = sg_query_image_desc(i0); - T(i1_desc.type == 0); - T(i1_desc.render_target == false); - T(i1_desc.width == 0); - T(i1_desc.height == 0); - T(i1_desc.num_slices == 0); - T(i1_desc.num_mipmaps == 0); - T(i1_desc.usage == 0); - T(i1_desc.pixel_format == 0); - T(i1_desc.sample_count == 0); + const sg_image_desc i0_desc_x = sg_query_image_desc(i0); + T(i0_desc_x.type == 0); + T(i0_desc_x.render_target == false); + T(i0_desc_x.width == 0); + T(i0_desc_x.height == 0); + T(i0_desc_x.num_slices == 0); + T(i0_desc_x.num_mipmaps == 0); + T(i0_desc_x.usage == 0); + T(i0_desc_x.pixel_format == 0); + T(i0_desc_x.sample_count == 0); + + sg_shutdown(); +} + +UTEST(sokol_gfx, query_sampler_desc) { + setup(&(sg_desc){0}); + sg_sampler s0 = sg_make_sampler(&(sg_sampler_desc){ + .min_filter = SG_FILTER_LINEAR, + .mipmap_filter = SG_FILTER_LINEAR, + .wrap_v = SG_WRAP_MIRRORED_REPEAT, + .max_anisotropy = 8, + .border_color = SG_BORDERCOLOR_TRANSPARENT_BLACK, + .compare = SG_COMPAREFUNC_GREATER, + }); + const sg_sampler_desc s0_desc = sg_query_sampler_desc(s0); + T(s0_desc.min_filter == SG_FILTER_LINEAR); + T(s0_desc.mag_filter == SG_FILTER_NEAREST); + T(s0_desc.mipmap_filter == SG_FILTER_LINEAR); + T(s0_desc.wrap_u == SG_WRAP_REPEAT); + T(s0_desc.wrap_v == SG_WRAP_MIRRORED_REPEAT); + T(s0_desc.wrap_w == SG_WRAP_REPEAT); + T(s0_desc.min_lod == 0.0f); + T(s0_desc.max_lod == FLT_MAX); + T(s0_desc.border_color == SG_BORDERCOLOR_TRANSPARENT_BLACK); + T(s0_desc.compare == SG_COMPAREFUNC_GREATER); + T(s0_desc.max_anisotropy == 8); + + sg_destroy_sampler(s0); + const sg_sampler_desc s0_desc_x = sg_query_sampler_desc(s0); + T(s0_desc_x.min_filter == 0); + T(s0_desc_x.compare == 0); sg_shutdown(); } @@ -1150,6 +1284,19 @@ UTEST(sokol_gfx, image_resource_states) { sg_shutdown(); } +UTEST(sokol_gfx, sampler_resource_states) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_alloc_sampler(); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_ALLOC); + sg_init_sampler(smp, &(sg_sampler_desc){ .min_filter = SG_FILTER_LINEAR, .mag_filter = SG_FILTER_LINEAR }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_VALID); + sg_uninit_sampler(smp); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_ALLOC); + sg_dealloc_sampler(smp); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_INVALID); + sg_shutdown(); +} + UTEST(sokol_gfx, shader_resource_states) { setup(&(sg_desc){0}); sg_shader shd = sg_alloc_shader(); @@ -1419,6 +1566,17 @@ UTEST(sokol_gfx, image_double_destroy_is_ok) { sg_shutdown(); } +UTEST(sokol_gfx, sampler_double_destroy_is_ok) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){0}); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_VALID); + sg_destroy_sampler(smp); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_INVALID); + sg_destroy_sampler(smp); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_INVALID); + sg_shutdown(); +} + UTEST(sokol_gfx, shader_double_destroy_is_ok) { setup(&(sg_desc){0}); sg_shader shd = create_shader(); @@ -1478,6 +1636,19 @@ UTEST(sokol_gfx, make_dealloc_image_warns) { sg_shutdown(); } +UTEST(sokol_gfx, make_dealloc_sampler_warns) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){0}); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_VALID); + sg_dealloc_sampler(smp); + T(log_items[0] == SG_LOGITEM_DEALLOC_SAMPLER_INVALID_STATE); + T(num_log_called == 1); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_VALID); + sg_destroy_sampler(smp); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_INVALID); + sg_shutdown(); +} + UTEST(sokol_gfx, make_dealloc_shader_warns) { setup(&(sg_desc){0}); sg_shader shd = create_shader(); @@ -1539,6 +1710,17 @@ UTEST(sokol_gfx, alloc_uninit_image_warns) { sg_shutdown(); } +UTEST(sokol_gfx, alloc_uninit_sampler_warns) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_alloc_sampler(); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_ALLOC); + sg_uninit_sampler(smp); + T(log_items[0] == SG_LOGITEM_UNINIT_SAMPLER_INVALID_STATE); + T(num_log_called == 1); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_ALLOC); + sg_shutdown(); +} + UTEST(sokol_gfx, alloc_uninit_shader_warns) { setup(&(sg_desc){0}); sg_shader shd = sg_alloc_shader(); @@ -1592,6 +1774,17 @@ UTEST(sokol_gfx, alloc_destroy_image_is_ok) { sg_shutdown(); } +UTEST(sokol_gfx, alloc_destroy_sampler_is_ok) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_alloc_sampler(); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_ALLOC); + sg_destroy_sampler(smp); + T(num_log_called == 0); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_INVALID); + sg_shutdown(); + +} + UTEST(sokol_gfx, alloc_destroy_shader_is_ok) { setup(&(sg_desc){0}); sg_shader shd = sg_alloc_shader(); From bdbe99ee7c9711981ee36dddfd0aea406ca67888 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:17:45 +0200 Subject: [PATCH 051/292] sokol_gfx.h: fix unused warning in release mode --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a78cac632..0630f6426 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -8074,8 +8074,8 @@ _SOKOL_PRIVATE void _sg_gl_apply_bindings( _sg_sampler_t** smps = (stage_index == SG_SHADERSTAGE_VS) ? vs_smps : fs_smps; const int num_imgs = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_imgs : num_fs_imgs; const int num_smps = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_smps : num_fs_smps; - SOKOL_ASSERT(num_imgs == stage->num_images); - SOKOL_ASSERT(num_smps == stage->num_samplers); + SOKOL_ASSERT(num_imgs == stage->num_images); _SOKOL_UNUSED(num_imgs); + SOKOL_ASSERT(num_smps == stage->num_samplers); _SOKOL_UNUSED(num_smps); for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { const int gl_tex_slot = gl_stage->image_samplers[img_smp_index].gl_tex_slot; if (gl_tex_slot != -1) { From 52392686a5f13361925c54bc456911346e7256c3 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:18:21 +0200 Subject: [PATCH 052/292] sokol_nuklear.h: fix embedded glsl shader name --- util/sokol_nuklear.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index af166080d..6cd14027f 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -391,7 +391,7 @@ static const char _snk_vs_source_glsl330[341] = { 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b, 0x0a,0x7d,0x0a,0x0a,0x00, }; -static const char fs_source_glsl330[177] = { +static const char _snk_fs_source_glsl330[177] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, From f919f5c422126f781ee967bd335a9a7cdaee1a4c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:18:31 +0200 Subject: [PATCH 053/292] fix tests --- tests/functional/sokol_gl_test.c | 38 ++++++++++++++++++++++++++- tests/functional/sokol_shape_test.c | 40 ++++++++++++++--------------- tests/functional/sokol_spine_test.c | 13 +++++++--- 3 files changed, 66 insertions(+), 25 deletions(-) diff --git a/tests/functional/sokol_gl_test.c b/tests/functional/sokol_gl_test.c index 1310e4400..4fe4f4551 100644 --- a/tests/functional/sokol_gl_test.c +++ b/tests/functional/sokol_gl_test.c @@ -98,11 +98,47 @@ UTEST(sokol_gl, texture) { .height = 8, .data.subimage[0][0] = SG_RANGE(pixels), }); - sgl_texture(img); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){0}); + sgl_texture(img, smp); T(_sgl.cur_ctx->cur_img.id == img.id); + T(_sgl.cur_ctx->cur_smp.id == smp.id); shutdown(); } +UTEST(sokol_gl, texture_image_nosampler) { + init(); + T(_sgl.cur_ctx->cur_img.id == _sgl.def_img.id); + uint32_t pixels[64] = { 0 }; + sg_image img = sg_make_image(&(sg_image_desc){ + .type = SG_IMAGETYPE_2D, + .width = 8, + .height = 8, + .data.subimage[0][0] = SG_RANGE(pixels), + }); + sgl_texture(img, (sg_sampler){0}); + T(_sgl.cur_ctx->cur_img.id == img.id); + T(_sgl.cur_ctx->cur_smp.id == _sgl.def_smp.id); + shutdown(); +} + +UTEST(sokol_gl, texture_noimage_sampler) { + init(); + T(_sgl.cur_ctx->cur_img.id == _sgl.def_img.id); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){0}); + sgl_texture((sg_image){0}, smp); + T(_sgl.cur_ctx->cur_img.id == _sgl.def_img.id); + T(_sgl.cur_ctx->cur_smp.id == smp.id); + shutdown(); +} + +UTEST(sokol_gl, texture_noimage_nosampler) { + init(); + T(_sgl.cur_ctx->cur_img.id == _sgl.def_img.id); + sgl_texture((sg_image){0}, (sg_sampler){0}); + T(_sgl.cur_ctx->cur_img.id == _sgl.def_img.id); + T(_sgl.cur_ctx->cur_smp.id == _sgl.def_smp.id); + shutdown(); +} UTEST(sokol_gl, begin_end) { init(); sgl_begin_triangles(); diff --git a/tests/functional/sokol_shape_test.c b/tests/functional/sokol_shape_test.c index 5249641fa..8fc84b104 100644 --- a/tests/functional/sokol_shape_test.c +++ b/tests/functional/sokol_shape_test.c @@ -168,36 +168,36 @@ UTEST(sokol_shape, torus_buffer_sizes) { } UTEST(sokol_shape, buffer_layout_desc) { - const sg_buffer_layout_desc desc = sshape_buffer_layout_desc(); - T(sizeof(sshape_vertex_t) == desc.stride); - T(0 == desc.step_func); - T(0 == desc.step_rate); + const sg_vertex_buffer_layout_state l_state = sshape_vertex_buffer_layout_state(); + T(sizeof(sshape_vertex_t) == l_state.stride); + T(0 == l_state.step_func); + T(0 == l_state.step_rate); } UTEST(sokol_shape, attr_descs) { { - const sg_vertex_attr_desc desc = sshape_position_attr_desc(); - T(offsetof(sshape_vertex_t, x) == desc.offset); - T(SG_VERTEXFORMAT_FLOAT3 == desc.format); - T(0 == desc.buffer_index); + const sg_vertex_attr_state a_state = sshape_position_vertex_attr_state(); + T(offsetof(sshape_vertex_t, x) == a_state.offset); + T(SG_VERTEXFORMAT_FLOAT3 == a_state.format); + T(0 == a_state.buffer_index); } { - const sg_vertex_attr_desc desc = sshape_normal_attr_desc(); - T(offsetof(sshape_vertex_t, normal) == desc.offset); - T(SG_VERTEXFORMAT_BYTE4N == desc.format); - T(0 == desc.buffer_index); + const sg_vertex_attr_state a_state = sshape_normal_vertex_attr_state(); + T(offsetof(sshape_vertex_t, normal) == a_state.offset); + T(SG_VERTEXFORMAT_BYTE4N == a_state.format); + T(0 == a_state.buffer_index); } { - const sg_vertex_attr_desc desc = sshape_texcoord_attr_desc(); - T(offsetof(sshape_vertex_t, u) == desc.offset); - T(SG_VERTEXFORMAT_USHORT2N == desc.format); - T(0 == desc.buffer_index); + const sg_vertex_attr_state a_state = sshape_texcoord_vertex_attr_state(); + T(offsetof(sshape_vertex_t, u) == a_state.offset); + T(SG_VERTEXFORMAT_USHORT2N == a_state.format); + T(0 == a_state.buffer_index); } { - const sg_vertex_attr_desc desc = sshape_color_attr_desc(); - T(offsetof(sshape_vertex_t, color) == desc.offset); - T(SG_VERTEXFORMAT_UBYTE4N == desc.format); - T(0 == desc.buffer_index); + const sg_vertex_attr_state a_state = sshape_color_vertex_attr_state(); + T(offsetof(sshape_vertex_t, color) == a_state.offset); + T(SG_VERTEXFORMAT_UBYTE4N == a_state.format); + T(0 == a_state.buffer_index); } } diff --git a/tests/functional/sokol_spine_test.c b/tests/functional/sokol_spine_test.c index 0063fff89..d32bd27cc 100644 --- a/tests/functional/sokol_spine_test.c +++ b/tests/functional/sokol_spine_test.c @@ -190,8 +190,9 @@ UTEST(sokol_spine, atlas_with_overrides) { sspine_atlas atlas = sspine_make_atlas(&(sspine_atlas_desc){ .data = atlas_data, .override = { - .min_filter = SG_FILTER_NEAREST_MIPMAP_NEAREST, + .min_filter = SG_FILTER_NEAREST, .mag_filter = SG_FILTER_NEAREST, + .mipmap_filter = SG_FILTER_LINEAR, .wrap_u = SG_WRAP_REPEAT, .wrap_v = SG_WRAP_CLAMP_TO_EDGE, .premul_alpha_enabled = true, @@ -204,8 +205,9 @@ UTEST(sokol_spine, atlas_with_overrides) { T(img_info.sgimage.id != SG_INVALID_ID); T(sg_query_image_state(img_info.sgimage) == SG_RESOURCESTATE_ALLOC); T(strcmp(img_info.filename.cstr, "spineboy.png") == 0); - T(img_info.min_filter == SG_FILTER_NEAREST_MIPMAP_NEAREST); + T(img_info.min_filter == SG_FILTER_NEAREST); T(img_info.mag_filter == SG_FILTER_NEAREST); + T(img_info.mipmap_filter == SG_FILTER_LINEAR); T(img_info.wrap_u == SG_WRAP_REPEAT); T(img_info.wrap_v == SG_WRAP_CLAMP_TO_EDGE); T(img_info.width == 1024); @@ -636,8 +638,9 @@ UTEST(sokol_spine, atlas_get_atlas_page_info_with_overrides) { sspine_atlas atlas = sspine_make_atlas(&(sspine_atlas_desc){ .data = atlas_data, .override = { - .min_filter = SG_FILTER_NEAREST_MIPMAP_NEAREST, + .min_filter = SG_FILTER_NEAREST, .mag_filter = SG_FILTER_NEAREST, + .mipmap_filter = SG_FILTER_NEAREST, .wrap_u = SG_WRAP_REPEAT, .wrap_v = SG_WRAP_CLAMP_TO_EDGE, .premul_alpha_enabled = true, @@ -652,13 +655,15 @@ UTEST(sokol_spine, atlas_get_atlas_page_info_with_overrides) { T(strcmp(info.image.filename.cstr, "spineboy.png") == 0); T(info.image.min_filter == SG_FILTER_LINEAR); T(info.image.mag_filter == SG_FILTER_LINEAR); + T(info.image.mipmap_filter == SG_FILTER_NONE); T(info.image.wrap_u == SG_WRAP_CLAMP_TO_EDGE); T(info.image.wrap_v == SG_WRAP_CLAMP_TO_EDGE); T(info.image.width == 1024); T(info.image.height == 256); T(info.image.premul_alpha == true); // FIXME: hmm, this is actually inconsistent - T(info.overrides.min_filter == SG_FILTER_NEAREST_MIPMAP_NEAREST); + T(info.overrides.min_filter == SG_FILTER_NEAREST); T(info.overrides.mag_filter == SG_FILTER_NEAREST); + T(info.overrides.mipmap_filter == SG_FILTER_NEAREST); T(info.overrides.wrap_u == SG_WRAP_REPEAT); T(info.overrides.wrap_v == SG_WRAP_CLAMP_TO_EDGE); T(info.overrides.premul_alpha_enabled); From 2f9a2dced814d6b9c0aa16a34b201d0b80217fb5 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:41:21 +0200 Subject: [PATCH 054/292] sokol_gfx.h: fix sign conversion warning --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0630f6426..b9b378cd3 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -14801,8 +14801,8 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { } } // each image and sampler must be referenced by an image sampler - const uint32_t expected_img_slot_mask = (1 << num_images) - 1; - const uint32_t expected_smp_slot_mask = (1 << num_samplers) - 1; + const uint32_t expected_img_slot_mask = (1 << (uint32_t)num_images) - 1; + const uint32_t expected_smp_slot_mask = (1 << (uint32_t)num_samplers) - 1; uint32_t actual_img_slot_mask = 0; uint32_t actual_smp_slot_mask = 0; for (int img_smp_index = 0; img_smp_index < num_image_samplers; img_smp_index++) { From 99157e21c833baa46b92d70356173ad4418f44d1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:55:12 +0200 Subject: [PATCH 055/292] sokol_gfx_imgui.h: fix switch-case fallthrough bug (thanks gcc for the warning) --- util/sokol_gfx_imgui.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index ec9c5063e..1db2a959d 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -1817,6 +1817,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.destroy_sampler.sampler); _sg_imgui_snprintf(&str, "%d: sg_destroy_sampler(smp=%s)", index, res_id.buf); } + break; case SG_IMGUI_CMD_DESTROY_SHADER: { @@ -1953,6 +1954,7 @@ _SOKOL_PRIVATE sg_imgui_str_t _sg_imgui_capture_item_string(sg_imgui_t* ctx, int sg_imgui_str_t res_id = _sg_imgui_sampler_id_string(ctx, item->args.alloc_sampler.result); _sg_imgui_snprintf(&str, "%d: sg_alloc_sampler() => %s", index, res_id.buf); } + break; case SG_IMGUI_CMD_ALLOC_SHADER: { From 3b69571d76b9108a40914b258e5dedc209be2150 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 16:55:35 +0200 Subject: [PATCH 056/292] sokol_gfx.h: fix sign conversion warning (this time for realz) --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b9b378cd3..a1c02ec1c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -14801,8 +14801,8 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { } } // each image and sampler must be referenced by an image sampler - const uint32_t expected_img_slot_mask = (1 << (uint32_t)num_images) - 1; - const uint32_t expected_smp_slot_mask = (1 << (uint32_t)num_samplers) - 1; + const uint32_t expected_img_slot_mask = (uint32_t)((1 << num_images) - 1); + const uint32_t expected_smp_slot_mask = (uint32_t)((1 << num_samplers) - 1); uint32_t actual_img_slot_mask = 0; uint32_t actual_smp_slot_mask = 0; for (int img_smp_index = 0; img_smp_index < num_image_samplers; img_smp_index++) { From 159bb444872b5b43cb43bccd816e5ed8bc4db8c9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 24 Jun 2023 18:08:40 +0200 Subject: [PATCH 057/292] sokol_imgui.h, sokol_nuklear.h: remove sampler state from texture handles. On platforms with 32-bit pointers (e.g. WASM), the default Dear ImGui and Nuklear texture handles are not wide enough to store both a sokol-gfx image and sampler handle. --- util/sokol_imgui.h | 25 ++++++++----------------- util/sokol_nuklear.h | 26 +++++++++----------------- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 5edb834ba..614a9b291 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -209,9 +209,9 @@ simgui_shutdown() --- use the following helper function to create an ImTextureID handle from - a sokol-gfx image and sampler handle: + a sokol-gfx image (note that you cannot provide your own sampler currently): - ImTextureID tex_id = simgui_imtextureid(img, smp); + ImTextureID tex_id = simgui_imtextureid(img); ...an invalid handle {SG_INVALID_ID} will be replaced with the default font texture or default sampler object @@ -340,7 +340,7 @@ typedef struct simgui_frame_desc_t { SOKOL_IMGUI_API_DECL void simgui_setup(const simgui_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); -SOKOL_IMGUI_API_DECL void* simgui_imtextureid(sg_image img, sg_sampler smp); +SOKOL_IMGUI_API_DECL void* simgui_imtextureid(sg_image img); #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) SOKOL_IMGUI_API_DECL bool simgui_handle_event(const sapp_event* ev); SOKOL_IMGUI_API_DECL int simgui_map_keycode(sapp_keycode keycode); // returns ImGuiKey_* @@ -1715,21 +1715,13 @@ static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { } static uint32_t _simgui_imageid_from_texid(ImTextureID tex_id) { - uint32_t img_id = (uint32_t)(((uintptr_t)tex_id) & 0xFFFFFFFF); + uint32_t img_id = (uint32_t)(uintptr_t)tex_id; if (0 == img_id) { img_id = _simgui.img.id; } return img_id; } -static uint32_t _simgui_samplerid_from_texid(ImTextureID tex_id) { - uint32_t smp_id = (uint32_t)((((uintptr_t)tex_id) >> 32) & 0xFFFFFFFF); - if (0 == smp_id) { - smp_id = _simgui.smp.id; - } - return smp_id; -} - SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { SOKOL_ASSERT(desc); _simgui_clear(&_simgui, sizeof(_simgui)); @@ -1826,7 +1818,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { smp_desc.mag_filter = SG_FILTER_LINEAR; smp_desc.mipmap_filter = SG_FILTER_NONE; _simgui.smp = sg_make_sampler(&smp_desc); - io->Fonts->TexID = simgui_imtextureid(_simgui.img, _simgui.smp); + io->Fonts->TexID = simgui_imtextureid(_simgui.img); // shader object for using the embedded shader source (or bytecode) sg_shader_desc shd_desc; @@ -1949,8 +1941,8 @@ SOKOL_API_IMPL void simgui_shutdown(void) { _simgui_free((void*)_simgui.indices.ptr); } -SOKOL_API_IMPL void* simgui_imtextureid(sg_image img, sg_sampler smp) { - return (void*) ((((uint64_t)smp.id) << 32) | (img.id)); +SOKOL_API_IMPL void* simgui_imtextureid(sg_image img) { + return (void*)(uintptr_t)img.id; } SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { @@ -2090,7 +2082,7 @@ SOKOL_API_IMPL void simgui_render(void) { bind.fs.samplers[0] = _simgui.smp; ImTextureID tex_id = io->Fonts->TexID; bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); - bind.fs.samplers[0].id = _simgui_samplerid_from_texid(tex_id); + bind.fs.samplers[0] = _simgui.smp; int vb_offset = 0; int ib_offset = 0; for (int cl_index = 0; cl_index < cmd_list_count; cl_index++) { @@ -2120,7 +2112,6 @@ SOKOL_API_IMPL void simgui_render(void) { tex_id = pcmd->TextureId; vtx_offset = pcmd->VtxOffset; bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); - bind.fs.samplers[0].id = _simgui_samplerid_from_texid(tex_id); bind.vertex_buffer_offsets[0] = vb_offset + (int)(pcmd->VtxOffset * sizeof(ImDrawVert)); sg_apply_bindings(&bind); } diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 6cd14027f..184440349 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -156,10 +156,12 @@ and hide the onscreen keyboard as required. --- NOTE: to create a Nuklear image handle, use the helper function - `nk_handle snk_nkhandle(sg_image img, sg_sampler smp)` together with + `nk_handle snk_nkhandle(sg_image img)` together with the Nuklear function nk_image_handle like this: - nk_image_handle(snk_nkhandle(img, smp)) + nk_image_handle(snk_nkhandle(img)) + + Note that it's currently not possible to provide a custom sg_sampler object. LICENSE ======= @@ -227,7 +229,7 @@ typedef struct snk_desc_t { SOKOL_NUKLEAR_API_DECL void snk_setup(const snk_desc_t* desc); SOKOL_NUKLEAR_API_DECL struct nk_context* snk_new_frame(void); SOKOL_NUKLEAR_API_DECL void snk_render(int width, int height); -SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(sg_image img, sg_sampler smp); +SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(sg_image img); #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) SOKOL_NUKLEAR_API_DECL void snk_handle_event(const sapp_event* ev); SOKOL_NUKLEAR_API_DECL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter); @@ -1825,28 +1827,18 @@ SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { return &_snuklear.ctx; } -SOKOL_API_IMPL nk_handle snk_nkhandle(sg_image img, sg_sampler smp) { - return (nk_handle) { - .ptr = (void*)(uintptr_t)(((uint64_t)img.id << 32) | smp.id) - }; +SOKOL_API_IMPL nk_handle snk_nkhandle(sg_image img) { + return (nk_handle) { .ptr = (void*)(uintptr_t)img.id }; } _SOKOL_PRIVATE uint32_t _snk_imageid_from_nkhandle(nk_handle h) { - uint32_t img_id = (uint32_t)(((uintptr_t)h.ptr) & 0xFFFFFFFF); + uint32_t img_id = (uint32_t)(uintptr_t)h.ptr; if (0 == img_id) { img_id = _snuklear.img.id; } return img_id; } -_SOKOL_PRIVATE uint32_t _snk_samplerid_from_nkhandle(nk_handle h) { - uint32_t smp_id = (uint32_t)((((uintptr_t)h.ptr) >> 32) & 0xFFFFFFFF); - if (0 == smp_id) { - smp_id = _snuklear.smp.id; - } - return smp_id; -} - SOKOL_API_IMPL void snk_render(int width, int height) { static const struct nk_draw_vertex_layout_element vertex_layout[] = { {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct _snk_vertex_t, pos)}, @@ -1901,7 +1893,7 @@ SOKOL_API_IMPL void snk_render(int width, int height) { if (cmd->elem_count > 0) { sg_apply_bindings(&(sg_bindings){ .fs.images[0].id = _snk_imageid_from_nkhandle(cmd->texture), - .fs.samplers[0].id = _snk_samplerid_from_nkhandle(cmd->texture), + .fs.samplers[0] = _snuklear.smp, .vertex_buffers[0] = _snuklear.vbuf, .index_buffer = _snuklear.ibuf, .vertex_buffer_offsets[0] = 0, From 02ba77f40ea9be8f41e03d19b42558cc5f400f0e Mon Sep 17 00:00:00 2001 From: Pixeller Date: Sun, 25 Jun 2023 03:16:43 +0800 Subject: [PATCH 058/292] Update gen_bindings.yml --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index b547ac36a..fe3a9b46e 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -125,7 +125,7 @@ jobs: steps: - uses: jiro4989/setup-nim-action@v1 with: - nim-version: 1.6.12 + nim-version: devel repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v3 with: From 7ec61b183239aa5b67be6a351a9ad04b42966782 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 25 Jun 2023 13:32:36 +0200 Subject: [PATCH 059/292] sokol_spine.h: fix image-sampler handling to work with 32-bit pointers --- util/sokol_spine.h | 71 ++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index d599e106b..e9db24d77 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -2640,6 +2640,11 @@ typedef struct { _sspine_atlas_t* ptr; } _sspine_atlas_ref_t; +typedef struct { + sg_image img; + sg_sampler smp; +} _sspine_image_sampler_pair_t; + typedef struct { _sspine_slot_t slot; _sspine_atlas_ref_t atlas; @@ -2781,9 +2786,9 @@ void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) { (void)self; (void)path; } -static void _sspine_destroy_atlas_image_sampler(spAtlasPage* p); +static void _sspine_delete_image_sampler_pair(const _sspine_image_sampler_pair_t* isp); void _spAtlasPage_disposeTexture(spAtlasPage* self) { - _sspine_destroy_atlas_image_sampler(self); + _sspine_delete_image_sampler_pair((const _sspine_image_sampler_pair_t*) self->rendererObject); } char* _spUtil_readFile(const char* path, int* length) { @@ -3319,21 +3324,32 @@ static sspine_atlas _sspine_alloc_atlas(void) { } } -static void* _sspine_renderobject_handle(sg_image img, sg_sampler smp) { - return (void*) ((((uint64_t)smp.id) << 32) | (img.id)); +static const _sspine_image_sampler_pair_t* _sspine_new_image_sampler_pair(sg_image img, sg_sampler smp) { + _sspine_image_sampler_pair_t* isp = _sspine_malloc_clear(sizeof(_sspine_image_sampler_pair_t)); + SOKOL_ASSERT(isp); + isp->img = img; + isp->smp = smp; + return isp; } -static sg_image _sspine_image_from_renderobject_handle(void* render_object) { - SOKOL_ASSERT(render_object); - uint32_t img_id = (uint32_t)(((uintptr_t)render_object) & 0xFFFFFFFF); - sg_image img = { img_id }; - return img; +static void _sspine_delete_image_sampler_pair(const _sspine_image_sampler_pair_t* isp) { + if (isp) { + sg_destroy_sampler(isp->smp); + sg_destroy_image(isp->img); + _sspine_free((void*)isp); + } } -static sg_sampler _sspine_sampler_from_renderobject_handle(void* render_object) { - uint32_t smp_id = (uint32_t)((((uintptr_t)render_object) >> 32) & 0xFFFFFFFF); - sg_sampler smp = { smp_id }; - return smp; +static sg_image _sspine_image_from_renderer_object(void* renderer_object) { + SOKOL_ASSERT(renderer_object); + const _sspine_image_sampler_pair_t* isp = (const _sspine_image_sampler_pair_t*)renderer_object; + return isp->img; +} + +static sg_sampler _sspine_sampler_from_renderer_object(void* renderer_object) { + SOKOL_ASSERT(renderer_object); + const _sspine_image_sampler_pair_t* isp = (const _sspine_image_sampler_pair_t*)renderer_object; + return isp->smp; } static sspine_resource_state _sspine_init_atlas(_sspine_atlas_t* atlas, const sspine_atlas_desc* desc) { @@ -3369,7 +3385,12 @@ static sspine_resource_state _sspine_init_atlas(_sspine_atlas_t* atlas, const ss _SSPINE_ERROR(SG_ALLOC_SAMPLER_FAILED); return SSPINE_RESOURCESTATE_FAILED; } - page->rendererObject = _sspine_renderobject_handle(img, smp); + + // need to put the image and sampler handle into a heap-alloc unfortunately, + // because a void* isn't big enough to stash two 32-bit handles into + // it directly on platforms with 32-bit pointers (like wasm) + page->rendererObject = (void*) _sspine_new_image_sampler_pair(img, smp); + if (desc->override.premul_alpha_enabled) { // NOTE: -1 is spine-c convention for 'true' page->pma = -1; @@ -3425,16 +3446,6 @@ static spAtlasPage* _sspine_lookup_atlas_page(uint32_t atlas_id, int page_index) return 0; } -static void _sspine_destroy_atlas_image_sampler(spAtlasPage* p) { - SOKOL_ASSERT(p); - if (p->rendererObject != 0) { - const sg_image img = _sspine_image_from_renderobject_handle(p->rendererObject); - const sg_sampler smp = _sspine_sampler_from_renderobject_handle(p->rendererObject); - sg_destroy_image(img); - sg_destroy_sampler(smp); - } -} - // ███████ ██ ██ ███████ ██ ███████ ████████ ██████ ███ ██ // ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ // ███████ █████ █████ ██ █████ ██ ██ ██ ██ ██ ██ @@ -4159,8 +4170,8 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in num_indices = 6; uvs = region->uvs; const spAtlasPage* sp_page = ((spAtlasRegion*)region->rendererObject)->page; - img = _sspine_image_from_renderobject_handle(sp_page->rendererObject); - smp = _sspine_sampler_from_renderobject_handle(sp_page->rendererObject); + img = _sspine_image_from_renderer_object(sp_page->rendererObject); + smp = _sspine_sampler_from_renderer_object(sp_page->rendererObject); premul_alpha = sp_page->pma != 0; } else if (sp_slot->attachment->type == SP_ATTACHMENT_MESH) { spMeshAttachment* mesh = (spMeshAttachment*)sp_slot->attachment; @@ -4179,8 +4190,8 @@ static void _sspine_draw_instance(_sspine_context_t* ctx, _sspine_instance_t* in num_indices = mesh->trianglesCount; // actually indicesCount??? uvs = mesh->uvs; const spAtlasPage* sp_page = ((spAtlasRegion*)mesh->rendererObject)->page; - img = _sspine_image_from_renderobject_handle(sp_page->rendererObject); - smp = _sspine_sampler_from_renderobject_handle(sp_page->rendererObject); + img = _sspine_image_from_renderer_object(sp_page->rendererObject); + smp = _sspine_sampler_from_renderer_object(sp_page->rendererObject); premul_alpha = sp_page->pma != 0; } else if (sp_slot->attachment->type == SP_ATTACHMENT_CLIPPING) { spClippingAttachment* clip_attachment = (spClippingAttachment*) sp_slot->attachment; @@ -4447,8 +4458,8 @@ static void _sspine_init_image_info(const _sspine_atlas_t* atlas, int index, ssp SOKOL_ASSERT(page); SOKOL_ASSERT(page->name); info->valid = true; - info->sgimage = _sspine_image_from_renderobject_handle(page->rendererObject); - info->sgsampler = _sspine_sampler_from_renderobject_handle(page->rendererObject); + info->sgimage = _sspine_image_from_renderer_object(page->rendererObject); + info->sgsampler = _sspine_sampler_from_renderer_object(page->rendererObject); if (with_overrides && (atlas->overrides.min_filter != _SG_FILTER_DEFAULT)) { info->min_filter = atlas->overrides.min_filter; } else { From 899315018884b0722731756364c2169d87fea1aa Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 25 Jun 2023 13:39:24 +0200 Subject: [PATCH 060/292] sokol_spine.h: fix c++ build --- util/sokol_spine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index e9db24d77..5a9125aea 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -3325,7 +3325,7 @@ static sspine_atlas _sspine_alloc_atlas(void) { } static const _sspine_image_sampler_pair_t* _sspine_new_image_sampler_pair(sg_image img, sg_sampler smp) { - _sspine_image_sampler_pair_t* isp = _sspine_malloc_clear(sizeof(_sspine_image_sampler_pair_t)); + _sspine_image_sampler_pair_t* isp = (_sspine_image_sampler_pair_t*) _sspine_malloc_clear(sizeof(_sspine_image_sampler_pair_t)); SOKOL_ASSERT(isp); isp->img = img; isp->smp = smp; From 4effe89578359f1edc5bf73e8f91aa674f63a37d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 25 Jun 2023 14:34:22 +0200 Subject: [PATCH 061/292] sokol_gfx gl: add missing win gl loader decls, fix glSamplerParameteri vs glSamplerParameterf for min/max lod --- sokol_gfx.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a1c02ec1c..cea4426e1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3865,6 +3865,9 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_FRAMEBUFFER_SRGB 0x8DB9 + #define GL_TEXTURE_COMPARE_MODE 0x884C + #define GL_TEXTURE_COMPARE_FUNC 0x884D + #define GL_COMPARE_REF_TO_TEXTURE 0x884E #endif #ifndef GL_UNSIGNED_INT_2_10_10_10_REV @@ -5883,7 +5886,13 @@ _SOKOL_PRIVATE void _sg_dummy_update_image(_sg_image_t* img, const sg_image_data _SG_XMACRO(glGenVertexArrays, void, (GLsizei n, GLuint * arrays)) \ _SG_XMACRO(glFrontFace, void, (GLenum mode)) \ _SG_XMACRO(glCullFace, void, (GLenum mode)) \ - _SG_XMACRO(glPixelStorei, void, (GLenum pname, GLint param)) + _SG_XMACRO(glPixelStorei, void, (GLenum pname, GLint param)) \ + _SG_XMACRO(glBindSampler, void, (GLuint unit, GLuint sampler)) \ + _SG_XMACRO(glGenSamplers, void, (GLsizei n, GLuint* samplers)) \ + _SG_XMACRO(glSamplerParameteri, void, (GLuint sampler, GLenum pname, GLint param)) \ + _SG_XMACRO(glSamplerParameterf, void, (GLuint sampler, GLenum pname, GLfloat param)) \ + _SG_XMACRO(glSamplerParameterfv, void, (GLuint sampler, GLenum pname, const GLfloat* params)) \ + _SG_XMACRO(glDeleteSamplers, void, (GLsizei n, const GLuint* samplers)) // generate GL function pointer typedefs #define _SG_XMACRO(name, ret, args) typedef ret (GL_APIENTRY* PFN_ ## name) args; @@ -7227,8 +7236,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_sampler(_sg_sampler_t* smp, const // GL spec has strange defaults for mipmap min/max lod: -1000 to +1000 const float min_lod = _sg_clamp(desc->min_lod, 0.0f, 1000.0f); const float max_lod = _sg_clamp(desc->max_lod, 0.0f, 1000.0f); - glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MIN_LOD, min_lod); - glSamplerParameteri(smp->gl.smp, GL_TEXTURE_MAX_LOD, max_lod); + glSamplerParameterf(smp->gl.smp, GL_TEXTURE_MIN_LOD, min_lod); + glSamplerParameterf(smp->gl.smp, GL_TEXTURE_MAX_LOD, max_lod); glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_S, (GLint)_sg_gl_wrap(smp->cmn.wrap_u)); glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_T, (GLint)_sg_gl_wrap(smp->cmn.wrap_v)); glSamplerParameteri(smp->gl.smp, GL_TEXTURE_WRAP_R, (GLint)_sg_gl_wrap(smp->cmn.wrap_w)); From ada81f073d8d2a776cda46344c09894459543de5 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 25 Jun 2023 15:28:14 +0200 Subject: [PATCH 062/292] sokol_gfx.h iOS/macOS: fix feature availability code (mainly clamp-to-border) --- sokol_gfx.h | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index cea4426e1..cab296b63 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -10228,11 +10228,15 @@ _SOKOL_PRIVATE MTLStoreAction _sg_mtl_store_action(sg_store_action a, bool resol } _SOKOL_PRIVATE MTLResourceOptions _sg_mtl_resource_options_storage_mode_managed_or_shared(void) { + #if defined(_SG_TARGET_MACOS) if (_sg.mtl.force_managed_storage_mode || !_sg.mtl.has_unified_memory) { return MTLResourceStorageModeManaged; } else { return MTLResourceStorageModeShared; } + #else + return MTLResourceStorageModeShared; + #endif } _SOKOL_PRIVATE MTLResourceOptions _sg_mtl_buffer_resource_options(sg_usage usg) { @@ -10493,22 +10497,29 @@ _SOKOL_PRIVATE bool _sg_mtl_is_pvrtc(sg_pixel_format fmt) { } _SOKOL_PRIVATE MTLSamplerAddressMode _sg_mtl_address_mode(sg_wrap w) { + if (_sg.features.image_clamp_to_border) { + if (@available(macOS 12.0, iOS 14.0, *)) { + // border color feature available + switch (w) { + case SG_WRAP_REPEAT: return MTLSamplerAddressModeRepeat; + case SG_WRAP_CLAMP_TO_EDGE: return MTLSamplerAddressModeClampToEdge; + case SG_WRAP_CLAMP_TO_BORDER: return MTLSamplerAddressModeClampToBorderColor; + case SG_WRAP_MIRRORED_REPEAT: return MTLSamplerAddressModeMirrorRepeat; + default: SOKOL_UNREACHABLE; return (MTLSamplerAddressMode)0; + } + } + } + // fallthrough: clamp to border no supported switch (w) { case SG_WRAP_REPEAT: return MTLSamplerAddressModeRepeat; case SG_WRAP_CLAMP_TO_EDGE: return MTLSamplerAddressModeClampToEdge; - #if defined(_SG_TARGET_MACOS) - case SG_WRAP_CLAMP_TO_BORDER: return MTLSamplerAddressModeClampToBorderColor; - #else - // clamp-to-border not supported on iOS, fall back to clamp-to-edge case SG_WRAP_CLAMP_TO_BORDER: return MTLSamplerAddressModeClampToEdge; - #endif case SG_WRAP_MIRRORED_REPEAT: return MTLSamplerAddressModeMirrorRepeat; default: SOKOL_UNREACHABLE; return (MTLSamplerAddressMode)0; } } -#if defined(_SG_TARGET_MACOS) -_SOKOL_PRIVATE MTLSamplerBorderColor _sg_mtl_border_color(sg_border_color c) { +_SOKOL_PRIVATE API_AVAILABLE(ios(14.0), macos(12.0)) MTLSamplerBorderColor _sg_mtl_border_color(sg_border_color c) { switch (c) { case SG_BORDERCOLOR_TRANSPARENT_BLACK: return MTLSamplerBorderColorTransparentBlack; case SG_BORDERCOLOR_OPAQUE_BLACK: return MTLSamplerBorderColorOpaqueBlack; @@ -10516,7 +10527,6 @@ _SOKOL_PRIVATE MTLSamplerBorderColor _sg_mtl_border_color(sg_border_color c) { default: SOKOL_UNREACHABLE; return (MTLSamplerBorderColor)0; } } -#endif _SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter f) { switch (f) { @@ -10683,10 +10693,17 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { _sg.features.origin_top_left = true; _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; + + _sg.features.image_clamp_to_border = false; if (@available(macOS 12.0, iOS 14.0, *)) { - _sg.features.image_clamp_to_border = true; - } else { - _sg.features.image_clamp_to_border = false; + _sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyApple7] + || [_sg.mtl.device supportsFamily:MTLGPUFamilyApple8] + || [_sg.mtl.device supportsFamily:MTLGPUFamilyMac2]; + if (!_sg.features.image_clamp_to_border) { + if (@available(macOS 13.0, iOS 16.0, *)) { + _sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyMetal3]; + } + } } #if defined(_SG_TARGET_MACOS) @@ -11103,7 +11120,9 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, cons mtl_desc.tAddressMode = _sg_mtl_address_mode(desc->wrap_v); mtl_desc.rAddressMode = _sg_mtl_address_mode(desc->wrap_w); if (_sg.features.image_clamp_to_border) { - mtl_desc.borderColor = _sg_mtl_border_color(desc->border_color); + if (@available(macOS 12.0, iOS 14.0, *)) { + mtl_desc.borderColor = _sg_mtl_border_color(desc->border_color); + } } mtl_desc.minFilter = _sg_mtl_minmag_filter(desc->min_filter); mtl_desc.magFilter = _sg_mtl_minmag_filter(desc->mag_filter); @@ -11849,9 +11868,11 @@ _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* dat __unsafe_unretained id mtl_buf = _sg_mtl_id(buf->mtl.buf[buf->cmn.active_slot]); void* dst_ptr = [mtl_buf contents]; memcpy(dst_ptr, data->ptr, data->size); + #if defined(_SG_TARGET_MACOS) if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { [mtl_buf didModifyRange:NSMakeRange(0, data->size)]; } + #endif } _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { @@ -11865,9 +11886,11 @@ _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data uint8_t* dst_ptr = (uint8_t*) [mtl_buf contents]; dst_ptr += buf->cmn.append_pos; memcpy(dst_ptr, data->ptr, data->size); + #if defined(_SG_TARGET_MACOS) if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; } + #endif // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backends return _sg_roundup((int)data->size, 4); } From dcbafab90b0f20dcead065940d6238f91a8776af Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 26 Jun 2023 15:48:10 +0200 Subject: [PATCH 063/292] sokol_gfx.h: fix pass-desc validation to allow no color attachments --- sokol_gfx.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index cab296b63..f6a4da2ce 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2972,7 +2972,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4, "sg_pipeline_desc.layout.buffers[].stride must be multiple of 4") \ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_ATTR_SEMANTICS, "D3D11 missing vertex attribute semantics in shader") \ _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_CANARY, "sg_pass_desc not initialized") \ - _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_NO_COLOR_ATTS, "sg_pass_desc.color_attachments[0] must be valid") \ + _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_NO_ATTACHMENTS, "sg_pass_desc no color or depth-stencil attachments") \ _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_NO_CONT_COLOR_ATTS, "color attachments must occupy continuous slots") \ _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_IMAGE, "pass attachment image is not valid") \ _SG_LOGITEM_XMACRO(VALIDATE_PASSDESC_MIPLEVEL, "pass attachment mip level is bigger than image has mipmaps") \ @@ -14906,16 +14906,17 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_PASSDESC_CANARY); _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_PASSDESC_CANARY); bool atts_cont = true; - int width = -1, height = -1, sample_count = -1; + int color_width = -1, color_height = -1, color_sample_count = -1; + bool has_color_atts = false; // color attachments for (int att_index = 0; att_index < SG_MAX_COLOR_ATTACHMENTS; att_index++) { const sg_pass_attachment_desc* att = &desc->color_attachments[att_index]; if (att->image.id == SG_INVALID_ID) { - _SG_VALIDATE(att_index > 0, VALIDATE_PASSDESC_NO_COLOR_ATTS); atts_cont = false; continue; } _SG_VALIDATE(atts_cont, VALIDATE_PASSDESC_NO_CONT_COLOR_ATTS); + has_color_atts = true; const _sg_image_t* img = _sg_lookup_image(&_sg.pools, att->image.id); _SG_VALIDATE(img, VALIDATE_PASSDESC_IMAGE); if (0 != img) { @@ -14930,13 +14931,13 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_SLICE); } if (att_index == 0) { - width = img->cmn.width >> att->mip_level; - height = img->cmn.height >> att->mip_level; - sample_count = img->cmn.sample_count; + color_width = img->cmn.width >> att->mip_level; + color_height = img->cmn.height >> att->mip_level; + color_sample_count = img->cmn.sample_count; } else { - _SG_VALIDATE(width == img->cmn.width >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); - _SG_VALIDATE(height == img->cmn.height >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); - _SG_VALIDATE(sample_count == img->cmn.sample_count, VALIDATE_PASSDESC_IMAGE_SAMPLE_COUNTS); + _SG_VALIDATE(color_width == img->cmn.width >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); + _SG_VALIDATE(color_height == img->cmn.height >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); + _SG_VALIDATE(color_sample_count == img->cmn.sample_count, VALIDATE_PASSDESC_IMAGE_SAMPLE_COUNTS); } _SG_VALIDATE(_sg_is_valid_rendertarget_color_format(img->cmn.pixel_format), VALIDATE_PASSDESC_COLOR_INV_PIXELFORMAT); @@ -14960,16 +14961,18 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(res_att->slice < res_img->cmn.num_slices, VALIDATE_PASSDESC_RESOLVE_SLICE); } _SG_VALIDATE(img->cmn.pixel_format == res_img->cmn.pixel_format, VALIDATE_PASSDESC_RESOLVE_IMAGE_FORMAT); - _SG_VALIDATE(width == res_img->cmn.width >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); - _SG_VALIDATE(height == res_img->cmn.height >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); + _SG_VALIDATE(color_width == res_img->cmn.width >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); + _SG_VALIDATE(color_height == res_img->cmn.height >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); } } } } + bool has_depth_stencil_att; if (desc->depth_stencil_attachment.image.id != SG_INVALID_ID) { const sg_pass_attachment_desc* att = &desc->depth_stencil_attachment; const _sg_image_t* img = _sg_lookup_image(&_sg.pools, att->image.id); _SG_VALIDATE(img, VALIDATE_PASSDESC_DEPTH_IMAGE); + has_depth_stencil_att = true; if (img) { _SG_VALIDATE(img->slot.state == SG_RESOURCESTATE_VALID, VALIDATE_PASSDESC_DEPTH_IMAGE); _SG_VALIDATE(att->mip_level < img->cmn.num_mipmaps, VALIDATE_PASSDESC_DEPTH_MIPLEVEL); @@ -14982,12 +14985,13 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_DEPTH_SLICE); } _SG_VALIDATE(img->cmn.render_target, VALIDATE_PASSDESC_DEPTH_IMAGE_NO_RT); - _SG_VALIDATE(width == img->cmn.width >> att->mip_level, VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); - _SG_VALIDATE(height == img->cmn.height >> att->mip_level, VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); - _SG_VALIDATE(sample_count == img->cmn.sample_count, VALIDATE_PASSDESC_DEPTH_IMAGE_SAMPLE_COUNT); + _SG_VALIDATE((color_width == -1) || (color_width == img->cmn.width >> att->mip_level), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); + _SG_VALIDATE((color_height == -1) || (color_height == img->cmn.height >> att->mip_level), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); + _SG_VALIDATE((color_sample_count == -1) || (color_sample_count == img->cmn.sample_count), VALIDATE_PASSDESC_DEPTH_IMAGE_SAMPLE_COUNT); _SG_VALIDATE(_sg_is_valid_rendertarget_depth_format(img->cmn.pixel_format), VALIDATE_PASSDESC_DEPTH_INV_PIXELFORMAT); } } + _SG_VALIDATE(has_color_atts || has_depth_stencil_att, VALIDATE_PASSDESC_NO_ATTACHMENTS); return _sg_validate_end(); #endif } From a9a00418a9a638a4c4a6ef5d7d729acf8f6ea11c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 26 Jun 2023 16:26:01 +0200 Subject: [PATCH 064/292] sokol_gfx.h: handle depth-only special case when patching pipeline desc defaults --- sokol_gfx.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index f6a4da2ce..a53b6b7b1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4190,7 +4190,7 @@ typedef struct { } _sg_pipeline_common_t; _SOKOL_PRIVATE void _sg_pipeline_common_init(_sg_pipeline_common_t* cmn, const sg_pipeline_desc* desc) { - SOKOL_ASSERT((desc->color_count >= 1) && (desc->color_count <= SG_MAX_COLOR_ATTACHMENTS)); + SOKOL_ASSERT((desc->color_count >= 0) && (desc->color_count <= SG_MAX_COLOR_ATTACHMENTS)); for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++) { cmn->vertex_buffer_layout_active[i] = false; } @@ -15457,7 +15457,12 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des def.depth.compare = _sg_def(def.depth.compare, SG_COMPAREFUNC_ALWAYS); def.depth.pixel_format = _sg_def(def.depth.pixel_format, _sg.desc.context.depth_format); - def.color_count = _sg_def(def.color_count, 1); + if (def.colors[0].pixel_format == SG_PIXELFORMAT_NONE) { + // special case depth-only rendering, enforce a color count of 0 + def.color_count = 0; + } else { + def.color_count = _sg_def(def.color_count, 1); + } if (def.color_count > SG_MAX_COLOR_ATTACHMENTS) { def.color_count = SG_MAX_COLOR_ATTACHMENTS; } From aaee17256c211e879f5ff49884419ce111963048 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 27 Jun 2023 19:00:48 +0200 Subject: [PATCH 065/292] sokol_gfx.h: move common-init funcs out of backends --- sokol_gfx.h | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a53b6b7b1..5fa344c58 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5559,7 +5559,6 @@ _SOKOL_PRIVATE void _sg_dummy_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); - _sg_buffer_common_init(&buf->cmn, desc); return SG_RESOURCESTATE_VALID; } @@ -5570,7 +5569,6 @@ _SOKOL_PRIVATE void _sg_dummy_discard_buffer(_sg_buffer_t* buf) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); - _sg_image_common_init(&img->cmn, desc); return SG_RESOURCESTATE_VALID; } @@ -5581,7 +5579,6 @@ _SOKOL_PRIVATE void _sg_dummy_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); - _sg_sampler_common_init(&smp->cmn, desc); return SG_RESOURCESTATE_VALID; } @@ -5592,7 +5589,6 @@ _SOKOL_PRIVATE void _sg_dummy_discard_sampler(_sg_sampler_t* smp) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); - _sg_shader_common_init(&shd->cmn, desc); return SG_RESOURCESTATE_VALID; } @@ -5604,7 +5600,6 @@ _SOKOL_PRIVATE void _sg_dummy_discard_shader(_sg_shader_t* shd) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && desc); pip->shader = shd; - _sg_pipeline_common_init(&pip->cmn, desc); for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) { const sg_vertex_attr_state* a_state = &desc->layout.attrs[attr_index]; if (a_state->format == SG_VERTEXFORMAT_INVALID) { @@ -5625,8 +5620,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_pass(_sg_pass_t* pass, _sg_ima SOKOL_ASSERT(pass && desc); SOKOL_ASSERT(color_images && resolve_images); - _sg_pass_common_init(&pass->cmn, desc); - for (int i = 0; i < pass->cmn.num_color_atts; i++) { const sg_pass_attachment_desc* color_desc = &desc->color_attachments[i]; _SOKOL_UNUSED(color_desc); @@ -7061,7 +7054,6 @@ _SOKOL_PRIVATE void _sg_gl_discard_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_gl_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); _SG_GL_CHECK_ERROR(); - _sg_buffer_common_init(&buf->cmn, desc); buf->gl.injected = (0 != desc->gl_buffers[0]); const GLenum gl_target = _sg_gl_buffer_target(buf->cmn.type); const GLenum gl_usage = _sg_gl_usage(buf->cmn.usage); @@ -7111,7 +7103,6 @@ _SOKOL_PRIVATE bool _sg_gl_supported_texture_format(sg_pixel_format fmt) { _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); _SG_GL_CHECK_ERROR(); - _sg_image_common_init(&img->cmn, desc); img->gl.injected = (0 != desc->gl_textures[0]); // check if texture format is support @@ -7221,7 +7212,6 @@ _SOKOL_PRIVATE void _sg_gl_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_gl_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); _SG_GL_CHECK_ERROR(); - _sg_sampler_common_init(&smp->cmn, desc); smp->gl.injected = (0 != desc->gl_sampler); if (smp->gl.injected) { smp->gl.smp = (GLuint) desc->gl_sampler; @@ -7315,8 +7305,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s SOKOL_ASSERT(!shd->gl.prog); _SG_GL_CHECK_ERROR(); - _sg_shader_common_init(&shd->cmn, desc); - // copy the optional vertex attribute names over for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { _sg_strcpy(&shd->gl.attrs[i].name, desc->attrs[i].name); @@ -7439,7 +7427,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg SOKOL_ASSERT(desc->shader.id == shd->slot.id); SOKOL_ASSERT(shd->gl.prog); pip->shader = shd; - _sg_pipeline_common_init(&pip->cmn, desc); pip->gl.primitive_type = desc->primitive_type; pip->gl.depth = desc->depth; pip->gl.stencil = desc->stencil; @@ -7536,8 +7523,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pass(_sg_pass_t* pass, _sg_image_ SOKOL_ASSERT(color_images && resolve_images); _SG_GL_CHECK_ERROR(); - _sg_pass_common_init(&pass->cmn, desc); - // copy image pointers for (int i = 0; i < pass->cmn.num_color_atts; i++) { const sg_pass_attachment_desc* color_desc = &desc->color_attachments[i]; @@ -9085,7 +9070,6 @@ _SOKOL_PRIVATE void _sg_d3d11_discard_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); SOKOL_ASSERT(!buf->d3d11.buf); - _sg_buffer_common_init(&buf->cmn, desc); const bool injected = (0 != desc->d3d11_buffer); if (injected) { buf->d3d11.buf = (ID3D11Buffer*) desc->d3d11_buffer; @@ -9154,7 +9138,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const SOKOL_ASSERT((0 == img->d3d11.tex2d) && (0 == img->d3d11.tex3d) && (0 == img->d3d11.res) && (0 == img->d3d11.srv)); HRESULT hr; - _sg_image_common_init(&img->cmn, desc); const bool injected = (0 != desc->d3d11_texture) || (0 != desc->d3d11_shader_resource_view); const bool msaa = (img->cmn.sample_count > 1); img->d3d11.format = _sg_d3d11_pixel_format(img->cmn.pixel_format); @@ -9344,7 +9327,6 @@ _SOKOL_PRIVATE void _sg_d3d11_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); SOKOL_ASSERT(0 == smp->d3d11.smp); - _sg_sampler_common_init(&smp->cmn, desc); const bool injected = (0 != desc->d3d11_sampler); if (injected) { smp->d3d11.smp = (ID3D11SamplerState*)desc->d3d11_sampler; @@ -9449,8 +9431,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_shader(_sg_shader_t* shd, cons SOKOL_ASSERT(!shd->d3d11.vs && !shd->d3d11.fs && !shd->d3d11.vs_blob); HRESULT hr; - _sg_shader_common_init(&shd->cmn, desc); - // copy vertex attribute semantic names and indices for (int i = 0; i < SG_MAX_VERTEX_ATTRIBUTES; i++) { _sg_strcpy(&shd->d3d11.attrs[i].sem_name, desc->attrs[i].sem_name); @@ -9555,7 +9535,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pipeline(_sg_pipeline_t* pip, SOKOL_ASSERT(!pip->d3d11.il && !pip->d3d11.rs && !pip->d3d11.dss && !pip->d3d11.bs); pip->shader = shd; - _sg_pipeline_common_init(&pip->cmn, desc); pip->d3d11.index_format = _sg_d3d11_index_format(pip->cmn.index_type); pip->d3d11.topology = _sg_d3d11_primitive_topology(desc->primitive_type); pip->d3d11.stencil_ref = desc->stencil.ref; @@ -9712,8 +9691,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pass(_sg_pass_t* pass, _sg_ima SOKOL_ASSERT(color_images && resolve_images); SOKOL_ASSERT(_sg.d3d11.dev); - _sg_pass_common_init(&pass->cmn, desc); - // copy image pointers for (int i = 0; i < pass->cmn.num_color_atts; i++) { const sg_pass_attachment_desc* color_desc = &desc->color_attachments[i]; @@ -10931,7 +10908,6 @@ _SOKOL_PRIVATE void _sg_mtl_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); - _sg_buffer_common_init(&buf->cmn, desc); const bool injected = (0 != desc->mtl_buffers[0]); MTLResourceOptions mtl_options = _sg_mtl_buffer_resource_options(buf->cmn.usage); for (int slot = 0; slot < buf->cmn.num_slots; slot++) { @@ -11059,7 +11035,6 @@ _SOKOL_PRIVATE void _sg_mtl_init_texdesc_rt_msaa(MTLTextureDescriptor* mtl_desc, _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); - _sg_image_common_init(&img->cmn, desc); const bool injected = (0 != desc->mtl_textures[0]); // first initialize all Metal resource pool slots to 'empty' @@ -11108,7 +11083,6 @@ _SOKOL_PRIVATE void _sg_mtl_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); - _sg_sampler_common_init(&smp->cmn, desc); id mtl_smp; const bool injected = (0 != desc->mtl_sampler); if (injected) { @@ -11176,8 +11150,6 @@ _SOKOL_PRIVATE id _sg_mtl_library_from_bytecode(const void* ptr, siz _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); - _sg_shader_common_init(&shd->cmn, desc); - // create metal library objects and lookup entry functions id vs_lib = nil; id fs_lib = nil; @@ -11254,7 +11226,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s SOKOL_ASSERT(desc->shader.id == shd->slot.id); pip->shader = shd; - _sg_pipeline_common_init(&pip->cmn, desc); sg_primitive_type prim_type = desc->primitive_type; pip->mtl.prim_type = _sg_mtl_primitive_type(prim_type); @@ -11383,8 +11354,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pass(_sg_pass_t* pass, _sg_image SOKOL_ASSERT(pass && desc); SOKOL_ASSERT(color_images && resolve_images); - _sg_pass_common_init(&pass->cmn, desc); - // copy image pointers for (int i = 0; i < pass->cmn.num_color_atts; i++) { const sg_pass_attachment_desc* color_desc = &desc->color_attachments[i]; @@ -12811,7 +12780,6 @@ _SOKOL_PRIVATE void _sg_wgpu_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); const bool injected = (0 != desc->wgpu_buffer); - _sg_buffer_common_init(&buf->cmn, desc); if (injected) { buf->wgpu.buf = (WGPUBuffer) desc->wgpu_buffer; wgpuBufferReference(buf->wgpu.buf); @@ -12867,8 +12835,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - _sg_image_common_init(&img->cmn, desc); - const bool injected = (0 != desc->wgpu_texture); const bool is_msaa = desc->sample_count > 1; WGPUTextureDescriptor wgpu_tex_desc; @@ -12992,7 +12958,6 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); SOKOL_ASSERT(desc->vs.bytecode.ptr && desc->fs.bytecode.ptr); - _sg_shader_common_init(&shd->cmn, desc); bool success = true; for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { @@ -13066,7 +13031,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout); SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout); pip->shader = shd; - _sg_pipeline_common_init(&pip->cmn, desc); pip->wgpu.stencil_ref = (uint32_t) desc->stencil.ref; WGPUBindGroupLayout pip_bgl[3] = { @@ -13199,7 +13163,6 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_pipeline(_sg_pipeline_t* pip) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_image_t** att_images, const sg_pass_desc* desc) { SOKOL_ASSERT(pass && desc); SOKOL_ASSERT(att_images && att_images[0]); - _sg_pass_common_init(&pass->cmn, desc); // copy image pointers and create render-texture views const sg_pass_attachment_desc* att_desc; @@ -15641,6 +15604,7 @@ _SOKOL_PRIVATE void _sg_init_buffer(_sg_buffer_t* buf, const sg_buffer_desc* des SOKOL_ASSERT(desc); buf->slot.ctx_id = _sg.active_context.id; if (_sg_validate_buffer_desc(desc)) { + _sg_buffer_common_init(&buf->cmn, desc); buf->slot.state = _sg_create_buffer(buf, desc); } else { buf->slot.state = SG_RESOURCESTATE_FAILED; @@ -15653,6 +15617,7 @@ _SOKOL_PRIVATE void _sg_init_image(_sg_image_t* img, const sg_image_desc* desc) SOKOL_ASSERT(desc); img->slot.ctx_id = _sg.active_context.id; if (_sg_validate_image_desc(desc)) { + _sg_image_common_init(&img->cmn, desc); img->slot.state = _sg_create_image(img, desc); } else { img->slot.state = SG_RESOURCESTATE_FAILED; @@ -15665,6 +15630,7 @@ _SOKOL_PRIVATE void _sg_init_sampler(_sg_sampler_t* smp, const sg_sampler_desc* SOKOL_ASSERT(desc); smp->slot.ctx_id = _sg.active_context.id; if (_sg_validate_sampler_desc(desc)) { + _sg_sampler_common_init(&smp->cmn, desc); smp->slot.state = _sg_create_sampler(smp, desc); } else { smp->slot.state = SG_RESOURCESTATE_FAILED; @@ -15677,6 +15643,7 @@ _SOKOL_PRIVATE void _sg_init_shader(_sg_shader_t* shd, const sg_shader_desc* des SOKOL_ASSERT(desc); shd->slot.ctx_id = _sg.active_context.id; if (_sg_validate_shader_desc(desc)) { + _sg_shader_common_init(&shd->cmn, desc); shd->slot.state = _sg_create_shader(shd, desc); } else { shd->slot.state = SG_RESOURCESTATE_FAILED; @@ -15691,6 +15658,7 @@ _SOKOL_PRIVATE void _sg_init_pipeline(_sg_pipeline_t* pip, const sg_pipeline_des if (_sg_validate_pipeline_desc(desc)) { _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, desc->shader.id); if (shd && (shd->slot.state == SG_RESOURCESTATE_VALID)) { + _sg_pipeline_common_init(&pip->cmn, desc); pip->slot.state = _sg_create_pipeline(pip, shd, desc); } else { pip->slot.state = SG_RESOURCESTATE_FAILED; @@ -15733,6 +15701,7 @@ _SOKOL_PRIVATE void _sg_init_pass(_sg_pass_t* pass, const sg_pass_desc* desc) { return; } } + _sg_pass_common_init(&pass->cmn, desc); pass->slot.state = _sg_create_pass(pass, color_images, resolve_images, ds_image, desc); } else { pass->slot.state = SG_RESOURCESTATE_FAILED; From 9b55b0a8b4c73b4cd9cb317eb632ed9d3622dc86 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 27 Jun 2023 19:35:54 +0200 Subject: [PATCH 066/292] sokol_gfx.h: miplevel and pass fixes - new helper function _sg_miplevel_dim() to compute mip level width/height/depth - replace all places where miplevel size with computed with _sg_miplevel_dim() - set pass width/height upfront in _sg_pass_common_t - bugfix: pass width/height was wrong when rendering to miplevel > 0 --- sokol_gfx.h | 106 ++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 5fa344c58..236138de1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4219,6 +4219,8 @@ typedef struct { } _sg_pass_attachment_common_t; typedef struct { + int width; + int height; int num_color_atts; _sg_pass_attachment_common_t color_atts[SG_MAX_COLOR_ATTACHMENTS]; _sg_pass_attachment_common_t resolve_atts[SG_MAX_COLOR_ATTACHMENTS]; @@ -4231,7 +4233,10 @@ _SOKOL_PRIVATE void _sg_pass_attachment_common_init(_sg_pass_attachment_common_t cmn->slice = desc->slice; } -_SOKOL_PRIVATE void _sg_pass_common_init(_sg_pass_common_t* cmn, const sg_pass_desc* desc) { +_SOKOL_PRIVATE void _sg_pass_common_init(_sg_pass_common_t* cmn, const sg_pass_desc* desc, int width, int height) { + SOKOL_ASSERT((width > 0) && (height > 0)); + cmn->width = width; + cmn->height = height; for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { if (desc->color_attachments[i].image.id != SG_INVALID_ID) { cmn->num_color_atts++; @@ -5408,6 +5413,11 @@ _SOKOL_PRIVATE int _sg_num_rows(sg_pixel_format fmt, int height) { return num_rows; } +// return size of a mipmap level +_SOKOL_PRIVATE int _sg_miplevel_dim(int base_dim, int mip_level) { + return _sg_max(base_dim >> mip_level, 1); +} + /* return pitch of a 2D subimage / texture slice see ComputePitch in https://github.com/microsoft/DirectXTex/blob/master/DirectXTex/DirectXTexUtil.cpp */ @@ -7147,14 +7157,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ gl_img_target = _sg_gl_cubeface_target(face_index); } const GLvoid* data_ptr = desc->data.subimage[face_index][mip_index].ptr; - int mip_width = img->cmn.width >> mip_index; - if (mip_width == 0) { - mip_width = 1; - } - int mip_height = img->cmn.height >> mip_index; - if (mip_height == 0) { - mip_height = 1; - } + const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); if ((SG_IMAGETYPE_2D == img->cmn.type) || (SG_IMAGETYPE_CUBE == img->cmn.type)) { if (is_compressed) { const GLsizei data_size = (GLsizei) desc->data.subimage[face_index][mip_index].size; @@ -7168,10 +7172,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ } else if ((SG_IMAGETYPE_3D == img->cmn.type) || (SG_IMAGETYPE_ARRAY == img->cmn.type)) { int mip_depth = img->cmn.num_slices; if (SG_IMAGETYPE_3D == img->cmn.type) { - mip_depth >>= mip_index; - } - if (mip_depth == 0) { - mip_depth = 1; + mip_depth = _sg_miplevel_dim(mip_depth, mip_index); } if (is_compressed) { const GLsizei data_size = (GLsizei) desc->data.subimage[face_index][mip_index].size; @@ -8286,14 +8287,8 @@ _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* d gl_img_target = _sg_gl_cubeface_target(face_index); } const GLvoid* data_ptr = data->subimage[face_index][mip_index].ptr; - int mip_width = img->cmn.width >> mip_index; - if (mip_width == 0) { - mip_width = 1; - } - int mip_height = img->cmn.height >> mip_index; - if (mip_height == 0) { - mip_height = 1; - } + int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); if ((SG_IMAGETYPE_2D == img->cmn.type) || (SG_IMAGETYPE_CUBE == img->cmn.type)) { glTexSubImage2D(gl_img_target, mip_index, 0, 0, @@ -8301,9 +8296,9 @@ _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* d gl_img_format, gl_img_type, data_ptr); } else if ((SG_IMAGETYPE_3D == img->cmn.type) || (SG_IMAGETYPE_ARRAY == img->cmn.type)) { - int mip_depth = img->cmn.num_slices >> mip_index; - if (mip_depth == 0) { - mip_depth = 1; + int mip_depth = img->cmn.num_slices; + if (SG_IMAGETYPE_3D == img->cmn.type) { + mip_depth = _sg_miplevel_dim(img->cmn.num_slices, mip_index); } glTexSubImage3D(gl_img_target, mip_index, 0, 0, 0, @@ -9114,8 +9109,8 @@ _SOKOL_PRIVATE void _sg_d3d11_fill_subres_data(const _sg_image_t* img, const sg_ for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++, subres_index++) { SOKOL_ASSERT(subres_index < (SG_MAX_MIPMAPS * SG_MAX_TEXTUREARRAY_LAYERS)); D3D11_SUBRESOURCE_DATA* subres_data = &_sg.d3d11.subres_data[subres_index]; - const int mip_width = ((img->cmn.width>>mip_index)>0) ? img->cmn.width>>mip_index : 1; - const int mip_height = ((img->cmn.height>>mip_index)>0) ? img->cmn.height>>mip_index : 1; + const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); const sg_range* subimg_data = &(data->subimage[face_index][mip_index]); const size_t slice_size = subimg_data->size / (size_t)num_slices; const size_t slice_offset = slice_size * (size_t)slice_index; @@ -9123,7 +9118,7 @@ _SOKOL_PRIVATE void _sg_d3d11_fill_subres_data(const _sg_image_t* img, const sg_ subres_data->pSysMem = ptr + slice_offset; subres_data->SysMemPitch = (UINT)_sg_row_pitch(img->cmn.pixel_format, mip_width, 1); if (img->cmn.type == SG_IMAGETYPE_3D) { - // FIXME? const int mip_depth = ((img->depth>>mip_index)>0) ? img->depth>>mip_index : 1; + // FIXME? const int mip_depth = _sg_miplevel_dim(img->depth, mip_index); subres_data->SysMemSlicePitch = (UINT)_sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, 1); } else { subres_data->SysMemSlicePitch = 0; @@ -10126,8 +10121,8 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data for (int slice_index = 0; slice_index < num_slices; slice_index++) { for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++, subres_index++) { SOKOL_ASSERT(subres_index < (SG_MAX_MIPMAPS * SG_MAX_TEXTUREARRAY_LAYERS)); - const int mip_width = ((img->cmn.width>>mip_index)>0) ? img->cmn.width>>mip_index : 1; - const int mip_height = ((img->cmn.height>>mip_index)>0) ? img->cmn.height>>mip_index : 1; + const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); const int src_pitch = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1); const sg_range* subimg_data = &(data->subimage[face_index][mip_index]); const size_t slice_size = subimg_data->size / (size_t)num_slices; @@ -10945,8 +10940,8 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr SOKOL_ASSERT(data->subimage[face_index][mip_index].ptr); SOKOL_ASSERT(data->subimage[face_index][mip_index].size > 0); const uint8_t* data_ptr = (const uint8_t*)data->subimage[face_index][mip_index].ptr; - const int mip_width = _sg_max(img->cmn.width >> mip_index, 1); - const int mip_height = _sg_max(img->cmn.height >> mip_index, 1); + const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); // special case PVRTC formats: bytePerRow and bytesPerImage must be 0 int bytes_per_row = 0; int bytes_per_slice = 0; @@ -10961,7 +10956,7 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr MTLRegion region; int bytes_per_image; if (img->cmn.type == SG_IMAGETYPE_3D) { - const int mip_depth = _sg_max(img->cmn.num_slices >> mip_index, 1); + const int mip_depth = _sg_miplevel_dim(img->cmn.num_slices, mip_index); region = MTLRegionMake3D(0, 0, 0, (NSUInteger)mip_width, (NSUInteger)mip_height, (NSUInteger)mip_depth); bytes_per_image = bytes_per_slice; // FIXME: apparently the minimal bytes_per_image size for 3D texture is 4 KByte... somehow need to handle this @@ -12434,8 +12429,8 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) const uint32_t num_faces = (img->cmn.type == SG_IMAGETYPE_CUBE) ? 6:1; const uint32_t num_slices = (img->cmn.type == SG_IMAGETYPE_ARRAY) ? img->cmn.num_slices : 1; for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++) { - const uint32_t mip_width = _sg_max(img->cmn.width >> mip_index, 1); - const uint32_t mip_height = _sg_max(img->cmn.height >> mip_index, 1); + const uint32_t mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const uint32_t mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); // row-pitch must be 256-aligend const uint32_t bytes_per_slice = _sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, _SG_WGPU_ROWPITCH_ALIGN); num_bytes += bytes_per_slice * num_slices * num_faces; @@ -12472,9 +12467,9 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st SOKOL_ASSERT(src_base_ptr); uint8_t* dst_base_ptr = stg_base_ptr + stg_offset; - const uint32_t mip_width = _sg_max(img->cmn.width >> mip_index, 1); - const uint32_t mip_height = _sg_max(img->cmn.height >> mip_index, 1); - const uint32_t mip_depth = (img->cmn.type == SG_IMAGETYPE_3D) ? _sg_max(img->cmn.num_slices >> mip_index, 1) : 1; + const uint32_t mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + const uint32_t mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); + const uint32_t mip_depth = (img->cmn.type == SG_IMAGETYPE_3D) ? _sg_miplevel_dim(img->cmn.num_slices, mip_index) : 1; const uint32_t num_rows = _sg_num_rows(fmt, mip_height); const uint32_t src_bytes_per_row = _sg_row_pitch(fmt, mip_width, 1); const uint32_t dst_bytes_per_row = _sg_row_pitch(fmt, mip_width, _SG_WGPU_ROWPITCH_ALIGN); @@ -14563,8 +14558,8 @@ _SOKOL_PRIVATE void _sg_validate_image_data(const sg_image_data* data, sg_pixel_ const bool has_data = data->subimage[face_index][mip_index].ptr != 0; const bool has_size = data->subimage[face_index][mip_index].size > 0; _SG_VALIDATE(has_data && has_size, VALIDATE_IMAGEDATA_NODATA); - const int mip_width = _sg_max(width >> mip_index, 1); - const int mip_height = _sg_max(height >> mip_index, 1); + const int mip_width = _sg_miplevel_dim(width, mip_index); + const int mip_height = _sg_miplevel_dim(height, mip_index); const int bytes_per_slice = _sg_surface_pitch(fmt, mip_width, mip_height, 1); const int expected_size = bytes_per_slice * num_slices; _SG_VALIDATE(expected_size == (int)data->subimage[face_index][mip_index].size, VALIDATE_IMAGEDATA_DATA_SIZE); @@ -14894,12 +14889,12 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_SLICE); } if (att_index == 0) { - color_width = img->cmn.width >> att->mip_level; - color_height = img->cmn.height >> att->mip_level; + color_width = _sg_miplevel_dim(img->cmn.width, att->mip_level); + color_height = _sg_miplevel_dim(img->cmn.height, att->mip_level); color_sample_count = img->cmn.sample_count; } else { - _SG_VALIDATE(color_width == img->cmn.width >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); - _SG_VALIDATE(color_height == img->cmn.height >> att->mip_level, VALIDATE_PASSDESC_IMAGE_SIZES); + _SG_VALIDATE(color_width == _sg_miplevel_dim(img->cmn.width, att->mip_level), VALIDATE_PASSDESC_IMAGE_SIZES); + _SG_VALIDATE(color_height == _sg_miplevel_dim(img->cmn.height, att->mip_level), VALIDATE_PASSDESC_IMAGE_SIZES); _SG_VALIDATE(color_sample_count == img->cmn.sample_count, VALIDATE_PASSDESC_IMAGE_SAMPLE_COUNTS); } _SG_VALIDATE(_sg_is_valid_rendertarget_color_format(img->cmn.pixel_format), VALIDATE_PASSDESC_COLOR_INV_PIXELFORMAT); @@ -14924,8 +14919,8 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(res_att->slice < res_img->cmn.num_slices, VALIDATE_PASSDESC_RESOLVE_SLICE); } _SG_VALIDATE(img->cmn.pixel_format == res_img->cmn.pixel_format, VALIDATE_PASSDESC_RESOLVE_IMAGE_FORMAT); - _SG_VALIDATE(color_width == res_img->cmn.width >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); - _SG_VALIDATE(color_height == res_img->cmn.height >> res_att->mip_level, VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); + _SG_VALIDATE(color_width == _sg_miplevel_dim(res_img->cmn.width, res_att->mip_level), VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); + _SG_VALIDATE(color_height == _sg_miplevel_dim(res_img->cmn.height, res_att->mip_level), VALIDATE_PASSDESC_RESOLVE_IMAGE_SIZES); } } } @@ -14948,8 +14943,8 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { _SG_VALIDATE(att->slice < img->cmn.num_slices, VALIDATE_PASSDESC_DEPTH_SLICE); } _SG_VALIDATE(img->cmn.render_target, VALIDATE_PASSDESC_DEPTH_IMAGE_NO_RT); - _SG_VALIDATE((color_width == -1) || (color_width == img->cmn.width >> att->mip_level), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); - _SG_VALIDATE((color_height == -1) || (color_height == img->cmn.height >> att->mip_level), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); + _SG_VALIDATE((color_width == -1) || (color_width == _sg_miplevel_dim(img->cmn.width, att->mip_level)), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); + _SG_VALIDATE((color_height == -1) || (color_height == _sg_miplevel_dim(img->cmn.height, att->mip_level)), VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); _SG_VALIDATE((color_sample_count == -1) || (color_sample_count == img->cmn.sample_count), VALIDATE_PASSDESC_DEPTH_IMAGE_SAMPLE_COUNT); _SG_VALIDATE(_sg_is_valid_rendertarget_depth_format(img->cmn.pixel_format), VALIDATE_PASSDESC_DEPTH_INV_PIXELFORMAT); } @@ -15678,6 +15673,9 @@ _SOKOL_PRIVATE void _sg_init_pass(_sg_pass_t* pass, const sg_pass_desc* desc) { _sg_image_t* color_images[SG_MAX_COLOR_ATTACHMENTS] = { 0 }; _sg_image_t* resolve_images[SG_MAX_COLOR_ATTACHMENTS] = { 0 }; _sg_image_t* ds_image = 0; + // NOTE: validation already checked that all surfaces are same width/height + int width = 0; + int height = 0; for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { if (desc->color_attachments[i].image.id) { color_images[i] = _sg_lookup_image(&_sg.pools, desc->color_attachments[i].image.id); @@ -15685,6 +15683,9 @@ _SOKOL_PRIVATE void _sg_init_pass(_sg_pass_t* pass, const sg_pass_desc* desc) { pass->slot.state = SG_RESOURCESTATE_FAILED; return; } + const int mip_level = desc->color_attachments[i].mip_level; + width = _sg_miplevel_dim(color_images[i]->cmn.width, mip_level); + height = _sg_miplevel_dim(color_images[i]->cmn.height, mip_level); } if (desc->resolve_attachments[i].image.id) { resolve_images[i] = _sg_lookup_image(&_sg.pools, desc->resolve_attachments[i].image.id); @@ -15700,8 +15701,11 @@ _SOKOL_PRIVATE void _sg_init_pass(_sg_pass_t* pass, const sg_pass_desc* desc) { pass->slot.state = SG_RESOURCESTATE_FAILED; return; } + const int mip_level = desc->depth_stencil_attachment.mip_level; + width = _sg_miplevel_dim(ds_image->cmn.width, mip_level); + height = _sg_miplevel_dim(ds_image->cmn.height, mip_level); } - _sg_pass_common_init(&pass->cmn, desc); + _sg_pass_common_init(&pass->cmn, desc, width, height); pass->slot.state = _sg_create_pass(pass, color_images, resolve_images, ds_image, desc); } else { pass->slot.state = SG_RESOURCESTATE_FAILED; @@ -16629,11 +16633,7 @@ SOKOL_API_IMPL void sg_begin_pass(sg_pass pass_id, const sg_pass_action* pass_ac _sg.pass_valid = true; sg_pass_action pa; _sg_resolve_default_pass_action(pass_action, &pa); - const _sg_image_t* img = _sg_pass_color_image(pass, 0); - SOKOL_ASSERT(img); - const int w = img->cmn.width; - const int h = img->cmn.height; - _sg_begin_pass(pass, &pa, w, h); + _sg_begin_pass(pass, &pa, pass->cmn.width, pass->cmn.height); _SG_TRACE_ARGS(begin_pass, pass_id, &pa); } else { _sg.pass_valid = false; From 2a3bf607ba9a0918d4ae1d48389cc1c8c489bd26 Mon Sep 17 00:00:00 2001 From: Janne Hellsten Date: Fri, 30 Jun 2023 14:21:32 +0300 Subject: [PATCH 067/292] Update zig bindgen produce source that matches "zig fmt" style for #39, #40 --- bindgen/gen_zig.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py index a8768ca36..b1631ebc2 100644 --- a/bindgen/gen_zig.py +++ b/bindgen/gen_zig.py @@ -212,7 +212,7 @@ def as_c_arg_type(arg_type, prefix): elif is_const_struct_ptr(arg_type): return f"[*c]const {as_zig_struct_type(util.extract_ptr_type(arg_type), prefix)}" elif is_prim_ptr(arg_type): - return f"[*c] {as_zig_prim_type(util.extract_ptr_type(arg_type))}" + return f"[*c]{as_zig_prim_type(util.extract_ptr_type(arg_type))}" elif is_const_prim_ptr(arg_type): return f"[*c]const {as_zig_prim_type(util.extract_ptr_type(arg_type))}" else: @@ -242,7 +242,7 @@ def as_zig_arg_type(arg_prefix, arg_type, prefix): # not a bug, pass const structs by value return pre + f"{as_zig_struct_type(util.extract_ptr_type(arg_type), prefix)}" elif is_prim_ptr(arg_type): - return pre + f"* {as_zig_prim_type(util.extract_ptr_type(arg_type))}" + return pre + f"*{as_zig_prim_type(util.extract_ptr_type(arg_type))}" elif is_const_prim_ptr(arg_type): return pre + f"*const {as_zig_prim_type(util.extract_ptr_type(arg_type))}" else: @@ -323,7 +323,7 @@ def gen_struct(decl, prefix): if is_prim_type(field_type): l(f" {field_name}: {as_zig_prim_type(field_type)} = {type_default_value(field_type)},") elif is_struct_type(field_type): - l(f" {field_name}: {as_zig_struct_type(field_type, prefix)} = .{{ }},") + l(f" {field_name}: {as_zig_struct_type(field_type, prefix)} = .{{}},") elif is_enum_type(field_type): l(f" {field_name}: {as_zig_enum_type(field_type, prefix)} = .{enum_default_item(field_type)},") elif util.is_string_ptr(field_type): @@ -335,7 +335,7 @@ def gen_struct(decl, prefix): elif is_const_prim_ptr(field_type): l(f" {field_name}: ?[*]const {as_zig_prim_type(util.extract_ptr_type(field_type))} = null,") elif util.is_func_ptr(field_type): - l(f" {field_name}: ?*const fn({funcptr_args_c(field_type, prefix)}) callconv(.C) {funcptr_result_c(field_type)} = null,") + l(f" {field_name}: ?*const fn ({funcptr_args_c(field_type, prefix)}) callconv(.C) {funcptr_result_c(field_type)} = null,") elif util.is_1d_array_type(field_type): array_type = util.extract_array_type(field_type) array_sizes = util.extract_array_sizes(field_type) @@ -355,7 +355,7 @@ def gen_struct(decl, prefix): t1 = f"[_]{zig_type}" l(f" {field_name}: {t0} = {t1}{{{def_val}}} ** {array_sizes[0]},") elif util.is_const_void_ptr(array_type): - l(f" {field_name}: [{array_sizes[0]}]?*const anyopaque = [_]?*const anyopaque {{ null }} ** {array_sizes[0]},") + l(f" {field_name}: [{array_sizes[0]}]?*const anyopaque = [_]?*const anyopaque{{null}} ** {array_sizes[0]},") else: sys.exit(f"ERROR gen_struct: array {field_name}: {field_type} => {array_type} [{array_sizes[0]}]") elif util.is_2d_array_type(field_type): @@ -366,11 +366,11 @@ def gen_struct(decl, prefix): def_val = type_default_value(array_type) elif is_struct_type(array_type): zig_type = as_zig_struct_type(array_type, prefix) - def_val = ".{ }" + def_val = ".{}" else: sys.exit(f"ERROR gen_struct is_2d_array_type: {array_type}") t0 = f"[{array_sizes[0]}][{array_sizes[1]}]{zig_type}" - l(f" {field_name}: {t0} = [_][{array_sizes[1]}]{zig_type}{{[_]{zig_type}{{ {def_val} }}**{array_sizes[1]}}}**{array_sizes[0]},") + l(f" {field_name}: {t0} = [_][{array_sizes[1]}]{zig_type}{{[_]{zig_type}{{{def_val}}} ** {array_sizes[1]}}} ** {array_sizes[0]},") else: sys.exit(f"ERROR gen_struct: {field_name}: {field_type};") l("};") @@ -419,7 +419,7 @@ def gen_func_zig(decl, prefix): if is_const_struct_ptr(arg_type): s += f"&{arg_name}" elif util.is_string_ptr(arg_type): - s += f"@ptrCast([*c]const u8,{arg_name})" + s += f"@ptrCast({arg_name})" else: s += arg_name if is_zig_string(zig_res_type): @@ -452,7 +452,7 @@ def gen_imports(inp, dep_prefixes): def gen_helpers(inp): l('// helper function to convert a C string to a Zig string slice') l('fn cStrToZig(c_str: [*c]const u8) [:0]const u8 {') - l(' return @import("std").mem.span(c_str);') + l(' return @import("std").mem.span(c_str);') l('}') if inp['prefix'] in ['sg_', 'sdtx_', 'sshape_']: l('// helper function to convert "anything" to a Range struct') @@ -471,14 +471,14 @@ def gen_helpers(inp): l(' },') l(' else => {') l(' @compileError("Cannot convert to range!");') - l(' }') + l(' },') l(' }') l('}') l('') if inp['prefix'] == 'sdtx_': l('// std.fmt compatible Writer') l('pub const Writer = struct {') - l(' pub const Error = error { };') + l(' pub const Error = error{};') l(' pub fn writeAll(self: Writer, bytes: []const u8) Error!void {') l(' _ = self;') l(' for (bytes) |byte| {') @@ -488,7 +488,7 @@ def gen_helpers(inp): l(' pub fn writeByteNTimes(self: Writer, byte: u8, n: u64) Error!void {') l(' _ = self;') l(' var i: u64 = 0;') - l(' while (i < n): (i += 1) {') + l(' while (i < n) : (i += 1) {') l(' putc(byte);') l(' }') l(' }') From 0d7d72e6740026c2cdd7cd0a5503596efa74cb0b Mon Sep 17 00:00:00 2001 From: Anuj Asher Date: Sun, 2 Jul 2023 16:46:16 +0530 Subject: [PATCH 068/292] fix public function implementation prefix for egl functions it was a typo SOKOL_APP_IMPL -> SOKOL_API_IMPL --- sokol_app.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index 1b9225b4e..a1f45b6b1 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -11062,7 +11062,7 @@ SOKOL_API_IMPL float sapp_dpi_scale(void) { return _sapp.dpi_scale; } -SOKOL_APP_IMPL const void* sapp_egl_get_display(void) { +SOKOL_API_IMPL const void* sapp_egl_get_display(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_ANDROID) return _sapp.android.display; @@ -11073,7 +11073,7 @@ SOKOL_APP_IMPL const void* sapp_egl_get_display(void) { #endif } -SOKOL_APP_IMPL const void* sapp_egl_get_context(void) { +SOKOL_API_IMPL const void* sapp_egl_get_context(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_ANDROID) return _sapp.android.context; From ceac091e9f25944d0e193606eb8943251b76a5bf Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 16:10:27 +0200 Subject: [PATCH 069/292] sokol_gfx.h gl: depth-only rendering fixes --- sokol_gfx.h | 67 +++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 236138de1..e811321c5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3031,7 +3031,6 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: image bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to vertex stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ @@ -3043,7 +3042,6 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_DEPTH, "sg_apply_bindings: cannot bind depth/stencil image to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ @@ -7424,7 +7422,7 @@ _SOKOL_PRIVATE void _sg_gl_discard_shader(_sg_shader_t* shd) { _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && shd && desc); - SOKOL_ASSERT(!pip->shader && pip->cmn.shader_id.id == SG_INVALID_ID); + SOKOL_ASSERT((pip->shader == 0) && (pip->cmn.shader_id.id != SG_INVALID_ID)); SOKOL_ASSERT(desc->shader.id == shd->slot.id); SOKOL_ASSERT(shd->gl.prog); pip->shader = shd; @@ -7939,9 +7937,9 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { cache_ss->ref = state_ss->ref; } - // update blend state - // FIXME: separate blend state per color attachment not support, needs GL4 - { + if (pip->cmn.color_count > 0) { + // update blend state + // FIXME: separate blend state per color attachment not support, needs GL4 const sg_blend_state* state_bs = &pip->gl.blend; sg_blend_state* cache_bs = &_sg.gl.cache.blend; if (state_bs->enabled != cache_bs->enabled) { @@ -7971,39 +7969,40 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { cache_bs->op_alpha = state_bs->op_alpha; glBlendEquationSeparate(_sg_gl_blend_op(state_bs->op_rgb), _sg_gl_blend_op(state_bs->op_alpha)); } - } - // standalone state - for (GLuint i = 0; i < (GLuint)pip->cmn.color_count; i++) { - if (pip->gl.color_write_mask[i] != _sg.gl.cache.color_write_mask[i]) { - const sg_color_mask cm = pip->gl.color_write_mask[i]; - _sg.gl.cache.color_write_mask[i] = cm; - #ifdef SOKOL_GLCORE33 - glColorMaski(i, - (cm & SG_COLORMASK_R) != 0, - (cm & SG_COLORMASK_G) != 0, - (cm & SG_COLORMASK_B) != 0, - (cm & SG_COLORMASK_A) != 0); - #else - if (0 == i) { - glColorMask((cm & SG_COLORMASK_R) != 0, + // standalone color target state + for (GLuint i = 0; i < (GLuint)pip->cmn.color_count; i++) { + if (pip->gl.color_write_mask[i] != _sg.gl.cache.color_write_mask[i]) { + const sg_color_mask cm = pip->gl.color_write_mask[i]; + _sg.gl.cache.color_write_mask[i] = cm; + #ifdef SOKOL_GLCORE33 + glColorMaski(i, + (cm & SG_COLORMASK_R) != 0, (cm & SG_COLORMASK_G) != 0, (cm & SG_COLORMASK_B) != 0, (cm & SG_COLORMASK_A) != 0); - } - #endif + #else + if (0 == i) { + glColorMask((cm & SG_COLORMASK_R) != 0, + (cm & SG_COLORMASK_G) != 0, + (cm & SG_COLORMASK_B) != 0, + (cm & SG_COLORMASK_A) != 0); + } + #endif + } } - } - if (!_sg_fequal(pip->cmn.blend_color.r, _sg.gl.cache.blend_color.r, 0.0001f) || - !_sg_fequal(pip->cmn.blend_color.g, _sg.gl.cache.blend_color.g, 0.0001f) || - !_sg_fequal(pip->cmn.blend_color.b, _sg.gl.cache.blend_color.b, 0.0001f) || - !_sg_fequal(pip->cmn.blend_color.a, _sg.gl.cache.blend_color.a, 0.0001f)) - { - sg_color c = pip->cmn.blend_color; - _sg.gl.cache.blend_color = c; - glBlendColor(c.r, c.g, c.b, c.a); - } + if (!_sg_fequal(pip->cmn.blend_color.r, _sg.gl.cache.blend_color.r, 0.0001f) || + !_sg_fequal(pip->cmn.blend_color.g, _sg.gl.cache.blend_color.g, 0.0001f) || + !_sg_fequal(pip->cmn.blend_color.b, _sg.gl.cache.blend_color.b, 0.0001f) || + !_sg_fequal(pip->cmn.blend_color.a, _sg.gl.cache.blend_color.a, 0.0001f)) + { + sg_color c = pip->cmn.blend_color; + _sg.gl.cache.blend_color = c; + glBlendColor(c.r, c.g, c.b, c.a); + } + } // pip->cmn.color_count > 0 + if (pip->gl.cull_mode != _sg.gl.cache.cull_mode) { _sg.gl.cache.cull_mode = pip->gl.cull_mode; if (SG_CULLMODE_NONE == pip->gl.cull_mode) { @@ -15103,7 +15102,6 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH); _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_VS_IMAGE_MSAA); - _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_VS_IMAGE_DEPTH); } } } else { @@ -15143,7 +15141,6 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH); _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_FS_IMAGE_MSAA); - _SG_VALIDATE(!_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format), VALIDATE_ABND_FS_IMAGE_DEPTH); } } } else { From 0ca581b3260538227e0918e31dcae95262da1656 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 16:21:53 +0200 Subject: [PATCH 070/292] sokol_gfx_imgui.h: render depth textures in image panel --- util/sokol_gfx_imgui.h | 1 - 1 file changed, 1 deletion(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 1db2a959d..401be25c3 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -3316,7 +3316,6 @@ _SOKOL_PRIVATE void _sg_imgui_draw_buffer_panel(sg_imgui_t* ctx, sg_buffer buf) _SOKOL_PRIVATE bool _sg_imgui_image_renderable(sg_image_type type, sg_pixel_format fmt, int sample_count) { return (type == SG_IMAGETYPE_2D) && sg_query_pixelformat(fmt).sample - && !sg_query_pixelformat(fmt).depth && sample_count == 1; } From 66434b0a08bfb6f43a25944cc846ab39b8542109 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 16:31:55 +0200 Subject: [PATCH 071/292] sokol_imgui.h: add label to sampler --- util/sokol_imgui.h | 1 + 1 file changed, 1 insertion(+) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 614a9b291..4e1edae50 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -1817,6 +1817,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { smp_desc.min_filter = SG_FILTER_LINEAR; smp_desc.mag_filter = SG_FILTER_LINEAR; smp_desc.mipmap_filter = SG_FILTER_NONE; + smp_desc.label = "sokol-imgui-sampler"; _simgui.smp = sg_make_sampler(&smp_desc); io->Fonts->TexID = simgui_imtextureid(_simgui.img); From 8b806f8f8f8202896aa9f6c99a319d50dc135278 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 17:29:32 +0200 Subject: [PATCH 072/292] sokol_gfx.h: fix uninitialized variable warning --- sokol_gfx.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index e811321c5..fb4e4c197 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -14865,7 +14865,6 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { bool atts_cont = true; int color_width = -1, color_height = -1, color_sample_count = -1; bool has_color_atts = false; - // color attachments for (int att_index = 0; att_index < SG_MAX_COLOR_ATTACHMENTS; att_index++) { const sg_pass_attachment_desc* att = &desc->color_attachments[att_index]; if (att->image.id == SG_INVALID_ID) { @@ -14924,7 +14923,7 @@ _SOKOL_PRIVATE bool _sg_validate_pass_desc(const sg_pass_desc* desc) { } } } - bool has_depth_stencil_att; + bool has_depth_stencil_att = false; if (desc->depth_stencil_attachment.image.id != SG_INVALID_ID) { const sg_pass_attachment_desc* att = &desc->depth_stencil_attachment; const _sg_image_t* img = _sg_lookup_image(&_sg.pools, att->image.id); From 449f553ab87aa7babe4e995a8e8cd1c9d776f006 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 18:14:26 +0200 Subject: [PATCH 073/292] sokol_gfx.h d3d11: fix texture vs srv vs rtv vs dsv pixel formats (allows depth textures to be sampled) --- sokol_gfx.h | 85 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 29 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index fb4e4c197..ec1b65cb8 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -8728,7 +8728,7 @@ _SOKOL_PRIVATE UINT _sg_d3d11_cpu_access_flags(sg_usage usg) { } } -_SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_pixel_format(sg_pixel_format fmt) { +_SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_texture_pixel_format(sg_pixel_format fmt) { switch (fmt) { case SG_PIXELFORMAT_R8: return DXGI_FORMAT_R8_UNORM; case SG_PIXELFORMAT_R8SN: return DXGI_FORMAT_R8_SNORM; @@ -8771,7 +8771,7 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_pixel_format(sg_pixel_format fmt) { case SG_PIXELFORMAT_RGBA32UI: return DXGI_FORMAT_R32G32B32A32_UINT; case SG_PIXELFORMAT_RGBA32SI: return DXGI_FORMAT_R32G32B32A32_SINT; case SG_PIXELFORMAT_RGBA32F: return DXGI_FORMAT_R32G32B32A32_FLOAT; - case SG_PIXELFORMAT_DEPTH: return DXGI_FORMAT_D32_FLOAT; + case SG_PIXELFORMAT_DEPTH: return DXGI_FORMAT_R32_TYPELESS; case SG_PIXELFORMAT_DEPTH_STENCIL: return DXGI_FORMAT_D24_UNORM_S8_UINT; case SG_PIXELFORMAT_BC1_RGBA: return DXGI_FORMAT_BC1_UNORM; case SG_PIXELFORMAT_BC2_RGBA: return DXGI_FORMAT_BC2_UNORM; @@ -8787,6 +8787,30 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_pixel_format(sg_pixel_format fmt) { }; } +_SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_srv_pixel_format(sg_pixel_format fmt) { + if (fmt == SG_PIXELFORMAT_DEPTH) { + return DXGI_FORMAT_R32_FLOAT; + } else { + return _sg_d3d11_texture_pixel_format(fmt); + } +} + +_SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_dsv_pixel_format(sg_pixel_format fmt) { + if (fmt == SG_PIXELFORMAT_DEPTH) { + return DXGI_FORMAT_D32_FLOAT; + } else { + return _sg_d3d11_texture_pixel_format(fmt); + } +} + +_SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_rtv_pixel_format(sg_pixel_format fmt) { + if (fmt == SG_PIXELFORMAT_DEPTH) { + return DXGI_FORMAT_R32_FLOAT; + } else { + return _sg_d3d11_texture_pixel_format(fmt); + } +} + _SOKOL_PRIVATE D3D11_PRIMITIVE_TOPOLOGY _sg_d3d11_primitive_topology(sg_primitive_type prim_type) { switch (prim_type) { case SG_PRIMITIVETYPE_POINTS: return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; @@ -8971,6 +8995,18 @@ _SOKOL_PRIVATE UINT8 _sg_d3d11_color_write_mask(sg_color_mask m) { return res; } +_SOKOL_PRIVATE UINT _sg_d3d11_dxgi_fmt_caps(DXGI_FORMAT dxgi_fmt) { + UINT dxgi_fmt_caps = 0; + if (dxgi_fmt != DXGI_FORMAT_UNKNOWN) { + HRESULT hr = _sg_d3d11_CheckFormatSupport(_sg.d3d11.dev, dxgi_fmt, &dxgi_fmt_caps); + SOKOL_ASSERT(SUCCEEDED(hr) || (E_FAIL == hr)); + if (!SUCCEEDED(hr)) { + dxgi_fmt_caps = 0; + } + } + return dxgi_fmt_caps; +} + // see: https://docs.microsoft.com/en-us/windows/win32/direct3d11/overviews-direct3d-11-resources-limits#resource-limits-for-feature-level-11-hardware _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { _sg.backend = SG_BACKEND_D3D11; @@ -8989,25 +9025,16 @@ _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { // see: https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_format_support for (int fmt = (SG_PIXELFORMAT_NONE+1); fmt < _SG_PIXELFORMAT_NUM; fmt++) { - UINT dxgi_fmt_caps = 0; - const DXGI_FORMAT dxgi_fmt = _sg_d3d11_pixel_format((sg_pixel_format)fmt); - if (dxgi_fmt != DXGI_FORMAT_UNKNOWN) { - HRESULT hr = _sg_d3d11_CheckFormatSupport(_sg.d3d11.dev, dxgi_fmt, &dxgi_fmt_caps); - SOKOL_ASSERT(SUCCEEDED(hr) || (E_FAIL == hr)); - if (!SUCCEEDED(hr)) { - dxgi_fmt_caps = 0; - } - } + const UINT srv_dxgi_fmt_caps = _sg_d3d11_dxgi_fmt_caps(_sg_d3d11_srv_pixel_format((sg_pixel_format)fmt)); + const UINT rtv_dxgi_fmt_caps = _sg_d3d11_dxgi_fmt_caps(_sg_d3d11_rtv_pixel_format((sg_pixel_format)fmt)); + const UINT dsv_dxgi_fmt_caps = _sg_d3d11_dxgi_fmt_caps(_sg_d3d11_dsv_pixel_format((sg_pixel_format)fmt)); sg_pixelformat_info* info = &_sg.formats[fmt]; - info->sample = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_TEXTURE2D); - info->filter = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE); - info->render = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_RENDER_TARGET); - info->blend = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_BLENDABLE); - info->msaa = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET); - info->depth = 0 != (dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL); - if (info->depth) { - info->render = true; - } + info->sample = 0 != (srv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_TEXTURE2D); + info->filter = 0 != (srv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE); + info->render = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_RENDER_TARGET); + info->blend = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_BLENDABLE); + info->msaa = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET); + info->depth = 0 != (dsv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL); } } @@ -9134,7 +9161,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const const bool injected = (0 != desc->d3d11_texture) || (0 != desc->d3d11_shader_resource_view); const bool msaa = (img->cmn.sample_count > 1); - img->d3d11.format = _sg_d3d11_pixel_format(img->cmn.pixel_format); + img->d3d11.format = _sg_d3d11_texture_pixel_format(img->cmn.pixel_format); if (img->d3d11.format == DXGI_FORMAT_UNKNOWN) { _SG_ERROR(D3D11_CREATE_2D_TEXTURE_UNSUPPORTED_PIXEL_FORMAT); return SG_RESOURCESTATE_FAILED; @@ -9185,9 +9212,9 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const d3d11_tex_desc.BindFlags = D3D11_BIND_DEPTH_STENCIL; } else { d3d11_tex_desc.BindFlags = D3D11_BIND_RENDER_TARGET; - if (!msaa) { - d3d11_tex_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; - } + } + if (!msaa) { + d3d11_tex_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; } d3d11_tex_desc.CPUAccessFlags = 0; } else { @@ -9211,10 +9238,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const // ...and similar, if not injected, create shader-resource-view // FIXME: currently we don't support setting MSAA texture as shader resource - if ((0 == img->d3d11.srv) && !msaa && !_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format)) { + if ((0 == img->d3d11.srv) && !msaa) { D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); - d3d11_srv_desc.Format = img->d3d11.format; + d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); switch (img->cmn.type) { case SG_IMAGETYPE_2D: d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; @@ -9289,7 +9316,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const if ((0 == img->d3d11.srv) && !msaa) { D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); - d3d11_srv_desc.Format = img->d3d11.format; + d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; d3d11_srv_desc.Texture3D.MipLevels = (UINT)img->cmn.num_mipmaps; hr = _sg_d3d11_CreateShaderResourceView(_sg.d3d11.dev, img->d3d11.res, &d3d11_srv_desc, &img->d3d11.srv); @@ -9719,7 +9746,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pass(_sg_pass_t* pass, _sg_ima const bool msaa = color_img->cmn.sample_count > 1; D3D11_RENDER_TARGET_VIEW_DESC d3d11_rtv_desc; _sg_clear(&d3d11_rtv_desc, sizeof(d3d11_rtv_desc)); - d3d11_rtv_desc.Format = color_img->d3d11.format; + d3d11_rtv_desc.Format = _sg_d3d11_rtv_pixel_format(color_img->cmn.pixel_format); if (color_img->cmn.type == SG_IMAGETYPE_2D) { if (msaa) { d3d11_rtv_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; @@ -9759,7 +9786,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_pass(_sg_pass_t* pass, _sg_ima const bool msaa = ds_img->cmn.sample_count > 1; D3D11_DEPTH_STENCIL_VIEW_DESC d3d11_dsv_desc; _sg_clear(&d3d11_dsv_desc, sizeof(d3d11_dsv_desc)); - d3d11_dsv_desc.Format = ds_img->d3d11.format; + d3d11_dsv_desc.Format = _sg_d3d11_dsv_pixel_format(ds_img->cmn.pixel_format); SOKOL_ASSERT(ds_img && ds_img->cmn.type != SG_IMAGETYPE_3D); if (ds_img->cmn.type == SG_IMAGETYPE_2D) { if (msaa) { From 126322f8c0d766b3c3f49a10635ca00831f91c66 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 18:31:22 +0200 Subject: [PATCH 074/292] sokol_gfx.h: fix unused parameter warnings --- sokol_gfx.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index ec1b65cb8..1d6d6421e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5567,6 +5567,8 @@ _SOKOL_PRIVATE void _sg_dummy_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); + _SOKOL_UNUSED(buf); + _SOKOL_UNUSED(desc); return SG_RESOURCESTATE_VALID; } @@ -5577,6 +5579,8 @@ _SOKOL_PRIVATE void _sg_dummy_discard_buffer(_sg_buffer_t* buf) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); + _SOKOL_UNUSED(img); + _SOKOL_UNUSED(desc); return SG_RESOURCESTATE_VALID; } @@ -5587,6 +5591,8 @@ _SOKOL_PRIVATE void _sg_dummy_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); + _SOKOL_UNUSED(smp); + _SOKOL_UNUSED(desc); return SG_RESOURCESTATE_VALID; } @@ -5597,6 +5603,8 @@ _SOKOL_PRIVATE void _sg_dummy_discard_sampler(_sg_sampler_t* smp) { _SOKOL_PRIVATE sg_resource_state _sg_dummy_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); + _SOKOL_UNUSED(shd); + _SOKOL_UNUSED(desc); return SG_RESOURCESTATE_VALID; } From e92b005893de63c55390b2c1a073d64917cf22a8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 2 Jul 2023 18:31:44 +0200 Subject: [PATCH 075/292] fix sokol_gfx_test.c (create pass without color attachments is now allowed --- tests/functional/sokol_gfx_test.c | 34 +++++++++++++------------------ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 3e7c862af..28084e0f3 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -1854,6 +1854,20 @@ UTEST(sokol_gfx, make_pass_with_nonvalid_color_images) { sg_shutdown(); } +UTEST(sokol_gfx, make_pass_without_color_attachments) { + setup(&(sg_desc){0}); + sg_pass pass = sg_make_pass(&(sg_pass_desc){ + .depth_stencil_attachment.image = sg_make_image(&(sg_image_desc){ + .render_target = true, + .width = 64, + .height = 64, + .pixel_format = SG_PIXELFORMAT_DEPTH, + }) + }); + T(sg_query_pass_state(pass) == SG_RESOURCESTATE_VALID); + sg_shutdown(); +} + UTEST(sokol_gfx, make_buffer_validate_start_canary) { setup(&(sg_desc){0}); const uint32_t data[32] = {0}; @@ -2167,26 +2181,6 @@ UTEST(sokol_gfx, make_pass_validate_end_canary) { sg_shutdown(); } -UTEST(sokol_gfx, make_pass_validate_no_color_attrs) { - setup(&(sg_desc){0}); - // FIXME: rendering without color attachments but depth attachment should actually work - sg_pass pass = sg_make_pass(&(sg_pass_desc){ - .depth_stencil_attachment.image = sg_make_image(&(sg_image_desc){ - .render_target = true, - .width = 64, - .height = 64, - .pixel_format = SG_PIXELFORMAT_DEPTH, - }) - }); - T(sg_query_pass_state(pass) == SG_RESOURCESTATE_FAILED); - T(log_items[0] == SG_LOGITEM_VALIDATE_PASSDESC_NO_COLOR_ATTS); - T(log_items[1] == SG_LOGITEM_VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); - T(log_items[2] == SG_LOGITEM_VALIDATE_PASSDESC_DEPTH_IMAGE_SIZES); - T(log_items[3] == SG_LOGITEM_VALIDATE_PASSDESC_DEPTH_IMAGE_SAMPLE_COUNT); - T(log_items[4] == SG_LOGITEM_VALIDATION_FAILED); - sg_shutdown(); -} - UTEST(sokol_gfx, make_pass_validate_no_cont_color_atts1) { setup(&(sg_desc){0}); const sg_image_desc img_desc = { .render_target = true, .width = 64, .height = 64 }; From d477ad6055741058fbcf08a6e55eed8bf00ef9de Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 3 Jul 2023 13:34:57 +0200 Subject: [PATCH 076/292] sokol_gfx.h: fix comments in _sg_gl_create_pass() --- sokol_gfx.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 1d6d6421e..9f6c3e931 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7564,7 +7564,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pass(_sg_pass_t* pass, _sg_image_ glGenFramebuffers(1, &pass->gl.fb); glBindFramebuffer(GL_FRAMEBUFFER, pass->gl.fb); - // attach msaa render buffer or textures + // attach color attachments to framebuffer for (int i = 0; i < pass->cmn.num_color_atts; i++) { const _sg_image_t* color_img = pass->gl.color_atts[i].image; SOKOL_ASSERT(color_img); @@ -7576,6 +7576,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pass(_sg_pass_t* pass, _sg_image_ _sg_gl_fb_attach_texture(&pass->gl.color_atts[i], &pass->cmn.color_atts[i], gl_att_type); } } + // attach depth-stencil attachement if (pass->gl.ds_att.image) { const GLenum gl_att = _sg_gl_depth_stencil_attachment_type(&pass->gl.ds_att); const _sg_image_t* ds_img = pass->gl.ds_att.image; From b1056481511667f3d1e43cb52ed5d97b2856d1eb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 5 Jul 2023 19:09:50 +0200 Subject: [PATCH 077/292] gen_zig.py: map sg_pixelformat_info to sg_pixel_format_info --- bindgen/gen_zig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py index a8768ca36..beb01e47e 100644 --- a/bindgen/gen_zig.py +++ b/bindgen/gen_zig.py @@ -50,6 +50,7 @@ 'sgl_error': 'sgl_get_error', # 'error' is reserved in Zig 'sgl_deg': 'sgl_as_degrees', 'sgl_rad': 'sgl_as_radians', + 'sg_pixelformat_info': 'sg_pixel_format_info', 'sg_context_desc.color_format': 'int', 'sg_context_desc.depth_format': 'int', 'sg_apply_uniforms.ub_index': 'uint32_t', From 295a3bf14ec664986d82a60a0bc861b78810c7c6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 7 Jul 2023 19:10:36 +0200 Subject: [PATCH 078/292] gen_zig.py: revert sg_pixelformat_info remapping --- bindgen/gen_zig.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py index beb01e47e..a8768ca36 100644 --- a/bindgen/gen_zig.py +++ b/bindgen/gen_zig.py @@ -50,7 +50,6 @@ 'sgl_error': 'sgl_get_error', # 'error' is reserved in Zig 'sgl_deg': 'sgl_as_degrees', 'sgl_rad': 'sgl_as_radians', - 'sg_pixelformat_info': 'sg_pixel_format_info', 'sg_context_desc.color_format': 'int', 'sg_context_desc.depth_format': 'int', 'sg_apply_uniforms.ub_index': 'uint32_t', From 089f2a91914743dc42b9b8444e90733ff266d1b2 Mon Sep 17 00:00:00 2001 From: Pixeller Date: Fri, 23 Jun 2023 22:47:08 +0800 Subject: [PATCH 079/292] use addr instead warning:: `unsafeAddr` is a deprecated alias for `addr`, use `addr` instead. --- bindgen/gen_nim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindgen/gen_nim.py b/bindgen/gen_nim.py index f99f4b02b..14d6297d1 100644 --- a/bindgen/gen_nim.py +++ b/bindgen/gen_nim.py @@ -437,7 +437,7 @@ def gen_func_nim(decl, prefix): arg_name = param_decl['name'] arg_type = param_decl['type'] if is_const_struct_ptr(arg_type): - s += f"unsafeAddr({arg_name})" + s += f"addr({arg_name})" else: s += arg_name s += ")" @@ -562,7 +562,7 @@ def gen_extra(inp): #if inp['prefix'] in ['sg_', 'sdtx_', 'sshape_']: # l('# helper function to convert "anything" into a Range') # l('converter to_Range*[T](source: T): Range =') - # l(' Range(addr: source.unsafeAddr, size: source.sizeof.uint)') + # l(' Range(addr: source.addr, size: source.sizeof.uint)') # l('') c_source_path = '/'.join(c_source_paths[inp['prefix']].split('/')[3:]) l('{.passc:"-DSOKOL_NIM_IMPL".}') From da8466d9a968a91e4b1bc9e1a049d0ac9771ed3f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 9 Jul 2023 18:26:13 +0200 Subject: [PATCH 080/292] add MEG-4 project to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d9ac024a0..389a0ce81 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ cross-platform libraries for C and C++, written in C. - A 'single-file' [Pacman clone in C99](https://github.com/floooh/pacman.c/), also available in [Zig](https://github.com/floooh/pacman.zig/) +- [MEG-4](https://bztsrc.gitlab.io/meg4) a virtual fantasy console emulator in C89, ported to sokol + - A [Minigolf game](https://mgerdes.github.io/minigolf.html) ([source](https://github.com/mgerdes/minigolf)). - ['Dealer's Dungeon'](https://dealers-dungeon.com/demo/) ([lower graphics quality](https://dealers-dungeon.com/demo/?q=3), From f74c77a85aa28e5af140ba80ab12aa51460410f0 Mon Sep 17 00:00:00 2001 From: Benjamin Trosch Date: Sat, 8 Jul 2023 14:56:53 -0400 Subject: [PATCH 081/292] made sokol_imgui event functions that were sapp agnostic public --- util/sokol_imgui.h | 260 +++++++++++++++++++++++++-------------------- 1 file changed, 142 insertions(+), 118 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 80ab5e03d..0166cfb14 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -2137,6 +2137,124 @@ SOKOL_API_IMPL void simgui_render(void) { sg_pop_debug_group(); } +SOKOL_API_IMPL void simgui_add_focus_event(ImGuiIO* io, bool focus) { + #if defined(__cplusplus) + io->AddFocusEvent(focus); + #else + ImGuiIO_AddFocusEvent(io, focus); + #endif +} + +SOKOL_API_IMPL void simgui_add_mouse_pos_event(ImGuiIO* io, float x, float y) { + #if defined(__cplusplus) + #if (IMGUI_VERSION_NUM >= 18950) + io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); + #endif + io->AddMousePosEvent(x, y); + #else + #if (IMGUI_VERSION_NUM >= 18950) + ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); + #endif + ImGuiIO_AddMousePosEvent(io, x, y); + #endif +} + +SOKOL_API_IMPL void simgui_add_touch_pos_event(ImGuiIO* io, float x, float y) { + #if defined(__cplusplus) + #if (IMGUI_VERSION_NUM >= 18950) + io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); + #endif + io->AddMousePosEvent(x, y); + #else + #if (IMGUI_VERSION_NUM >= 18950) + ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); + #endif + ImGuiIO_AddMousePosEvent(io, x, y); + #endif +} + +SOKOL_API_IMPL void simgui_add_mouse_button_event(ImGuiIO* io, int mouse_button, bool down) { + #if defined(__cplusplus) + #if (IMGUI_VERSION_NUM >= 18950) + io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); + #endif + io->AddMouseButtonEvent(mouse_button, down); + #else + #if (IMGUI_VERSION_NUM >= 18950) + ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); + #endif + ImGuiIO_AddMouseButtonEvent(io, mouse_button, down); + #endif +} + +SOKOL_API_IMPL void simgui_add_touch_button_event(ImGuiIO* io, int mouse_button, bool down) { + #if defined(__cplusplus) + #if (IMGUI_VERSION_NUM >= 18950) + io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); + #endif + io->AddMouseButtonEvent(mouse_button, down); + #else + #if (IMGUI_VERSION_NUM >= 18950) + ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); + #endif + ImGuiIO_AddMouseButtonEvent(io, mouse_button, down); + #endif +} + +SOKOL_API_IMPL void simgui_add_mouse_wheel_event(ImGuiIO* io, float wheel_x, float wheel_y) { + #if defined(__cplusplus) + #if (IMGUI_VERSION_NUM >= 18950) + io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); + #endif + io->AddMouseWheelEvent(wheel_x, wheel_y); + #else + #if (IMGUI_VERSION_NUM >= 18950) + ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); + #endif + ImGuiIO_AddMouseWheelEvent(io, wheel_x, wheel_y); + #endif +} + +SOKOL_API_IMPL void simgui_add_key_event(ImGuiIO* io, int (*map_keycode)(int), int keycode, bool down) { + const ImGuiKey imgui_key = (ImGuiKey)map_keycode(keycode); + #if defined(__cplusplus) + io->AddKeyEvent(imgui_key, down); + io->SetKeyEventNativeData(imgui_key, keycode, 0, -1); + #else + ImGuiIO_AddKeyEvent(io, imgui_key, down); + ImGuiIO_SetKeyEventNativeData(io, imgui_key, keycode, 0, -1); + #endif +} + +SOKOL_API_IMPL void simgui_add_imgui_key_event(ImGuiIO* io, ImGuiKey imgui_key, bool down) { + #if defined(__cplusplus) + io->AddKeyEvent(imgui_key, down); + #else + ImGuiIO_AddKeyEvent(io, imgui_key, down); + #endif +} + +SOKOL_API_IMPL void simgui_add_input_character(ImGuiIO* io, uint32_t c) { + #if defined(__cplusplus) + io->AddInputCharacter(c); + #else + ImGuiIO_AddInputCharacter(io, c); + #endif +} + +SOKOL_API_IMPL void simgui_add_input_characters_utf8(ImGuiIO* io, const char* c) { + #if defined(__cplusplus) + io->AddInputCharactersUTF8(c); + #else + ImGuiIO_AddInputCharactersUTF8(io, c); + #endif +} + +// returns Ctrl or Super, depending on platform +SOKOL_API_IMPL ImGuiKey simgui_copypaste_modifier(bool is_osx) { + return is_osx ? ImGuiMod_Super : ImGuiMod_Ctrl; +} + #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) _SOKOL_PRIVATE bool _simgui_is_ctrl(uint32_t modifiers) { if (_simgui.is_osx) { @@ -2258,84 +2376,6 @@ _SOKOL_PRIVATE ImGuiKey _simgui_map_keycode(sapp_keycode key) { } } -_SOKOL_PRIVATE void _simgui_add_focus_event(ImGuiIO* io, bool focus) { - #if defined(__cplusplus) - io->AddFocusEvent(focus); - #else - ImGuiIO_AddFocusEvent(io, focus); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_mouse_pos_event(ImGuiIO* io, float x, float y) { - #if defined(__cplusplus) - #if (IMGUI_VERSION_NUM >= 18950) - io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); - #endif - io->AddMousePosEvent(x, y); - #else - #if (IMGUI_VERSION_NUM >= 18950) - ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); - #endif - ImGuiIO_AddMousePosEvent(io, x, y); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_touch_pos_event(ImGuiIO* io, float x, float y) { - #if defined(__cplusplus) - #if (IMGUI_VERSION_NUM >= 18950) - io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); - #endif - io->AddMousePosEvent(x, y); - #else - #if (IMGUI_VERSION_NUM >= 18950) - ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); - #endif - ImGuiIO_AddMousePosEvent(io, x, y); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_mouse_button_event(ImGuiIO* io, int mouse_button, bool down) { - #if defined(__cplusplus) - #if (IMGUI_VERSION_NUM >= 18950) - io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); - #endif - io->AddMouseButtonEvent(mouse_button, down); - #else - #if (IMGUI_VERSION_NUM >= 18950) - ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); - #endif - ImGuiIO_AddMouseButtonEvent(io, mouse_button, down); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_touch_button_event(ImGuiIO* io, int mouse_button, bool down) { - #if defined(__cplusplus) - #if (IMGUI_VERSION_NUM >= 18950) - io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); - #endif - io->AddMouseButtonEvent(mouse_button, down); - #else - #if (IMGUI_VERSION_NUM >= 18950) - ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); - #endif - ImGuiIO_AddMouseButtonEvent(io, mouse_button, down); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_mouse_wheel_event(ImGuiIO* io, float wheel_x, float wheel_y) { - #if defined(__cplusplus) - #if (IMGUI_VERSION_NUM >= 18950) - io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); - #endif - io->AddMouseWheelEvent(wheel_x, wheel_y); - #else - #if (IMGUI_VERSION_NUM >= 18950) - ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); - #endif - ImGuiIO_AddMouseWheelEvent(io, wheel_x, wheel_y); - #endif -} - _SOKOL_PRIVATE void _simgui_add_sapp_key_event(ImGuiIO* io, sapp_keycode sapp_key, bool down) { const ImGuiKey imgui_key = _simgui_map_keycode(sapp_key); #if defined(__cplusplus) @@ -2347,27 +2387,11 @@ _SOKOL_PRIVATE void _simgui_add_sapp_key_event(ImGuiIO* io, sapp_keycode sapp_ke #endif } -_SOKOL_PRIVATE void _simgui_add_imgui_key_event(ImGuiIO* io, ImGuiKey imgui_key, bool down) { - #if defined(__cplusplus) - io->AddKeyEvent(imgui_key, down); - #else - ImGuiIO_AddKeyEvent(io, imgui_key, down); - #endif -} - -_SOKOL_PRIVATE void _simgui_add_input_character(ImGuiIO* io, uint32_t c) { - #if defined(__cplusplus) - io->AddInputCharacter(c); - #else - ImGuiIO_AddInputCharacter(io, c); - #endif -} - _SOKOL_PRIVATE void _simgui_update_modifiers(ImGuiIO* io, uint32_t mods) { - _simgui_add_imgui_key_event(io, ImGuiMod_Ctrl, (mods & SAPP_MODIFIER_CTRL) != 0); - _simgui_add_imgui_key_event(io, ImGuiMod_Shift, (mods & SAPP_MODIFIER_SHIFT) != 0); - _simgui_add_imgui_key_event(io, ImGuiMod_Alt, (mods & SAPP_MODIFIER_ALT) != 0); - _simgui_add_imgui_key_event(io, ImGuiMod_Super, (mods & SAPP_MODIFIER_SUPER) != 0); + simgui_add_imgui_key_event(io, ImGuiMod_Ctrl, (mods & SAPP_MODIFIER_CTRL) != 0); + simgui_add_imgui_key_event(io, ImGuiMod_Shift, (mods & SAPP_MODIFIER_SHIFT) != 0); + simgui_add_imgui_key_event(io, ImGuiMod_Alt, (mods & SAPP_MODIFIER_ALT) != 0); + simgui_add_imgui_key_event(io, ImGuiMod_Super, (mods & SAPP_MODIFIER_SUPER) != 0); } // returns Ctrl or Super, depending on platform @@ -2388,23 +2412,23 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { #endif switch (ev->type) { case SAPP_EVENTTYPE_FOCUSED: - _simgui_add_focus_event(io, true); + simgui_add_focus_event(io, true); break; case SAPP_EVENTTYPE_UNFOCUSED: - _simgui_add_focus_event(io, false); + simgui_add_focus_event(io, false); break; case SAPP_EVENTTYPE_MOUSE_DOWN: - _simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); - _simgui_add_mouse_button_event(io, (int)ev->mouse_button, true); + simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_button_event(io, (int)ev->mouse_button, true); _simgui_update_modifiers(io, ev->modifiers); break; case SAPP_EVENTTYPE_MOUSE_UP: - _simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); - _simgui_add_mouse_button_event(io, (int)ev->mouse_button, false); + simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_button_event(io, (int)ev->mouse_button, false); _simgui_update_modifiers(io, ev->modifiers); break; case SAPP_EVENTTYPE_MOUSE_MOVE: - _simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); break; case SAPP_EVENTTYPE_MOUSE_ENTER: case SAPP_EVENTTYPE_MOUSE_LEAVE: @@ -2415,26 +2439,26 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { // "platform behaviour flags". #if defined(__EMSCRIPTEN__) for (int i = 0; i < SAPP_MAX_MOUSEBUTTONS; i++) { - _simgui_add_mouse_button_event(io, i, false); + simgui_add_mouse_button_event(io, i, false); } #endif break; case SAPP_EVENTTYPE_MOUSE_SCROLL: - _simgui_add_mouse_wheel_event(io, ev->scroll_x, ev->scroll_y); + simgui_add_mouse_wheel_event(io, ev->scroll_x, ev->scroll_y); break; case SAPP_EVENTTYPE_TOUCHES_BEGAN: - _simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); - _simgui_add_touch_button_event(io, 0, true); + simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_button_event(io, 0, true); break; case SAPP_EVENTTYPE_TOUCHES_MOVED: - _simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); break; case SAPP_EVENTTYPE_TOUCHES_ENDED: - _simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); - _simgui_add_touch_button_event(io, 0, false); + simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_button_event(io, 0, false); break; case SAPP_EVENTTYPE_TOUCHES_CANCELLED: - _simgui_add_touch_button_event(io, 0, false); + simgui_add_touch_button_event(io, 0, false); break; case SAPP_EVENTTYPE_KEY_DOWN: _simgui_update_modifiers(io, ev->modifiers); @@ -2481,16 +2505,16 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { (ev->char_code != 127) && (0 == (ev->modifiers & (SAPP_MODIFIER_ALT|SAPP_MODIFIER_CTRL|SAPP_MODIFIER_SUPER)))) { - _simgui_add_input_character(io, ev->char_code); + simgui_add_input_character(io, ev->char_code); } break; case SAPP_EVENTTYPE_CLIPBOARD_PASTED: /* simulate a Ctrl-V key down/up */ if (!_simgui.desc.disable_paste_override) { - _simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), true); - _simgui_add_imgui_key_event(io, ImGuiKey_V, true); - _simgui_add_imgui_key_event(io, ImGuiKey_V, false); - _simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), false); + simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), true); + simgui_add_imgui_key_event(io, ImGuiKey_V, true); + simgui_add_imgui_key_event(io, ImGuiKey_V, false); + simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), false); } break; default: From 136f01b1edb1274e14c19e87cee88164957c8fca Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 10 Jul 2023 14:02:57 +0200 Subject: [PATCH 082/292] gen_bindings.yml: update odin to dev-2023-07 --- .github/workflows/gen_bindings.yml | 124 ++++++++++++++--------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index b547ac36a..9a1725c4e 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -166,82 +166,82 @@ jobs: run: | sudo apt-get update sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev llvm-11 - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-03/odin-ubuntu-amd64-dev-2023-03.zip --output odin.zip + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-ubuntu-amd64-dev-2023-07.zip --output odin.zip unzip odin.zip - chmod a+x ubuntu_artifacts/odin + chmod a+x ./odin ./build_clibs_linux.sh - ubuntu_artifacts/odin build examples/clear -debug - ubuntu_artifacts/odin build examples/triangle -debug - ubuntu_artifacts/odin build examples/quad -debug - ubuntu_artifacts/odin build examples/bufferoffsets -debug - ubuntu_artifacts/odin build examples/cube -debug - ubuntu_artifacts/odin build examples/noninterleaved -debug - ubuntu_artifacts/odin build examples/texcube -debug - ubuntu_artifacts/odin build examples/shapes -debug - ubuntu_artifacts/odin build examples/offscreen -debug - ubuntu_artifacts/odin build examples/instancing -debug - ubuntu_artifacts/odin build examples/mrt -debug - ubuntu_artifacts/odin build examples/blend -debug - ubuntu_artifacts/odin build examples/debugtext -debug - ubuntu_artifacts/odin build examples/debugtext-print -debug - ubuntu_artifacts/odin build examples/debugtext-userfont -debug - ubuntu_artifacts/odin build examples/saudio -debug - ubuntu_artifacts/odin build examples/sgl -debug - ubuntu_artifacts/odin build examples/sgl-points -debug - ubuntu_artifacts/odin build examples/sgl-context -debug + ./odin build examples/clear -debug + ./odin build examples/triangle -debug + ./odin build examples/quad -debug + ./odin build examples/bufferoffsets -debug + ./odin build examples/cube -debug + ./odin build examples/noninterleaved -debug + ./odin build examples/texcube -debug + ./odin build examples/shapes -debug + ./odin build examples/offscreen -debug + ./odin build examples/instancing -debug + ./odin build examples/mrt -debug + ./odin build examples/blend -debug + ./odin build examples/debugtext -debug + ./odin build examples/debugtext-print -debug + ./odin build examples/debugtext-userfont -debug + ./odin build examples/saudio -debug + ./odin build examples/sgl -debug + ./odin build examples/sgl-points -debug + ./odin build examples/sgl-context -debug - if: runner.os == 'macOS' name: build-macos run: | brew install llvm@11 - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-03/odin-macos-amd64-dev-2023-03.zip --output odin.zip + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-macos-amd64-dev-2023-07.zip --output odin.zip unzip odin.zip - chmod a+x macos_artifacts/odin + chmod a+x ./odin ./build_clibs_macos.sh - macos_artifacts/odin build examples/clear -debug - macos_artifacts/odin build examples/triangle -debug - macos_artifacts/odin build examples/quad -debug - macos_artifacts/odin build examples/bufferoffsets -debug - macos_artifacts/odin build examples/cube -debug - macos_artifacts/odin build examples/noninterleaved -debug - macos_artifacts/odin build examples/texcube -debug - macos_artifacts/odin build examples/shapes -debug - macos_artifacts/odin build examples/offscreen -debug - macos_artifacts/odin build examples/instancing -debug - macos_artifacts/odin build examples/mrt -debug - macos_artifacts/odin build examples/blend -debug - macos_artifacts/odin build examples/debugtext -debug - macos_artifacts/odin build examples/debugtext-print -debug - macos_artifacts/odin build examples/debugtext-userfont -debug - macos_artifacts/odin build examples/saudio -debug - macos_artifacts/odin build examples/sgl -debug - macos_artifacts/odin build examples/sgl-points -debug - macos_artifacts/odin build examples/sgl-context -debug + ./odin build examples/clear -debug + ./odin build examples/triangle -debug + ./odin build examples/quad -debug + ./odin build examples/bufferoffsets -debug + ./odin build examples/cube -debug + ./odin build examples/noninterleaved -debug + ./odin build examples/texcube -debug + ./odin build examples/shapes -debug + ./odin build examples/offscreen -debug + ./odin build examples/instancing -debug + ./odin build examples/mrt -debug + ./odin build examples/blend -debug + ./odin build examples/debugtext -debug + ./odin build examples/debugtext-print -debug + ./odin build examples/debugtext-userfont -debug + ./odin build examples/saudio -debug + ./odin build examples/sgl -debug + ./odin build examples/sgl-points -debug + ./odin build examples/sgl-context -debug - if: runner.os == 'Windows' name: build-windows shell: cmd run: | - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-03/odin-windows-amd64-dev-2023-03.zip --output odin.zip + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-windows-amd64-dev-2023-07.zip --output odin.zip unzip odin.zip build_clibs_windows.cmd - windows_artifacts/odin build examples/clear -debug - windows_artifacts/odin build examples/triangle -debug - windows_artifacts/odin build examples/quad -debug - windows_artifacts/odin build examples/bufferoffsets -debug - windows_artifacts/odin build examples/cube -debug - windows_artifacts/odin build examples/noninterleaved -debug - windows_artifacts/odin build examples/texcube -debug - windows_artifacts/odin build examples/shapes -debug - windows_artifacts/odin build examples/offscreen -debug - windows_artifacts/odin build examples/instancing -debug - windows_artifacts/odin build examples/mrt -debug - windows_artifacts/odin build examples/blend -debug - windows_artifacts/odin build examples/debugtext -debug - windows_artifacts/odin build examples/debugtext-print -debug - windows_artifacts/odin build examples/debugtext-userfont -debug - windows_artifacts/odin build examples/saudio -debug - windows_artifacts/odin build examples/sgl -debug - windows_artifacts/odin build examples/sgl-points -debug - windows_artifacts/odin build examples/sgl-context -debug + ./odin build examples/clear -debug + ./odin build examples/triangle -debug + ./odin build examples/quad -debug + ./odin build examples/bufferoffsets -debug + ./odin build examples/cube -debug + ./odin build examples/noninterleaved -debug + ./odin build examples/texcube -debug + ./odin build examples/shapes -debug + ./odin build examples/offscreen -debug + ./odin build examples/instancing -debug + ./odin build examples/mrt -debug + ./odin build examples/blend -debug + ./odin build examples/debugtext -debug + ./odin build examples/debugtext-print -debug + ./odin build examples/debugtext-userfont -debug + ./odin build examples/saudio -debug + ./odin build examples/sgl -debug + ./odin build examples/sgl-points -debug + ./odin build examples/sgl-context -debug test-rust: needs: gen-bindings From 5b282c347e2f9f5232bf97c8ef2fcb192a46950c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 10 Jul 2023 15:16:07 +0200 Subject: [PATCH 083/292] gh actions: clean up test-odin job --- .github/workflows/gen_bindings.yml | 46 ++++-------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 9a1725c4e..34ce2a067 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -162,7 +162,7 @@ jobs: # NOTE: see https://github.com/floooh/sokol-odin/blob/main/.github/workflows/main.yml - uses: ilammy/msvc-dev-cmd@v1 - if: runner.os == 'Linux' - name: build-linux + name: prepare-linux run: | sudo apt-get update sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev llvm-11 @@ -170,59 +170,23 @@ jobs: unzip odin.zip chmod a+x ./odin ./build_clibs_linux.sh - ./odin build examples/clear -debug - ./odin build examples/triangle -debug - ./odin build examples/quad -debug - ./odin build examples/bufferoffsets -debug - ./odin build examples/cube -debug - ./odin build examples/noninterleaved -debug - ./odin build examples/texcube -debug - ./odin build examples/shapes -debug - ./odin build examples/offscreen -debug - ./odin build examples/instancing -debug - ./odin build examples/mrt -debug - ./odin build examples/blend -debug - ./odin build examples/debugtext -debug - ./odin build examples/debugtext-print -debug - ./odin build examples/debugtext-userfont -debug - ./odin build examples/saudio -debug - ./odin build examples/sgl -debug - ./odin build examples/sgl-points -debug - ./odin build examples/sgl-context -debug - if: runner.os == 'macOS' - name: build-macos + name: prepare-macos run: | brew install llvm@11 curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-macos-amd64-dev-2023-07.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_macos.sh - ./odin build examples/clear -debug - ./odin build examples/triangle -debug - ./odin build examples/quad -debug - ./odin build examples/bufferoffsets -debug - ./odin build examples/cube -debug - ./odin build examples/noninterleaved -debug - ./odin build examples/texcube -debug - ./odin build examples/shapes -debug - ./odin build examples/offscreen -debug - ./odin build examples/instancing -debug - ./odin build examples/mrt -debug - ./odin build examples/blend -debug - ./odin build examples/debugtext -debug - ./odin build examples/debugtext-print -debug - ./odin build examples/debugtext-userfont -debug - ./odin build examples/saudio -debug - ./odin build examples/sgl -debug - ./odin build examples/sgl-points -debug - ./odin build examples/sgl-context -debug - if: runner.os == 'Windows' - name: build-windows + name: prepare-windows shell: cmd run: | curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-windows-amd64-dev-2023-07.zip --output odin.zip unzip odin.zip build_clibs_windows.cmd + - name: build + run: | ./odin build examples/clear -debug ./odin build examples/triangle -debug ./odin build examples/quad -debug From b1c29d53adca764aa69bda66f024e1a0a73ce3e7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 10 Jul 2023 16:49:16 +0200 Subject: [PATCH 084/292] sokol_gl.h: update documentation --- util/sokol_gl.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/sokol_gl.h b/util/sokol_gl.h index c7693f781..f17da4788 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -48,7 +48,7 @@ FEATURE OVERVIEW: ================= sokol_gl.h implements a subset of the OpenGLES 1.x feature set useful for - when you just want to quickly render a bunch of colored triangles or + when you just want to quickly render a bunch of triangles or lines without having to mess with buffers and shaders. The current feature set is mostly useful for debug visualizations @@ -233,7 +233,11 @@ sgl_enable_texture() sgl_disable_texture() - sgl_texture(sg_image img) + sgl_texture(sg_image img, sg_sampler smp) + + NOTE: the img and smp handles can be invalid (SG_INVALID_ID), in this + case, sokol-gl will fall back to the internal default (white) texture + and sampler. --- set the current viewport and scissor rect with: From 685584e4e4d952fb483b760ae0d46ce0a706b236 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 10 Jul 2023 19:41:25 +0200 Subject: [PATCH 085/292] sokol_gfx.h documentation update (wip) --- sokol_gfx.h | 156 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 108 insertions(+), 48 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9f6c3e931..b1a0ecb9f 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -113,10 +113,11 @@ }); --- create resource objects (at least buffers, shaders and pipelines, - and optionally images and passes): + and optionally images, samplers and passes): sg_buffer sg_make_buffer(const sg_buffer_desc*) sg_image sg_make_image(const sg_image_desc*) + sg_sampler sg_make_sampler(const sg_sampler_desc*) sg_shader sg_make_shader(const sg_shader_desc*) sg_pipeline sg_make_pipeline(const sg_pipeline_desc*) sg_pass sg_make_pass(const sg_pass_desc*) @@ -140,8 +141,8 @@ sg_apply_pipeline(sg_pipeline pip) --- fill an sg_bindings struct with the resource bindings for the next - draw call (1..N vertex buffers, 0 or 1 index buffer, 0..N image objects - to use as textures each on the vertex-shader- and fragment-shader-stage + draw call (1..N vertex buffers, 0 or 1 index buffer, 0..N image objects and + 0..N sampler objects on the vertex-shader- and fragment-shader-stage and then call sg_apply_bindings(const sg_bindings* bindings) @@ -185,6 +186,7 @@ sg_destroy_buffer(sg_buffer buf) sg_destroy_image(sg_image img) + sg_destroy_sampler(sg_sampler smp) sg_destroy_shader(sg_shader shd) sg_destroy_pipeline(sg_pipeline pip) sg_destroy_pass(sg_pass pass) @@ -305,6 +307,7 @@ sg_buffer_desc sg_query_buffer_desc(sg_buffer buf) sg_image_desc sg_query_image_desc(sg_image img) + sg_sampler_desc sg_query_sampler_desc(sg_sampler smp) sg_shader_desc sq_query_shader_desc(sg_shader shd) sg_pipeline_desc sg_query_pipeline_desc(sg_pipeline pip) sg_pass_desc sg_query_pass_desc(sg_pass pass) @@ -324,6 +327,7 @@ sg_buffer_desc sg_query_buffer_defaults(const sg_buffer_desc* desc) sg_image_desc sg_query_image_defaults(const sg_image_desc* desc) + sg_sampler_desc sg_query_sampler_defaults(const sg_sampler_desc* desc) sg_shader_desc sg_query_shader_defaults(const sg_shader_desc* desc) sg_pipeline_desc sg_query_pipeline_defaults(const sg_pipeline_desc* desc) sg_pass_desc sg_query_pass_defaults(const sg_pass_desc* desc) @@ -337,6 +341,7 @@ sg_buffer_info sg_query_buffer_info(sg_buffer buf) sg_image_info sg_query_image_info(sg_image img) + sg_sampler_info sg_query_sampler_info(sg_sampler smp) sg_shader_info sg_query_shader_info(sg_shader shd) sg_pipeline_info sg_query_pipeline_info(sg_pipeline pip) sg_pass_info sg_query_pass_info(sg_pass pass) @@ -383,6 +388,45 @@ See the documentation block of the sg_desc struct below for more information. + ON SHADER CREATION + ================== + sokol-gfx doesn't come with an integrated shader cross-compiler, instead + backend-specific shader sources or binary blobs need to provided when + creating a shader object, along with information about the shader interface + needed in the sokol-gfx validation layer and to properly bind shader resources + on the CPU-side to be consumable by the GPU-side. + + The easiest way to provide all this shader creation data is to use the + sokol-shdc shader compiler tool to compile shaders from a common + GLSL syntax into backend-specific sources or binary blobs, along with + shader interface information and uniform blocks mapped to C structs. + + To create a shader using a C header which has been code-generated by sokol-shdc: + + // include the C header code-generated by sokol-shdc: + #include "myshader.glsl.h" + ... + + // create shader using a code-generated helper function from the C header: + sg_shader shd = sg_make_shader(mshader_shader_desc(sg_query_backend())); + + If you're planning to use sokol-shdc, you can stop reading here, instead + continue with the sokol-shdc documentation: + + https://github.com/floooh/sokol-tools/blob/master/docs/sokol-shdc.md + + ...otherwise here's how to provide the information needed for creating shaders + without the help of sokol-shdc. + + To get a general idea how this works, please have a look at the backend-specific + sokol samples, those all create shader object directly without sokol-shdc: + + - for D3D11: https://github.com/floooh/sokol-samples/tree/master/d3d11 + - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal + - for OpenGL: https://github.com/floooh/sokol-samples/tree/master/glfw + - for GLES3: https://github.com/floooh/sokol-samples/tree/master/html5 + + FIXME FIXME FIXME ON RENDER PASSES ================ @@ -432,9 +476,6 @@ .height = 256, .pixel_format = SG_PIXELFORMAT_RGBA8, .sample_count = 1, - // the sampling properties are only used when the image is used as texture - .min_filter = SG_FILTER_LINEAR, - .mag_filter = SG_FILTER_LINEAR, }); const sg_image depth_img = sg_make_image(&(sg_image_desc){ .render_target = true, @@ -545,10 +586,6 @@ .height = 256, .pixel_format = SG_PIXELFORMAT_RGBA8, .sample_count = 1, - // the resolve image is the one that will be used as texture - // in later passes, so define texture sampler properties too: - .min_filter = SG_FILTER_LINEAR, - .mag_filter = SG_FILTER_LINEAR, }); const sg_image depth_img = sg_make_image(&(sg_image_desc){ .render_target = true, @@ -704,8 +741,10 @@ BACKEND-SPECIFIC TOPICS: ======================== + FIXME: delete this block after the new shader creation block is complete + --- The GL backends need to know about the internal structure of uniform - blocks, and the texture sampler-name and -type. The uniform layout details + blocks, and the texture type. The uniform layout details are described in the UNIFORM DATA LAYOUT section above. // uniform block structure and texture image definition in sg_shader_desc: @@ -715,7 +754,7 @@ ... }, // one texture on the fragment-shader-stage (name is optional) - .fs.images[0] = { .name="tex", .type=SG_IMAGETYPE_ARRAY } + .fs.images[0] = { .type=SG_IMAGETYPE_ARRAY } ... }; @@ -1032,6 +1071,7 @@ sg_buffer sg_make_buffer(const sg_buffer_desc* desc) sg_image sg_make_image(const sg_image_desc* desc) + sg_sampler sg_make_sampler(const sg_sampler_desc* desc) sg_shader sg_make_shader(const sg_shader_desc* desc) sg_pipeline sg_make_pipeline(const sg_pipeline_desc* desc) sg_pass sg_make_pass(const sg_pass_desc* desc) @@ -1089,6 +1129,7 @@ sg_buffer sg_alloc_buffer(void) sg_image sg_alloc_image(void) + sg_sampler sg_alloc_sampler(void) sg_shader sg_alloc_shader(void) sg_pipeline sg_alloc_pipeline(void) sg_pass sg_alloc_pass(void) @@ -1113,6 +1154,7 @@ void sg_init_buffer(sg_buffer buf, const sg_buffer_desc* desc) void sg_init_image(sg_image img, const sg_image_desc* desc) + void sg_init_sampler(sg_sampler smp, const sg_sampler_desc* desc) void sg_init_shader(sg_shader shd, const sg_shader_desc* desc) void sg_init_pipeline(sg_pipeline pip, const sg_pipeline_desc* desc) void sg_init_pass(sg_pass pass, const sg_pass_desc* desc) @@ -1128,6 +1170,7 @@ void sg_uninit_buffer(sg_buffer buf) void sg_uninit_image(sg_image img) + void sg_uninit_sampler(sg_sampler smp) void sg_uninit_shader(sg_shader shd) void sg_uninit_pipeline(sg_pipeline pip) void sg_uninit_pass(sg_pass pass) @@ -1139,6 +1182,7 @@ void sg_dealloc_buffer(sg_buffer buf) void sg_dealloc_image(sg_image img) + void sg_dealloc_sampler(sg_sampler smp) void sg_dealloc_shader(sg_shader shd) void sg_dealloc_pipeline(sg_pipeline pip) void sg_dealloc_pass(sg_pass pass) @@ -1151,6 +1195,7 @@ void sg_destroy_buffer(sg_buffer buf) void sg_destroy_image(sg_image img) + void sg_destroy_sampler(sg_sampler smp) void sg_destroy_shader(sg_shader shd) void sg_destroy_pipeline(sg_pipeline pip) void sg_destroy_pass(sg_pass pass) @@ -1164,19 +1209,20 @@ sg_fail_buffer(sg_buffer buf) sg_fail_image(sg_image img) + sg_fail_sampler(sg_sampler smp) sg_fail_shader(sg_shader shd) sg_fail_pipeline(sg_pipeline pip) sg_fail_pass(sg_pass pass) This is recommended if anything went wrong outside of sokol-gfx during asynchronous - resource creation (for instance the file loading operation failed). In this case, + resource creation (for instance a file loading operation failed). In this case, the 'fail function' should be called instead of the 'init function'. Calling a 'fail function' on a resource that's not in ALLOC state is a no-op, but will generate a warning log message. NOTE: that two-step resource creation usually only makes sense for buffers - and images, but not for shaders, pipelines or passes. Most notably, trying + and images, but not for samplers, shaders, pipelines or passes. Most notably, trying to create a pipeline object with a shader that's not in VALID state will trigger a validation layer error, or if the validation layer is disabled, result in a pipeline object in FAILED state. Same when trying to create @@ -1233,7 +1279,8 @@ extern "C" { Resource id typedefs: sg_buffer: vertex- and index-buffers - sg_image: textures and render targets + sg_image: images used as textures and render targets + sg_sampler sampler object describing how a texture is sampled in a shader 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 @@ -1329,9 +1376,7 @@ typedef enum sg_backend { sg_pixel_format sokol_gfx.h basically uses the same pixel formats as WebGPU, since these - are supported on most newer GPUs. smaller subset of actually available - pixel formCall sg_query_pixelformat() to check at runtime if a pixel format - supports the desired features. + are supported on most newer GPUs. A pixelformat name consist of three parts: @@ -1453,8 +1498,8 @@ typedef enum sg_pixel_format { by sg_query_pixelformat(). */ typedef struct sg_pixelformat_info { - bool sample; // pixel format can be sampled in shaders - bool filter; // pixel format can be sampled with filtering + bool sample; // pixel format can be sampled in shaders at least with nearest filtering + bool filter; // pixel format can be sampled with linear filtering bool render; // pixel format can be used as render target bool blend; // alpha-blending is supported bool msaa; // pixel format can be used as MSAA render target @@ -1602,8 +1647,9 @@ typedef enum sg_index_type { Indicates the basic type of an image object (2D-texture, cubemap, 3D-texture or 2D-array-texture). 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. + creating an image, and in sg_shader_image_desc to describe a sampled texture + in the shader (both must match and will be checked in the validation layer + when calling sg_apply_bindings). The default image type when creating an image is SG_IMAGETYPE_2D. */ @@ -1620,7 +1666,11 @@ typedef enum sg_image_type { /* sg_image_sample_type - FIXME + The basic data type of a texture sample as expected by a shader. + Must be provided in sg_shader_image_desc and used by the validation + layer in sg_apply_bindings() to check if the provided image object + is compatible with what the shader expects, and also required by the + WebGPU backend. */ typedef enum sg_image_sample_type { _SG_IMAGESAMPLETYPE_DEFAULT, // value 0 reserved for default-init @@ -1635,7 +1685,8 @@ typedef enum sg_image_sample_type { /* sg_sampler_type - FIXME (WGPU only) + The basic type of a texture sampler (sampling vs comparison) as + defined in a shader. Must be provided in sg_shader_sampler_desc. */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, @@ -1710,7 +1761,12 @@ typedef enum sg_primitive_type { For mipmap_filter the default is SG_FILTER_NONE. - NOTE: an image object with (num_mipmaps == 1) *must* use SG_MIPMAP_FILTER_NONE. + The following restrictions apply: + + - an image object with (num_mipmaps == 1) must use SG_FILTER_NONE + - min_filter and mag_filter cannot be SG_FILTER_NONE + + Those restrictions are checked in the validation layer. */ typedef enum sg_filter { _SG_FILTER_DEFAULT, // value 0 reserved for default-init @@ -1737,17 +1793,6 @@ typedef enum sg_filter { 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: - - - GLES3 and WebGL2 - - Metal on iOS */ typedef enum sg_wrap { _SG_WRAP_DEFAULT, // value 0 reserved for default-init @@ -1926,8 +1971,9 @@ typedef enum sg_face_winding { /* sg_compare_func - The compare-function for depth- and stencil-ref tests. - This is used when creating pipeline objects in the members: + The compare-function for configuring depth- and stencil-ref tests + in pipeline objects, and for texture samplers which perform a comparison + instead of regular sampling operation. sg_pipeline_desc .depth @@ -1936,8 +1982,13 @@ typedef enum sg_face_winding { .front.compare .back.compar + sg_sampler_desc + .compare + The default compare func for depth- and stencil-tests is SG_COMPAREFUNC_ALWAYS. + + The default compare func for sampler is SG_COMPAREFUNC_NEVER. */ typedef enum sg_compare_func { _SG_COMPAREFUNC_DEFAULT, // value 0 reserved for default-init @@ -2166,8 +2217,6 @@ typedef struct sg_pass_action { /* sg_bindings - FIXME - The sg_bindings structure defines the resource binding slots of the sokol_gfx render pipeline, used as argument to the sg_apply_bindings() function. @@ -2179,7 +2228,9 @@ typedef struct sg_pass_action { - 0..1 index buffers - 0..1 index buffer offsets - 0..N vertex shader stage images + - 0..N vertex shader stage samplers - 0..N fragment shader stage images + - 0..N fragment shader stage samplers The max number of vertex buffer and shader stage images are defined by the SG_MAX_VERTEX_BUFFERS and @@ -2300,7 +2351,7 @@ typedef struct sg_image_data { .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 targets .data an sg_image_data struct to define the initial content - .label 0 (optional string label for trace hooks) + .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? @@ -2364,7 +2415,7 @@ typedef struct sg_image_desc { /* sg_sampler_desc - FIXME + Creation parameters for sg_sampler objects, used in the sg_make_sampler() call .min_filter: SG_FILTER_NEAREST .mag_filter: SG_FILTER_NEAREST @@ -2372,10 +2423,11 @@ typedef struct sg_image_desc { .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 + .border_color SG_BORDERCOLOR_OPAQUE_BLACK + .compare SG_COMPAREFUNC_NEVER + .max_anisotropy 1 (must be 1..16) */ typedef struct sg_sampler_desc { @@ -2421,10 +2473,16 @@ typedef struct sg_sampler_desc { - 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: + - reflection info for textures used in the shader stage: - the image type (SG_IMAGETYPE_xxx) - - the sampler type (SG_SAMPLETYPE_xxx, default is SG_SAMPLETYPE_FLOAT) - - the name of the texture sampler (optional) + - the image-sample type (SG_IMAGESAMPLETYPE_xxx, default is SG_IMAGESAMPLETYPE_FLOAT) + - whether the shader expects a multisampled texture + - reflection info for samplers used in the shader stage: + - the sampler type (SG_SAMPLERTYPE_xxx) + - reflection info for each image-sampler-pair used by the shader: + - the texture slot of the involved texture + - the sampler slot of the involved sampler + - for GLSL only: the name of the combined image-sampler object For all GL backends, shader source-code must be provided. For D3D11 and Metal, either shader source-code or byte-code can be provided. @@ -2658,7 +2716,7 @@ typedef struct sg_pipeline_desc { is a cubemap, array-texture or 3D-texture, the face-index, array-layer or depth-slice. - All attachments must have the same size. + All attachments must have the same width and height. All color attachments and the depth-stencil attachment must have the same sample count. @@ -2764,6 +2822,7 @@ typedef struct sg_trace_hooks { /* sg_buffer_info sg_image_info + sg_sampler_info sg_shader_info sg_pipeline_info sg_pass_info @@ -2778,6 +2837,7 @@ typedef struct sg_trace_hooks { sg_query_buffer_info() sg_query_image_info() + sg_query_sampler_info() sg_query_shader_info() sg_query_pipeline_info() sg_query_pass_info() From 7f4d5f81ba173104756615e4180ece0016569712 Mon Sep 17 00:00:00 2001 From: Benjamin Trosch Date: Mon, 10 Jul 2023 23:53:55 -0400 Subject: [PATCH 086/292] added function prototypes, removed imguikey function, and added documentation blurb --- util/sokol_imgui.h | 135 ++++++++++++++++++++++++++++++--------------- 1 file changed, 89 insertions(+), 46 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 0166cfb14..a42cc6d8b 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -239,6 +239,27 @@ itself though, not any allocations in Dear ImGui. + IMGUI EVENT HANDLING + ==================== + You can call these functions from your platform's events to handle ImGui events + when SOKOL_IMGUI_NO_SOKOL_APP is defined. + + E.g. mouse position events can be dispatched like this: + + simgui_add_mouse_pos_event(100, 200); + + Key events require a mapping function to convert your platform's key values to ImGuiKey's: + + int map_keycode(int keycode) { + // Your mapping logic here... + } + simgui_add_key_event(map_keycode, keycode, true); + + Take note that modifiers (shift, ctrl, etc.) must be updated manually. + + If sokol_app is being used, ImGui events are handled for you. + + LICENSE ======= @@ -332,6 +353,15 @@ typedef struct simgui_frame_desc_t { SOKOL_IMGUI_API_DECL void simgui_setup(const simgui_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); +SOKOL_IMGUI_API_DECL void simgui_add_focus_event(bool focus); +SOKOL_IMGUI_API_DECL void simgui_add_mouse_pos_event(float x, float y); +SOKOL_IMGUI_API_DECL void simgui_add_touch_pos_event(float x, float y); +SOKOL_IMGUI_API_DECL void simgui_add_mouse_button_event(int mouse_button, bool down); +SOKOL_IMGUI_API_DECL void simgui_add_mouse_wheel_event(float wheel_x, float wheel_y); +SOKOL_IMGUI_API_DECL void simgui_add_key_event(int (*map_keycode)(int), int keycode, bool down); +SOKOL_IMGUI_API_DECL void simgui_add_input_character(uint32_t c); +SOKOL_IMGUI_API_DECL void simgui_add_input_characters_utf8(const char* c); +SOKOL_IMGUI_API_DECL void simgui_add_touch_button_event(int mouse_button, bool down); #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) SOKOL_IMGUI_API_DECL bool simgui_handle_event(const sapp_event* ev); SOKOL_IMGUI_API_DECL int simgui_map_keycode(sapp_keycode keycode); // returns ImGuiKey_* @@ -2137,21 +2167,25 @@ SOKOL_API_IMPL void simgui_render(void) { sg_pop_debug_group(); } -SOKOL_API_IMPL void simgui_add_focus_event(ImGuiIO* io, bool focus) { +SOKOL_API_IMPL void simgui_add_focus_event(bool focus) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); io->AddFocusEvent(focus); #else + ImGuiIO* io = igGetIO(); ImGuiIO_AddFocusEvent(io, focus); #endif } -SOKOL_API_IMPL void simgui_add_mouse_pos_event(ImGuiIO* io, float x, float y) { +SOKOL_API_IMPL void simgui_add_mouse_pos_event(float x, float y) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); #endif io->AddMousePosEvent(x, y); #else + ImGuiIO* io = igGetIO(); #if (IMGUI_VERSION_NUM >= 18950) ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); #endif @@ -2159,13 +2193,15 @@ SOKOL_API_IMPL void simgui_add_mouse_pos_event(ImGuiIO* io, float x, float y) { #endif } -SOKOL_API_IMPL void simgui_add_touch_pos_event(ImGuiIO* io, float x, float y) { +SOKOL_API_IMPL void simgui_add_touch_pos_event(float x, float y) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); #endif io->AddMousePosEvent(x, y); #else + ImGuiIO* io = igGetIO(); #if (IMGUI_VERSION_NUM >= 18950) ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); #endif @@ -2173,13 +2209,15 @@ SOKOL_API_IMPL void simgui_add_touch_pos_event(ImGuiIO* io, float x, float y) { #endif } -SOKOL_API_IMPL void simgui_add_mouse_button_event(ImGuiIO* io, int mouse_button, bool down) { +SOKOL_API_IMPL void simgui_add_mouse_button_event(int mouse_button, bool down) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); #endif io->AddMouseButtonEvent(mouse_button, down); #else + ImGuiIO* io = igGetIO(); #if (IMGUI_VERSION_NUM >= 18950) ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); #endif @@ -2187,13 +2225,15 @@ SOKOL_API_IMPL void simgui_add_mouse_button_event(ImGuiIO* io, int mouse_button, #endif } -SOKOL_API_IMPL void simgui_add_touch_button_event(ImGuiIO* io, int mouse_button, bool down) { +SOKOL_API_IMPL void simgui_add_touch_button_event(int mouse_button, bool down) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) io->AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); #endif io->AddMouseButtonEvent(mouse_button, down); #else + ImGuiIO* io = igGetIO(); #if (IMGUI_VERSION_NUM >= 18950) ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_TouchScreen); #endif @@ -2201,13 +2241,15 @@ SOKOL_API_IMPL void simgui_add_touch_button_event(ImGuiIO* io, int mouse_button, #endif } -SOKOL_API_IMPL void simgui_add_mouse_wheel_event(ImGuiIO* io, float wheel_x, float wheel_y) { +SOKOL_API_IMPL void simgui_add_mouse_wheel_event(float wheel_x, float wheel_y) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) io->AddMouseSourceEvent(ImGuiMouseSource_Mouse); #endif io->AddMouseWheelEvent(wheel_x, wheel_y); #else + ImGuiIO* io = igGetIO(); #if (IMGUI_VERSION_NUM >= 18950) ImGuiIO_AddMouseSourceEvent(io, ImGuiMouseSource_Mouse); #endif @@ -2215,46 +2257,39 @@ SOKOL_API_IMPL void simgui_add_mouse_wheel_event(ImGuiIO* io, float wheel_x, flo #endif } -SOKOL_API_IMPL void simgui_add_key_event(ImGuiIO* io, int (*map_keycode)(int), int keycode, bool down) { +SOKOL_API_IMPL void simgui_add_key_event(int (*map_keycode)(int), int keycode, bool down) { const ImGuiKey imgui_key = (ImGuiKey)map_keycode(keycode); #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); io->AddKeyEvent(imgui_key, down); io->SetKeyEventNativeData(imgui_key, keycode, 0, -1); #else + ImGuiIO* io = igGetIO(); ImGuiIO_AddKeyEvent(io, imgui_key, down); ImGuiIO_SetKeyEventNativeData(io, imgui_key, keycode, 0, -1); #endif } -SOKOL_API_IMPL void simgui_add_imgui_key_event(ImGuiIO* io, ImGuiKey imgui_key, bool down) { - #if defined(__cplusplus) - io->AddKeyEvent(imgui_key, down); - #else - ImGuiIO_AddKeyEvent(io, imgui_key, down); - #endif -} - -SOKOL_API_IMPL void simgui_add_input_character(ImGuiIO* io, uint32_t c) { +SOKOL_API_IMPL void simgui_add_input_character(uint32_t c) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); io->AddInputCharacter(c); #else + ImGuiIO* io = igGetIO(); ImGuiIO_AddInputCharacter(io, c); #endif } -SOKOL_API_IMPL void simgui_add_input_characters_utf8(ImGuiIO* io, const char* c) { +SOKOL_API_IMPL void simgui_add_input_characters_utf8(const char* c) { #if defined(__cplusplus) + ImGuiIO* io = &ImGui::GetIO(); io->AddInputCharactersUTF8(c); #else + ImGuiIO* io = igGetIO(); ImGuiIO_AddInputCharactersUTF8(io, c); #endif } -// returns Ctrl or Super, depending on platform -SOKOL_API_IMPL ImGuiKey simgui_copypaste_modifier(bool is_osx) { - return is_osx ? ImGuiMod_Super : ImGuiMod_Ctrl; -} - #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) _SOKOL_PRIVATE bool _simgui_is_ctrl(uint32_t modifiers) { if (_simgui.is_osx) { @@ -2387,11 +2422,19 @@ _SOKOL_PRIVATE void _simgui_add_sapp_key_event(ImGuiIO* io, sapp_keycode sapp_ke #endif } +_SOKOL_PRIVATE void _simgui_add_imgui_key_event(ImGuiIO* io, ImGuiKey imgui_key, bool down) { + #if defined(__cplusplus) + io->AddKeyEvent(imgui_key, down); + #else + ImGuiIO_AddKeyEvent(io, imgui_key, down); + #endif +} + _SOKOL_PRIVATE void _simgui_update_modifiers(ImGuiIO* io, uint32_t mods) { - simgui_add_imgui_key_event(io, ImGuiMod_Ctrl, (mods & SAPP_MODIFIER_CTRL) != 0); - simgui_add_imgui_key_event(io, ImGuiMod_Shift, (mods & SAPP_MODIFIER_SHIFT) != 0); - simgui_add_imgui_key_event(io, ImGuiMod_Alt, (mods & SAPP_MODIFIER_ALT) != 0); - simgui_add_imgui_key_event(io, ImGuiMod_Super, (mods & SAPP_MODIFIER_SUPER) != 0); + _simgui_add_imgui_key_event(io, ImGuiMod_Ctrl, (mods & SAPP_MODIFIER_CTRL) != 0); + _simgui_add_imgui_key_event(io, ImGuiMod_Shift, (mods & SAPP_MODIFIER_SHIFT) != 0); + _simgui_add_imgui_key_event(io, ImGuiMod_Alt, (mods & SAPP_MODIFIER_ALT) != 0); + _simgui_add_imgui_key_event(io, ImGuiMod_Super, (mods & SAPP_MODIFIER_SUPER) != 0); } // returns Ctrl or Super, depending on platform @@ -2412,23 +2455,23 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { #endif switch (ev->type) { case SAPP_EVENTTYPE_FOCUSED: - simgui_add_focus_event(io, true); + simgui_add_focus_event(true); break; case SAPP_EVENTTYPE_UNFOCUSED: - simgui_add_focus_event(io, false); + simgui_add_focus_event(false); break; case SAPP_EVENTTYPE_MOUSE_DOWN: - simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); - simgui_add_mouse_button_event(io, (int)ev->mouse_button, true); + simgui_add_mouse_pos_event(ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_button_event((int)ev->mouse_button, true); _simgui_update_modifiers(io, ev->modifiers); break; case SAPP_EVENTTYPE_MOUSE_UP: - simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); - simgui_add_mouse_button_event(io, (int)ev->mouse_button, false); + simgui_add_mouse_pos_event(ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_button_event((int)ev->mouse_button, false); _simgui_update_modifiers(io, ev->modifiers); break; case SAPP_EVENTTYPE_MOUSE_MOVE: - simgui_add_mouse_pos_event(io, ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); + simgui_add_mouse_pos_event(ev->mouse_x / dpi_scale, ev->mouse_y / dpi_scale); break; case SAPP_EVENTTYPE_MOUSE_ENTER: case SAPP_EVENTTYPE_MOUSE_LEAVE: @@ -2439,26 +2482,26 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { // "platform behaviour flags". #if defined(__EMSCRIPTEN__) for (int i = 0; i < SAPP_MAX_MOUSEBUTTONS; i++) { - simgui_add_mouse_button_event(io, i, false); + simgui_add_mouse_button_event(i, false); } #endif break; case SAPP_EVENTTYPE_MOUSE_SCROLL: - simgui_add_mouse_wheel_event(io, ev->scroll_x, ev->scroll_y); + simgui_add_mouse_wheel_event(ev->scroll_x, ev->scroll_y); break; case SAPP_EVENTTYPE_TOUCHES_BEGAN: - simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); - simgui_add_touch_button_event(io, 0, true); + simgui_add_touch_pos_event(ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_button_event(0, true); break; case SAPP_EVENTTYPE_TOUCHES_MOVED: - simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_pos_event(ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); break; case SAPP_EVENTTYPE_TOUCHES_ENDED: - simgui_add_touch_pos_event(io, ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); - simgui_add_touch_button_event(io, 0, false); + simgui_add_touch_pos_event(ev->touches[0].pos_x / dpi_scale, ev->touches[0].pos_y / dpi_scale); + simgui_add_touch_button_event(0, false); break; case SAPP_EVENTTYPE_TOUCHES_CANCELLED: - simgui_add_touch_button_event(io, 0, false); + simgui_add_touch_button_event(0, false); break; case SAPP_EVENTTYPE_KEY_DOWN: _simgui_update_modifiers(io, ev->modifiers); @@ -2505,16 +2548,16 @@ SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { (ev->char_code != 127) && (0 == (ev->modifiers & (SAPP_MODIFIER_ALT|SAPP_MODIFIER_CTRL|SAPP_MODIFIER_SUPER)))) { - simgui_add_input_character(io, ev->char_code); + simgui_add_input_character(ev->char_code); } break; case SAPP_EVENTTYPE_CLIPBOARD_PASTED: /* simulate a Ctrl-V key down/up */ if (!_simgui.desc.disable_paste_override) { - simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), true); - simgui_add_imgui_key_event(io, ImGuiKey_V, true); - simgui_add_imgui_key_event(io, ImGuiKey_V, false); - simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), false); + _simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), true); + _simgui_add_imgui_key_event(io, ImGuiKey_V, true); + _simgui_add_imgui_key_event(io, ImGuiKey_V, false); + _simgui_add_imgui_key_event(io, _simgui_copypaste_modifier(), false); } break; default: From 1261f3fa109c11d8e92d96473d8088515fc75a64 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 12 Jul 2023 20:05:08 +0200 Subject: [PATCH 087/292] sokol_gfx.h: finish documentation block on shader creation --- sokol_gfx.h | 139 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 100 insertions(+), 39 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b1a0ecb9f..16fdde8a1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -388,45 +388,6 @@ See the documentation block of the sg_desc struct below for more information. - ON SHADER CREATION - ================== - sokol-gfx doesn't come with an integrated shader cross-compiler, instead - backend-specific shader sources or binary blobs need to provided when - creating a shader object, along with information about the shader interface - needed in the sokol-gfx validation layer and to properly bind shader resources - on the CPU-side to be consumable by the GPU-side. - - The easiest way to provide all this shader creation data is to use the - sokol-shdc shader compiler tool to compile shaders from a common - GLSL syntax into backend-specific sources or binary blobs, along with - shader interface information and uniform blocks mapped to C structs. - - To create a shader using a C header which has been code-generated by sokol-shdc: - - // include the C header code-generated by sokol-shdc: - #include "myshader.glsl.h" - ... - - // create shader using a code-generated helper function from the C header: - sg_shader shd = sg_make_shader(mshader_shader_desc(sg_query_backend())); - - If you're planning to use sokol-shdc, you can stop reading here, instead - continue with the sokol-shdc documentation: - - https://github.com/floooh/sokol-tools/blob/master/docs/sokol-shdc.md - - ...otherwise here's how to provide the information needed for creating shaders - without the help of sokol-shdc. - - To get a general idea how this works, please have a look at the backend-specific - sokol samples, those all create shader object directly without sokol-shdc: - - - for D3D11: https://github.com/floooh/sokol-samples/tree/master/d3d11 - - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal - - for OpenGL: https://github.com/floooh/sokol-samples/tree/master/glfw - - for GLES3: https://github.com/floooh/sokol-samples/tree/master/html5 - - FIXME FIXME FIXME ON RENDER PASSES ================ @@ -630,6 +591,106 @@ texture would result in a validation error). + ON SHADER CREATION + ================== + sokol-gfx doesn't come with an integrated shader cross-compiler, instead + backend-specific shader sources or binary blobs need to provided when + creating a shader object, along with information about the shader interface + needed in the sokol-gfx validation layer and to properly bind shader resources + on the CPU-side to be consumable by the GPU-side. + + The easiest way to provide all this shader creation data is to use the + sokol-shdc shader compiler tool to compile shaders from a common + GLSL syntax into backend-specific sources or binary blobs, along with + shader interface information and uniform blocks mapped to C structs. + + To create a shader using a C header which has been code-generated by sokol-shdc: + + // include the C header code-generated by sokol-shdc: + #include "myshader.glsl.h" + ... + + // create shader using a code-generated helper function from the C header: + sg_shader shd = sg_make_shader(mshader_shader_desc(sg_query_backend())); + + The samples in the 'sapp' subdirectory of the sokol-samples project + also use the sokol-shdc approach: + + https://github.com/floooh/sokol-samples/tree/master/sapp + + If you're planning to use sokol-shdc, you can stop reading here, instead + continue with the sokol-shdc documentation: + + https://github.com/floooh/sokol-tools/blob/master/docs/sokol-shdc.md + + To create shaders with backend-specific shader code or binary blobs, + the sg_make_shader() function requires the following information: + + - Shader code or shader binary blobs for the vertex- and fragment- shader-stage: + - for the desktop GL backend, source code must be provided in '#version 330' syntax + - for the GLES3 backend, source code must be provided in '#version 300 es' syntax + - for the D3D11 backend, shaders can be provided as source or binary blobs, the + source code should be in HLSL4.0 (for best compatibility) or alternatively + in HLSL5.0 syntax (other versions may work but are not tested), NOTE: when + shader source code is provided for the D3D11 backend, sokol-gfx will dynamically + load 'd3dcompiler_47.dll' + - for the Metal backends, shaders can be provided as source or binary blobs, the + MSL version should be in 'metal-1.1' (other versions may work but are not tested) + - optionally the following shader-code related attributes can be provided: + - an entry function name (only on D3D11 or Metal, but not OpenGL) + - on D3D11 only, a compilation target (default is "vs_4_0" and "ps_4_0" + + - Depending on backend, information about the input vertex attributes used by the + vertex shader: + - Metal: no information needed since vertex attributes are always bound + by their attribute location defined in the shader via '[[attribute(N)]]' + - GLSL: vertex attribute names can be optionally provided, in that case their + location will be looked up by name, otherwise, the vertex attribute location + can be defined 'layout(location = N)', PLEASE NOTE that the name-lookup method + may be removed at some point + - D3D11: a 'semantic name' and 'semantic index' must be provided for each vertex + attribute, e.g. if the vertex attribute is defined as 'TEXCOORD1' in the shader, + the semantic name would be 'TEXCOORD', and the semantic index would be '1' + + - Information about each uniform block used in the shader: + - The size of the uniform block in number of bytes. + - A layout hint (currently 'native' or 'std140') where 'native' defines a + backend-specific memory layout which shouldn't be used for cross-platform code. + Only std140 guarantees a backend-agnostic memory layout. + - For GLSL only: a description of the internal uniform block layout, which maps + member types and their offsets on the CPU side to uniform variable names + in the GLSL shader + - please also NOTE the documentation sections about UNIFORM DATA LAYOUT + and CROSS-BACKEND COMMON UNIFORM DATA LAYOUT below! + + - A description of each texture/image used in the shader: + - the expected image type (e.g. 2D, 3D, etc...) + - the 'image sample type' (e.g. float, depth, signed- or unsigned-int) + - a flag whether the texture is expected to be multisampled + (currently it's not supported to fetch data from multisampled + textures in shaders, but this is planned for a later time) + + - A description of each sampler used in the shader: + - just wether the sampler is a regular 'sampling sampler', + or a 'comparison sampler' (which is usually used for + texture mapping) + + - An array of 'image-sampler-pairs' used by the shader to sample textures, + for D3D11 and Metal this is only used for validation purposes to check + whether the texture and sampler are compatible with each other. For GLSL + an additional 'combined-image-sampler name' must be provided because + 'OpenGL style GLSL' cannot handle separate texture and sampler objects, + but still groups them into a tradtional GLSL 'sampler object'. + + For example code of how to create backend-specific shader objects, + please refer to the following samples: + + - for D3D11: https://github.com/floooh/sokol-samples/tree/master/d3d11 + - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal + - for OpenGL: https://github.com/floooh/sokol-samples/tree/master/glfw + - for GLES3: https://github.com/floooh/sokol-samples/tree/master/html5 + + UNIFORM DATA LAYOUT: ==================== NOTE: if you use the sokol-shdc shader compiler tool, you don't need to worry From d629e4538bb40f578057e2843f6e6c6995e42cae Mon Sep 17 00:00:00 2001 From: "Stian H. Johannesen" Date: Sat, 15 Jul 2023 15:13:00 +0200 Subject: [PATCH 088/292] sokol_debugtext.h: fix doc code example typo --- util/sokol_debugtext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index eed04361c..d98b8259d 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -82,7 +82,7 @@ fonts that can be used for rendering. To use all builtin fonts call sdtx_setup() like this (in C99): - sdtx_setup(&sdtx_desc_t){ + sdtx_setup(&(sdtx_desc_t){ .fonts = { [0] = sdtx_font_kc853(), [1] = sdtx_font_kc854(), From 99986cccaaec2ebc21b79e680b543eeb91d60f03 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 16 Jul 2023 17:07:53 +0200 Subject: [PATCH 089/292] sokol_gfx.h: remove obsolete docs and code --- sokol_gfx.h | 97 ----------------------------------------------------- 1 file changed, 97 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 16fdde8a1..b47f6bf6b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -800,96 +800,6 @@ to use the sokol-shdc shader cross-compiler tool! - BACKEND-SPECIFIC TOPICS: - ======================== - FIXME: delete this block after the new shader creation block is complete - - --- The GL backends need to know about the internal structure of uniform - blocks, and the texture type. The uniform layout details - are described in the UNIFORM DATA LAYOUT section above. - - // uniform block structure and texture image definition in sg_shader_desc: - sg_shader_desc desc = { - // uniform block description (size and internal structure) - .vs.uniform_blocks[0] = { - ... - }, - // one texture on the fragment-shader-stage (name is optional) - .fs.images[0] = { .type=SG_IMAGETYPE_ARRAY } - ... - }; - - --- the Metal and D3D11 backends only need to know the size of uniform blocks, - not their internal member structure, and they only need to know - the type of a texture sampler, not its name: - - sg_shader_desc desc = { - .vs.uniform_blocks[0].size = sizeof(params_t), - .fs.images[0].type = SG_IMAGETYPE_ARRAY, - ... - }; - - --- when creating a shader object, vertex attribute names may be provided - for the GL backends: - - sg_shader_desc desc = { - .attrs = { - [0] = { .name="position" }, - [1] = { .name="color1" } - } - }; - - The vertex attribute names provided when creating a shader will be - used later in sg_create_pipeline() for matching the vertex layout - to vertex shader inputs. - - --- on D3D11 you need to provide a semantic name and semantic index in the - shader description struct instead (see the D3D11 documentation on - D3D11_INPUT_ELEMENT_DESC for details): - - sg_shader_desc desc = { - .attrs = { - [0] = { .sem_name="POSITION", .sem_index=0 } - [1] = { .sem_name="COLOR", .sem_index=1 } - } - }; - - The provided semantic information will be used later in sg_create_pipeline() - to match the vertex layout to vertex shader inputs. - - --- on D3D11, and when passing HLSL source code (instead of byte code) to shader - creation, you can optionally define the shader model targets on the vertex - stage: - - sg_shader_Desc desc = { - .vs = { - ... - .d3d11_target = "vs_5_0" - }, - .fs = { - ... - .d3d11_target = "ps_5_0" - } - }; - - The default targets are "ps_4_0" and "fs_4_0". Note that those target names - are only used when compiling shaders from source. They are ignored when - creating a shader from bytecode. - - --- on Metal, GL 3.3 or GLES3/WebGL2, you don't need to provide an attribute - name or semantic name, since vertex attributes can be bound by their slot index - (this is mandatory in Metal, and optional in GL): - - sg_pipeline_desc desc = { - .layout = { - .attrs = { - [0] = { .format=SG_VERTEXFORMAT_FLOAT3 }, - [1] = { .format=SG_VERTEXFORMAT_FLOAT4 } - } - } - }; - - WORKING WITH CONTEXTS ===================== sokol-gfx allows to switch between different rendering contexts and @@ -7029,13 +6939,6 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture_sampler(GLuint tex, GLuint s } } -// called from _sg_gl_discard_sampler() -_SOKOL_PRIVATE void _sg_gl_cache_invalidate_sampler(GLuint smp) { - // FIXME! - (void)smp; - SOKOL_ASSERT(false); -} - // called from _sg_gl_discard_shader() _SOKOL_PRIVATE void _sg_gl_cache_invalidate_program(GLuint prog) { if (prog == _sg.gl.cache.prog) { From b96f491f24ba8cadfa276dadbcadbb9d13e8d3a4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 16 Jul 2023 18:56:24 +0200 Subject: [PATCH 090/292] sokol_nuklear.h: fix example code in docs --- util/sokol_nuklear.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 184440349..21b7761e5 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -159,7 +159,7 @@ `nk_handle snk_nkhandle(sg_image img)` together with the Nuklear function nk_image_handle like this: - nk_image_handle(snk_nkhandle(img)) + nk_image nki = nk_image_handle(snk_nkhandle(img)); Note that it's currently not possible to provide a custom sg_sampler object. From 17d799177833ffc9b204ba66fbd68cd8c689384e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 16 Jul 2023 18:58:09 +0200 Subject: [PATCH 091/292] update changelog and readme --- CHANGELOG.md | 240 ++++++++++++++++++++++++++++++++++++++++++++------- README.md | 2 +- 2 files changed, 212 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72006f77f..619916ef6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,213 @@ ## Updates -- **20-May-2023**: some minor event-related cleanup in sokol_app.h and - a touchscreen fix in sokol_imgui.h - - - in the event `SAPP_EVENTTYPE_FILESDROPPED`: - - the `sapp_event.modifier` field now contains the active modifier keys - at the time of the file drop operations on the platforms macOS, Emscripten - and Win32 (on Linux I haven't figured out how this might work with the - Xlib API) - - on macOS, the `sapp_event.mouse_x/y` fields now contain the window-relative - mouse position where the drop happened (this already worked as expected on - the other desktop platforms) - - on macOS and Linux, the `sapp_event.mouse_dx/dy` fields are now set to zero - (this already was the case on Emscripten and Win32) - - in the events `SAPP_EVENTTYPE_MOUSE_ENTER` and `SAPP_EVENTTYPE_MOUSE_LEAVE`: - - the `sapp_event.mouse_dx/dy` fields are now set to zero, previously this - could be a very big value on some desktop platforms - - Many thanks to @castano for the initial PR (https://github.com/floooh/sokol/pull/830)! - - - In sokol_imgui.h, the new io.AddMouseSourceEvent() function in Dear ImGui 1.89.5 - is called to differentiate between mouse- and touch-events, this makes ui tabs - work with a single tap (previously a double-tap on the tab was needed). The code - won't break if the ImGui version is older (in this case the function simply isn't called) - - -- **19-May-2023**: _**BREAKING CHANGES**_ in sokol_gfx.h: Render passes are now more 'harmonized' - with Metal and WebGPU by exposing a 'store action', and making MSAA resolve attachments - explicit. The changes in detail: +#### 16-Jul-2023 + +**BREAKING CHANGES** + +The main topic of this update is to separate sampler state from image state in +sokol_gfx.h which became possible after GLES2 support had been removed from +sokol_gfx.h. + +This also causes some 'colateral changes' in shader authoring and +other sokol headers, but there was opportunity to fill a few feature gaps +in sokol_gfx.h as well: + +- it's now possible to sample depth textures in shaders both with regular + samplers, and with 'comparison samplers' (which is mainly useful for shadow mapping) +- it's now possible to create render passes without color attachments for + 'depth-only' rendering + +See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows-depthtex-sapp.html) sample which demonstrates both features. + +##### **sokol_gfx.h** + +- texture sampler state has been removed from `sg_image_desc`, instead you now + need to create separate sampler objects: + + ```c + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + .wrap_u = SG_WRAP_CLAMP_TO_EDGE, + .wrap_v = SG_WRAP_CLAMP_TO_EDGE + }); + ``` + +- texture filtering is now described by 3 separate filters: + - min_filter = SG_FILTER_NEAREST | SG_FILTER_LINEAR + - mag_filter = SG_FILTER_NEAREST | SG_FILTER_LINEAR + - mipmap_filter = SG_FILTER_NONE | SG_FILTER_NEAREST | SG_FILTER_LINEAR + + ...this basically switches from the esoteric GL convention to a convention + that's used by all other 3D APIs. There's still a limitation that's caused by + GL though: a sampler which is going to be used with an image that has a + `mipmap_count = 1` requires that `.mipmap_filter = SG_FILTER_NONE`. + +- another new sampler state in `sg_sampler_desc` is `sg_compare_func compare;`, + this allows to create 'comparison samplers' for shadow mapping + +- when calling `sg_apply_bindings()` the struct `sg_bindings` now has changed + to also include sampler objects, note that there is no 1:1 relationship + between images and samplers required: + + ```c + sg_apply_bindings(&(sg_bindings){ + .vertex_buffers[0] = vbuf, + .fs = { + .images = { + [0] = img0, + [1] = img1, + [2] = img2, + }, + .samplers[0] = smp, + } + }); + ``` + +- if you use sokol-shdc, you need to rewrite your shaders from 'OpenGL GLSL style' (with + combined image samplers) to 'Vulkan GLSL style' (with separate textures and samplers): + + E.g. the old GL-style shader with combined image samplers: + + ```glsl + sampler2D tex; + + void main() { + frag_color = texture(tex, uv); + } + ``` + ...now needs to look like this: + + ```glsl + texture2D tex; + sampler smp; + + void main() { + frag_color = texture(sampler2D(tex, smp), uv); + } + ``` + + sokol-shdc will now throw an error if it encounters an 'old' shader using combined + image-samplers, this helps you to catch all places where a rewrite to separate + texture and sampler objects is required. + +- If you *don't* use sokol-shdc and instead provide your own backend-specific + shaders, you need to provide more shader interface reflection info about the texture + and sampler usage in a shader when calling `sg_make_shader`. + Please see the new documentation block `ON SHADER CREATION` in sokol_gfx.h for more details! + + Also refer to the updated 3D-backend-specific samples here: + + - for GL: https://github.com/floooh/sokol-samples/tree/master/glfw + - for GLES3: https://github.com/floooh/sokol-samples/tree/master/html5 + - for D3D11: https://github.com/floooh/sokol-samples/tree/master/d3d11 + - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal + +- it's now possible to create `sg_pass` objects without color attachments to + enable depth-only rendering, see the new sample for details [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows-depthtex-sapp.html), + specifically be aware of the caveat that a compatible `sg_pipeline` object + needs to 'deactivate' the first color target by setting its pixel format + to `NONE`: + + ```c + sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){ + ... + .colors[0].pixel_format = SG_PIXELFORMAT_NONE, + ... + }); + ``` + +- the following struct names have been changed to be more in line with related + struct names, this also makes those names similar to WebGPU types: + + - `sg_buffer_layout_desc` => `sg_vertex_buffer_layout_state` + - `sg_vertex_attr_desc` => `sg_vertex_attr_state` + - `sg_layout_desc` => `sg_vertex_layout_state` + - `sg_color_state` => `sg_color_target_state` + +##### **sokol_gl.h** + +- The function `sgl_texture(sg_image img)` has been changed to accept a sampler + object to `sgl_texture(sg_image img, sg_sampler smp)`. Passing an invalid image handle + will use the builtin default (white) texture, and passing an invalid sampler + handle will use the builtin default sampler. + +##### **sokol_shape.h** + +- Some sokol-shape functions have been renamed to match renamed structs in sokol-gfx: + + - `sshape_buffer_layout_desc()` => `sshape_vertex_buffer_layout_state()` + - `sshape_position_attr_desc()` => `sshape_position_vertex_attr_state()` + - `sshape_normal_attr_desc()` => `sshape_normal_vertex_attr_state()` + - `sshape_texcoord_attr_desc()` => `sshape_texcoord_vertex_attr_state()` + - `sshape_color_attr_desc()` => `sshape_color_vertex_attr_state()` + +##### **sokol_spine.h** + +- A sokol-spine atlas object now allocates both an `sg_image` and `sg_sampler` handle + and expects the user code to initialize those handles to complete image and + sampler objects. Check the updates sokol-spine samples here for more details: + + https://github.com/floooh/sokol-samples/tree/master/sapp + +##### **sokol_imgui.h** + +- sokol_imgui.h has a new public function to create an ImTextureID handle from + an `sg_image` handle which can be used like this: + + ```c + ImTextureID tex_id = simgui_imtextureid(img); + ``` + + Note that sokol-imgui currently doesn't currently allow to pass user-provided `sg_sampler` + object with the user-provided image. + +##### **sokol_nuklear.h** + +- similar to sokol_imgui.h, there's a new public function `snk_nkhandle()` + which creates a Nuklear handle from a sokol-gfx image handle which can be + used like this to create a Nuklear image handle: + + ```c + nk_image nki = nk_image_handle(snk_nkhandle(img)); + ``` + + As with sokol_imgui.h, it's currently not possible to pass a user-provided `sg_sampler` + object with the image. + + +#### 20-May-2023 + +Some minor event-related cleanup in sokol_app.h and a touchscreen fix in sokol_imgui.h + +- in the event `SAPP_EVENTTYPE_FILESDROPPED`: + - the `sapp_event.modifier` field now contains the active modifier keys + at the time of the file drop operations on the platforms macOS, Emscripten + and Win32 (on Linux I haven't figured out how this might work with the + Xlib API) + - on macOS, the `sapp_event.mouse_x/y` fields now contain the window-relative + mouse position where the drop happened (this already worked as expected on + the other desktop platforms) + - on macOS and Linux, the `sapp_event.mouse_dx/dy` fields are now set to zero + (this already was the case on Emscripten and Win32) +- in the events `SAPP_EVENTTYPE_MOUSE_ENTER` and `SAPP_EVENTTYPE_MOUSE_LEAVE`: + - the `sapp_event.mouse_dx/dy` fields are now set to zero, previously this + could be a very big value on some desktop platforms + +Many thanks to @castano for the initial PR (https://github.com/floooh/sokol/pull/830)! + +- In sokol_imgui.h, the new io.AddMouseSourceEvent() function in Dear ImGui 1.89.5 + is called to differentiate between mouse- and touch-events, this makes ui tabs + work with a single tap (previously a double-tap on the tab was needed). The code + won't break if the ImGui version is older (in this case the function simply isn't called) + + +#### 19-May-2023 + +**BREAKING CHANGES**_ in sokol_gfx.h: Render passes are now more 'harmonized' +with Metal and WebGPU by exposing a 'store action', and making MSAA resolve attachments +explicit. The changes in detail: + - A new documentation section `ON RENDER PASSES` has been added to sokol_gfx.h, this gives a much more detailed overview of the new render pass behaviour than this changelog, please make sure to give it a read - especially when you are using @@ -62,7 +242,9 @@ Next up: WebGPU! -- **30-Apr-2023**: GLES2/WebGL1 support has been removed from the sokol headers (now that +#### 30-Apr-2023 + +GLES2/WebGL1 support has been removed from the sokol headers (now that all browsers support WebGL2, and WebGPU is around the corner I feel like it's finally time to ditch GLES2. diff --git a/README.md b/README.md index d9ac024a0..b9f403dfe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**19-May-2023** BREAKING CHANGES in sokol_gfx.h around render pass behaviour) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Jul-2023** BREAKING CHANGES: sokol_gfx.h now has separate sampler objects!) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 2aada5c4afcd0e881c682578ed98262232e3e43a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 16 Jul 2023 19:32:07 +0200 Subject: [PATCH 092/292] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 619916ef6..c8581cc0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,6 +125,13 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows - `sg_layout_desc` => `sg_vertex_layout_state` - `sg_color_state` => `sg_color_target_state` +- bugfixes and under-the-hood changes + - `sg_begin_pass()` used the wrong framebuffer size when rendering to a mip-level != 0 + - on macOS the Metal backend now creates resources in Shared resource storage mode if + supported by the device + - on iOS the Metal backend now supports clamp-to-border-color if possible (depends on + iOS version and GPU family) + ##### **sokol_gl.h** - The function `sgl_texture(sg_image img)` has been changed to accept a sampler From f793299d4d67bdf4b40a8c1c1b3bfa16b93656ec Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 13:13:43 +0200 Subject: [PATCH 093/292] changelog: mention 'pre-separate-samplers' tag --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8581cc0d..be504103c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ in sokol_gfx.h as well: See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows-depthtex-sapp.html) sample which demonstrates both features. +> NOTE: all related projects have a git tag `pre-separate-samplers` in case you are not ready yet to make the switch + ##### **sokol_gfx.h** - texture sampler state has been removed from `sg_image_desc`, instead you now From e475aa44401088c5c04ee649b572f7b6a7d10691 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 15:00:32 +0200 Subject: [PATCH 094/292] changelog: mention use of if(@available(...)) in sokol headers --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be504103c..0fd574b4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,6 +129,11 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows - bugfixes and under-the-hood changes - `sg_begin_pass()` used the wrong framebuffer size when rendering to a mip-level != 0 + - the Metal backend code started to use the `if (@available(...))` statement + to check for runtime-availability of macOS/iOS API features (this caused problems + in the sokol-zig bindings with Zig version 0.10.1, this is fixed in the current + zig-0.11.0-dev version => I'll merge the zig-0.11.0 branch of the bindings into + master a bit early, hopefully zig 0.11.0 isn't too far out) - on macOS the Metal backend now creates resources in Shared resource storage mode if supported by the device - on iOS the Metal backend now supports clamp-to-border-color if possible (depends on From feb51cd7a04259daf100f21e9a9b24e27c5e4a39 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 19:37:38 +0200 Subject: [PATCH 095/292] gh actions: temporarily remove macos from sokol-rust build matrix --- .github/workflows/gen_bindings.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index a2e2c22e7..fdd097f3d 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -214,7 +214,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 From 4f0eb1bb7e2da20a570ae06942409b5cbca96071 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 19:38:31 +0200 Subject: [PATCH 096/292] gh actions: set zig version to 0.11.0-dev.4004+a57608217 --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index fdd097f3d..1c992512e 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -101,7 +101,7 @@ jobs: repository: floooh/sokol-zig - uses: goto-bus-stop/setup-zig@v1 with: - version: 0.10.0 + version: 0.11.0-dev.4004+a57608217 - uses: actions/download-artifact@v3 with: name: ignore-me-zig From 41c725e5563d7f4c2d31807ed68a86b6f7fd461f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 19:50:13 +0200 Subject: [PATCH 097/292] changelog: mention linker problems in the sokol-zig and sokol-rust bindings on macOS --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fd574b4a..39a64ef3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,11 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows in the sokol-zig bindings with Zig version 0.10.1, this is fixed in the current zig-0.11.0-dev version => I'll merge the zig-0.11.0 branch of the bindings into master a bit early, hopefully zig 0.11.0 isn't too far out) + - **NOTE:** this change (`if (@available(...))`) caused linking problems in + the Zig and Rust bindings on GH Actions (missing symbol + `___isPlatformVersionAtLeast`) which I could not reproduce locally on my + M1 Mac. On Zig this could be fixed by moving to the latest zig-0.11.0-dev + version, but for Rust this still needs to be fixed). - on macOS the Metal backend now creates resources in Shared resource storage mode if supported by the device - on iOS the Metal backend now supports clamp-to-border-color if possible (depends on From a6195239d8c91391000e10f73645c16471486c94 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 20:12:00 +0200 Subject: [PATCH 098/292] changelog: mention that a sokol-shdc binary update is also needed --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a64ef3c..fac1f4ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows > NOTE: all related projects have a git tag `pre-separate-samplers` in case you are not ready yet to make the switch +> NOTE 2: if you use sokol-gfx with the sokol-shdc shader compiler, you'll also need +> to update the sokol-shdc binaries from https://github.com/floooh/sokol-tools-bin + ##### **sokol_gfx.h** - texture sampler state has been removed from `sg_image_desc`, instead you now From 1644c3b78a82ee51244f1643d8f910cee6d6f3c7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 20:46:48 +0200 Subject: [PATCH 099/292] update code example in changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fac1f4ee5..93272e5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,11 +60,11 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows .vertex_buffers[0] = vbuf, .fs = { .images = { - [0] = img0, - [1] = img1, - [2] = img2, + [SLOT_tex0] = img0, + [SLOT_tex1] = img1, + [SLOT_tex2] = img2, }, - .samplers[0] = smp, + .samplers[SLOT_smp] = smp, } }); ``` From bd85445598016b0e3ff2850ecfdccbe7e7bcaab7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 21:32:56 +0200 Subject: [PATCH 100/292] changelog: clean up some redundancy --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93272e5dd..b66c91398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,10 +133,7 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows - bugfixes and under-the-hood changes - `sg_begin_pass()` used the wrong framebuffer size when rendering to a mip-level != 0 - the Metal backend code started to use the `if (@available(...))` statement - to check for runtime-availability of macOS/iOS API features (this caused problems - in the sokol-zig bindings with Zig version 0.10.1, this is fixed in the current - zig-0.11.0-dev version => I'll merge the zig-0.11.0 branch of the bindings into - master a bit early, hopefully zig 0.11.0 isn't too far out) + to check for runtime-availability of macOS/iOS API features - **NOTE:** this change (`if (@available(...))`) caused linking problems in the Zig and Rust bindings on GH Actions (missing symbol `___isPlatformVersionAtLeast`) which I could not reproduce locally on my From a3e0362ad4acff849eff6cc83bdf3aa7ed8d89b5 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 21:42:25 +0200 Subject: [PATCH 101/292] changelog: fix GLSL code samples doh --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b66c91398..d43fac5b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,7 +75,7 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows E.g. the old GL-style shader with combined image samplers: ```glsl - sampler2D tex; + uniform sampler2D tex; void main() { frag_color = texture(tex, uv); @@ -84,8 +84,8 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows ...now needs to look like this: ```glsl - texture2D tex; - sampler smp; + uniform texture2D tex; + uniform sampler smp; void main() { frag_color = texture(sampler2D(tex, smp), uv); From fd387074e42d5de716837a71f4dc0d6790435a48 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 17 Jul 2023 21:58:02 +0200 Subject: [PATCH 102/292] changelog: fix some typos --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d43fac5b4..278535e32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,8 +109,8 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal - it's now possible to create `sg_pass` objects without color attachments to - enable depth-only rendering, see the new sample for details [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows-depthtex-sapp.html), - specifically be aware of the caveat that a compatible `sg_pipeline` object + enable depth-only rendering, see the new sample [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows-depthtex-sapp.html) for details, + specifically be aware of the caveat that a depth-only-compatible `sg_pipeline` object needs to 'deactivate' the first color target by setting its pixel format to `NONE`: @@ -165,7 +165,7 @@ See the new [shadows-depthtex-sapp](https://floooh.github.io/sokol-html5/shadows - A sokol-spine atlas object now allocates both an `sg_image` and `sg_sampler` handle and expects the user code to initialize those handles to complete image and - sampler objects. Check the updates sokol-spine samples here for more details: + sampler objects. Check the updated sokol-spine samples here for more details: https://github.com/floooh/sokol-samples/tree/master/sapp From 58936be501e8a43d9ea8f3bf8ea74232a06bdf17 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 18 Jul 2023 11:35:25 +0200 Subject: [PATCH 103/292] sokol_gfx.h: fix doc typos --- sokol_gfx.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 38111e3d8..19a29d6b4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -594,7 +594,7 @@ ON SHADER CREATION ================== sokol-gfx doesn't come with an integrated shader cross-compiler, instead - backend-specific shader sources or binary blobs need to provided when + backend-specific shader sources or binary blobs need to be provided when creating a shader object, along with information about the shader interface needed in the sokol-gfx validation layer and to properly bind shader resources on the CPU-side to be consumable by the GPU-side. @@ -611,7 +611,7 @@ ... // create shader using a code-generated helper function from the C header: - sg_shader shd = sg_make_shader(mshader_shader_desc(sg_query_backend())); + sg_shader shd = sg_make_shader(myshader_shader_desc(sg_query_backend())); The samples in the 'sapp' subdirectory of the sokol-samples project also use the sokol-shdc approach: @@ -638,7 +638,7 @@ MSL version should be in 'metal-1.1' (other versions may work but are not tested) - optionally the following shader-code related attributes can be provided: - an entry function name (only on D3D11 or Metal, but not OpenGL) - - on D3D11 only, a compilation target (default is "vs_4_0" and "ps_4_0" + - on D3D11 only, a compilation target (default is "vs_4_0" and "ps_4_0") - Depending on backend, information about the input vertex attributes used by the vertex shader: @@ -646,7 +646,7 @@ by their attribute location defined in the shader via '[[attribute(N)]]' - GLSL: vertex attribute names can be optionally provided, in that case their location will be looked up by name, otherwise, the vertex attribute location - can be defined 'layout(location = N)', PLEASE NOTE that the name-lookup method + can be defined with 'layout(location = N)', PLEASE NOTE that the name-lookup method may be removed at some point - D3D11: a 'semantic name' and 'semantic index' must be provided for each vertex attribute, e.g. if the vertex attribute is defined as 'TEXCOORD1' in the shader, @@ -654,7 +654,7 @@ - Information about each uniform block used in the shader: - The size of the uniform block in number of bytes. - - A layout hint (currently 'native' or 'std140') where 'native' defines a + - A memory layout hint (currently 'native' or 'std140') where 'native' defines a backend-specific memory layout which shouldn't be used for cross-platform code. Only std140 guarantees a backend-agnostic memory layout. - For GLSL only: a description of the internal uniform block layout, which maps @@ -673,7 +673,7 @@ - A description of each sampler used in the shader: - just wether the sampler is a regular 'sampling sampler', or a 'comparison sampler' (which is usually used for - texture mapping) + shadow mapping) - An array of 'image-sampler-pairs' used by the shader to sample textures, for D3D11 and Metal this is only used for validation purposes to check @@ -796,7 +796,7 @@ std140 layout rules, this means that the cbuffer declarations in HLSL code must be tweaked so that the layout is compatible with std140. - The by far easiest way to tacke the common uniform block layout problem is + The by far easiest way to tackle the common uniform block layout problem is to use the sokol-shdc shader cross-compiler tool! @@ -1197,7 +1197,7 @@ to create a pipeline object with a shader that's not in VALID state will trigger a validation layer error, or if the validation layer is disabled, result in a pipeline object in FAILED state. Same when trying to create - a pass object with image invalid image objects. + a pass object with invalid image objects. LICENSE ======= From 4b900b790a8681b9f1bcf5f76a2a4cfb15598c8c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 21 Jul 2023 17:51:02 +0200 Subject: [PATCH 104/292] sokol_imgui.h: start with simgui_image_t implementation --- util/sokol_imgui.h | 179 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 2 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 4cba553bf..d8f43b4c0 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -323,6 +323,33 @@ extern "C" { #endif +enum { + SIMGUI_INVALID_ID = 0, +}; + +/* + simgui_image_t + + A combined image-sampler pair used to inject custom images and samplers into Dear ImGui. + + Create with simgui_make_image(), and convert to an ImTextureID handle via + simgui_imtextureid(). +*/ +typedef struct simgui_image_t { uint32_t id } simgui_image_t; + +/* + simgui_image_desc_t + + Descriptor struct for simgui_make_image(). You must provide + at least an sg_image handle. Keeping the sg_sampler handle + zero-initialized will select the builtin default sampler + which uses linear filtering. +*/ +typedef struct simgui_image_desc_t { + sg_image image; + sg_sampler sampler +} simgui_image_desc_t; + /* simgui_allocator_t @@ -339,6 +366,7 @@ typedef struct simgui_allocator_t { typedef struct simgui_desc_t { int max_vertices; + int image_pool_size; // default size: 256 sg_pixel_format color_format; sg_pixel_format depth_format; int sample_count; @@ -361,7 +389,9 @@ typedef struct simgui_frame_desc_t { SOKOL_IMGUI_API_DECL void simgui_setup(const simgui_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); -SOKOL_IMGUI_API_DECL void* simgui_imtextureid(sg_image img); +SOKOL_IMGUI_API_DECL simgui_image_t simgui_make_image(simgui_image_desc_t* desc); +SOKOL_IMGUI_API_DECL void simgui_destroy_image(simgui_image_t img); +SOKOL_IMGUI_API_DECL void* simgui_imtextureid(simgui_image_t img); SOKOL_IMGUI_API_DECL void simgui_add_focus_event(bool focus); SOKOL_IMGUI_API_DECL void simgui_add_mouse_pos_event(float x, float y); SOKOL_IMGUI_API_DECL void simgui_add_touch_pos_event(float x, float y); @@ -432,6 +462,11 @@ inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_ne #endif #endif +#define _SIMGUI_INVALID_SLOT_INDEX (0) +#define _SIMGUI_SLOT_SHIFT (16) +#define _SIMGUI_MAX_POOL_SIZE (1<<_SIMGUI_SLOT_SHIFT) +#define _SIMGUI_SLOT_MASK (_SIMGUI_MAX_POOL_SIZE-1) + // helper macros and constants #define _simgui_def(val, def) (((val) == 0) ? (def) : (val)) @@ -440,6 +475,37 @@ typedef struct { uint8_t _pad_8[8]; } _simgui_vs_params_t; +typedef enum { + _SIMGUI_RESOURCESTATE_INITIAL, + _SIMGUI_RESOURCESTATE_ALLOC, + _SIMGUI_RESOURCESTATE_VALID, + _SIMGUI_RESOURCESTATE_FAILED, + _SIMGUI_RESOURCESTATE_INVALID, + _SIMGUI_RESOURCESTATE_FORCE_U32 = 0x7FFFFFFF +} _simgui_resource_state; + +typedef struct { + uint32_t id; + _simgui_resource_state state; +} _simgui_slot_t; + +typedef struct { + int size; + int queue_top; + uint32_t* gen_ctrs; + int* free_queue; +} _simgui_pool_t; + +typedef struct { + sg_image img; + sg_sampler smp; +} _simgui_image_t; + +typedef struct { + _simgui_pool_t pool; + _simgui_image_t* items; +} _simgui_image_pool_t; + typedef struct { simgui_desc_t desc; float cur_dpi_scale; @@ -451,7 +517,8 @@ typedef struct { sg_pipeline pip; sg_range vertices; sg_range indices; - bool is_osx; // return true if running on OSX (or HTML5 OSX), needed for copy/paste + bool is_osx; + _simgui_image_pool_t image_pool; } _simgui_state_t; static _simgui_state_t _simgui; @@ -1717,6 +1784,12 @@ static void* _simgui_malloc(size_t size) { return ptr; } +static void* _simgui_malloc_clear(size_t size) { + void* ptr = _sspine_malloc(size); + _sspine_clear(ptr, size); + return ptr; +} + static void _simgui_free(void* ptr) { if (_simgui.desc.allocator.free) { _simgui.desc.allocator.free(ptr, _simgui.desc.allocator.user_data); @@ -1725,6 +1798,108 @@ static void _simgui_free(void* ptr) { } } +static void _simgui_init_pool(_simgui_pool_t* pool, int num) { + SOKOL_ASSERT(pool && (num >= 1)); + // slot 0 is reserved for the 'invalid id', so bump the pool size by 1 + pool->size = num + 1; + pool->queue_top = 0; + // generation counters indexable by pool slot index, slot 0 is reserved + size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size; + pool->gen_ctrs = (uint32_t*) _sspine_malloc_clear(gen_ctrs_size); + // it's not a bug to only reserve 'num' here + pool->free_queue = (int*) _sspine_malloc_clear(sizeof(int) * (size_t)num); + // never allocate the zero-th pool item since the invalid id is 0 + for (int i = pool->size-1; i >= 1; i--) { + pool->free_queue[pool->queue_top++] = i; + } +} + +static void _simgui_discard_pool(_simgui_pool_t* pool) { + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + _simgui_free(pool->free_queue); + pool->free_queue = 0; + SOKOL_ASSERT(pool->gen_ctrs); + _simgui_free(pool->gen_ctrs); + pool->gen_ctrs = 0; + pool->size = 0; + pool->queue_top = 0; +} + +static int _simgui_pool_alloc_index(_simgui_pool_t* pool) { + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + if (pool->queue_top > 0) { + int slot_index = pool->free_queue[--pool->queue_top]; + SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); + return slot_index; + } else { + // pool exhausted + return _SIMGUI_INVALID_SLOT_INDEX; + } +} + +static void _simgui_pool_free_index(_simgui_pool_t* pool, int slot_index) { + SOKOL_ASSERT((slot_index > _SIMGUI_INVALID_SLOT_INDEX) && (slot_index < pool->size)); + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + SOKOL_ASSERT(pool->queue_top < pool->size); + #ifdef SOKOL_DEBUG + // debug check against double-free + for (int i = 0; i < pool->queue_top; i++) { + SOKOL_ASSERT(pool->free_queue[i] != slot_index); + } + #endif + pool->free_queue[pool->queue_top++] = slot_index; + SOKOL_ASSERT(pool->queue_top <= (pool->size-1)); +} + +/* initiailize a pool slot: + - bump the slot's generation counter + - create a resource id from the generation counter and slot index + - set the slot's id to this id + - set the slot's state to ALLOC + - return the handle id +*/ +static uint32_t _simgui_slot_init(_simgui_pool_t* pool, _simgui_slot_t* slot, int slot_index) { + /* FIXME: add handling for an overflowing generation counter, + for now, just overflow (another option is to disable + the slot) + */ + SOKOL_ASSERT(pool && pool->gen_ctrs); + SOKOL_ASSERT((slot_index > _SIMGUI_INVALID_SLOT_INDEX) && (slot_index < pool->size)); + SOKOL_ASSERT((slot->state == _SIMGUI_RESOURCESTATE_INITIAL) && (slot->id == SIMGUI_INVALID_ID)); + uint32_t ctr = ++pool->gen_ctrs[slot_index]; + slot->id = (ctr<<_SIMGUI_SLOT_SHIFT)|(slot_index & _SIMGUI_SLOT_MASK); + slot->state = _SIMGUI_RESOURCESTATE_ALLOC; + return slot->id; +} + +// extract slot index from id +static int _simgui_slot_index(uint32_t id) { + int slot_index = (int) (id & _SIMGUI_SLOT_MASK); + SOKOL_ASSERT(_SIMGUI_INVALID_SLOT_INDEX != slot_index); + return slot_index; +} + +static void _simgui_init_item_pool(_simgui_pool_t* pool, int pool_size, void** items_ptr, size_t item_size_bytes) { + // NOTE: the pools will have an additional item, since slot 0 is reserved + SOKOL_ASSERT(pool && (pool->size == 0)); + SOKOL_ASSERT((pool_size > 0) && (pool_size < _SIMGUI_MAX_POOL_SIZE)); + SOKOL_ASSERT(items_ptr && (*items_ptr == 0)); + SOKOL_ASSERT(item_size_bytes > 0); + _sspine_init_pool(pool, pool_size); + const size_t pool_size_bytes = item_size_bytes * (size_t)pool->size; + *items_ptr = _sspine_malloc_clear(pool_size_bytes); +} + +static void _simgui_discard_item_pool(_simgui_pool_t* pool, void** items_ptr) { + SOKOL_ASSERT(pool && (pool->size != 0)); + SOKOL_ASSERT(items_ptr && (*items_ptr != 0)); + _sspine_free(*items_ptr); *items_ptr = 0; + _sspine_discard_pool(pool); +} + static bool _simgui_is_osx(void) { #if defined(SOKOL_DUMMY_BACKEND) return false; From 5969fb3b6987242131d86771c7ccb3bbedf55e0b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 22 Jul 2023 16:05:53 +0200 Subject: [PATCH 105/292] sokol_imgui.h: simgui_image_t implementation finished --- util/sokol_imgui.h | 344 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 291 insertions(+), 53 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index d8f43b4c0..8d8bd2742 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -335,7 +335,7 @@ enum { Create with simgui_make_image(), and convert to an ImTextureID handle via simgui_imtextureid(). */ -typedef struct simgui_image_t { uint32_t id } simgui_image_t; +typedef struct simgui_image_t { uint32_t id; } simgui_image_t; /* simgui_image_desc_t @@ -347,9 +347,26 @@ typedef struct simgui_image_t { uint32_t id } simgui_image_t; */ typedef struct simgui_image_desc_t { sg_image image; - sg_sampler sampler + sg_sampler sampler; } simgui_image_desc_t; +/* + simgui_log_item + + An enum with a unique item for each log message, warning, error + and validation layer message. +*/ +#define _SIMGUI_LOG_ITEMS \ + _SIMGUI_LOGITEM_XMACRO(OK, "Ok") \ + _SIMGUI_LOGITEM_XMACRO(MALLOC_FAILED, "memory allocation failed") \ + _SIMGUI_LOGITEM_XMACRO(IMAGE_POOL_EXHAUSTED, "image pool exhausted") \ + +#define _SIMGUI_LOGITEM_XMACRO(item,msg) SIMGUI_LOGITEM_##item, +typedef enum simgui_log_item_t { + _SIMGUI_LOG_ITEMS +} simgui_log_item_t; +#undef _SIMGUI_LOGITEM_XMACRO + /* simgui_allocator_t @@ -364,9 +381,31 @@ typedef struct simgui_allocator_t { void* user_data; } simgui_allocator_t; +/* + simgui_logger + + Used in simgui_desc to provide a logging function. Please be aware + that without logging function, sokol-imgui will be completely + silent, e.g. it will not report errors, warnings and + validation layer messages. For maximum error verbosity, + compile in debug mode (e.g. NDEBUG *not* defined) and install + a logger (for instance the standard logging function from sokol_log.h). +*/ +typedef struct simgui_logger_t { + void (*func)( + const char* tag, // always "simgui" + uint32_t log_level, // 0=panic, 1=error, 2=warning, 3=info + uint32_t log_item_id, // SIMGUI_LOGITEM_* + const char* message_or_null, // a message string, may be nullptr in release mode + uint32_t line_nr, // line number in sokol_imgui.h + const char* filename_or_null, // source filename, may be nullptr in release mode + void* user_data); + void* user_data; +} simgui_logger_t; + typedef struct simgui_desc_t { - int max_vertices; - int image_pool_size; // default size: 256 + int max_vertices; // default: 65536 + int image_pool_size; // default: 256 sg_pixel_format color_format; sg_pixel_format depth_format; int sample_count; @@ -377,6 +416,7 @@ typedef struct simgui_desc_t { bool disable_windows_resize_from_edges; // if true, only resize edges from the bottom right corner bool write_alpha_channel; // if true, alpha values get written into the framebuffer simgui_allocator_t allocator; // optional memory allocation overrides (default: malloc/free) + simgui_logger_t logger; // optional log function override } simgui_desc_t; typedef struct simgui_frame_desc_t { @@ -497,8 +537,9 @@ typedef struct { } _simgui_pool_t; typedef struct { - sg_image img; - sg_sampler smp; + _simgui_slot_t slot; + sg_image image; + sg_sampler sampler; } _simgui_image_t; typedef struct { @@ -511,8 +552,11 @@ typedef struct { float cur_dpi_scale; sg_buffer vbuf; sg_buffer ibuf; - sg_image img; - sg_sampler smp; + sg_image font_img; + sg_sampler font_smp; + simgui_image_t default_font; + sg_image def_img; // used as default image for user images + sg_sampler def_smp; // used as default sampler for user images sg_shader shd; sg_pipeline pip; sg_range vertices; @@ -1767,6 +1811,52 @@ EM_JS(int, simgui_js_is_osx, (void), { }); #endif +// ██ ██████ ██████ ██████ ██ ███ ██ ██████ +// ██ ██ ██ ██ ██ ██ ████ ██ ██ +// ██ ██ ██ ██ ███ ██ ███ ██ ██ ██ ██ ██ ███ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ███████ ██████ ██████ ██████ ██ ██ ████ ██████ +// +// >>logging +#if defined(SOKOL_DEBUG) +#define _SIMGUI_LOGITEM_XMACRO(item,msg) #item ": " msg, +static const char* _simgui_log_messages[] = { + _SIMGUI_LOG_ITEMS +}; +#undef _SIMGUI_LOGITEM_XMACRO +#endif // SOKOL_DEBUG + +#define _SIMGUI_PANIC(code) _simgui_log(SIMGUI_LOGITEM_ ##code, 0, 0, __LINE__) +#define _SIMGUI_ERROR(code) _simgui_log(SIMGUI_LOGITEM_ ##code, 1, 0, __LINE__) +#define _SIMGUI_WARN(code) _simgui_log(SIMGUI_LOGITEM_ ##code, 2, 0, __LINE__) +#define _SIMGUI_INFO(code) _simgui_log(SIMGUI_LOGITEM_ ##code, 3, 0, __LINE__) +#define _SIMGUI_LOGMSG(code,msg) _simgui_log(SIMGUI_LOGITEM_ ##code, 3, msg, __LINE__) + +static void _simgui_log(simgui_log_item_t log_item, uint32_t log_level, const char* msg, uint32_t line_nr) { + if (_simgui.desc.logger.func) { + const char* filename = 0; + #if defined(SOKOL_DEBUG) + filename = __FILE__; + if (0 == msg) { + msg = _simgui_log_messages[log_item]; + } + #endif + _simgui.desc.logger.func("simgui", log_level, log_item, msg, line_nr, filename, _simgui.desc.logger.user_data); + } else { + // for log level PANIC it would be 'undefined behaviour' to continue + if (log_level == 0) { + abort(); + } + } +} + +// ███ ███ ███████ ███ ███ ██████ ██████ ██ ██ +// ████ ████ ██ ████ ████ ██ ██ ██ ██ ██ ██ +// ██ ████ ██ █████ ██ ████ ██ ██ ██ ██████ ████ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ██ ██ ███████ ██ ██ ██████ ██ ██ ██ +// +// >>memory static void _simgui_clear(void* ptr, size_t size) { SOKOL_ASSERT(ptr && (size > 0)); memset(ptr, 0, size); @@ -1780,13 +1870,15 @@ static void* _simgui_malloc(size_t size) { } else { ptr = malloc(size); } - SOKOL_ASSERT(ptr); + if (0 == ptr) { + _SIMGUI_PANIC(MALLOC_FAILED); + } return ptr; } static void* _simgui_malloc_clear(size_t size) { - void* ptr = _sspine_malloc(size); - _sspine_clear(ptr, size); + void* ptr = _simgui_malloc(size); + _simgui_clear(ptr, size); return ptr; } @@ -1798,6 +1890,13 @@ static void _simgui_free(void* ptr) { } } +// ██████ ██████ ██████ ██ +// ██ ██ ██ ██ ██ ██ ██ +// ██████ ██ ██ ██ ██ ██ +// ██ ██ ██ ██ ██ ██ +// ██ ██████ ██████ ███████ +// +// >>pool static void _simgui_init_pool(_simgui_pool_t* pool, int num) { SOKOL_ASSERT(pool && (num >= 1)); // slot 0 is reserved for the 'invalid id', so bump the pool size by 1 @@ -1805,9 +1904,9 @@ static void _simgui_init_pool(_simgui_pool_t* pool, int num) { pool->queue_top = 0; // generation counters indexable by pool slot index, slot 0 is reserved size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size; - pool->gen_ctrs = (uint32_t*) _sspine_malloc_clear(gen_ctrs_size); + pool->gen_ctrs = (uint32_t*) _simgui_malloc_clear(gen_ctrs_size); // it's not a bug to only reserve 'num' here - pool->free_queue = (int*) _sspine_malloc_clear(sizeof(int) * (size_t)num); + pool->free_queue = (int*) _simgui_malloc_clear(sizeof(int) * (size_t)num); // never allocate the zero-th pool item since the invalid id is 0 for (int i = pool->size-1; i >= 1; i--) { pool->free_queue[pool->queue_top++] = i; @@ -1888,16 +1987,101 @@ static void _simgui_init_item_pool(_simgui_pool_t* pool, int pool_size, void** i SOKOL_ASSERT((pool_size > 0) && (pool_size < _SIMGUI_MAX_POOL_SIZE)); SOKOL_ASSERT(items_ptr && (*items_ptr == 0)); SOKOL_ASSERT(item_size_bytes > 0); - _sspine_init_pool(pool, pool_size); + _simgui_init_pool(pool, pool_size); const size_t pool_size_bytes = item_size_bytes * (size_t)pool->size; - *items_ptr = _sspine_malloc_clear(pool_size_bytes); + *items_ptr = _simgui_malloc_clear(pool_size_bytes); } static void _simgui_discard_item_pool(_simgui_pool_t* pool, void** items_ptr) { SOKOL_ASSERT(pool && (pool->size != 0)); SOKOL_ASSERT(items_ptr && (*items_ptr != 0)); - _sspine_free(*items_ptr); *items_ptr = 0; - _sspine_discard_pool(pool); + _simgui_free(*items_ptr); *items_ptr = 0; + _simgui_discard_pool(pool); +} + +static void _simgui_setup_image_pool(int pool_size) { + _simgui_image_pool_t* p = &_simgui.image_pool; + _simgui_init_item_pool(&p->pool, pool_size, (void**)&p->items, sizeof(_simgui_image_t)); +} + +static void _simgui_discard_image_pool(void) { + _simgui_image_pool_t* p = &_simgui.image_pool; + _simgui_discard_item_pool(&p->pool, (void**)&p->items); +} + +static simgui_image_t _simgui_make_image_handle(uint32_t id) { + simgui_image_t handle = { id }; + return handle; +} + +static _simgui_image_t* _simgui_image_at(uint32_t id) { + SOKOL_ASSERT(SIMGUI_INVALID_ID != id); + const _simgui_image_pool_t* p = &_simgui.image_pool; + int slot_index = _simgui_slot_index(id); + SOKOL_ASSERT((slot_index > _SIMGUI_INVALID_SLOT_INDEX) && (slot_index < p->pool.size)); + return &p->items[slot_index]; +} + +static _simgui_image_t* _simgui_lookup_image(uint32_t id) { + if (SIMGUI_INVALID_ID != id) { + _simgui_image_t* img = _simgui_image_at(id); + if (img->slot.id == id) { + return img; + } + } + return 0; +} + +static simgui_image_t _simgui_alloc_image(void) { + _simgui_image_pool_t* p = &_simgui.image_pool; + int slot_index = _simgui_pool_alloc_index(&p->pool); + if (_SIMGUI_INVALID_SLOT_INDEX != slot_index) { + uint32_t id = _simgui_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); + return _simgui_make_image_handle(id); + } else { + // pool exhausted + return _simgui_make_image_handle(SIMGUI_INVALID_ID); + } +} + +static _simgui_resource_state _simgui_init_image(_simgui_image_t* img, const simgui_image_desc_t* desc) { + SOKOL_ASSERT(img && (img->slot.state == _SIMGUI_RESOURCESTATE_ALLOC)); + SOKOL_ASSERT(desc); + img->image = desc->image; + img->sampler = desc->sampler; + return _SIMGUI_RESOURCESTATE_VALID; +} + +static void _simgui_deinit_image(_simgui_image_t* img) { + SOKOL_ASSERT(img); + img->image.id = SIMGUI_INVALID_ID; + img->sampler.id = SIMGUI_INVALID_ID; +} + +static void _simgui_destroy_image(simgui_image_t img_id) { + _simgui_image_t* img = _simgui_lookup_image(img_id.id); + if (img) { + _simgui_deinit_image(img); + _simgui_image_pool_t* p = &_simgui.image_pool; + _simgui_clear(img, sizeof(_simgui_image_t)); + _simgui_pool_free_index(&p->pool, _simgui_slot_index(img_id.id)); + } +} + +static void _simgui_destroy_all_images(void) { + _simgui_image_pool_t* p = &_simgui.image_pool; + for (int i = 0; i < p->pool.size; i++) { + _simgui_image_t* img = &p->items[i]; + _simgui_destroy_image(_simgui_make_image_handle(img->slot.id)); + } +} + +static simgui_image_desc_t _simgui_image_desc_defaults(const simgui_image_desc_t* desc) { + SOKOL_ASSERT(desc); + simgui_image_desc_t res = *desc; + res.image.id = _simgui_def(res.image.id, _simgui.def_img.id); + res.sampler.id = _simgui_def(res.sampler.id, _simgui.def_smp.id); + return res; } static bool _simgui_is_osx(void) { @@ -1916,17 +2100,10 @@ static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); simgui_desc_t res = *desc; res.max_vertices = _simgui_def(res.max_vertices, 65536); + res.image_pool_size = _simgui_def(res.image_pool_size, 256); return res; } -static uint32_t _simgui_imageid_from_texid(ImTextureID tex_id) { - uint32_t img_id = (uint32_t)(uintptr_t)tex_id; - if (0 == img_id) { - img_id = _simgui.img.id; - } - return img_id; -} - SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { SOKOL_ASSERT(desc); _simgui_clear(&_simgui, sizeof(_simgui)); @@ -1938,6 +2115,9 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { // can keep color_format, depth_format and sample_count as is, // since sokol_gfx.h will do its own default-value handling + // setup image pool + _simgui_setup_image_pool(_simgui.desc.image_pool_size); + // allocate an intermediate vertex- and index-buffer SOKOL_ASSERT(_simgui.desc.max_vertices > 0); _simgui.vertices.size = (size_t)_simgui.desc.max_vertices * sizeof(ImDrawVert); @@ -1992,6 +2172,17 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { ib_desc.label = "sokol-imgui-indices"; _simgui.ibuf = sg_make_buffer(&ib_desc); + // a default font sampler + sg_sampler_desc font_smp_desc; + _simgui_clear(&font_smp_desc, sizeof(font_smp_desc)); + font_smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + font_smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + font_smp_desc.min_filter = SG_FILTER_LINEAR; + font_smp_desc.mag_filter = SG_FILTER_LINEAR; + font_smp_desc.mipmap_filter = SG_FILTER_NONE; + font_smp_desc.label = "sokol-imgui-font-sampler"; + _simgui.font_smp = sg_make_sampler(&font_smp_desc); + // default font texture if (!_simgui.desc.no_default_font) { unsigned char* font_pixels; @@ -2002,29 +2193,45 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { int bytes_per_pixel; ImFontAtlas_GetTexDataAsRGBA32(io->Fonts, &font_pixels, &font_width, &font_height, &bytes_per_pixel); #endif - sg_image_desc img_desc; + sg_image_desc font_img_desc; + _simgui_clear(&font_img_desc, sizeof(font_img_desc)); + font_img_desc.width = font_width; + font_img_desc.height = font_height; + font_img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; + font_img_desc.data.subimage[0][0].ptr = font_pixels; + font_img_desc.data.subimage[0][0].size = (size_t)(font_width * font_height) * sizeof(uint32_t); + font_img_desc.label = "sokol-imgui-font-image"; + _simgui.font_img = sg_make_image(&font_img_desc); + + simgui_image_desc_t img_desc; _simgui_clear(&img_desc, sizeof(img_desc)); - img_desc.width = font_width; - img_desc.height = font_height; - img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; - img_desc.data.subimage[0][0].ptr = font_pixels; - img_desc.data.subimage[0][0].size = (size_t)(font_width * font_height) * sizeof(uint32_t); - img_desc.label = "sokol-imgui-font"; - _simgui.img = sg_make_image(&img_desc); - io->Fonts->TexID = (ImTextureID)(uintptr_t) _simgui.img.id; + img_desc.image = _simgui.font_img; + img_desc.sampler = _simgui.font_smp; + _simgui.default_font = simgui_make_image(&img_desc); + io->Fonts->TexID = simgui_imtextureid(_simgui.default_font); } - // a sampler for the font texture - sg_sampler_desc smp_desc; - _simgui_clear(&smp_desc, sizeof(smp_desc)); - smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; - smp_desc.min_filter = SG_FILTER_LINEAR; - smp_desc.mag_filter = SG_FILTER_LINEAR; - smp_desc.mipmap_filter = SG_FILTER_NONE; - smp_desc.label = "sokol-imgui-sampler"; - _simgui.smp = sg_make_sampler(&smp_desc); - io->Fonts->TexID = simgui_imtextureid(_simgui.img); + // a default user image and sampler + static uint32_t def_pixels[64]; + memset(def_pixels, 0xFF, sizeof(def_pixels)); + sg_image_desc def_image_desc; + _simgui_clear(&def_image_desc, sizeof(def_image_desc)); + def_image_desc.width = 8; + def_image_desc.height = 8; + def_image_desc.pixel_format = SG_PIXELFORMAT_RGBA8; + def_image_desc.data.subimage[0][0].ptr = def_pixels; + def_image_desc.data.subimage[0][0].size = sizeof(def_pixels); + def_image_desc.label = "sokol-imgui-default-image"; + _simgui.def_img = sg_make_image(&def_image_desc); + + sg_sampler_desc def_sampler_desc; + _simgui_clear(&def_sampler_desc, sizeof(def_sampler_desc)); + def_sampler_desc.min_filter = SG_FILTER_NEAREST; + def_sampler_desc.mag_filter = SG_FILTER_NEAREST; + def_sampler_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.label = "sokol-imgui-default-sampler"; + _simgui.def_smp = sg_make_sampler(&def_sampler_desc); // shader object for using the embedded shader source (or bytecode) sg_shader_desc shd_desc; @@ -2133,21 +2340,43 @@ SOKOL_API_IMPL void simgui_shutdown(void) { igDestroyContext(0); #endif // NOTE: it's valid to call the destroy funcs with SG_INVALID_ID - sg_push_debug_group("sokol-imgui"); sg_destroy_pipeline(_simgui.pip); sg_destroy_shader(_simgui.shd); - sg_destroy_sampler(_simgui.smp); - sg_destroy_image(_simgui.img); + sg_destroy_sampler(_simgui.font_smp); + sg_destroy_image(_simgui.font_img); + sg_destroy_sampler(_simgui.def_smp); + sg_destroy_image(_simgui.def_img); sg_destroy_buffer(_simgui.ibuf); sg_destroy_buffer(_simgui.vbuf); sg_pop_debug_group(); + sg_push_debug_group("sokol-imgui"); + _simgui_destroy_all_images(); + _simgui_discard_image_pool(); SOKOL_ASSERT(_simgui.vertices.ptr); _simgui_free((void*)_simgui.vertices.ptr); SOKOL_ASSERT(_simgui.indices.ptr); _simgui_free((void*)_simgui.indices.ptr); } -SOKOL_API_IMPL void* simgui_imtextureid(sg_image img) { +SOKOL_API_IMPL simgui_image_t simgui_make_image(simgui_image_desc_t* desc) { + SOKOL_ASSERT(desc); + const simgui_image_desc_t desc_def = _simgui_image_desc_defaults(desc); + simgui_image_t img_id = _simgui_alloc_image(); + _simgui_image_t* img = _simgui_lookup_image(img_id.id); + if (img) { + img->slot.state = _simgui_init_image(img, &desc_def); + SOKOL_ASSERT((img->slot.state == _SIMGUI_RESOURCESTATE_VALID) || (img->slot.state == _SIMGUI_RESOURCESTATE_FAILED)); + } else { + _SIMGUI_ERROR(IMAGE_POOL_EXHAUSTED); + } + return img_id; +} + +SOKOL_API_IMPL void simgui_destroy_image(simgui_image_t img) { + _simgui_destroy_image(img); +} + +SOKOL_API_IMPL void* simgui_imtextureid(simgui_image_t img) { return (void*)(uintptr_t)img.id; } @@ -2200,6 +2429,17 @@ SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { #endif } +static void _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id) { + _simgui_image_t* img = _simgui_lookup_image((uint32_t)(uintptr_t)tex_id); + if (img) { + bindings->fs.images[0] = img->image; + bindings->fs.samplers[0] = img->sampler; + } else { + bindings->fs.images[0] = _simgui.def_img; + bindings->fs.samplers[0] = _simgui.def_smp; + } +} + SOKOL_API_IMPL void simgui_render(void) { #if defined(__cplusplus) ImGui::Render(); @@ -2285,10 +2525,8 @@ SOKOL_API_IMPL void simgui_render(void) { _simgui_clear((void*)&bind, sizeof(bind)); bind.vertex_buffers[0] = _simgui.vbuf; bind.index_buffer = _simgui.ibuf; - bind.fs.samplers[0] = _simgui.smp; ImTextureID tex_id = io->Fonts->TexID; - bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); - bind.fs.samplers[0] = _simgui.smp; + _simgui_bind_image_sampler(&bind, tex_id); int vb_offset = 0; int ib_offset = 0; for (int cl_index = 0; cl_index < cmd_list_count; cl_index++) { @@ -2317,7 +2555,7 @@ SOKOL_API_IMPL void simgui_render(void) { if ((tex_id != pcmd->TextureId) || (vtx_offset != pcmd->VtxOffset)) { tex_id = pcmd->TextureId; vtx_offset = pcmd->VtxOffset; - bind.fs.images[0].id = _simgui_imageid_from_texid(tex_id); + _simgui_bind_image_sampler(&bind, tex_id); bind.vertex_buffer_offsets[0] = vb_offset + (int)(pcmd->VtxOffset * sizeof(ImDrawVert)); sg_apply_bindings(&bind); } From b6a8f21638920b95ac3e34437ce7651662272f0a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 22 Jul 2023 18:01:30 +0200 Subject: [PATCH 106/292] sokol_imgui.h: check that API functions are called between setup/shutdown --- util/sokol_imgui.h | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 8d8bd2742..9b4a792d4 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -502,6 +502,7 @@ inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_ne #endif #endif +#define _SIMGUI_INIT_COOKIE (0xBABEBABE) #define _SIMGUI_INVALID_SLOT_INDEX (0) #define _SIMGUI_SLOT_SHIFT (16) #define _SIMGUI_MAX_POOL_SIZE (1<<_SIMGUI_SLOT_SHIFT) @@ -548,6 +549,7 @@ typedef struct { } _simgui_image_pool_t; typedef struct { + uint32_t init_cookie; simgui_desc_t desc; float cur_dpi_scale; sg_buffer vbuf; @@ -2107,6 +2109,7 @@ static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { SOKOL_ASSERT(desc); _simgui_clear(&_simgui, sizeof(_simgui)); + _simgui.init_cookie = _SIMGUI_INIT_COOKIE; _simgui.desc = _simgui_desc_defaults(desc); _simgui.cur_dpi_scale = 1.0f; #if !defined(SOKOL_IMGUI_NO_SOKOL_APP) @@ -2183,6 +2186,16 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { font_smp_desc.label = "sokol-imgui-font-sampler"; _simgui.font_smp = sg_make_sampler(&font_smp_desc); + // a default user-image sampler + sg_sampler_desc def_sampler_desc; + _simgui_clear(&def_sampler_desc, sizeof(def_sampler_desc)); + def_sampler_desc.min_filter = SG_FILTER_NEAREST; + def_sampler_desc.mag_filter = SG_FILTER_NEAREST; + def_sampler_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.label = "sokol-imgui-default-sampler"; + _simgui.def_smp = sg_make_sampler(&def_sampler_desc); + // default font texture if (!_simgui.desc.no_default_font) { unsigned char* font_pixels; @@ -2211,7 +2224,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { io->Fonts->TexID = simgui_imtextureid(_simgui.default_font); } - // a default user image and sampler + // a default user image static uint32_t def_pixels[64]; memset(def_pixels, 0xFF, sizeof(def_pixels)); sg_image_desc def_image_desc; @@ -2224,15 +2237,6 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { def_image_desc.label = "sokol-imgui-default-image"; _simgui.def_img = sg_make_image(&def_image_desc); - sg_sampler_desc def_sampler_desc; - _simgui_clear(&def_sampler_desc, sizeof(def_sampler_desc)); - def_sampler_desc.min_filter = SG_FILTER_NEAREST; - def_sampler_desc.mag_filter = SG_FILTER_NEAREST; - def_sampler_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - def_sampler_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; - def_sampler_desc.label = "sokol-imgui-default-sampler"; - _simgui.def_smp = sg_make_sampler(&def_sampler_desc); - // shader object for using the embedded shader source (or bytecode) sg_shader_desc shd_desc; _simgui_clear(&shd_desc, sizeof(shd_desc)); @@ -2334,6 +2338,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { } SOKOL_API_IMPL void simgui_shutdown(void) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGui::DestroyContext(); #else @@ -2356,9 +2361,11 @@ SOKOL_API_IMPL void simgui_shutdown(void) { _simgui_free((void*)_simgui.vertices.ptr); SOKOL_ASSERT(_simgui.indices.ptr); _simgui_free((void*)_simgui.indices.ptr); + _simgui.init_cookie = 0; } SOKOL_API_IMPL simgui_image_t simgui_make_image(simgui_image_desc_t* desc) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); SOKOL_ASSERT(desc); const simgui_image_desc_t desc_def = _simgui_image_desc_defaults(desc); simgui_image_t img_id = _simgui_alloc_image(); @@ -2373,14 +2380,17 @@ SOKOL_API_IMPL simgui_image_t simgui_make_image(simgui_image_desc_t* desc) { } SOKOL_API_IMPL void simgui_destroy_image(simgui_image_t img) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); _simgui_destroy_image(img); } SOKOL_API_IMPL void* simgui_imtextureid(simgui_image_t img) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); return (void*)(uintptr_t)img.id; } SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->width > 0); SOKOL_ASSERT(desc->height > 0); @@ -2441,6 +2451,7 @@ static void _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id } SOKOL_API_IMPL void simgui_render(void) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGui::Render(); ImDrawData* draw_data = ImGui::GetDrawData(); @@ -2583,6 +2594,7 @@ SOKOL_API_IMPL void simgui_render(void) { } SOKOL_API_IMPL void simgui_add_focus_event(bool focus) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); io->AddFocusEvent(focus); @@ -2593,6 +2605,7 @@ SOKOL_API_IMPL void simgui_add_focus_event(bool focus) { } SOKOL_API_IMPL void simgui_add_mouse_pos_event(float x, float y) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) @@ -2609,6 +2622,7 @@ SOKOL_API_IMPL void simgui_add_mouse_pos_event(float x, float y) { } SOKOL_API_IMPL void simgui_add_touch_pos_event(float x, float y) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) @@ -2625,6 +2639,7 @@ SOKOL_API_IMPL void simgui_add_touch_pos_event(float x, float y) { } SOKOL_API_IMPL void simgui_add_mouse_button_event(int mouse_button, bool down) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) @@ -2641,6 +2656,7 @@ SOKOL_API_IMPL void simgui_add_mouse_button_event(int mouse_button, bool down) { } SOKOL_API_IMPL void simgui_add_touch_button_event(int mouse_button, bool down) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) @@ -2657,6 +2673,7 @@ SOKOL_API_IMPL void simgui_add_touch_button_event(int mouse_button, bool down) { } SOKOL_API_IMPL void simgui_add_mouse_wheel_event(float wheel_x, float wheel_y) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); #if (IMGUI_VERSION_NUM >= 18950) @@ -2673,6 +2690,7 @@ SOKOL_API_IMPL void simgui_add_mouse_wheel_event(float wheel_x, float wheel_y) { } SOKOL_API_IMPL void simgui_add_key_event(int (*map_keycode)(int), int keycode, bool down) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); const ImGuiKey imgui_key = (ImGuiKey)map_keycode(keycode); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); @@ -2686,6 +2704,7 @@ SOKOL_API_IMPL void simgui_add_key_event(int (*map_keycode)(int), int keycode, b } SOKOL_API_IMPL void simgui_add_input_character(uint32_t c) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); io->AddInputCharacter(c); @@ -2696,6 +2715,7 @@ SOKOL_API_IMPL void simgui_add_input_character(uint32_t c) { } SOKOL_API_IMPL void simgui_add_input_characters_utf8(const char* c) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); io->AddInputCharactersUTF8(c); @@ -2857,10 +2877,12 @@ _SOKOL_PRIVATE ImGuiKey _simgui_copypaste_modifier(void) { } SOKOL_API_IMPL int simgui_map_keycode(sapp_keycode keycode) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); return (int)_simgui_map_keycode(keycode); } SOKOL_API_IMPL bool simgui_handle_event(const sapp_event* ev) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); const float dpi_scale = _simgui.cur_dpi_scale; #if defined(__cplusplus) ImGuiIO* io = &ImGui::GetIO(); From 5d4bb746a9890921e8b530c8f43df8d27a9797ac Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 22 Jul 2023 18:01:58 +0200 Subject: [PATCH 107/292] sokol_gfx_imgui.h: fixes for sokol_imgui.h changes --- util/sokol_gfx_imgui.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 401be25c3..48ff120ca 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -250,6 +250,7 @@ typedef struct sg_imgui_image_t { float ui_scale; sg_imgui_str_t label; sg_image_desc desc; + simgui_image_t simgui_img; } sg_imgui_image_t; typedef struct sg_imgui_sampler_t { @@ -1517,12 +1518,18 @@ _SOKOL_PRIVATE void _sg_imgui_image_created(sg_imgui_t* ctx, sg_image res_id, in img->desc = *desc; img->ui_scale = 1.0f; img->label = _sg_imgui_make_str(desc->label); + simgui_image_desc_t simgui_img_desc; + _sg_imgui_clear(&simgui_img_desc, sizeof(simgui_img_desc)); + simgui_img_desc.image = res_id; + // keep sampler at default, which will use sokol_imgui.h's default nearest-filtering sampler + img->simgui_img = simgui_make_image(&simgui_img_desc); } _SOKOL_PRIVATE void _sg_imgui_image_destroyed(sg_imgui_t* ctx, int slot_index) { SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->images.num_slots)); sg_imgui_image_t* img = &ctx->images.slots[slot_index]; img->res_id.id = SG_INVALID_ID; + simgui_destroy_image(img->simgui_img); } _SOKOL_PRIVATE void _sg_imgui_sampler_created(sg_imgui_t* ctx, sg_sampler res_id, int slot_index, const sg_sampler_desc* desc) { @@ -3327,7 +3334,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_embedded_image(sg_imgui_t* ctx, sg_image img, igSliderFloat("Scale", scale, 0.125f, 8.0f, "%.3f", ImGuiSliderFlags_Logarithmic); float w = (float)img_ui->desc.width * (*scale); float h = (float)img_ui->desc.height * (*scale); - igImage((ImTextureID)(intptr_t)img.id, IMVEC2(w, h), IMVEC2(0,0), IMVEC2(1,1), IMVEC4(1,1,1,1), IMVEC4(0,0,0,0)); + igImage((ImTextureID)simgui_imtextureid(img_ui->simgui_img), IMVEC2(w, h), IMVEC2(0,0), IMVEC2(1,1), IMVEC4(1,1,1,1), IMVEC4(0,0,0,0)); igPopID(); } else { igText("Image not renderable."); From 4cd305796daee6665b0ffe415216b3319ab51c63 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 14:50:08 +0200 Subject: [PATCH 108/292] sokol_gfx_imgui.h: remove a redundant cast --- util/sokol_gfx_imgui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 48ff120ca..f9106f1bb 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -3334,7 +3334,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_embedded_image(sg_imgui_t* ctx, sg_image img, igSliderFloat("Scale", scale, 0.125f, 8.0f, "%.3f", ImGuiSliderFlags_Logarithmic); float w = (float)img_ui->desc.width * (*scale); float h = (float)img_ui->desc.height * (*scale); - igImage((ImTextureID)simgui_imtextureid(img_ui->simgui_img), IMVEC2(w, h), IMVEC2(0,0), IMVEC2(1,1), IMVEC4(1,1,1,1), IMVEC4(0,0,0,0)); + igImage(simgui_imtextureid(img_ui->simgui_img), IMVEC2(w, h), IMVEC2(0,0), IMVEC2(1,1), IMVEC4(1,1,1,1), IMVEC4(0,0,0,0)); igPopID(); } else { igText("Image not renderable."); From 4abf384ce0e82847fb57e6d73ed2dce550b33ee8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 14:50:40 +0200 Subject: [PATCH 109/292] sokol_imgui.h: update documentation --- util/sokol_imgui.h | 94 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 9b4a792d4..e908cfe28 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -102,6 +102,10 @@ sokol-imgui will use this to compute the size of the vertex- and index-buffers allocated via sokol_gfx.h + int image_pool_size + Number of simgui_image_t objects which can be alive at the same time. + The default is 256. + sg_pixel_format color_format The color pixel format of the render pass where the UI will be rendered. The default (0) matches sokoL_gfx.h's @@ -158,9 +162,20 @@ Used to override memory allocation functions. See further below for details. + simgui_logger_t logger + A user-provided logging callback. Note that without logging + callback, sokol-imgui will be completely silent! + See the section about ERROR REPORTING AND LOGGING below + for more details. + --- At the start of a frame, call: - simgui_new_frame(&(simgui_frame_desc_t){.width = ..., .height = ..., .delta_time = ..., .dpi_scale = ...}); + simgui_new_frame(&(simgui_frame_desc_t){ + .width = ..., + .height = ..., + .delta_time = ..., + .dpi_scale = ... + }); 'width' and 'height' are the dimensions of the rendering surface, passed to ImGui::GetIO().DisplaySize. @@ -217,6 +232,42 @@ default font texture or default sampler object + ON USER-PROVIDED IMAGES AND SAMPLERS + ==================================== + To render your own images via ImGui::Image(), first create an simgui_image_t + object from a sokol-gfx image and sampler object. + + // create a sokol-imgui image object which associates an sg_image with an sg_sampler + simgui_image_t simgui_img = simgui_make_image(&(simgui_image_desc_t){ + .image = sg_make_image(...), + .sampler = sg_make_sampler(...), + }); + + // convert the returned image handle into a ImTextureID handle + ImTextureID tex_id = simgui_imtextureid(simgui_img); + + // use the ImTextureID handle in Dear ImGui calls: + ImGui::Image(tex_id, ...); + + simgui_image_t objects are small and cheap (literally just the image and sampler + handle). + + You can omit the sampler handle in the simgui_make_image() call, in this case a + default sampler will be used with nearest-filtering and clamp-to-edge. + + Trying to render with an invalid simgui_image_t handle will render a small 8x8 + white default texture instead. + + To destroy a sokol-imgui image object, call + + simgui_destroy_image(simgui_img); + + But please be aware that the image object needs to be around until simgui_render() is called + in a frame (if this turns out to be too much of a hassle we could introduce some sort + of garbage collection where destroyed simgui_image_t objects are kept around until + the simgui_render() call). + + MEMORY ALLOCATION OVERRIDE ========================== You can override the memory allocation functions at initialization time @@ -247,6 +298,47 @@ itself though, not any allocations in Dear ImGui. + ERROR REPORTING AND LOGGING + =========================== + To get any logging information at all you need to provide a logging callback in the setup call + the easiest way is to use sokol_log.h: + + #include "sokol_log.h" + + simgui_setup(&(simgui_desc_t){ + .logger.func = slog_func + }); + + To override logging with your own callback, first write a logging function like this: + + void my_log(const char* tag, // e.g. 'simgui' + uint32_t log_level, // 0=panic, 1=error, 2=warn, 3=info + uint32_t log_item_id, // SIMGUI_LOGITEM_* + const char* message_or_null, // a message string, may be nullptr in release mode + uint32_t line_nr, // line number in sokol_imgui.h + const char* filename_or_null, // source filename, may be nullptr in release mode + void* user_data) + { + ... + } + + ...and then setup sokol-imgui like this: + + simgui_setup(&(simgui_desc_t){ + .logger = { + .func = my_log, + .user_data = my_user_data, + } + }); + + The provided logging function must be reentrant (e.g. be callable from + different threads). + + If you don't want to provide your own custom logger it is highly recommended to use + the standard logger in sokol_log.h instead, otherwise you won't see any warnings or + errors. + + IMGUI EVENT HANDLING ==================== You can call these functions from your platform's events to handle ImGui events From 7ddc256318275fdc247cce094c84b15f91715a1a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 14:55:30 +0200 Subject: [PATCH 110/292] sokol_imgui.h: add c++ wrapper func and code cleanup --- util/sokol_imgui.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index e908cfe28..557e073fb 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -521,7 +521,7 @@ typedef struct simgui_frame_desc_t { SOKOL_IMGUI_API_DECL void simgui_setup(const simgui_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); -SOKOL_IMGUI_API_DECL simgui_image_t simgui_make_image(simgui_image_desc_t* desc); +SOKOL_IMGUI_API_DECL simgui_image_t simgui_make_image(const simgui_image_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_destroy_image(simgui_image_t img); SOKOL_IMGUI_API_DECL void* simgui_imtextureid(simgui_image_t img); SOKOL_IMGUI_API_DECL void simgui_add_focus_event(bool focus); @@ -544,6 +544,7 @@ SOKOL_IMGUI_API_DECL void simgui_shutdown(void); // reference-based equivalents for C++ inline void simgui_setup(const simgui_desc_t& desc) { return simgui_setup(&desc); } +inline simgui_image_t simgui_make_image(const simgui_image_desc_t& desc) { return simgui_make_image(&desc); } inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_new_frame(&desc); } #endif @@ -2456,7 +2457,7 @@ SOKOL_API_IMPL void simgui_shutdown(void) { _simgui.init_cookie = 0; } -SOKOL_API_IMPL simgui_image_t simgui_make_image(simgui_image_desc_t* desc) { +SOKOL_API_IMPL simgui_image_t simgui_make_image(const simgui_image_desc_t* desc) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); SOKOL_ASSERT(desc); const simgui_image_desc_t desc_def = _simgui_image_desc_defaults(desc); From 8642c7e4fa2be103c6ed4b9109cba29de9b450d5 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 15:10:51 +0200 Subject: [PATCH 111/292] update changelog and readme --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 278535e32..c6ccb224a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ ## Updates +#### 23-Jul-2023 + +**sokol_imgui.h**: Add proper support for injecting user-provided sokol-gfx +images and samplers into Dear ImGui UIs. With the introduction of separate +sampler objects in sokol_gfx.h there's a temporary feature regression in +sokol_imgui.h and sokol_nuklear.h in that user provided images had to use a +shared sampler that's hardwired into the respective headers. This update fixes +this problem for sokol_imgui.h, with a similar fix for sokol_nuklear.h coming +up next. + +The sokol_imgui.h changes in detail are: + +- a new object type `simgui_image_t` which wraps a sokol-gfx image and sampler + object under a common handle +- two new function `simgui_make_image()` and `simgui_destroy_image()` to + create and destroy such a new `simgui_image_t` object. +- the existing function `simgui_imtextureid()` has been changed to take + an `simgui_image_t` +- sokol_imgui.h now also uses the same error-handling and logging callback + as the other sokol headers (this was needed because creating an `simgui_image_t` + object may fail because the object pool is exhausted) - don't forget + to provide a logging callback (for instance via sokol_log.h), otherwise + sokol_imgui.h will be entirely silent in case of errors. + +Please also read the new documentation section `ON USER-PROVIDED IMAGES AND SAMPLERS` +in sokol_imgui.h, and also check out the new sample: + +https://floooh.github.io/sokol-html5/imgui-images-sapp.html + #### 16-Jul-2023 **BREAKING CHANGES** diff --git a/README.md b/README.md index 406225727..2b5404013 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Jul-2023** BREAKING CHANGES: sokol_gfx.h now has separate sampler objects!) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**23-Jul-2023** proper image/sampler pair support in sokol_imgui.h) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 591b3c58a05a44dd20cd32788e48f391c8d4a0d6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 15:24:35 +0200 Subject: [PATCH 112/292] changelog: add pr link for last change --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ccb224a..d3752a784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ in sokol_imgui.h, and also check out the new sample: https://floooh.github.io/sokol-html5/imgui-images-sapp.html +Associated PR: https://github.com/floooh/sokol/pull/861 + #### 16-Jul-2023 **BREAKING CHANGES** From 662272fca1d574aea1b2cd9e4f1171005d5834c0 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 23 Jul 2023 16:32:41 +0200 Subject: [PATCH 113/292] sokol_imgui.h: add two useful helper functions --- util/sokol_imgui.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 557e073fb..e47396197 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -267,6 +267,17 @@ of garbage collection where destroyed simgui_image_t objects are kept around until the simgui_render() call). + You can call: + + simgui_image_desc_t desc = simgui_query_image_desc(img) + + ...to get the original desc struct, useful if you need to get the sokol-gfx image + and sampler handle of the simgui_image_t object. + + You can convert an ImTextureID back into an simgui_image_t handle: + + simgui_image_t img = simgui_image_from_imtextureid(tex_id); + MEMORY ALLOCATION OVERRIDE ========================== @@ -523,7 +534,9 @@ SOKOL_IMGUI_API_DECL void simgui_new_frame(const simgui_frame_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_render(void); SOKOL_IMGUI_API_DECL simgui_image_t simgui_make_image(const simgui_image_desc_t* desc); SOKOL_IMGUI_API_DECL void simgui_destroy_image(simgui_image_t img); +SOKOL_IMGUI_API_DECL simgui_image_desc_t simgui_query_image_desc(simgui_image_t img); SOKOL_IMGUI_API_DECL void* simgui_imtextureid(simgui_image_t img); +SOKOL_IMGUI_API_DECL simgui_image_t simgui_image_from_imtextureid(void* imtextureid); SOKOL_IMGUI_API_DECL void simgui_add_focus_event(bool focus); SOKOL_IMGUI_API_DECL void simgui_add_mouse_pos_event(float x, float y); SOKOL_IMGUI_API_DECL void simgui_add_touch_pos_event(float x, float y); @@ -2472,9 +2485,21 @@ SOKOL_API_IMPL simgui_image_t simgui_make_image(const simgui_image_desc_t* desc) return img_id; } -SOKOL_API_IMPL void simgui_destroy_image(simgui_image_t img) { +SOKOL_API_IMPL void simgui_destroy_image(simgui_image_t img_id) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); + _simgui_destroy_image(img_id); +} + +SOKOL_API_IMPL simgui_image_desc_t simgui_query_image_desc(simgui_image_t img_id) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); - _simgui_destroy_image(img); + _simgui_image_t* img = _simgui_lookup_image(img_id.id); + simgui_image_desc_t desc; + _simgui_clear(&desc, sizeof(desc)); + if (img) { + desc.image = img->image; + desc.sampler = img->sampler; + } + return desc; } SOKOL_API_IMPL void* simgui_imtextureid(simgui_image_t img) { @@ -2482,6 +2507,12 @@ SOKOL_API_IMPL void* simgui_imtextureid(simgui_image_t img) { return (void*)(uintptr_t)img.id; } +SOKOL_API_IMPL simgui_image_t simgui_image_from_imtextureid(void* imtextureid) { + SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); + simgui_image_t img = { (uint32_t)(uintptr_t) imtextureid }; + return img; +} + SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); SOKOL_ASSERT(desc); From abbd45491d2131fb0a9a60b1c80acb2a14a18b2a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 24 Jul 2023 13:03:48 +0200 Subject: [PATCH 114/292] sokoL_imgui.h: fix comment typo --- util/sokol_imgui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index e47396197..34ad0429e 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -487,7 +487,7 @@ typedef struct simgui_allocator_t { /* simgui_logger - Used in simgui_desc to provide a logging function. Please be aware + Used in simgui_desc_t to provide a logging function. Please be aware that without logging function, sokol-imgui will be completely silent, e.g. it will not report errors, warnings and validation layer messages. For maximum error verbosity, From 7a1e0a697e3b21aa242ce0ee554c87ba208aa2a9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 24 Jul 2023 19:22:13 +0200 Subject: [PATCH 115/292] sokol_imgui.h: add a comment header --- util/sokol_imgui.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 34ad0429e..1c8c9014b 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -2212,6 +2212,13 @@ static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { return res; } +// ██████ ██ ██ ██████ ██ ██ ██████ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ██████ ██ ██ ██████ ██ ██ ██ +// ██ ██ ██ ██ ██ ██ ██ ██ +// ██ ██████ ██████ ███████ ██ ██████ +// +// >>public SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { SOKOL_ASSERT(desc); _simgui_clear(&_simgui, sizeof(_simgui)); From 600d13afb570d729094f10a6a6c2ffb043c7745d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 24 Jul 2023 19:23:00 +0200 Subject: [PATCH 116/292] sokol_nuklear.h: initial image/sampler object implementation --- util/sokol_nuklear.h | 584 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 540 insertions(+), 44 deletions(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 21b7761e5..9eabfa622 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -192,6 +192,7 @@ #define SOKOL_NUKLEAR_INCLUDED (1) #include #include +#include #if !defined(SOKOL_GFX_INCLUDED) #error "Please include sokol_gfx.h before sokol_nuklear.h" @@ -199,6 +200,9 @@ #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) && !defined(SOKOL_APP_INCLUDED) #error "Please include sokol_app.h before sokol_nuklear.h" #endif +#if !defined(NK_UNDEFINED) +#error "Please include nuklear.h before sokol_nuklear.h" +#endif #if defined(SOKOL_API_DECL) && !defined(SOKOL_NUKLEAR_API_DECL) #define SOKOL_NUKLEAR_API_DECL SOKOL_API_DECL @@ -217,19 +221,106 @@ extern "C" { #endif +enum { + SNK_INVALID_ID = 0, +}; + +/* + snk_image_t + + A combined image-sampler pair used to inject custom images and samplers into Nuklear + + Create with snk_make_image(), and convert to an nk_handle via snk_nkhandle(). +*/ +typedef struct snk_image_t { uint32_t id; } snk_image_t; + +/* + snk_image_desc_t + + Descriptor struct for snk_make_image(). You must provide + at least an sg_image handle. Keeping the sg_sampler handle + zero-initialized will select the builtin default sampler + which uses linear filtering. +*/ +typedef struct snk_image_desc_t { + sg_image image; + sg_sampler sampler; +} snk_image_desc_t; + +/* + snk_log_item + + An enum with a unique item for each log message, warning, error + and validation layer message. +*/ +#define _SNK_LOG_ITEMS \ + _SNK_LOGITEM_XMACRO(OK, "Ok") \ + _SNK_LOGITEM_XMACRO(MALLOC_FAILED, "memory allocation failed") \ + _SNK_LOGITEM_XMACRO(IMAGE_POOL_EXHAUSTED, "image pool exhausted") \ + +#define _SNK_LOGITEM_XMACRO(item,msg) SNK_LOGITEM_##item, +typedef enum snk_log_item_t { + _SNK_LOG_ITEMS +} snk_log_item_t; +#undef _SNK_LOGITEM_XMACRO + +/* + snk_allocator_t + + Used in snk_desc_t to provide custom memory-alloc and -free functions + to sokol_nuklear.h. If memory management should be overridden, both the + alloc and free function must be provided (e.g. it's not valid to + override one function but not the other). +*/ +typedef struct snk_allocator_t { + void* (*alloc)(size_t size, void* user_data); + void (*free)(void* ptr, void* user_data); + void* user_data; +} snk_allocator_t; + +/* + snk_logger + + Used in snk_desc_t to provide a logging function. Please be aware + that without logging function, sokol-nuklear will be completely + silent, e.g. it will not report errors, warnings and + validation layer messages. For maximum error verbosity, + compile in debug mode (e.g. NDEBUG *not* defined) and install + a logger (for instance the standard logging function from sokol_log.h). +*/ +typedef struct snk_logger_t { + void (*func)( + const char* tag, // always "snk" + uint32_t log_level, // 0=panic, 1=error, 2=warning, 3=info + uint32_t log_item_id, // SNK_LOGITEM_* + const char* message_or_null, // a message string, may be nullptr in release mode + uint32_t line_nr, // line number in sokol_imgui.h + const char* filename_or_null, // source filename, may be nullptr in release mode + void* user_data); + void* user_data; +} snk_logger_t; + + typedef struct snk_desc_t { - int max_vertices; + int max_vertices; // default: 65536 + int image_pool_size; // default: 256 sg_pixel_format color_format; sg_pixel_format depth_format; int sample_count; float dpi_scale; bool no_default_font; + snk_allocator_t allocator; // optional memory allocation overrides (default: malloc/free) + snk_logger_t logger; // optional log function override } snk_desc_t; SOKOL_NUKLEAR_API_DECL void snk_setup(const snk_desc_t* desc); SOKOL_NUKLEAR_API_DECL struct nk_context* snk_new_frame(void); SOKOL_NUKLEAR_API_DECL void snk_render(int width, int height); -SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(sg_image img); +SOKOL_NUKLEAR_API_DECL snk_image_t snk_make_image(const snk_image_desc_t* desc); +SOKOL_NUKLEAR_API_DECL void snk_destroy_image(snk_image_t img); +SOKOL_NUKLEAR_API_DECL snk_image_desc_t snk_query_image_desc(snk_image_t img); +SOKOL_NUKLEAR_API_DECL nk_handle snk_nkhandle(snk_image_t img); +SOKOL_NUKLEAR_API_DECL snk_image_t snk_image_from_nkhandle(nk_handle handle); #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) SOKOL_NUKLEAR_API_DECL void snk_handle_event(const sapp_event* ev); SOKOL_NUKLEAR_API_DECL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter); @@ -241,6 +332,7 @@ SOKOL_NUKLEAR_API_DECL void snk_shutdown(void); /* reference-based equivalents for C++ */ inline void snk_setup(const snk_desc_t& desc) { return snk_setup(&desc); } +inline snk_image_t snk_make_image(const snk_image_desc_t& desc) { return snk_make_image(&desc); } #endif #endif /* SOKOL_NUKLEAR_INCLUDED */ @@ -249,10 +341,6 @@ inline void snk_setup(const snk_desc_t& desc) { return snk_setup(&desc); } #ifdef SOKOL_NUKLEAR_IMPL #define SOKOL_NUKLEAR_IMPL_INCLUDED (1) -#if !defined(NK_UNDEFINED) -#error "Please include nuklear.h before the sokol_nuklear.h implementation" -#endif - #if !defined(NK_INCLUDE_VERTEX_BUFFER_OUTPUT) #error "Please ensure that NK_INCLUDE_VERTEX_BUFFER_OUTPUT is #defined before including nuklear.h" #endif @@ -261,9 +349,8 @@ inline void snk_setup(const snk_desc_t& desc) { return snk_setup(&desc); } #error "The sokol_nuklear.h implementation must be compiled as C." #endif - -#include /* offsetof */ -#include /* memset */ +#include +#include // memset #if defined(__EMSCRIPTEN__) && !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) && !defined(SOKOL_DUMMY_BACKEND) #include @@ -289,7 +376,13 @@ inline void snk_setup(const snk_desc_t& desc) { return snk_setup(&desc); } #endif #endif -/* helper macros */ +#define _SNK_INIT_COOKIE (0xBABEBABE) +#define _SNK_INVALID_SLOT_INDEX (0) +#define _SNK_SLOT_SHIFT (16) +#define _SNK_MAX_POOL_SIZE (1<<_SNK_SLOT_SHIFT) +#define _SNK_SLOT_MASK (_SNK_MAX_POOL_SIZE-1) + +// helper macros #define _snk_def(val, def) (((val) == 0) ? (def) : (val)) typedef struct _snk_vertex_t { @@ -303,7 +396,40 @@ typedef struct _snk_vs_params_t { uint8_t _pad_8[8]; } _snk_vs_params_t; +typedef enum { + _SNK_RESOURCESTATE_INITIAL, + _SNK_RESOURCESTATE_ALLOC, + _SNK_RESOURCESTATE_VALID, + _SNK_RESOURCESTATE_FAILED, + _SNK_RESOURCESTATE_INVALID, + _SNK_RESOURCESTATE_FORCE_U32 = 0x7FFFFFFF +} _snk_resource_state; + +typedef struct { + uint32_t id; + _snk_resource_state state; +} _snk_slot_t; + +typedef struct { + int size; + int queue_top; + uint32_t* gen_ctrs; + int* free_queue; +} _snk_pool_t; + +typedef struct { + _snk_slot_t slot; + sg_image image; + sg_sampler sampler; +} _snk_image_t; + typedef struct { + _snk_pool_t pool; + _snk_image_t* items; +} _snk_image_pool_t; + +typedef struct { + uint32_t init_cookie; snk_desc_t desc; struct nk_context ctx; struct nk_font_atlas atlas; @@ -312,11 +438,15 @@ typedef struct { size_t index_buffer_size; sg_buffer vbuf; sg_buffer ibuf; - sg_image img; - sg_sampler smp; + sg_image font_img; + sg_sampler font_smp; + snk_image_t default_font; + sg_image def_img; + sg_sampler def_smp; sg_shader shd; sg_pipeline pip; - bool is_osx; /* return true if running on OSX (or HTML5 OSX), needed for copy/paste */ + bool is_osx; // true if running on OSX (or HTML5 OSX), needed for copy/paste + _snk_image_pool_t image_pool; #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) int mouse_pos[2]; float mouse_scroll[2]; @@ -1593,18 +1723,308 @@ static bool _snk_is_osx(void) { } #endif // !SOKOL_NUKLEAR_NO_SOKOL_APP +// ██ ██████ ██████ ██████ ██ ███ ██ ██████ +// ██ ██ ██ ██ ██ ██ ████ ██ ██ +// ██ ██ ██ ██ ███ ██ ███ ██ ██ ██ ██ ██ ███ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ███████ ██████ ██████ ██████ ██ ██ ████ ██████ +// +// >>logging +#if defined(SOKOL_DEBUG) +#define _SNK_LOGITEM_XMACRO(item,msg) #item ": " msg, +static const char* _snk_log_messages[] = { + _SNK_LOG_ITEMS +}; +#undef _SNK_LOGITEM_XMACRO +#endif // SOKOL_DEBUG + +#define _SNK_PANIC(code) _snk_log(SNK_LOGITEM_ ##code, 0, 0, __LINE__) +#define _SNK_ERROR(code) _snk_log(SNK_LOGITEM_ ##code, 1, 0, __LINE__) +#define _SNK_WARN(code) _snk_log(SNK_LOGITEM_ ##code, 2, 0, __LINE__) +#define _SNK_INFO(code) _snk_log(SNK_LOGITEM_ ##code, 3, 0, __LINE__) +#define _SNK_LOGMSG(code,msg) _snk_log(SNK_LOGITEM_ ##code, 3, msg, __LINE__) + +static void _snk_log(snk_log_item_t log_item, uint32_t log_level, const char* msg, uint32_t line_nr) { + if (_snuklear.desc.logger.func) { + const char* filename = 0; + #if defined(SOKOL_DEBUG) + filename = __FILE__; + if (0 == msg) { + msg = _snk_log_messages[log_item]; + } + #endif + _snuklear.desc.logger.func("snk", log_level, log_item, msg, line_nr, filename, _snuklear.desc.logger.user_data); + } else { + // for log level PANIC it would be 'undefined behaviour' to continue + if (log_level == 0) { + abort(); + } + } +} + +// ███ ███ ███████ ███ ███ ██████ ██████ ██ ██ +// ████ ████ ██ ████ ████ ██ ██ ██ ██ ██ ██ +// ██ ████ ██ █████ ██ ████ ██ ██ ██ ██████ ████ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ██ ██ ███████ ██ ██ ██████ ██ ██ ██ +// +// >>memory +static void _snk_clear(void* ptr, size_t size) { + SOKOL_ASSERT(ptr && (size > 0)); + memset(ptr, 0, size); +} + +static void* _snk_malloc(size_t size) { + SOKOL_ASSERT(size > 0); + void* ptr; + if (_snuklear.desc.allocator.alloc) { + ptr = _snuklear.desc.allocator.alloc(size, _snuklear.desc.allocator.user_data); + } else { + ptr = malloc(size); + } + if (0 == ptr) { + _SNK_PANIC(MALLOC_FAILED); + } + return ptr; +} + +static void* _snk_malloc_clear(size_t size) { + void* ptr = _snk_malloc(size); + _snk_clear(ptr, size); + return ptr; +} + +static void _snk_free(void* ptr) { + if (_snuklear.desc.allocator.free) { + _snuklear.desc.allocator.free(ptr, _snuklear.desc.allocator.user_data); + } else { + free(ptr); + } +} + +// ██████ ██████ ██████ ██ +// ██ ██ ██ ██ ██ ██ ██ +// ██████ ██ ██ ██ ██ ██ +// ██ ██ ██ ██ ██ ██ +// ██ ██████ ██████ ███████ +// +// >>pool +static void _snk_init_pool(_snk_pool_t* pool, int num) { + SOKOL_ASSERT(pool && (num >= 1)); + // slot 0 is reserved for the 'invalid id', so bump the pool size by 1 + pool->size = num + 1; + pool->queue_top = 0; + // generation counters indexable by pool slot index, slot 0 is reserved + size_t gen_ctrs_size = sizeof(uint32_t) * (size_t)pool->size; + pool->gen_ctrs = (uint32_t*) _snk_malloc_clear(gen_ctrs_size); + // it's not a bug to only reserve 'num' here + pool->free_queue = (int*) _snk_malloc_clear(sizeof(int) * (size_t)num); + // never allocate the zero-th pool item since the invalid id is 0 + for (int i = pool->size-1; i >= 1; i--) { + pool->free_queue[pool->queue_top++] = i; + } +} + +static void _snk_discard_pool(_snk_pool_t* pool) { + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + _snk_free(pool->free_queue); + pool->free_queue = 0; + SOKOL_ASSERT(pool->gen_ctrs); + _snk_free(pool->gen_ctrs); + pool->gen_ctrs = 0; + pool->size = 0; + pool->queue_top = 0; +} + +static int _snk_pool_alloc_index(_snk_pool_t* pool) { + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + if (pool->queue_top > 0) { + int slot_index = pool->free_queue[--pool->queue_top]; + SOKOL_ASSERT((slot_index > 0) && (slot_index < pool->size)); + return slot_index; + } else { + // pool exhausted + return _SNK_INVALID_SLOT_INDEX; + } +} + +static void _snk_pool_free_index(_snk_pool_t* pool, int slot_index) { + SOKOL_ASSERT((slot_index > _SNK_INVALID_SLOT_INDEX) && (slot_index < pool->size)); + SOKOL_ASSERT(pool); + SOKOL_ASSERT(pool->free_queue); + SOKOL_ASSERT(pool->queue_top < pool->size); + #ifdef SOKOL_DEBUG + // debug check against double-free + for (int i = 0; i < pool->queue_top; i++) { + SOKOL_ASSERT(pool->free_queue[i] != slot_index); + } + #endif + pool->free_queue[pool->queue_top++] = slot_index; + SOKOL_ASSERT(pool->queue_top <= (pool->size-1)); +} + +/* initiailize a pool slot: + - bump the slot's generation counter + - create a resource id from the generation counter and slot index + - set the slot's id to this id + - set the slot's state to ALLOC + - return the handle id +*/ +static uint32_t _snk_slot_init(_snk_pool_t* pool, _snk_slot_t* slot, int slot_index) { + /* FIXME: add handling for an overflowing generation counter, + for now, just overflow (another option is to disable + the slot) + */ + SOKOL_ASSERT(pool && pool->gen_ctrs); + SOKOL_ASSERT((slot_index > _SNK_INVALID_SLOT_INDEX) && (slot_index < pool->size)); + SOKOL_ASSERT((slot->state == _SNK_RESOURCESTATE_INITIAL) && (slot->id == SNK_INVALID_ID)); + uint32_t ctr = ++pool->gen_ctrs[slot_index]; + slot->id = (ctr<<_SNK_SLOT_SHIFT)|(slot_index & _SNK_SLOT_MASK); + slot->state = _SNK_RESOURCESTATE_ALLOC; + return slot->id; +} + +// extract slot index from id +static int _snk_slot_index(uint32_t id) { + int slot_index = (int) (id & _SNK_SLOT_MASK); + SOKOL_ASSERT(_SNK_INVALID_SLOT_INDEX != slot_index); + return slot_index; +} + +static void _snk_init_item_pool(_snk_pool_t* pool, int pool_size, void** items_ptr, size_t item_size_bytes) { + // NOTE: the pools will have an additional item, since slot 0 is reserved + SOKOL_ASSERT(pool && (pool->size == 0)); + SOKOL_ASSERT((pool_size > 0) && (pool_size < _SNK_MAX_POOL_SIZE)); + SOKOL_ASSERT(items_ptr && (*items_ptr == 0)); + SOKOL_ASSERT(item_size_bytes > 0); + _snk_init_pool(pool, pool_size); + const size_t pool_size_bytes = item_size_bytes * (size_t)pool->size; + *items_ptr = _snk_malloc_clear(pool_size_bytes); +} + +static void _snk_discard_item_pool(_snk_pool_t* pool, void** items_ptr) { + SOKOL_ASSERT(pool && (pool->size != 0)); + SOKOL_ASSERT(items_ptr && (*items_ptr != 0)); + _snk_free(*items_ptr); *items_ptr = 0; + _snk_discard_pool(pool); +} + +static void _snk_setup_image_pool(int pool_size) { + _snk_image_pool_t* p = &_snuklear.image_pool; + _snk_init_item_pool(&p->pool, pool_size, (void**)&p->items, sizeof(_snk_image_t)); +} + +static void _snk_discard_image_pool(void) { + _snk_image_pool_t* p = &_snuklear.image_pool; + _snk_discard_item_pool(&p->pool, (void**)&p->items); +} + +static snk_image_t _snk_make_image_handle(uint32_t id) { + snk_image_t handle = { id }; + return handle; +} + +static _snk_image_t* _snk_image_at(uint32_t id) { + SOKOL_ASSERT(SNK_INVALID_ID != id); + const _snk_image_pool_t* p = &_snuklear.image_pool; + int slot_index = _snk_slot_index(id); + SOKOL_ASSERT((slot_index > _SNK_INVALID_SLOT_INDEX) && (slot_index < p->pool.size)); + return &p->items[slot_index]; +} + +static _snk_image_t* _snk_lookup_image(uint32_t id) { + if (SNK_INVALID_ID != id) { + _snk_image_t* img = _snk_image_at(id); + if (img->slot.id == id) { + return img; + } + } + return 0; +} + +static snk_image_t _snk_alloc_image(void) { + _snk_image_pool_t* p = &_snuklear.image_pool; + int slot_index = _snk_pool_alloc_index(&p->pool); + if (_SNK_INVALID_SLOT_INDEX != slot_index) { + uint32_t id = _snk_slot_init(&p->pool, &p->items[slot_index].slot, slot_index); + return _snk_make_image_handle(id); + } else { + // pool exhausted + return _snk_make_image_handle(SNK_INVALID_ID); + } +} + +static _snk_resource_state _snk_init_image(_snk_image_t* img, const snk_image_desc_t* desc) { + SOKOL_ASSERT(img && (img->slot.state == _SNK_RESOURCESTATE_ALLOC)); + SOKOL_ASSERT(desc); + img->image = desc->image; + img->sampler = desc->sampler; + return _SNK_RESOURCESTATE_VALID; +} + +static void _snk_deinit_image(_snk_image_t* img) { + SOKOL_ASSERT(img); + img->image.id = SNK_INVALID_ID; + img->sampler.id = SNK_INVALID_ID; +} + +static void _snk_destroy_image(snk_image_t img_id) { + _snk_image_t* img = _snk_lookup_image(img_id.id); + if (img) { + _snk_deinit_image(img); + _snk_image_pool_t* p = &_snuklear.image_pool; + _snk_clear(img, sizeof(_snk_image_t)); + _snk_pool_free_index(&p->pool, _snk_slot_index(img_id.id)); + } +} + +static void _snk_destroy_all_images(void) { + _snk_image_pool_t* p = &_snuklear.image_pool; + for (int i = 0; i < p->pool.size; i++) { + _snk_image_t* img = &p->items[i]; + _snk_destroy_image(_snk_make_image_handle(img->slot.id)); + } +} + +static snk_image_desc_t _snk_image_desc_defaults(const snk_image_desc_t* desc) { + SOKOL_ASSERT(desc); + snk_image_desc_t res = *desc; + res.image.id = _snk_def(res.image.id, _snuklear.def_img.id); + res.sampler.id = _snk_def(res.sampler.id, _snuklear.def_smp.id); + return res; +} + +static snk_desc_t _snk_desc_defaults(const snk_desc_t* desc) { + SOKOL_ASSERT(desc); + snk_desc_t res = *desc; + res.max_vertices = _snk_def(res.max_vertices, 65536); + res.dpi_scale = _snk_def(res.dpi_scale, 1.0f); + res.image_pool_size = _snk_def(res.image_pool_size, 256); + return res; +} + +// ██████ ██ ██ ██████ ██ ██ ██████ +// ██ ██ ██ ██ ██ ██ ██ ██ ██ +// ██████ ██ ██ ██████ ██ ██ ██ +// ██ ██ ██ ██ ██ ██ ██ ██ +// ██ ██████ ██████ ███████ ██ ██████ +// +// >>public SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { SOKOL_ASSERT(desc); - memset(&_snuklear, 0, sizeof(_snuklear)); - _snuklear.desc = *desc; - _snuklear.desc.max_vertices = _snk_def(_snuklear.desc.max_vertices, 65536); - _snuklear.desc.dpi_scale = _snk_def(_snuklear.desc.dpi_scale, 1.0f); + _snk_clear(&_snuklear, sizeof(_snuklear)); + _snuklear.init_cookie = _SNK_INIT_COOKIE; + _snuklear.desc = _snk_desc_defaults(desc); #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) _snuklear.is_osx = _snk_is_osx(); #endif // can keep color_format, depth_format and sample_count as is, // since sokol_gfx.h will do its own default-value handling + _snk_setup_image_pool(_snuklear.desc.image_pool_size); + // initialize Nuklear nk_bool init_res = nk_init_default(&_snuklear.ctx, 0); SOKOL_ASSERT(1 == init_res); (void)init_res; // silence unused warning in release mode @@ -1633,6 +2053,24 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .label = "sokol-nuklear-indices" }); + // default font sampler + _snuklear.font_smp = sg_make_sampler(&(sg_sampler_desc){ + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + .wrap_u = SG_WRAP_CLAMP_TO_EDGE, + .wrap_v = SG_WRAP_CLAMP_TO_EDGE, + .label = "sokol-nuklear-font-sampler", + }); + + // default user-image sampler + _snuklear.def_smp = sg_make_sampler(&(sg_sampler_desc){ + .min_filter = SG_FILTER_NEAREST, + .mag_filter = SG_FILTER_NEAREST, + .wrap_u = SG_WRAP_CLAMP_TO_EDGE, + .wrap_v = SG_WRAP_CLAMP_TO_EDGE, + .label = "sokol-nuklear-default-sampler", + }); + // default font texture if (!_snuklear.desc.no_default_font) { nk_font_atlas_init_default(&_snuklear.atlas); @@ -1640,7 +2078,7 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { int font_width = 0, font_height = 0; const void* pixels = nk_font_atlas_bake(&_snuklear.atlas, &font_width, &font_height, NK_FONT_ATLAS_RGBA32); SOKOL_ASSERT((font_width > 0) && (font_height > 0)); - _snuklear.img = sg_make_image(&(sg_image_desc){ + _snuklear.font_img = sg_make_image(&(sg_image_desc){ .width = font_width, .height = font_height, .pixel_format = SG_PIXELFORMAT_RGBA8, @@ -1650,19 +2088,26 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { }, .label = "sokol-nuklear-font" }); - nk_font_atlas_end(&_snuklear.atlas, nk_handle_id((int)_snuklear.img.id), 0); + _snuklear.default_font = snk_make_image(&(snk_image_desc_t){ + .image = _snuklear.font_img, + .sampler = _snuklear.font_smp, + }); + nk_font_atlas_end(&_snuklear.atlas, snk_nkhandle(_snuklear.default_font), 0); nk_font_atlas_cleanup(&_snuklear.atlas); if (_snuklear.atlas.default_font) { nk_style_set_font(&_snuklear.ctx, &_snuklear.atlas.default_font->handle); } } - // default font sampler - _snuklear.smp = sg_make_sampler(&(sg_sampler_desc){ - .wrap_u = SG_WRAP_CLAMP_TO_EDGE, - .wrap_v = SG_WRAP_CLAMP_TO_EDGE, - .min_filter = SG_FILTER_LINEAR, - .mag_filter = SG_FILTER_LINEAR, + // default user image + static uint32_t def_pixels[64]; + memset(def_pixels, 0xFF, sizeof(def_pixels)); + _snuklear.def_img = sg_make_image(&(sg_image_desc){ + .width = 8, + .height = 8, + .pixel_format = SG_PIXELFORMAT_RGBA8, + .data.subimage[0][0] = SG_RANGE(def_pixels), + .label = "sokol-nuklear-default-image", }); // shader @@ -1769,6 +2214,7 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { } SOKOL_API_IMPL void snk_shutdown(void) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); nk_free(&_snuklear.ctx); nk_font_atlas_clear(&_snuklear.atlas); @@ -1776,14 +2222,20 @@ SOKOL_API_IMPL void snk_shutdown(void) { sg_push_debug_group("sokol-nuklear"); sg_destroy_pipeline(_snuklear.pip); sg_destroy_shader(_snuklear.shd); - sg_destroy_sampler(_snuklear.smp); - sg_destroy_image(_snuklear.img); + sg_destroy_sampler(_snuklear.font_smp); + sg_destroy_image(_snuklear.font_img); + sg_destroy_sampler(_snuklear.def_smp); + sg_destroy_image(_snuklear.def_img); sg_destroy_buffer(_snuklear.ibuf); sg_destroy_buffer(_snuklear.vbuf); sg_pop_debug_group(); + _snk_destroy_all_images(); + _snk_discard_image_pool(); + _snuklear.init_cookie = 0; } SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); #if !defined(SOKOL_NUKLEAR_NO_SOKOL_APP) nk_input_begin(&_snuklear.ctx); if (_snuklear.mouse_did_move) { @@ -1808,7 +2260,7 @@ SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { for (size_t i = 0; i < char_buffer_len; i++) { nk_input_char(&_snuklear.ctx, _snuklear.char_buffer[i]); } - memset(_snuklear.char_buffer, 0, NK_INPUT_MAX); + _snk_clear(_snuklear.char_buffer, NK_INPUT_MAX); } for (int i = 0; i < NK_KEY_MAX; i++) { if (_snuklear.keys_down[i]) { @@ -1827,19 +2279,62 @@ SOKOL_API_IMPL struct nk_context* snk_new_frame(void) { return &_snuklear.ctx; } -SOKOL_API_IMPL nk_handle snk_nkhandle(sg_image img) { - return (nk_handle) { .ptr = (void*)(uintptr_t)img.id }; +SOKOL_API_IMPL snk_image_t snk_make_image(const snk_image_desc_t* desc) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); + SOKOL_ASSERT(desc); + const snk_image_desc_t desc_def = _snk_image_desc_defaults(desc); + snk_image_t img_id = _snk_alloc_image(); + _snk_image_t* img = _snk_lookup_image(img_id.id); + if (img) { + img->slot.state = _snk_init_image(img, &desc_def); + SOKOL_ASSERT((img->slot.state == _SNK_RESOURCESTATE_VALID) || (img->slot.state == _SNK_RESOURCESTATE_FAILED)); + } else { + _SNK_ERROR(IMAGE_POOL_EXHAUSTED); + } + return img_id; +} + +SOKOL_API_IMPL void snk_destroy_image(snk_image_t img_id) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); + _snk_destroy_image(img_id); +} + +SOKOL_API_IMPL snk_image_desc_t snk_query_image_desc(snk_image_t img_id) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); + _snk_image_t* img = _snk_lookup_image(img_id.id); + if (img) { + return (snk_image_desc_t){ + .image = img->image, + .sampler = img->sampler, + }; + } else { + return (snk_image_desc_t){0}; + } +} + +SOKOL_API_IMPL nk_handle snk_nkhandle(snk_image_t img) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); + return (nk_handle) { .id = (int)img.id }; } -_SOKOL_PRIVATE uint32_t _snk_imageid_from_nkhandle(nk_handle h) { - uint32_t img_id = (uint32_t)(uintptr_t)h.ptr; - if (0 == img_id) { - img_id = _snuklear.img.id; +SOKOL_API_IMPL snk_image_t snk_image_from_nkhandle(nk_handle h) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); + return (snk_image_t){ .id = (uint32_t) h.id }; +} + +static void _snk_bind_image_sampler(sg_bindings* bindings, nk_handle h) { + _snk_image_t* img = _snk_lookup_image((uint32_t)h.id); + if (img) { + bindings->fs.images[0] = img->image; + bindings->fs.samplers[0] = img->sampler; + } else { + bindings->fs.images[0] = _snuklear.def_img; + bindings->fs.samplers[0] = _snuklear.def_smp; } - return img_id; } SOKOL_API_IMPL void snk_render(int width, int height) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); static const struct nk_draw_vertex_layout_element vertex_layout[] = { {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct _snk_vertex_t, pos)}, {NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct _snk_vertex_t, uv)}, @@ -1889,23 +2384,22 @@ SOKOL_API_IMPL void snk_render(int width, int height) { // Iterate through the command list, rendering each one const struct nk_draw_command* cmd = NULL; int idx_offset = 0; + sg_bindings bindings = { + .vertex_buffers[0] = _snuklear.vbuf, + .index_buffer = _snuklear.ibuf, + .index_buffer_offset = idx_offset + }; nk_draw_foreach(cmd, &_snuklear.ctx, &cmds) { if (cmd->elem_count > 0) { - sg_apply_bindings(&(sg_bindings){ - .fs.images[0].id = _snk_imageid_from_nkhandle(cmd->texture), - .fs.samplers[0] = _snuklear.smp, - .vertex_buffers[0] = _snuklear.vbuf, - .index_buffer = _snuklear.ibuf, - .vertex_buffer_offsets[0] = 0, - .index_buffer_offset = idx_offset - }); + _snk_bind_image_sampler(&bindings, cmd->texture); + sg_apply_bindings(&bindings); sg_apply_scissor_rectf(cmd->clip_rect.x * dpi_scale, cmd->clip_rect.y * dpi_scale, cmd->clip_rect.w * dpi_scale, cmd->clip_rect.h * dpi_scale, true); sg_draw(0, (int)cmd->elem_count, 1); - idx_offset += (int)cmd->elem_count * (int)sizeof(uint16_t); + bindings.index_buffer_offset += (int)cmd->elem_count * (int)sizeof(uint16_t); } } sg_apply_scissor_rect(0, 0, fb_width, fb_height, true); @@ -1985,6 +2479,7 @@ _SOKOL_PRIVATE enum nk_keys _snk_event_to_nuklearkey(const sapp_event* ev) { } SOKOL_API_IMPL void snk_handle_event(const sapp_event* ev) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); const float dpi_scale = _snuklear.desc.dpi_scale; switch (ev->type) { case SAPP_EVENTTYPE_MOUSE_DOWN: @@ -2104,6 +2599,7 @@ SOKOL_API_IMPL void snk_handle_event(const sapp_event* ev) { } SOKOL_API_IMPL nk_flags snk_edit_string(struct nk_context *ctx, nk_flags flags, char *memory, int *len, int max, nk_plugin_filter filter) { + SOKOL_ASSERT(_SNK_INIT_COOKIE == _snuklear.init_cookie); nk_flags event = nk_edit_string(ctx, flags, memory, len, max, filter); if ((event & NK_EDIT_ACTIVATED) && !sapp_keyboard_shown()) { sapp_show_keyboard(true); From 8b9496fb305491076d93de42e48e4fb7ef9c337d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 26 Jul 2023 20:55:56 +0200 Subject: [PATCH 117/292] sokol_imgui.h: remove obsolete documentation snippet --- util/sokol_imgui.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 1c8c9014b..024b37618 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -223,14 +223,6 @@ simgui_shutdown() - --- use the following helper function to create an ImTextureID handle from - a sokol-gfx image (note that you cannot provide your own sampler currently): - - ImTextureID tex_id = simgui_imtextureid(img); - - ...an invalid handle {SG_INVALID_ID} will be replaced with the - default font texture or default sampler object - ON USER-PROVIDED IMAGES AND SAMPLERS ==================================== From b8f38c1f08c27de82eff5bec70ad9ae8d9263d7d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 26 Jul 2023 21:06:59 +0200 Subject: [PATCH 118/292] sokol_nuklear.h: update documentation --- util/sokol_nuklear.h | 132 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 123 insertions(+), 9 deletions(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 9eabfa622..ae4e9ae09 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -50,10 +50,6 @@ sokol_gfx.h sokol_app.h (except SOKOL_NUKLEAR_NO_SOKOL_APP) - - Additionally, include the following headers before including the - implementation: - nuklear.h NOTE: Unlike most other sokol-headers, the implementation must be compiled @@ -94,6 +90,10 @@ sokol-nuklear will use this to compute the size of the vertex- and index-buffers allocated via sokol_gfx.h + int image_pool_size + Number of snk_image_t objects which can be alive at the same time. + The default is 256. + sg_pixel_format color_format The color pixel format of the render pass where the UI will be rendered. The default is SG_PIXELFORMAT_RGBA8 @@ -155,13 +155,127 @@ nk_edit_string(...), called snk_edit_string(...) which will show and hide the onscreen keyboard as required. - --- NOTE: to create a Nuklear image handle, use the helper function - `nk_handle snk_nkhandle(sg_image img)` together with - the Nuklear function nk_image_handle like this: - nk_image nki = nk_image_handle(snk_nkhandle(img)); + ON USER-PROVIDED IMAGES AND SAMPLERS + ==================================== + To render your own images via nk_image(), first create an snk_image_t + object from a sokol-gfx image and sampler object. + + // create a sokol-nuklear image object which associates an sg_image with an sg_sampler + snk_image_t snk_img = snk_make_image(&(snk_image_desc_t){ + .image = sg_make_image(...), + .sampler = sg_make_sampler(...), + }); + + // convert the returned image handle into an nk_handle object + struct nk_handle nk_hnd = snk_nkhandle(snk_img); + + // create a nuklear image from the generic handle (note that there a different helper functions for this) + struct nk_image nk_img = nk_image_handle(nk_hnd); + + // finally specify a Nuklear image UI object + nk_image(ctx, nk_img); + + snk_image_t objects are small and cheap (literally just the image and sampler + handle). + + You can omit the sampler handle in the snk_make_image() call, in this case a + default sampler will be used with nearest-filtering and clamp-to-edge. + + Trying to render with an invalid snk_image_t handle will render a small 8x8 + white default texture instead. + + To destroy a sokol-nuklear image object, call + + snk_destroy_image(snk_img); + + But please be aware that the image object needs to be around until snk_render() is called + in a frame (if this turns out to be too much of a hassle we could introduce some sort + of garbage collection where destroyed snk_image_t objects are kept around until + the snk_render() call). + + You can call: + + snk_image_desc_t desc = snk_query_image_desc(img) + + ...to get the original desc struct, useful if you need to get the sokol-gfx image + and sampler handle of the snk_image_t object. + + You can convert an nk_handle back into an snk_image_t handle: + + snk_image_t img = snk_image_from_nkhandle(nk_hnd); + + + MEMORY ALLOCATION OVERRIDE + ========================== + You can override the memory allocation functions at initialization time + like this: + + void* my_alloc(size_t size, void* user_data) { + return malloc(size); + } + + void my_free(void* ptr, void* user_data) { + free(ptr); + } + + ... + snk_setup(&(snk_desc_t){ + // ... + .allocator = { + .alloc = my_alloc, + .free = my_free, + .user_data = ...; + } + }); + ... + + If no overrides are provided, malloc and free will be used. + + This only affects memory allocation calls done by sokol_nuklear.h + itself though, not any allocations in Nuklear. + + + ERROR REPORTING AND LOGGING + =========================== + To get any logging information at all you need to provide a logging callback in the setup call + the easiest way is to use sokol_log.h: + + #include "sokol_log.h" + + snk_setup(&(snk_desc_t){ + .logger.func = slog_func + }); + + To override logging with your own callback, first write a logging function like this: + + void my_log(const char* tag, // e.g. 'snk' + uint32_t log_level, // 0=panic, 1=error, 2=warn, 3=info + uint32_t log_item_id, // SNK_LOGITEM_* + const char* message_or_null, // a message string, may be nullptr in release mode + uint32_t line_nr, // line number in sokol_nuklear.h + const char* filename_or_null, // source filename, may be nullptr in release mode + void* user_data) + { + ... + } + + ...and then setup sokol-nuklear like this: + + snk_setup(&(snk_desc_t){ + .logger = { + .func = my_log, + .user_data = my_user_data, + } + }); + + The provided logging function must be reentrant (e.g. be callable from + different threads). + + If you don't want to provide your own custom logger it is highly recommended to use + the standard logger in sokol_log.h instead, otherwise you won't see any warnings or + errors. - Note that it's currently not possible to provide a custom sg_sampler object. LICENSE ======= From edfed6771199ca876778d478281e51d0fc551845 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 26 Jul 2023 21:16:16 +0200 Subject: [PATCH 119/292] update changelog and readme (image+sampler support in sokol_nuklear.h) --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3752a784..61fb769b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ ## Updates +#### 26-Jul-2023 + +**sokol_nuklear.h**: The same image+sampler support has been added as in sokol_nuklear.h +three days ago: + +- a new object type `snk_image_t` which wraps a sokol-gfx image and sampler + under a common handle +- new functions: + - snk_make_image() + - snk_destroy_image() + - snk_query_image_desc() + - snk_image_from_nkhandle() +- the function snk_nkhandle() now takes an snk_image_t handle instead of an sg_image handle +- the nuklear.h header needs to be included before the declaration (not just the implementation), + this was already required before, but now you get a proper error message if the include is missing +- the 'standard' logging- and error-reporting callback has been added as in the other sokol headers + (don't forget to add a logging callback in snk_setup(), otherwise sokol-nuklear will be silent) +- since sokol-nuklear now needs to allocate memory, an allocator can now be provided to the + snk_setup() call (otherwise malloc/free will be used) + +Please also read the new documentation section `ON USER-PROVIDED IMAGES AND SAMPLERS` +in sokol_nuklear.h, and also check out the (rewritten) sample: + +https://floooh.github.io/sokol-html5/nuklear-images-sapp.html + +Associated PR: https://github.com/floooh/sokol/pull/862 + #### 23-Jul-2023 **sokol_imgui.h**: Add proper support for injecting user-provided sokol-gfx diff --git a/README.md b/README.md index 2b5404013..90eba58d4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**23-Jul-2023** proper image/sampler pair support in sokol_imgui.h) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Jul-2023** proper image/sampler pair support in sokol_nuklear.h) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 30ca006b927b984ab2c2365cd1fde26e72b91377 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 26 Jul 2023 21:21:04 +0200 Subject: [PATCH 120/292] fix typo in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61fb769b1..2ff9e4f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### 26-Jul-2023 -**sokol_nuklear.h**: The same image+sampler support has been added as in sokol_nuklear.h +**sokol_nuklear.h**: The same image+sampler support has been added as in sokol_imgui.h three days ago: - a new object type `snk_image_t` which wraps a sokol-gfx image and sampler From b9e7f1207d9bc43fc082d727df9eadbfb337cd7d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 27 Jul 2023 21:52:16 +0200 Subject: [PATCH 121/292] gh actions: switch to goto-bus-stop/setup-zig@v2 --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 1c992512e..9e372d4e4 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -99,7 +99,7 @@ jobs: - uses: actions/checkout@v3 with: repository: floooh/sokol-zig - - uses: goto-bus-stop/setup-zig@v1 + - uses: goto-bus-stop/setup-zig@v2 with: version: 0.11.0-dev.4004+a57608217 - uses: actions/download-artifact@v3 From 858f6128a370ed9ae2f052b7f009f95877bf2965 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 30 Jul 2023 17:58:40 +0200 Subject: [PATCH 122/292] sokol_gfx.h: wgpu update wip --- sokol_gfx.h | 166 +++++++++++++++++++++++----------------------------- 1 file changed, 73 insertions(+), 93 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 19a29d6b4..4a31de7fe 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2902,11 +2902,6 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND, "fragment shader entry not found (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ - _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "mapping uniform buffer failed (wgpu)") \ - _SG_LOGITEM_XMACRO(WGPU_STAGING_BUFFER_FULL_COPY_TO_BUFFER, "per frame staging buffer full when copying to buffer (wgpu)") \ - _SG_LOGITEM_XMACRO(WGPU_STAGING_BUFFER_FULL_COPY_TO_TEXTURE, "per frame staging buffer full when copying to texture (wgpu)") \ - _SG_LOGITEM_XMACRO(WGPU_RESET_STATE_CACHE_FIXME, "_sg_wgpu_reset_state_cache: fixme") \ - _SG_LOGITEM_XMACRO(WGPU_ACTIVATE_CONTEXT_FIXME, "_sg_wgpu_activate_context: fixme") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ @@ -3134,7 +3129,7 @@ typedef enum sg_log_item { .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) + WebGPU: *no default* (must be queried from swapchain) .context.depth_format SG_PIXELFORMAT_DEPTH_STENCIL .context.sample_count 1 @@ -3236,7 +3231,7 @@ typedef struct sg_wgpu_context_desc { const void* (*render_view_userdata_cb)(void*); const void* (*resolve_view_cb)(void); // returns WGPUTextureView const void* (*resolve_view_userdata_cb)(void*); - const void* (*depth_stencil_view_cb)(void); // returns WGPUTextureView, must be WGPUTextureFormat_Depth24Plus8 + const void* (*depth_stencil_view_cb)(void); // returns WGPUTextureView const void* (*depth_stencil_view_userdata_cb)(void*); void* user_data; } sg_wgpu_context_desc; @@ -3614,11 +3609,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #endif #import #elif defined(SOKOL_WGPU) - #if defined(__EMSCRIPTEN__) - #include - #else - #include - #endif + #include #elif defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) #define _SOKOL_ANY_GL (1) @@ -4814,13 +4805,20 @@ typedef struct { _sg_image_common_t cmn; struct { WGPUTexture tex; - WGPUTextureView tex_view; - WGPUTexture msaa_tex; - WGPUSampler sampler; + WGPUTextureView view; } wgpu; } _sg_wgpu_image_t; typedef _sg_wgpu_image_t _sg_image_t; +typedef struct { + _sg_slot_t slot; + _sg_sampler_common_t cmn; + struct { + WGPUSampler smp; + } wgpu; +} _sg_wgpu_sampler_t; +typedef _sg_wgpu_sampler_t _sg_sampler_t; + typedef struct { WGPUShaderModule module; WGPUBindGroupLayout bind_group_layout; @@ -4849,8 +4847,7 @@ typedef _sg_wgpu_pipeline_t _sg_pipeline_t; typedef struct { _sg_image_t* image; - WGPUTextureView render_tex_view; - WGPUTextureView resolve_tex_view; + WGPUTextureView view; } _sg_wgpu_attachment_t; typedef struct { @@ -4858,6 +4855,7 @@ typedef struct { _sg_pass_common_t cmn; struct { _sg_wgpu_attachment_t color_atts[SG_MAX_COLOR_ATTACHMENTS]; + _sg_wgpu_attachment_t resolve_atts[SG_MAX_COLOR_ATTACHMENTS]; _sg_wgpu_attachment_t ds_att; } wgpu; } _sg_wgpu_pass_t; @@ -4885,23 +4883,9 @@ typedef struct { } stage; } _sg_wgpu_ubpool_t; -// ...a similar pool (like uniform buffer pool) of dynamic-resource staging buffers -typedef struct { - uint32_t num_bytes; - uint32_t offset; // current offset into current frame's staging buffer - int num; // number of staging buffers - int cur; // this frame's staging buffer - WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; // CPU-side staging buffers - uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // if != 0, staging buffer currently mapped -} _sg_wgpu_stagingpool_t; - // the WGPU backend state typedef struct { bool valid; - bool in_pass; - bool draw_indexed; - int cur_width; - int cur_height; WGPUDevice dev; WGPUTextureView (*render_view_cb)(void); WGPUTextureView (*render_view_userdata_cb)(void*); @@ -4910,6 +4894,10 @@ typedef struct { WGPUTextureView (*depth_stencil_view_cb)(void); WGPUTextureView (*depth_stencil_view_userdata_cb)(void*); void* user_data; + bool in_pass; + bool use_indexed_draw; + int cur_width; + int cur_height; WGPUQueue queue; WGPUCommandEncoder render_cmd_enc; WGPUCommandEncoder staging_cmd_enc; @@ -4918,7 +4906,6 @@ typedef struct { const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; _sg_wgpu_ubpool_t ub; - _sg_wgpu_stagingpool_t staging; } _sg_wgpu_backend_t; #endif @@ -11956,16 +11943,28 @@ _SOKOL_PRIVATE WGPUBufferUsageFlags _sg_wgpu_buffer_usage(sg_buffer_type t, sg_u return res; } -_SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(sg_action a) { +_SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(sg_load_action a) { switch (a) { - case SG_ACTION_CLEAR: - case SG_ACTION_DONTCARE: + case SG_LOADACTION_CLEAR: + case SG_LOADACTION_DONTCARE: return WGPULoadOp_Clear; - case SG_ACTION_LOAD: + case SG_LOADACTION_LOAD: return WGPULoadOp_Load; default: SOKOL_UNREACHABLE; - return (WGPULoadOp)0; + return WGPULoadOp_Force32; + } +} + +_SOKOL_PRIVATE WGPUStoreOp _sg_wgpu_store_op(sg_store_action a) { + switch (a) { + case SG_STOREACTION_STORE: + return WGPUStoreOp_Store; + case SG_STOREACTION_DONTCARE: + return WGPUStoreOp_Discard; + default: + SOKOL_UNREACHABLE; + return WGPUStoreOp_Force32; } } @@ -11979,13 +11978,13 @@ _SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_viewdim(sg_image_type t) { } } -_SOKOL_PRIVATE WGPUTextureComponentType _sg_wgpu_tex_comptype(sg_image_sample_type t) { - // FIXME +_SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_tex_sample_type(sg_image_sample_type t) { switch (t) { - case SG_IMAGESAMPLETYPE_FLOAT: return WGPUTextureComponentType_Float; - case SG_IMAGESAMPLETYPE_SINT: return WGPUTextureComponentType_Sint; - case SG_IMAGESAMPLETYPE_UINT: return WGPUTextureComponentType_Uint; - default: SOKOL_UNREACHABLE; return WGPUTextureComponentType_Force32; + case SG_IMAGESAMPLETYPE_FLOAT: return WGPUTextureSampleType_Float; + case SG_IMAGESAMPLETYPE_DEPTH: return WGPUTextureSampleType_Depth; + case SG_IMAGESAMPLETYPE_SINT: return WGPUTextureSampleType_Sint; + case SG_IMAGESAMPLETYPE_UINT: return WGPUTextureSampleType_Uint; + default: SOKOL_UNREACHABLE; return WGPUTextureSampleType_Force32; } } @@ -12015,12 +12014,8 @@ _SOKOL_PRIVATE WGPUAddressMode _sg_wgpu_sampler_addrmode(sg_wrap m) { _SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmagfilter(sg_filter f) { switch (f) { case SG_FILTER_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - case SG_FILTER_NEAREST_MIPMAP_LINEAR: return WGPUFilterMode_Nearest; case SG_FILTER_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: - case SG_FILTER_LINEAR_MIPMAP_LINEAR: return WGPUFilterMode_Linear; default: SOKOL_UNREACHABLE; @@ -12028,15 +12023,12 @@ _SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmagfilter(sg_filter f) { } } -_SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_mipfilter(sg_filter f) { +_SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_mipmap_filter(sg_filter f) { switch (f) { + case SG_FILTER_NONE: case SG_FILTER_NEAREST: - case SG_FILTER_LINEAR: - case SG_FILTER_NEAREST_MIPMAP_NEAREST: - case SG_FILTER_LINEAR_MIPMAP_NEAREST: return WGPUFilterMode_Nearest; - case SG_FILTER_NEAREST_MIPMAP_LINEAR: - case SG_FILTER_LINEAR_MIPMAP_LINEAR: + case SG_FILTER_LINEAR: return WGPUFilterMode_Linear; default: SOKOL_UNREACHABLE; @@ -12049,28 +12041,28 @@ _SOKOL_PRIVATE WGPUIndexFormat _sg_wgpu_indexformat(sg_index_type t) { return (t == SG_INDEXTYPE_UINT16) ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32; } -_SOKOL_PRIVATE WGPUInputStepMode _sg_wgpu_stepmode(sg_vertex_step s) { - return (s == SG_VERTEXSTEP_PER_VERTEX) ? WGPUInputStepMode_Vertex : WGPUInputStepMode_Instance; +_SOKOL_PRIVATE WGPUVertexStepMode _sg_wgpu_stepmode(sg_vertex_step s) { + return (s == SG_VERTEXSTEP_PER_VERTEX) ? WGPUVertexStepMode_Vertex : WGPUVertexStepMode_Instance; } _SOKOL_PRIVATE WGPUVertexFormat _sg_wgpu_vertexformat(sg_vertex_format f) { switch (f) { - case SG_VERTEXFORMAT_FLOAT: return WGPUVertexFormat_Float; - case SG_VERTEXFORMAT_FLOAT2: return WGPUVertexFormat_Float2; - case SG_VERTEXFORMAT_FLOAT3: return WGPUVertexFormat_Float3; - case SG_VERTEXFORMAT_FLOAT4: return WGPUVertexFormat_Float4; - case SG_VERTEXFORMAT_BYTE4: return WGPUVertexFormat_Char4; - case SG_VERTEXFORMAT_BYTE4N: return WGPUVertexFormat_Char4Norm; - case SG_VERTEXFORMAT_UBYTE4: return WGPUVertexFormat_UChar4; - case SG_VERTEXFORMAT_UBYTE4N: return WGPUVertexFormat_UChar4Norm; - case SG_VERTEXFORMAT_SHORT2: return WGPUVertexFormat_Short2; - case SG_VERTEXFORMAT_SHORT2N: return WGPUVertexFormat_Short2Norm; - case SG_VERTEXFORMAT_USHORT2N: return WGPUVertexFormat_UShort2Norm; - case SG_VERTEXFORMAT_SHORT4: return WGPUVertexFormat_Short4; - case SG_VERTEXFORMAT_SHORT4N: return WGPUVertexFormat_Short4Norm; - case SG_VERTEXFORMAT_USHORT4N: return WGPUVertexFormat_UShort4Norm; - case SG_VERTEXFORMAT_HALF2: return WGPUVertexFormat_Half2; - case SG_VERTEXFORMAT_HALF3: return WGPUVertexFormat_Half4; + case SG_VERTEXFORMAT_FLOAT: return WGPUVertexFormat_Float32; + case SG_VERTEXFORMAT_FLOAT2: return WGPUVertexFormat_Float32x2; + case SG_VERTEXFORMAT_FLOAT3: return WGPUVertexFormat_Float32x3; + case SG_VERTEXFORMAT_FLOAT4: return WGPUVertexFormat_Float32x4; + case SG_VERTEXFORMAT_BYTE4: return WGPUVertexFormat_Sint8x4; + case SG_VERTEXFORMAT_BYTE4N: return WGPUVertexFormat_Snorm8x4; + case SG_VERTEXFORMAT_UBYTE4: return WGPUVertexFormat_Uint8x4; + case SG_VERTEXFORMAT_UBYTE4N: return WGPUVertexFormat_Unorm8x4; + case SG_VERTEXFORMAT_SHORT2: return WGPUVertexFormat_Sint16x2; + case SG_VERTEXFORMAT_SHORT2N: return WGPUVertexFormat_Snorm16x2; + case SG_VERTEXFORMAT_USHORT2N: return WGPUVertexFormat_Uint16x2; + case SG_VERTEXFORMAT_SHORT4: return WGPUVertexFormat_Sint16x4; + case SG_VERTEXFORMAT_SHORT4N: return WGPUVertexFormat_Snorm16x4; + case SG_VERTEXFORMAT_USHORT4N: return WGPUVertexFormat_Unorm16x4; + case SG_VERTEXFORMAT_HALF2: return WGPUVertexFormat_Float16x2; + case SG_VERTEXFORMAT_HALF4: return WGPUVertexFormat_Float16x4; // FIXME! UINT10_N2 case SG_VERTEXFORMAT_UINT10_N2: default: @@ -12129,7 +12121,7 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RGBA8SI: return WGPUTextureFormat_RGBA8Sint; case SG_PIXELFORMAT_BGRA8: return WGPUTextureFormat_BGRA8Unorm; case SG_PIXELFORMAT_RGB10A2: return WGPUTextureFormat_RGB10A2Unorm; - case SG_PIXELFORMAT_RG11B10F: return WGPUTextureFormat_RG11B10Float; + case SG_PIXELFORMAT_RG11B10F: return WGPUTextureFormat_RG11B10Ufloat; case SG_PIXELFORMAT_RG32UI: return WGPUTextureFormat_RG32Uint; case SG_PIXELFORMAT_RG32SI: return WGPUTextureFormat_RG32Sint; case SG_PIXELFORMAT_RG32F: return WGPUTextureFormat_RG32Float; @@ -12148,7 +12140,7 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_BC4_RSN: return WGPUTextureFormat_BC4RSnorm; case SG_PIXELFORMAT_BC5_RG: return WGPUTextureFormat_BC5RGUnorm; case SG_PIXELFORMAT_BC5_RGSN: return WGPUTextureFormat_BC5RGSnorm; - case SG_PIXELFORMAT_BC6H_RGBF: return WGPUTextureFormat_BC6HRGBSfloat; + case SG_PIXELFORMAT_BC6H_RGBF: return WGPUTextureFormat_BC6HRGBFloat; case SG_PIXELFORMAT_BC6H_RGBUF: return WGPUTextureFormat_BC6HRGBUfloat; case SG_PIXELFORMAT_BC7_RGBA: return WGPUTextureFormat_BC7RGBAUnorm; @@ -12176,18 +12168,6 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { } } -/* -FIXME ??? this isn't needed anywhere? -_SOKOL_PRIVATE WGPUTextureAspect _sg_wgpu_texture_aspect(sg_pixel_format fmt) { - if (_sg_is_valid_rendertarget_depth_format(fmt)) { - if (!_sg_is_depth_stencil_format(fmt)) { - return WGPUTextureAspect_DepthOnly; - } - } - return WGPUTextureAspect_All; -} -*/ - _SOKOL_PRIVATE WGPUCompareFunction _sg_wgpu_comparefunc(sg_compare_func f) { switch (f) { case SG_COMPAREFUNC_NEVER: return WGPUCompareFunction_Never; @@ -12229,20 +12209,20 @@ _SOKOL_PRIVATE WGPUBlendFactor _sg_wgpu_blendfactor(sg_blend_factor f) { switch (f) { case SG_BLENDFACTOR_ZERO: return WGPUBlendFactor_Zero; case SG_BLENDFACTOR_ONE: return WGPUBlendFactor_One; - case SG_BLENDFACTOR_SRC_COLOR: return WGPUBlendFactor_SrcColor; - case SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return WGPUBlendFactor_OneMinusSrcColor; + case SG_BLENDFACTOR_SRC_COLOR: return WGPUBlendFactor_Src; + case SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return WGPUBlendFactor_OneMinusSrc; case SG_BLENDFACTOR_SRC_ALPHA: return WGPUBlendFactor_SrcAlpha; case SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: return WGPUBlendFactor_OneMinusSrcAlpha; - case SG_BLENDFACTOR_DST_COLOR: return WGPUBlendFactor_DstColor; - case SG_BLENDFACTOR_ONE_MINUS_DST_COLOR: return WGPUBlendFactor_OneMinusDstColor; + case SG_BLENDFACTOR_DST_COLOR: return WGPUBlendFactor_Dst; + case SG_BLENDFACTOR_ONE_MINUS_DST_COLOR: return WGPUBlendFactor_OneMinusDst; case SG_BLENDFACTOR_DST_ALPHA: return WGPUBlendFactor_DstAlpha; case SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return WGPUBlendFactor_OneMinusDstAlpha; case SG_BLENDFACTOR_SRC_ALPHA_SATURATED: return WGPUBlendFactor_SrcAlphaSaturated; - case SG_BLENDFACTOR_BLEND_COLOR: return WGPUBlendFactor_BlendColor; - case SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR: return WGPUBlendFactor_OneMinusBlendColor; + case SG_BLENDFACTOR_BLEND_COLOR: return WGPUBlendFactor_Constant; + case SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR: return WGPUBlendFactor_OneMinusConstant; // FIXME: separate blend alpha value not supported? - case SG_BLENDFACTOR_BLEND_ALPHA: return WGPUBlendFactor_BlendColor; - case SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA: return WGPUBlendFactor_OneMinusBlendColor; + case SG_BLENDFACTOR_BLEND_ALPHA: return WGPUBlendFactor_Constant; + case SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA: return WGPUBlendFactor_OneMinusConstant; default: SOKOL_UNREACHABLE; return WGPUBlendFactor_Force32; } From 2083a4b25e1055e3802a3787ba2962306f44fba7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 30 Jul 2023 23:22:22 +0200 Subject: [PATCH 123/292] sokol_gfx.h: wgpu update wip --- sokol_gfx.h | 249 ++++++++-------------------------------------------- 1 file changed, 38 insertions(+), 211 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 4a31de7fe..e283564e5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2902,6 +2902,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND, "fragment shader entry not found (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ + _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "failed to map uniform buffer (wgpu)") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ @@ -4898,7 +4899,6 @@ typedef struct { bool use_indexed_draw; int cur_width; int cur_height; - WGPUQueue queue; WGPUCommandEncoder render_cmd_enc; WGPUCommandEncoder staging_cmd_enc; WGPURenderPassEncoder pass_enc; @@ -12326,13 +12326,11 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { buffer, but this isn't currently allowed in Dawn. */ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { - - /* Add the max-uniform-update size (64 KB) to the requested buffer size, - this is to prevent validation errors in the WebGPU implementation - if the entire buffer size is used per frame. 64 KB is the allowed - max uniform update size on NVIDIA - */ - _sg.wgpu.ub.num_bytes = desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE; + // Add the max-uniform-update size (64 KB) to the requested buffer size, + // this is to prevent validation errors in the WebGPU implementation + // if the entire buffer size is used per frame. 64 KB is the allowed + // max uniform update size on NVIDIA + _sg.wgpu.ub.num_bytes = (uint32_t)desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE; WGPUBufferDescriptor ub_desc; _sg_clear(&ub_desc, sizeof(ub_desc)); @@ -12341,42 +12339,42 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { _sg.wgpu.ub.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &ub_desc); SOKOL_ASSERT(_sg.wgpu.ub.buf); - WGPUBindGroupLayoutBinding ub_bglb_desc[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; - _sg_clear(ub_bglb_desc, sizeof(ub_bglb_desc)); - for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { + WGPUBindGroupLayoutEntry ub_bgle_desc[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; + _sg_clear(ub_bgle_desc, sizeof(ub_bgle_desc)); + for (uint32_t stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { WGPUShaderStage vis = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; - for (int ub_index = 0; ub_index < SG_MAX_SHADERSTAGE_UBS; ub_index++) { - int bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; - ub_bglb_desc[stage_index][ub_index].binding = bind_index; - ub_bglb_desc[stage_index][ub_index].visibility = vis; - ub_bglb_desc[stage_index][ub_index].type = WGPUBindingType_UniformBuffer; - ub_bglb_desc[stage_index][ub_index].hasDynamicOffset = true; + for (uint32_t ub_index = 0; ub_index < SG_MAX_SHADERSTAGE_UBS; ub_index++) { + uint32_t bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; + ub_bgle_desc[stage_index][ub_index].binding = bind_index; + ub_bgle_desc[stage_index][ub_index].visibility = vis; + ub_bgle_desc[stage_index][ub_index].buffer.type = WGPUBufferBindingType_Uniform; + ub_bgle_desc[stage_index][ub_index].buffer.hasDynamicOffset = true; } } WGPUBindGroupLayoutDescriptor ub_bgl_desc; _sg_clear(&ub_bgl_desc, sizeof(ub_bgl_desc)); - ub_bgl_desc.bindingCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; - ub_bgl_desc.bindings = &ub_bglb_desc[0][0]; + ub_bgl_desc.entryCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; + ub_bgl_desc.entries = &ub_bgle_desc[0][0]; _sg.wgpu.ub.bindgroup_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &ub_bgl_desc); SOKOL_ASSERT(_sg.wgpu.ub.bindgroup_layout); - WGPUBindGroupBinding ub_bgb[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; - _sg_clear(ub_bgb, sizeof(ub_bgb)); - for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { - for (int ub_index = 0; ub_index < SG_MAX_SHADERSTAGE_UBS; ub_index++) { - int bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; - ub_bgb[stage_index][ub_index].binding = bind_index; - ub_bgb[stage_index][ub_index].buffer = _sg.wgpu.ub.buf; + WGPUBindGroupEntry ub_bge[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; + _sg_clear(ub_bge, sizeof(ub_bge)); + for (uint32_t stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { + for (uint32_t ub_index = 0; ub_index < SG_MAX_SHADERSTAGE_UBS; ub_index++) { + uint32_t bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; + ub_bge[stage_index][ub_index].binding = bind_index; + ub_bge[stage_index][ub_index].buffer = _sg.wgpu.ub.buf; // FIXME FIXME FIXME FIXME: HACK FOR VALIDATION BUG IN DAWN - ub_bgb[stage_index][ub_index].size = (1<<16); + // ub_bge[stage_index][ub_index].size = (1<<16); } } WGPUBindGroupDescriptor bg_desc; _sg_clear(&bg_desc, sizeof(bg_desc)); bg_desc.layout = _sg.wgpu.ub.bindgroup_layout; - bg_desc.bindingCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; - bg_desc.bindings = &ub_bgb[0][0]; + bg_desc.entryCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; + bg_desc.entries = &ub_bge[0][0]; _sg.wgpu.ub.bindgroup = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); SOKOL_ASSERT(_sg.wgpu.ub.bindgroup); } @@ -12403,7 +12401,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_discard(void) { } } -_SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus status, void* data, uint64_t data_len, void* user_data) { +_SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus status, void* user_data) { if (!_sg.wgpu.valid) { return; } @@ -12412,8 +12410,9 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus sta _SG_ERROR(WGPU_MAP_UNIFORM_BUFFER_FAILED); SOKOL_ASSERT(false); } - SOKOL_ASSERT(data && (data_len == _sg.wgpu.ub.num_bytes)); int index = (int)(intptr_t) user_data; + void* data = wgpuBufferGetMappedRange(_sg.wgpu.ub.stage.buf[index], 0, _sg.wgpu.ub.num_bytes); + SOKOL_ASSERT(data); SOKOL_ASSERT(index < _sg.wgpu.ub.stage.num); SOKOL_ASSERT(0 == _sg.wgpu.ub.stage.ptr[index]); _sg.wgpu.ub.stage.ptr[index] = (uint8_t*) data; @@ -12424,7 +12423,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { // immediately request a new mapping for the last frame's current staging buffer if (!first_frame) { WGPUBuffer ub_src = _sg.wgpu.ub.stage.buf[_sg.wgpu.ub.stage.cur]; - wgpuBufferMapWriteAsync(ub_src, _sg_wgpu_ubpool_mapped_callback, (void*)(intptr_t)_sg.wgpu.ub.stage.cur); + wgpuBufferMapAsync(ub_src, WGPUMapMode_Write, 0, 0, _sg_wgpu_ubpool_mapped_callback, (void*)(intptr_t)_sg.wgpu.ub.stage.cur); } // rewind per-frame offsets @@ -12446,14 +12445,13 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { WGPUBufferDescriptor desc; _sg_clear(&desc, sizeof(desc)); - desc.size = _sg.wgpu.ub.num_bytes; desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_MapWrite; - WGPUCreateBufferMappedResult res = wgpuDeviceCreateBufferMapped(_sg.wgpu.dev, &desc); - _sg.wgpu.ub.stage.buf[cur] = res.buffer; - _sg.wgpu.ub.stage.ptr[cur] = (uint8_t*) res.data; + desc.size = _sg.wgpu.ub.num_bytes; + desc.mappedAtCreation = true; + _sg.wgpu.ub.stage.buf[cur] = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &desc); + _sg.wgpu.ub.stage.ptr[cur] = wgpuBufferGetMappedRange(_sg.wgpu.ub.stage.buf[cur], 0, _sg.wgpu.ub.num_bytes); SOKOL_ASSERT(_sg.wgpu.ub.stage.buf[cur]); SOKOL_ASSERT(_sg.wgpu.ub.stage.ptr[cur]); - SOKOL_ASSERT(res.dataLength == _sg.wgpu.ub.num_bytes); } _SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { @@ -12469,6 +12467,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { } } +/* // helper function to compute number of bytes needed in staging buffer to copy image data _SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) { uint32_t num_bytes = 0; @@ -12484,9 +12483,6 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) return num_bytes; } -/* helper function to copy image data into a texture via a staging buffer, returns number of - bytes copied -*/ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* stg_base_ptr, uint32_t stg_base_offset, _sg_image_t* img, const sg_image_data* data) { SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); SOKOL_ASSERT(stg_buf && stg_base_ptr); @@ -12567,168 +12563,8 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* st SOKOL_ASSERT(stg_offset >= stg_base_offset); return (stg_offset - stg_base_offset); } - -/* - The WGPU staging buffer implementation: - - Very similar to the uniform buffer pool, there's a pool of big - per-frame staging buffers, each must be big enough to hold - all data uploaded to dynamic resources for one frame. - - Staging buffers are created on demand and reused, because the - 'frame pipeline depth' of WGPU isn't predictable. - - The difference to the uniform buffer system is that there isn't - a 1:1 relationship for source- and destination for the - data-copy operation. There's always one staging buffer as copy-source - per frame, but many copy-destinations (regular vertex/index buffers - or images). Instead of one big copy-operation at the end of the frame, - multiple copy-operations will be written throughout the frame. */ -_SOKOL_PRIVATE void _sg_wgpu_staging_init(const sg_desc* desc) { - SOKOL_ASSERT(desc && (desc->staging_buffer_size > 0)); - _sg.wgpu.staging.num_bytes = desc->staging_buffer_size; - // there's actually nothing more to do here -} - -_SOKOL_PRIVATE void _sg_wgpu_staging_discard(void) { - for (int i = 0; i < _sg.wgpu.staging.num; i++) { - if (_sg.wgpu.staging.buf[i]) { - wgpuBufferRelease(_sg.wgpu.staging.buf[i]); - _sg.wgpu.staging.buf[i] = 0; - _sg.wgpu.staging.ptr[i] = 0; - } - } -} - -_SOKOL_PRIVATE void _sg_wgpu_staging_mapped_callback(WGPUBufferMapAsyncStatus status, void* data, uint64_t data_len, void* user_data) { - if (!_sg.wgpu.valid) { - return; - } - // FIXME: better handling for this - if (WGPUBufferMapAsyncStatus_Success != status) { - SOKOL_ASSERT("Mapping staging buffer failed!\n"); - SOKOL_ASSERT(false); - } - SOKOL_ASSERT(data && (data_len == _sg.wgpu.staging.num_bytes)); - int index = (int)(intptr_t) user_data; - SOKOL_ASSERT(index < _sg.wgpu.staging.num); - SOKOL_ASSERT(0 == _sg.wgpu.staging.ptr[index]); - _sg.wgpu.staging.ptr[index] = (uint8_t*) data; -} - -_SOKOL_PRIVATE void _sg_wgpu_staging_next_frame(bool first_frame) { - - // immediately request a new mapping for the last frame's current staging buffer - if (!first_frame) { - WGPUBuffer cur_buf = _sg.wgpu.staging.buf[_sg.wgpu.staging.cur]; - wgpuBufferMapWriteAsync(cur_buf, _sg_wgpu_staging_mapped_callback, (void*)(intptr_t)_sg.wgpu.staging.cur); - } - - // rewind staging-buffer offset - _sg.wgpu.staging.offset = 0; - - // check if mapped staging buffer is available, otherwise create one - for (int i = 0; i < _sg.wgpu.staging.num; i++) { - if (_sg.wgpu.staging.ptr[i]) { - _sg.wgpu.staging.cur = i; - return; - } - } - - // no mapped buffer available, create one - SOKOL_ASSERT(_sg.wgpu.staging.num < _SG_WGPU_STAGING_PIPELINE_SIZE); - _sg.wgpu.staging.cur = _sg.wgpu.staging.num++; - const int cur = _sg.wgpu.staging.cur; - WGPUBufferDescriptor desc; - _sg_clear(&desc, sizeof(desc)); - desc.size = _sg.wgpu.staging.num_bytes; - desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_MapWrite; - WGPUCreateBufferMappedResult res = wgpuDeviceCreateBufferMapped(_sg.wgpu.dev, &desc); - _sg.wgpu.staging.buf[cur] = res.buffer; - _sg.wgpu.staging.ptr[cur] = (uint8_t*) res.data; - SOKOL_ASSERT(_sg.wgpu.staging.buf[cur]); - SOKOL_ASSERT(_sg.wgpu.staging.ptr[cur]); - SOKOL_ASSERT(res.dataLength == _sg.wgpu.staging.num_bytes); -} - -_SOKOL_PRIVATE uint32_t _sg_wgpu_staging_copy_to_buffer(WGPUBuffer dst_buf, uint32_t dst_buf_offset, const void* data, uint32_t data_num_bytes) { - /* Copy a chunk of data into the staging buffer, and record a blit-operation into - the command encoder, bump the offset for the next data chunk, return 0 if there - was not enough room in the staging buffer, return the number of actually - copied bytes on success. - - NOTE: that the number of staging bytes to be copied must be a multiple of 4. - - */ - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - SOKOL_ASSERT((dst_buf_offset & 3) == 0); - SOKOL_ASSERT(data_num_bytes > 0); - uint32_t copy_num_bytes = _sg_roundup(data_num_bytes, 4); - if ((_sg.wgpu.staging.offset + copy_num_bytes) >= _sg.wgpu.staging.num_bytes) { - _SG_ERROR(WGPU_STAGING_BUFFER_FULL_COPY_TO_BUFFER); - return false; - } - const int cur = _sg.wgpu.staging.cur; - SOKOL_ASSERT(_sg.wgpu.staging.ptr[cur]); - uint32_t stg_buf_offset = _sg.wgpu.staging.offset; - uint8_t* stg_ptr = _sg.wgpu.staging.ptr[cur] + stg_buf_offset; - memcpy(stg_ptr, data, data_num_bytes); - WGPUBuffer stg_buf = _sg.wgpu.staging.buf[cur]; - wgpuCommandEncoderCopyBufferToBuffer(_sg.wgpu.staging_cmd_enc, stg_buf, stg_buf_offset, dst_buf, dst_buf_offset, copy_num_bytes); - _sg.wgpu.staging.offset = stg_buf_offset + copy_num_bytes; - return copy_num_bytes; -} - -_SOKOL_PRIVATE bool _sg_wgpu_staging_copy_to_texture(_sg_image_t* img, const sg_image_data* data) { - // similar to _sg_wgpu_staging_copy_to_buffer(), but with image data instead - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - uint32_t num_bytes = _sg_wgpu_image_data_buffer_size(img); - if ((_sg.wgpu.staging.offset + num_bytes) >= _sg.wgpu.staging.num_bytes) { - _SG_ERROR(WGPU_STAGING_BUFFER_FULL_COPY_TO_TEXTURE); - return false; - } - const int cur = _sg.wgpu.staging.cur; - SOKOL_ASSERT(_sg.wgpu.staging.ptr[cur]); - uint32_t stg_offset = _sg.wgpu.staging.offset; - uint8_t* stg_ptr = _sg.wgpu.staging.ptr[cur]; - WGPUBuffer stg_buf = _sg.wgpu.staging.buf[cur]; - uint32_t bytes_copied = _sg_wgpu_copy_image_data(stg_buf, stg_ptr, stg_offset, img, data); - _SOKOL_UNUSED(bytes_copied); - SOKOL_ASSERT(bytes_copied == num_bytes); - _sg.wgpu.staging.offset = _sg_roundup(stg_offset + num_bytes, _SG_WGPU_STAGING_ALIGN); - return true; -} - -_SOKOL_PRIVATE void _sg_wgpu_staging_unmap(void) { - // called at end of frame before queue-submit - const int cur = _sg.wgpu.staging.cur; - SOKOL_ASSERT(_sg.wgpu.staging.ptr[cur]); - _sg.wgpu.staging.ptr[cur] = 0; - wgpuBufferUnmap(_sg.wgpu.staging.buf[cur]); -} - -_SOKOL_PRIVATE WGPUSampler _sg_wgpu_create_sampler(const sg_image_desc* img_desc) { - SOKOL_ASSERT(img_desc); - // create a new WGPU sampler - // FIXME: anisotropic filtering not supported? - WGPUSamplerDescriptor smp_desc; - _sg_clear(&smp_desc, sizeof(smp_desc)); - smp_desc.addressModeU = _sg_wgpu_sampler_addrmode(img_desc->wrap_u); - smp_desc.addressModeV = _sg_wgpu_sampler_addrmode(img_desc->wrap_v); - smp_desc.addressModeW = _sg_wgpu_sampler_addrmode(img_desc->wrap_w); - smp_desc.magFilter = _sg_wgpu_sampler_minmagfilter(img_desc->mag_filter); - smp_desc.minFilter = _sg_wgpu_sampler_minmagfilter(img_desc->min_filter); - smp_desc.mipmapFilter = _sg_wgpu_sampler_mipfilter(img_desc->min_filter); - smp_desc.lodMinClamp = img_desc->min_lod; - smp_desc.lodMaxClamp = img_desc->max_lod; - WGPUSampler smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &smp_desc); - SOKOL_ASSERT(smp); - return smp; -} - -//--- WGPU backend API functions --- _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.wgpu.device); @@ -12747,8 +12583,6 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.depth_stencil_view_cb = (WGPUTextureView(*)(void)) desc->context.wgpu.depth_stencil_view_cb; _sg.wgpu.depth_stencil_view_userdata_cb = (WGPUTextureView(*)(void*)) desc->context.wgpu.depth_stencil_view_userdata_cb; _sg.wgpu.user_data = desc->context.wgpu.user_data; - _sg.wgpu.queue = wgpuDeviceCreateQueue(_sg.wgpu.dev); - SOKOL_ASSERT(_sg.wgpu.queue); // setup WebGPU features and limits _sg_wgpu_init_caps(); @@ -12756,8 +12590,6 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { // setup the uniform and staging buffer pools _sg_wgpu_ubpool_init(desc); _sg_wgpu_ubpool_next_frame(true); - _sg_wgpu_staging_init(desc); - _sg_wgpu_staging_next_frame(true); // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -12786,20 +12618,15 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); _sg.wgpu.valid = false; _sg_wgpu_ubpool_discard(); - _sg_wgpu_staging_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; wgpuCommandEncoderRelease(_sg.wgpu.staging_cmd_enc); _sg.wgpu.staging_cmd_enc = 0; - if (_sg.wgpu.queue) { - wgpuQueueRelease(_sg.wgpu.queue); - _sg.wgpu.queue = 0; - } } _SOKOL_PRIVATE void _sg_wgpu_reset_state_cache(void) { - _SG_WARN(WGPU_RESET_STATE_CACHE_FIXME); + // FIXME } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_context(_sg_context_t* ctx) { @@ -12815,7 +12642,7 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_context(_sg_context_t* ctx) { _SOKOL_PRIVATE void _sg_wgpu_activate_context(_sg_context_t* ctx) { (void)ctx; - _SG_WARN(WGPU_ACTIVATE_CONTEXT_FIXME); + // FIXME } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { From fee8b6fa86bf6148f6cfe83875a0b0acb7ec2035 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 31 Jul 2023 20:39:20 +0200 Subject: [PATCH 124/292] sokol_gfx.h: wgpu update wip --- sokol_gfx.h | 227 +++++++++++++++++++++++++++------------------------- 1 file changed, 120 insertions(+), 107 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index e283564e5..37c4c3b07 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3119,7 +3119,6 @@ typedef enum sg_log_item { .pass_pool_size 16 .context_pool_size 16 .uniform_buffer_size 4 MB (4*1024*1024) - .staging_buffer_size 8 MB (8*1024*1024) .max_commit_listeners 1024 .disable_validation false @@ -3306,7 +3305,6 @@ typedef struct sg_desc { int pass_pool_size; int context_pool_size; int uniform_buffer_size; - int staging_buffer_size; int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests bool mtl_force_managed_storage_mode; // for debugging: use Metal managed storage mode for resources even with UMA @@ -4900,7 +4898,6 @@ typedef struct { int cur_width; int cur_height; WGPUCommandEncoder render_cmd_enc; - WGPUCommandEncoder staging_cmd_enc; WGPURenderPassEncoder pass_enc; WGPUBindGroup empty_bind_group; const _sg_pipeline_t* cur_pipeline; @@ -12572,7 +12569,6 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc->context.wgpu.resolve_view_cb || desc->context.wgpu.resolve_view_userdata_cb); SOKOL_ASSERT(desc->context.wgpu.depth_stencil_view_cb || desc->context.wgpu.depth_stencil_view_userdata_cb); SOKOL_ASSERT(desc->uniform_buffer_size > 0); - SOKOL_ASSERT(desc->staging_buffer_size > 0); _sg.backend = SG_BACKEND_WGPU; _sg.wgpu.valid = true; _sg.wgpu.dev = (WGPUDevice) desc->context.wgpu.device; @@ -12608,21 +12604,16 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); - _sg.wgpu.staging_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); } _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); _sg.wgpu.valid = false; _sg_wgpu_ubpool_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; - wgpuCommandEncoderRelease(_sg.wgpu.staging_cmd_enc); - _sg.wgpu.staging_cmd_enc = 0; } _SOKOL_PRIVATE void _sg_wgpu_reset_state_cache(void) { @@ -12647,6 +12638,7 @@ _SOKOL_PRIVATE void _sg_wgpu_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); +/* const bool injected = (0 != desc->wgpu_buffer); if (injected) { buf->wgpu.buf = (WGPUBuffer) desc->wgpu_buffer; @@ -12667,17 +12659,21 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const buf->wgpu.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &wgpu_buf_desc); } } +*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_buffer(_sg_buffer_t* buf) { SOKOL_ASSERT(buf); +/* WGPUBuffer wgpu_buf = buf->wgpu.buf; if (0 != wgpu_buf) { wgpuBufferRelease(wgpu_buf); } +*/ } +/* _SOKOL_PRIVATE void _sg_wgpu_init_texdesc_common(WGPUTextureDescriptor* wgpu_tex_desc, const sg_image_desc* desc) { wgpu_tex_desc->usage = WGPUTextureUsage_Sampled|WGPUTextureUsage_CopyDst; wgpu_tex_desc->dimension = _sg_wgpu_tex_dim(desc->type); @@ -12697,10 +12693,12 @@ _SOKOL_PRIVATE void _sg_wgpu_init_texdesc_common(WGPUTextureDescriptor* wgpu_tex wgpu_tex_desc->mipLevelCount = desc->num_mipmaps; wgpu_tex_desc->sampleCount = 1; } +*/ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); SOKOL_ASSERT(_sg.wgpu.dev); +/* SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); const bool injected = (0 != desc->wgpu_texture); @@ -12713,9 +12711,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s SOKOL_ASSERT(img->cmn.type == SG_IMAGETYPE_2D); SOKOL_ASSERT(img->cmn.num_mipmaps == 1); SOKOL_ASSERT(!injected); - /* NOTE: a depth-stencil texture will never be MSAA-resolved, so there - won't be a separate MSAA- and resolve-texture - */ wgpu_tex_desc.usage = WGPUTextureUsage_OutputAttachment; wgpu_tex_desc.sampleCount = desc->sample_count; img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); @@ -12725,9 +12720,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s img->wgpu.tex = (WGPUTexture) desc->wgpu_texture; wgpuTextureReference(img->wgpu.tex); } else { - /* NOTE: in the MSAA-rendertarget case, both the MSAA texture *and* - the resolve texture need OutputAttachment usage - */ if (img->cmn.render_target) { wgpu_tex_desc.usage = WGPUTextureUsage_Sampled|WGPUTextureUsage_OutputAttachment; } @@ -12756,10 +12748,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s wgpu_view_desc.dimension = _sg_wgpu_tex_viewdim(desc->type); img->wgpu.tex_view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_view_desc); - /* if render target and MSAA, then a separate texture in MSAA format is needed - which will be resolved into the regular texture at the end of the - offscreen-render pass - */ if (desc->render_target && is_msaa) { wgpu_tex_desc.dimension = WGPUTextureDimension_2D; wgpu_tex_desc.size.depth = 1; @@ -12775,11 +12763,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s img->wgpu.sampler = _sg_wgpu_create_sampler(desc); SOKOL_ASSERT(img->wgpu.sampler); } +*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { SOKOL_ASSERT(img); +/* if (img->wgpu.tex) { wgpuTextureRelease(img->wgpu.tex); img->wgpu.tex = 0; @@ -12794,6 +12784,19 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { } // NOTE: do *not* destroy the sampler from the shared-sampler-cache img->wgpu.sampler = 0; +*/ +} + +_SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { + SOKOL_ASSERT(smp && desc); + SOKOL_ASSERT(_sg.wgpu.dev); + // FIXME + return SG_RESOURCESTATE_VALID; +} + +_SOKOL_PRIVATE void _sg_wgpu_discard_sampler(_sg_sampler_t* smp) { + SOKOL_ASSERT(smp); + // FIXME } /* @@ -12828,6 +12831,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const SOKOL_ASSERT(desc->vs.bytecode.ptr && desc->fs.bytecode.ptr); bool success = true; +/* for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS) ? &desc->vs : &desc->fs; SOKOL_ASSERT((stage_desc->bytecode.size & 3) == 0); @@ -12875,11 +12879,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const wgpu_stage->bind_group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &img_bgl_desc); SOKOL_ASSERT(wgpu_stage->bind_group_layout); } +*/ return success ? SG_RESOURCESTATE_VALID : SG_RESOURCESTATE_FAILED; } _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd); +/* for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { _sg_wgpu_shader_stage_t* wgpu_stage = &shd->wgpu.stage[stage_index]; if (wgpu_stage->module) { @@ -12891,10 +12897,12 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { wgpu_stage->bind_group_layout = 0; } } +*/ } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && shd && desc); +/* SOKOL_ASSERT(desc->shader.id == shd->slot.id); SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout); SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout); @@ -12924,9 +12932,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ } vb_desc[vb_idx].arrayStride = src_vb_desc->stride; vb_desc[vb_idx].stepMode = _sg_wgpu_stepmode(src_vb_desc->step_func); - /* NOTE: WebGPU has no support for vertex step rate (because that's - not supported by Core Vulkan - */ int va_idx = 0; for (int va_loc = 0; va_loc < SG_MAX_VERTEX_ATTRIBUTES; va_loc++) { const sg_vertex_attr_desc* src_va_desc = &desc->layout.attrs[va_loc]; @@ -13012,12 +13017,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ pip->wgpu.pip = wgpuDeviceCreateRenderPipeline(_sg.wgpu.dev, &pip_desc); SOKOL_ASSERT(0 != pip->wgpu.pip); wgpuPipelineLayoutRelease(pip_layout); - +*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_pipeline(_sg_pipeline_t* pip) { SOKOL_ASSERT(pip); +/* if (pip == _sg.wgpu.cur_pipeline) { _sg.wgpu.cur_pipeline = 0; _Sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; @@ -13026,12 +13032,13 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_pipeline(_sg_pipeline_t* pip) { wgpuRenderPipelineRelease(pip->wgpu.pip); pip->wgpu.pip = 0; } +*/ } -_SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_image_t** att_images, const sg_pass_desc* desc) { +_SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_image_t** color_images, _sg_image_t** resolve_images, _sg_image_t* ds_img, const sg_pass_desc* desc) { SOKOL_ASSERT(pass && desc); - SOKOL_ASSERT(att_images && att_images[0]); - + SOKOL_ASSERT(color_images && resolve_images); +/* // copy image pointers and create render-texture views const sg_pass_attachment_desc* att_desc; for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { @@ -13083,11 +13090,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_imag pass->wgpu.ds_att.render_tex_view = wgpuTextureCreateView(wgpu_tex, &view_desc); SOKOL_ASSERT(pass->wgpu.ds_att.render_tex_view); } +*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_pass(_sg_pass_t* pass) { SOKOL_ASSERT(pass); +/* for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { if (pass->wgpu.color_atts[i].render_tex_view) { wgpuTextureViewRelease(pass->wgpu.color_atts[i].render_tex_view); @@ -13102,6 +13111,7 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_pass(_sg_pass_t* pass) { wgpuTextureViewRelease(pass->wgpu.ds_att.render_tex_view); pass->wgpu.ds_att.render_tex_view = 0; } +*/ } _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_color_image(const _sg_pass_t* pass, int index) { @@ -13110,12 +13120,41 @@ _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_color_image(const _sg_pass_t* pass, in return pass->wgpu.color_atts[index].image; } +_SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_resolve_image(const _sg_pass_t* pass, int index) { + SOKOL_ASSERT(pass && (index >= 0) && (index < SG_MAX_COLOR_ATTACHMENTS)); + // NOTE: may return null + return pass->wgpu.resolve_atts[index].image; +} + _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_ds_image(const _sg_pass_t* pass) { // NOTE: may return null SOKOL_ASSERT(pass); return pass->wgpu.ds_att.image; } +_SOKOL_PRIVATE void _sg_wgpu_init_color_att(WGPURenderPassColorAttachment* wgpu_att, const sg_color_attachment_action* action, WGPUTextureView color_view, WGPUTextureView resolve_view) { + wgpu_att->view = color_view; + wgpu_att->resolveTarget = resolve_view; + wgpu_att->loadOp = _sg_wgpu_load_op(action->load_action); + wgpu_att->storeOp = _sg_wgpu_store_op(action->store_action); + wgpu_att->clearValue.r = action->clear_value.r; + wgpu_att->clearValue.g = action->clear_value.g; + wgpu_att->clearValue.b = action->clear_value.b; + wgpu_att->clearValue.a = action->clear_value.a; +} + +_SOKOL_PRIVATE void _sg_wgpu_init_ds_att(WGPURenderPassDepthStencilAttachment* wgpu_att, const sg_pass_action* action, WGPUTextureView view) { + wgpu_att->view = view; + wgpu_att->depthLoadOp = _sg_wgpu_load_op(action->depth.load_action); + wgpu_att->depthStoreOp = _sg_wgpu_store_op(action->depth.store_action); + wgpu_att->depthClearValue = action->depth.clear_value; + wgpu_att->depthReadOnly = false; + wgpu_att->stencilLoadOp = _sg_wgpu_load_op(action->stencil.load_action); + wgpu_att->stencilStoreOp = _sg_wgpu_store_op(action->stencil.store_action); + wgpu_att->stencilClearValue = action->stencil.clear_value; + wgpu_att->stencilReadOnly = false; +} + _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* action, int w, int h) { SOKOL_ASSERT(action); SOKOL_ASSERT(!_sg.wgpu.in_pass); @@ -13131,68 +13170,36 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); + WGPURenderPassDescriptor wgpu_pass_desc; + WGPURenderPassColorAttachment wgpu_color_att[SG_MAX_COLOR_ATTACHMENTS]; + WGPURenderPassDepthStencilAttachment wgpu_ds_att; + _sg_clear(&wgpu_pass_desc, sizeof(wgpu_pass_desc)); + _sg_clear(&wgpu_color_att, sizeof(wgpu_color_att)); + _sg_clear(&wgpu_ds_att, sizeof(wgpu_ds_att)); if (pass) { - WGPURenderPassDescriptor wgpu_pass_desc; - _sg_clear(&wgpu_pass_desc, sizeof(wgpu_pass_desc)); - WGPURenderPassColorAttachmentDescriptor wgpu_color_att_desc[SG_MAX_COLOR_ATTACHMENTS]; - _sg_clear(&wgpu_color_att_desc, sizeof(wgpu_color_att_desc)); SOKOL_ASSERT(pass->slot.state == SG_RESOURCESTATE_VALID); - for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { - const _sg_wgpu_attachment_t* wgpu_att = &pass->wgpu.color_atts[i]; - wgpu_color_att_desc[i].loadOp = _sg_wgpu_load_op(action->colors[i].action); - wgpu_color_att_desc[i].storeOp = WGPUStoreOp_Store; - wgpu_color_att_desc[i].clearColor.r = action->colors[i].value.r; - wgpu_color_att_desc[i].clearColor.g = action->colors[i].value.g; - wgpu_color_att_desc[i].clearColor.b = action->colors[i].value.b; - wgpu_color_att_desc[i].clearColor.a = action->colors[i].value.a; - wgpu_color_att_desc[i].attachment = wgpu_att->render_tex_view; - if (wgpu_att->image->cmn.sample_count > 1) { - wgpu_color_att_desc[i].resolveTarget = wgpu_att->resolve_tex_view; - } + for (int i = 0; i < pass->cmn.num_color_atts; i++) { + _sg_wgpu_init_color_att(&wgpu_color_att[i], &action->colors[i], pass->wgpu.color_atts[i].view, pass->wgpu.resolve_atts[i].view); } - wgpu_pass_desc.colorAttachmentCount = pass->cmn.num_color_atts; - wgpu_pass_desc.colorAttachments = &wgpu_color_att_desc[0]; + wgpu_pass_desc.colorAttachmentCount = (size_t)pass->cmn.num_color_atts; + wgpu_pass_desc.colorAttachments = &wgpu_color_att[0]; if (pass->wgpu.ds_att.image) { - WGPURenderPassDepthStencilAttachmentDescriptor wgpu_ds_att_desc; - _sg_clear(&wgpu_ds_att_desc, sizeof(wgpu_ds_att_desc)); - wgpu_ds_att_desc.depthLoadOp = _sg_wgpu_load_op(action->depth.action); - wgpu_ds_att_desc.clearDepth = action->depth.value; - wgpu_ds_att_desc.stencilLoadOp = _sg_wgpu_load_op(action->stencil.action); - wgpu_ds_att_desc.clearStencil = action->stencil.value; - wgpu_ds_att_desc.attachment = pass->wgpu.ds_att.render_tex_view; - wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att_desc; - _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &wgpu_pass_desc); + _sg_wgpu_init_ds_att(&wgpu_ds_att, action, pass->wgpu.ds_att.view); + wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att; } } else { - // default render pass - WGPUTextureView wgpu_render_view = _sg.wgpu.render_view_cb ? _sg.wgpu.render_view_cb() : _sg.wgpu.render_view_userdata_cb(_sg.wgpu.user_data); + WGPUTextureView wgpu_color_view = _sg.wgpu.render_view_cb ? _sg.wgpu.render_view_cb() : _sg.wgpu.render_view_userdata_cb(_sg.wgpu.user_data); WGPUTextureView wgpu_resolve_view = _sg.wgpu.resolve_view_cb ? _sg.wgpu.resolve_view_cb() : _sg.wgpu.resolve_view_userdata_cb(_sg.wgpu.user_data); WGPUTextureView wgpu_depth_stencil_view = _sg.wgpu.depth_stencil_view_cb ? _sg.wgpu.depth_stencil_view_cb() : _sg.wgpu.depth_stencil_view_userdata_cb(_sg.wgpu.user_data); - - WGPURenderPassDescriptor pass_desc; - _sg_clear(&pass_desc, sizeof(pass_desc)); - WGPURenderPassColorAttachmentDescriptor color_att_desc; - _sg_clear(&color_att_desc, sizeof(color_att_desc)); - color_att_desc.loadOp = _sg_wgpu_load_op(action->colors[0].action); - color_att_desc.clearColor.r = action->colors[0].value.r; - color_att_desc.clearColor.g = action->colors[0].value.g; - color_att_desc.clearColor.b = action->colors[0].value.b; - color_att_desc.clearColor.a = action->colors[0].value.a; - color_att_desc.attachment = wgpu_render_view; - color_att_desc.resolveTarget = wgpu_resolve_view; // null if no MSAA rendering - pass_desc.colorAttachmentCount = 1; - pass_desc.colorAttachments = &color_att_desc; - WGPURenderPassDepthStencilAttachmentDescriptor ds_att_desc; - _sg_clear(&ds_att_desc, sizeof(ds_att_desc)); - ds_att_desc.attachment = wgpu_depth_stencil_view; - SOKOL_ASSERT(0 != ds_att_desc.attachment); - ds_att_desc.depthLoadOp = _sg_wgpu_load_op(action->depth.action); - ds_att_desc.clearDepth = action->depth.value; - ds_att_desc.stencilLoadOp = _sg_wgpu_load_op(action->stencil.action); - ds_att_desc.clearStencil = action->stencil.value; - pass_desc.depthStencilAttachment = &ds_att_desc; - _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &pass_desc); + _sg_wgpu_init_color_att(&wgpu_color_att[0], &action->colors[0], wgpu_color_view, wgpu_resolve_view); + wgpu_pass_desc.colorAttachmentCount = 1; + wgpu_pass_desc.colorAttachments = &wgpu_color_att[0]; + if (wgpu_depth_stencil_view) { + _sg_wgpu_init_ds_att(&wgpu_ds_att, action, wgpu_depth_stencil_view); + } + wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att; } + _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &wgpu_pass_desc); SOKOL_ASSERT(_sg.wgpu.pass_enc); // initial uniform buffer binding (required even if no uniforms are set in the frame) @@ -13207,49 +13214,38 @@ _SOKOL_PRIVATE void _sg_wgpu_end_pass(void) { SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); _sg.wgpu.in_pass = false; - wgpuRenderPassEncoderEndPass(_sg.wgpu.pass_enc); + wgpuRenderPassEncoderEnd(_sg.wgpu.pass_enc); wgpuRenderPassEncoderRelease(_sg.wgpu.pass_enc); _sg.wgpu.pass_enc = 0; } _SOKOL_PRIVATE void _sg_wgpu_commit(void) { SOKOL_ASSERT(!_sg.wgpu.in_pass); - SOKOL_ASSERT(_sg.wgpu.queue); SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); // finish and submit this frame's work _sg_wgpu_ubpool_flush(); - _sg_wgpu_staging_unmap(); - - WGPUCommandBuffer cmd_bufs[2]; WGPUCommandBufferDescriptor cmd_buf_desc; _sg_clear(&cmd_buf_desc, sizeof(cmd_buf_desc)); - cmd_bufs[0] = wgpuCommandEncoderFinish(_sg.wgpu.staging_cmd_enc, &cmd_buf_desc); - SOKOL_ASSERT(cmd_bufs[0]); - wgpuCommandEncoderRelease(_sg.wgpu.staging_cmd_enc); - _sg.wgpu.staging_cmd_enc = 0; - - cmd_bufs[1] = wgpuCommandEncoderFinish(_sg.wgpu.render_cmd_enc, &cmd_buf_desc); - SOKOL_ASSERT(cmd_bufs[1]); + WGPUCommandBuffer wgpu_cmd_buf = wgpuCommandEncoderFinish(_sg.wgpu.render_cmd_enc, &cmd_buf_desc); + SOKOL_ASSERT(wgpu_cmd_buf); wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; - wgpuQueueSubmit(_sg.wgpu.queue, 2, &cmd_bufs[0]); - - wgpuCommandBufferRelease(cmd_bufs[0]); - wgpuCommandBufferRelease(cmd_bufs[1]); + WGPUQueue wgpu_queue = wgpuDeviceGetQueue(_sg.wgpu.dev); + SOKOL_ASSERT(wgpu_queue); + wgpuQueueSubmit(wgpu_queue, 1, &wgpu_cmd_buf); + wgpuCommandBufferRelease(wgpu_cmd_buf); + wgpuQueueRelease(wgpu_queue); - // create a new render- and staging-command-encoders for next frame + // create a new render-command-encoder for next frame WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); - _sg.wgpu.staging_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); // grab new staging buffers for uniform- and vertex/image-updates _sg_wgpu_ubpool_next_frame(false); - _sg_wgpu_staging_next_frame(false); } _SOKOL_PRIVATE void _sg_wgpu_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { @@ -13281,13 +13277,14 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_scissor_rect(int x, int y, int w, int h, bool h = _sg_max(h, 1); uint32_t sx = (uint32_t) x; - uint32_t sy = origin_top_left ? y : (_sg.wgpu.cur_height - (y + h)); - uint32_t sw = w; - uint32_t sh = h; + uint32_t sy = (uint32_t) (origin_top_left ? y : (_sg.wgpu.cur_height - (y + h))); + uint32_t sw = (uint32_t) w; + uint32_t sh = (uint32_t) h; wgpuRenderPassEncoderSetScissorRect(_sg.wgpu.pass_enc, sx, sy, sw, sh); } _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { +/* SOKOL_ASSERT(pip); SOKOL_ASSERT(pip->wgpu.pip); SOKOL_ASSERT(_sg.wgpu.in_pass); @@ -13298,8 +13295,10 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { wgpuRenderPassEncoderSetPipeline(_sg.wgpu.pass_enc, pip->wgpu.pip); wgpuRenderPassEncoderSetBlendColor(_sg.wgpu.pass_enc, (WGPUColor*)&pip->cmn.blend_color); wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->wgpu.stencil_ref); +*/ } +/* _SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_images_bindgroup(WGPUBindGroupLayout bgl, _sg_image_t** imgs, int num_imgs) { SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(num_imgs <= _SG_WGPU_MAX_SHADERSTAGE_IMAGES); @@ -13322,15 +13321,19 @@ _SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_images_bindgroup(WGPUBindGroupLayou SOKOL_ASSERT(bg); return bg; } +*/ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs) + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(_sg.wgpu.in_pass); +/* SOKOL_ASSERT(_sg.wgpu.pass_enc); SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); @@ -13369,9 +13372,11 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( } else { wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 2, _sg.wgpu.empty_bind_group, 0, 0); } +*/ } _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { +/* SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); SOKOL_ASSERT((_sg.wgpu.ub.offset + data->size) <= _sg.wgpu.ub.num_bytes); @@ -13393,37 +13398,46 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.ub.bind_offsets[0][0]); _sg.wgpu.ub.offset = _sg_roundup(_sg.wgpu.ub.offset + data->size, _SG_WGPU_STAGING_ALIGN); +*/ } _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_instances) { SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - if (_sg.wgpu.draw_indexed) { - wgpuRenderPassEncoderDrawIndexed(_sg.wgpu.pass_enc, num_elements, num_instances, base_element, 0, 0); + SOKOL_ASSERT(_sg.wgpu.cur_pipeline && (_sg.wgpu.cur_pipeline->slot.id == _sg.wgpu.cur_pipeline_id.id)); + if (SG_INDEXTYPE_NONE != _sg.wgpu.cur_pipeline->cmn.index_type) { + wgpuRenderPassEncoderDrawIndexed(_sg.wgpu.pass_enc, (uint32_t)num_elements, (uint32_t)num_instances, (uint32_t)base_element, 0, 0); } else { - wgpuRenderPassEncoderDraw(_sg.wgpu.pass_enc, num_elements, num_instances, base_element, 0); + wgpuRenderPassEncoderDraw(_sg.wgpu.pass_enc, (uint32_t)num_elements, (uint32_t)num_instances, (uint32_t)base_element, 0); } } _SOKOL_PRIVATE void _sg_wgpu_update_buffer(_sg_buffer_t* buf, const sg_range* data) { +/* SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); uint32_t copied_num_bytes = _sg_wgpu_staging_copy_to_buffer(buf->wgpu.buf, 0, data->ptr, data->size); SOKOL_ASSERT(copied_num_bytes > 0); _SOKOL_UNUSED(copied_num_bytes); +*/ } _SOKOL_PRIVATE int _sg_wgpu_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +return 0; +/* SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); _SOKOL_UNUSED(new_frame); uint32_t copied_num_bytes = _sg_wgpu_staging_copy_to_buffer(buf->wgpu.buf, buf->cmn.append_pos, data->ptr, data->size); SOKOL_ASSERT(copied_num_bytes > 0); _SOKOL_UNUSED(copied_num_bytes); return (int)copied_num_bytes; +*/ } _SOKOL_PRIVATE void _sg_wgpu_update_image(_sg_image_t* img, const sg_image_data* data) { + /* SOKOL_ASSERT(img && data); bool success = _sg_wgpu_staging_copy_to_texture(img, data); SOKOL_ASSERT(success); _SOKOL_UNUSED(success); +*/ } #endif @@ -15742,7 +15756,6 @@ _SOKOL_PRIVATE sg_desc _sg_desc_defaults(const sg_desc* desc) { res.pass_pool_size = _sg_def(res.pass_pool_size, _SG_DEFAULT_PASS_POOL_SIZE); res.context_pool_size = _sg_def(res.context_pool_size, _SG_DEFAULT_CONTEXT_POOL_SIZE); res.uniform_buffer_size = _sg_def(res.uniform_buffer_size, _SG_DEFAULT_UB_SIZE); - res.staging_buffer_size = _sg_def(res.staging_buffer_size, _SG_DEFAULT_STAGING_SIZE); res.max_commit_listeners = _sg_def(res.max_commit_listeners, _SG_DEFAULT_MAX_COMMIT_LISTENERS); return res; } From d551b7a9d3efc67e92e820ad426eeaff0fd85bbd Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 1 Aug 2023 20:16:41 +0200 Subject: [PATCH 125/292] sokol_gfx.h: wgpu update wip --- sokol_gfx.h | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 37c4c3b07..5b59d6c4a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1649,6 +1649,7 @@ typedef enum sg_image_sample_type { SG_IMAGESAMPLETYPE_DEPTH, SG_IMAGESAMPLETYPE_SINT, SG_IMAGESAMPLETYPE_UINT, + SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT, _SG_IMAGESAMPLETYPE_NUM, _SG_IMAGESAMPLETYPE_FORCE_U32 = 0x7FFFFFFF } sg_image_sample_type; @@ -3609,6 +3610,9 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #import #elif defined(SOKOL_WGPU) #include + #if defined(__EMSCRIPTEN__) + #include + #endif #elif defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) #define _SOKOL_ANY_GL (1) @@ -4878,8 +4882,8 @@ typedef struct { int num; int cur; WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; // CPU-side staging buffers - uint8_t* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // if != 0, staging buffer currently mapped - } stage; + void* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // non-null if currently mapped + } staging; } _sg_wgpu_ubpool_t; // the WGPU backend state @@ -11981,6 +11985,7 @@ _SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_tex_sample_type(sg_image_sample_ty case SG_IMAGESAMPLETYPE_DEPTH: return WGPUTextureSampleType_Depth; case SG_IMAGESAMPLETYPE_SINT: return WGPUTextureSampleType_Sint; case SG_IMAGESAMPLETYPE_UINT: return WGPUTextureSampleType_Uint; + case SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT: return WGPUTextureSampleType_UnfilterableFloat; default: SOKOL_UNREACHABLE; return WGPUTextureSampleType_Force32; } } @@ -12254,7 +12259,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.limits.max_image_size_cube = 8 * 1024; _sg.limits.max_image_size_3d = 2 * 1024; _sg.limits.max_image_size_array = 8 * 1024; - _sg.limits.max_image_array_layers = 2 * 1024; + _sg.limits.max_image_array_layers = 256; _sg.limits.max_vertex_attrs = SG_MAX_VERTEX_ATTRIBUTES; _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); @@ -12270,7 +12275,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG8SI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32UI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32SI]); - _sg_pixelformat_sbr(&_sg.formats[SG_PIXELFORMAT_R32F]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32F]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG16UI]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG16SI]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG16F]); @@ -12283,7 +12288,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { // FIXME: missing SG_PIXELFORMAT_RG11B10F _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32UI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32SI]); - _sg_pixelformat_sbr(&_sg.formats[SG_PIXELFORMAT_RG32F]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32F]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA16UI]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA16SI]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA16F]); @@ -12327,7 +12332,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { // this is to prevent validation errors in the WebGPU implementation // if the entire buffer size is used per frame. 64 KB is the allowed // max uniform update size on NVIDIA - _sg.wgpu.ub.num_bytes = (uint32_t)desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE; + _sg.wgpu.ub.num_bytes = (uint32_t)(desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); WGPUBufferDescriptor ub_desc; _sg_clear(&ub_desc, sizeof(ub_desc)); @@ -12363,8 +12368,7 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { uint32_t bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; ub_bge[stage_index][ub_index].binding = bind_index; ub_bge[stage_index][ub_index].buffer = _sg.wgpu.ub.buf; - // FIXME FIXME FIXME FIXME: HACK FOR VALIDATION BUG IN DAWN - // ub_bge[stage_index][ub_index].size = (1<<16); + ub_bge[stage_index][ub_index].size = _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE; } } WGPUBindGroupDescriptor bg_desc; @@ -12389,11 +12393,11 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_discard(void) { wgpuBindGroupLayoutRelease(_sg.wgpu.ub.bindgroup_layout); _sg.wgpu.ub.bindgroup_layout = 0; } - for (int i = 0; i < _sg.wgpu.ub.stage.num; i++) { - if (_sg.wgpu.ub.stage.buf[i]) { - wgpuBufferRelease(_sg.wgpu.ub.stage.buf[i]); - _sg.wgpu.ub.stage.buf[i] = 0; - _sg.wgpu.ub.stage.ptr[i] = 0; + for (int i = 0; i < _sg.wgpu.ub.staging.num; i++) { + if (_sg.wgpu.ub.staging.buf[i]) { + wgpuBufferRelease(_sg.wgpu.ub.staging.buf[i]); + _sg.wgpu.ub.staging.buf[i] = 0; + _sg.wgpu.ub.staging.ptr[i] = 0; } } } @@ -12407,20 +12411,27 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus sta _SG_ERROR(WGPU_MAP_UNIFORM_BUFFER_FAILED); SOKOL_ASSERT(false); } - int index = (int)(intptr_t) user_data; - void* data = wgpuBufferGetMappedRange(_sg.wgpu.ub.stage.buf[index], 0, _sg.wgpu.ub.num_bytes); - SOKOL_ASSERT(data); - SOKOL_ASSERT(index < _sg.wgpu.ub.stage.num); - SOKOL_ASSERT(0 == _sg.wgpu.ub.stage.ptr[index]); - _sg.wgpu.ub.stage.ptr[index] = (uint8_t*) data; + const int staging_index = (int)(intptr_t) user_data; + SOKOL_ASSERT(staging_index < _sg.wgpu.ub.staging.num); + SOKOL_ASSERT(0 == _sg.wgpu.ub.staging.ptr[staging_index]); + _sg.wgpu.ub.staging.ptr[staging_index] = (uint8_t*) wgpuBufferGetMappedRange(_sg.wgpu.ub.staging.buf[staging_index], 0, _sg.wgpu.ub.num_bytes); + SOKOL_ASSERT(0 != _sg.wgpu.ub.staging.ptr[staging_index]); } _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { // immediately request a new mapping for the last frame's current staging buffer if (!first_frame) { - WGPUBuffer ub_src = _sg.wgpu.ub.stage.buf[_sg.wgpu.ub.stage.cur]; - wgpuBufferMapAsync(ub_src, WGPUMapMode_Write, 0, 0, _sg_wgpu_ubpool_mapped_callback, (void*)(intptr_t)_sg.wgpu.ub.stage.cur); + WGPUBuffer ub_src = _sg.wgpu.ub.staging.buf[_sg.wgpu.ub.staging.cur]; + SOKOL_ASSERT(ub_src); + wgpuBufferMapAsync( + ub_src, // buffer + WGPUMapMode_Write, // mode + 0, // offset + _sg.wgpu.ub.num_bytes, // size + _sg_wgpu_ubpool_mapped_callback, // callback + (void*)(intptr_t)_sg.wgpu.ub.staging.cur // usedata + ); } // rewind per-frame offsets @@ -12428,38 +12439,38 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { _sg_clear(&_sg.wgpu.ub.bind_offsets, sizeof(_sg.wgpu.ub.bind_offsets)); // check if a mapped staging buffer is available, otherwise create one - for (int i = 0; i < _sg.wgpu.ub.stage.num; i++) { - if (_sg.wgpu.ub.stage.ptr[i]) { - _sg.wgpu.ub.stage.cur = i; + for (int i = 0; i < _sg.wgpu.ub.staging.num; i++) { + if (_sg.wgpu.ub.staging.ptr[i]) { + _sg.wgpu.ub.staging.cur = i; return; } } // no mapped uniform buffer available, create one - SOKOL_ASSERT(_sg.wgpu.ub.stage.num < _SG_WGPU_STAGING_PIPELINE_SIZE); - _sg.wgpu.ub.stage.cur = _sg.wgpu.ub.stage.num++; - const int cur = _sg.wgpu.ub.stage.cur; + SOKOL_ASSERT(_sg.wgpu.ub.staging.num < _SG_WGPU_STAGING_PIPELINE_SIZE); + _sg.wgpu.ub.staging.cur = _sg.wgpu.ub.staging.num++; + const int cur = _sg.wgpu.ub.staging.cur; WGPUBufferDescriptor desc; _sg_clear(&desc, sizeof(desc)); - desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_MapWrite; desc.size = _sg.wgpu.ub.num_bytes; + desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_MapWrite; desc.mappedAtCreation = true; - _sg.wgpu.ub.stage.buf[cur] = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &desc); - _sg.wgpu.ub.stage.ptr[cur] = wgpuBufferGetMappedRange(_sg.wgpu.ub.stage.buf[cur], 0, _sg.wgpu.ub.num_bytes); - SOKOL_ASSERT(_sg.wgpu.ub.stage.buf[cur]); - SOKOL_ASSERT(_sg.wgpu.ub.stage.ptr[cur]); + _sg.wgpu.ub.staging.buf[cur] = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &desc); + _sg.wgpu.ub.staging.ptr[cur] = wgpuBufferGetMappedRange(_sg.wgpu.ub.staging.buf[cur], 0, _sg.wgpu.ub.num_bytes); + SOKOL_ASSERT(_sg.wgpu.ub.staging.buf[cur]); + SOKOL_ASSERT(_sg.wgpu.ub.staging.ptr[cur]); } _SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { // unmap staging buffer and copy to uniform buffer - const int cur = _sg.wgpu.ub.stage.cur; - SOKOL_ASSERT(_sg.wgpu.ub.stage.ptr[cur]); - _sg.wgpu.ub.stage.ptr[cur] = 0; - WGPUBuffer src_buf = _sg.wgpu.ub.stage.buf[cur]; + const int cur = _sg.wgpu.ub.staging.cur; + SOKOL_ASSERT(_sg.wgpu.ub.staging.ptr[cur]); + _sg.wgpu.ub.staging.ptr[cur] = 0; + WGPUBuffer src_buf = _sg.wgpu.ub.staging.buf[cur]; wgpuBufferUnmap(src_buf); if (_sg.wgpu.ub.offset > 0) { - WGPUBuffer dst_buf = _sg.wgpu.ub.buf; + const WGPUBuffer dst_buf = _sg.wgpu.ub.buf; wgpuCommandEncoderCopyBufferToBuffer(_sg.wgpu.render_cmd_enc, src_buf, 0, dst_buf, 0, _sg.wgpu.ub.offset); } } From ff67fdb6d6681c33889fc742fe9378c351124f41 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 2 Aug 2023 19:10:42 +0200 Subject: [PATCH 126/292] sokol_gfx wgpu: implement create/discard buffer --- sokol_gfx.h | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 5b59d6c4a..13a5c61a3 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2904,6 +2904,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "failed to map uniform buffer (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "failed to create buffer (wgpu)") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ @@ -5330,6 +5331,10 @@ _SOKOL_PRIVATE int _sg_roundup(int val, int round_to) { return (val+(round_to-1)) & ~(round_to-1); } +_SOKOL_PRIVATE uint64_t _sg_roundup_u64(uint64_t val, uint64_t round_to) { + return (val+(round_to-1)) & ~(round_to-1); +} + /* return row pitch for an image see ComputePitch in https://github.com/microsoft/DirectXTex/blob/master/DirectXTex/DirectXTexUtil.cpp @@ -12649,39 +12654,44 @@ _SOKOL_PRIVATE void _sg_wgpu_activate_context(_sg_context_t* ctx) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const sg_buffer_desc* desc) { SOKOL_ASSERT(buf && desc); -/* const bool injected = (0 != desc->wgpu_buffer); if (injected) { buf->wgpu.buf = (WGPUBuffer) desc->wgpu_buffer; wgpuBufferReference(buf->wgpu.buf); } else { + // buffer mapping size must be multiple of 4, so round up buffer size (only a problem + // with index buffers containing odd number of indices) + const uint64_t wgpu_buf_size = _sg_roundup_u64((uint64_t)buf->cmn.size, 4); + const bool map_at_creation = (SG_USAGE_IMMUTABLE == buf->cmn.usage); + WGPUBufferDescriptor wgpu_buf_desc; _sg_clear(&wgpu_buf_desc, sizeof(wgpu_buf_desc)); wgpu_buf_desc.usage = _sg_wgpu_buffer_usage(buf->cmn.type, buf->cmn.usage); - wgpu_buf_desc.size = buf->cmn.size; - if (SG_USAGE_IMMUTABLE == buf->cmn.usage) { - SOKOL_ASSERT(desc->data.ptr); - WGPUCreateBufferMappedResult res = wgpuDeviceCreateBufferMapped(_sg.wgpu.dev, &wgpu_buf_desc); - buf->wgpu.buf = res.buffer; - SOKOL_ASSERT(res.data && (res.dataLength == buf->cmn.size)); - memcpy(res.data, desc->data.ptr, buf->cmn.size); - wgpuBufferUnmap(res.buffer); - } else { - buf->wgpu.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &wgpu_buf_desc); + wgpu_buf_desc.size = wgpu_buf_size; + wgpu_buf_desc.mappedAtCreation = map_at_creation; + buf->wgpu.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &wgpu_buf_desc); + if (0 == buf->wgpu.buf) { + _SG_ERROR(WGPU_CREATE_BUFFER_FAILED); + return SG_RESOURCESTATE_FAILED; + } + if (map_at_creation) { + SOKOL_ASSERT(desc->data.ptr && (desc->data.size > 0)); + SOKOL_ASSERT(desc->data.size <= (size_t)buf->cmn.size); + // FIXME: inefficient on WASM + void* ptr = wgpuBufferGetMappedRange(buf->wgpu.buf, 0, wgpu_buf_size); + SOKOL_ASSERT(ptr); + memcpy(ptr, desc->data.ptr, desc->data.size); + wgpuBufferUnmap(buf->wgpu.buf); } } -*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_buffer(_sg_buffer_t* buf) { SOKOL_ASSERT(buf); -/* - WGPUBuffer wgpu_buf = buf->wgpu.buf; - if (0 != wgpu_buf) { - wgpuBufferRelease(wgpu_buf); + if (buf->wgpu.buf) { + wgpuBufferRelease(buf->wgpu.buf); } -*/ } /* From a05f17fe22339511c7875e1e98f77d5d1fbb4cf2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 2 Aug 2023 19:45:17 +0200 Subject: [PATCH 127/292] sokol_gfx wgpu: initialize limits from actual wgpu limits --- sokol_gfx.h | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 13a5c61a3..508213c96 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4902,6 +4902,8 @@ typedef struct { bool use_indexed_draw; int cur_width; int cur_height; + WGPUSupportedLimits limits; + WGPUQueue queue; WGPUCommandEncoder render_cmd_enc; WGPURenderPassEncoder pass_enc; WGPUBindGroup empty_bind_group; @@ -12259,12 +12261,15 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; - // FIXME: max images size??? - _sg.limits.max_image_size_2d = 8 * 1024; - _sg.limits.max_image_size_cube = 8 * 1024; - _sg.limits.max_image_size_3d = 2 * 1024; - _sg.limits.max_image_size_array = 8 * 1024; - _sg.limits.max_image_array_layers = 256; + bool success = wgpuDeviceGetLimits(_sg.wgpu.dev, &_sg.wgpu.limits); + SOKOL_ASSERT(success); + + const WGPULimits* l = &_sg.wgpu.limits.limits; + _sg.limits.max_image_size_2d = (int) l->maxTextureDimension2D; + _sg.limits.max_image_size_cube = (int) l->maxTextureDimension2D; // not a bug, see: https://github.com/gpuweb/gpuweb/issues/1327 + _sg.limits.max_image_size_3d = (int) l->maxTextureDimension3D; + _sg.limits.max_image_size_array = (int) l->maxTextureDimension2D; + _sg.limits.max_image_array_layers = (int) l->maxTextureArrayLayers; _sg.limits.max_vertex_attrs = SG_MAX_VERTEX_ATTRIBUTES; _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); @@ -12595,6 +12600,8 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.depth_stencil_view_cb = (WGPUTextureView(*)(void)) desc->context.wgpu.depth_stencil_view_cb; _sg.wgpu.depth_stencil_view_userdata_cb = (WGPUTextureView(*)(void*)) desc->context.wgpu.depth_stencil_view_userdata_cb; _sg.wgpu.user_data = desc->context.wgpu.user_data; + _sg.wgpu.queue = wgpuDeviceGetQueue(_sg.wgpu.dev); + SOKOL_ASSERT(_sg.wgpu.queue); // setup WebGPU features and limits _sg_wgpu_init_caps(); @@ -12627,9 +12634,10 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); _sg.wgpu.valid = false; _sg_wgpu_ubpool_discard(); - wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); - wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); - _sg.wgpu.render_cmd_enc = 0; + wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; + wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; + wgpuQueueRelease(_sg.wgpu.queue); _sg.wgpu.queue = 0; + } _SOKOL_PRIVATE void _sg_wgpu_reset_state_cache(void) { @@ -12669,6 +12677,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const wgpu_buf_desc.usage = _sg_wgpu_buffer_usage(buf->cmn.type, buf->cmn.usage); wgpu_buf_desc.size = wgpu_buf_size; wgpu_buf_desc.mappedAtCreation = map_at_creation; + wgpu_buf_desc.label = desc->label; buf->wgpu.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &wgpu_buf_desc); if (0 == buf->wgpu.buf) { _SG_ERROR(WGPU_CREATE_BUFFER_FAILED); @@ -12849,7 +12858,7 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_sampler(_sg_sampler_t* smp) { */ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); - SOKOL_ASSERT(desc->vs.bytecode.ptr && desc->fs.bytecode.ptr); + SOKOL_ASSERT(desc->vs.source && desc->fs.source); bool success = true; /* @@ -13254,11 +13263,8 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; - WGPUQueue wgpu_queue = wgpuDeviceGetQueue(_sg.wgpu.dev); - SOKOL_ASSERT(wgpu_queue); - wgpuQueueSubmit(wgpu_queue, 1, &wgpu_cmd_buf); + wgpuQueueSubmit(_sg.wgpu.queue, 1, &wgpu_cmd_buf); wgpuCommandBufferRelease(wgpu_cmd_buf); - wgpuQueueRelease(wgpu_queue); // create a new render-command-encoder for next frame WGPUCommandEncoderDescriptor cmd_enc_desc; @@ -14580,18 +14586,14 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { #if defined(SOKOL_D3D11) _SG_VALIDATE(0 != desc->attrs[0].sem_name, VALIDATE_SHADERDESC_ATTR_SEMANTICS); #endif - #if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) - // on GL, must provide shader source code + #if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) || defined(SOKOL_WGPU) + // on GL or WebGPU, must provide shader source code _SG_VALIDATE(0 != desc->vs.source, VALIDATE_SHADERDESC_SOURCE); _SG_VALIDATE(0 != desc->fs.source, VALIDATE_SHADERDESC_SOURCE); #elif defined(SOKOL_METAL) || defined(SOKOL_D3D11) // on Metal or D3D11, must provide shader source code or byte code _SG_VALIDATE((0 != desc->vs.source)||(0 != desc->vs.bytecode.ptr), VALIDATE_SHADERDESC_SOURCE_OR_BYTECODE); _SG_VALIDATE((0 != desc->fs.source)||(0 != desc->fs.bytecode.ptr), VALIDATE_SHADERDESC_SOURCE_OR_BYTECODE); - #elif defined(SOKOL_WGPU) - // on WGPU byte code must be provided - _SG_VALIDATE((0 != desc->vs.bytecode.ptr), VALIDATE_SHADERDESC_BYTECODE); - _SG_VALIDATE((0 != desc->fs.bytecode.ptr), VALIDATE_SHADERDESC_BYTECODE); #else // Dummy Backend, don't require source or bytecode #endif From 30824ccfc0b3054aad8ae3f903c3cd62752c88fe Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 3 Aug 2023 19:33:18 +0200 Subject: [PATCH 128/292] sokol_gfx wgpu: create shader module and bind group --- sokol_gfx.h | 110 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 42 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 508213c96..3ee670974 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2904,7 +2904,11 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "failed to map uniform buffer (wgpu)") \ - _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "failed to create buffer (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "wgpuDeviceCreateBuffer() failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_SHADER_MODULE_FAILED, "wgpuDeviceCreateShaderModule failed") \ + _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_IMAGES, "shader uses too many sampled images on shader stage (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_SAMPLERS, "shader uses too many samplers on shader stage (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED, "wgpuDeviceCreateBindGroupLayout for shader stage failed") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ @@ -11976,7 +11980,7 @@ _SOKOL_PRIVATE WGPUStoreOp _sg_wgpu_store_op(sg_store_action a) { } } -_SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_viewdim(sg_image_type t) { +_SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_view_dimension(sg_image_type t) { switch (t) { case SG_IMAGETYPE_2D: return WGPUTextureViewDimension_2D; case SG_IMAGETYPE_CUBE: return WGPUTextureViewDimension_Cube; @@ -12005,6 +12009,15 @@ _SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_tex_dim(sg_image_type t) { } } +_SOKOL_PRIVATE WGPUSamplerBindingType _sg_wgpu_sampler_binding_type(sg_sampler_type t) { + switch (t) { + // FIXME: NonFiltering + case SG_SAMPLERTYPE_SAMPLE: return WGPUSamplerBindingType_Filtering; + case SG_SAMPLERTYPE_COMPARE: return WGPUSamplerBindingType_Comparison; + default: SOKOL_UNREACHABLE; return WGPUSamplerBindingType_Force32; + } +} + _SOKOL_PRIVATE WGPUAddressMode _sg_wgpu_sampler_addrmode(sg_wrap m) { switch (m) { case SG_WRAP_REPEAT: @@ -12860,62 +12873,76 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const SOKOL_ASSERT(shd && desc); SOKOL_ASSERT(desc->vs.source && desc->fs.source); - bool success = true; -/* for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS) ? &desc->vs : &desc->fs; - SOKOL_ASSERT((stage_desc->bytecode.size & 3) == 0); _sg_shader_stage_t* cmn_stage = &shd->cmn.stage[stage_index]; _sg_wgpu_shader_stage_t* wgpu_stage = &shd->wgpu.stage[stage_index]; - _sg_strcpy(&wgpu_stage->entry, stage_desc->entry); + + WGPUShaderModuleWGSLDescriptor wgpu_shdmod_wgsl_desc; + _sg_clear(&wgpu_shdmod_wgsl_desc, sizeof(wgpu_shdmod_wgsl_desc)); + wgpu_shdmod_wgsl_desc.chain.sType = WGPUSType_ShaderModuleWGSLDescriptor; + wgpu_shdmod_wgsl_desc.code = stage_desc->source; + WGPUShaderModuleDescriptor wgpu_shdmod_desc; _sg_clear(&wgpu_shdmod_desc, sizeof(wgpu_shdmod_desc)); - wgpu_shdmod_desc.codeSize = stage_desc->bytecode.size >> 2; - wgpu_shdmod_desc.code = (const uint32_t*) stage_desc->bytecode.ptr; + wgpu_shdmod_desc.nextInChain = &wgpu_shdmod_wgsl_desc.chain; + wgpu_shdmod_desc.label = desc->label; + wgpu_stage->module = wgpuDeviceCreateShaderModule(_sg.wgpu.dev, &wgpu_shdmod_desc); if (0 == wgpu_stage->module) { - success = false; + _SG_ERROR(WGPU_CREATE_SHADER_MODULE_FAILED); + return SG_RESOURCESTATE_FAILED; } - // create image/sampler bind group for the shader stage - WGPUShaderStage vis = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; - int num_imgs = cmn_stage->num_images; - if (num_imgs > _SG_WGPU_MAX_SHADERSTAGE_IMAGES) { - num_imgs = _SG_WGPU_MAX_SHADERSTAGE_IMAGES; - } - WGPUBindGroupLayoutBinding bglb_desc[_SG_WGPU_MAX_SHADERSTAGE_IMAGES * 2]; - _sg_clear(bglb_desc, sizeof(bglb_desc)); - for (int img_index = 0; img_index < num_imgs; img_index++) { - // texture- and sampler-bindings - WGPUBindGroupLayoutBinding* tex_desc = &bglb_desc[img_index*2 + 0]; - WGPUBindGroupLayoutBinding* smp_desc = &bglb_desc[img_index*2 + 1]; - - tex_desc->binding = img_index; - tex_desc->visibility = vis; - tex_desc->type = WGPUBindingType_SampledTexture; - tex_desc->textureDimension = _sg_wgpu_tex_viewdim(cmn_stage->images[img_index].image_type); - tex_desc->textureComponentType = _sg_wgpu_tex_comptype(cmn_stage->images[img_index].sampler_type); - - smp_desc->binding = img_index + _SG_WGPU_MAX_SHADERSTAGE_IMAGES; - smp_desc->visibility = vis; - smp_desc->type = WGPUBindingType_Sampler; - } - WGPUBindGroupLayoutDescriptor img_bgl_desc; - _sg_clear(&img_bgl_desc, sizeof(img_bgl_desc)); - img_bgl_desc.bindingCount = num_imgs * 2; - img_bgl_desc.bindings = &bglb_desc[0]; - wgpu_stage->bind_group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &img_bgl_desc); - SOKOL_ASSERT(wgpu_stage->bind_group_layout); + // create image/sampler bind group + WGPUShaderStage wgpu_shader_stage = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; + const int num_images = cmn_stage->num_images; + if (num_images > (int)_sg.wgpu.limits.limits.maxSampledTexturesPerShaderStage) { + _SG_ERROR(WGPU_SHADER_TOO_MANY_IMAGES); + return SG_RESOURCESTATE_FAILED; + } + const int num_samplers = cmn_stage->num_samplers; + if (num_samplers > (int)_sg.wgpu.limits.limits.maxSamplersPerShaderStage) { + _SG_ERROR(WGPU_SHADER_TOO_MANY_SAMPLERS); + return SG_RESOURCESTATE_FAILED; + } + WGPUBindGroupLayoutEntry wgpu_bgl_entries[SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; + _sg_clear(wgpu_bgl_entries, sizeof(wgpu_bgl_entries)); + for (int img_index = 0; img_index < num_images; img_index++) { + const int bind_index = img_index; + WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bind_index]; + const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; + wgpu_bgl_entry->binding = (uint32_t)bind_index; + wgpu_bgl_entry->visibility = wgpu_shader_stage; + wgpu_bgl_entry->texture.viewDimension = _sg_wgpu_tex_view_dimension(img_desc->image_type); + wgpu_bgl_entry->texture.sampleType = _sg_wgpu_tex_sample_type(img_desc->sample_type); + wgpu_bgl_entry->texture.multisampled = img_desc->multisampled; + } + for (int smp_index = 0; smp_index < num_samplers; smp_index++) { + const int bind_index = smp_index; + WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bind_index]; + const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; + wgpu_bgl_entry->binding = (uint32_t)bind_index; + wgpu_bgl_entry->visibility = wgpu_shader_stage; + wgpu_bgl_entry->sampler.type = _sg_wgpu_sampler_binding_type(smp_desc->sampler_type); + } + WGPUBindGroupLayoutDescriptor wgpu_bgl_desc; + _sg_clear(&wgpu_bgl_desc, sizeof(wgpu_bgl_desc)); + wgpu_bgl_desc.entryCount = (size_t)(num_images + num_samplers); + wgpu_bgl_desc.entries = &wgpu_bgl_entries[0]; + wgpu_stage->bind_group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &wgpu_bgl_desc); + if (wgpu_stage->bind_group_layout == 0) { + _SG_ERROR(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED); + return SG_RESOURCESTATE_FAILED; + } } -*/ - return success ? SG_RESOURCESTATE_VALID : SG_RESOURCESTATE_FAILED; + return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd); -/* for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { _sg_wgpu_shader_stage_t* wgpu_stage = &shd->wgpu.stage[stage_index]; if (wgpu_stage->module) { @@ -12927,7 +12954,6 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { wgpu_stage->bind_group_layout = 0; } } -*/ } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { From 47d92ff86298fc96b3b84d93d0ee8c8533d3a2d2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 4 Aug 2023 19:21:58 +0200 Subject: [PATCH 129/292] gh actions: set zig version to 0.11.0 --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 9e372d4e4..c1c45d6dd 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -101,7 +101,7 @@ jobs: repository: floooh/sokol-zig - uses: goto-bus-stop/setup-zig@v2 with: - version: 0.11.0-dev.4004+a57608217 + version: 0.11.0 - uses: actions/download-artifact@v3 with: name: ignore-me-zig From ab4525377a92c29e9c8745527deccd4b0893235e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 7 Aug 2023 18:16:37 +0200 Subject: [PATCH 130/292] sokol_gfx wgpu: create/destroy render pipeline --- sokol_gfx.h | 232 +++++++++++++++++++++++++++------------------------- 1 file changed, 122 insertions(+), 110 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3ee670974..d2f42a84d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4798,6 +4798,7 @@ typedef struct { #define _SG_WGPU_ROWPITCH_ALIGN (256) #define _SG_WGPU_MAX_SHADERSTAGE_IMAGES (8) #define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) +#define _SG_WGPU_NUM_BINDGROUPS (3) // 1: uniforms, 2: vertex stage images & samplers, 3: fragment stage images & samplers typedef struct { _sg_slot_t slot; @@ -4848,7 +4849,7 @@ typedef struct { _sg_shader_t* shader; struct { WGPURenderPipeline pip; - uint32_t stencil_ref; + WGPUColor blend_color; } wgpu; } _sg_wgpu_pipeline_t; typedef _sg_wgpu_pipeline_t _sg_pipeline_t; @@ -12063,6 +12064,16 @@ _SOKOL_PRIVATE WGPUIndexFormat _sg_wgpu_indexformat(sg_index_type t) { return (t == SG_INDEXTYPE_UINT16) ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32; } +_SOKOL_PRIVATE WGPUIndexFormat _sg_wgpu_stripindexformat(sg_primitive_type prim_type, sg_index_type idx_type) { + if (idx_type == SG_INDEXTYPE_NONE) { + return WGPUIndexFormat_Undefined; + } else if ((prim_type == SG_PRIMITIVETYPE_LINE_STRIP) || (prim_type == SG_PRIMITIVETYPE_TRIANGLE_STRIP)) { + return _sg_wgpu_indexformat(idx_type); + } else { + return WGPUIndexFormat_Undefined; + } +} + _SOKOL_PRIVATE WGPUVertexStepMode _sg_wgpu_stepmode(sg_vertex_step s) { return (s == SG_VERTEXSTEP_PER_VERTEX) ? WGPUVertexStepMode_Vertex : WGPUVertexStepMode_Instance; } @@ -12958,137 +12969,140 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && shd && desc); -/* SOKOL_ASSERT(desc->shader.id == shd->slot.id); SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout); SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout); pip->shader = shd; - pip->wgpu.stencil_ref = (uint32_t) desc->stencil.ref; - WGPUBindGroupLayout pip_bgl[3] = { + pip->wgpu.blend_color.r = (double) desc->blend_color.r; + pip->wgpu.blend_color.g = (double) desc->blend_color.g; + pip->wgpu.blend_color.b = (double) desc->blend_color.b; + pip->wgpu.blend_color.a = (double) desc->blend_color.a; + + // - 1 bindgroup for uniform block, + // - 1 bindgroup for vertex shader resources + // - 1 bindgroup for fragment shader resources + WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS] = { _sg.wgpu.ub.bindgroup_layout, shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout, shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout }; - WGPUPipelineLayoutDescriptor pl_desc; - _sg_clear(&pl_desc, sizeof(pl_desc)); - pl_desc.bindGroupLayoutCount = 3; - pl_desc.bindGroupLayouts = &pip_bgl[0]; - WGPUPipelineLayout pip_layout = wgpuDeviceCreatePipelineLayout(_sg.wgpu.dev, &pl_desc); - - WGPUVertexBufferLayoutDescriptor vb_desc[SG_MAX_VERTEX_BUFFERS]; - _sg_clear(&vb_desc, sizeof(vb_desc)); - WGPUVertexAttributeDescriptor va_desc[SG_MAX_VERTEX_BUFFERS][SG_MAX_VERTEX_ATTRIBUTES]; - _sg_clear(&va_desc, sizeof(va_desc)); - int vb_idx = 0; - for (; vb_idx < SG_MAX_VERTEX_BUFFERS; vb_idx++) { - const sg_buffer_layout_desc* src_vb_desc = &desc->layout.buffers[vb_idx]; - if (0 == src_vb_desc->stride) { + WGPUPipelineLayoutDescriptor wgpu_pl_desc; + _sg_clear(&wgpu_pl_desc, sizeof(wgpu_pl_desc)); + wgpu_pl_desc.bindGroupLayoutCount = _SG_WGPU_NUM_BINDGROUPS; + wgpu_pl_desc.bindGroupLayouts = &wgpu_bgl[0]; + const WGPUPipelineLayout wgpu_pip_layout = wgpuDeviceCreatePipelineLayout(_sg.wgpu.dev, &wgpu_pl_desc); + SOKOL_ASSERT(wgpu_pip_layout); + + WGPUVertexBufferLayout wgpu_vb_layouts[SG_MAX_VERTEX_BUFFERS]; + _sg_clear(wgpu_vb_layouts, sizeof(wgpu_vb_layouts)); + WGPUVertexAttribute wgpu_vtx_attrs[SG_MAX_VERTEX_BUFFERS][SG_MAX_VERTEX_ATTRIBUTES]; + _sg_clear(wgpu_vtx_attrs, sizeof(wgpu_vtx_attrs)); + int wgpu_vb_num = 0; + for (int vb_idx = 0; vb_idx < SG_MAX_VERTEX_BUFFERS; vb_idx++, wgpu_vb_num++) { + const sg_vertex_buffer_layout_state* vbl_state = &desc->layout.buffers[vb_idx]; + if (0 == vbl_state->stride) { break; } - vb_desc[vb_idx].arrayStride = src_vb_desc->stride; - vb_desc[vb_idx].stepMode = _sg_wgpu_stepmode(src_vb_desc->step_func); - int va_idx = 0; - for (int va_loc = 0; va_loc < SG_MAX_VERTEX_ATTRIBUTES; va_loc++) { - const sg_vertex_attr_desc* src_va_desc = &desc->layout.attrs[va_loc]; - if (SG_VERTEXFORMAT_INVALID == src_va_desc->format) { - break; - } - pip->cmn.vertex_buffer_layout_active[src_va_desc->buffer_index] = true; - if (vb_idx == src_va_desc->buffer_index) { - va_desc[vb_idx][va_idx].format = _sg_wgpu_vertexformat(src_va_desc->format); - va_desc[vb_idx][va_idx].offset = src_va_desc->offset; - va_desc[vb_idx][va_idx].shaderLocation = va_loc; - va_idx++; - } - } - vb_desc[vb_idx].attributeCount = va_idx; - vb_desc[vb_idx].attributes = &va_desc[vb_idx][0]; + wgpu_vb_layouts[vb_idx].arrayStride = (uint64_t)vbl_state->stride; + wgpu_vb_layouts[vb_idx].stepMode = _sg_wgpu_stepmode(vbl_state->step_func); + wgpu_vb_layouts[vb_idx].attributes = &wgpu_vtx_attrs[vb_idx][0]; } - WGPUVertexStateDescriptor vx_state_desc; - _sg_clear(&vx_state_desc, sizeof(vx_state_desc)); - vx_state_desc.indexFormat = _sg_wgpu_indexformat(desc->index_type); - vx_state_desc.vertexBufferCount = vb_idx; - vx_state_desc.vertexBuffers = vb_desc; - - WGPURasterizationStateDescriptor rs_desc; - _sg_clear(&rs_desc, sizeof(rs_desc)); - rs_desc.frontFace = _sg_wgpu_frontface(desc->face_winding); - rs_desc.cullMode = _sg_wgpu_cullmode(desc->cull_mode); - rs_desc.depthBias = (int32_t) desc->depth.bias; - rs_desc.depthBiasClamp = desc->depth.bias_clamp; - rs_desc.depthBiasSlopeScale = desc->depth.bias_slope_scale; - - WGPUDepthStencilStateDescriptor ds_desc; - _sg_clear(&ds_desc, sizeof(ds_desc)); - ds_desc.format = _sg_wgpu_textureformat(desc->depth.pixel_format); - ds_desc.depthWriteEnabled = desc->depth.write_enabled; - ds_desc.depthCompare = _sg_wgpu_comparefunc(desc->depth.compare); - ds_desc.stencilReadMask = desc->stencil.read_mask; - ds_desc.stencilWriteMask = desc->stencil.write_mask; - ds_desc.stencilFront.compare = _sg_wgpu_comparefunc(desc->stencil.front.compare); - ds_desc.stencilFront.failOp = _sg_wgpu_stencilop(desc->stencil.front.fail_op); - ds_desc.stencilFront.depthFailOp = _sg_wgpu_stencilop(desc->stencil.front.depth_fail_op); - ds_desc.stencilFront.passOp = _sg_wgpu_stencilop(desc->stencil.front.pass_op); - ds_desc.stencilBack.compare = _sg_wgpu_comparefunc(desc->stencil.back.compare); - ds_desc.stencilBack.failOp = _sg_wgpu_stencilop(desc->stencil.back.fail_op); - ds_desc.stencilBack.depthFailOp = _sg_wgpu_stencilop(desc->stencil.back.depth_fail_op); - ds_desc.stencilBack.passOp = _sg_wgpu_stencilop(desc->stencil.back.pass_op); - - WGPUProgrammableStageDescriptor fs_desc; - _sg_clear(&fs_desc, sizeof(fs_desc)); - fs_desc.module = shd->wgpu.stage[SG_SHADERSTAGE_FS].module; - fs_desc.entryPoint = shd->wgpu.stage[SG_SHADERSTAGE_VS].entry.buf; - - WGPUColorStateDescriptor cs_desc[SG_MAX_COLOR_ATTACHMENTS]; - _sg_clear(cs_desc, sizeof(cs_desc)); - for (uint32_t i = 0; i < desc->color_count; i++) { - SOKOL_ASSERT(i < SG_MAX_COLOR_ATTACHMENTS); - cs_desc[i].format = _sg_wgpu_textureformat(desc->colors[i].pixel_format); - cs_desc[i].colorBlend.operation = _sg_wgpu_blendop(desc->colors[i].blend.op_rgb); - cs_desc[i].colorBlend.srcFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.src_factor_rgb); - cs_desc[i].colorBlend.dstFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.dst_factor_rgb); - cs_desc[i].alphaBlend.operation = _sg_wgpu_blendop(desc->colors[i].blend.op_alpha); - cs_desc[i].alphaBlend.srcFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.src_factor_alpha); - cs_desc[i].alphaBlend.dstFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.dst_factor_alpha); - cs_desc[i].writeMask = _sg_wgpu_colorwritemask(desc->colors[i].write_mask); - } - - WGPURenderPipelineDescriptor pip_desc; - _sg_clear(&pip_desc, sizeof(pip_desc)); - pip_desc.layout = pip_layout; - pip_desc.vertexStage.module = shd->wgpu.stage[SG_SHADERSTAGE_VS].module; - pip_desc.vertexStage.entryPoint = shd->wgpu.stage[SG_SHADERSTAGE_VS].entry.buf; - pip_desc.fragmentStage = &fs_desc; - pip_desc.vertexState = &vx_state_desc; - pip_desc.primitiveTopology = _sg_wgpu_topology(desc->primitive_type); - pip_desc.rasterizationState = &rs_desc; - pip_desc.sampleCount = desc->sample_count; + for (int va_idx = 0; va_idx < SG_MAX_VERTEX_ATTRIBUTES; va_idx++) { + const sg_vertex_attr_state* va_state = &desc->layout.attrs[va_idx]; + if (SG_VERTEXFORMAT_INVALID == va_state->format) { + break; + } + const int vb_idx = va_state->buffer_index; + SOKOL_ASSERT(vb_idx < SG_MAX_VERTEX_BUFFERS); + pip->cmn.vertex_buffer_layout_active[vb_idx] = true; + const uint32_t wgpu_attr_idx = wgpu_vb_layouts[vb_idx].attributeCount; + wgpu_vb_layouts[vb_idx].attributeCount += 1; + wgpu_vtx_attrs[vb_idx][wgpu_attr_idx].format = _sg_wgpu_vertexformat(va_state->format); + wgpu_vtx_attrs[vb_idx][wgpu_attr_idx].offset = (uint64_t)va_state->offset; + wgpu_vtx_attrs[vb_idx][wgpu_attr_idx].shaderLocation = (uint32_t)va_idx; + } + + WGPURenderPipelineDescriptor wgpu_pip_desc; + _sg_clear(&wgpu_pip_desc, sizeof(wgpu_pip_desc)); + wgpu_pip_desc.label = desc->label; + wgpu_pip_desc.layout = wgpu_pip_layout; + wgpu_pip_desc.vertex.module = shd->wgpu.stage[SG_SHADERSTAGE_VS].module; + wgpu_pip_desc.vertex.entryPoint = shd->wgpu.stage[SG_SHADERSTAGE_VS].entry.buf; + wgpu_pip_desc.vertex.bufferCount = (size_t)wgpu_vb_num; + wgpu_pip_desc.vertex.buffers = &wgpu_vb_layouts[0]; + wgpu_pip_desc.primitive.topology = _sg_wgpu_topology(desc->primitive_type); + wgpu_pip_desc.primitive.stripIndexFormat = _sg_wgpu_stripindexformat(desc->primitive_type, desc->index_type); + wgpu_pip_desc.primitive.frontFace = _sg_wgpu_frontface(desc->face_winding); + wgpu_pip_desc.primitive.cullMode = _sg_wgpu_cullmode(desc->cull_mode); if (SG_PIXELFORMAT_NONE != desc->depth.pixel_format) { - pip_desc.depthStencilState = &ds_desc; + WGPUDepthStencilState wgpu_ds_state; + _sg_clear(&wgpu_ds_state, sizeof(wgpu_ds_state)); + wgpu_ds_state.format = _sg_wgpu_textureformat(desc->depth.pixel_format); + wgpu_ds_state.depthWriteEnabled = desc->depth.write_enabled; + wgpu_ds_state.depthCompare = _sg_wgpu_comparefunc(desc->depth.compare); + wgpu_ds_state.stencilFront.compare = _sg_wgpu_comparefunc(desc->stencil.front.compare); + wgpu_ds_state.stencilFront.failOp = _sg_wgpu_stencilop(desc->stencil.front.fail_op); + wgpu_ds_state.stencilFront.depthFailOp = _sg_wgpu_stencilop(desc->stencil.front.depth_fail_op); + wgpu_ds_state.stencilFront.passOp = _sg_wgpu_stencilop(desc->stencil.front.pass_op); + wgpu_ds_state.stencilBack.compare = _sg_wgpu_comparefunc(desc->stencil.back.compare); + wgpu_ds_state.stencilBack.failOp = _sg_wgpu_stencilop(desc->stencil.back.fail_op); + wgpu_ds_state.stencilBack.depthFailOp = _sg_wgpu_stencilop(desc->stencil.back.depth_fail_op); + wgpu_ds_state.stencilBack.passOp = _sg_wgpu_stencilop(desc->stencil.back.pass_op); + wgpu_ds_state.stencilReadMask = desc->stencil.read_mask; + wgpu_ds_state.stencilWriteMask = desc->stencil.write_mask; + wgpu_ds_state.depthBias = (int32_t)desc->depth.bias; + wgpu_ds_state.depthBiasSlopeScale = desc->depth.bias_slope_scale; + wgpu_ds_state.depthBiasClamp = desc->depth.bias_clamp; + wgpu_pip_desc.depthStencil = &wgpu_ds_state; + } + wgpu_pip_desc.multisample.count = (uint32_t)desc->sample_count; + wgpu_pip_desc.multisample.mask = 0xFFFFFFFF; + wgpu_pip_desc.multisample.alphaToCoverageEnabled = desc->alpha_to_coverage_enabled; + if (desc->color_count > 0) { + WGPUFragmentState wgpu_frag_state; + _sg_clear(&wgpu_frag_state, sizeof(wgpu_frag_state)); + WGPUColorTargetState wgpu_ctgt_state[SG_MAX_COLOR_ATTACHMENTS]; + _sg_clear(&wgpu_ctgt_state, sizeof(wgpu_ctgt_state)); + WGPUBlendState wgpu_blend_state[SG_MAX_COLOR_ATTACHMENTS]; + _sg_clear(&wgpu_blend_state, sizeof(wgpu_blend_state)); + wgpu_frag_state.module = shd->wgpu.stage[SG_SHADERSTAGE_FS].module; + wgpu_frag_state.entryPoint = shd->wgpu.stage[SG_SHADERSTAGE_FS].entry.buf; + wgpu_frag_state.targetCount = (size_t)desc->color_count; + wgpu_frag_state.targets = &wgpu_ctgt_state[0]; + for (int i = 0; i < desc->color_count; i++) { + SOKOL_ASSERT(i < SG_MAX_COLOR_ATTACHMENTS); + wgpu_ctgt_state[i].format = _sg_wgpu_textureformat(desc->colors[i].pixel_format); + wgpu_ctgt_state[i].writeMask = _sg_wgpu_colorwritemask(desc->colors[i].write_mask); + if (desc->colors[i].blend.enabled) { + wgpu_ctgt_state[i].blend = &wgpu_blend_state[i]; + wgpu_blend_state[i].color.operation = _sg_wgpu_blendop(desc->colors[i].blend.op_rgb); + wgpu_blend_state[i].color.srcFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.src_factor_rgb); + wgpu_blend_state[i].color.dstFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.dst_factor_rgb); + wgpu_blend_state[i].alpha.operation = _sg_wgpu_blendop(desc->colors[i].blend.op_alpha); + wgpu_blend_state[i].alpha.srcFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.src_factor_alpha); + wgpu_blend_state[i].alpha.dstFactor = _sg_wgpu_blendfactor(desc->colors[i].blend.dst_factor_alpha); + } + } + wgpu_pip_desc.fragment = &wgpu_frag_state; } - pip_desc.colorStateCount = desc->color_count; - pip_desc.colorStates = cs_desc; - pip_desc.sampleMask = 0xFFFFFFFF; // FIXME: ??? - pip->wgpu.pip = wgpuDeviceCreateRenderPipeline(_sg.wgpu.dev, &pip_desc); + pip->wgpu.pip = wgpuDeviceCreateRenderPipeline(_sg.wgpu.dev, &wgpu_pip_desc); SOKOL_ASSERT(0 != pip->wgpu.pip); - wgpuPipelineLayoutRelease(pip_layout); -*/ + wgpuPipelineLayoutRelease(wgpu_pip_layout); + return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_pipeline(_sg_pipeline_t* pip) { SOKOL_ASSERT(pip); -/* if (pip == _sg.wgpu.cur_pipeline) { _sg.wgpu.cur_pipeline = 0; - _Sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; + _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; } if (pip->wgpu.pip) { wgpuRenderPipelineRelease(pip->wgpu.pip); pip->wgpu.pip = 0; } -*/ } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_image_t** color_images, _sg_image_t** resolve_images, _sg_image_t* ds_img, const sg_pass_desc* desc) { @@ -13337,18 +13351,16 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_scissor_rect(int x, int y, int w, int h, bool } _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { -/* SOKOL_ASSERT(pip); SOKOL_ASSERT(pip->wgpu.pip); SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - _sg.wgpu.draw_indexed = (pip->cmn.index_type != SG_INDEXTYPE_NONE); + _sg.wgpu.use_indexed_draw = (pip->cmn.index_type != SG_INDEXTYPE_NONE); _sg.wgpu.cur_pipeline = pip; _sg.wgpu.cur_pipeline_id.id = pip->slot.id; wgpuRenderPassEncoderSetPipeline(_sg.wgpu.pass_enc, pip->wgpu.pip); - wgpuRenderPassEncoderSetBlendColor(_sg.wgpu.pass_enc, (WGPUColor*)&pip->cmn.blend_color); - wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->wgpu.stencil_ref); -*/ + wgpuRenderPassEncoderSetBlendConstant(_sg.wgpu.pass_enc, &pip->wgpu.blend_color); + wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->cmn.stencil.ref); } /* From 3634c90068e487b14ffc1faeb38705a2cec9d946 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 12 Aug 2023 17:02:22 +0200 Subject: [PATCH 131/292] sokol_gfx wgpu: implement sg_apply_bindings() --- sokol_gfx.h | 101 +++++++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 44 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index d2f42a84d..2f369f8cc 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4796,9 +4796,12 @@ typedef struct { #define _SG_WGPU_STAGING_ALIGN (256) #define _SG_WGPU_STAGING_PIPELINE_SIZE (8) #define _SG_WGPU_ROWPITCH_ALIGN (256) -#define _SG_WGPU_MAX_SHADERSTAGE_IMAGES (8) #define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) -#define _SG_WGPU_NUM_BINDGROUPS (3) // 1: uniforms, 2: vertex stage images & samplers, 3: fragment stage images & samplers +#define _SG_WGPU_NUM_BINDGROUPS (3) // 0: uniforms, 1: vertex stage images & samplers, 2: fragment stage images & samplers +#define _SG_WGPU_UNIFORMS_BINDGROUP_INDEX (0) +#define _SG_WGPU_VS_BINDGROUP_INDEX (1) +#define _SG_WGPU_FS_BINDGROUP_INDEX (2) + typedef struct { _sg_slot_t slot; @@ -12907,7 +12910,9 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const return SG_RESOURCESTATE_FAILED; } - // create image/sampler bind group + // create image/sampler bind group layout: + // - first all images + // - followed by all samplers WGPUShaderStage wgpu_shader_stage = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; const int num_images = cmn_stage->num_images; if (num_images > (int)_sg.wgpu.limits.limits.maxSampledTexturesPerShaderStage) { @@ -12932,7 +12937,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const wgpu_bgl_entry->texture.multisampled = img_desc->multisampled; } for (int smp_index = 0; smp_index < num_samplers; smp_index++) { - const int bind_index = smp_index; + const int bind_index = num_images + smp_index; WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bind_index]; const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; wgpu_bgl_entry->binding = (uint32_t)bind_index; @@ -12982,11 +12987,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ // - 1 bindgroup for uniform block, // - 1 bindgroup for vertex shader resources // - 1 bindgroup for fragment shader resources - WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS] = { - _sg.wgpu.ub.bindgroup_layout, - shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout, - shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout - }; + WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS]; + wgpu_bgl[_SG_WGPU_UNIFORMS_BINDGROUP_INDEX] = _sg.wgpu.ub.bindgroup_layout; + wgpu_bgl[_SG_WGPU_VS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; + wgpu_bgl[_SG_WGPU_FS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout; WGPUPipelineLayoutDescriptor wgpu_pl_desc; _sg_clear(&wgpu_pl_desc, sizeof(wgpu_pl_desc)); wgpu_pl_desc.bindGroupLayoutCount = _SG_WGPU_NUM_BINDGROUPS; @@ -13363,30 +13367,38 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->cmn.stencil.ref); } -/* -_SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_images_bindgroup(WGPUBindGroupLayout bgl, _sg_image_t** imgs, int num_imgs) { +_SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_bindgroup( + WGPUBindGroupLayout bgl, + _sg_image_t** imgs, int num_imgs, + _sg_sampler_t** smps, int num_smps) +{ SOKOL_ASSERT(_sg.wgpu.dev); - SOKOL_ASSERT(num_imgs <= _SG_WGPU_MAX_SHADERSTAGE_IMAGES); - WGPUBindGroupBinding img_bgb[_SG_WGPU_MAX_SHADERSTAGE_IMAGES * 2]; - _sg_clear(&img_bgb, sizeof(img_bgb)); + SOKOL_ASSERT(imgs && (num_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); + SOKOL_ASSERT(smps && (num_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); + + WGPUBindGroupEntry wgpu_entries[SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; + _sg_clear(&wgpu_entries, sizeof(wgpu_entries)); for (int img_index = 0; img_index < num_imgs; img_index++) { - WGPUBindGroupBinding* tex_bdg = &img_bgb[img_index*2 + 0]; - WGPUBindGroupBinding* smp_bdg = &img_bgb[img_index*2 + 1]; - tex_bdg->binding = img_index; - tex_bdg->textureView = imgs[img_index]->wgpu.tex_view; - smp_bdg->binding = img_index + _SG_WGPU_MAX_SHADERSTAGE_IMAGES; - smp_bdg->sampler = imgs[img_index]->wgpu.sampler; + uint32_t wgpu_bind_index = (uint32_t)img_index; + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[wgpu_bind_index]; + wgpu_entry->binding = wgpu_bind_index; + wgpu_entry->textureView = imgs[img_index]->wgpu.view; + } + for (int smp_index = 0; smp_index < num_smps; smp_index++) { + uint32_t wgpu_bind_index = (uint32_t)(num_imgs + smp_index); + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[wgpu_bind_index]; + wgpu_entry->binding = wgpu_bind_index; + wgpu_entry->sampler = smps[smp_index]->wgpu.smp; } WGPUBindGroupDescriptor bg_desc; _sg_clear(&bg_desc, sizeof(bg_desc)); bg_desc.layout = bgl; - bg_desc.bindingCount = 2 * num_imgs; - bg_desc.bindings = &img_bgb[0]; + bg_desc.entryCount = (size_t)(num_imgs + num_smps); + bg_desc.entries = &wgpu_entries[0]; WGPUBindGroup bg = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); SOKOL_ASSERT(bg); return bg; } -*/ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( _sg_pipeline_t* pip, @@ -13398,46 +13410,47 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(_sg.wgpu.in_pass); -/* SOKOL_ASSERT(_sg.wgpu.pass_enc); SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); // index buffer if (ib) { - wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, ib_offset); + const WGPUIndexFormat format = _sg_wgpu_indexformat(pip->cmn.index_type); + const uint64_t buf_size = (uint64_t)ib->cmn.size; + const uint64_t offset = (uint64_t)ib_offset; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, format, offset, max_bytes); } // vertex buffers for (uint32_t slot = 0; slot < (uint32_t)num_vbs; slot++) { - wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, slot, vbs[slot]->wgpu.buf, (uint64_t)vb_offsets[slot]); + const uint64_t buf_size = (uint64_t)vbs[slot]->cmn.size; + const uint64_t offset = (uint64_t)vb_offsets[slot]; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, slot, vbs[slot]->wgpu.buf, offset, max_bytes); } - // need to create throw-away bind groups for images - if (num_vs_imgs > 0) { - if (num_vs_imgs > _SG_WGPU_MAX_SHADERSTAGE_IMAGES) { - num_vs_imgs = _SG_WGPU_MAX_SHADERSTAGE_IMAGES; - } + // FIXME: create adhoc bind group objects for images and samplers per stage + if ((num_vs_imgs + num_vs_smps) > 0) { WGPUBindGroupLayout vs_bgl = pip->shader->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; SOKOL_ASSERT(vs_bgl); - WGPUBindGroup vs_img_bg = _sg_wgpu_create_images_bindgroup(vs_bgl, vs_imgs, num_vs_imgs); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 1, vs_img_bg, 0, 0); - wgpuBindGroupRelease(vs_img_bg); + WGPUBindGroup vs_bg = _sg_wgpu_create_bindgroup(vs_bgl, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_VS_BINDGROUP_INDEX, vs_bg, 0, 0); + wgpuBindGroupRelease(vs_bg); } else { - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 1, _sg.wgpu.empty_bind_group, 0, 0); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_VS_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); } - if (num_fs_imgs > 0) { - if (num_fs_imgs > _SG_WGPU_MAX_SHADERSTAGE_IMAGES) { - num_fs_imgs = _SG_WGPU_MAX_SHADERSTAGE_IMAGES; - } + if ((num_fs_imgs + num_fs_smps) > 0) { WGPUBindGroupLayout fs_bgl = pip->shader->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout; SOKOL_ASSERT(fs_bgl); - WGPUBindGroup fs_img_bg = _sg_wgpu_create_images_bindgroup(fs_bgl, fs_imgs, num_fs_imgs); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 2, fs_img_bg, 0, 0); - wgpuBindGroupRelease(fs_img_bg); + WGPUBindGroup fs_bg = _sg_wgpu_create_bindgroup(fs_bgl, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_FS_BINDGROUP_INDEX, fs_bg, 0, 0); + wgpuBindGroupRelease(fs_bg); } else { - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 2, _sg.wgpu.empty_bind_group, 0, 0); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_FS_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); } -*/ } _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { From 893ba7b01082e4058c4b87e9c806f038bdd92b0c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 13 Aug 2023 15:19:29 +0200 Subject: [PATCH 132/292] sokol_gfx.h wgpu: code cleanup and remove uniform buffer conveyor belt --- sokol_gfx.h | 214 +++++++++++++++------------------------------------- 1 file changed, 62 insertions(+), 152 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 2f369f8cc..afd5cccf0 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4794,7 +4794,6 @@ typedef struct { #elif defined(SOKOL_WGPU) #define _SG_WGPU_STAGING_ALIGN (256) -#define _SG_WGPU_STAGING_PIPELINE_SIZE (8) #define _SG_WGPU_ROWPITCH_ALIGN (256) #define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) #define _SG_WGPU_NUM_BINDGROUPS (3) // 0: uniforms, 1: vertex stage images & samplers, 2: fragment stage images & samplers @@ -4881,19 +4880,15 @@ typedef _sg_wgpu_context_t _sg_context_t; // a pool of per-frame uniform buffers typedef struct { - WGPUBindGroupLayout bindgroup_layout; uint32_t num_bytes; - uint32_t offset; // current offset into current frame's mapped uniform buffer - uint32_t bind_offsets[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; + uint32_t offset; // current offset into buf WGPUBuffer buf; // the GPU-side uniform buffer - WGPUBindGroup bindgroup; struct { - int num; - int cur; - WGPUBuffer buf[_SG_WGPU_STAGING_PIPELINE_SIZE]; // CPU-side staging buffers - void* ptr[_SG_WGPU_STAGING_PIPELINE_SIZE]; // non-null if currently mapped - } staging; -} _sg_wgpu_ubpool_t; + WGPUBindGroupLayout group_layout; + WGPUBindGroup group; + uint32_t offsets[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; + } bind; +} _sg_wgpu_uniform_buffer_t; // the WGPU backend state typedef struct { @@ -4917,7 +4912,7 @@ typedef struct { WGPUBindGroup empty_bind_group; const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; - _sg_wgpu_ubpool_t ub; + _sg_wgpu_uniform_buffer_t uniform; } _sg_wgpu_backend_t; #endif @@ -11943,7 +11938,8 @@ _SOKOL_PRIVATE void _sg_mtl_update_image(_sg_image_t* img, const sg_image_data* // ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ // ███ ███ ███████ ██████ ██████ ██ ██████ ██████ ██ ██ ██████ ██ ██ ███████ ██ ████ ██████ // -// >>webgpu backend +// >>webgpu +// >>wgpu #elif defined(SOKOL_WGPU) _SOKOL_PRIVATE WGPUBufferUsageFlags _sg_wgpu_buffer_usage(sg_buffer_type t, sg_usage u) { @@ -11984,7 +11980,7 @@ _SOKOL_PRIVATE WGPUStoreOp _sg_wgpu_store_op(sg_store_action a) { } } -_SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_view_dimension(sg_image_type t) { +_SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_texture_view_dimension(sg_image_type t) { switch (t) { case SG_IMAGETYPE_2D: return WGPUTextureViewDimension_2D; case SG_IMAGETYPE_CUBE: return WGPUTextureViewDimension_Cube; @@ -11994,7 +11990,15 @@ _SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_tex_view_dimension(sg_image_typ } } -_SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_tex_sample_type(sg_image_sample_type t) { +_SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_texture_dim(sg_image_type t) { + if (SG_IMAGETYPE_3D == t) { + return WGPUTextureDimension_3D; + } else { + return WGPUTextureDimension_2D; + } +} + +_SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_texture_sample_type(sg_image_sample_type t) { switch (t) { case SG_IMAGESAMPLETYPE_FLOAT: return WGPUTextureSampleType_Float; case SG_IMAGESAMPLETYPE_DEPTH: return WGPUTextureSampleType_Depth; @@ -12005,14 +12009,6 @@ _SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_tex_sample_type(sg_image_sample_ty } } -_SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_tex_dim(sg_image_type t) { - if (SG_IMAGETYPE_3D == t) { - return WGPUTextureDimension_3D; - } else { - return WGPUTextureDimension_2D; - } -} - _SOKOL_PRIVATE WGPUSamplerBindingType _sg_wgpu_sampler_binding_type(sg_sampler_type t) { switch (t) { // FIXME: NonFiltering @@ -12037,7 +12033,7 @@ _SOKOL_PRIVATE WGPUAddressMode _sg_wgpu_sampler_addrmode(sg_wrap m) { } } -_SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmagfilter(sg_filter f) { +_SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmag_filter(sg_filter f) { switch (f) { case SG_FILTER_NEAREST: return WGPUFilterMode_Nearest; @@ -12350,33 +12346,21 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_RGBA]); } -/* - WGPU uniform buffer pool implementation: - - At start of frame, a mapped buffer is grabbed from the pool, - or a new buffer is created if there is no mapped buffer available. - - At end of frame, the current buffer is unmapped before queue submit, - and async-mapped immediately again. - - UNIFORM BUFFER FIXME: - - - As per WebGPU spec, it should be possible to create a Uniform|MapWrite - buffer, but this isn't currently allowed in Dawn. -*/ -_SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { +_SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { // Add the max-uniform-update size (64 KB) to the requested buffer size, // this is to prevent validation errors in the WebGPU implementation // if the entire buffer size is used per frame. 64 KB is the allowed // max uniform update size on NVIDIA - _sg.wgpu.ub.num_bytes = (uint32_t)(desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); + // + // FIXME: is this still needed? + _sg.wgpu.uniform.num_bytes = (uint32_t)(desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); WGPUBufferDescriptor ub_desc; _sg_clear(&ub_desc, sizeof(ub_desc)); - ub_desc.size = _sg.wgpu.ub.num_bytes; + ub_desc.size = _sg.wgpu.uniform.num_bytes; ub_desc.usage = WGPUBufferUsage_Uniform|WGPUBufferUsage_CopyDst; - _sg.wgpu.ub.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &ub_desc); - SOKOL_ASSERT(_sg.wgpu.ub.buf); + _sg.wgpu.uniform.buf = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &ub_desc); + SOKOL_ASSERT(_sg.wgpu.uniform.buf); WGPUBindGroupLayoutEntry ub_bgle_desc[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; _sg_clear(ub_bgle_desc, sizeof(ub_bgle_desc)); @@ -12395,8 +12379,8 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { _sg_clear(&ub_bgl_desc, sizeof(ub_bgl_desc)); ub_bgl_desc.entryCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; ub_bgl_desc.entries = &ub_bgle_desc[0][0]; - _sg.wgpu.ub.bindgroup_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &ub_bgl_desc); - SOKOL_ASSERT(_sg.wgpu.ub.bindgroup_layout); + _sg.wgpu.uniform.bind.group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &ub_bgl_desc); + SOKOL_ASSERT(_sg.wgpu.uniform.bind.group_layout); WGPUBindGroupEntry ub_bge[SG_NUM_SHADER_STAGES][SG_MAX_SHADERSTAGE_UBS]; _sg_clear(ub_bge, sizeof(ub_bge)); @@ -12404,112 +12388,47 @@ _SOKOL_PRIVATE void _sg_wgpu_ubpool_init(const sg_desc* desc) { for (uint32_t ub_index = 0; ub_index < SG_MAX_SHADERSTAGE_UBS; ub_index++) { uint32_t bind_index = stage_index * SG_MAX_SHADERSTAGE_UBS + ub_index; ub_bge[stage_index][ub_index].binding = bind_index; - ub_bge[stage_index][ub_index].buffer = _sg.wgpu.ub.buf; + ub_bge[stage_index][ub_index].buffer = _sg.wgpu.uniform.buf; ub_bge[stage_index][ub_index].size = _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE; } } WGPUBindGroupDescriptor bg_desc; _sg_clear(&bg_desc, sizeof(bg_desc)); - bg_desc.layout = _sg.wgpu.ub.bindgroup_layout; + bg_desc.layout = _sg.wgpu.uniform.bind.group_layout; bg_desc.entryCount = SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS; bg_desc.entries = &ub_bge[0][0]; - _sg.wgpu.ub.bindgroup = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); - SOKOL_ASSERT(_sg.wgpu.ub.bindgroup); + _sg.wgpu.uniform.bind.group = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); + SOKOL_ASSERT(_sg.wgpu.uniform.bind.group); } -_SOKOL_PRIVATE void _sg_wgpu_ubpool_discard(void) { - if (_sg.wgpu.ub.buf) { - wgpuBufferRelease(_sg.wgpu.ub.buf); - _sg.wgpu.ub.buf = 0; +_SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_discard(void) { + if (_sg.wgpu.uniform.buf) { + wgpuBufferRelease(_sg.wgpu.uniform.buf); + _sg.wgpu.uniform.buf = 0; } - if (_sg.wgpu.ub.bindgroup) { - wgpuBindGroupRelease(_sg.wgpu.ub.bindgroup); - _sg.wgpu.ub.bindgroup = 0; + if (_sg.wgpu.uniform.bind.group) { + wgpuBindGroupRelease(_sg.wgpu.uniform.bind.group); + _sg.wgpu.uniform.bind.group = 0; } - if (_sg.wgpu.ub.bindgroup_layout) { - wgpuBindGroupLayoutRelease(_sg.wgpu.ub.bindgroup_layout); - _sg.wgpu.ub.bindgroup_layout = 0; - } - for (int i = 0; i < _sg.wgpu.ub.staging.num; i++) { - if (_sg.wgpu.ub.staging.buf[i]) { - wgpuBufferRelease(_sg.wgpu.ub.staging.buf[i]); - _sg.wgpu.ub.staging.buf[i] = 0; - _sg.wgpu.ub.staging.ptr[i] = 0; - } + if (_sg.wgpu.uniform.bind.group_layout) { + wgpuBindGroupLayoutRelease(_sg.wgpu.uniform.bind.group_layout); + _sg.wgpu.uniform.bind.group_layout = 0; } } -_SOKOL_PRIVATE void _sg_wgpu_ubpool_mapped_callback(WGPUBufferMapAsyncStatus status, void* user_data) { - if (!_sg.wgpu.valid) { - return; - } - // FIXME: better handling for this - if (WGPUBufferMapAsyncStatus_Success != status) { - _SG_ERROR(WGPU_MAP_UNIFORM_BUFFER_FAILED); - SOKOL_ASSERT(false); - } - const int staging_index = (int)(intptr_t) user_data; - SOKOL_ASSERT(staging_index < _sg.wgpu.ub.staging.num); - SOKOL_ASSERT(0 == _sg.wgpu.ub.staging.ptr[staging_index]); - _sg.wgpu.ub.staging.ptr[staging_index] = (uint8_t*) wgpuBufferGetMappedRange(_sg.wgpu.ub.staging.buf[staging_index], 0, _sg.wgpu.ub.num_bytes); - SOKOL_ASSERT(0 != _sg.wgpu.ub.staging.ptr[staging_index]); -} - -_SOKOL_PRIVATE void _sg_wgpu_ubpool_next_frame(bool first_frame) { - - // immediately request a new mapping for the last frame's current staging buffer - if (!first_frame) { - WGPUBuffer ub_src = _sg.wgpu.ub.staging.buf[_sg.wgpu.ub.staging.cur]; - SOKOL_ASSERT(ub_src); - wgpuBufferMapAsync( - ub_src, // buffer - WGPUMapMode_Write, // mode - 0, // offset - _sg.wgpu.ub.num_bytes, // size - _sg_wgpu_ubpool_mapped_callback, // callback - (void*)(intptr_t)_sg.wgpu.ub.staging.cur // usedata - ); - } - - // rewind per-frame offsets - _sg.wgpu.ub.offset = 0; - _sg_clear(&_sg.wgpu.ub.bind_offsets, sizeof(_sg.wgpu.ub.bind_offsets)); - - // check if a mapped staging buffer is available, otherwise create one - for (int i = 0; i < _sg.wgpu.ub.staging.num; i++) { - if (_sg.wgpu.ub.staging.ptr[i]) { - _sg.wgpu.ub.staging.cur = i; - return; - } - } - - // no mapped uniform buffer available, create one - SOKOL_ASSERT(_sg.wgpu.ub.staging.num < _SG_WGPU_STAGING_PIPELINE_SIZE); - _sg.wgpu.ub.staging.cur = _sg.wgpu.ub.staging.num++; - const int cur = _sg.wgpu.ub.staging.cur; - - WGPUBufferDescriptor desc; - _sg_clear(&desc, sizeof(desc)); - desc.size = _sg.wgpu.ub.num_bytes; - desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_MapWrite; - desc.mappedAtCreation = true; - _sg.wgpu.ub.staging.buf[cur] = wgpuDeviceCreateBuffer(_sg.wgpu.dev, &desc); - _sg.wgpu.ub.staging.ptr[cur] = wgpuBufferGetMappedRange(_sg.wgpu.ub.staging.buf[cur], 0, _sg.wgpu.ub.num_bytes); - SOKOL_ASSERT(_sg.wgpu.ub.staging.buf[cur]); - SOKOL_ASSERT(_sg.wgpu.ub.staging.ptr[cur]); +_SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { + // FIXME: is this still needed? + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, + 0, // groupIndex 0 is reserved for uniform buffers + _sg.wgpu.uniform.bind.group, + SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, + &_sg.wgpu.uniform.bind.offsets[0][0]); } -_SOKOL_PRIVATE void _sg_wgpu_ubpool_flush(void) { - // unmap staging buffer and copy to uniform buffer - const int cur = _sg.wgpu.ub.staging.cur; - SOKOL_ASSERT(_sg.wgpu.ub.staging.ptr[cur]); - _sg.wgpu.ub.staging.ptr[cur] = 0; - WGPUBuffer src_buf = _sg.wgpu.ub.staging.buf[cur]; - wgpuBufferUnmap(src_buf); - if (_sg.wgpu.ub.offset > 0) { - const WGPUBuffer dst_buf = _sg.wgpu.ub.buf; - wgpuCommandEncoderCopyBufferToBuffer(_sg.wgpu.render_cmd_enc, src_buf, 0, dst_buf, 0, _sg.wgpu.ub.offset); - } +_SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { + // clear offsets + _sg.wgpu.uniform.offset = 0; + _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } /* @@ -12634,8 +12553,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_wgpu_init_caps(); // setup the uniform and staging buffer pools - _sg_wgpu_ubpool_init(desc); - _sg_wgpu_ubpool_next_frame(true); + _sg_wgpu_uniform_buffer_init(desc); // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -12660,11 +12578,10 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); _sg.wgpu.valid = false; - _sg_wgpu_ubpool_discard(); + _sg_wgpu_uniform_buffer_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; wgpuQueueRelease(_sg.wgpu.queue); _sg.wgpu.queue = 0; - } _SOKOL_PRIVATE void _sg_wgpu_reset_state_cache(void) { @@ -12932,8 +12849,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; wgpu_bgl_entry->binding = (uint32_t)bind_index; wgpu_bgl_entry->visibility = wgpu_shader_stage; - wgpu_bgl_entry->texture.viewDimension = _sg_wgpu_tex_view_dimension(img_desc->image_type); - wgpu_bgl_entry->texture.sampleType = _sg_wgpu_tex_sample_type(img_desc->sample_type); + wgpu_bgl_entry->texture.viewDimension = _sg_wgpu_texture_view_dimension(img_desc->image_type); + wgpu_bgl_entry->texture.sampleType = _sg_wgpu_texture_sample_type(img_desc->sample_type); wgpu_bgl_entry->texture.multisampled = img_desc->multisampled; } for (int smp_index = 0; smp_index < num_samplers; smp_index++) { @@ -12988,7 +12905,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ // - 1 bindgroup for vertex shader resources // - 1 bindgroup for fragment shader resources WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS]; - wgpu_bgl[_SG_WGPU_UNIFORMS_BINDGROUP_INDEX] = _sg.wgpu.ub.bindgroup_layout; + wgpu_bgl[_SG_WGPU_UNIFORMS_BINDGROUP_INDEX] = _sg.wgpu.uniform.bind.group_layout; wgpu_bgl[_SG_WGPU_VS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; wgpu_bgl[_SG_WGPU_FS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout; WGPUPipelineLayoutDescriptor wgpu_pl_desc; @@ -13277,11 +13194,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* SOKOL_ASSERT(_sg.wgpu.pass_enc); // initial uniform buffer binding (required even if no uniforms are set in the frame) - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, - 0, // groupIndex 0 is reserved for uniform buffers - _sg.wgpu.ub.bindgroup, - SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, - &_sg.wgpu.ub.bind_offsets[0][0]); + _sg_wgpu_uniform_buffer_on_begin_pass(); } _SOKOL_PRIVATE void _sg_wgpu_end_pass(void) { @@ -13297,9 +13210,6 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { SOKOL_ASSERT(!_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); - // finish and submit this frame's work - _sg_wgpu_ubpool_flush(); - WGPUCommandBufferDescriptor cmd_buf_desc; _sg_clear(&cmd_buf_desc, sizeof(cmd_buf_desc)); WGPUCommandBuffer wgpu_cmd_buf = wgpuCommandEncoderFinish(_sg.wgpu.render_cmd_enc, &cmd_buf_desc); @@ -13315,8 +13225,8 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); - // grab new staging buffers for uniform- and vertex/image-updates - _sg_wgpu_ubpool_next_frame(false); + // reset uniform buffer offsets + _sg_wgpu_uniform_buffer_on_commit(); } _SOKOL_PRIVATE void _sg_wgpu_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { From fbdae164c42613677d1471077288a5506450b351 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 13 Aug 2023 16:27:41 +0200 Subject: [PATCH 133/292] sokol_gfx.h wgpu: implement sg_apply_uniforms() --- sokol_gfx.h | 62 +++++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index afd5cccf0..368aaacdd 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4013,7 +4013,6 @@ enum { _SG_DEFAULT_PASS_POOL_SIZE = 16, _SG_DEFAULT_CONTEXT_POOL_SIZE = 16, _SG_DEFAULT_UB_SIZE = 4 * 1024 * 1024, - _SG_DEFAULT_STAGING_SIZE = 8 * 1024 * 1024, _SG_DEFAULT_MAX_COMMIT_LISTENERS = 1024, }; @@ -4793,15 +4792,13 @@ typedef struct { #elif defined(SOKOL_WGPU) -#define _SG_WGPU_STAGING_ALIGN (256) #define _SG_WGPU_ROWPITCH_ALIGN (256) -#define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) +#define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) // also see WGPULimits.maxUniformBufferBindingSize #define _SG_WGPU_NUM_BINDGROUPS (3) // 0: uniforms, 1: vertex stage images & samplers, 2: fragment stage images & samplers #define _SG_WGPU_UNIFORMS_BINDGROUP_INDEX (0) #define _SG_WGPU_VS_BINDGROUP_INDEX (1) #define _SG_WGPU_FS_BINDGROUP_INDEX (2) - typedef struct { _sg_slot_t slot; _sg_buffer_common_t cmn; @@ -5336,6 +5333,10 @@ _SOKOL_PRIVATE int _sg_roundup(int val, int round_to) { return (val+(round_to-1)) & ~(round_to-1); } +_SOKOL_PRIVATE uint64_t _sg_roundup_u32(uint32_t val, uint32_t round_to) { + return (val+(round_to-1)) & ~(round_to-1); +} + _SOKOL_PRIVATE uint64_t _sg_roundup_u64(uint64_t val, uint64_t round_to) { return (val+(round_to-1)) & ~(round_to-1); } @@ -12417,7 +12418,6 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_discard(void) { } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { - // FIXME: is this still needed? wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, 0, // groupIndex 0 is reserved for uniform buffers _sg.wgpu.uniform.bind.group, @@ -12549,10 +12549,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.queue = wgpuDeviceGetQueue(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.queue); - // setup WebGPU features and limits _sg_wgpu_init_caps(); - - // setup the uniform and staging buffer pools _sg_wgpu_uniform_buffer_init(desc); // create an empty bind group for shader stages without bound images @@ -12773,33 +12770,6 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_sampler(_sg_sampler_t* smp) { // FIXME } -/* - How BindGroups work in WebGPU: - - - up to 4 bind groups can be bound simultaneously - - up to 16 bindings per bind group - - 'binding' slots are local per bind group - - in the shader: - layout(set=0, binding=1) corresponds to bind group 0, binding 1 - - Now how to map this to sokol-gfx's bind model: - - Reduce SG_MAX_SHADERSTAGE_IMAGES to 8, then: - - 1 bind group for all 8 uniform buffers - 1 bind group for vertex shader textures + samplers - 1 bind group for fragment shader textures + samples - - Alternatively: - - 1 bind group for 8 uniform buffer slots - 1 bind group for 8 vs images + 8 vs samplers - 1 bind group for 12 fs images - 1 bind group for 12 fs samplers - - I guess this means that we need to create BindGroups on the - fly during sg_apply_bindings() :/ -*/ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { SOKOL_ASSERT(shd && desc); SOKOL_ASSERT(desc->vs.source && desc->fs.source); @@ -13343,6 +13313,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( } // FIXME: create adhoc bind group objects for images and samplers per stage + // (either use a bindgroup-cache or introduce bindgroups as sokol-gfx objects) if ((num_vs_imgs + num_vs_smps) > 0) { WGPUBindGroupLayout vs_bgl = pip->shader->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; SOKOL_ASSERT(vs_bgl); @@ -13364,29 +13335,26 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( } _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { -/* + const uint32_t alignment = _sg.wgpu.limits.limits.minUniformBufferOffsetAlignment; SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - SOKOL_ASSERT((_sg.wgpu.ub.offset + data->size) <= _sg.wgpu.ub.num_bytes); - SOKOL_ASSERT((_sg.wgpu.ub.offset & (_SG_WGPU_STAGING_ALIGN-1)) == 0); + SOKOL_ASSERT((_sg.wgpu.uniform.offset + data->size) <= _sg.wgpu.uniform.num_bytes); + SOKOL_ASSERT((_sg.wgpu.uniform.offset & (alignment - 1)) == 0); SOKOL_ASSERT(_sg.wgpu.cur_pipeline && _sg.wgpu.cur_pipeline->shader); SOKOL_ASSERT(_sg.wgpu.cur_pipeline->slot.id == _sg.wgpu.cur_pipeline_id.id); SOKOL_ASSERT(_sg.wgpu.cur_pipeline->shader->slot.id == _sg.wgpu.cur_pipeline->cmn.shader_id.id); SOKOL_ASSERT(ub_index < _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].num_uniform_blocks); SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - SOKOL_ASSERT(0 != _sg.wgpu.ub.stage.ptr[_sg.wgpu.ub.stage.cur]); - uint8_t* dst_ptr = _sg.wgpu.ub.stage.ptr[_sg.wgpu.ub.stage.cur] + _sg.wgpu.ub.offset; - memcpy(dst_ptr, data->ptr, data->size); - _sg.wgpu.ub.bind_offsets[stage_index][ub_index] = _sg.wgpu.ub.offset; + wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, _sg.wgpu.uniform.offset, data->ptr, data->size); + _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, - 0, // groupIndex 0 is reserved for uniform buffers - _sg.wgpu.ub.bindgroup, + _SG_WGPU_UNIFORMS_BINDGROUP_INDEX, + _sg.wgpu.uniform.bind.group, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, - &_sg.wgpu.ub.bind_offsets[0][0]); - _sg.wgpu.ub.offset = _sg_roundup(_sg.wgpu.ub.offset + data->size, _SG_WGPU_STAGING_ALIGN); -*/ + &_sg.wgpu.uniform.bind.offsets[0][0]); + _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + data->size, alignment); } _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_instances) { From 96c691193cc78287e3279baea9363a8aaf5e3997 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 14 Aug 2023 15:51:40 +0200 Subject: [PATCH 134/292] sokol_gfx.h wgpu: implement image create/destroy --- sokol_gfx.h | 272 +++++++++++++++------------------------------------- 1 file changed, 79 insertions(+), 193 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 368aaacdd..9b38a3f3d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2905,7 +2905,9 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "failed to map uniform buffer (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "wgpuDeviceCreateBuffer() failed") \ - _SG_LOGITEM_XMACRO(WGPU_CREATE_SHADER_MODULE_FAILED, "wgpuDeviceCreateShaderModule failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_FAILED, "wgpuDeviceCreateTexture() failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_VIEW_FAILED, "wgpuTextureCreateView() failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_SHADER_MODULE_FAILED, "wgpuDeviceCreateShaderModule() failed") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_IMAGES, "shader uses too many sampled images on shader stage (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_SAMPLERS, "shader uses too many samplers on shader stage (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED, "wgpuDeviceCreateBindGroupLayout for shader stage failed") \ @@ -11991,7 +11993,7 @@ _SOKOL_PRIVATE WGPUTextureViewDimension _sg_wgpu_texture_view_dimension(sg_image } } -_SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_texture_dim(sg_image_type t) { +_SOKOL_PRIVATE WGPUTextureDimension _sg_wgpu_texture_dimension(sg_image_type t) { if (SG_IMAGETYPE_3D == t) { return WGPUTextureDimension_3D; } else { @@ -12431,104 +12433,6 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } -/* -// helper function to compute number of bytes needed in staging buffer to copy image data -_SOKOL_PRIVATE uint32_t _sg_wgpu_image_data_buffer_size(const _sg_image_t* img) { - uint32_t num_bytes = 0; - const uint32_t num_faces = (img->cmn.type == SG_IMAGETYPE_CUBE) ? 6:1; - const uint32_t num_slices = (img->cmn.type == SG_IMAGETYPE_ARRAY) ? img->cmn.num_slices : 1; - for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++) { - const uint32_t mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); - const uint32_t mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); - // row-pitch must be 256-aligend - const uint32_t bytes_per_slice = _sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, _SG_WGPU_ROWPITCH_ALIGN); - num_bytes += bytes_per_slice * num_slices * num_faces; - } - return num_bytes; -} - -_SOKOL_PRIVATE uint32_t _sg_wgpu_copy_image_data(WGPUBuffer stg_buf, uint8_t* stg_base_ptr, uint32_t stg_base_offset, _sg_image_t* img, const sg_image_data* data) { - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - SOKOL_ASSERT(stg_buf && stg_base_ptr); - SOKOL_ASSERT(img); - SOKOL_ASSERT(data); - uint32_t stg_offset = stg_base_offset; - const uint32_t num_faces = (img->cmn.type == SG_IMAGETYPE_CUBE) ? 6:1; - const uint32_t num_slices = (img->cmn.type == SG_IMAGETYPE_ARRAY) ? img->cmn.num_slices : 1; - const sg_pixel_format fmt = img->cmn.pixel_format; - WGPUBufferCopyView src_view; - _sg_clear(&src_view, sizeof(src_view)); - src_view.buffer = stg_buf; - WGPUTextureCopyView dst_view; - _sg_clear(&dst_view, sizeof(dst_view)); - dst_view.texture = img->wgpu.tex; - WGPUExtent3D extent; - _sg_clear(&extent, sizeof(extent)); - - for (uint32_t face_index = 0; face_index < num_faces; face_index++) { - for (uint32_t mip_index = 0; mip_index < (uint32_t)img->cmn.num_mipmaps; mip_index++) { - SOKOL_ASSERT(data->subimage[face_index][mip_index].ptr); - SOKOL_ASSERT(data->subimage[face_index][mip_index].size > 0); - const uint8_t* src_base_ptr = (const uint8_t*)data->subimage[face_index][mip_index].ptr; - SOKOL_ASSERT(src_base_ptr); - uint8_t* dst_base_ptr = stg_base_ptr + stg_offset; - - const uint32_t mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); - const uint32_t mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); - const uint32_t mip_depth = (img->cmn.type == SG_IMAGETYPE_3D) ? _sg_miplevel_dim(img->cmn.num_slices, mip_index) : 1; - const uint32_t num_rows = _sg_num_rows(fmt, mip_height); - const uint32_t src_bytes_per_row = _sg_row_pitch(fmt, mip_width, 1); - const uint32_t dst_bytes_per_row = _sg_row_pitch(fmt, mip_width, _SG_WGPU_ROWPITCH_ALIGN); - const uint32_t src_bytes_per_slice = _sg_surface_pitch(fmt, mip_width, mip_height, 1); - const uint32_t dst_bytes_per_slice = _sg_surface_pitch(fmt, mip_width, mip_height, _SG_WGPU_ROWPITCH_ALIGN); - SOKOL_ASSERT((uint32_t)data->subimage[face_index][mip_index].size == (src_bytes_per_slice * num_slices)); - SOKOL_ASSERT(src_bytes_per_row <= dst_bytes_per_row); - SOKOL_ASSERT(src_bytes_per_slice == (src_bytes_per_row * num_rows)); - SOKOL_ASSERT(dst_bytes_per_slice == (dst_bytes_per_row * num_rows)); - _SOKOL_UNUSED(src_bytes_per_slice); - - // copy data into mapped staging buffer - if (src_bytes_per_row == dst_bytes_per_row) { - // can do a single memcpy - uint32_t num_bytes = data->subimage[face_index][mip_index].size; - memcpy(dst_base_ptr, src_base_ptr, num_bytes); - } else { - // src/dst pitch doesn't match, need to copy row by row - uint8_t* dst_ptr = dst_base_ptr; - const uint8_t* src_ptr = src_base_ptr; - for (uint32_t slice_index = 0; slice_index < num_slices; slice_index++) { - SOKOL_ASSERT(dst_ptr == dst_base_ptr + slice_index * dst_bytes_per_slice); - for (uint32_t row_index = 0; row_index < num_rows; row_index++) { - memcpy(dst_ptr, src_ptr, src_bytes_per_row); - src_ptr += src_bytes_per_row; - dst_ptr += dst_bytes_per_row; - } - } - } - - // record the staging copy operation into command encoder - src_view.imageHeight = mip_height; - src_view.rowPitch = dst_bytes_per_row; - dst_view.mipLevel = mip_index; - extent.width = mip_width; - extent.height = mip_height; - extent.depth = mip_depth; - SOKOL_ASSERT((img->cmn.type != SG_IMAGETYPE_CUBE) || (num_slices == 1)); - for (uint32_t slice_index = 0; slice_index < num_slices; slice_index++) { - const uint32_t layer_index = (img->cmn.type == SG_IMAGETYPE_ARRAY) ? slice_index : face_index; - src_view.offset = stg_offset; - dst_view.arrayLayer = layer_index; - wgpuCommandEncoderCopyBufferToTexture(_sg.wgpu.staging_cmd_enc, &src_view, &dst_view, &extent); - stg_offset += dst_bytes_per_slice; - SOKOL_ASSERT(stg_offset <= _sg.wgpu.staging.num_bytes); - } - } - } - SOKOL_ASSERT(stg_offset >= stg_base_offset); - return (stg_offset - stg_base_offset); -} -*/ - _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.wgpu.device); @@ -12644,118 +12548,100 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_buffer(_sg_buffer_t* buf) { } } -/* -_SOKOL_PRIVATE void _sg_wgpu_init_texdesc_common(WGPUTextureDescriptor* wgpu_tex_desc, const sg_image_desc* desc) { - wgpu_tex_desc->usage = WGPUTextureUsage_Sampled|WGPUTextureUsage_CopyDst; - wgpu_tex_desc->dimension = _sg_wgpu_tex_dim(desc->type); - wgpu_tex_desc->size.width = desc->width; - wgpu_tex_desc->size.height = desc->height; - if (desc->type == SG_IMAGETYPE_3D) { - wgpu_tex_desc->size.depth = desc->num_slices; - wgpu_tex_desc->arrayLayerCount = 1; - } else if (desc->type == SG_IMAGETYPE_CUBE) { - wgpu_tex_desc->size.depth = 1; - wgpu_tex_desc->arrayLayerCount = 6; - } else { - wgpu_tex_desc->size.depth = 1; - wgpu_tex_desc->arrayLayerCount = desc->num_slices; +_SOKOL_PRIVATE void _sg_wgpu_copy_image_data(const _sg_image_t* img, WGPUTexture wgpu_tex, const sg_image_data* data) { + WGPUTextureDataLayout wgpu_layout; + _sg_clear(&wgpu_layout, sizeof(wgpu_layout)); + WGPUImageCopyTexture wgpu_copy_tex; + _sg_clear(&wgpu_copy_tex, sizeof(wgpu_copy_tex)); + wgpu_copy_tex.texture = wgpu_tex; + wgpu_copy_tex.aspect = WGPUTextureAspect_All; + WGPUExtent3D wgpu_extent; + _sg_clear(&wgpu_extent, sizeof(wgpu_extent)); + for (int mip_level = 0; mip_level < img->cmn.num_mipmaps; mip_level++) { + wgpu_copy_tex.mipLevel = (uint32_t)mip_level; + const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_level); + const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_level); + int mip_slices; + switch (img->cmn.type) { + case SG_IMAGETYPE_CUBE: + mip_slices = 6; + break; + case SG_IMAGETYPE_3D: + mip_slices = _sg_miplevel_dim(img->cmn.num_slices, mip_level); + break; + default: + mip_slices = img->cmn.num_slices; + break; + } + const int row_pitch = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1); + const int num_rows = _sg_num_rows(img->cmn.pixel_format, mip_height); + wgpu_layout.offset = 0; + wgpu_layout.bytesPerRow = (uint32_t)row_pitch; + wgpu_layout.rowsPerImage = (uint32_t)num_rows; + wgpu_extent.width = (uint32_t)mip_width; + wgpu_extent.height = (uint32_t)mip_height; + wgpu_extent.depthOrArrayLayers = (uint32_t)mip_slices; + const sg_range* mip_data = &data->subimage[0][mip_level]; + wgpuQueueWriteTexture(_sg.wgpu.queue, &wgpu_copy_tex, mip_data->ptr, mip_data->size, &wgpu_layout, &wgpu_extent); } - wgpu_tex_desc->format = _sg_wgpu_textureformat(desc->pixel_format); - wgpu_tex_desc->mipLevelCount = desc->num_mipmaps; - wgpu_tex_desc->sampleCount = 1; } -*/ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const sg_image_desc* desc) { SOKOL_ASSERT(img && desc); - SOKOL_ASSERT(_sg.wgpu.dev); -/* - SOKOL_ASSERT(_sg.wgpu.staging_cmd_enc); - const bool injected = (0 != desc->wgpu_texture); - const bool is_msaa = desc->sample_count > 1; - WGPUTextureDescriptor wgpu_tex_desc; - _sg_clear(&wgpu_tex_desc, sizeof(wgpu_tex_desc)); - _sg_wgpu_init_texdesc_common(&wgpu_tex_desc, desc); - if (_sg_is_valid_rendertarget_depth_format(img->cmn.pixel_format)) { - SOKOL_ASSERT(img->cmn.render_target); - SOKOL_ASSERT(img->cmn.type == SG_IMAGETYPE_2D); - SOKOL_ASSERT(img->cmn.num_mipmaps == 1); - SOKOL_ASSERT(!injected); - wgpu_tex_desc.usage = WGPUTextureUsage_OutputAttachment; - wgpu_tex_desc.sampleCount = desc->sample_count; - img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); - SOKOL_ASSERT(img->wgpu.tex); + if (injected) { + img->wgpu.tex = (WGPUTexture)desc->wgpu_texture; + wgpuTextureReference(img->wgpu.tex); } else { - if (injected) { - img->wgpu.tex = (WGPUTexture) desc->wgpu_texture; - wgpuTextureReference(img->wgpu.tex); - } else { - if (img->cmn.render_target) { - wgpu_tex_desc.usage = WGPUTextureUsage_Sampled|WGPUTextureUsage_OutputAttachment; - } - img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); - SOKOL_ASSERT(img->wgpu.tex); - - // copy content into texture via a throw-away staging buffer - if (desc->usage == SG_USAGE_IMMUTABLE && !desc->render_target) { - WGPUBufferDescriptor wgpu_buf_desc; - _sg_clear(&wgpu_buf_desc, sizeof(wgpu_buf_desc)); - wgpu_buf_desc.size = _sg_wgpu_image_data_buffer_size(img); - wgpu_buf_desc.usage = WGPUBufferUsage_CopySrc|WGPUBufferUsage_CopyDst; - WGPUCreateBufferMappedResult map = wgpuDeviceCreateBufferMapped(_sg.wgpu.dev, &wgpu_buf_desc); - SOKOL_ASSERT(map.buffer && map.data); - uint32_t num_bytes = _sg_wgpu_copy_image_data(map.buffer, (uint8_t*)map.data, 0, img, &desc->data); - _SOKOL_UNUSED(num_bytes); - SOKOL_ASSERT(num_bytes == wgpu_buf_desc.size); - wgpuBufferUnmap(map.buffer); - wgpuBufferRelease(map.buffer); - } - } - - // create texture view object - WGPUTextureViewDescriptor wgpu_view_desc; - _sg_clear(&wgpu_view_desc, sizeof(wgpu_view_desc)); - wgpu_view_desc.dimension = _sg_wgpu_tex_viewdim(desc->type); - img->wgpu.tex_view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_view_desc); - - if (desc->render_target && is_msaa) { - wgpu_tex_desc.dimension = WGPUTextureDimension_2D; - wgpu_tex_desc.size.depth = 1; - wgpu_tex_desc.arrayLayerCount = 1; - wgpu_tex_desc.mipLevelCount = 1; - wgpu_tex_desc.usage = WGPUTextureUsage_OutputAttachment; - wgpu_tex_desc.sampleCount = desc->sample_count; - img->wgpu.msaa_tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); - SOKOL_ASSERT(img->wgpu.msaa_tex); + WGPUTextureDescriptor wgpu_tex_desc; + _sg_clear(&wgpu_tex_desc, sizeof(wgpu_tex_desc)); + wgpu_tex_desc.label = desc->label; + wgpu_tex_desc.usage = WGPUTextureUsage_TextureBinding|WGPUTextureUsage_CopyDst; + if (desc->render_target) { + wgpu_tex_desc.usage |= WGPUTextureUsage_RenderAttachment; + } + wgpu_tex_desc.dimension = _sg_wgpu_texture_dimension(desc->type); + wgpu_tex_desc.size.width = (uint32_t) desc->width; + wgpu_tex_desc.size.height = (uint32_t) desc->height; + wgpu_tex_desc.size.depthOrArrayLayers = (uint32_t) desc->num_slices; + wgpu_tex_desc.format = _sg_wgpu_textureformat(desc->pixel_format); + wgpu_tex_desc.mipLevelCount = (uint32_t) desc->num_mipmaps; + wgpu_tex_desc.sampleCount = (uint32_t) desc->sample_count; + img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); + if (0 == img->wgpu.tex) { + _SG_ERROR(WGPU_CREATE_TEXTURE_FAILED); + return SG_RESOURCESTATE_FAILED; } - - // create sampler via shared-sampler-cache - img->wgpu.sampler = _sg_wgpu_create_sampler(desc); - SOKOL_ASSERT(img->wgpu.sampler); + if ((img->cmn.usage == SG_USAGE_IMMUTABLE) && !img->cmn.render_target) { + _sg_wgpu_copy_image_data(img, img->wgpu.tex, &desc->data); + } + } + WGPUTextureViewDescriptor wgpu_texview_desc; + _sg_clear(&wgpu_texview_desc, sizeof(wgpu_texview_desc)); + wgpu_texview_desc.label = desc->label; + wgpu_texview_desc.dimension = _sg_wgpu_texture_view_dimension(img->cmn.type); + wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; + wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + // FIXME: should aspect be DepthOnly for all depth texture formats? + wgpu_texview_desc.aspect = WGPUTextureAspect_All; + img->wgpu.view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_texview_desc); + if (0 == img->wgpu.view) { + _SG_ERROR(WGPU_CREATE_TEXTURE_VIEW_FAILED); + return SG_RESOURCESTATE_FAILED; } -*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { SOKOL_ASSERT(img); -/* if (img->wgpu.tex) { wgpuTextureRelease(img->wgpu.tex); img->wgpu.tex = 0; } - if (img->wgpu.tex_view) { - wgpuTextureViewRelease(img->wgpu.tex_view); - img->wgpu.tex_view = 0; + if (img->wgpu.view) { + wgpuTextureViewRelease(img->wgpu.view); + img->wgpu.view = 0; } - if (img->wgpu.msaa_tex) { - wgpuTextureRelease(img->wgpu.msaa_tex); - img->wgpu.msaa_tex = 0; - } - // NOTE: do *not* destroy the sampler from the shared-sampler-cache - img->wgpu.sampler = 0; -*/ } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { From dc250eb6b4316daea99f685893bf382a504600f8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 14 Aug 2023 16:10:47 +0200 Subject: [PATCH 135/292] sokol_gfx.h wgpu: implement sampler create/destroy --- sokol_gfx.h | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9b38a3f3d..8d5d9dd45 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2907,6 +2907,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "wgpuDeviceCreateBuffer() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_FAILED, "wgpuDeviceCreateTexture() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_VIEW_FAILED, "wgpuTextureCreateView() failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_SAMPLER_FAILED, "wgpuDeviceCreateSampler() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_SHADER_MODULE_FAILED, "wgpuDeviceCreateShaderModule() failed") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_IMAGES, "shader uses too many sampled images on shader stage (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_SAMPLERS, "shader uses too many samplers on shader stage (wgpu)") \ @@ -12021,7 +12022,7 @@ _SOKOL_PRIVATE WGPUSamplerBindingType _sg_wgpu_sampler_binding_type(sg_sampler_t } } -_SOKOL_PRIVATE WGPUAddressMode _sg_wgpu_sampler_addrmode(sg_wrap m) { +_SOKOL_PRIVATE WGPUAddressMode _sg_wgpu_sampler_address_mode(sg_wrap m) { switch (m) { case SG_WRAP_REPEAT: return WGPUAddressMode_Repeat; @@ -12048,16 +12049,16 @@ _SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmag_filter(sg_filter f) { } } -_SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_mipmap_filter(sg_filter f) { +_SOKOL_PRIVATE WGPUMipmapFilterMode _sg_wgpu_sampler_mipmap_filter(sg_filter f) { switch (f) { case SG_FILTER_NONE: case SG_FILTER_NEAREST: - return WGPUFilterMode_Nearest; + return WGPUMipmapFilterMode_Nearest; case SG_FILTER_LINEAR: - return WGPUFilterMode_Linear; + return WGPUMipmapFilterMode_Linear; default: SOKOL_UNREACHABLE; - return WGPUFilterMode_Force32; + return WGPUMipmapFilterMode_Force32; } } @@ -12468,7 +12469,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(_sg.wgpu.empty_bind_group); wgpuBindGroupLayoutRelease(empty_bgl); - // create initial per-frame command encoders + // create initial per-frame command encoder WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); @@ -12647,13 +12648,36 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); SOKOL_ASSERT(_sg.wgpu.dev); - // FIXME + WGPUSamplerDescriptor wgpu_desc; + _sg_clear(&wgpu_desc, sizeof(wgpu_desc)); + wgpu_desc.label = desc->label; + wgpu_desc.addressModeU = _sg_wgpu_sampler_address_mode(desc->wrap_u); + wgpu_desc.addressModeV = _sg_wgpu_sampler_address_mode(desc->wrap_v); + wgpu_desc.addressModeW = _sg_wgpu_sampler_address_mode(desc->wrap_w); + wgpu_desc.magFilter = _sg_wgpu_sampler_minmag_filter(desc->mag_filter); + wgpu_desc.minFilter = _sg_wgpu_sampler_minmag_filter(desc->min_filter); + wgpu_desc.mipmapFilter = _sg_wgpu_sampler_mipmap_filter(desc->mipmap_filter); + wgpu_desc.lodMinClamp = desc->min_lod; + wgpu_desc.lodMaxClamp = desc->max_lod; + wgpu_desc.compare = _sg_wgpu_comparefunc(desc->compare); + if (wgpu_desc.compare == WGPUCompareFunction_Never) { + wgpu_desc.compare = WGPUCompareFunction_Undefined; + } + wgpu_desc.maxAnisotropy = (uint16_t)desc->max_anisotropy; + smp->wgpu.smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &wgpu_desc); + if (0 == smp->wgpu.smp) { + _SG_ERROR(WGPU_CREATE_SAMPLER_FAILED); + return SG_RESOURCESTATE_FAILED; + } return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_sampler(_sg_sampler_t* smp) { SOKOL_ASSERT(smp); - // FIXME + if (smp->wgpu.smp) { + wgpuSamplerReference(smp->wgpu.smp); + smp->wgpu.smp = 0; + } } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const sg_shader_desc* desc) { From 233f6888defb8cfc70028e53ae4047aa6fc5bac9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 15 Aug 2023 19:55:16 +0200 Subject: [PATCH 136/292] sokol_gfx.h wgpu: implement pass create/destroy --- sokol_gfx.h | 178 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 103 insertions(+), 75 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 8d5d9dd45..f8d167205 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2911,7 +2911,10 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(WGPU_CREATE_SHADER_MODULE_FAILED, "wgpuDeviceCreateShaderModule() failed") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_IMAGES, "shader uses too many sampled images on shader stage (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_SHADER_TOO_MANY_SAMPLERS, "shader uses too many samplers on shader stage (wgpu)") \ - _SG_LOGITEM_XMACRO(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED, "wgpuDeviceCreateBindGroupLayout for shader stage failed") \ + _SG_LOGITEM_XMACRO(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED, "wgpuDeviceCreateBindGroupLayout() for shader stage failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_PIPELINE_LAYOUT_FAILED, "wgpuDeviceCreatePipelineLayout() failed") \ + _SG_LOGITEM_XMACRO(WGPU_CREATE_RENDER_PIPELINE_FAILED, "wgpuDeviceCreateRenderPipeline() failed") \ + _SG_LOGITEM_XMACRO(WGPU_PASS_CREATE_TEXTURE_VIEW_FAILED, "wgpuTextureCreateView() failed in create pass") \ _SG_LOGITEM_XMACRO(UNINIT_BUFFER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in buffer uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_IMAGE_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in image uninit (must be same as for creation)") \ _SG_LOGITEM_XMACRO(UNINIT_SAMPLER_ACTIVE_CONTEXT_MISMATCH, "active context mismatch in sampler uninit (must be same as for creation)") \ @@ -11959,8 +11962,10 @@ _SOKOL_PRIVATE WGPUBufferUsageFlags _sg_wgpu_buffer_usage(sg_buffer_type t, sg_u return res; } -_SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(sg_load_action a) { - switch (a) { +_SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(WGPUTextureView view, sg_load_action a) { + if (0 == view) { + return WGPULoadOp_Undefined; + } else switch (a) { case SG_LOADACTION_CLEAR: case SG_LOADACTION_DONTCARE: return WGPULoadOp_Clear; @@ -11972,8 +11977,10 @@ _SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(sg_load_action a) { } } -_SOKOL_PRIVATE WGPUStoreOp _sg_wgpu_store_op(sg_store_action a) { - switch (a) { +_SOKOL_PRIVATE WGPUStoreOp _sg_wgpu_store_op(WGPUTextureView view, sg_store_action a) { + if (0 == view) { + return WGPUStoreOp_Undefined; + } else switch (a) { case SG_STOREACTION_STORE: return WGPUStoreOp_Store; case SG_STOREACTION_DONTCARE: @@ -12793,6 +12800,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ wgpu_pl_desc.bindGroupLayoutCount = _SG_WGPU_NUM_BINDGROUPS; wgpu_pl_desc.bindGroupLayouts = &wgpu_bgl[0]; const WGPUPipelineLayout wgpu_pip_layout = wgpuDeviceCreatePipelineLayout(_sg.wgpu.dev, &wgpu_pl_desc); + if (0 == wgpu_pip_layout) { + _SG_ERROR(WGPU_CREATE_PIPELINE_LAYOUT_FAILED); + return SG_RESOURCESTATE_FAILED; + } SOKOL_ASSERT(wgpu_pip_layout); WGPUVertexBufferLayout wgpu_vb_layouts[SG_MAX_VERTEX_BUFFERS]; @@ -12888,9 +12899,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ wgpu_pip_desc.fragment = &wgpu_frag_state; } pip->wgpu.pip = wgpuDeviceCreateRenderPipeline(_sg.wgpu.dev, &wgpu_pip_desc); - SOKOL_ASSERT(0 != pip->wgpu.pip); wgpuPipelineLayoutRelease(wgpu_pip_layout); - + if (0 == pip->wgpu.pip) { + _SG_ERROR(WGPU_CREATE_RENDER_PIPELINE_FAILED); + return SG_RESOURCESTATE_FAILED; + } return SG_RESOURCESTATE_VALID; } @@ -12909,80 +12922,90 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_pipeline(_sg_pipeline_t* pip) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pass(_sg_pass_t* pass, _sg_image_t** color_images, _sg_image_t** resolve_images, _sg_image_t* ds_img, const sg_pass_desc* desc) { SOKOL_ASSERT(pass && desc); SOKOL_ASSERT(color_images && resolve_images); -/* - // copy image pointers and create render-texture views - const sg_pass_attachment_desc* att_desc; - for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { - att_desc = &desc->color_attachments[i]; - if (att_desc->image.id != SG_INVALID_ID) { - SOKOL_ASSERT(att_desc->image.id != SG_INVALID_ID); - SOKOL_ASSERT(0 == pass->wgpu.color_atts[i].image); - _sg_image_t* img = att_images[i]; - SOKOL_ASSERT(img && (img->slot.id == att_desc->image.id)); - SOKOL_ASSERT(_sg_is_valid_rendertarget_color_format(img->cmn.pixel_format)); - pass->wgpu.color_atts[i].image = img; - // create a render-texture-view to render into the right sub-surface - const bool is_msaa = img->cmn.sample_count > 1; - WGPUTextureViewDescriptor view_desc; - _sg_clear(&view_desc, sizeof(view_desc)); - view_desc.baseMipLevel = is_msaa ? 0 : att_desc->mip_level; - view_desc.mipLevelCount = 1; - view_desc.baseArrayLayer = is_msaa ? 0 : att_desc->slice; - view_desc.arrayLayerCount = 1; - WGPUTexture wgpu_tex = is_msaa ? img->wgpu.msaa_tex : img->wgpu.tex; - SOKOL_ASSERT(wgpu_tex); - pass->wgpu.color_atts[i].render_tex_view = wgpuTextureCreateView(wgpu_tex, &view_desc); - SOKOL_ASSERT(pass->wgpu.color_atts[i].render_tex_view); - // ... and if needed a separate resolve texture view - if (is_msaa) { - view_desc.baseMipLevel = att_desc->mip_level; - view_desc.baseArrayLayer = att_desc->slice; - WGPUTexture wgpu_tex = img->wgpu.tex; - pass->wgpu.color_atts[i].resolve_tex_view = wgpuTextureCreateView(wgpu_tex, &view_desc); - SOKOL_ASSERT(pass->wgpu.color_atts[i].resolve_tex_view); + + // copy image pointers and create renderable wgpu texture views + for (int i = 0; i < pass->cmn.num_color_atts; i++) { + const sg_pass_attachment_desc* color_desc = &desc->color_attachments[i]; + _SOKOL_UNUSED(color_desc); + SOKOL_ASSERT(color_desc->image.id != SG_INVALID_ID); + SOKOL_ASSERT(0 == pass->wgpu.color_atts[i].image); + SOKOL_ASSERT(color_images[i] && (color_images[i]->slot.id == color_desc->image.id)); + SOKOL_ASSERT(_sg_is_valid_rendertarget_color_format(color_images[i]->cmn.pixel_format)); + SOKOL_ASSERT(color_images[i]->wgpu.tex); + pass->wgpu.color_atts[i].image = color_images[i]; + + WGPUTextureViewDescriptor wgpu_color_view_desc; + _sg_clear(&wgpu_color_view_desc, sizeof(wgpu_color_view_desc)); + wgpu_color_view_desc.baseMipLevel = (uint32_t) color_desc->mip_level; + wgpu_color_view_desc.mipLevelCount = 1; + wgpu_color_view_desc.baseArrayLayer = (uint32_t) color_desc->slice; + wgpu_color_view_desc.arrayLayerCount = 1; + pass->wgpu.color_atts[i].view = wgpuTextureCreateView(color_images[i]->wgpu.tex, &wgpu_color_view_desc); + if (0 == pass->wgpu.color_atts[i].view) { + _SG_ERROR(WGPU_PASS_CREATE_TEXTURE_VIEW_FAILED); + return SG_RESOURCESTATE_FAILED; + } + + const sg_pass_attachment_desc* resolve_desc = &desc->resolve_attachments[i]; + if (resolve_desc->image.id != SG_INVALID_ID) { + SOKOL_ASSERT(0 == pass->wgpu.resolve_atts[i].image); + SOKOL_ASSERT(resolve_images[i] && (resolve_images[i]->slot.id == resolve_desc->image.id)); + SOKOL_ASSERT(color_images[i] && (color_images[i]->cmn.pixel_format == resolve_images[i]->cmn.pixel_format)); + SOKOL_ASSERT(resolve_images[i]->wgpu.tex); + pass->wgpu.resolve_atts[i].image = resolve_images[i]; + + WGPUTextureViewDescriptor wgpu_resolve_view_desc; + _sg_clear(&wgpu_resolve_view_desc, sizeof(wgpu_resolve_view_desc)); + wgpu_resolve_view_desc.baseMipLevel = (uint32_t) resolve_desc->mip_level; + wgpu_resolve_view_desc.mipLevelCount = 1; + wgpu_resolve_view_desc.baseArrayLayer = (uint32_t) resolve_desc->slice; + wgpu_resolve_view_desc.arrayLayerCount = 1; + pass->wgpu.resolve_atts[i].view = wgpuTextureCreateView(resolve_images[i]->wgpu.tex, &wgpu_resolve_view_desc); + if (0 == pass->wgpu.resolve_atts[i].view) { + _SG_ERROR(WGPU_PASS_CREATE_TEXTURE_VIEW_FAILED); + return SG_RESOURCESTATE_FAILED; } } } SOKOL_ASSERT(0 == pass->wgpu.ds_att.image); - att_desc = &desc->depth_stencil_attachment; - if (att_desc->image.id != SG_INVALID_ID) { - const int ds_img_index = SG_MAX_COLOR_ATTACHMENTS; - SOKOL_ASSERT(att_images[ds_img_index] && (att_images[ds_img_index]->slot.id == att_desc->image.id)); - SOKOL_ASSERT(_sg_is_valid_rendertarget_depth_format(att_images[ds_img_index]->cmn.pixel_format)); - _sg_image_t* ds_img = att_images[ds_img_index]; + const sg_pass_attachment_desc* ds_desc = &desc->depth_stencil_attachment; + if (ds_desc->image.id != SG_INVALID_ID) { + SOKOL_ASSERT(ds_img && (ds_img->slot.id == ds_desc->image.id)); + SOKOL_ASSERT(_sg_is_valid_rendertarget_depth_format(ds_img->cmn.pixel_format)); + SOKOL_ASSERT(ds_img->wgpu.tex); pass->wgpu.ds_att.image = ds_img; - // create a render-texture view - SOKOL_ASSERT(0 == att_desc->mip_level); - SOKOL_ASSERT(0 == att_desc->slice); - WGPUTextureViewDescriptor view_desc; - _sg_clear(&view_desc, sizeof(view_desc)); - WGPUTexture wgpu_tex = ds_img->wgpu.tex; - SOKOL_ASSERT(wgpu_tex); - pass->wgpu.ds_att.render_tex_view = wgpuTextureCreateView(wgpu_tex, &view_desc); - SOKOL_ASSERT(pass->wgpu.ds_att.render_tex_view); + + WGPUTextureViewDescriptor wgpu_ds_view_desc; + _sg_clear(&wgpu_ds_view_desc, sizeof(wgpu_ds_view_desc)); + wgpu_ds_view_desc.baseMipLevel = (uint32_t) ds_desc->mip_level; + wgpu_ds_view_desc.mipLevelCount = 1; + wgpu_ds_view_desc.baseArrayLayer = (uint32_t) ds_desc->slice; + wgpu_ds_view_desc.arrayLayerCount = 1; + pass->wgpu.ds_att.view = wgpuTextureCreateView(ds_img->wgpu.tex, &wgpu_ds_view_desc); + if (0 == pass->wgpu.ds_att.view) { + _SG_ERROR(WGPU_PASS_CREATE_TEXTURE_VIEW_FAILED); + return SG_RESOURCESTATE_FAILED; + } } -*/ return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_pass(_sg_pass_t* pass) { SOKOL_ASSERT(pass); -/* - for (uint32_t i = 0; i < pass->cmn.num_color_atts; i++) { - if (pass->wgpu.color_atts[i].render_tex_view) { - wgpuTextureViewRelease(pass->wgpu.color_atts[i].render_tex_view); - pass->wgpu.color_atts[i].render_tex_view = 0; + for (int i = 0; i < pass->cmn.num_color_atts; i++) { + if (pass->wgpu.color_atts[i].view) { + wgpuTextureViewRelease(pass->wgpu.color_atts[i].view); + pass->wgpu.color_atts[i].view = 0; } - if (pass->wgpu.color_atts[i].resolve_tex_view) { - wgpuTextureViewRelease(pass->wgpu.color_atts[i].resolve_tex_view); - pass->wgpu.color_atts[i].resolve_tex_view = 0; + if (pass->wgpu.resolve_atts[i].view) { + wgpuTextureViewRelease(pass->wgpu.resolve_atts[i].view); + pass->wgpu.resolve_atts[i].view = 0; } } - if (pass->wgpu.ds_att.render_tex_view) { - wgpuTextureViewRelease(pass->wgpu.ds_att.render_tex_view); - pass->wgpu.ds_att.render_tex_view = 0; + if (pass->wgpu.ds_att.view) { + wgpuTextureViewRelease(pass->wgpu.ds_att.view); + pass->wgpu.ds_att.view = 0; } -*/ } _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_color_image(const _sg_pass_t* pass, int index) { @@ -13006,22 +13029,27 @@ _SOKOL_PRIVATE _sg_image_t* _sg_wgpu_pass_ds_image(const _sg_pass_t* pass) { _SOKOL_PRIVATE void _sg_wgpu_init_color_att(WGPURenderPassColorAttachment* wgpu_att, const sg_color_attachment_action* action, WGPUTextureView color_view, WGPUTextureView resolve_view) { wgpu_att->view = color_view; wgpu_att->resolveTarget = resolve_view; - wgpu_att->loadOp = _sg_wgpu_load_op(action->load_action); - wgpu_att->storeOp = _sg_wgpu_store_op(action->store_action); + wgpu_att->loadOp = _sg_wgpu_load_op(color_view, action->load_action); + wgpu_att->storeOp = _sg_wgpu_store_op(color_view, action->store_action); wgpu_att->clearValue.r = action->clear_value.r; wgpu_att->clearValue.g = action->clear_value.g; wgpu_att->clearValue.b = action->clear_value.b; wgpu_att->clearValue.a = action->clear_value.a; } -_SOKOL_PRIVATE void _sg_wgpu_init_ds_att(WGPURenderPassDepthStencilAttachment* wgpu_att, const sg_pass_action* action, WGPUTextureView view) { +_SOKOL_PRIVATE void _sg_wgpu_init_ds_att(WGPURenderPassDepthStencilAttachment* wgpu_att, const sg_pass_action* action, sg_pixel_format fmt, WGPUTextureView view) { wgpu_att->view = view; - wgpu_att->depthLoadOp = _sg_wgpu_load_op(action->depth.load_action); - wgpu_att->depthStoreOp = _sg_wgpu_store_op(action->depth.store_action); + wgpu_att->depthLoadOp = _sg_wgpu_load_op(view, action->depth.load_action); + wgpu_att->depthStoreOp = _sg_wgpu_store_op(view, action->depth.store_action); wgpu_att->depthClearValue = action->depth.clear_value; wgpu_att->depthReadOnly = false; - wgpu_att->stencilLoadOp = _sg_wgpu_load_op(action->stencil.load_action); - wgpu_att->stencilStoreOp = _sg_wgpu_store_op(action->stencil.store_action); + if (_sg_is_depth_stencil_format(fmt)) { + wgpu_att->stencilLoadOp = _sg_wgpu_load_op(view, action->stencil.load_action); + wgpu_att->stencilStoreOp = _sg_wgpu_store_op(view, action->stencil.store_action); + } else { + wgpu_att->stencilLoadOp = WGPULoadOp_Undefined; + wgpu_att->stencilStoreOp = WGPUStoreOp_Undefined; + } wgpu_att->stencilClearValue = action->stencil.clear_value; wgpu_att->stencilReadOnly = false; } @@ -13055,7 +13083,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* wgpu_pass_desc.colorAttachmentCount = (size_t)pass->cmn.num_color_atts; wgpu_pass_desc.colorAttachments = &wgpu_color_att[0]; if (pass->wgpu.ds_att.image) { - _sg_wgpu_init_ds_att(&wgpu_ds_att, action, pass->wgpu.ds_att.view); + _sg_wgpu_init_ds_att(&wgpu_ds_att, action, pass->wgpu.ds_att.image->cmn.pixel_format, pass->wgpu.ds_att.view); wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att; } } else { @@ -13066,7 +13094,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* wgpu_pass_desc.colorAttachmentCount = 1; wgpu_pass_desc.colorAttachments = &wgpu_color_att[0]; if (wgpu_depth_stencil_view) { - _sg_wgpu_init_ds_att(&wgpu_ds_att, action, wgpu_depth_stencil_view); + _sg_wgpu_init_ds_att(&wgpu_ds_att, action, _sg.desc.context.depth_format, wgpu_depth_stencil_view); } wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att; } From 7906e70c777c7fbe35f2e81f0dbd6ec49794e2cf Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 16 Aug 2023 00:30:33 +0200 Subject: [PATCH 137/292] sokol_gfx.h wgpu: fix pipeline desc linked struct lifetimes doh --- sokol_gfx.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index f8d167205..527f7ba6e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12837,6 +12837,14 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ WGPURenderPipelineDescriptor wgpu_pip_desc; _sg_clear(&wgpu_pip_desc, sizeof(wgpu_pip_desc)); + WGPUDepthStencilState wgpu_ds_state; + _sg_clear(&wgpu_ds_state, sizeof(wgpu_ds_state)); + WGPUFragmentState wgpu_frag_state; + _sg_clear(&wgpu_frag_state, sizeof(wgpu_frag_state)); + WGPUColorTargetState wgpu_ctgt_state[SG_MAX_COLOR_ATTACHMENTS]; + _sg_clear(&wgpu_ctgt_state, sizeof(wgpu_ctgt_state)); + WGPUBlendState wgpu_blend_state[SG_MAX_COLOR_ATTACHMENTS]; + _sg_clear(&wgpu_blend_state, sizeof(wgpu_blend_state)); wgpu_pip_desc.label = desc->label; wgpu_pip_desc.layout = wgpu_pip_layout; wgpu_pip_desc.vertex.module = shd->wgpu.stage[SG_SHADERSTAGE_VS].module; @@ -12848,8 +12856,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ wgpu_pip_desc.primitive.frontFace = _sg_wgpu_frontface(desc->face_winding); wgpu_pip_desc.primitive.cullMode = _sg_wgpu_cullmode(desc->cull_mode); if (SG_PIXELFORMAT_NONE != desc->depth.pixel_format) { - WGPUDepthStencilState wgpu_ds_state; - _sg_clear(&wgpu_ds_state, sizeof(wgpu_ds_state)); wgpu_ds_state.format = _sg_wgpu_textureformat(desc->depth.pixel_format); wgpu_ds_state.depthWriteEnabled = desc->depth.write_enabled; wgpu_ds_state.depthCompare = _sg_wgpu_comparefunc(desc->depth.compare); @@ -12872,12 +12878,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ wgpu_pip_desc.multisample.mask = 0xFFFFFFFF; wgpu_pip_desc.multisample.alphaToCoverageEnabled = desc->alpha_to_coverage_enabled; if (desc->color_count > 0) { - WGPUFragmentState wgpu_frag_state; - _sg_clear(&wgpu_frag_state, sizeof(wgpu_frag_state)); - WGPUColorTargetState wgpu_ctgt_state[SG_MAX_COLOR_ATTACHMENTS]; - _sg_clear(&wgpu_ctgt_state, sizeof(wgpu_ctgt_state)); - WGPUBlendState wgpu_blend_state[SG_MAX_COLOR_ATTACHMENTS]; - _sg_clear(&wgpu_blend_state, sizeof(wgpu_blend_state)); wgpu_frag_state.module = shd->wgpu.stage[SG_SHADERSTAGE_FS].module; wgpu_frag_state.entryPoint = shd->wgpu.stage[SG_SHADERSTAGE_FS].entry.buf; wgpu_frag_state.targetCount = (size_t)desc->color_count; From 0341168249a65bb1c0aadd85c2c7085b28067cdb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 17 Aug 2023 19:02:40 +0200 Subject: [PATCH 138/292] sokol_gfx.h wgpu: implement sg_update_buffer --- sokol_gfx.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 527f7ba6e..9e549c0d9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12296,7 +12296,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.features.mrt_independent_write_mask = true; bool success = wgpuDeviceGetLimits(_sg.wgpu.dev, &_sg.wgpu.limits); - SOKOL_ASSERT(success); + SOKOL_ASSERT(success); _SOKOL_UNUSED(success); const WGPULimits* l = &_sg.wgpu.limits.limits; _sg.limits.max_image_size_2d = (int) l->maxTextureDimension2D; @@ -13307,14 +13307,13 @@ _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_in } _SOKOL_PRIVATE void _sg_wgpu_update_buffer(_sg_buffer_t* buf, const sg_range* data) { -/* - SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - uint32_t copied_num_bytes = _sg_wgpu_staging_copy_to_buffer(buf->wgpu.buf, 0, data->ptr, data->size); - SOKOL_ASSERT(copied_num_bytes > 0); _SOKOL_UNUSED(copied_num_bytes); -*/ + SOKOL_ASSERT(data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(buf); + wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, 0, data->ptr, data->size); } _SOKOL_PRIVATE int _sg_wgpu_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +SOKOL_ASSERT(false); return 0; /* SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); @@ -13326,6 +13325,7 @@ return 0; } _SOKOL_PRIVATE void _sg_wgpu_update_image(_sg_image_t* img, const sg_image_data* data) { +SOKOL_ASSERT(false); /* SOKOL_ASSERT(img && data); bool success = _sg_wgpu_staging_copy_to_texture(img, data); From 97fafacb5b38ceb481ae560595d4b9d700cb6396 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 19 Aug 2023 14:25:29 +0200 Subject: [PATCH 139/292] sokol_gfx.h wgpu: implement sg_update_image --- sokol_gfx.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9e549c0d9..6632b07e5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13325,13 +13325,8 @@ return 0; } _SOKOL_PRIVATE void _sg_wgpu_update_image(_sg_image_t* img, const sg_image_data* data) { -SOKOL_ASSERT(false); - /* SOKOL_ASSERT(img && data); - bool success = _sg_wgpu_staging_copy_to_texture(img, data); - SOKOL_ASSERT(success); - _SOKOL_UNUSED(success); -*/ + _sg_wgpu_copy_image_data(img, img->wgpu.tex, data); } #endif From 61d36f21935f0f4e5b6f0c6b5ecf151eaeaac679 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 20 Aug 2023 18:54:31 +0200 Subject: [PATCH 140/292] sokol_gfx.h wgpu: implement sg_append_buffer --- sokol_gfx.h | 65 ++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 6632b07e5..1f88af68b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5347,6 +5347,10 @@ _SOKOL_PRIVATE uint64_t _sg_roundup_u64(uint64_t val, uint64_t round_to) { return (val+(round_to-1)) & ~(round_to-1); } +_SOKOL_PRIVATE bool _sg_multiple_u64(uint64_t val, uint64_t of) { + return (val & (of-1)) == 0; +} + /* return row pitch for an image see ComputePitch in https://github.com/microsoft/DirectXTex/blob/master/DirectXTex/DirectXTexUtil.cpp @@ -5795,22 +5799,22 @@ _SOKOL_PRIVATE void _sg_dummy_draw(int base_element, int num_elements, int num_i _SOKOL_PRIVATE void _sg_dummy_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); _SOKOL_UNUSED(data); if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; } } -_SOKOL_PRIVATE int _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +_SOKOL_PRIVATE void _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); _SOKOL_UNUSED(data); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; } } - // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend - return _sg_roundup((int)data->size, 4); } _SOKOL_PRIVATE void _sg_dummy_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -8273,6 +8277,7 @@ _SOKOL_PRIVATE void _sg_gl_commit(void) { _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); // only one update per buffer per frame allowed if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -8289,8 +8294,9 @@ _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data _SG_GL_CHECK_ERROR(); } -_SOKOL_PRIVATE int _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +_SOKOL_PRIVATE void _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -8306,8 +8312,6 @@ _SOKOL_PRIVATE int _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, glBufferSubData(gl_tgt, buf->cmn.append_pos, (GLsizeiptr)data->size, data->ptr); _sg_gl_cache_restore_buffer_binding(gl_tgt); _SG_GL_CHECK_ERROR(); - // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backend - return _sg_roundup((int)data->size, 4); } _SOKOL_PRIVATE void _sg_gl_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -10149,6 +10153,7 @@ _SOKOL_PRIVATE void _sg_d3d11_commit(void) { _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(_sg.d3d11.ctx); SOKOL_ASSERT(buf->d3d11.buf); D3D11_MAPPED_SUBRESOURCE d3d11_msr; @@ -10161,8 +10166,9 @@ _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* d } } -_SOKOL_PRIVATE int _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +_SOKOL_PRIVATE void _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(_sg.d3d11.ctx); SOKOL_ASSERT(buf->d3d11.buf); D3D11_MAP map_type = new_frame ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; @@ -10175,8 +10181,6 @@ _SOKOL_PRIVATE int _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* da } else { _SG_ERROR(D3D11_MAP_FOR_APPEND_BUFFER_FAILED); } - // NOTE: this alignment is a requirement from WebGPU, but we want identical behaviour across all backend - return _sg_roundup((int)data->size, 4); } _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -11897,6 +11901,7 @@ _SOKOL_PRIVATE void _sg_mtl_draw(int base_element, int num_elements, int num_ins _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; } @@ -11910,8 +11915,9 @@ _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* dat #endif } -_SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +_SOKOL_PRIVATE void _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -11926,8 +11932,6 @@ _SOKOL_PRIVATE int _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; } #endif - // NOTE: this is a requirement from WebGPU, but we want identical behaviour across all backends - return _sg_roundup((int)data->size, 4); } _SOKOL_PRIVATE void _sg_mtl_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -13308,20 +13312,17 @@ _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_in _SOKOL_PRIVATE void _sg_wgpu_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(buf); wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, 0, data->ptr, data->size); } -_SOKOL_PRIVATE int _sg_wgpu_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { -SOKOL_ASSERT(false); -return 0; -/* - SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); +_SOKOL_PRIVATE void _sg_wgpu_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { + SOKOL_ASSERT(data && data->ptr && (data->size > 0)); + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); + SOKOL_ASSERT(_sg_multiple_u64((uint64_t)buf->cmn.append_pos, 4)); _SOKOL_UNUSED(new_frame); - uint32_t copied_num_bytes = _sg_wgpu_staging_copy_to_buffer(buf->wgpu.buf, buf->cmn.append_pos, data->ptr, data->size); - SOKOL_ASSERT(copied_num_bytes > 0); _SOKOL_UNUSED(copied_num_bytes); - return (int)copied_num_bytes; -*/ + wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, (uint64_t)buf->cmn.append_pos, data->ptr, data->size); } _SOKOL_PRIVATE void _sg_wgpu_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -13841,17 +13842,17 @@ static inline void _sg_update_buffer(_sg_buffer_t* buf, const sg_range* data) { #endif } -static inline int _sg_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +static inline void _sg_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { #if defined(_SOKOL_ANY_GL) - return _sg_gl_append_buffer(buf, data, new_frame); + _sg_gl_append_buffer(buf, data, new_frame); #elif defined(SOKOL_METAL) - return _sg_mtl_append_buffer(buf, data, new_frame); + _sg_mtl_append_buffer(buf, data, new_frame); #elif defined(SOKOL_D3D11) - return _sg_d3d11_append_buffer(buf, data, new_frame); + _sg_d3d11_append_buffer(buf, data, new_frame); #elif defined(SOKOL_WGPU) - return _sg_wgpu_append_buffer(buf, data, new_frame); + _sg_wgpu_append_buffer(buf, data, new_frame); #elif defined(SOKOL_DUMMY_BACKEND) - return _sg_dummy_append_buffer(buf, data, new_frame); + _sg_dummy_append_buffer(buf, data, new_frame); #else #error("INVALID BACKEND"); #endif @@ -14597,7 +14598,7 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) { if (l_state->stride == 0) { continue; } - _SG_VALIDATE((l_state->stride & 3) == 0, VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4); + _SG_VALIDATE(_sg_multiple_u64((uint64_t)l_state->stride, 4), VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4); } _SG_VALIDATE(desc->layout.attrs[0].format != SG_VERTEXFORMAT_INVALID, VALIDATE_PIPELINEDESC_NO_ATTRS); const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, desc->shader.id); @@ -15016,6 +15017,7 @@ _SOKOL_PRIVATE bool _sg_validate_update_buffer(const _sg_buffer_t* buf, const sg _SG_VALIDATE(buf->cmn.size >= (int)data->size, VALIDATE_UPDATEBUF_SIZE); _SG_VALIDATE(buf->cmn.update_frame_index != _sg.frame_index, VALIDATE_UPDATEBUF_ONCE); _SG_VALIDATE(buf->cmn.append_frame_index != _sg.frame_index, VALIDATE_UPDATEBUF_APPEND); + // FIXME: data->size must be a multiple of 4 return _sg_validate_end(); #endif } @@ -15034,6 +15036,7 @@ _SOKOL_PRIVATE bool _sg_validate_append_buffer(const _sg_buffer_t* buf, const sg _SG_VALIDATE(buf->cmn.usage != SG_USAGE_IMMUTABLE, VALIDATE_APPENDBUF_USAGE); _SG_VALIDATE(buf->cmn.size >= (buf->cmn.append_pos + (int)data->size), VALIDATE_APPENDBUF_SIZE); _SG_VALIDATE(buf->cmn.update_frame_index != _sg.frame_index, VALIDATE_APPENDBUF_UPDATE); + // FIXME: data->size must be a multiple of 4 return _sg_validate_end(); #endif } @@ -16652,11 +16655,13 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { const int start_pos = buf->cmn.append_pos; if (buf->slot.state == SG_RESOURCESTATE_VALID) { if (_sg_validate_append_buffer(buf, data)) { + SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (!buf->cmn.append_overflow && (data->size > 0)) { // update and append on same buffer in same frame not allowed SOKOL_ASSERT(buf->cmn.update_frame_index != _sg.frame_index); - int copied_num_bytes = _sg_append_buffer(buf, data, buf->cmn.append_frame_index != _sg.frame_index); - buf->cmn.append_pos += copied_num_bytes; + SOKOL_ASSERT(_sg_multiple_u64((uint64_t)buf->cmn.append_pos, 4)); + _sg_append_buffer(buf, data, buf->cmn.append_frame_index != _sg.frame_index); + buf->cmn.append_pos += (int)data->size; buf->cmn.append_frame_index = _sg.frame_index; } } From 3f00bf34cf11c22b71cef51b2f74d252456e96a8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 21 Aug 2023 14:38:36 +0200 Subject: [PATCH 141/292] sokol_gfx.h wgpu: fix buffer updates for sizes not multiple of 4 --- sokol_gfx.h | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 1f88af68b..8cce079d6 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5799,7 +5799,6 @@ _SOKOL_PRIVATE void _sg_dummy_draw(int base_element, int num_elements, int num_i _SOKOL_PRIVATE void _sg_dummy_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); _SOKOL_UNUSED(data); if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -5808,7 +5807,6 @@ _SOKOL_PRIVATE void _sg_dummy_update_buffer(_sg_buffer_t* buf, const sg_range* d _SOKOL_PRIVATE void _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); _SOKOL_UNUSED(data); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { @@ -8277,7 +8275,6 @@ _SOKOL_PRIVATE void _sg_gl_commit(void) { _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); // only one update per buffer per frame allowed if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -8296,7 +8293,6 @@ _SOKOL_PRIVATE void _sg_gl_update_buffer(_sg_buffer_t* buf, const sg_range* data _SOKOL_PRIVATE void _sg_gl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -10153,7 +10149,6 @@ _SOKOL_PRIVATE void _sg_d3d11_commit(void) { _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(_sg.d3d11.ctx); SOKOL_ASSERT(buf->d3d11.buf); D3D11_MAPPED_SUBRESOURCE d3d11_msr; @@ -10168,7 +10163,6 @@ _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* d _SOKOL_PRIVATE void _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(_sg.d3d11.ctx); SOKOL_ASSERT(buf->d3d11.buf); D3D11_MAP map_type = new_frame ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; @@ -11901,7 +11895,6 @@ _SOKOL_PRIVATE void _sg_mtl_draw(int base_element, int num_elements, int num_ins _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; } @@ -11917,7 +11910,6 @@ _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* dat _SOKOL_PRIVATE void _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (new_frame) { if (++buf->cmn.active_slot >= buf->cmn.num_slots) { buf->cmn.active_slot = 0; @@ -12560,6 +12552,26 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_buffer(_sg_buffer_t* buf) { } } +_SOKOL_PRIVATE void _sg_wgpu_copy_buffer_data(const _sg_buffer_t* buf, uint64_t offset, const sg_range* data) { + SOKOL_ASSERT((offset + data->size) <= (size_t)buf->cmn.size); + // WebGPU's write-buffer requires the size to be a multiple of four, so we may need to split the copy + // operation into two writeBuffer calls + uint64_t clamped_size = data->size & ~3UL; + uint64_t extra_size = data->size & 3UL; + SOKOL_ASSERT(extra_size < 4); + wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, offset, data->ptr, clamped_size); + if (extra_size > 0) { + const uint64_t extra_src_offset = clamped_size; + const uint64_t extra_dst_offset = offset + clamped_size; + uint8_t extra_data[4] = { 0 }; + uint8_t* extra_src_ptr = ((uint8_t*)data->ptr) + extra_src_offset; + for (size_t i = 0; i < extra_size; i++) { + extra_data[i] = extra_src_ptr[i]; + } + wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, extra_dst_offset, extra_src_ptr, 4); + } +} + _SOKOL_PRIVATE void _sg_wgpu_copy_image_data(const _sg_image_t* img, WGPUTexture wgpu_tex, const sg_image_data* data) { WGPUTextureDataLayout wgpu_layout; _sg_clear(&wgpu_layout, sizeof(wgpu_layout)); @@ -13312,17 +13324,14 @@ _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_in _SOKOL_PRIVATE void _sg_wgpu_update_buffer(_sg_buffer_t* buf, const sg_range* data) { SOKOL_ASSERT(data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); SOKOL_ASSERT(buf); - wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, 0, data->ptr, data->size); + _sg_wgpu_copy_buffer_data(buf, 0, data); } _SOKOL_PRIVATE void _sg_wgpu_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(data && data->ptr && (data->size > 0)); - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); - SOKOL_ASSERT(_sg_multiple_u64((uint64_t)buf->cmn.append_pos, 4)); _SOKOL_UNUSED(new_frame); - wgpuQueueWriteBuffer(_sg.wgpu.queue, buf->wgpu.buf, (uint64_t)buf->cmn.append_pos, data->ptr, data->size); + _sg_wgpu_copy_buffer_data(buf, (uint64_t)buf->cmn.append_pos, data); } _SOKOL_PRIVATE void _sg_wgpu_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -15017,7 +15026,6 @@ _SOKOL_PRIVATE bool _sg_validate_update_buffer(const _sg_buffer_t* buf, const sg _SG_VALIDATE(buf->cmn.size >= (int)data->size, VALIDATE_UPDATEBUF_SIZE); _SG_VALIDATE(buf->cmn.update_frame_index != _sg.frame_index, VALIDATE_UPDATEBUF_ONCE); _SG_VALIDATE(buf->cmn.append_frame_index != _sg.frame_index, VALIDATE_UPDATEBUF_APPEND); - // FIXME: data->size must be a multiple of 4 return _sg_validate_end(); #endif } @@ -15036,7 +15044,6 @@ _SOKOL_PRIVATE bool _sg_validate_append_buffer(const _sg_buffer_t* buf, const sg _SG_VALIDATE(buf->cmn.usage != SG_USAGE_IMMUTABLE, VALIDATE_APPENDBUF_USAGE); _SG_VALIDATE(buf->cmn.size >= (buf->cmn.append_pos + (int)data->size), VALIDATE_APPENDBUF_SIZE); _SG_VALIDATE(buf->cmn.update_frame_index != _sg.frame_index, VALIDATE_APPENDBUF_UPDATE); - // FIXME: data->size must be a multiple of 4 return _sg_validate_end(); #endif } @@ -16649,19 +16656,20 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { buf->cmn.append_pos = 0; buf->cmn.append_overflow = false; } - if ((buf->cmn.append_pos + _sg_roundup((int)data->size, 4)) > buf->cmn.size) { + if ((buf->cmn.append_pos + data->size) > (size_t)buf->cmn.size) { buf->cmn.append_overflow = true; } const int start_pos = buf->cmn.append_pos; + // NOTE: the multiple-of-4 requirement for the buffer offset is coming + // from WebGPU, but we want identical behaviour between backends + SOKOL_ASSERT(_sg_multiple_u64((uint64_t)start_pos, 4)); if (buf->slot.state == SG_RESOURCESTATE_VALID) { if (_sg_validate_append_buffer(buf, data)) { - SOKOL_ASSERT(_sg_multiple_u64(data->size, 4)); if (!buf->cmn.append_overflow && (data->size > 0)) { // update and append on same buffer in same frame not allowed SOKOL_ASSERT(buf->cmn.update_frame_index != _sg.frame_index); - SOKOL_ASSERT(_sg_multiple_u64((uint64_t)buf->cmn.append_pos, 4)); _sg_append_buffer(buf, data, buf->cmn.append_frame_index != _sg.frame_index); - buf->cmn.append_pos += (int)data->size; + buf->cmn.append_pos += (int) _sg_roundup_u64(data->size, 4); buf->cmn.append_frame_index = _sg.frame_index; } } From d2d6d4762f2984e98eb5b4aeea7d806f933e46ea Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 21 Aug 2023 16:06:22 +0200 Subject: [PATCH 142/292] sokol_gfx.h wgpu: fix injected samplers, expose some wgpu objects in public api --- sokol_gfx.h | 115 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 79 insertions(+), 36 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 8cce079d6..3c77db269 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3451,12 +3451,18 @@ SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); - // Metal: return __bridge-casted MTLDevice SOKOL_GFX_API_DECL const void* sg_mtl_device(void); - // Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) SOKOL_GFX_API_DECL const void* sg_mtl_render_command_encoder(void); +// WebGPU: return WGPUDevice object +SOKOL_GFX_API_DECL const void* sg_wgpu_device(void); +// WebGPU: return WGPUQueue object +SOKOL_GFX_API_DECL const void* sg_wgpu_queue(void); +// WebGPU: return this frame's WGPUCommandEncoder +SOKOL_GFX_API_DECL const void* sg_wgpu_command_encoder(void); +// WebGPU: return WGPURenderPassEncoder of currrent pass +SOKOL_GFX_API_DECL const void* sg_wgpu_render_pass_encoder(void); #ifdef __cplusplus } // extern "C" @@ -4910,7 +4916,7 @@ typedef struct { int cur_height; WGPUSupportedLimits limits; WGPUQueue queue; - WGPUCommandEncoder render_cmd_enc; + WGPUCommandEncoder cmd_enc; WGPURenderPassEncoder pass_enc; WGPUBindGroup empty_bind_group; const _sg_pipeline_t* cur_pipeline; @@ -12475,17 +12481,17 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { // create initial per-frame command encoder WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); - _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); - SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); + _sg.wgpu.cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); + SOKOL_ASSERT(_sg.wgpu.cmd_enc); } _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); - SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); + SOKOL_ASSERT(_sg.wgpu.cmd_enc); _sg.wgpu.valid = false; _sg_wgpu_uniform_buffer_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; - wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); _sg.wgpu.render_cmd_enc = 0; + wgpuCommandEncoderRelease(_sg.wgpu.cmd_enc); _sg.wgpu.cmd_enc = 0; wgpuQueueRelease(_sg.wgpu.queue); _sg.wgpu.queue = 0; } @@ -12671,26 +12677,32 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { SOKOL_ASSERT(smp && desc); SOKOL_ASSERT(_sg.wgpu.dev); - WGPUSamplerDescriptor wgpu_desc; - _sg_clear(&wgpu_desc, sizeof(wgpu_desc)); - wgpu_desc.label = desc->label; - wgpu_desc.addressModeU = _sg_wgpu_sampler_address_mode(desc->wrap_u); - wgpu_desc.addressModeV = _sg_wgpu_sampler_address_mode(desc->wrap_v); - wgpu_desc.addressModeW = _sg_wgpu_sampler_address_mode(desc->wrap_w); - wgpu_desc.magFilter = _sg_wgpu_sampler_minmag_filter(desc->mag_filter); - wgpu_desc.minFilter = _sg_wgpu_sampler_minmag_filter(desc->min_filter); - wgpu_desc.mipmapFilter = _sg_wgpu_sampler_mipmap_filter(desc->mipmap_filter); - wgpu_desc.lodMinClamp = desc->min_lod; - wgpu_desc.lodMaxClamp = desc->max_lod; - wgpu_desc.compare = _sg_wgpu_comparefunc(desc->compare); - if (wgpu_desc.compare == WGPUCompareFunction_Never) { - wgpu_desc.compare = WGPUCompareFunction_Undefined; - } - wgpu_desc.maxAnisotropy = (uint16_t)desc->max_anisotropy; - smp->wgpu.smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &wgpu_desc); - if (0 == smp->wgpu.smp) { - _SG_ERROR(WGPU_CREATE_SAMPLER_FAILED); - return SG_RESOURCESTATE_FAILED; + const bool injected = (0 != desc->wgpu_sampler); + if (injected) { + smp->wgpu.smp = (WGPUSampler) desc->wgpu_sampler; + wgpuSamplerReference(smp->wgpu.smp); + } else { + WGPUSamplerDescriptor wgpu_desc; + _sg_clear(&wgpu_desc, sizeof(wgpu_desc)); + wgpu_desc.label = desc->label; + wgpu_desc.addressModeU = _sg_wgpu_sampler_address_mode(desc->wrap_u); + wgpu_desc.addressModeV = _sg_wgpu_sampler_address_mode(desc->wrap_v); + wgpu_desc.addressModeW = _sg_wgpu_sampler_address_mode(desc->wrap_w); + wgpu_desc.magFilter = _sg_wgpu_sampler_minmag_filter(desc->mag_filter); + wgpu_desc.minFilter = _sg_wgpu_sampler_minmag_filter(desc->min_filter); + wgpu_desc.mipmapFilter = _sg_wgpu_sampler_mipmap_filter(desc->mipmap_filter); + wgpu_desc.lodMinClamp = desc->min_lod; + wgpu_desc.lodMaxClamp = desc->max_lod; + wgpu_desc.compare = _sg_wgpu_comparefunc(desc->compare); + if (wgpu_desc.compare == WGPUCompareFunction_Never) { + wgpu_desc.compare = WGPUCompareFunction_Undefined; + } + wgpu_desc.maxAnisotropy = (uint16_t)desc->max_anisotropy; + smp->wgpu.smp = wgpuDeviceCreateSampler(_sg.wgpu.dev, &wgpu_desc); + if (0 == smp->wgpu.smp) { + _SG_ERROR(WGPU_CREATE_SAMPLER_FAILED); + return SG_RESOURCESTATE_FAILED; + } } return SG_RESOURCESTATE_VALID; } @@ -13073,7 +13085,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_ds_att(WGPURenderPassDepthStencilAttachment* w _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* action, int w, int h) { SOKOL_ASSERT(action); SOKOL_ASSERT(!_sg.wgpu.in_pass); - SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); + SOKOL_ASSERT(_sg.wgpu.cmd_enc); SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.render_view_cb || _sg.wgpu.render_view_userdata_cb); SOKOL_ASSERT(_sg.wgpu.resolve_view_cb || _sg.wgpu.resolve_view_userdata_cb); @@ -13084,7 +13096,6 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.cur_pipeline = 0; _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; - SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); WGPURenderPassDescriptor wgpu_pass_desc; WGPURenderPassColorAttachment wgpu_color_att[SG_MAX_COLOR_ATTACHMENTS]; WGPURenderPassDepthStencilAttachment wgpu_ds_att; @@ -13114,7 +13125,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* } wgpu_pass_desc.depthStencilAttachment = &wgpu_ds_att; } - _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.render_cmd_enc, &wgpu_pass_desc); + _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.cmd_enc, &wgpu_pass_desc); SOKOL_ASSERT(_sg.wgpu.pass_enc); // initial uniform buffer binding (required even if no uniforms are set in the frame) @@ -13132,14 +13143,14 @@ _SOKOL_PRIVATE void _sg_wgpu_end_pass(void) { _SOKOL_PRIVATE void _sg_wgpu_commit(void) { SOKOL_ASSERT(!_sg.wgpu.in_pass); - SOKOL_ASSERT(_sg.wgpu.render_cmd_enc); + SOKOL_ASSERT(_sg.wgpu.cmd_enc); WGPUCommandBufferDescriptor cmd_buf_desc; _sg_clear(&cmd_buf_desc, sizeof(cmd_buf_desc)); - WGPUCommandBuffer wgpu_cmd_buf = wgpuCommandEncoderFinish(_sg.wgpu.render_cmd_enc, &cmd_buf_desc); + WGPUCommandBuffer wgpu_cmd_buf = wgpuCommandEncoderFinish(_sg.wgpu.cmd_enc, &cmd_buf_desc); SOKOL_ASSERT(wgpu_cmd_buf); - wgpuCommandEncoderRelease(_sg.wgpu.render_cmd_enc); - _sg.wgpu.render_cmd_enc = 0; + wgpuCommandEncoderRelease(_sg.wgpu.cmd_enc); + _sg.wgpu.cmd_enc = 0; wgpuQueueSubmit(_sg.wgpu.queue, 1, &wgpu_cmd_buf); wgpuCommandBufferRelease(wgpu_cmd_buf); @@ -13147,7 +13158,7 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { // create a new render-command-encoder for next frame WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); - _sg.wgpu.render_cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); + _sg.wgpu.cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); // reset uniform buffer offsets _sg_wgpu_uniform_buffer_on_commit(); @@ -16656,7 +16667,7 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { buf->cmn.append_pos = 0; buf->cmn.append_overflow = false; } - if ((buf->cmn.append_pos + data->size) > (size_t)buf->cmn.size) { + if (((size_t)buf->cmn.append_pos + data->size) > (size_t)buf->cmn.size) { buf->cmn.append_overflow = true; } const int start_pos = buf->cmn.append_pos; @@ -17038,6 +17049,38 @@ SOKOL_API_IMPL const void* sg_mtl_render_command_encoder(void) { #endif } +SOKOL_API_IMPL const void* sg_wgpu_device(void) { + #if defined(SOKOL_WGPU) + return _sg.wgpu.dev; + #else + return 0; + #endif +} + +SOKOL_API_IMPL const void* sg_wgpu_queue(void) { + #if defined(SOKOL_WGPU) + return _sg.wgpu.queue; + #else + return 0; + #endif +} + +SOKOL_API_IMPL const void* sg_wgpu_command_encoder(void) { + #if defined(SOKOL_WGPU) + return _sg.wgpu.cmd_enc; + #else + return 0; + #endif +} + +SOKOL_API_IMPL const void* sg_wgpu_render_pass_encoder(void) { + #if defined(SOKOL_WGPU) + return _sg.wgpu.pass_enc; + #else + return 0; + #endif +} + #ifdef _MSC_VER #pragma warning(pop) #endif From 660401c96a0df7f3ebe8f1e9e5391ca870c0ed46 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 25 Aug 2023 17:41:15 +0200 Subject: [PATCH 143/292] sokol_gfx.h mtl: new attempt to fix swapchain lifetime issues See https://github.com/floooh/sokol/issues/872 This does away with the separate retained-reference command buffer for the present call, and instead uses the regular 'deferred release queue' for the default pass MTLRenderPassDescriptor. Since the render-pass-descriptor holds a strong-ref to swapchain surfaces this should make sure that those surfaces outlive their command buffer when they are released by MTKView because of a window resize. This means there's a memory spike during window resize, but I guess there's no way around that. --- sokol_gfx.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 19a29d6b4..055c636d2 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4787,7 +4787,6 @@ typedef struct { id device; id cmd_queue; id cmd_buffer; - id present_cmd_buffer; id cmd_encoder; id uniform_buffers[SG_NUM_INFLIGHT_FRAMES]; } _sg_mtl_backend_t; @@ -10599,7 +10598,8 @@ _SOKOL_PRIVATE void _sg_mtl_init_pool(const sg_desc* desc) { 1 * desc->sampler_pool_size + 4 * desc->shader_pool_size + 2 * desc->pipeline_pool_size + - desc->pass_pool_size + desc->pass_pool_size + + 128 ); _sg.mtl.idpool.pool = [NSMutableArray arrayWithCapacity:(NSUInteger)_sg.mtl.idpool.num_slots]; _SG_OBJC_RETAIN(_sg.mtl.idpool.pool); @@ -10924,7 +10924,6 @@ _SOKOL_PRIVATE void _sg_mtl_discard_backend(void) { } // NOTE: MTLCommandBuffer and MTLRenderCommandEncoder are auto-released _sg.mtl.cmd_buffer = nil; - _sg.mtl.present_cmd_buffer = nil; _sg.mtl.cmd_encoder = nil; } @@ -11489,14 +11488,11 @@ _SOKOL_PRIVATE void _sg_mtl_begin_pass(_sg_pass_t* pass, const sg_pass_action* a Also see: https://github.com/floooh/sokol/issues/762 */ if (nil == _sg.mtl.cmd_buffer) { - SOKOL_ASSERT(nil == _sg.mtl.present_cmd_buffer); // block until the oldest frame in flight has finished dispatch_semaphore_wait(_sg.mtl.sem, DISPATCH_TIME_FOREVER); _sg.mtl.cmd_buffer = [_sg.mtl.cmd_queue commandBufferWithUnretainedReferences]; - _sg.mtl.present_cmd_buffer = [_sg.mtl.cmd_queue commandBuffer]; [_sg.mtl.cmd_buffer enqueue]; - [_sg.mtl.present_cmd_buffer enqueue]; - [_sg.mtl.present_cmd_buffer addCompletedHandler:^(id cmd_buf) { + [_sg.mtl.cmd_buffer addCompletedHandler:^(id cmd_buf) { // NOTE: this code is called on a different thread! _SOKOL_UNUSED(cmd_buf); dispatch_semaphore_signal(_sg.mtl.sem); @@ -11520,6 +11516,10 @@ _SOKOL_PRIVATE void _sg_mtl_begin_pass(_sg_pass_t* pass, const sg_pass_action* a } else { pass_desc = (__bridge MTLRenderPassDescriptor*) _sg.mtl.renderpass_descriptor_userdata_cb(_sg.mtl.user_data); } + // pin the swapchain resources into memory so that they outlive their command buffer + // (this is necessary because the command buffer doesn't retain references) + int default_pass_desc_ref = _sg_mtl_add_resource(pass_desc); + _sg_mtl_release_resource(_sg.mtl.frame_index, default_pass_desc_ref); } if (pass_desc) { _sg.mtl.pass_valid = true; @@ -11651,7 +11651,6 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { SOKOL_ASSERT(_sg.mtl.drawable_cb || _sg.mtl.drawable_userdata_cb); SOKOL_ASSERT(nil == _sg.mtl.cmd_encoder); SOKOL_ASSERT(nil != _sg.mtl.cmd_buffer); - SOKOL_ASSERT(nil != _sg.mtl.present_cmd_buffer); // present, commit and signal semaphore when done id cur_drawable = nil; @@ -11661,10 +11660,9 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { cur_drawable = (__bridge id) _sg.mtl.drawable_userdata_cb(_sg.mtl.user_data); } if (nil != cur_drawable) { - [_sg.mtl.present_cmd_buffer presentDrawable:cur_drawable]; + [_sg.mtl.cmd_buffer presentDrawable:cur_drawable]; } [_sg.mtl.cmd_buffer commit]; - [_sg.mtl.present_cmd_buffer commit]; // garbage-collect resources pending for release _sg_mtl_garbage_collect(_sg.mtl.frame_index); @@ -11678,7 +11676,6 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { _sg.mtl.cur_ub_base_ptr = 0; // NOTE: MTLCommandBuffer is autoreleased _sg.mtl.cmd_buffer = nil; - _sg.mtl.present_cmd_buffer = nil; } _SOKOL_PRIVATE void _sg_mtl_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { From 6a7a6b3f03e8079fb4bfbb847d5d30839a860d9e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 25 Aug 2023 19:20:46 +0200 Subject: [PATCH 144/292] sokol_gfx.h wgpu: rewrite image/sampler binding use single bindgroup per pipeline --- sokol_gfx.h | 183 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 109 insertions(+), 74 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3c77db269..09b52f90e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4806,10 +4806,9 @@ typedef struct { #define _SG_WGPU_ROWPITCH_ALIGN (256) #define _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE (1<<16) // also see WGPULimits.maxUniformBufferBindingSize -#define _SG_WGPU_NUM_BINDGROUPS (3) // 0: uniforms, 1: vertex stage images & samplers, 2: fragment stage images & samplers -#define _SG_WGPU_UNIFORMS_BINDGROUP_INDEX (0) -#define _SG_WGPU_VS_BINDGROUP_INDEX (1) -#define _SG_WGPU_FS_BINDGROUP_INDEX (2) +#define _SG_WGPU_NUM_BINDGROUPS (2) // 0: uniforms, 1: images and sampler on both shader stages +#define _SG_WGPU_UNIFORM_BINDGROUP_INDEX (0) +#define _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX (1) typedef struct { _sg_slot_t slot; @@ -4841,7 +4840,6 @@ typedef _sg_wgpu_sampler_t _sg_sampler_t; typedef struct { WGPUShaderModule module; - WGPUBindGroupLayout bind_group_layout; _sg_str_t entry; } _sg_wgpu_shader_stage_t; @@ -4850,6 +4848,7 @@ typedef struct { _sg_shader_common_t cmn; struct { _sg_wgpu_shader_stage_t stage[SG_NUM_SHADER_STAGES]; + WGPUBindGroupLayout bind_group_layout; } wgpu; } _sg_wgpu_shader_t; typedef _sg_wgpu_shader_t _sg_shader_t; @@ -12290,6 +12289,40 @@ _SOKOL_PRIVATE WGPUColorWriteMaskFlags _sg_wgpu_colorwritemask(uint8_t m) { return res; } +// image/sampler binding on wgpu follows this convention: +// +// - all images and sampler are in @group(1) +// - vertex stage images start at @binding(0) +// - vertex stage samplers start at @binding(16) +// - fragment stage images start at @binding(32) +// - fragment stage samplers start at @binding(48) +// +_SOKOL_PRIVATE uint32_t _sg_wgpu_image_binding(sg_shader_stage stage, int img_slot) { + SOKOL_ASSERT((img_slot >= 0) && (img_slot < 16)); + if (SG_SHADERSTAGE_VS == stage) { + return 0 + (uint32_t)img_slot; + } else { + return 32 + (uint32_t)img_slot; + } +} + +_SOKOL_PRIVATE uint32_t _sg_wgpu_sampler_binding(sg_shader_stage stage, int smp_slot) { + SOKOL_ASSERT((smp_slot >= 0) && (smp_slot < 16)); + if (SG_SHADERSTAGE_VS == stage) { + return 16 + (uint32_t)smp_slot; + } else { + return 48 + (uint32_t)smp_slot; + } +} + +_SOKOL_PRIVATE WGPUShaderStage _sg_wgpu_shader_stage(sg_shader_stage stage) { + switch (stage) { + case SG_SHADERSTAGE_VS: return WGPUShaderStage_Vertex; + case SG_SHADERSTAGE_FS: return WGPUShaderStage_Fragment; + default: SOKOL_UNREACHABLE; return WGPUShaderStage_None; + } +} + _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.backend = SG_BACKEND_WGPU; _sg.features.origin_top_left = true; @@ -12719,6 +12752,9 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const SOKOL_ASSERT(shd && desc); SOKOL_ASSERT(desc->vs.source && desc->fs.source); + #define _sg_wgpu_create_shader_max_bgl_entries (SG_NUM_SHADER_STAGES * (SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS)) + WGPUBindGroupLayoutEntry wgpu_bgl_entries[_sg_wgpu_create_shader_max_bgl_entries]; + int bgl_index = 0; for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS) ? &desc->vs : &desc->fs; @@ -12742,10 +12778,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const return SG_RESOURCESTATE_FAILED; } - // create image/sampler bind group layout: - // - first all images - // - followed by all samplers - WGPUShaderStage wgpu_shader_stage = (stage_index == SG_SHADERSTAGE_VS) ? WGPUShaderStage_Vertex : WGPUShaderStage_Fragment; const int num_images = cmn_stage->num_images; if (num_images > (int)_sg.wgpu.limits.limits.maxSampledTexturesPerShaderStage) { _SG_ERROR(WGPU_SHADER_TOO_MANY_IMAGES); @@ -12756,59 +12788,60 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const _SG_ERROR(WGPU_SHADER_TOO_MANY_SAMPLERS); return SG_RESOURCESTATE_FAILED; } - WGPUBindGroupLayoutEntry wgpu_bgl_entries[SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; _sg_clear(wgpu_bgl_entries, sizeof(wgpu_bgl_entries)); for (int img_index = 0; img_index < num_images; img_index++) { - const int bind_index = img_index; - WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bind_index]; + SOKOL_ASSERT(bgl_index < _sg_wgpu_create_shader_max_bgl_entries); + WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bgl_index++]; const sg_shader_image_desc* img_desc = &stage_desc->images[img_index]; - wgpu_bgl_entry->binding = (uint32_t)bind_index; - wgpu_bgl_entry->visibility = wgpu_shader_stage; + wgpu_bgl_entry->binding = _sg_wgpu_image_binding((sg_shader_stage)stage_index, img_index); + wgpu_bgl_entry->visibility = _sg_wgpu_shader_stage((sg_shader_stage)stage_index); wgpu_bgl_entry->texture.viewDimension = _sg_wgpu_texture_view_dimension(img_desc->image_type); wgpu_bgl_entry->texture.sampleType = _sg_wgpu_texture_sample_type(img_desc->sample_type); wgpu_bgl_entry->texture.multisampled = img_desc->multisampled; } for (int smp_index = 0; smp_index < num_samplers; smp_index++) { - const int bind_index = num_images + smp_index; - WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bind_index]; + SOKOL_ASSERT(bgl_index < _sg_wgpu_create_shader_max_bgl_entries); + WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bgl_index++]; const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[smp_index]; - wgpu_bgl_entry->binding = (uint32_t)bind_index; - wgpu_bgl_entry->visibility = wgpu_shader_stage; + wgpu_bgl_entry->binding =_sg_wgpu_sampler_binding((sg_shader_stage)stage_index, smp_index); + wgpu_bgl_entry->visibility = _sg_wgpu_shader_stage((sg_shader_stage)stage_index); wgpu_bgl_entry->sampler.type = _sg_wgpu_sampler_binding_type(smp_desc->sampler_type); } - WGPUBindGroupLayoutDescriptor wgpu_bgl_desc; - _sg_clear(&wgpu_bgl_desc, sizeof(wgpu_bgl_desc)); - wgpu_bgl_desc.entryCount = (size_t)(num_images + num_samplers); - wgpu_bgl_desc.entries = &wgpu_bgl_entries[0]; - wgpu_stage->bind_group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &wgpu_bgl_desc); - if (wgpu_stage->bind_group_layout == 0) { - _SG_ERROR(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED); - return SG_RESOURCESTATE_FAILED; - } } + + WGPUBindGroupLayoutDescriptor wgpu_bgl_desc; + _sg_clear(&wgpu_bgl_desc, sizeof(wgpu_bgl_desc)); + wgpu_bgl_desc.entryCount = (size_t)bgl_index; + wgpu_bgl_desc.entries = &wgpu_bgl_entries[0]; + shd->wgpu.bind_group_layout = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &wgpu_bgl_desc); + if (shd->wgpu.bind_group_layout == 0) { + _SG_ERROR(WGPU_SHADER_CREATE_BINDGROUP_LAYOUT_FAILED); + return SG_RESOURCESTATE_FAILED; + } + + #undef _sg_wgpu_create_shader_max_bgl_entries return SG_RESOURCESTATE_VALID; } _SOKOL_PRIVATE void _sg_wgpu_discard_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd); + if (shd->wgpu.bind_group_layout) { + wgpuBindGroupLayoutRelease(shd->wgpu.bind_group_layout); + shd->wgpu.bind_group_layout = 0; + } for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { _sg_wgpu_shader_stage_t* wgpu_stage = &shd->wgpu.stage[stage_index]; if (wgpu_stage->module) { wgpuShaderModuleRelease(wgpu_stage->module); wgpu_stage->module = 0; } - if (wgpu_stage->bind_group_layout) { - wgpuBindGroupLayoutRelease(wgpu_stage->bind_group_layout); - wgpu_stage->bind_group_layout = 0; - } } } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { SOKOL_ASSERT(pip && shd && desc); SOKOL_ASSERT(desc->shader.id == shd->slot.id); - SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout); - SOKOL_ASSERT(shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout); + SOKOL_ASSERT(shd->wgpu.bind_group_layout); pip->shader = shd; pip->wgpu.blend_color.r = (double) desc->blend_color.r; @@ -12816,13 +12849,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ pip->wgpu.blend_color.b = (double) desc->blend_color.b; pip->wgpu.blend_color.a = (double) desc->blend_color.a; - // - 1 bindgroup for uniform block, - // - 1 bindgroup for vertex shader resources - // - 1 bindgroup for fragment shader resources + // - @group(0) for uniform blocks + // - @group(1) for all image and sampler resources WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS]; - wgpu_bgl[_SG_WGPU_UNIFORMS_BINDGROUP_INDEX] = _sg.wgpu.uniform.bind.group_layout; - wgpu_bgl[_SG_WGPU_VS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; - wgpu_bgl[_SG_WGPU_FS_BINDGROUP_INDEX] = shd->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout; + wgpu_bgl[_SG_WGPU_UNIFORM_BINDGROUP_INDEX] = _sg.wgpu.uniform.bind.group_layout; + wgpu_bgl[_SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX] = shd->wgpu.bind_group_layout; WGPUPipelineLayoutDescriptor wgpu_pl_desc; _sg_clear(&wgpu_pl_desc, sizeof(wgpu_pl_desc)); wgpu_pl_desc.bindGroupLayoutCount = _SG_WGPU_NUM_BINDGROUPS; @@ -13214,31 +13245,44 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { _SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_bindgroup( WGPUBindGroupLayout bgl, - _sg_image_t** imgs, int num_imgs, - _sg_sampler_t** smps, int num_smps) + _sg_image_t** vs_imgs, int num_vs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** fs_smps, int num_fs_smps) { SOKOL_ASSERT(_sg.wgpu.dev); - SOKOL_ASSERT(imgs && (num_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); - SOKOL_ASSERT(smps && (num_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); + SOKOL_ASSERT(vs_imgs && (num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); + SOKOL_ASSERT(vs_smps && (num_vs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); + SOKOL_ASSERT(fs_imgs && (num_fs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); + SOKOL_ASSERT(fs_smps && (num_fs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); - WGPUBindGroupEntry wgpu_entries[SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; + WGPUBindGroupEntry wgpu_entries[2 * SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; _sg_clear(&wgpu_entries, sizeof(wgpu_entries)); - for (int img_index = 0; img_index < num_imgs; img_index++) { - uint32_t wgpu_bind_index = (uint32_t)img_index; - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[wgpu_bind_index]; - wgpu_entry->binding = wgpu_bind_index; - wgpu_entry->textureView = imgs[img_index]->wgpu.view; - } - for (int smp_index = 0; smp_index < num_smps; smp_index++) { - uint32_t wgpu_bind_index = (uint32_t)(num_imgs + smp_index); - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[wgpu_bind_index]; - wgpu_entry->binding = wgpu_bind_index; - wgpu_entry->sampler = smps[smp_index]->wgpu.smp; + int bge_index = 0; + for (int i = 0; i < num_vs_imgs; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_VS, i); + wgpu_entry->textureView = vs_imgs[i]->wgpu.view; + } + for (int i = 0; i < num_vs_smps; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_VS, i); + wgpu_entry->sampler = vs_smps[i]->wgpu.smp; + } + for (int i = 0; i < num_fs_imgs; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_FS, i); + wgpu_entry->textureView = fs_imgs[i]->wgpu.view; + } + for (int i = 0; i < num_fs_smps; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_FS, i); + wgpu_entry->sampler = fs_smps[i]->wgpu.smp; } WGPUBindGroupDescriptor bg_desc; _sg_clear(&bg_desc, sizeof(bg_desc)); bg_desc.layout = bgl; - bg_desc.entryCount = (size_t)(num_imgs + num_smps); + bg_desc.entryCount = (size_t)bge_index; bg_desc.entries = &wgpu_entries[0]; WGPUBindGroup bg = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); SOKOL_ASSERT(bg); @@ -13277,25 +13321,16 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, slot, vbs[slot]->wgpu.buf, offset, max_bytes); } - // FIXME: create adhoc bind group objects for images and samplers per stage + // FIXME: create adhoc bind group object for images and samplers // (either use a bindgroup-cache or introduce bindgroups as sokol-gfx objects) - if ((num_vs_imgs + num_vs_smps) > 0) { - WGPUBindGroupLayout vs_bgl = pip->shader->wgpu.stage[SG_SHADERSTAGE_VS].bind_group_layout; - SOKOL_ASSERT(vs_bgl); - WGPUBindGroup vs_bg = _sg_wgpu_create_bindgroup(vs_bgl, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_VS_BINDGROUP_INDEX, vs_bg, 0, 0); - wgpuBindGroupRelease(vs_bg); - } else { - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_VS_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); - } - if ((num_fs_imgs + num_fs_smps) > 0) { - WGPUBindGroupLayout fs_bgl = pip->shader->wgpu.stage[SG_SHADERSTAGE_FS].bind_group_layout; - SOKOL_ASSERT(fs_bgl); - WGPUBindGroup fs_bg = _sg_wgpu_create_bindgroup(fs_bgl, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_FS_BINDGROUP_INDEX, fs_bg, 0, 0); - wgpuBindGroupRelease(fs_bg); + if ((num_vs_imgs + num_vs_smps + num_fs_imgs + num_fs_smps) > 0) { + WGPUBindGroupLayout bgl = pip->shader->wgpu.bind_group_layout; + SOKOL_ASSERT(bgl); + WGPUBindGroup bg = _sg_wgpu_create_bindgroup(bgl, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg, 0, 0); + wgpuBindGroupRelease(bg); } else { - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_FS_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); } } @@ -13315,7 +13350,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, - _SG_WGPU_UNIFORMS_BINDGROUP_INDEX, + _SG_WGPU_UNIFORM_BINDGROUP_INDEX, _sg.wgpu.uniform.bind.group, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.uniform.bind.offsets[0][0]); From 4a2e1747c226d62fcd7453559eed7629c5515f61 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 26 Aug 2023 17:52:32 +0200 Subject: [PATCH 145/292] sokol_gfx.h wgpu: minor cleanup --- sokol_gfx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 09b52f90e..41a5d9bce 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12852,6 +12852,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ // - @group(0) for uniform blocks // - @group(1) for all image and sampler resources WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS]; + _sg_clear(&wgpu_bgl, sizeof(wgpu_bgl)); wgpu_bgl[_SG_WGPU_UNIFORM_BINDGROUP_INDEX] = _sg.wgpu.uniform.bind.group_layout; wgpu_bgl[_SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX] = shd->wgpu.bind_group_layout; WGPUPipelineLayoutDescriptor wgpu_pl_desc; From 8d7460cc2ac133c63eb31df02de3973954f3ed43 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 27 Aug 2023 10:29:37 +0200 Subject: [PATCH 146/292] sokol_gfx.h metal: remove redundant frame_index in _sg_mtl_backend_t --- sokol_gfx.h | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 41a5d9bce..6c9ff8263 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4782,7 +4782,6 @@ typedef struct { const void*(*drawable_cb)(void); const void*(*drawable_userdata_cb)(void*); void* user_data; - uint32_t frame_index; uint32_t cur_frame_rotate_index; int ub_size; int cur_ub_offset; @@ -10886,7 +10885,6 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { _sg.mtl.drawable_cb = desc->context.metal.drawable_cb; _sg.mtl.drawable_userdata_cb = desc->context.metal.drawable_userdata_cb; _sg.mtl.user_data = desc->context.metal.user_data; - _sg.mtl.frame_index = 1; _sg.mtl.ub_size = desc->uniform_buffer_size; _sg.mtl.sem = dispatch_semaphore_create(SG_NUM_INFLIGHT_FRAMES); _sg.mtl.device = (__bridge id) desc->context.metal.device; @@ -10920,7 +10918,7 @@ _SOKOL_PRIVATE void _sg_mtl_discard_backend(void) { for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { dispatch_semaphore_signal(_sg.mtl.sem); } - _sg_mtl_garbage_collect(_sg.mtl.frame_index + SG_NUM_INFLIGHT_FRAMES + 2); + _sg_mtl_garbage_collect(_sg.frame_index + SG_NUM_INFLIGHT_FRAMES + 2); _sg_mtl_destroy_pool(); _sg.mtl.valid = false; @@ -11002,7 +11000,7 @@ _SOKOL_PRIVATE void _sg_mtl_discard_buffer(_sg_buffer_t* buf) { SOKOL_ASSERT(buf); for (int slot = 0; slot < buf->cmn.num_slots; slot++) { // it's valid to call release resource with '0' - _sg_mtl_release_resource(_sg.mtl.frame_index, buf->mtl.buf[slot]); + _sg_mtl_release_resource(_sg.frame_index, buf->mtl.buf[slot]); } } @@ -11146,7 +11144,7 @@ _SOKOL_PRIVATE void _sg_mtl_discard_image(_sg_image_t* img) { SOKOL_ASSERT(img); // it's valid to call release resource with a 'null resource' for (int slot = 0; slot < img->cmn.num_slots; slot++) { - _sg_mtl_release_resource(_sg.mtl.frame_index, img->mtl.tex[slot]); + _sg_mtl_release_resource(_sg.frame_index, img->mtl.tex[slot]); } } @@ -11187,7 +11185,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, cons _SOKOL_PRIVATE void _sg_mtl_discard_sampler(_sg_sampler_t* smp) { SOKOL_ASSERT(smp); // it's valid to call release resource with a 'null resource' - _sg_mtl_release_resource(_sg.mtl.frame_index, smp->mtl.sampler_state); + _sg_mtl_release_resource(_sg.frame_index, smp->mtl.sampler_state); } _SOKOL_PRIVATE id _sg_mtl_compile_library(const char* src) { @@ -11284,10 +11282,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const _SOKOL_PRIVATE void _sg_mtl_discard_shader(_sg_shader_t* shd) { SOKOL_ASSERT(shd); // it is valid to call _sg_mtl_release_resource with a 'null resource' - _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func); - _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib); - _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func); - _sg_mtl_release_resource(_sg.mtl.frame_index, shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib); + _sg_mtl_release_resource(_sg.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func); + _sg_mtl_release_resource(_sg.frame_index, shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib); + _sg_mtl_release_resource(_sg.frame_index, shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func); + _sg_mtl_release_resource(_sg.frame_index, shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib); } _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _sg_shader_t* shd, const sg_pipeline_desc* desc) { @@ -11415,8 +11413,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s _SOKOL_PRIVATE void _sg_mtl_discard_pipeline(_sg_pipeline_t* pip) { SOKOL_ASSERT(pip); // it's valid to call release resource with a 'null resource' - _sg_mtl_release_resource(_sg.mtl.frame_index, pip->mtl.rps); - _sg_mtl_release_resource(_sg.mtl.frame_index, pip->mtl.dss); + _sg_mtl_release_resource(_sg.frame_index, pip->mtl.rps); + _sg_mtl_release_resource(_sg.frame_index, pip->mtl.dss); } _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pass(_sg_pass_t* pass, _sg_image_t** color_images, _sg_image_t** resolve_images, _sg_image_t* ds_img, const sg_pass_desc* desc) { @@ -11675,13 +11673,12 @@ _SOKOL_PRIVATE void _sg_mtl_commit(void) { [_sg.mtl.present_cmd_buffer commit]; // garbage-collect resources pending for release - _sg_mtl_garbage_collect(_sg.mtl.frame_index); + _sg_mtl_garbage_collect(_sg.frame_index); // rotate uniform buffer slot if (++_sg.mtl.cur_frame_rotate_index >= SG_NUM_INFLIGHT_FRAMES) { _sg.mtl.cur_frame_rotate_index = 0; } - _sg.mtl.frame_index++; _sg.mtl.cur_ub_offset = 0; _sg.mtl.cur_ub_base_ptr = 0; // NOTE: MTLCommandBuffer is autoreleased From 692a38961d094dbbc953a32dcbe1eb578561a362 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 27 Aug 2023 22:07:16 +0200 Subject: [PATCH 147/292] sokol_gfx.h wgpu: workaround missing return value of Emscripten's wgpuDeviceGetLimits() shim --- sokol_gfx.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 6c9ff8263..c4cb3952c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12327,8 +12327,9 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.features.mrt_independent_blend_state = true; _sg.features.mrt_independent_write_mask = true; - bool success = wgpuDeviceGetLimits(_sg.wgpu.dev, &_sg.wgpu.limits); - SOKOL_ASSERT(success); _SOKOL_UNUSED(success); + // FIXME: in webgpu.h, wgpuDeviceGetLimits() has a boolean return value, but + // the JS shim doesn't actually return anything + wgpuDeviceGetLimits(_sg.wgpu.dev, &_sg.wgpu.limits); const WGPULimits* l = &_sg.wgpu.limits.limits; _sg.limits.max_image_size_2d = (int) l->maxTextureDimension2D; From 03c0efd842e884dd4e973f23f5874f0f28b7a71a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 12:19:58 +0200 Subject: [PATCH 148/292] fix ci scripts for odin installation --- .github/workflows/gen_bindings.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index c1c45d6dd..7d96ae860 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -165,16 +165,16 @@ jobs: name: prepare-linux run: | sudo apt-get update - sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev llvm-11 - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-ubuntu-amd64-dev-2023-07.zip --output odin.zip + sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev llvm-14 + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-ubuntu-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_linux.sh - if: runner.os == 'macOS' name: prepare-macos run: | - brew install llvm@11 - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-macos-amd64-dev-2023-07.zip --output odin.zip + brew install llvm@14 + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-macos-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_macos.sh @@ -182,7 +182,7 @@ jobs: name: prepare-windows shell: cmd run: | - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-07/odin-windows-amd64-dev-2023-07.zip --output odin.zip + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-windows-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip build_clibs_windows.cmd - name: build From 58d9f411f3cba791c592ca8e485a1cbad2d0adf1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 13:02:47 +0200 Subject: [PATCH 149/292] try a more recent Odin build on macOS CI --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 7d96ae860..86096b949 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -174,7 +174,7 @@ jobs: name: prepare-macos run: | brew install llvm@14 - curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-macos-amd64-dev-2023-08.zip --output odin.zip + curl -L https://f001.backblazeb2.com/file/odin-binaries/nightly/odin-macos-amd64-nightly%2B2023-08-27.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_macos.sh From 0aa93b309088c16db19b80526ed340570959e3a7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 13:23:19 +0200 Subject: [PATCH 150/292] bindings gh actions: temporarily remove macos from odin test matrix --- .github/workflows/gen_bindings.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 86096b949..57e7d2718 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -150,7 +150,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + # FIXME: macOS Odin vs Homebrew LLVM currently seems broken + # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v3 @@ -174,7 +176,7 @@ jobs: name: prepare-macos run: | brew install llvm@14 - curl -L https://f001.backblazeb2.com/file/odin-binaries/nightly/odin-macos-amd64-nightly%2B2023-08-27.zip --output odin.zip + curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-macos-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_macos.sh From 7a036943408837ad2269d7ee938f95bda3778bfc Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 13:59:24 +0200 Subject: [PATCH 151/292] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff9e4f0b..900a8d7ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Updates +#### 28-Aug-2023 + +**sokol_gfx.h metal**: A new attempt at fixing a rare Metal validation layer +error for MTKView swapchain resources. See ticket PR https://github.com/floooh/sokol/pull/873 +for details. + #### 26-Jul-2023 **sokol_nuklear.h**: The same image+sampler support has been added as in sokol_imgui.h From f418b98a8c8e0286fadd65c804a2edfa54e935e6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 14:01:56 +0200 Subject: [PATCH 152/292] fix last changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 900a8d7ed..c6162474a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ #### 28-Aug-2023 **sokol_gfx.h metal**: A new attempt at fixing a rare Metal validation layer -error for MTKView swapchain resources. See ticket PR https://github.com/floooh/sokol/pull/873 +error about MTKView swapchain resource lifetimes. See PR https://github.com/floooh/sokol/pull/873 for details. #### 26-Jul-2023 From 7e4c532606960378e4fb9802e333a0a5747e3405 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 16:03:09 +0200 Subject: [PATCH 153/292] sokol_gfx.h wgpu: change SG_PIXELFORMAT_DEPTH_STENCIL to WGPUTextureFormat_Depth32FloatStencil8 --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index c4cb3952c..b67a2c62b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3207,7 +3207,7 @@ typedef enum sg_log_item { .context.wgpu.depth_stencil_view_cb .context.wgpu.depth_stencil_view_userdata_cb callback to get current default-pass depth-stencil-surface WGPUTextureView - the pixel format of the default WGPUTextureView must be WGPUTextureFormat_Depth24Plus8 + the pixel format of the default WGPUTextureView must be WGPUTextureFormat_Depth32FloatStencil8 .context.wgpu.user_data optional user data pointer passed to the userdata versions of callback functions @@ -12173,7 +12173,7 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RGBA32SI: return WGPUTextureFormat_RGBA32Sint; case SG_PIXELFORMAT_RGBA32F: return WGPUTextureFormat_RGBA32Float; case SG_PIXELFORMAT_DEPTH: return WGPUTextureFormat_Depth32Float; - case SG_PIXELFORMAT_DEPTH_STENCIL: return WGPUTextureFormat_Depth24PlusStencil8; + case SG_PIXELFORMAT_DEPTH_STENCIL: return WGPUTextureFormat_Depth32FloatStencil8; case SG_PIXELFORMAT_BC1_RGBA: return WGPUTextureFormat_BC1RGBAUnorm; case SG_PIXELFORMAT_BC2_RGBA: return WGPUTextureFormat_BC2RGBAUnorm; case SG_PIXELFORMAT_BC3_RGBA: return WGPUTextureFormat_BC3RGBAUnorm; From fb3b4ef10354534142e8d0721fffdeea885a037a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 16:04:33 +0200 Subject: [PATCH 154/292] sokol_gfx.h: fix wgpu initialization and frame loop --- sokol_app.h | 452 +++++++++++++++++++++++++++++----------------------- 1 file changed, 252 insertions(+), 200 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index a1f45b6b1..d0975861b 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1573,6 +1573,18 @@ typedef struct sapp_allocator { _SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_ONCREATE, "NativeActivity onCreate") \ _SAPP_LOGITEM_XMACRO(ANDROID_CREATE_THREAD_PIPE_FAILED, "failed to create thread pipe") \ _SAPP_LOGITEM_XMACRO(ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS, "NativeActivity sucessfully created") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED, "wgpu: failed to create surface for swapchain") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED, "wgpu: failed to create swapchain object") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED, "wgpu: failed to create depth-stencil texture for swapchain") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED, "wgpu: failed to create view object for swapchain depth-stencil texture") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED, "wgpu: failed to create msaa texture for swapchain") \ + _SAPP_LOGITEM_XMACRO(WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED, "wgpu: failed to create view object for swapchain msaa texture") \ + _SAPP_LOGITEM_XMACRO(WGPU_REQUEST_DEVICE_STATUS_ERROR, "wgpu: requesting device failed with status 'error'") \ + _SAPP_LOGITEM_XMACRO(WGPU_REQUEST_DEVICE_STATUS_UNKNOWN, "wgpu: requesting device failed with status 'unknown'") \ + _SAPP_LOGITEM_XMACRO(WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE, "wgpu: requesting adapter failed with 'unavailable'") \ + _SAPP_LOGITEM_XMACRO(WGPU_REQUEST_ADAPTER_STATUS_ERROR, "wgpu: requesting adapter failed with status 'error'") \ + _SAPP_LOGITEM_XMACRO(WGPU_REQUEST_ADAPTER_STATUS_UNKNOWN, "wgpu: requesting adapter failed with status 'unknown'") \ + _SAPP_LOGITEM_XMACRO(WGPU_CREATE_INSTANCE_FAILED, "wgpu: failed to create instance") \ _SAPP_LOGITEM_XMACRO(IMAGE_DATA_SIZE_MISMATCH, "image data size mismatch (must be width*height*4 bytes)") \ _SAPP_LOGITEM_XMACRO(DROPPED_FILE_PATH_TOO_LONG, "dropped file path too long (sapp_desc.max_dropped_filed_path_length)") \ _SAPP_LOGITEM_XMACRO(CLIPBOARD_STRING_TOO_BIG, "clipboard string didn't fit into clipboard buffer") \ @@ -1852,7 +1864,31 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); } #include // size_t #include // roundf -/* check if the config defines are alright */ +// helper macros +#define _sapp_def(val, def) (((val) == 0) ? (def) : (val)) +#define _sapp_absf(a) (((a)<0.0f)?-(a):(a)) + +#define _SAPP_MAX_TITLE_LENGTH (128) +#define _SAPP_FALLBACK_DEFAULT_WINDOW_WIDTH (640) +#define _SAPP_FALLBACK_DEFAULT_WINDOW_HEIGHT (480) +// NOTE: the pixel format values *must* be compatible with sg_pixel_format +#define _SAPP_PIXELFORMAT_RGBA8 (23) +#define _SAPP_PIXELFORMAT_BGRA8 (28) +#define _SAPP_PIXELFORMAT_DEPTH (42) +#define _SAPP_PIXELFORMAT_DEPTH_STENCIL (43) + +#if defined(_SAPP_MACOS) || defined(_SAPP_IOS) + // this is ARC compatible + #if defined(__cplusplus) + #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = type(); } + #else + #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; } + #endif +#else + #define _SAPP_CLEAR_ARC_STRUCT(type, item) { _sapp_clear(&item, sizeof(item)); } +#endif + +// check if the config defines are alright #if defined(__APPLE__) // see https://clang.llvm.org/docs/LanguageExtensions.html#automatic-reference-counting #if !defined(__cplusplus) @@ -2339,15 +2375,18 @@ typedef struct { #if defined(SOKOL_WGPU) typedef struct { - int state; + WGPUInstance instance; + WGPUAdapter adapter; WGPUDevice device; - WGPUSwapChain swapchain; WGPUTextureFormat render_format; + WGPUSurface surface; + WGPUSwapChain swapchain; WGPUTexture msaa_tex; - WGPUTexture depth_stencil_tex; - WGPUTextureView swapchain_view; WGPUTextureView msaa_view; + WGPUTexture depth_stencil_tex; WGPUTextureView depth_stencil_view; + WGPUTextureView swapchain_view; + bool async_init_done; } _sapp_wgpu_t; #endif @@ -2357,9 +2396,7 @@ typedef struct { bool wants_hide_keyboard; bool mouse_lock_requested; uint16_t mouse_buttons; - #if defined(SOKOL_WGPU) - _sapp_wgpu_t wgpu; - #endif + char canvas_selector[_SAPP_MAX_TITLE_LENGTH]; } _sapp_emsc_t; #endif // _SAPP_EMSCRIPTEN @@ -2396,7 +2433,7 @@ typedef enum MONITOR_DPI_TYPE { MDT_RAW_DPI = 2, MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE; -#endif /*DPI_ENUMS_DECLARED*/ +#endif // DPI_ENUMS_DECLARED typedef struct { bool aware; @@ -2683,30 +2720,6 @@ typedef struct { #endif // _SAPP_LINUX -/* helper macros */ -#define _sapp_def(val, def) (((val) == 0) ? (def) : (val)) -#define _sapp_absf(a) (((a)<0.0f)?-(a):(a)) - -#define _SAPP_MAX_TITLE_LENGTH (128) -#define _SAPP_FALLBACK_DEFAULT_WINDOW_WIDTH (640) -#define _SAPP_FALLBACK_DEFAULT_WINDOW_HEIGHT (480) -/* NOTE: the pixel format values *must* be compatible with sg_pixel_format */ -#define _SAPP_PIXELFORMAT_RGBA8 (23) -#define _SAPP_PIXELFORMAT_BGRA8 (28) -#define _SAPP_PIXELFORMAT_DEPTH (42) -#define _SAPP_PIXELFORMAT_DEPTH_STENCIL (43) - -#if defined(_SAPP_MACOS) || defined(_SAPP_IOS) - // this is ARC compatible - #if defined(__cplusplus) - #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = type(); } - #else - #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; } - #endif -#else - #define _SAPP_CLEAR_ARC_STRUCT(type, item) { _sapp_clear(&item, sizeof(item)); } -#endif - typedef struct { bool enabled; int buf_size; @@ -2764,6 +2777,9 @@ typedef struct { _sapp_ios_t ios; #elif defined(_SAPP_EMSCRIPTEN) _sapp_emsc_t emsc; + #if defined(SOKOL_WGPU) + _sapp_wgpu_t wgpu; + #endif #elif defined(_SAPP_WIN32) _sapp_win32_t win32; #if defined(SOKOL_D3D11) @@ -2781,7 +2797,6 @@ typedef struct { _sapp_egl_t egl; #endif #endif - char html5_canvas_selector[_SAPP_MAX_TITLE_LENGTH]; char window_title[_SAPP_MAX_TITLE_LENGTH]; /* UTF-8 */ wchar_t window_title_wide[_SAPP_MAX_TITLE_LENGTH]; /* UTF-32 or UCS-2 */ sapp_keycode keycodes[SAPP_MAX_KEYCODES]; @@ -3005,9 +3020,9 @@ _SOKOL_PRIVATE void _sapp_init_state(const sapp_desc* desc) { _sapp.framebuffer_height = _sapp.window_height; _sapp.sample_count = _sapp.desc.sample_count; _sapp.swap_interval = _sapp.desc.swap_interval; - _sapp.html5_canvas_selector[0] = '#'; - _sapp_strcpy(_sapp.desc.html5_canvas_name, &_sapp.html5_canvas_selector[1], sizeof(_sapp.html5_canvas_selector) - 1); - _sapp.desc.html5_canvas_name = &_sapp.html5_canvas_selector[1]; + _sapp.emsc.canvas_selector[0] = '#'; + _sapp_strcpy(_sapp.desc.html5_canvas_name, &_sapp.emsc.canvas_selector[1], sizeof(_sapp.emsc.canvas_selector) - 1); + _sapp.desc.html5_canvas_name = &_sapp.emsc.canvas_selector[1]; _sapp.html5_ask_leave_site = _sapp.desc.html5_ask_leave_site; _sapp.clipboard.enabled = _sapp.desc.enable_clipboard; if (_sapp.clipboard.enabled) { @@ -5031,11 +5046,6 @@ _SOKOL_PRIVATE void _sapp_emsc_set_icon(const sapp_icon_desc* icon_desc, int num sapp_js_set_favicon(img_desc->width, img_desc->height, (const uint8_t*) img_desc->pixels.ptr); } -#if defined(SOKOL_WGPU) -_SOKOL_PRIVATE void _sapp_emsc_wgpu_surfaces_create(void); -_SOKOL_PRIVATE void _sapp_emsc_wgpu_surfaces_discard(void); -#endif - _SOKOL_PRIVATE uint32_t _sapp_emsc_mouse_button_mods(uint16_t buttons) { uint32_t m = 0; if (0 != (buttons & (1<<0))) { m |= SAPP_MODIFIER_LMB; } @@ -5074,11 +5084,15 @@ _SOKOL_PRIVATE uint32_t _sapp_emsc_touch_event_mods(const EmscriptenTouchEvent* return m; } +#if defined(SOKOL_WGPU) +_SOKOL_PRIVATE void _sapp_emsc_wgpu_size_changed(void); +#endif + _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenUiEvent* ui_event, void* user_data) { _SOKOL_UNUSED(event_type); _SOKOL_UNUSED(user_data); double w, h; - emscripten_get_element_css_size(_sapp.html5_canvas_selector, &w, &h); + emscripten_get_element_css_size(_sapp.emsc.canvas_selector, &w, &h); /* The above method might report zero when toggling HTML5 fullscreen, in that case use the window's inner width reported by the emscripten event. This works ok when toggling *into* fullscreen @@ -5117,11 +5131,10 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU _sapp.framebuffer_width = (int)roundf(w * _sapp.dpi_scale); _sapp.framebuffer_height = (int)roundf(h * _sapp.dpi_scale); SOKOL_ASSERT((_sapp.framebuffer_width > 0) && (_sapp.framebuffer_height > 0)); - emscripten_set_canvas_element_size(_sapp.html5_canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); + emscripten_set_canvas_element_size(_sapp.emsc.canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); #if defined(SOKOL_WGPU) - /* on WebGPU: recreate size-dependent rendering surfaces */ - _sapp_emsc_wgpu_surfaces_discard(); - _sapp_emsc_wgpu_surfaces_create(); + // on WebGPU: recreate size-dependent rendering surfaces + _sapp_emsc_wgpu_size_changed(); #endif if (_sapp_events_enabled()) { _sapp_init_event(SAPP_EVENTTYPE_RESIZED); @@ -5393,11 +5406,10 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard _sapp.event.key_code = _sapp_emsc_translate_key(emsc_event->key); } - /* Special hack for macOS: if the Super key is pressed, macOS doesn't - send keyUp events. As a workaround, to prevent keys from - "sticking", we'll send a keyup event following a keydown - when the SUPER key is pressed - */ + // Special hack for macOS: if the Super key is pressed, macOS doesn't + // send keyUp events. As a workaround, to prevent keys from + // "sticking", we'll send a keyup event following a keydown + // when the SUPER key is pressed if ((type == SAPP_EVENTTYPE_KEY_DOWN) && (_sapp.event.key_code != SAPP_KEYCODE_LEFT_SUPER) && (_sapp.event.key_code != SAPP_KEYCODE_RIGHT_SUPER) && @@ -5582,7 +5594,7 @@ _SOKOL_PRIVATE void _sapp_emsc_webgl_init(void) { attrs.preserveDrawingBuffer = _sapp.desc.html5_preserve_drawing_buffer; attrs.enableExtensionsByDefault = true; attrs.majorVersion = 2; - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(_sapp.html5_canvas_selector, &attrs); + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(_sapp.emsc.canvas_selector, &attrs); // FIXME: error message? emscripten_webgl_make_context_current(ctx); @@ -5592,129 +5604,190 @@ _SOKOL_PRIVATE void _sapp_emsc_webgl_init(void) { #endif #if defined(SOKOL_WGPU) -#define _SAPP_EMSC_WGPU_STATE_INITIAL (0) -#define _SAPP_EMSC_WGPU_STATE_READY (1) -#define _SAPP_EMSC_WGPU_STATE_RUNNING (2) - -#if defined(__cplusplus) -extern "C" { -#endif -/* called when the asynchronous WebGPU device + swapchain init code in JS has finished */ -EMSCRIPTEN_KEEPALIVE void _sapp_emsc_wgpu_ready(int device_id, int swapchain_id, int swapchain_fmt) { - SOKOL_ASSERT(0 == _sapp.emsc.wgpu.device); - _sapp.emsc.wgpu.device = (WGPUDevice) device_id; - _sapp.emsc.wgpu.swapchain = (WGPUSwapChain) swapchain_id; - _sapp.emsc.wgpu.render_format = (WGPUTextureFormat) swapchain_fmt; - _sapp.emsc.wgpu.state = _SAPP_EMSC_WGPU_STATE_READY; -} -#if defined(__cplusplus) -} // extern "C" -#endif - -/* embedded JS function to handle all the asynchronous WebGPU setup */ -EM_JS(void, sapp_js_wgpu_init, (), { - WebGPU.initManagers(); - // FIXME: the extension activation must be more clever here - navigator.gpu.requestAdapter().then((adapter) => { - console.log("wgpu adapter extensions: " + adapter.extensions); - adapter.requestDevice({ extensions: ["textureCompressionBC"]}).then((device) => { - var gpuContext = document.getElementById("canvas").getContext("gpupresent"); - console.log("wgpu device extensions: " + adapter.extensions); - gpuContext.getSwapChainPreferredFormat(device).then((fmt) => { - const swapChainDescriptor = { device: device, format: fmt }; - const swapChain = gpuContext.configureSwapChain(swapChainDescriptor); - const deviceId = WebGPU.mgrDevice.create(device); - const swapChainId = WebGPU.mgrSwapChain.create(swapChain); - const fmtId = WebGPU.TextureFormat.findIndex(function(elm) { return elm==fmt; }); - console.log("wgpu device: " + device); - console.log("wgpu swap chain: " + swapChain); - console.log("wgpu preferred format: " + fmt + " (" + fmtId + ")"); - __sapp_emsc_wgpu_ready(deviceId, swapChainId, fmtId); - }); - }); - }); -}); -_SOKOL_PRIVATE void _sapp_emsc_wgpu_surfaces_create(void) { - SOKOL_ASSERT(_sapp.emsc.wgpu.device); - SOKOL_ASSERT(_sapp.emsc.wgpu.swapchain); - SOKOL_ASSERT(0 == _sapp.emsc.wgpu.depth_stencil_tex); - SOKOL_ASSERT(0 == _sapp.emsc.wgpu.depth_stencil_view); - SOKOL_ASSERT(0 == _sapp.emsc.wgpu.msaa_tex); - SOKOL_ASSERT(0 == _sapp.emsc.wgpu.msaa_view); +_SOKOL_PRIVATE void _sapp_emsc_wgpu_create_swapchain(void) { + SOKOL_ASSERT(_sapp.wgpu.instance); + SOKOL_ASSERT(_sapp.wgpu.device); + SOKOL_ASSERT(0 == _sapp.wgpu.surface); + SOKOL_ASSERT(0 == _sapp.wgpu.swapchain); + SOKOL_ASSERT(0 == _sapp.wgpu.msaa_tex); + SOKOL_ASSERT(0 == _sapp.wgpu.msaa_view); + SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_tex); + SOKOL_ASSERT(0 == _sapp.wgpu.depth_stencil_view); + SOKOL_ASSERT(0 == _sapp.wgpu.swapchain_view); + + WGPUSurfaceDescriptorFromCanvasHTMLSelector canvas_desc; + _sapp_clear(&canvas_desc, sizeof(canvas_desc)); + canvas_desc.chain.sType = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector; + canvas_desc.selector = _sapp.emsc.canvas_selector; + WGPUSurfaceDescriptor surf_desc; + _sapp_clear(&surf_desc, sizeof(surf_desc)); + surf_desc.nextInChain = &canvas_desc.chain; + _sapp.wgpu.surface = wgpuInstanceCreateSurface(_sapp.wgpu.instance, &surf_desc); + if (0 == _sapp.wgpu.surface) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED); + } + _sapp.wgpu.render_format = wgpuSurfaceGetPreferredFormat(_sapp.wgpu.surface, _sapp.wgpu.adapter); + + WGPUSwapChainDescriptor sc_desc; + _sapp_clear(&sc_desc, sizeof(sc_desc)); + sc_desc.usage = WGPUTextureUsage_RenderAttachment; + sc_desc.format = _sapp.wgpu.render_format; + sc_desc.width = (uint32_t)_sapp.framebuffer_width; + sc_desc.height = (uint32_t)_sapp.framebuffer_height; + sc_desc.presentMode = WGPUPresentMode_Fifo; + _sapp.wgpu.swapchain = wgpuDeviceCreateSwapChain(_sapp.wgpu.device, _sapp.wgpu.surface, &sc_desc); + if (0 == _sapp.wgpu.swapchain) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_SWAPCHAIN_FAILED); + } WGPUTextureDescriptor ds_desc; _sapp_clear(&ds_desc, sizeof(ds_desc)); - ds_desc.usage = WGPUTextureUsage_OutputAttachment; + ds_desc.usage = WGPUTextureUsage_RenderAttachment; ds_desc.dimension = WGPUTextureDimension_2D; - ds_desc.size.width = (uint32_t) _sapp.framebuffer_width; - ds_desc.size.height = (uint32_t) _sapp.framebuffer_height; - ds_desc.size.depth = 1; - ds_desc.arrayLayerCount = 1; - ds_desc.format = WGPUTextureFormat_Depth24PlusStencil8; + ds_desc.size.width = (uint32_t)_sapp.framebuffer_width; + ds_desc.size.height = (uint32_t)_sapp.framebuffer_height; + ds_desc.size.depthOrArrayLayers = 1; + ds_desc.format = WGPUTextureFormat_Depth32FloatStencil8; ds_desc.mipLevelCount = 1; - ds_desc.sampleCount = _sapp.sample_count; - _sapp.emsc.wgpu.depth_stencil_tex = wgpuDeviceCreateTexture(_sapp.emsc.wgpu.device, &ds_desc); - _sapp.emsc.wgpu.depth_stencil_view = wgpuTextureCreateView(_sapp.emsc.wgpu.depth_stencil_tex, 0); + ds_desc.sampleCount = (uint32_t)_sapp.sample_count; + _sapp.wgpu.depth_stencil_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &ds_desc); + if (0 == _sapp.wgpu.depth_stencil_tex) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED); + } + _sapp.wgpu.depth_stencil_view = wgpuTextureCreateView(_sapp.wgpu.depth_stencil_tex, 0); + if (0 == _sapp.wgpu.depth_stencil_view) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_VIEW_FAILED); + } if (_sapp.sample_count > 1) { WGPUTextureDescriptor msaa_desc; _sapp_clear(&msaa_desc, sizeof(msaa_desc)); - msaa_desc.usage = WGPUTextureUsage_OutputAttachment; + msaa_desc.usage = WGPUTextureUsage_RenderAttachment; msaa_desc.dimension = WGPUTextureDimension_2D; - msaa_desc.size.width = (uint32_t) _sapp.framebuffer_width; - msaa_desc.size.height = (uint32_t) _sapp.framebuffer_height; - msaa_desc.size.depth = 1; - msaa_desc.arrayLayerCount = 1; - msaa_desc.format = _sapp.emsc.wgpu.render_format; + msaa_desc.size.width = (uint32_t)_sapp.framebuffer_width; + msaa_desc.size.height = (uint32_t)_sapp.framebuffer_height; + msaa_desc.size.depthOrArrayLayers = 1; + msaa_desc.format = _sapp.wgpu.render_format; msaa_desc.mipLevelCount = 1; - msaa_desc.sampleCount = _sapp.sample_count; - _sapp.emsc.wgpu.msaa_tex = wgpuDeviceCreateTexture(_sapp.emsc.wgpu.device, &msaa_desc); - _sapp.emsc.wgpu.msaa_view = wgpuTextureCreateView(_sapp.emsc.wgpu.msaa_tex, 0); + msaa_desc.sampleCount = (uint32_t)_sapp.sample_count; + _sapp.wgpu.msaa_tex = wgpuDeviceCreateTexture(_sapp.wgpu.device, &msaa_desc); + if (0 == _sapp.wgpu.msaa_tex) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_TEXTURE_FAILED); + } + _sapp.wgpu.msaa_view = wgpuTextureCreateView(_sapp.wgpu.msaa_tex, 0); + if (0 == _sapp.wgpu.msaa_view) { + _SAPP_PANIC(WGPU_SWAPCHAIN_CREATE_MSAA_VIEW_FAILED); + } } } -_SOKOL_PRIVATE void _sapp_emsc_wgpu_surfaces_discard(void) { - if (_sapp.emsc.wgpu.msaa_tex) { - wgpuTextureRelease(_sapp.emsc.wgpu.msaa_tex); - _sapp.emsc.wgpu.msaa_tex = 0; +_SOKOL_PRIVATE void _sapp_emsc_wgpu_discard_swapchain(void) { + if (_sapp.wgpu.msaa_view) { + wgpuTextureViewRelease(_sapp.wgpu.msaa_view); + _sapp.wgpu.msaa_view = 0; + } + if (_sapp.wgpu.msaa_tex) { + wgpuTextureRelease(_sapp.wgpu.msaa_tex); + _sapp.wgpu.msaa_tex = 0; } - if (_sapp.emsc.wgpu.msaa_view) { - wgpuTextureViewRelease(_sapp.emsc.wgpu.msaa_view); - _sapp.emsc.wgpu.msaa_view = 0; + if (_sapp.wgpu.depth_stencil_view) { + wgpuTextureViewRelease(_sapp.wgpu.depth_stencil_view); + _sapp.wgpu.depth_stencil_view = 0; } - if (_sapp.emsc.wgpu.depth_stencil_tex) { - wgpuTextureRelease(_sapp.emsc.wgpu.depth_stencil_tex); - _sapp.emsc.wgpu.depth_stencil_tex = 0; + if (_sapp.wgpu.depth_stencil_tex) { + wgpuTextureRelease(_sapp.wgpu.depth_stencil_tex); + _sapp.wgpu.depth_stencil_tex = 0; } - if (_sapp.emsc.wgpu.depth_stencil_view) { - wgpuTextureViewRelease(_sapp.emsc.wgpu.depth_stencil_view); - _sapp.emsc.wgpu.depth_stencil_view = 0; + if (_sapp.wgpu.swapchain) { + wgpuSwapChainRelease(_sapp.wgpu.swapchain); + _sapp.wgpu.swapchain = 0; } + if (_sapp.wgpu.surface) { + wgpuSurfaceRelease(_sapp.wgpu.surface); + _sapp.wgpu.surface = 0; + } +} + +_SOKOL_PRIVATE void _sapp_emsc_wgpu_size_changed(void) { + _sapp_emsc_wgpu_discard_swapchain(); + _sapp_emsc_wgpu_create_swapchain(); } -_SOKOL_PRIVATE void _sapp_emsc_wgpu_next_frame(void) { - if (_sapp.emsc.wgpu.swapchain_view) { - wgpuTextureViewRelease(_sapp.emsc.wgpu.swapchain_view); +_SOKOL_PRIVATE void _sapp_emsc_wgpu_request_device_cb(WGPURequestDeviceStatus status, WGPUDevice device, const char* msg, void* userdata) { + _SOKOL_UNUSED(msg); + _SOKOL_UNUSED(userdata); + SOKOL_ASSERT(!_sapp.wgpu.async_init_done); + if (status != WGPURequestDeviceStatus_Success) { + if (status == WGPURequestDeviceStatus_Error) { + _SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_ERROR); + } else { + _SAPP_PANIC(WGPU_REQUEST_DEVICE_STATUS_UNKNOWN); + } } - _sapp.emsc.wgpu.swapchain_view = wgpuSwapChainGetCurrentTextureView(_sapp.emsc.wgpu.swapchain); + SOKOL_ASSERT(device); + _sapp.wgpu.device = device; + _sapp_emsc_wgpu_create_swapchain(); + _sapp.wgpu.async_init_done = true; } -#endif + +_SOKOL_PRIVATE void _sapp_emsc_wgpu_request_adapter_cb(WGPURequestAdapterStatus status, WGPUAdapter adapter, const char* msg, void* userdata) { + _SOKOL_UNUSED(msg); + _SOKOL_UNUSED(userdata); + if (status != WGPURequestAdapterStatus_Success) { + switch (status) { + case WGPURequestAdapterStatus_Unavailable: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNAVAILABLE); break; + case WGPURequestAdapterStatus_Error: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_ERROR); break; + default: _SAPP_PANIC(WGPU_REQUEST_ADAPTER_STATUS_UNKNOWN); break; + } + } + SOKOL_ASSERT(adapter); + _sapp.wgpu.adapter = adapter; + const WGPUFeatureName requiredFeatures[1] = { + WGPUFeatureName_Depth32FloatStencil8, + }; + WGPUDeviceDescriptor dev_desc; + _sapp_clear(&dev_desc, sizeof(dev_desc)); + dev_desc.requiredFeaturesCount = 1, + dev_desc.requiredFeatures = requiredFeatures, + wgpuAdapterRequestDevice(adapter, &dev_desc, _sapp_emsc_wgpu_request_device_cb, 0); +} + +_SOKOL_PRIVATE void _sapp_emsc_wgpu_init(void) { + SOKOL_ASSERT(0 == _sapp.wgpu.instance); + SOKOL_ASSERT(!_sapp.wgpu.async_init_done); + _sapp.wgpu.instance = wgpuCreateInstance(0); + if (0 == _sapp.wgpu.instance) { + _SAPP_PANIC(WGPU_CREATE_INSTANCE_FAILED); + } + // FIXME: power preference? + wgpuInstanceRequestAdapter(_sapp.wgpu.instance, 0, _sapp_emsc_wgpu_request_adapter_cb, 0); +} + +_SOKOL_PRIVATE void _sapp_emsc_wgpu_frame(void) { + if (_sapp.wgpu.async_init_done) { + _sapp.wgpu.swapchain_view = wgpuSwapChainGetCurrentTextureView(_sapp.wgpu.swapchain); + _sapp_frame(); + wgpuTextureViewRelease(_sapp.wgpu.swapchain_view); + _sapp.wgpu.swapchain_view = 0; + } +} +#endif // SOKOL_WGPU _SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) { - emscripten_set_mousedown_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseup_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mousemove_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseenter_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseleave_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_wheel_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_wheel_cb); + emscripten_set_mousedown_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseup_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mousemove_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseenter_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseleave_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_wheel_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_wheel_cb); emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); - emscripten_set_touchstart_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchmove_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchend_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchcancel_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchstart_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchmove_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchend_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchcancel_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, _sapp_emsc_pointerlockchange_cb); emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, _sapp_emsc_pointerlockerror_cb); emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_focus_cb); @@ -5724,28 +5797,28 @@ _SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) { sapp_js_add_clipboard_listener(); } if (_sapp.drop.enabled) { - sapp_js_add_dragndrop_listeners(&_sapp.html5_canvas_selector[1]); + sapp_js_add_dragndrop_listeners(&_sapp.emsc.canvas_selector[1]); } #if defined(SOKOL_GLES3) - emscripten_set_webglcontextlost_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); - emscripten_set_webglcontextrestored_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); + emscripten_set_webglcontextlost_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); + emscripten_set_webglcontextrestored_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); #endif } _SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() { - emscripten_set_mousedown_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_mouseup_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_mousemove_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_mouseenter_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_mouseleave_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_wheel_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_mousedown_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_mouseup_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_mousemove_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_mouseenter_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_mouseleave_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_wheel_callback(_sapp.emsc.canvas_selector, 0, true, 0); emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); - emscripten_set_touchstart_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_touchmove_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_touchend_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_touchcancel_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_touchstart_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_touchmove_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_touchend_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_touchcancel_callback(_sapp.emsc.canvas_selector, 0, true, 0); emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, 0); emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, 0); emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); @@ -5755,11 +5828,11 @@ _SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() { sapp_js_remove_clipboard_listener(); } if (_sapp.drop.enabled) { - sapp_js_remove_dragndrop_listeners(&_sapp.html5_canvas_selector[1]); + sapp_js_remove_dragndrop_listeners(&_sapp.emsc.canvas_selector[1]); } #if defined(SOKOL_GLES3) - emscripten_set_webglcontextlost_callback(_sapp.html5_canvas_selector, 0, true, 0); - emscripten_set_webglcontextrestored_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_webglcontextlost_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_webglcontextrestored_callback(_sapp.emsc.canvas_selector, 0, true, 0); #endif } @@ -5768,32 +5841,12 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_frame(double time, void* userData) { _sapp_timing_external(&_sapp.timing, time / 1000.0); #if defined(SOKOL_WGPU) - /* - on WebGPU, the emscripten frame callback will already be called while - the asynchronous WebGPU device and swapchain initialization is still - in progress - */ - switch (_sapp.emsc.wgpu.state) { - case _SAPP_EMSC_WGPU_STATE_INITIAL: - /* async JS init hasn't finished yet */ - break; - case _SAPP_EMSC_WGPU_STATE_READY: - /* perform post-async init stuff */ - _sapp_emsc_wgpu_surfaces_create(); - _sapp.emsc.wgpu.state = _SAPP_EMSC_WGPU_STATE_RUNNING; - break; - case _SAPP_EMSC_WGPU_STATE_RUNNING: - /* a regular frame */ - _sapp_emsc_wgpu_next_frame(); - _sapp_frame(); - break; - } + _sapp_emsc_wgpu_frame(); #else - /* WebGL code path */ _sapp_frame(); #endif - /* quit-handling */ + // quit-handling if (_sapp.quit_requested) { _sapp_init_event(SAPP_EVENTTYPE_QUIT_REQUESTED); _sapp_call_event(&_sapp.event); @@ -5812,14 +5865,14 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_frame(double time, void* userData) { _SOKOL_PRIVATE void _sapp_emsc_run(const sapp_desc* desc) { _sapp_init_state(desc); - sapp_js_init(&_sapp.html5_canvas_selector[1]); + sapp_js_init(&_sapp.emsc.canvas_selector[1]); double w, h; if (_sapp.desc.html5_canvas_resize) { w = (double) _sapp_def(_sapp.desc.width, _SAPP_FALLBACK_DEFAULT_WINDOW_WIDTH); h = (double) _sapp_def(_sapp.desc.height, _SAPP_FALLBACK_DEFAULT_WINDOW_HEIGHT); } else { - emscripten_get_element_css_size(_sapp.html5_canvas_selector, &w, &h); + emscripten_get_element_css_size(_sapp.emsc.canvas_selector, &w, &h); emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, false, _sapp_emsc_size_changed); } if (_sapp.desc.high_dpi) { @@ -5829,22 +5882,21 @@ _SOKOL_PRIVATE void _sapp_emsc_run(const sapp_desc* desc) { _sapp.window_height = (int)roundf(h); _sapp.framebuffer_width = (int)roundf(w * _sapp.dpi_scale); _sapp.framebuffer_height = (int)roundf(h * _sapp.dpi_scale); - emscripten_set_canvas_element_size(_sapp.html5_canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); + emscripten_set_canvas_element_size(_sapp.emsc.canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); #if defined(SOKOL_GLES3) _sapp_emsc_webgl_init(); #elif defined(SOKOL_WGPU) - sapp_js_wgpu_init(); + _sapp_emsc_wgpu_init(); #endif _sapp.valid = true; _sapp_emsc_register_eventhandlers(); sapp_set_icon(&desc->icon); - /* start the frame loop */ + // start the frame loop emscripten_request_animation_frame_loop(_sapp_emsc_frame, 0); - /* NOT A BUG: do not call _sapp_discard_state() here, instead this is - called in _sapp_emsc_frame() when the application is ordered to quit - */ + // NOT A BUG: do not call _sapp_discard_state() here, instead this is + // called in _sapp_emsc_frame() when the application is ordered to quit } #if !defined(SOKOL_NO_ENTRY) @@ -11030,7 +11082,7 @@ SOKOL_API_IMPL float sapp_heightf(void) { SOKOL_API_IMPL int sapp_color_format(void) { #if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU) - switch (_sapp.emsc.wgpu.render_format) { + switch (_sapp.wgpu.render_format) { case WGPUTextureFormat_RGBA8Unorm: return _SAPP_PIXELFORMAT_RGBA8; case WGPUTextureFormat_BGRA8Unorm: @@ -11458,7 +11510,7 @@ SOKOL_API_IMPL const void* sapp_win32_get_hwnd(void) { SOKOL_API_IMPL const void* sapp_wgpu_get_device(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU) - return (const void*) _sapp.emsc.wgpu.device; + return (const void*) _sapp.wgpu.device; #else return 0; #endif @@ -11468,10 +11520,10 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_render_view(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU) if (_sapp.sample_count > 1) { - return (const void*) _sapp.emsc.wgpu.msaa_view; + return (const void*) _sapp.wgpu.msaa_view; } else { - return (const void*) _sapp.emsc.wgpu.swapchain_view; + return (const void*) _sapp.wgpu.swapchain_view; } #else return 0; @@ -11482,7 +11534,7 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_resolve_view(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU) if (_sapp.sample_count > 1) { - return (const void*) _sapp.emsc.wgpu.swapchain_view; + return (const void*) _sapp.wgpu.swapchain_view; } else { return 0; @@ -11495,7 +11547,7 @@ SOKOL_API_IMPL const void* sapp_wgpu_get_resolve_view(void) { SOKOL_API_IMPL const void* sapp_wgpu_get_depth_stencil_view(void) { SOKOL_ASSERT(_sapp.valid); #if defined(_SAPP_EMSCRIPTEN) && defined(SOKOL_WGPU) - return (const void*) _sapp.emsc.wgpu.depth_stencil_view; + return (const void*) _sapp.wgpu.depth_stencil_view; #else return 0; #endif From e4bf816bc3c563afaf7cfcc71b47f0af558ebd0b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 16:13:22 +0200 Subject: [PATCH 155/292] sokol_gfx.h wgpu: fix wrong SG_VERTEXFORMAT_USHORT2N mapping --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b67a2c62b..dfceb0942 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12098,7 +12098,7 @@ _SOKOL_PRIVATE WGPUVertexFormat _sg_wgpu_vertexformat(sg_vertex_format f) { case SG_VERTEXFORMAT_UBYTE4N: return WGPUVertexFormat_Unorm8x4; case SG_VERTEXFORMAT_SHORT2: return WGPUVertexFormat_Sint16x2; case SG_VERTEXFORMAT_SHORT2N: return WGPUVertexFormat_Snorm16x2; - case SG_VERTEXFORMAT_USHORT2N: return WGPUVertexFormat_Uint16x2; + case SG_VERTEXFORMAT_USHORT2N: return WGPUVertexFormat_Unorm16x2; case SG_VERTEXFORMAT_SHORT4: return WGPUVertexFormat_Sint16x4; case SG_VERTEXFORMAT_SHORT4N: return WGPUVertexFormat_Snorm16x4; case SG_VERTEXFORMAT_USHORT4N: return WGPUVertexFormat_Unorm16x4; From f750e22e3af09796141b9dd6951722cb4e146d26 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 28 Aug 2023 16:46:28 +0200 Subject: [PATCH 156/292] sokol_app.h emsc: revert _sapp.html5_canvas_selector => _sapp.emsc.canvas_selector change --- sokol_app.h | 78 ++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index d0975861b..1a13ba7b8 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -2396,7 +2396,6 @@ typedef struct { bool wants_hide_keyboard; bool mouse_lock_requested; uint16_t mouse_buttons; - char canvas_selector[_SAPP_MAX_TITLE_LENGTH]; } _sapp_emsc_t; #endif // _SAPP_EMSCRIPTEN @@ -2797,8 +2796,9 @@ typedef struct { _sapp_egl_t egl; #endif #endif - char window_title[_SAPP_MAX_TITLE_LENGTH]; /* UTF-8 */ - wchar_t window_title_wide[_SAPP_MAX_TITLE_LENGTH]; /* UTF-32 or UCS-2 */ + char html5_canvas_selector[_SAPP_MAX_TITLE_LENGTH]; + char window_title[_SAPP_MAX_TITLE_LENGTH]; // UTF-8 + wchar_t window_title_wide[_SAPP_MAX_TITLE_LENGTH]; // UTF-32 or UCS-2 */ sapp_keycode keycodes[SAPP_MAX_KEYCODES]; } _sapp_t; static _sapp_t _sapp; @@ -3020,9 +3020,9 @@ _SOKOL_PRIVATE void _sapp_init_state(const sapp_desc* desc) { _sapp.framebuffer_height = _sapp.window_height; _sapp.sample_count = _sapp.desc.sample_count; _sapp.swap_interval = _sapp.desc.swap_interval; - _sapp.emsc.canvas_selector[0] = '#'; - _sapp_strcpy(_sapp.desc.html5_canvas_name, &_sapp.emsc.canvas_selector[1], sizeof(_sapp.emsc.canvas_selector) - 1); - _sapp.desc.html5_canvas_name = &_sapp.emsc.canvas_selector[1]; + _sapp.html5_canvas_selector[0] = '#'; + _sapp_strcpy(_sapp.desc.html5_canvas_name, &_sapp.html5_canvas_selector[1], sizeof(_sapp.html5_canvas_selector) - 1); + _sapp.desc.html5_canvas_name = &_sapp.html5_canvas_selector[1]; _sapp.html5_ask_leave_site = _sapp.desc.html5_ask_leave_site; _sapp.clipboard.enabled = _sapp.desc.enable_clipboard; if (_sapp.clipboard.enabled) { @@ -5092,7 +5092,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU _SOKOL_UNUSED(event_type); _SOKOL_UNUSED(user_data); double w, h; - emscripten_get_element_css_size(_sapp.emsc.canvas_selector, &w, &h); + emscripten_get_element_css_size(_sapp.html5_canvas_selector, &w, &h); /* The above method might report zero when toggling HTML5 fullscreen, in that case use the window's inner width reported by the emscripten event. This works ok when toggling *into* fullscreen @@ -5131,7 +5131,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_size_changed(int event_type, const EmscriptenU _sapp.framebuffer_width = (int)roundf(w * _sapp.dpi_scale); _sapp.framebuffer_height = (int)roundf(h * _sapp.dpi_scale); SOKOL_ASSERT((_sapp.framebuffer_width > 0) && (_sapp.framebuffer_height > 0)); - emscripten_set_canvas_element_size(_sapp.emsc.canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); + emscripten_set_canvas_element_size(_sapp.html5_canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); #if defined(SOKOL_WGPU) // on WebGPU: recreate size-dependent rendering surfaces _sapp_emsc_wgpu_size_changed(); @@ -5594,7 +5594,7 @@ _SOKOL_PRIVATE void _sapp_emsc_webgl_init(void) { attrs.preserveDrawingBuffer = _sapp.desc.html5_preserve_drawing_buffer; attrs.enableExtensionsByDefault = true; attrs.majorVersion = 2; - EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(_sapp.emsc.canvas_selector, &attrs); + EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(_sapp.html5_canvas_selector, &attrs); // FIXME: error message? emscripten_webgl_make_context_current(ctx); @@ -5619,7 +5619,7 @@ _SOKOL_PRIVATE void _sapp_emsc_wgpu_create_swapchain(void) { WGPUSurfaceDescriptorFromCanvasHTMLSelector canvas_desc; _sapp_clear(&canvas_desc, sizeof(canvas_desc)); canvas_desc.chain.sType = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector; - canvas_desc.selector = _sapp.emsc.canvas_selector; + canvas_desc.selector = _sapp.html5_canvas_selector; WGPUSurfaceDescriptor surf_desc; _sapp_clear(&surf_desc, sizeof(surf_desc)); surf_desc.nextInChain = &canvas_desc.chain; @@ -5775,19 +5775,19 @@ _SOKOL_PRIVATE void _sapp_emsc_wgpu_frame(void) { #endif // SOKOL_WGPU _SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) { - emscripten_set_mousedown_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseup_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mousemove_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseenter_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_mouseleave_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_mouse_cb); - emscripten_set_wheel_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_wheel_cb); + emscripten_set_mousedown_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseup_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mousemove_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseenter_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_mouseleave_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_mouse_cb); + emscripten_set_wheel_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_wheel_cb); emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_key_cb); - emscripten_set_touchstart_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchmove_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchend_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); - emscripten_set_touchcancel_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchstart_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchmove_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchend_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); + emscripten_set_touchcancel_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_touch_cb); emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, _sapp_emsc_pointerlockchange_cb); emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, _sapp_emsc_pointerlockerror_cb); emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, _sapp_emsc_focus_cb); @@ -5797,28 +5797,28 @@ _SOKOL_PRIVATE void _sapp_emsc_register_eventhandlers(void) { sapp_js_add_clipboard_listener(); } if (_sapp.drop.enabled) { - sapp_js_add_dragndrop_listeners(&_sapp.emsc.canvas_selector[1]); + sapp_js_add_dragndrop_listeners(&_sapp.html5_canvas_selector[1]); } #if defined(SOKOL_GLES3) - emscripten_set_webglcontextlost_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); - emscripten_set_webglcontextrestored_callback(_sapp.emsc.canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); + emscripten_set_webglcontextlost_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); + emscripten_set_webglcontextrestored_callback(_sapp.html5_canvas_selector, 0, true, _sapp_emsc_webgl_context_cb); #endif } _SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() { - emscripten_set_mousedown_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_mouseup_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_mousemove_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_mouseenter_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_mouseleave_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_wheel_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_mousedown_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_mouseup_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_mousemove_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_mouseenter_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_mouseleave_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_wheel_callback(_sapp.html5_canvas_selector, 0, true, 0); emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); - emscripten_set_touchstart_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_touchmove_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_touchend_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_touchcancel_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_touchstart_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_touchmove_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_touchend_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_touchcancel_callback(_sapp.html5_canvas_selector, 0, true, 0); emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, 0); emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, 0, true, 0); emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, true, 0); @@ -5828,11 +5828,11 @@ _SOKOL_PRIVATE void _sapp_emsc_unregister_eventhandlers() { sapp_js_remove_clipboard_listener(); } if (_sapp.drop.enabled) { - sapp_js_remove_dragndrop_listeners(&_sapp.emsc.canvas_selector[1]); + sapp_js_remove_dragndrop_listeners(&_sapp.html5_canvas_selector[1]); } #if defined(SOKOL_GLES3) - emscripten_set_webglcontextlost_callback(_sapp.emsc.canvas_selector, 0, true, 0); - emscripten_set_webglcontextrestored_callback(_sapp.emsc.canvas_selector, 0, true, 0); + emscripten_set_webglcontextlost_callback(_sapp.html5_canvas_selector, 0, true, 0); + emscripten_set_webglcontextrestored_callback(_sapp.html5_canvas_selector, 0, true, 0); #endif } @@ -5865,14 +5865,14 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_frame(double time, void* userData) { _SOKOL_PRIVATE void _sapp_emsc_run(const sapp_desc* desc) { _sapp_init_state(desc); - sapp_js_init(&_sapp.emsc.canvas_selector[1]); + sapp_js_init(&_sapp.html5_canvas_selector[1]); double w, h; if (_sapp.desc.html5_canvas_resize) { w = (double) _sapp_def(_sapp.desc.width, _SAPP_FALLBACK_DEFAULT_WINDOW_WIDTH); h = (double) _sapp_def(_sapp.desc.height, _SAPP_FALLBACK_DEFAULT_WINDOW_HEIGHT); } else { - emscripten_get_element_css_size(_sapp.emsc.canvas_selector, &w, &h); + emscripten_get_element_css_size(_sapp.html5_canvas_selector, &w, &h); emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, 0, false, _sapp_emsc_size_changed); } if (_sapp.desc.high_dpi) { @@ -5882,7 +5882,7 @@ _SOKOL_PRIVATE void _sapp_emsc_run(const sapp_desc* desc) { _sapp.window_height = (int)roundf(h); _sapp.framebuffer_width = (int)roundf(w * _sapp.dpi_scale); _sapp.framebuffer_height = (int)roundf(h * _sapp.dpi_scale); - emscripten_set_canvas_element_size(_sapp.emsc.canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); + emscripten_set_canvas_element_size(_sapp.html5_canvas_selector, _sapp.framebuffer_width, _sapp.framebuffer_height); #if defined(SOKOL_GLES3) _sapp_emsc_webgl_init(); #elif defined(SOKOL_WGPU) From e453b7726d7db2d79831d769485d3ea507bbe995 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 30 Aug 2023 20:22:58 +0200 Subject: [PATCH 157/292] sokol_gfx.h: harmonize sg_sampler_type names with webgpu --- sokol_gfx.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 697c2e9f5..31fe1bffb 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1662,8 +1662,9 @@ typedef enum sg_image_sample_type { */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, - SG_SAMPLERTYPE_SAMPLE, - SG_SAMPLERTYPE_COMPARE, + SG_SAMPLERTYPE_FILTERING, + SG_SAMPLERTYPE_NONFILTERING, + SG_SAMPLERTYPE_COMPARISON, _SG_SAMPLERTYPE_NUM, _SG_SAMPLERTYPE_FORCE_U32, } sg_sampler_type; @@ -3072,8 +3073,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to vertex stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ @@ -3083,8 +3084,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARE on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_SAMPLE on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to fragment stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ @@ -12017,9 +12018,9 @@ _SOKOL_PRIVATE WGPUTextureSampleType _sg_wgpu_texture_sample_type(sg_image_sampl _SOKOL_PRIVATE WGPUSamplerBindingType _sg_wgpu_sampler_binding_type(sg_sampler_type t) { switch (t) { - // FIXME: NonFiltering - case SG_SAMPLERTYPE_SAMPLE: return WGPUSamplerBindingType_Filtering; - case SG_SAMPLERTYPE_COMPARE: return WGPUSamplerBindingType_Comparison; + case SG_SAMPLERTYPE_FILTERING: return WGPUSamplerBindingType_Filtering; + case SG_SAMPLERTYPE_COMPARISON: return WGPUSamplerBindingType_Comparison; + case SG_SAMPLERTYPE_NONFILTERING: return WGPUSamplerBindingType_NonFiltering; default: SOKOL_UNREACHABLE; return WGPUSamplerBindingType_Force32; } } @@ -14942,7 +14943,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_VS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARE) { + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARISON) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER); @@ -14981,7 +14982,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); _SG_VALIDATE(smp != 0, VALIDATE_ABND_FS_SMP_EXISTS); if (smp) { - if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARE) { + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_COMPARISON) { _SG_VALIDATE(smp->cmn.compare != SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER); } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER); @@ -15210,7 +15211,7 @@ _SOKOL_PRIVATE sg_shader_desc _sg_shader_desc_defaults(const sg_shader_desc* des if (!smp_desc->used) { break; } - smp_desc->sampler_type = _sg_def(smp_desc->sampler_type, SG_SAMPLERTYPE_SAMPLE); + smp_desc->sampler_type = _sg_def(smp_desc->sampler_type, SG_SAMPLERTYPE_FILTERING); } } return def; From eeb975cf9c1796819ec5578582ea435ac8e9c4fe Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 31 Aug 2023 16:54:02 +0200 Subject: [PATCH 158/292] sg_sampler_type renaming fixes --- tests/functional/sokol_gfx_test.c | 16 ++++++++-------- util/sokol_debugtext.h | 2 +- util/sokol_fontstash.h | 2 +- util/sokol_gfx_imgui.h | 8 +++++--- util/sokol_gl.h | 2 +- util/sokol_imgui.h | 2 +- util/sokol_nuklear.h | 2 +- util/sokol_spine.h | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 28084e0f3..90d460afe 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -1064,8 +1064,8 @@ UTEST(sokol_gfx, query_shader_desc) { }, .images[0] = { .used = true, .image_type = SG_IMAGETYPE_2D, .sample_type = SG_IMAGESAMPLETYPE_FLOAT, .multisampled = true }, .images[1] = { .used = true, .image_type = SG_IMAGETYPE_3D, .sample_type = SG_IMAGESAMPLETYPE_SINT }, - .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, - .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARE }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_FILTERING }, + .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARISON }, .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 1, .glsl_name = "img0" }, .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 0, .glsl_name = "img1" }, }, @@ -1073,8 +1073,8 @@ UTEST(sokol_gfx, query_shader_desc) { .source = "fs_source", .images[0] = { .used = true, .image_type = SG_IMAGETYPE_ARRAY, .sample_type = SG_IMAGESAMPLETYPE_DEPTH }, .images[1] = { .used = true, .image_type = SG_IMAGETYPE_CUBE, .sample_type = SG_IMAGESAMPLETYPE_FLOAT }, - .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARE }, - .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARISON }, + .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_FILTERING }, .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 0, .glsl_name = "img3" }, .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 1, .glsl_name = "img4" }, }, @@ -1099,9 +1099,9 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.vs.images[1].sample_type == SG_IMAGESAMPLETYPE_SINT); T(s0_desc.vs.images[1].multisampled == false); T(s0_desc.vs.samplers[0].used); - T(s0_desc.vs.samplers[0].sampler_type == SG_SAMPLERTYPE_SAMPLE); + T(s0_desc.vs.samplers[0].sampler_type == SG_SAMPLERTYPE_FILTERING); T(s0_desc.vs.samplers[1].used); - T(s0_desc.vs.samplers[1].sampler_type == SG_SAMPLERTYPE_COMPARE); + T(s0_desc.vs.samplers[1].sampler_type == SG_SAMPLERTYPE_COMPARISON); T(s0_desc.vs.image_sampler_pairs[0].used); T(s0_desc.vs.image_sampler_pairs[0].image_slot == 0); T(s0_desc.vs.image_sampler_pairs[0].sampler_slot == 1); @@ -1125,9 +1125,9 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.fs.images[1].sample_type == SG_IMAGESAMPLETYPE_FLOAT); T(s0_desc.fs.images[1].multisampled == false); T(s0_desc.fs.samplers[0].used); - T(s0_desc.fs.samplers[0].sampler_type == SG_SAMPLERTYPE_COMPARE); + T(s0_desc.fs.samplers[0].sampler_type == SG_SAMPLERTYPE_COMPARISON); T(s0_desc.fs.samplers[1].used); - T(s0_desc.fs.samplers[1].sampler_type == SG_SAMPLERTYPE_SAMPLE); + T(s0_desc.fs.samplers[1].sampler_type == SG_SAMPLERTYPE_FILTERING); T(s0_desc.fs.image_sampler_pairs[0].used); T(s0_desc.fs.image_sampler_pairs[0].image_slot == 0); T(s0_desc.fs.image_sampler_pairs[0].sampler_slot == 0); diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index 4d4ee6e1f..b0af45dd3 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -4007,7 +4007,7 @@ static void _sdtx_setup_common(void) { shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; shd_desc.fs.samplers[0].used = true; - shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; shd_desc.fs.image_sampler_pairs[0].used = true; shd_desc.fs.image_sampler_pairs[0].image_slot = 0; shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 9719e3802..46950e45c 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -1663,7 +1663,7 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; shd_desc.fs.samplers[0].used = true; - shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; shd_desc.fs.image_sampler_pairs[0].used = true; shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp"; shd_desc.fs.image_sampler_pairs[0].image_slot = 0; diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index f9106f1bb..9685331c9 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -1136,15 +1136,17 @@ _SOKOL_PRIVATE const char* _sg_imgui_imagesampletype_string(sg_image_sample_type case SG_IMAGESAMPLETYPE_DEPTH: return "SG_IMAGESAMPLETYPE_DEPTH"; case SG_IMAGESAMPLETYPE_SINT: return "SG_IMAGESAMPLETYPE_SINT"; case SG_IMAGESAMPLETYPE_UINT: return "SG_IMAGESAMPLETYPE_UINT"; + case SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT: return "SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT"; default: return "???"; } } _SOKOL_PRIVATE const char* _sg_imgui_samplertype_string(sg_sampler_type t) { switch (t) { - case SG_SAMPLERTYPE_SAMPLE: return "SG_SAMPLERTYPE_SAMPLE"; - case SG_SAMPLERTYPE_COMPARE: return "SG_SAMPLERTYPE_COMPARE"; - default: return "???"; + case SG_SAMPLERTYPE_FILTERING: return "SG_SAMPLERTYPE_FILTERING"; + case SG_SAMPLERTYPE_COMPARISON: return "SG_SAMPLERTYPE_COMPARISON"; + case SG_SAMPLERTYPE_NONFILTERING: return "SG_SAMPLERTYPE_NONFILTERING"; + default: return "???"; } } diff --git a/util/sokol_gl.h b/util/sokol_gl.h index f17da4788..7fe1d936f 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -3344,7 +3344,7 @@ static void _sgl_setup_common(void) { shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; shd_desc.fs.samplers[0].used = true; - shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; shd_desc.fs.image_sampler_pairs[0].used = true; shd_desc.fs.image_sampler_pairs[0].image_slot = 0; shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 024b37618..e8abe7d81 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -2363,7 +2363,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; shd_desc.fs.samplers[0].used = true; - shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; shd_desc.fs.image_sampler_pairs[0].used = true; shd_desc.fs.image_sampler_pairs[0].image_slot = 0; shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index ae4e9ae09..8a5cfb8d3 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -2293,7 +2293,7 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { .entry = fs_entry, .d3d11_target = "ps_4_0", .images[0] = { .used = true, .image_type = SG_IMAGETYPE_2D, .sample_type = SG_IMAGESAMPLETYPE_FLOAT }, - .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_SAMPLE }, + .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_FILTERING }, .image_sampler_pairs[0] = { .used = true, .glsl_name = "tex_smp", .image_slot = 0, .sampler_slot = 0 }, }, .label = "sokol-nuklear-shader" diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 5a9125aea..0ca556c8c 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -4521,7 +4521,7 @@ static void _sspine_init_shared(void) { shd_desc.fs.images[0].image_type = SG_IMAGETYPE_2D; shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; shd_desc.fs.samplers[0].used = true; - shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_SAMPLE; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; shd_desc.fs.image_sampler_pairs[0].used = true; shd_desc.fs.image_sampler_pairs[0].image_slot = 0; shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0; From f697ca389123e8bc34b685fd50092d84433a800a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 2 Sep 2023 18:15:09 +0200 Subject: [PATCH 159/292] sokol_debugtext.h: fix embedded wgsl shader --- util/sokol_debugtext.h | 270 ++++++++++++++++------------------------- 1 file changed, 104 insertions(+), 166 deletions(-) diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index b0af45dd3..981cab465 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -3351,171 +3351,109 @@ static const uint8_t _sdtx_fs_bytecode_hlsl4[608] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -static const uint8_t _sdtx_vs_bytecode_wgpu[1648] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x2e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x24,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x2c,0x00,0x00,0x00, - 0x2d,0x00,0x00,0x00,0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65, - 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e, - 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65, - 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20, - 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65, - 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00, - 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00, - 0x0c,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78, - 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00, - 0x0c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00, - 0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00, - 0x05,0x00,0x03,0x00,0x24,0x00,0x00,0x00,0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00, - 0x25,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x27,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00, - 0x05,0x00,0x05,0x00,0x2c,0x00,0x00,0x00,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65, - 0x78,0x49,0x44,0x00,0x05,0x00,0x06,0x00,0x2d,0x00,0x00,0x00,0x67,0x6c,0x5f,0x49, - 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x47,0x00,0x03,0x00, - 0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x13,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x24,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x25,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x27,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x29,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2c,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2d,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00, - 0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00, - 0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00, - 0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x09,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x09,0x00,0x00,0x00, - 0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,0x0b,0x00,0x00,0x00, - 0x07,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,0x0c,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x15,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x40, - 0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0xc0, - 0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x15,0x00,0x00,0x00, - 0x16,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x19,0x00,0x00,0x00, - 0x00,0x00,0x80,0xbf,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x00,0x00,0x80,0x3f,0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00, - 0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x21,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x23,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x23,0x00,0x00,0x00, - 0x24,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x21,0x00,0x00,0x00, - 0x27,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x28,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x28,0x00,0x00,0x00, - 0x29,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x2b,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2b,0x00,0x00,0x00, - 0x2c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x2b,0x00,0x00,0x00, - 0x2d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00, - 0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00, - 0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x13,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0x14,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x81,0x00,0x05,0x00,0x11,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x51,0x00,0x05,0x00, - 0x07,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x51,0x00,0x05,0x00,0x07,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x50,0x00,0x07,0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x41,0x00,0x05,0x00,0x21,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x0e,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x22,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x25,0x00,0x00,0x00, - 0x3e,0x00,0x03,0x00,0x24,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x08,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x3e,0x00,0x03,0x00, - 0x27,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sdtx_vs_source_wgsl[922] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, + 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, + 0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a, + 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, + 0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20, + 0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f, + 0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20, + 0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x28,0x28,0x78,0x5f,0x31,0x39,0x20,0x2a, + 0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x32,0x2e,0x30,0x66,0x2c,0x20,0x2d,0x32,0x2e, + 0x30,0x66,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x2d,0x31,0x2e, + 0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34, + 0x66,0x28,0x78,0x5f,0x32,0x37,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32,0x37,0x2e,0x79, + 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20, + 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, + 0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20, + 0x20,0x75,0x76,0x20,0x3d,0x20,0x78,0x5f,0x33,0x37,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x34,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3d,0x20,0x78,0x5f,0x34,0x31,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72, + 0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69, + 0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74, + 0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x30,0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, + 0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31, + 0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, + 0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78,0x63, + 0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32, + 0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f, + 0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, + 0x64,0x30,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3d, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const uint8_t _sdtx_fs_bytecode_wgpu[940] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x1a,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00, - 0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64, - 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69, - 0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c, - 0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50, - 0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d, - 0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70, - 0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65, - 0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d, - 0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65, - 0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00, - 0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x12,0x00,0x00,0x00,0x75,0x76,0x00,0x00, - 0x05,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x19,0x00,0x09,0x00,0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x0c,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x10,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x05,0x00, - 0x08,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x4f,0x00,0x09,0x00,0x08,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0x17,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x08,0x00,0x00,0x00,0x19,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0a,0x00,0x00,0x00, - 0x19,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sdtx_fs_source_wgsl[663] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, + 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32, + 0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67, + 0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, + 0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x78,0x5f,0x32,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, + 0x20,0x78,0x5f,0x32,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x32, + 0x34,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32,0x34,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32, + 0x34,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32,0x34,0x2e,0x78,0x29,0x20,0x2a,0x20,0x78, + 0x5f,0x32,0x38,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f, + 0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40, + 0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c, + 0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b, + 0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31, + 0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69, + 0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _sdtx_vs_src_dummy = ""; @@ -4039,8 +3977,8 @@ static void _sdtx_setup_common(void) { shd_desc.vs.bytecode = SG_RANGE(_sdtx_vs_bytecode_hlsl4); shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - shd_desc.vs.bytecode = SG_RANGE(_sdtx_vs_bytecode_wgpu); - shd_desc.fs.bytecode = SG_RANGE(_sdtx_fs_bytecode_wgpu); + shd_desc.vs.source = _sdtx_vs_source_wgsl; + shd_desc.fs.source = _sdtx_fs_source_wgsl; #else shd_desc.vs.source = _sdtx_vs_src_dummy; shd_desc.fs.source = _sdtx_fs_src_dummy; From 9d18ccc58ec2c5f389b946dc567fc96742cf6201 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 2 Sep 2023 18:27:39 +0200 Subject: [PATCH 160/292] sokol_gfx.h wgpu: fix 3d texture view arrayLayerCount --- sokol_gfx.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 31fe1bffb..2ee46b9d9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12680,7 +12680,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s wgpu_texview_desc.label = desc->label; wgpu_texview_desc.dimension = _sg_wgpu_texture_view_dimension(img->cmn.type); wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; - wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + // FIXME: cubemap?? + if (img->cmn.type == SG_IMAGETYPE_ARRAY) { + wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + } else { + wgpu_texview_desc.arrayLayerCount = 1; + } // FIXME: should aspect be DepthOnly for all depth texture formats? wgpu_texview_desc.aspect = WGPUTextureAspect_All; img->wgpu.view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_texview_desc); From 08e258a9c00f0496802adbe30d830e8835745fa4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 2 Sep 2023 18:56:31 +0200 Subject: [PATCH 161/292] sokol_app.h, sokol_gfx.h wgpu: support bc and etc2 compressed texture formats --- sokol_app.h | 13 +++++++++++-- sokol_gfx.h | 33 ++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index 1a13ba7b8..7055653b0 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -5743,12 +5743,21 @@ _SOKOL_PRIVATE void _sapp_emsc_wgpu_request_adapter_cb(WGPURequestAdapterStatus } SOKOL_ASSERT(adapter); _sapp.wgpu.adapter = adapter; - const WGPUFeatureName requiredFeatures[1] = { + size_t cur_feature_index = 1; + WGPUFeatureName requiredFeatures[8] = { WGPUFeatureName_Depth32FloatStencil8, }; + // check for optional features we're interested in + // FIXME: ASTC texture compression + if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionBC)) { + requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionBC; + } else if (wgpuAdapterHasFeature(adapter, WGPUFeatureName_TextureCompressionETC2)) { + requiredFeatures[cur_feature_index++] = WGPUFeatureName_TextureCompressionETC2; + } + WGPUDeviceDescriptor dev_desc; _sapp_clear(&dev_desc, sizeof(dev_desc)); - dev_desc.requiredFeaturesCount = 1, + dev_desc.requiredFeaturesCount = cur_feature_index; dev_desc.requiredFeatures = requiredFeatures, wgpuAdapterRequestDevice(adapter, &dev_desc, _sapp_emsc_wgpu_request_device_cb, 0); } diff --git a/sokol_gfx.h b/sokol_gfx.h index 2ee46b9d9..dde49065c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12341,6 +12341,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_R8SN]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R8UI]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R8SI]); + // NOTE: no WGPUTextureFormat_R16Unorm _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R16UI]); _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R16SI]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); @@ -12373,19 +12374,25 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH]); _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH_STENCIL]); - /* FIXME FIXME FIXME: need to check if BC texture compression is - actually supported, currently the WebGPU C-API doesn't allow this - */ - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC1_RGBA]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC2_RGBA]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC3_RGBA]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC4_R]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC4_RSN]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC5_RG]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC5_RGSN]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC6H_RGBF]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC6H_RGBUF]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_RGBA]); + if (wgpuDeviceHasFeature(_sg.wgpu.dev, WGPUFeatureName_TextureCompressionBC)) { + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC1_RGBA]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC2_RGBA]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC3_RGBA]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC4_R]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC4_RSN]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC5_RG]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC5_RGSN]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC6H_RGBF]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC6H_RGBUF]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_RGBA]); + } + if (wgpuDeviceHasFeature(_sg.wgpu.dev, WGPUFeatureName_TextureCompressionETC2)) { + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGB8]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGB8A1]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGBA8]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RG11]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RG11SN]); + } } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { From 7008ca1f3110305de7f00157078927433bb44a0a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 2 Sep 2023 19:02:33 +0200 Subject: [PATCH 162/292] sokol_gfx.h wgpu: in _sg_wgpu_copy_image_data() round up mip width/height to multiple of 4 for compressed formats --- sokol_gfx.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index dde49065c..98d713b3f 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12625,8 +12625,8 @@ _SOKOL_PRIVATE void _sg_wgpu_copy_image_data(const _sg_image_t* img, WGPUTexture _sg_clear(&wgpu_extent, sizeof(wgpu_extent)); for (int mip_level = 0; mip_level < img->cmn.num_mipmaps; mip_level++) { wgpu_copy_tex.mipLevel = (uint32_t)mip_level; - const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_level); - const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_level); + int mip_width = _sg_miplevel_dim(img->cmn.width, mip_level); + int mip_height = _sg_miplevel_dim(img->cmn.height, mip_level); int mip_slices; switch (img->cmn.type) { case SG_IMAGETYPE_CUBE: @@ -12641,6 +12641,10 @@ _SOKOL_PRIVATE void _sg_wgpu_copy_image_data(const _sg_image_t* img, WGPUTexture } const int row_pitch = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1); const int num_rows = _sg_num_rows(img->cmn.pixel_format, mip_height); + if (_sg_is_compressed_pixel_format(img->cmn.pixel_format)) { + mip_width = _sg_roundup(mip_width, 4); + mip_height = _sg_roundup(mip_height, 4); + } wgpu_layout.offset = 0; wgpu_layout.bytesPerRow = (uint32_t)row_pitch; wgpu_layout.rowsPerImage = (uint32_t)num_rows; From 465a795ee9be1c90d082038cd07c733304f27703 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 2 Sep 2023 19:21:08 +0200 Subject: [PATCH 163/292] sokol_gl.h: fix embedded wgsl shader --- util/sokol_gl.h | 306 +++++++++++++++++++----------------------------- 1 file changed, 120 insertions(+), 186 deletions(-) diff --git a/util/sokol_gl.h b/util/sokol_gl.h index 7fe1d936f..32cc07f58 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -991,7 +991,9 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline out vec4 color; void main() { gl_Position = mvp * position; + #ifndef SOKOL_WGSL gl_PointSize = psize; + #endif uv = tm * vec4(texcoord0, 0.0, 1.0); color = color0; } @@ -2078,191 +2080,123 @@ static const uint8_t _sgl_fs_bytecode_hlsl4[608] = { }; #elif defined(SOKOL_WGPU) -static const uint8_t _sgl_vs_bytecode_wgpu[1968] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x21,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x33,0x00,0x00,0x00, - 0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00, - 0x07,0x00,0x00,0x00,0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00,0x00,0x00, - 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65, - 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e, - 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65, - 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20, - 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65, - 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00, - 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00, - 0x0d,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78, - 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00, - 0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00, - 0x05,0x00,0x03,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x00,0x00,0x00, - 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x76,0x70,0x00, - 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x74,0x6d,0x00,0x00, - 0x05,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x5f,0x32,0x31,0x00,0x05,0x00,0x05,0x00, - 0x1a,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x70,0x73,0x69,0x7a,0x65,0x00,0x00,0x00, - 0x05,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00, - 0x2a,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x32,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00, - 0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x47,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x04,0x00, - 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x48,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x23,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x47,0x00,0x03,0x00, - 0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00, - 0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1a,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x21,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x25,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2a,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x32,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00, - 0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00, - 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0a,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,0x0c,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,0x0d,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0d,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x15,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x18,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x1e,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x09,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x23,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x28,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x28,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x80,0x3f, - 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00, - 0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x11,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x91,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0x1b,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x0f,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x1e,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x23,0x00,0x00,0x00,0x24,0x00,0x00,0x00, - 0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x24,0x00,0x00,0x00, - 0x22,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x16,0x00,0x00,0x00,0x26,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x27,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x28,0x00,0x00,0x00, - 0x2b,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x51,0x00,0x05,0x00,0x08,0x00,0x00,0x00, - 0x2e,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x00,0x05,0x00, - 0x08,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x50,0x00,0x07,0x00,0x09,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, - 0x2f,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x91,0x00,0x05,0x00, - 0x09,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x30,0x00,0x00,0x00, - 0x3e,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x09,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x3e,0x00,0x03,0x00, - 0x32,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sgl_vs_source_wgsl[1162] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, + 0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34,0x29, + 0x20,0x2a,0x2f,0x0a,0x20,0x20,0x74,0x6d,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78, + 0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29, + 0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76,0x61,0x72, + 0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a, + 0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72, + 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69, + 0x6f,0x6e,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76, + 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, + 0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x70,0x73,0x69,0x7a,0x65,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x0a, + 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b, + 0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20,0x3a,0x20,0x6d,0x61, + 0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x35,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f, + 0x31,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x32,0x20,0x2a,0x20,0x78,0x5f,0x32,0x35,0x29, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x32,0x20,0x3a,0x20,0x6d, + 0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x74,0x6d, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, + 0x3b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x28,0x78,0x5f,0x33,0x32,0x20,0x2a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x33,0x36,0x2e,0x78,0x2c,0x20,0x78, + 0x5f,0x33,0x36,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30, + 0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x35,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x35, + 0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73, + 0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b, + 0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76, + 0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c, + 0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a, + 0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, + 0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c, + 0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x33,0x29,0x20,0x70,0x73, + 0x69,0x7a,0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x66,0x33,0x32,0x29, + 0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, + 0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d,0x20,0x74,0x65, + 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x70,0x73,0x69,0x7a,0x65,0x20, + 0x3d,0x20,0x70,0x73,0x69,0x7a,0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const uint8_t _sgl_fs_bytecode_wgpu[936] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x1a,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,0x07,0x00,0x00,0x00, - 0x73,0x67,0x6c,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00,0x00,0x00,0x03,0x00,0x37,0x00, - 0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30, - 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f, - 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70, - 0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64, - 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72, - 0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e, - 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f, - 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e, - 0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f, - 0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e, - 0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00, - 0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0b,0x00,0x00,0x00, - 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00, - 0x0f,0x00,0x00,0x00,0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x12,0x00,0x00,0x00, - 0x75,0x76,0x00,0x00,0x05,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f, - 0x72,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x21,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00, - 0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x19,0x00,0x09,0x00,0x0c,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0d,0x00,0x00,0x00, - 0x0c,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0d,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00, - 0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x0f,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x4f,0x00,0x07,0x00,0x13,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x57,0x00,0x05,0x00, - 0x09,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x15,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x85,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x18,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0b,0x00,0x00,0x00,0x19,0x00,0x00,0x00, - 0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sgl_fs_source_wgsl[647] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, + 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32, + 0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67, + 0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, + 0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x78,0x5f,0x32,0x33,0x2e,0x78, + 0x2c,0x20,0x78,0x5f,0x32,0x33,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x35,0x20,0x2a,0x20,0x78, + 0x5f,0x32,0x37,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f, + 0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40, + 0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c, + 0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b, + 0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31, + 0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69, + 0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _sgl_vs_source_dummy = ""; @@ -3377,8 +3311,8 @@ static void _sgl_setup_common(void) { shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_hlsl4); shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_wgpu); - shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_wgpu); + shd_desc.vs.source = _sgl_vs_source_wgsl; + shd_desc.fs.source = _sgl_fs_source_wgsl; #else shd_desc.vs.source = _sgl_vs_source_dummy; shd_desc.fs.source = _sgl_fs_source_dummy; From c703eceac9d8e28e9bc41896dae6d872ecc16536 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 12:48:38 +0200 Subject: [PATCH 164/292] sokol_fontstash.h wgpu: fix embedded shader --- util/sokol_fontstash.h | 314 ++++++++++++++++------------------------- 1 file changed, 122 insertions(+), 192 deletions(-) diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 46950e45c..c6e9b5f6f 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -300,7 +300,9 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui out vec4 color; void main() { gl_Position = mvp * position; + #ifndef SOKOL_WGSL gl_PointSize = psize; + #endif uv = tm * vec4(texcoord0, 0.0, 1.0); color = color0; } @@ -1395,195 +1397,125 @@ static const uint8_t _sfons_fs_bytecode_hlsl4[628] = { 0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -static const uint8_t _sfons_vs_bytecode_wgpu[1968] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x35,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x21,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x33,0x00,0x00,0x00, - 0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00, - 0x07,0x00,0x00,0x00,0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00, - 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65, - 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e, - 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65, - 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20, - 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65, - 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00, - 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00, - 0x0d,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78, - 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00, - 0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00, - 0x05,0x00,0x03,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x00,0x00,0x00, - 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x76,0x70,0x00, - 0x06,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x74,0x6d,0x00,0x00, - 0x05,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x5f,0x32,0x31,0x00,0x05,0x00,0x05,0x00, - 0x1a,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x21,0x00,0x00,0x00,0x70,0x73,0x69,0x7a,0x65,0x00,0x00,0x00, - 0x05,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00, - 0x2a,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x32,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x05,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00, - 0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0d,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x0d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x47,0x00,0x03,0x00,0x0d,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x48,0x00,0x04,0x00, - 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x48,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x05,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x23,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x13,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x47,0x00,0x03,0x00, - 0x13,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00, - 0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x15,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1a,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x21,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x25,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x2a,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x32,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00, - 0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00, - 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0a,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1c,0x00,0x04,0x00,0x0c,0x00,0x00,0x00, - 0x08,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x06,0x00,0x0d,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0d,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x15,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x18,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x1e,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x12,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x09,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x23,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x28,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x28,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,0x80,0x3f, - 0x3b,0x00,0x04,0x00,0x1d,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x19,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00, - 0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x11,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x91,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0x1b,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x0f,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x1e,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x23,0x00,0x00,0x00,0x24,0x00,0x00,0x00, - 0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x24,0x00,0x00,0x00, - 0x22,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x16,0x00,0x00,0x00,0x26,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x27,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x28,0x00,0x00,0x00, - 0x2b,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x51,0x00,0x05,0x00,0x08,0x00,0x00,0x00, - 0x2e,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x00,0x05,0x00, - 0x08,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x50,0x00,0x07,0x00,0x09,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, - 0x2f,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x91,0x00,0x05,0x00, - 0x09,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x30,0x00,0x00,0x00, - 0x3e,0x00,0x03,0x00,0x25,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x09,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x3e,0x00,0x03,0x00, - 0x32,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sfons_vs_source_wgsl[1162] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, + 0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34,0x29, + 0x20,0x2a,0x2f,0x0a,0x20,0x20,0x74,0x6d,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78, + 0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29, + 0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76,0x61,0x72, + 0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a, + 0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72, + 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69, + 0x6f,0x6e,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76, + 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, + 0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x70,0x73,0x69,0x7a,0x65,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x0a, + 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b, + 0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20,0x3a,0x20,0x6d,0x61, + 0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x35,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f, + 0x31,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x32,0x20,0x2a,0x20,0x78,0x5f,0x32,0x35,0x29, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x32,0x20,0x3a,0x20,0x6d, + 0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x74,0x6d, + 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, + 0x3b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x28,0x78,0x5f,0x33,0x32,0x20,0x2a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x33,0x36,0x2e,0x78,0x2c,0x20,0x78, + 0x5f,0x33,0x36,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30, + 0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x35,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x35, + 0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73, + 0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b, + 0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76, + 0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c, + 0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a, + 0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, + 0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c, + 0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x33,0x29,0x20,0x70,0x73, + 0x69,0x7a,0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x66,0x33,0x32,0x29, + 0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, + 0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d,0x20,0x74,0x65, + 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x70,0x73,0x69,0x7a,0x65,0x20, + 0x3d,0x20,0x70,0x73,0x69,0x7a,0x65,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74, + 0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const uint8_t fs_bytecode_wgpu[1000] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x1f,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x05,0x00,0x07,0x00,0x00,0x00, - 0x73,0x66,0x6f,0x6e,0x73,0x2e,0x67,0x6c,0x73,0x6c,0x00,0x00,0x03,0x00,0x37,0x00, - 0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30, - 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f, - 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70, - 0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64, - 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72, - 0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e, - 0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f, - 0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e, - 0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f, - 0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e, - 0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23, - 0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00, - 0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0b,0x00,0x00,0x00, - 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00, - 0x10,0x00,0x00,0x00,0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x13,0x00,0x00,0x00, - 0x75,0x76,0x00,0x00,0x05,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f, - 0x72,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x21,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x04,0x00,0x1c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00, - 0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x08,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x00,0x00,0x80,0x3f,0x19,0x00,0x09,0x00,0x0d,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0e,0x00,0x00,0x00, - 0x0d,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0e,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x09,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x14,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00, - 0x08,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x4f,0x00,0x07,0x00,0x14,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x15,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x57,0x00,0x05,0x00, - 0x09,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x51,0x00,0x05,0x00,0x08,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x50,0x00,0x07,0x00,0x09,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x0c,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x85,0x00,0x05,0x00,0x09,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x1d,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00, - 0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _sfons_fs_source_wgsl[674] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, + 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32, + 0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67, + 0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, + 0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x78,0x5f,0x32,0x34,0x2e,0x78, + 0x2c,0x20,0x78,0x5f,0x32,0x34,0x2e,0x79,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x33,0x32,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x76,0x65,0x63,0x34,0x66,0x28,0x31,0x2e, + 0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20, + 0x78,0x5f,0x32,0x36,0x2e,0x78,0x29,0x20,0x2a,0x20,0x78,0x5f,0x33,0x32,0x29,0x3b, + 0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74, + 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, + 0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20, + 0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d, + 0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63, + 0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61, + 0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61, + 0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20, + 0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x75,0x76,0x20, + 0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61, + 0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, + 0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x00, }; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _sfons_vs_source_dummy = ""; @@ -1696,10 +1628,8 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { shd_desc.vs.bytecode = SG_RANGE(_sfons_vs_bytecode_hlsl4); shd_desc.fs.bytecode = SG_RANGE(_sfons_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - shd_desc.vs.byte_code = _sfons_vs_bytecode_wgpu; - shd_desc.vs.byte_code_size = sizeof(_sfons_vs_bytecode_wgpu); - shd_desc.fs.byte_code = _sfons_fs_bytecode_wgpu; - shd_desc.fs.byte_code_size = sizeof(_sfons_fs_bytecode_wgpu); + shd_desc.vs.source = _sfons_vs_source_wgsl; + shd_desc.fs.source = _sfons_fs_source_wgsl; #else shd_desc.vs.source = _sfons_vs_source_dummy; shd_desc.fs.source = _sfons_fs_source_dummy; From 561eec0271e9e11ba64f4dd4e692bf4a2a6e9eb7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 13:09:29 +0200 Subject: [PATCH 165/292] sokol_imgui.h wgpu: fix embedded shader --- util/sokol_imgui.h | 290 +++++++++++++++++---------------------------- 1 file changed, 112 insertions(+), 178 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index e8abe7d81..51ad4eb52 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -1704,183 +1704,117 @@ static const uint8_t _simgui_fs_bytecode_hlsl4[608] = { }; #elif defined(SOKOL_WGPU) -static const uint8_t _simgui_vs_bytecode_wgpu[1868] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x34,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, - 0x2b,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x32,0x00,0x00,0x00, - 0x33,0x00,0x00,0x00,0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65, - 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e, - 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65, - 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20, - 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65, - 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00, - 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00, - 0x0c,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78, - 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00, - 0x0c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00, - 0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00, - 0x05,0x00,0x05,0x00,0x15,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x00,0x00,0x00,0x05,0x00,0x03,0x00, - 0x17,0x00,0x00,0x00,0x5f,0x32,0x33,0x00,0x05,0x00,0x03,0x00,0x2a,0x00,0x00,0x00, - 0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00,0x2b,0x00,0x00,0x00,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x2d,0x00,0x00,0x00, - 0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x2f,0x00,0x00,0x00, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00,0x05,0x00,0x05,0x00,0x32,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x00,0x05,0x00,0x06,0x00, - 0x33,0x00,0x00,0x00,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, - 0x44,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x32,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x05,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x06,0x00,0x00,0x00, - 0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x15,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x1c,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, - 0x1e,0x00,0x06,0x00,0x0c,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00, - 0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0f,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x11,0x00,0x00,0x00, - 0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1e,0x00,0x03,0x00,0x15,0x00,0x00,0x00, - 0x11,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x18,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x11,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x00,0x00,0x00,0x3f,0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x1d,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00, - 0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x2b,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,0x20,0x00,0x04,0x00, - 0x27,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x29,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x12,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x27,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x2e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x2e,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00, - 0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x11,0x00,0x00,0x00, - 0x14,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x18,0x00,0x00,0x00, - 0x19,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x11,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x88,0x00,0x05,0x00, - 0x11,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x83,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x1d,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x51,0x00,0x05,0x00,0x07,0x00,0x00,0x00, - 0x24,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x00,0x05,0x00, - 0x07,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x50,0x00,0x07,0x00,0x08,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x24,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x41,0x00,0x05,0x00, - 0x27,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3e,0x00,0x03,0x00,0x28,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x11,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x3e,0x00,0x03,0x00, - 0x2a,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00, - 0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00, - 0x30,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x2d,0x00,0x00,0x00, - 0x30,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _simgui_vs_source_wgsl[1083] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28, + 0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76, + 0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x32,0x32, + 0x20,0x3a,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76, + 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, + 0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20, + 0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, + 0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x39, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x5f,0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x78,0x5f,0x32,0x32, + 0x2e,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x33,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d, + 0x20,0x28,0x28,0x28,0x78,0x5f,0x31,0x39,0x20,0x2f,0x20,0x78,0x5f,0x32,0x35,0x29, + 0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30, + 0x2e,0x35,0x66,0x29,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x32,0x2e, + 0x30,0x66,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63, + 0x34,0x66,0x28,0x78,0x5f,0x33,0x33,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x33,0x2e, + 0x79,0x2c,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, + 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x33,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x78,0x5f,0x34,0x33,0x3b,0x0a,0x20,0x20,0x6c, + 0x65,0x74,0x20,0x78,0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f, + 0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x37,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c, + 0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20, + 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x31,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78, + 0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x32,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e, + 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, + 0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f, + 0x72,0x64,0x30,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const uint8_t _simgui_fs_bytecode_wgpu[904] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x19,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00, - 0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64, - 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69, - 0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c, - 0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50, - 0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d, - 0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70, - 0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65, - 0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d, - 0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65, - 0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00, - 0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x12,0x00,0x00,0x00,0x75,0x76,0x00,0x00, - 0x05,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x19,0x00,0x09,0x00,0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x0c,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x10,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x05,0x00, - 0x08,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x85,0x00,0x05,0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x17,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0a,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _simgui_fs_source_wgsl[630] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, + 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32, + 0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67, + 0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, + 0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x78,0x5f,0x32,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, + 0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x34,0x20,0x2a,0x20,0x78,0x5f, + 0x32,0x37,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, + 0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f, + 0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66, + 0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c,0x6f, + 0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29, + 0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, + 0x20,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28, + 0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29, + 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _simgui_vs_source_dummy = ""; @@ -2396,8 +2330,8 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { shd_desc.vs.bytecode = SG_RANGE(_simgui_vs_bytecode_hlsl4); shd_desc.fs.bytecode = SG_RANGE(_simgui_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - shd_desc.vs.bytecode = SG_RANGE(_simgui_vs_bytecode_wgpu); - shd_desc.fs.bytecode = SG_RANGE(_simgui_fs_bytecode_wgpu); + shd_desc.vs.source = _simgui_vs_source_wgsl; + shd_desc.fs.source = _simgui_fs_source_wgsl; #else shd_desc.vs.source = _simgui_vs_source_dummy; shd_desc.fs.source = _simgui_fs_source_dummy; From 21b4cb1dacd81f3e12b034e7df5ded6929e86e2b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 13:10:09 +0200 Subject: [PATCH 166/292] sokol_gfx_imgui.h: fix missing sokol-gfx wgpu backend string --- util/sokol_gfx_imgui.h | 1 + 1 file changed, 1 insertion(+) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 9685331c9..7614f61a7 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -1098,6 +1098,7 @@ _SOKOL_PRIVATE const char* _sg_imgui_backend_string(sg_backend b) { case SG_BACKEND_METAL_IOS: return "SG_BACKEND_METAL_IOS"; case SG_BACKEND_METAL_MACOS: return "SG_BACKEND_METAL_MACOS"; case SG_BACKEND_METAL_SIMULATOR: return "SG_BACKEND_METAL_SIMULATOR"; + case SG_BACKEND_WGPU: return "SG_BACKEND_WGPU"; case SG_BACKEND_DUMMY: return "SG_BACKEND_DUMMY"; default: return "???"; } From 915214d277799867450632d0e8455db51e20e0c8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 13:36:35 +0200 Subject: [PATCH 167/292] sokol_gfx.h wgpu: fix memory clearing bug in bind group layout setup --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 98d713b3f..70b2937c9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12766,6 +12766,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const #define _sg_wgpu_create_shader_max_bgl_entries (SG_NUM_SHADER_STAGES * (SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS)) WGPUBindGroupLayoutEntry wgpu_bgl_entries[_sg_wgpu_create_shader_max_bgl_entries]; + _sg_clear(wgpu_bgl_entries, sizeof(wgpu_bgl_entries)); int bgl_index = 0; for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { const sg_shader_stage_desc* stage_desc = (stage_index == SG_SHADERSTAGE_VS) ? &desc->vs : &desc->fs; @@ -12800,7 +12801,6 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const _SG_ERROR(WGPU_SHADER_TOO_MANY_SAMPLERS); return SG_RESOURCESTATE_FAILED; } - _sg_clear(wgpu_bgl_entries, sizeof(wgpu_bgl_entries)); for (int img_index = 0; img_index < num_images; img_index++) { SOKOL_ASSERT(bgl_index < _sg_wgpu_create_shader_max_bgl_entries); WGPUBindGroupLayoutEntry* wgpu_bgl_entry = &wgpu_bgl_entries[bgl_index++]; From bd96188aa66348729d2bbe1a682678708e434d3f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 13:48:09 +0200 Subject: [PATCH 168/292] sokol_nuklear.h: fix embedded wgsl shaders --- util/sokol_nuklear.h | 290 +++++++++++++++++-------------------------- 1 file changed, 112 insertions(+), 178 deletions(-) diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index 8a5cfb8d3..74f6fee28 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -1612,183 +1612,117 @@ static const uint8_t _snk_fs_bytecode_hlsl4[608] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; #elif defined(SOKOL_WGPU) -static const uint8_t _snk_vs_bytecode_wgpu[1520] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x27,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, - 0x2b,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x32,0x00,0x00,0x00, - 0x33,0x00,0x00,0x00,0x07,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00,0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00, - 0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65, - 0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e, - 0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f, - 0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64, - 0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b, - 0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c, - 0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65, - 0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20, - 0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65, - 0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d,0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65,0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00, - 0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,0x05,0x00,0x06,0x00, - 0x0c,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x65,0x72,0x56,0x65,0x72,0x74,0x65,0x78, - 0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x06,0x00,0x07,0x00, - 0x0c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74, - 0x53,0x69,0x7a,0x65,0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x67,0x6c,0x5f,0x43,0x6c,0x69,0x70,0x44,0x69,0x73,0x74,0x61, - 0x6e,0x63,0x65,0x00,0x06,0x00,0x07,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x43,0x75,0x6c,0x6c,0x44,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x00, - 0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00, - 0x13,0x00,0x00,0x00,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x00, - 0x05,0x00,0x05,0x00,0x15,0x00,0x00,0x00,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x00,0x00,0x00,0x06,0x00,0x06,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x00,0x00,0x00,0x05,0x00,0x03,0x00, - 0x17,0x00,0x00,0x00,0x5f,0x32,0x33,0x00,0x05,0x00,0x03,0x00,0x2a,0x00,0x00,0x00, - 0x75,0x76,0x00,0x00,0x05,0x00,0x05,0x00,0x2b,0x00,0x00,0x00,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x2d,0x00,0x00,0x00, - 0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00,0x05,0x00,0x04,0x00,0x2f,0x00,0x00,0x00, - 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x00,0x00,0x05,0x00,0x05,0x00,0x32,0x00,0x00,0x00, - 0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x00,0x05,0x00,0x06,0x00, - 0x33,0x00,0x00,0x00,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, - 0x44,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,0x00,0x05,0x00, - 0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x0c,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x13,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x48,0x00,0x05,0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x47,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x17,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2a,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2b,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x2f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x32,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x05,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x33,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x06,0x00,0x00,0x00, - 0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x15,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x2b,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x1c,0x00,0x04,0x00,0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0a,0x00,0x00,0x00, - 0x1e,0x00,0x06,0x00,0x0c,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00, - 0x0b,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00, - 0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x0f,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x0f,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x00,0x04,0x00,0x11,0x00,0x00,0x00, - 0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x12,0x00,0x00,0x00, - 0x13,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1e,0x00,0x03,0x00,0x15,0x00,0x00,0x00, - 0x11,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x15,0x00,0x00,0x00,0x3b,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00, - 0x02,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x18,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x11,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00,0x1c,0x00,0x00,0x00, - 0x00,0x00,0x00,0x3f,0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x1d,0x00,0x00,0x00, - 0x1c,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00, - 0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x2b,0x00,0x04,0x00,0x07,0x00,0x00,0x00, - 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x2c,0x00,0x05,0x00,0x11,0x00,0x00,0x00, - 0x21,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x2b,0x00,0x04,0x00, - 0x07,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x80,0x3f,0x20,0x00,0x04,0x00, - 0x27,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x29,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x12,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x27,0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x2e,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x2e,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3b,0x00,0x04,0x00, - 0x31,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x36,0x00,0x05,0x00, - 0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00, - 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x11,0x00,0x00,0x00, - 0x14,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x41,0x00,0x05,0x00,0x18,0x00,0x00,0x00, - 0x19,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x11,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x88,0x00,0x05,0x00, - 0x11,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, - 0x83,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, - 0x1d,0x00,0x00,0x00,0x85,0x00,0x05,0x00,0x11,0x00,0x00,0x00,0x22,0x00,0x00,0x00, - 0x1e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x51,0x00,0x05,0x00,0x07,0x00,0x00,0x00, - 0x24,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x51,0x00,0x05,0x00, - 0x07,0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x50,0x00,0x07,0x00,0x08,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x24,0x00,0x00,0x00, - 0x25,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x41,0x00,0x05,0x00, - 0x27,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3e,0x00,0x03,0x00,0x28,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x11,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x3e,0x00,0x03,0x00, - 0x2a,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x01,0x00,0x00,0x00, - 0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00, - 0x30,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x2d,0x00,0x00,0x00, - 0x30,0x00,0x00,0x00,0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _snk_vs_source_wgsl[1083] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28, + 0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76, + 0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x32,0x32, + 0x20,0x3a,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76, + 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a, + 0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, + 0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20, + 0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, + 0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x39, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x5f,0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x78,0x5f,0x32,0x32, + 0x2e,0x64,0x69,0x73,0x70,0x5f,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x33,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d, + 0x20,0x28,0x28,0x28,0x78,0x5f,0x31,0x39,0x20,0x2f,0x20,0x78,0x5f,0x32,0x35,0x29, + 0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30, + 0x2e,0x35,0x66,0x29,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x32,0x2e, + 0x30,0x66,0x2c,0x20,0x2d,0x32,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63, + 0x34,0x66,0x28,0x78,0x5f,0x33,0x33,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x33,0x2e, + 0x79,0x2c,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, + 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x33,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x78,0x5f,0x34,0x33,0x3b,0x0a,0x20,0x20,0x6c, + 0x65,0x74,0x20,0x78,0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f, + 0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x37,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c, + 0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20, + 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x31,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78, + 0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x32,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e, + 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, + 0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f, + 0x72,0x64,0x30,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -static const uint8_t _snk_fs_bytecode_wgpu[904] = { - 0x03,0x02,0x23,0x07,0x00,0x00,0x01,0x00,0x08,0x00,0x08,0x00,0x19,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x11,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x0b,0x00,0x06,0x00, - 0x02,0x00,0x00,0x00,0x47,0x4c,0x53,0x4c,0x2e,0x73,0x74,0x64,0x2e,0x34,0x35,0x30, - 0x00,0x00,0x00,0x00,0x0e,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x0f,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x10,0x00,0x03,0x00,0x05,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x03,0x00, - 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x37,0x00,0x02,0x00,0x00,0x00, - 0xc2,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64, - 0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x63,0x6c,0x69, - 0x65,0x6e,0x74,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x30,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x63,0x6c,0x69,0x65,0x6e,0x74,0x20,0x6f,0x70,0x65,0x6e,0x67,0x6c, - 0x31,0x30,0x30,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50, - 0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d, - 0x65,0x6e,0x76,0x20,0x76,0x75,0x6c,0x6b,0x61,0x6e,0x31,0x2e,0x30,0x0a,0x2f,0x2f, - 0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65,0x50,0x72,0x6f,0x63,0x65,0x73,0x73, - 0x65,0x64,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x2d,0x65,0x6e,0x76,0x20,0x6f,0x70, - 0x65,0x6e,0x67,0x6c,0x0a,0x2f,0x2f,0x20,0x4f,0x70,0x4d,0x6f,0x64,0x75,0x6c,0x65, - 0x50,0x72,0x6f,0x63,0x65,0x73,0x73,0x65,0x64,0x20,0x65,0x6e,0x74,0x72,0x79,0x2d, - 0x70,0x6f,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x0a,0x23,0x6c,0x69,0x6e,0x65, - 0x20,0x31,0x0a,0x00,0x05,0x00,0x04,0x00,0x05,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e, - 0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x00,0x0a,0x00,0x00,0x00,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x05,0x00,0x03,0x00,0x0e,0x00,0x00,0x00, - 0x74,0x65,0x78,0x00,0x05,0x00,0x03,0x00,0x12,0x00,0x00,0x00,0x75,0x76,0x00,0x00, - 0x05,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0a,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x0e,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x12,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x47,0x00,0x04,0x00,0x16,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x13,0x00,0x02,0x00,0x03,0x00,0x00,0x00,0x21,0x00,0x03,0x00,0x04,0x00,0x00,0x00, - 0x03,0x00,0x00,0x00,0x16,0x00,0x03,0x00,0x07,0x00,0x00,0x00,0x20,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x04,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x03,0x00,0x00,0x00, - 0x19,0x00,0x09,0x00,0x0b,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x1b,0x00,0x03,0x00,0x0c,0x00,0x00,0x00,0x0b,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x17,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x02,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x20,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00, - 0x3b,0x00,0x04,0x00,0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x01,0x00,0x00,0x00, - 0x36,0x00,0x05,0x00,0x03,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x04,0x00,0x00,0x00,0xf8,0x00,0x02,0x00,0x06,0x00,0x00,0x00,0x08,0x00,0x04,0x00, - 0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x0c,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x3d,0x00,0x04,0x00, - 0x10,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x57,0x00,0x05,0x00, - 0x08,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x13,0x00,0x00,0x00, - 0x3d,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x16,0x00,0x00,0x00, - 0x85,0x00,0x05,0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x14,0x00,0x00,0x00, - 0x17,0x00,0x00,0x00,0x3e,0x00,0x03,0x00,0x0a,0x00,0x00,0x00,0x18,0x00,0x00,0x00, - 0xfd,0x00,0x01,0x00,0x38,0x00,0x01,0x00, +static const char _snk_fs_source_wgsl[630] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, + 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32, + 0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67, + 0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, + 0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, + 0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x78,0x5f,0x32,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, + 0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x34,0x20,0x2a,0x20,0x78,0x5f, + 0x32,0x37,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, + 0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f, + 0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66, + 0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c,0x6f, + 0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29, + 0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, + 0x20,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28, + 0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e, + 0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29, + 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _snk_vs_source_dummy = ""; @@ -2261,8 +2195,8 @@ SOKOL_API_IMPL void snk_setup(const snk_desc_t* desc) { vs_bytecode = SG_RANGE(_snk_vs_bytecode_hlsl4); fs_bytecode = SG_RANGE(_snk_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - vs_bytecode = SG_RANGE(_snk_vs_bytecode_wgpu); - fs_bytecode = SG_RANGE(_snk_fs_bytecode_wgpu); + vs_source = _snk_vs_source_wgsl; + fs_source = _snk_fs_source_wgsl; #else vs_source = _snk_vs_source_dummy; fs_source = _snk_fs_source_dummy; From 7fdfefe0a3e5b2b1860fa34b71c7ad5e96631691 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 3 Sep 2023 15:09:26 +0200 Subject: [PATCH 169/292] sokol_spine.h: fix embedded wgsl shader --- util/sokol_spine.h | 143 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 0ca556c8c..8bdbc87bf 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -2571,7 +2571,144 @@ static const char _sspine_fs_source_metal_sim[619] = { 0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #elif defined(SOKOL_WGPU) -#error "FIXME: wgpu shaders" +static const char _sspine_vs_source_wgsl[1003] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, + 0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69, + 0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69, + 0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a,0x20,0x76,0x73,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, + 0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, + 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, + 0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, + 0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, + 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a, + 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, + 0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20, + 0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20,0x3a,0x20,0x6d, + 0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76, + 0x70,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x36,0x20,0x3a,0x20, + 0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x5f,0x31,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, + 0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x32,0x20,0x2a,0x20,0x76,0x65,0x63,0x34, + 0x66,0x28,0x78,0x5f,0x32,0x36,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32,0x36,0x2e,0x79, + 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a, + 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x38,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a, + 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x78,0x5f,0x33,0x38,0x3b,0x0a,0x20,0x20,0x6c, + 0x65,0x74,0x20,0x78,0x5f,0x34,0x32,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f, + 0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x32,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c, + 0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20, + 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x28,0x30,0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63, + 0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x31,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78, + 0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20, + 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28, + 0x32,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e, + 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, + 0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f, + 0x72,0x64,0x30,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20, + 0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a, + 0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65, + 0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63, + 0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +static const char _sspine_fs_source_wgsl[1125] = { + 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, + 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, + 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, + 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, + 0x20,0x70,0x6d,0x61,0x20,0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40, + 0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, + 0x67,0x28,0x33,0x32,0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20, + 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b, + 0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e, + 0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70, + 0x20,0x3a,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72, + 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76, + 0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, + 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, + 0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65, + 0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20, + 0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c, + 0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x35,0x33,0x20,0x3a,0x20, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d, + 0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20, + 0x63,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61, + 0x72,0x20,0x63,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20, + 0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, + 0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, + 0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73, + 0x6d,0x70,0x2c,0x20,0x78,0x5f,0x32,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, + 0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20, + 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x28,0x78, + 0x5f,0x32,0x34,0x20,0x2a,0x20,0x78,0x5f,0x32,0x37,0x29,0x3b,0x0a,0x20,0x20,0x6c, + 0x65,0x74,0x20,0x78,0x5f,0x33,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, + 0x3d,0x20,0x63,0x30,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x37, + 0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x63,0x30,0x2e,0x77,0x3b,0x0a,0x20, + 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, + 0x66,0x20,0x3d,0x20,0x28,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x33,0x31,0x2e, + 0x78,0x2c,0x20,0x78,0x5f,0x33,0x31,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x33,0x31,0x2e, + 0x7a,0x29,0x20,0x2a,0x20,0x78,0x5f,0x33,0x37,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, + 0x74,0x20,0x78,0x5f,0x34,0x30,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x63, + 0x30,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x35,0x20, + 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b, + 0x0a,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x28,0x76,0x65,0x63,0x34,0x66,0x28,0x78, + 0x5f,0x33,0x38,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x38,0x2e,0x79,0x2c,0x20,0x78, + 0x5f,0x33,0x38,0x2e,0x7a,0x2c,0x20,0x78,0x5f,0x34,0x30,0x29,0x20,0x2a,0x20,0x78, + 0x5f,0x34,0x35,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x39, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x30,0x3b,0x0a,0x20, + 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, + 0x66,0x20,0x3d,0x20,0x63,0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, + 0x35,0x38,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x35,0x33,0x2e, + 0x70,0x6d,0x61,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, + 0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x78,0x5f,0x34,0x39,0x2c,0x20,0x78,0x5f, + 0x35,0x30,0x2c,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x35,0x38,0x2c,0x20, + 0x78,0x5f,0x35,0x38,0x2c,0x20,0x78,0x5f,0x35,0x38,0x2c,0x20,0x78,0x5f,0x35,0x38, + 0x29,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, + 0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30, + 0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31, + 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72, + 0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x75,0x76,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72, + 0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20, + 0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20, + 0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, + 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70, + 0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29, + 0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, + 0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b, + 0x0a,0x7d,0x0a,0x0a,0x00, +}; #elif defined(SOKOL_DUMMY_BACKEND) static const char* _sspine_vs_source_dummy = ""; static const char* _sspine_fs_source_dummy = ""; @@ -4554,8 +4691,8 @@ static void _sspine_init_shared(void) { shd_desc.vs.bytecode = SG_RANGE(_sspine_vs_bytecode_hlsl4); shd_desc.fs.bytecode = SG_RANGE(_sspine_fs_bytecode_hlsl4); #elif defined(SOKOL_WGPU) - shd_desc.vs.bytecode = SG_RANGE(_sspine_vs_bytecode_wgpu); - shd_desc.fs.bytecode = SG_RANGE(_sspine_fs_bytecode_wgpu); + shd_desc.vs.source = _sspine_vs_source_wgsl; + shd_desc.fs.source = _sspine_fs_source_wgsl; #else shd_desc.vs.source = _sspine_vs_source_dummy; shd_desc.fs.source = _sspine_fs_source_dummy; From 38eee79b7dbd65f4941d613b072a70a675027b8c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 4 Sep 2023 13:54:22 +0200 Subject: [PATCH 170/292] sokol_gfx.h wgpu: fix pixel format caps --- sokol_gfx.h | 57 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 70b2937c9..09a0bd088 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12337,40 +12337,49 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg.limits.max_image_array_layers = (int) l->maxTextureArrayLayers; _sg.limits.max_vertex_attrs = SG_MAX_VERTEX_ATTRIBUTES; - _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_R8SN]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R8UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R8SI]); // NOTE: no WGPUTextureFormat_R16Unorm - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R16UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_R16SI]); - _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG8]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RG8SN]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG8UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG8SI]); - _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32UI]); - _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32SI]); - _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32F]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG16UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RG16SI]); - _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG16F]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA8]); - _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RGBA8SN]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA8UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA8SI]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_BGRA8]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG16F]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA16F]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGB10A2]); - // FIXME: missing SG_PIXELFORMAT_RG11B10F + + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_R8SN]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RG8SN]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RGBA8SN]); + + // FIXME: can be made renderable via extension + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RG11B10F]); + + // NOTE: msaa rendering is possible in WebGPU, but no resolve + // which is a combination that's not currently supported in sokol-gfx + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R8UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R8SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG8UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG8SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA8UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA8SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R16UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R16SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG16UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG16SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA16UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA16SI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32UI]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32SI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32UI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32SI]); - _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32F]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA16UI]); - _sg_pixelformat_srm(&_sg.formats[SG_PIXELFORMAT_RGBA16SI]); - _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA16F]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA32UI]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA32SI]); + + // FIXME: can be made filterable with extension + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_R32F]); + _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RG32F]); _sg_pixelformat_sr(&_sg.formats[SG_PIXELFORMAT_RGBA32F]); + _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH]); _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH_STENCIL]); From 8b49fa778e5821ec68023d2191be63acf2a64dbc Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 4 Sep 2023 18:17:29 +0200 Subject: [PATCH 171/292] sokol_gfx.h: new sg_sampler_desc validation: max_anistropy > 1 requires all filters to be linear --- sokol_gfx.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 09a0bd088..3c4390224 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2981,6 +2981,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_CANARY, "sg_sampler_desc not initialized") \ _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MINFILTER_NONE, "sg_sampler_desc.min_filter cannot be SG_FILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MAGFILTER_NONE, "sg_sampler_desc.mag_filter cannot be SG_FILTER_NONE") \ + _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING, "sg_sampler_desc.max_anisotropy > 1 requires min/mag/mipmap_filter to be SG_FILTER_LINEAR") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_CANARY, "sg_shader_desc not initialized") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SOURCE, "shader source code required") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_BYTECODE, "shader byte code required") \ @@ -14507,6 +14508,13 @@ _SOKOL_PRIVATE bool _sg_validate_sampler_desc(const sg_sampler_desc* desc) { _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_SAMPLERDESC_CANARY); _SG_VALIDATE(desc->min_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MINFILTER_NONE); _SG_VALIDATE(desc->mag_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MAGFILTER_NONE); + // restriction from WebGPU: when anisotropy > 1, all filters must be linear + if (desc->max_anisotropy > 1) { + _SG_VALIDATE((desc->min_filter == SG_FILTER_LINEAR) + && (desc->mag_filter == SG_FILTER_LINEAR) + && (desc->mipmap_filter == SG_FILTER_LINEAR), + VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); + } return _sg_validate_end(); #endif } From 647497809ad35aaa7404d1912bde386f834d8093 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 4 Sep 2023 18:57:43 +0200 Subject: [PATCH 172/292] sokol_gfx tests: add sampler-desc validation tests --- tests/functional/sokol_gfx_test.c | 88 ++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 90d460afe..1f80b2a0f 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -1016,6 +1016,7 @@ UTEST(sokol_gfx, query_sampler_desc) { setup(&(sg_desc){0}); sg_sampler s0 = sg_make_sampler(&(sg_sampler_desc){ .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, .mipmap_filter = SG_FILTER_LINEAR, .wrap_v = SG_WRAP_MIRRORED_REPEAT, .max_anisotropy = 8, @@ -1024,7 +1025,7 @@ UTEST(sokol_gfx, query_sampler_desc) { }); const sg_sampler_desc s0_desc = sg_query_sampler_desc(s0); T(s0_desc.min_filter == SG_FILTER_LINEAR); - T(s0_desc.mag_filter == SG_FILTER_NEAREST); + T(s0_desc.mag_filter == SG_FILTER_LINEAR); T(s0_desc.mipmap_filter == SG_FILTER_LINEAR); T(s0_desc.wrap_u == SG_WRAP_REPEAT); T(s0_desc.wrap_v == SG_WRAP_MIRRORED_REPEAT); @@ -2150,6 +2151,91 @@ UTEST(sokol_gfx, make_image_validate_wrong_mipsize) { sg_shutdown(); } +UTEST(sokol_gfx, make_sampler_validate_start_canary) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ + ._start_canary = 1234, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_CANARY); + sg_shutdown(); +} + +UTEST(sokol_gfx, make_sampler_validate_minfilter_none) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ + .min_filter = SG_FILTER_NONE, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_MINFILTER_NONE); + sg_shutdown(); +} + +UTEST(sokol_gfx, make_sampler_validate_magfilter_none) { + setup(&(sg_desc){0}); + sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ + .mag_filter = SG_FILTER_NONE, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_MAGFILTER_NONE); + sg_shutdown(); +} + +UTEST(sokol_gfx, make_sampler_validate_anistropic_requires_linear_filtering) { + setup(&(sg_desc){0}); + sg_sampler smp; + + smp = sg_make_sampler(&(sg_sampler_desc){ + .max_anisotropy = 2, + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + .mipmap_filter = SG_FILTER_NONE, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); + + reset_log_items(); + smp = sg_make_sampler(&(sg_sampler_desc){ + .max_anisotropy = 2, + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + .mipmap_filter = SG_FILTER_NEAREST, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); + + reset_log_items(); + smp = sg_make_sampler(&(sg_sampler_desc){ + .max_anisotropy = 2, + .min_filter = SG_FILTER_NEAREST, + .mag_filter = SG_FILTER_LINEAR, + .mipmap_filter = SG_FILTER_LINEAR, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); + + reset_log_items(); + smp = sg_make_sampler(&(sg_sampler_desc){ + .max_anisotropy = 2, + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_NEAREST, + .mipmap_filter = SG_FILTER_LINEAR, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); + T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); + + reset_log_items(); + smp = sg_make_sampler(&(sg_sampler_desc){ + .max_anisotropy = 2, + .min_filter = SG_FILTER_LINEAR, + .mag_filter = SG_FILTER_LINEAR, + .mipmap_filter = SG_FILTER_LINEAR, + }); + T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_VALID); + + sg_shutdown(); +} + UTEST(sokol_gfx, make_pass_validate_start_canary) { setup(&(sg_desc){0}); sg_pass pass = sg_make_pass(&(sg_pass_desc){ From 6fe8f03da808eeb5521cf1ebee67d6dbd12f29df Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 5 Sep 2023 19:00:14 +0200 Subject: [PATCH 173/292] sokol_gfx.h: validate image sample type vs sampler type in sg_shader_desc --- sokol_gfx.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3c4390224..9e1cc715b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3002,6 +3002,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED, "shader stage: image-sampler-pair has name but .used field not true") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED, "shader stage: image-sampler-pair has .image_slot != 0 but .used field not true") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_SAMPLER_BUT_NOT_USED, "shader stage: image-sampler-pair .sampler_slot != 0 but .used field not true") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NONFILTERING_SAMPLER_REQUIRED, "shader stage: image sample type UNFILTERABLE_FLOAT, UINT, SINT can only be used with NONFILTERING sampler") \ + _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_COMPARISON_SAMPLER_REQUIRED, "shader stage: image sample type DEPTH can only be used with COMPARISON sampler") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_IMAGE_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage: one or more images are note referenced by (sg_shader_desc.vs|fs.image_sampler_pairs[].image_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SAMPLER_NOT_REFERENCED_BY_IMAGE_SAMPLER_PAIRS, "shader stage: one or more samplers are not referenced by image-sampler-pairs (sg_shader_desc.vs|fs.image_sampler_pairs[].sampler_slot)") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_NO_CONT_IMAGE_SAMPLER_PAIRS, "shader stage image-sampler-pairs must occupy continuous slots (sg_shader_desc.vs|fs.image_samplers[])") \ @@ -14641,6 +14643,20 @@ _SOKOL_PRIVATE bool _sg_validate_shader_desc(const sg_shader_desc* desc) { #if defined(_SOKOL_ANY_GL) _SG_VALIDATE(img_smp_desc->glsl_name != 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_NAME_REQUIRED_FOR_GL); #endif + if (img_slot_in_range && smp_slot_in_range) { + const sg_shader_image_desc* img_desc = &stage_desc->images[img_smp_desc->image_slot]; + const sg_shader_sampler_desc* smp_desc = &stage_desc->samplers[img_smp_desc->sampler_slot]; + const bool needs_nonfiltering = (img_desc->sample_type == SG_IMAGESAMPLETYPE_UINT) + || (img_desc->sample_type == SG_IMAGESAMPLETYPE_SINT) + || (img_desc->sample_type == SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT); + const bool needs_comparison = img_desc->sample_type == SG_IMAGESAMPLETYPE_DEPTH; + if (needs_nonfiltering) { + _SG_VALIDATE(needs_nonfiltering && (smp_desc->sampler_type == SG_SAMPLERTYPE_NONFILTERING), VALIDATE_SHADERDESC_NONFILTERING_SAMPLER_REQUIRED); + } + if (needs_comparison) { + _SG_VALIDATE(needs_comparison && (smp_desc->sampler_type == SG_SAMPLERTYPE_COMPARISON), VALIDATE_SHADERDESC_COMPARISON_SAMPLER_REQUIRED); + } + } } else { _SG_VALIDATE(img_smp_desc->glsl_name == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_NAME_BUT_NOT_USED); _SG_VALIDATE(img_smp_desc->image_slot == 0, VALIDATE_SHADERDESC_IMAGE_SAMPLER_PAIR_HAS_IMAGE_BUT_NOT_USED); From e5f5d95d6a1b853b3614136c11f5b80a51f4289c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 5 Sep 2023 19:29:10 +0200 Subject: [PATCH 174/292] sokol_gfx.h: image sample type and sampler type validation in sg_apply_bindings() --- sokol_gfx.h | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9e1cc715b..e79f999de 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3074,10 +3074,13 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: image bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to vertex stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_FILTERABLE_IMAGE, "sg_apply_bindings: filterable image expected on vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_DEPTH_IMAGE, "sg_apply_bindings: depth image expected on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on vertex stage, but sampler has SG_FILTER_LINEAR filters") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to vertex stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ @@ -3085,10 +3088,13 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_FILTERABLE_IMAGE, "sg_apply_bindings: filterable image expected on fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_DEPTH_IMAGE, "sg_apply_bindings: depth image expected on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on fragment stage, but sampler has SG_FILTER_LINEAR filters") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to fragment stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ @@ -14976,6 +14982,17 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH); _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_VS_IMAGE_MSAA); + const sg_pixelformat_info* info = &_sg.formats[img->cmn.pixel_format]; + switch (stage->images[i].sample_type) { + case SG_IMAGESAMPLETYPE_FLOAT: + _SG_VALIDATE(info->filter, VALIDATE_ABND_VS_EXPECTED_FILTERABLE_IMAGE); + break; + case SG_IMAGESAMPLETYPE_DEPTH: + _SG_VALIDATE(info->depth, VALIDATE_ABND_VS_EXPECTED_DEPTH_IMAGE); + break; + default: + break; + } } } } else { @@ -14997,6 +15014,12 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER); } + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_NONFILTERING) { + const bool nonfiltering = (smp->cmn.min_filter != SG_FILTER_LINEAR) + && (smp->cmn.mag_filter != SG_FILTER_LINEAR) + && (smp->cmn.mipmap_filter != SG_FILTER_LINEAR); + _SG_VALIDATE(nonfiltering, VALIDATE_ABND_VS_EXPECTED_NONFILTERING_SAMPLER); + } } } } else { @@ -15015,6 +15038,17 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { if (img && img->slot.state == SG_RESOURCESTATE_VALID) { _SG_VALIDATE(img->cmn.type == stage->images[i].image_type, VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH); _SG_VALIDATE(img->cmn.sample_count == 1, VALIDATE_ABND_FS_IMAGE_MSAA); + const sg_pixelformat_info* info = &_sg.formats[img->cmn.pixel_format]; + switch (stage->images[i].sample_type) { + case SG_IMAGESAMPLETYPE_FLOAT: + _SG_VALIDATE(info->filter, VALIDATE_ABND_FS_EXPECTED_FILTERABLE_IMAGE); + break; + case SG_IMAGESAMPLETYPE_DEPTH: + _SG_VALIDATE(info->depth, VALIDATE_ABND_FS_EXPECTED_DEPTH_IMAGE); + break; + default: + break; + } } } } else { @@ -15036,6 +15070,12 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { } else { _SG_VALIDATE(smp->cmn.compare == SG_COMPAREFUNC_NEVER, VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER); } + if (stage->samplers[i].sampler_type == SG_SAMPLERTYPE_NONFILTERING) { + const bool nonfiltering = (smp->cmn.min_filter != SG_FILTER_LINEAR) + && (smp->cmn.mag_filter != SG_FILTER_LINEAR) + && (smp->cmn.mipmap_filter != SG_FILTER_LINEAR); + _SG_VALIDATE(nonfiltering, VALIDATE_ABND_FS_EXPECTED_NONFILTERING_SAMPLER); + } } } } else { From b6ab80fc1f59a8600ddca8121cc8d06ef53fcb21 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 6 Sep 2023 18:48:24 +0200 Subject: [PATCH 175/292] fix sokol-gfx tests --- tests/functional/sokol_gfx_test.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 1f80b2a0f..4e9e5db5e 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -1064,18 +1064,18 @@ UTEST(sokol_gfx, query_shader_desc) { } }, .images[0] = { .used = true, .image_type = SG_IMAGETYPE_2D, .sample_type = SG_IMAGESAMPLETYPE_FLOAT, .multisampled = true }, - .images[1] = { .used = true, .image_type = SG_IMAGETYPE_3D, .sample_type = SG_IMAGESAMPLETYPE_SINT }, + .images[1] = { .used = true, .image_type = SG_IMAGETYPE_3D, .sample_type = SG_IMAGESAMPLETYPE_DEPTH }, .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_FILTERING }, .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARISON }, - .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 1, .glsl_name = "img0" }, - .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 0, .glsl_name = "img1" }, + .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 0, .glsl_name = "img0" }, + .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 1, .glsl_name = "img1" }, }, .fs = { .source = "fs_source", .images[0] = { .used = true, .image_type = SG_IMAGETYPE_ARRAY, .sample_type = SG_IMAGESAMPLETYPE_DEPTH }, - .images[1] = { .used = true, .image_type = SG_IMAGETYPE_CUBE, .sample_type = SG_IMAGESAMPLETYPE_FLOAT }, + .images[1] = { .used = true, .image_type = SG_IMAGETYPE_CUBE, .sample_type = SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT }, .samplers[0] = { .used = true, .sampler_type = SG_SAMPLERTYPE_COMPARISON }, - .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_FILTERING }, + .samplers[1] = { .used = true, .sampler_type = SG_SAMPLERTYPE_NONFILTERING }, .image_sampler_pairs[0] = { .used = true, .image_slot = 0, .sampler_slot = 0, .glsl_name = "img3" }, .image_sampler_pairs[1] = { .used = true, .image_slot = 1, .sampler_slot = 1, .glsl_name = "img4" }, }, @@ -1097,7 +1097,7 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.vs.images[0].multisampled); T(s0_desc.vs.images[1].used); T(s0_desc.vs.images[1].image_type == SG_IMAGETYPE_3D); - T(s0_desc.vs.images[1].sample_type == SG_IMAGESAMPLETYPE_SINT); + T(s0_desc.vs.images[1].sample_type == SG_IMAGESAMPLETYPE_DEPTH); T(s0_desc.vs.images[1].multisampled == false); T(s0_desc.vs.samplers[0].used); T(s0_desc.vs.samplers[0].sampler_type == SG_SAMPLERTYPE_FILTERING); @@ -1105,11 +1105,11 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.vs.samplers[1].sampler_type == SG_SAMPLERTYPE_COMPARISON); T(s0_desc.vs.image_sampler_pairs[0].used); T(s0_desc.vs.image_sampler_pairs[0].image_slot == 0); - T(s0_desc.vs.image_sampler_pairs[0].sampler_slot == 1); + T(s0_desc.vs.image_sampler_pairs[0].sampler_slot == 0); T(s0_desc.vs.image_sampler_pairs[0].glsl_name == 0); T(s0_desc.vs.image_sampler_pairs[1].used); T(s0_desc.vs.image_sampler_pairs[1].image_slot == 1); - T(s0_desc.vs.image_sampler_pairs[1].sampler_slot == 0); + T(s0_desc.vs.image_sampler_pairs[1].sampler_slot == 1); T(s0_desc.vs.image_sampler_pairs[1].glsl_name == 0); T(s0_desc.fs.source == 0); T(s0_desc.fs.uniform_blocks[0].size == 0); @@ -1123,12 +1123,12 @@ UTEST(sokol_gfx, query_shader_desc) { T(s0_desc.fs.images[0].multisampled == false); T(s0_desc.fs.images[1].used); T(s0_desc.fs.images[1].image_type == SG_IMAGETYPE_CUBE); - T(s0_desc.fs.images[1].sample_type == SG_IMAGESAMPLETYPE_FLOAT); + T(s0_desc.fs.images[1].sample_type == SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT); T(s0_desc.fs.images[1].multisampled == false); T(s0_desc.fs.samplers[0].used); T(s0_desc.fs.samplers[0].sampler_type == SG_SAMPLERTYPE_COMPARISON); T(s0_desc.fs.samplers[1].used); - T(s0_desc.fs.samplers[1].sampler_type == SG_SAMPLERTYPE_FILTERING); + T(s0_desc.fs.samplers[1].sampler_type == SG_SAMPLERTYPE_NONFILTERING); T(s0_desc.fs.image_sampler_pairs[0].used); T(s0_desc.fs.image_sampler_pairs[0].image_slot == 0); T(s0_desc.fs.image_sampler_pairs[0].sampler_slot == 0); From 2d9e4bfe63cfafcded0ccb27d66c9d5c0cb578ad Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 7 Sep 2023 18:10:58 +0200 Subject: [PATCH 176/292] sokoL_imgui.h: allow unfilterable user images --- util/sokol_imgui.h | 210 ++++++++++++++++++++++++++------------------- 1 file changed, 120 insertions(+), 90 deletions(-) diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 51ad4eb52..786f98536 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -639,6 +639,7 @@ typedef struct { _simgui_slot_t slot; sg_image image; sg_sampler sampler; + sg_pipeline pip; // this will either be _simgui.def_pip or _simgui.pip_unfilterable } _simgui_image_t; typedef struct { @@ -657,8 +658,11 @@ typedef struct { simgui_image_t default_font; sg_image def_img; // used as default image for user images sg_sampler def_smp; // used as default sampler for user images - sg_shader shd; - sg_pipeline pip; + sg_shader def_shd; + sg_pipeline def_pip; + // separate shader and pipeline for unfilterable user images + sg_shader shd_unfilterable; + sg_pipeline pip_unfilterable; sg_range vertices; sg_range indices; bool is_osx; @@ -2081,8 +2085,15 @@ static simgui_image_t _simgui_alloc_image(void) { static _simgui_resource_state _simgui_init_image(_simgui_image_t* img, const simgui_image_desc_t* desc) { SOKOL_ASSERT(img && (img->slot.state == _SIMGUI_RESOURCESTATE_ALLOC)); SOKOL_ASSERT(desc); + SOKOL_ASSERT(_simgui.def_pip.id != SIMGUI_INVALID_ID); + SOKOL_ASSERT(_simgui.pip_unfilterable.id != SIMGUI_INVALID_ID); img->image = desc->image; img->sampler = desc->sampler; + if (sg_query_pixelformat(sg_query_image_desc(desc->image).pixel_format).filter) { + img->pip = _simgui.def_pip; + } else { + img->pip = _simgui.pip_unfilterable; + } return _SIMGUI_RESOURCESTATE_VALID; } @@ -2090,6 +2101,7 @@ static void _simgui_deinit_image(_simgui_image_t* img) { SOKOL_ASSERT(img); img->image.id = SIMGUI_INVALID_ID; img->sampler.id = SIMGUI_INVALID_ID; + img->pip.id = SIMGUI_INVALID_ID; } static void _simgui_destroy_image(simgui_image_t img_id) { @@ -2198,84 +2210,6 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { // create sokol-gfx resources sg_push_debug_group("sokol-imgui"); - // NOTE: since we're in C++ mode here we can't use C99 designated init - sg_buffer_desc vb_desc; - _simgui_clear(&vb_desc, sizeof(vb_desc)); - vb_desc.usage = SG_USAGE_STREAM; - vb_desc.size = _simgui.vertices.size; - vb_desc.label = "sokol-imgui-vertices"; - _simgui.vbuf = sg_make_buffer(&vb_desc); - - sg_buffer_desc ib_desc; - _simgui_clear(&ib_desc, sizeof(ib_desc)); - ib_desc.type = SG_BUFFERTYPE_INDEXBUFFER; - ib_desc.usage = SG_USAGE_STREAM; - ib_desc.size = _simgui.indices.size; - ib_desc.label = "sokol-imgui-indices"; - _simgui.ibuf = sg_make_buffer(&ib_desc); - - // a default font sampler - sg_sampler_desc font_smp_desc; - _simgui_clear(&font_smp_desc, sizeof(font_smp_desc)); - font_smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - font_smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; - font_smp_desc.min_filter = SG_FILTER_LINEAR; - font_smp_desc.mag_filter = SG_FILTER_LINEAR; - font_smp_desc.mipmap_filter = SG_FILTER_NONE; - font_smp_desc.label = "sokol-imgui-font-sampler"; - _simgui.font_smp = sg_make_sampler(&font_smp_desc); - - // a default user-image sampler - sg_sampler_desc def_sampler_desc; - _simgui_clear(&def_sampler_desc, sizeof(def_sampler_desc)); - def_sampler_desc.min_filter = SG_FILTER_NEAREST; - def_sampler_desc.mag_filter = SG_FILTER_NEAREST; - def_sampler_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; - def_sampler_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; - def_sampler_desc.label = "sokol-imgui-default-sampler"; - _simgui.def_smp = sg_make_sampler(&def_sampler_desc); - - // default font texture - if (!_simgui.desc.no_default_font) { - unsigned char* font_pixels; - int font_width, font_height; - #if defined(__cplusplus) - io->Fonts->GetTexDataAsRGBA32(&font_pixels, &font_width, &font_height); - #else - int bytes_per_pixel; - ImFontAtlas_GetTexDataAsRGBA32(io->Fonts, &font_pixels, &font_width, &font_height, &bytes_per_pixel); - #endif - sg_image_desc font_img_desc; - _simgui_clear(&font_img_desc, sizeof(font_img_desc)); - font_img_desc.width = font_width; - font_img_desc.height = font_height; - font_img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; - font_img_desc.data.subimage[0][0].ptr = font_pixels; - font_img_desc.data.subimage[0][0].size = (size_t)(font_width * font_height) * sizeof(uint32_t); - font_img_desc.label = "sokol-imgui-font-image"; - _simgui.font_img = sg_make_image(&font_img_desc); - - simgui_image_desc_t img_desc; - _simgui_clear(&img_desc, sizeof(img_desc)); - img_desc.image = _simgui.font_img; - img_desc.sampler = _simgui.font_smp; - _simgui.default_font = simgui_make_image(&img_desc); - io->Fonts->TexID = simgui_imtextureid(_simgui.default_font); - } - - // a default user image - static uint32_t def_pixels[64]; - memset(def_pixels, 0xFF, sizeof(def_pixels)); - sg_image_desc def_image_desc; - _simgui_clear(&def_image_desc, sizeof(def_image_desc)); - def_image_desc.width = 8; - def_image_desc.height = 8; - def_image_desc.pixel_format = SG_PIXELFORMAT_RGBA8; - def_image_desc.data.subimage[0][0].ptr = def_pixels; - def_image_desc.data.subimage[0][0].size = sizeof(def_pixels); - def_image_desc.label = "sokol-imgui-default-image"; - _simgui.def_img = sg_make_image(&def_image_desc); - // shader object for using the embedded shader source (or bytecode) sg_shader_desc shd_desc; _simgui_clear(&shd_desc, sizeof(shd_desc)); @@ -2336,7 +2270,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { shd_desc.vs.source = _simgui_vs_source_dummy; shd_desc.fs.source = _simgui_fs_source_dummy; #endif - _simgui.shd = sg_make_shader(&shd_desc); + _simgui.def_shd = sg_make_shader(&shd_desc); // pipeline object for imgui rendering sg_pipeline_desc pip_desc; @@ -2357,7 +2291,7 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { attr->offset = offsetof(ImDrawVert, col); attr->format = SG_VERTEXFORMAT_UBYTE4N; } - pip_desc.shader = _simgui.shd; + pip_desc.shader = _simgui.def_shd; pip_desc.index_type = SG_INDEXTYPE_UINT16; pip_desc.sample_count = _simgui.desc.sample_count; pip_desc.depth.pixel_format = _simgui.desc.depth_format; @@ -2371,7 +2305,94 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) { pip_desc.colors[0].blend.dst_factor_alpha = SG_BLENDFACTOR_ONE; } pip_desc.label = "sokol-imgui-pipeline"; - _simgui.pip = sg_make_pipeline(&pip_desc); + _simgui.def_pip = sg_make_pipeline(&pip_desc); + + // create a unfilterable/nonfiltering variants of the shader and pipeline + shd_desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT; + shd_desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_NONFILTERING; + shd_desc.label = "sokol-imgui-shader-unfilterable"; + _simgui.shd_unfilterable = sg_make_shader(&shd_desc); + pip_desc.shader = _simgui.shd_unfilterable; + pip_desc.label = "sokol-imgui-pipeline-unfilterable"; + _simgui.pip_unfilterable = sg_make_pipeline(&pip_desc); + + // NOTE: since we're in C++ mode here we can't use C99 designated init + sg_buffer_desc vb_desc; + _simgui_clear(&vb_desc, sizeof(vb_desc)); + vb_desc.usage = SG_USAGE_STREAM; + vb_desc.size = _simgui.vertices.size; + vb_desc.label = "sokol-imgui-vertices"; + _simgui.vbuf = sg_make_buffer(&vb_desc); + + sg_buffer_desc ib_desc; + _simgui_clear(&ib_desc, sizeof(ib_desc)); + ib_desc.type = SG_BUFFERTYPE_INDEXBUFFER; + ib_desc.usage = SG_USAGE_STREAM; + ib_desc.size = _simgui.indices.size; + ib_desc.label = "sokol-imgui-indices"; + _simgui.ibuf = sg_make_buffer(&ib_desc); + + // a default font sampler + sg_sampler_desc font_smp_desc; + _simgui_clear(&font_smp_desc, sizeof(font_smp_desc)); + font_smp_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + font_smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + font_smp_desc.min_filter = SG_FILTER_LINEAR; + font_smp_desc.mag_filter = SG_FILTER_LINEAR; + font_smp_desc.mipmap_filter = SG_FILTER_NONE; + font_smp_desc.label = "sokol-imgui-font-sampler"; + _simgui.font_smp = sg_make_sampler(&font_smp_desc); + + // a default user-image sampler + sg_sampler_desc def_sampler_desc; + _simgui_clear(&def_sampler_desc, sizeof(def_sampler_desc)); + def_sampler_desc.min_filter = SG_FILTER_NEAREST; + def_sampler_desc.mag_filter = SG_FILTER_NEAREST; + def_sampler_desc.wrap_u = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; + def_sampler_desc.label = "sokol-imgui-default-sampler"; + _simgui.def_smp = sg_make_sampler(&def_sampler_desc); + + // a default user image + static uint32_t def_pixels[64]; + memset(def_pixels, 0xFF, sizeof(def_pixels)); + sg_image_desc def_image_desc; + _simgui_clear(&def_image_desc, sizeof(def_image_desc)); + def_image_desc.width = 8; + def_image_desc.height = 8; + def_image_desc.pixel_format = SG_PIXELFORMAT_RGBA8; + def_image_desc.data.subimage[0][0].ptr = def_pixels; + def_image_desc.data.subimage[0][0].size = sizeof(def_pixels); + def_image_desc.label = "sokol-imgui-default-image"; + _simgui.def_img = sg_make_image(&def_image_desc); + + // default font texture + if (!_simgui.desc.no_default_font) { + unsigned char* font_pixels; + int font_width, font_height; + #if defined(__cplusplus) + io->Fonts->GetTexDataAsRGBA32(&font_pixels, &font_width, &font_height); + #else + int bytes_per_pixel; + ImFontAtlas_GetTexDataAsRGBA32(io->Fonts, &font_pixels, &font_width, &font_height, &bytes_per_pixel); + #endif + sg_image_desc font_img_desc; + _simgui_clear(&font_img_desc, sizeof(font_img_desc)); + font_img_desc.width = font_width; + font_img_desc.height = font_height; + font_img_desc.pixel_format = SG_PIXELFORMAT_RGBA8; + font_img_desc.data.subimage[0][0].ptr = font_pixels; + font_img_desc.data.subimage[0][0].size = (size_t)(font_width * font_height) * sizeof(uint32_t); + font_img_desc.label = "sokol-imgui-font-image"; + _simgui.font_img = sg_make_image(&font_img_desc); + + simgui_image_desc_t img_desc; + _simgui_clear(&img_desc, sizeof(img_desc)); + img_desc.image = _simgui.font_img; + img_desc.sampler = _simgui.font_smp; + _simgui.default_font = simgui_make_image(&img_desc); + io->Fonts->TexID = simgui_imtextureid(_simgui.default_font); + } sg_pop_debug_group(); } @@ -2384,8 +2405,10 @@ SOKOL_API_IMPL void simgui_shutdown(void) { igDestroyContext(0); #endif // NOTE: it's valid to call the destroy funcs with SG_INVALID_ID - sg_destroy_pipeline(_simgui.pip); - sg_destroy_shader(_simgui.shd); + sg_destroy_pipeline(_simgui.pip_unfilterable); + sg_destroy_shader(_simgui.shd_unfilterable); + sg_destroy_pipeline(_simgui.def_pip); + sg_destroy_shader(_simgui.def_shd); sg_destroy_sampler(_simgui.font_smp); sg_destroy_image(_simgui.font_img); sg_destroy_sampler(_simgui.def_smp); @@ -2496,8 +2519,8 @@ SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) { #endif } -static void _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id) { - _simgui_image_t* img = _simgui_lookup_image((uint32_t)(uintptr_t)tex_id); +static const _simgui_image_t* _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id) { + const _simgui_image_t* img = _simgui_lookup_image((uint32_t)(uintptr_t)tex_id); if (img) { bindings->fs.images[0] = img->image; bindings->fs.samplers[0] = img->sampler; @@ -2505,6 +2528,7 @@ static void _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id bindings->fs.images[0] = _simgui.def_img; bindings->fs.samplers[0] = _simgui.def_smp; } + return img; } SOKOL_API_IMPL void simgui_render(void) { @@ -2583,7 +2607,7 @@ SOKOL_API_IMPL void simgui_render(void) { sg_apply_viewport(0, 0, fb_width, fb_height, true); sg_apply_scissor_rect(0, 0, fb_width, fb_height, true); - sg_apply_pipeline(_simgui.pip); + sg_apply_pipeline(_simgui.def_pip); _simgui_vs_params_t vs_params; _simgui_clear((void*)&vs_params, sizeof(vs_params)); vs_params.disp_size.x = io->DisplaySize.x; @@ -2616,14 +2640,20 @@ SOKOL_API_IMPL void simgui_render(void) { pcmd->UserCallback(cl, pcmd); // need to re-apply all state after calling a user callback sg_apply_viewport(0, 0, fb_width, fb_height, true); - sg_apply_pipeline(_simgui.pip); + sg_apply_pipeline(_simgui.def_pip); sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(vs_params)); sg_apply_bindings(&bind); } else { if ((tex_id != pcmd->TextureId) || (vtx_offset != pcmd->VtxOffset)) { tex_id = pcmd->TextureId; vtx_offset = pcmd->VtxOffset; - _simgui_bind_image_sampler(&bind, tex_id); + const _simgui_image_t* img = _simgui_bind_image_sampler(&bind, tex_id); + if (img) { + sg_apply_pipeline(img->pip); + } else { + sg_apply_pipeline(_simgui.def_pip); + } + sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(vs_params)); bind.vertex_buffer_offsets[0] = vb_offset + (int)(pcmd->VtxOffset * sizeof(ImDrawVert)); sg_apply_bindings(&bind); } From fd9e7bc856ce4b303486e97ca25974ce88bf3686 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Fri, 8 Sep 2023 16:23:25 -0400 Subject: [PATCH 177/292] fix errant framebuffer bind the framebuffer was getting bound even when msaa hadn't changed it --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 055c636d2..6cf8fd4ec 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7811,7 +7811,7 @@ _SOKOL_PRIVATE void _sg_gl_end_pass(void) { const _sg_pass_t* pass = _sg.gl.cur_pass; SOKOL_ASSERT(pass->slot.id == _sg.gl.cur_pass_id.id); bool fb_read_bound = false; - bool fb_draw_bound = true; + bool fb_draw_bound = false; const int num_atts = pass->cmn.num_color_atts; for (int i = 0; i < num_atts; i++) { // perform MSAA resolve if needed From d4ac122f36d7659a18b312fd4fa2317fb9e06a63 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 9 Sep 2023 13:10:25 +0200 Subject: [PATCH 178/292] sokol_imgui.h: fix for cimgui 1.89.9 (fixes #879) --- CHANGELOG.md | 7 +++++++ util/sokol_imgui.h | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6162474a..59e389bdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Updates +#### 09-Sep-2023 + +- a small PR has been merged which fixes a redundant glBindFramebuffer() in the GLES3 backend + in `sg_end_pass()` (see: https://github.com/floooh/sokol/pull/878), many thanks to @danielchasehooper + for catching that issue! +- sokol_imgui.h has been fixed for cimgui 1.89.9 (see https://github.com/floooh/sokol/issues/879) + #### 28-Aug-2023 **sokol_gfx.h metal**: A new attempt at fixing a rare Metal validation layer diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 024b37618..2d4cd9454 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -2573,6 +2573,14 @@ static void _simgui_bind_image_sampler(sg_bindings* bindings, ImTextureID tex_id } } +static ImDrawList* _simgui_imdrawlist_at(ImDrawData* draw_data, int cl_index) { + #if defined(__cplusplus) + return draw_data->CmdLists[cl_index]; + #else + return draw_data->CmdLists.Data[cl_index]; + #endif +} + SOKOL_API_IMPL void simgui_render(void) { SOKOL_ASSERT(_SIMGUI_INIT_COOKIE == _simgui.init_cookie); #if defined(__cplusplus) @@ -2600,7 +2608,7 @@ SOKOL_API_IMPL void simgui_render(void) { size_t all_idx_size = 0; int cmd_list_count = 0; for (int cl_index = 0; cl_index < draw_data->CmdListsCount; cl_index++, cmd_list_count++) { - ImDrawList* cl = draw_data->CmdLists[cl_index]; + ImDrawList* cl = _simgui_imdrawlist_at(draw_data, cl_index); const size_t vtx_size = (size_t)cl->VtxBuffer.Size * sizeof(ImDrawVert); const size_t idx_size = (size_t)cl->IdxBuffer.Size * sizeof(ImDrawIdx); @@ -2664,7 +2672,7 @@ SOKOL_API_IMPL void simgui_render(void) { int vb_offset = 0; int ib_offset = 0; for (int cl_index = 0; cl_index < cmd_list_count; cl_index++) { - const ImDrawList* cl = draw_data->CmdLists[cl_index]; + ImDrawList* cl = _simgui_imdrawlist_at(draw_data, cl_index); bind.vertex_buffer_offsets[0] = vb_offset; bind.index_buffer_offset = ib_offset; From c98be285e73c39e785e65dc8048e79d4a2a0edc8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 9 Sep 2023 18:58:16 +0200 Subject: [PATCH 179/292] sokol_gfx.h: fix cubemap creation --- sokol_gfx.h | 87 +++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0cb8f76ae..17aa68f95 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12641,36 +12641,40 @@ _SOKOL_PRIVATE void _sg_wgpu_copy_image_data(const _sg_image_t* img, WGPUTexture wgpu_copy_tex.aspect = WGPUTextureAspect_All; WGPUExtent3D wgpu_extent; _sg_clear(&wgpu_extent, sizeof(wgpu_extent)); - for (int mip_level = 0; mip_level < img->cmn.num_mipmaps; mip_level++) { - wgpu_copy_tex.mipLevel = (uint32_t)mip_level; - int mip_width = _sg_miplevel_dim(img->cmn.width, mip_level); - int mip_height = _sg_miplevel_dim(img->cmn.height, mip_level); - int mip_slices; - switch (img->cmn.type) { - case SG_IMAGETYPE_CUBE: - mip_slices = 6; - break; - case SG_IMAGETYPE_3D: - mip_slices = _sg_miplevel_dim(img->cmn.num_slices, mip_level); - break; - default: - mip_slices = img->cmn.num_slices; - break; - } - const int row_pitch = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1); - const int num_rows = _sg_num_rows(img->cmn.pixel_format, mip_height); - if (_sg_is_compressed_pixel_format(img->cmn.pixel_format)) { - mip_width = _sg_roundup(mip_width, 4); - mip_height = _sg_roundup(mip_height, 4); + const int num_faces = (img->cmn.type == SG_IMAGETYPE_CUBE) ? 6 : 1; + for (int face_index = 0; face_index < num_faces; face_index++) { + for (int mip_index = 0; mip_index < img->cmn.num_mipmaps; mip_index++) { + wgpu_copy_tex.mipLevel = (uint32_t)mip_index; + wgpu_copy_tex.origin.z = (uint32_t)face_index; + int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index); + int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index); + int mip_slices; + switch (img->cmn.type) { + case SG_IMAGETYPE_CUBE: + mip_slices = 1; + break; + case SG_IMAGETYPE_3D: + mip_slices = _sg_miplevel_dim(img->cmn.num_slices, mip_index); + break; + default: + mip_slices = img->cmn.num_slices; + break; + } + const int row_pitch = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1); + const int num_rows = _sg_num_rows(img->cmn.pixel_format, mip_height); + if (_sg_is_compressed_pixel_format(img->cmn.pixel_format)) { + mip_width = _sg_roundup(mip_width, 4); + mip_height = _sg_roundup(mip_height, 4); + } + wgpu_layout.offset = 0; + wgpu_layout.bytesPerRow = (uint32_t)row_pitch; + wgpu_layout.rowsPerImage = (uint32_t)num_rows; + wgpu_extent.width = (uint32_t)mip_width; + wgpu_extent.height = (uint32_t)mip_height; + wgpu_extent.depthOrArrayLayers = (uint32_t)mip_slices; + const sg_range* mip_data = &data->subimage[face_index][mip_index]; + wgpuQueueWriteTexture(_sg.wgpu.queue, &wgpu_copy_tex, mip_data->ptr, mip_data->size, &wgpu_layout, &wgpu_extent); } - wgpu_layout.offset = 0; - wgpu_layout.bytesPerRow = (uint32_t)row_pitch; - wgpu_layout.rowsPerImage = (uint32_t)num_rows; - wgpu_extent.width = (uint32_t)mip_width; - wgpu_extent.height = (uint32_t)mip_height; - wgpu_extent.depthOrArrayLayers = (uint32_t)mip_slices; - const sg_range* mip_data = &data->subimage[0][mip_level]; - wgpuQueueWriteTexture(_sg.wgpu.queue, &wgpu_copy_tex, mip_data->ptr, mip_data->size, &wgpu_layout, &wgpu_extent); } } @@ -12688,13 +12692,17 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s if (desc->render_target) { wgpu_tex_desc.usage |= WGPUTextureUsage_RenderAttachment; } - wgpu_tex_desc.dimension = _sg_wgpu_texture_dimension(desc->type); - wgpu_tex_desc.size.width = (uint32_t) desc->width; - wgpu_tex_desc.size.height = (uint32_t) desc->height; - wgpu_tex_desc.size.depthOrArrayLayers = (uint32_t) desc->num_slices; - wgpu_tex_desc.format = _sg_wgpu_textureformat(desc->pixel_format); - wgpu_tex_desc.mipLevelCount = (uint32_t) desc->num_mipmaps; - wgpu_tex_desc.sampleCount = (uint32_t) desc->sample_count; + wgpu_tex_desc.dimension = _sg_wgpu_texture_dimension(img->cmn.type); + wgpu_tex_desc.size.width = (uint32_t) img->cmn.width; + wgpu_tex_desc.size.height = (uint32_t) img->cmn.height; + if (desc->type == SG_IMAGETYPE_CUBE) { + wgpu_tex_desc.size.depthOrArrayLayers = 6; + } else { + wgpu_tex_desc.size.depthOrArrayLayers = (uint32_t) img->cmn.num_slices; + } + wgpu_tex_desc.format = _sg_wgpu_textureformat(img->cmn.pixel_format); + wgpu_tex_desc.mipLevelCount = (uint32_t) img->cmn.num_mipmaps; + wgpu_tex_desc.sampleCount = (uint32_t) img->cmn.sample_count; img->wgpu.tex = wgpuDeviceCreateTexture(_sg.wgpu.dev, &wgpu_tex_desc); if (0 == img->wgpu.tex) { _SG_ERROR(WGPU_CREATE_TEXTURE_FAILED); @@ -12709,11 +12717,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s wgpu_texview_desc.label = desc->label; wgpu_texview_desc.dimension = _sg_wgpu_texture_view_dimension(img->cmn.type); wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; - // FIXME: cubemap?? - if (img->cmn.type == SG_IMAGETYPE_ARRAY) { - wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + if (img->cmn.type == SG_IMAGETYPE_CUBE) { + wgpu_texview_desc.arrayLayerCount = 6; } else { - wgpu_texview_desc.arrayLayerCount = 1; + wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; } // FIXME: should aspect be DepthOnly for all depth texture formats? wgpu_texview_desc.aspect = WGPUTextureAspect_All; From 681eb7801ce2431d8d2e6d457c159a3864195dc6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 11 Sep 2023 17:49:30 +0200 Subject: [PATCH 180/292] sokol_gfx.h wgpu: add a fixme comment in _sg_wgpu_apply_uniforms() --- sokol_gfx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 17aa68f95..e4f7c5493 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13385,6 +13385,8 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); + // FIXME: memcpy into an intermediate memory buffer here, and do a single big + // wgpuQueueWriteBuffer at the end of the frame wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, From f6bdb52aa52829af10231eb605d9b5a6dbe5383b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 12 Sep 2023 18:07:42 +0200 Subject: [PATCH 181/292] sokol_gfx.h wgpu: call wgpuBufferDestroy and wgpuTextureDestroy before the Release() call --- sokol_gfx.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index e4f7c5493..b9c4aa278 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12608,6 +12608,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_buffer(_sg_buffer_t* buf, const _SOKOL_PRIVATE void _sg_wgpu_discard_buffer(_sg_buffer_t* buf) { SOKOL_ASSERT(buf); if (buf->wgpu.buf) { + wgpuBufferDestroy(buf->wgpu.buf); wgpuBufferRelease(buf->wgpu.buf); } } @@ -12734,14 +12735,15 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s _SOKOL_PRIVATE void _sg_wgpu_discard_image(_sg_image_t* img) { SOKOL_ASSERT(img); - if (img->wgpu.tex) { - wgpuTextureRelease(img->wgpu.tex); - img->wgpu.tex = 0; - } if (img->wgpu.view) { wgpuTextureViewRelease(img->wgpu.view); img->wgpu.view = 0; } + if (img->wgpu.tex) { + wgpuTextureDestroy(img->wgpu.tex); + wgpuTextureRelease(img->wgpu.tex); + img->wgpu.tex = 0; + } } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, const sg_sampler_desc* desc) { From dd4c3cf43c4701f1648bd1105cde7ee51d6df849 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 12 Sep 2023 20:21:02 +0200 Subject: [PATCH 182/292] sokol_gfx.h wgpu: don't issue redundant vertex- and index-buffer binding calls --- sokol_gfx.h | 76 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b9c4aa278..7146a92da 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4929,6 +4929,16 @@ typedef struct { const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; _sg_wgpu_uniform_buffer_t uniform; + struct { + struct { + sg_buffer buffer; + int offset; + } vbs[SG_MAX_VERTEX_BUFFERS]; + struct { + sg_buffer buffer; + int offset; + } ib; + } bindcache; } _sg_wgpu_backend_t; #endif @@ -5352,7 +5362,7 @@ _SOKOL_PRIVATE int _sg_roundup(int val, int round_to) { return (val+(round_to-1)) & ~(round_to-1); } -_SOKOL_PRIVATE uint64_t _sg_roundup_u32(uint32_t val, uint32_t round_to) { +_SOKOL_PRIVATE uint32_t _sg_roundup_u32(uint32_t val, uint32_t round_to) { return (val+(round_to-1)) & ~(round_to-1); } @@ -12497,6 +12507,32 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } +_SOKOL_PRIVATE void _sg_wgpu_bindcache_clear(void) { + memset(&_sg.wgpu.bindcache, 0, sizeof(_sg.wgpu.bindcache)); +} + +_SOKOL_PRIVATE bool _sg_wgpu_bindcache_vb_dirty(int index, const _sg_buffer_t* vb, int offset) { + SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); + return (vb->slot.id != _sg.wgpu.bindcache.vbs[index].buffer.id) || (offset != _sg.wgpu.bindcache.vbs[index].offset); +} + +_SOKOL_PRIVATE void _sg_wgpu_bindcache_vb_update(int index, const _sg_buffer_t* vb, int offset) { + SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); + _sg.wgpu.bindcache.vbs[index].buffer.id = vb->slot.id; + _sg.wgpu.bindcache.vbs[index].offset = offset; +} + +_SOKOL_PRIVATE bool _sg_wgpu_bindcache_ib_dirty(const _sg_buffer_t* ib, int ib_offset) { + SOKOL_ASSERT(ib); + return (ib->slot.id != _sg.wgpu.bindcache.ib.buffer.id) || (ib_offset != _sg.wgpu.bindcache.ib.offset); +} + +_SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_offset) { + SOKOL_ASSERT(ib); + _sg.wgpu.bindcache.ib.buffer.id = ib->slot.id; + _sg.wgpu.bindcache.ib.offset = ib_offset; +} + _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.wgpu.device); @@ -12517,6 +12553,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.queue = wgpuDeviceGetQueue(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.queue); + _sg_wgpu_bindcache_clear(); _sg_wgpu_init_caps(); _sg_wgpu_uniform_buffer_init(desc); @@ -12927,7 +12964,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _ const int vb_idx = va_state->buffer_index; SOKOL_ASSERT(vb_idx < SG_MAX_VERTEX_BUFFERS); pip->cmn.vertex_buffer_layout_active[vb_idx] = true; - const uint32_t wgpu_attr_idx = wgpu_vb_layouts[vb_idx].attributeCount; + const size_t wgpu_attr_idx = wgpu_vb_layouts[vb_idx].attributeCount; wgpu_vb_layouts[vb_idx].attributeCount += 1; wgpu_vtx_attrs[vb_idx][wgpu_attr_idx].format = _sg_wgpu_vertexformat(va_state->format); wgpu_vtx_attrs[vb_idx][wgpu_attr_idx].offset = (uint64_t)va_state->offset; @@ -13166,6 +13203,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.cur_height = h; _sg.wgpu.cur_pipeline = 0; _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; + _sg_wgpu_bindcache_clear(); WGPURenderPassDescriptor wgpu_pass_desc; WGPURenderPassColorAttachment wgpu_color_att[SG_MAX_COLOR_ATTACHMENTS]; @@ -13344,21 +13382,29 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( // index buffer if (ib) { - const WGPUIndexFormat format = _sg_wgpu_indexformat(pip->cmn.index_type); - const uint64_t buf_size = (uint64_t)ib->cmn.size; - const uint64_t offset = (uint64_t)ib_offset; - SOKOL_ASSERT(buf_size > offset); - const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, format, offset, max_bytes); + if (_sg_wgpu_bindcache_ib_dirty(ib, ib_offset)) { + _sg_wgpu_bindcache_ib_update(ib, ib_offset); + const WGPUIndexFormat format = _sg_wgpu_indexformat(pip->cmn.index_type); + const uint64_t buf_size = (uint64_t)ib->cmn.size; + const uint64_t offset = (uint64_t)ib_offset; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, format, offset, max_bytes); + } } + // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) // vertex buffers - for (uint32_t slot = 0; slot < (uint32_t)num_vbs; slot++) { - const uint64_t buf_size = (uint64_t)vbs[slot]->cmn.size; - const uint64_t offset = (uint64_t)vb_offsets[slot]; - SOKOL_ASSERT(buf_size > offset); - const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, slot, vbs[slot]->wgpu.buf, offset, max_bytes); + for (int slot = 0; slot < num_vbs; slot++) { + if (_sg_wgpu_bindcache_vb_dirty(slot, vbs[slot], vb_offsets[slot])) { + _sg_wgpu_bindcache_vb_update(slot, vbs[slot], vb_offsets[slot]); + const uint64_t buf_size = (uint64_t)vbs[slot]->cmn.size; + const uint64_t offset = (uint64_t)vb_offsets[slot]; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, vbs[slot]->wgpu.buf, offset, max_bytes); + } + // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } // FIXME: create adhoc bind group object for images and samplers @@ -13396,7 +13442,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ _sg.wgpu.uniform.bind.group, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.uniform.bind.offsets[0][0]); - _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + data->size, alignment); + _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); } _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_instances) { From fa9a908429c23b6873fb41de0f3222eccd4d4703 Mon Sep 17 00:00:00 2001 From: "Desktop\\Damian" Date: Thu, 14 Sep 2023 23:17:36 +1000 Subject: [PATCH 183/292] Do all attribute queries at once - decrease startup time by ~65ms, binary size by 1.5kb --- sokol_app.h | 76 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index a1f45b6b1..6beed0f7d 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -6565,11 +6565,53 @@ _SOKOL_PRIVATE int _sapp_wgl_attrib(int pixel_format, int attrib) { return value; } +_SOKOL_PRIVATE void _sapp_wgl_attribiv(int pixel_format, int num_attribs, const int* attribs, int* results) { + SOKOL_ASSERT(_sapp.wgl.arb_pixel_format); + if (!_sapp.wgl.GetPixelFormatAttribivARB(_sapp.win32.dc, pixel_format, 0, num_attribs, attribs, results)) { + _SAPP_PANIC(WIN32_GET_PIXELFORMAT_ATTRIB_FAILED); + } +} + _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { SOKOL_ASSERT(_sapp.win32.dc); SOKOL_ASSERT(_sapp.wgl.arb_pixel_format); const _sapp_gl_fbconfig* closest; + const int QUERY_TAGS[] = { + WGL_SUPPORT_OPENGL_ARB, + WGL_DRAW_TO_WINDOW_ARB, + WGL_PIXEL_TYPE_ARB, + WGL_ACCELERATION_ARB, + WGL_DOUBLE_BUFFER_ARB, + WGL_RED_BITS_ARB, + WGL_GREEN_BITS_ARB, + WGL_BLUE_BITS_ARB, + WGL_ALPHA_BITS_ARB, + WGL_DEPTH_BITS_ARB, + WGL_STENCIL_BITS_ARB, + WGL_SAMPLES_ARB, + }; + const int RESULT_SUPPORT_OPENGL_INDEX = 0; + const int RESULT_DRAW_TO_WINDOW_INDEX = 1; + const int RESULT_PIXEL_TYPE_INDEX = 2; + const int RESULT_ACCELERATION_INDEX = 3; + const int RESULT_DOUBLE_BUFFER_INDEX = 4; + const int RESULT_RED_BITS_INDEX = 5; + const int RESULT_GREEN_BITS_INDEX = 6; + const int RESULT_BLUE_BITS_INDEX = 7; + const int RESULT_ALPHA_BITS_INDEX = 8; + const int RESULT_DEPTH_BITS_INDEX = 9; + const int RESULT_STENCIL_BITS_INDEX = 10; + const int RESULT_SAMPLES_INDEX = 11; + + int query_results[12] = {0}; + // Drop the last item if multisample extension is not supported. + // If in future querying with multiple extensions, will have to shuffle index values to have active extensions on the end. + int query_count = 12; + if (!_sapp.wgl.arb_multisample) { + query_count = 11; + } + int native_count = _sapp_wgl_attrib(1, WGL_NUMBER_PIXEL_FORMATS_ARB); _sapp_gl_fbconfig* usable_configs = (_sapp_gl_fbconfig*) _sapp_malloc_clear((size_t)native_count * sizeof(_sapp_gl_fbconfig)); SOKOL_ASSERT(usable_configs); @@ -6578,27 +6620,27 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { const int n = i + 1; _sapp_gl_fbconfig* u = usable_configs + usable_count; _sapp_gl_init_fbconfig(u); - if (!_sapp_wgl_attrib(n, WGL_SUPPORT_OPENGL_ARB) || !_sapp_wgl_attrib(n, WGL_DRAW_TO_WINDOW_ARB)) { - continue; - } - if (_sapp_wgl_attrib(n, WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB) { - continue; - } - if (_sapp_wgl_attrib(n, WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) { + _sapp_wgl_attribiv(n, query_count, QUERY_TAGS, query_results); + + if (query_results[RESULT_SUPPORT_OPENGL_INDEX] == 0 + || query_results[RESULT_DRAW_TO_WINDOW_INDEX] == 0 + || query_results[RESULT_PIXEL_TYPE_INDEX] != WGL_TYPE_RGBA_ARB + || query_results[RESULT_ACCELERATION_INDEX] == WGL_NO_ACCELERATION_ARB) + { continue; } - u->red_bits = _sapp_wgl_attrib(n, WGL_RED_BITS_ARB); - u->green_bits = _sapp_wgl_attrib(n, WGL_GREEN_BITS_ARB); - u->blue_bits = _sapp_wgl_attrib(n, WGL_BLUE_BITS_ARB); - u->alpha_bits = _sapp_wgl_attrib(n, WGL_ALPHA_BITS_ARB); - u->depth_bits = _sapp_wgl_attrib(n, WGL_DEPTH_BITS_ARB); - u->stencil_bits = _sapp_wgl_attrib(n, WGL_STENCIL_BITS_ARB); - if (_sapp_wgl_attrib(n, WGL_DOUBLE_BUFFER_ARB)) { + u->red_bits = query_results[RESULT_RED_BITS_INDEX]; + u->green_bits = query_results[RESULT_GREEN_BITS_INDEX]; + u->blue_bits = query_results[RESULT_BLUE_BITS_INDEX]; + u->alpha_bits = query_results[RESULT_ALPHA_BITS_INDEX]; + u->depth_bits = query_results[RESULT_DEPTH_BITS_INDEX]; + u->stencil_bits = query_results[RESULT_STENCIL_BITS_INDEX]; + if (query_results[RESULT_DOUBLE_BUFFER_INDEX]) { u->doublebuffer = true; } - if (_sapp.wgl.arb_multisample) { - u->samples = _sapp_wgl_attrib(n, WGL_SAMPLES_ARB); - } + + u->samples = query_results[RESULT_SAMPLES_INDEX]; // Note: If arb_multisample is not supported - just takes the default 0 + u->handle = (uintptr_t)n; usable_count++; } From f6a2bfd335618c8c1fa0fde11d08255709d8b83a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 16 Sep 2023 16:29:03 +0200 Subject: [PATCH 184/292] sokol_gfx.h wgpu: only do one writeBuffer per frame for uniform data --- sokol_gfx.h | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7146a92da..a96eaa857 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4898,6 +4898,7 @@ typedef _sg_wgpu_context_t _sg_context_t; typedef struct { uint32_t num_bytes; uint32_t offset; // current offset into buf + uint8_t* stage; // intermediate buffer for uniform data updates WGPUBuffer buf; // the GPU-side uniform buffer struct { WGPUBindGroupLayout group_layout; @@ -4906,6 +4907,17 @@ typedef struct { } bind; } _sg_wgpu_uniform_buffer_t; +typedef struct { + struct { + sg_buffer buffer; + int offset; + } vbs[SG_MAX_VERTEX_BUFFERS]; + struct { + sg_buffer buffer; + int offset; + } ib; +} _sg_wgpu_bindcache_t; + // the WGPU backend state typedef struct { bool valid; @@ -4929,16 +4941,7 @@ typedef struct { const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; _sg_wgpu_uniform_buffer_t uniform; - struct { - struct { - sg_buffer buffer; - int offset; - } vbs[SG_MAX_VERTEX_BUFFERS]; - struct { - sg_buffer buffer; - int offset; - } ib; - } bindcache; + _sg_wgpu_bindcache_t bindcache; } _sg_wgpu_backend_t; #endif @@ -12424,6 +12427,11 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { + SOKOL_ASSERT(0 == _sg.wgpu.uniform.stage); + SOKOL_ASSERT(0 == _sg.wgpu.uniform.buf); + SOKOL_ASSERT(0 == _sg.wgpu.uniform.bind.group_layout); + SOKOL_ASSERT(0 == _sg.wgpu.uniform.bind.group); + // Add the max-uniform-update size (64 KB) to the requested buffer size, // this is to prevent validation errors in the WebGPU implementation // if the entire buffer size is used per frame. 64 KB is the allowed @@ -12431,6 +12439,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { // // FIXME: is this still needed? _sg.wgpu.uniform.num_bytes = (uint32_t)(desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); + _sg.wgpu.uniform.stage = (uint8_t*)_sg_malloc(_sg.wgpu.uniform.num_bytes); WGPUBufferDescriptor ub_desc; _sg_clear(&ub_desc, sizeof(ub_desc)); @@ -12491,6 +12500,10 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_discard(void) { wgpuBindGroupLayoutRelease(_sg.wgpu.uniform.bind.group_layout); _sg.wgpu.uniform.bind.group_layout = 0; } + if (_sg.wgpu.uniform.stage) { + _sg_free(_sg.wgpu.uniform.stage); + _sg.wgpu.uniform.stage = 0; + } } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { @@ -12502,7 +12515,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { - // clear offsets + wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.stage, _sg.wgpu.uniform.offset); _sg.wgpu.uniform.offset = 0; _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } @@ -13254,6 +13267,8 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { SOKOL_ASSERT(!_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.cmd_enc); + _sg_wgpu_uniform_buffer_on_commit(); + WGPUCommandBufferDescriptor cmd_buf_desc; _sg_clear(&cmd_buf_desc, sizeof(cmd_buf_desc)); WGPUCommandBuffer wgpu_cmd_buf = wgpuCommandEncoderFinish(_sg.wgpu.cmd_enc, &cmd_buf_desc); @@ -13268,9 +13283,6 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { WGPUCommandEncoderDescriptor cmd_enc_desc; _sg_clear(&cmd_enc_desc, sizeof(cmd_enc_desc)); _sg.wgpu.cmd_enc = wgpuDeviceCreateCommandEncoder(_sg.wgpu.dev, &cmd_enc_desc); - - // reset uniform buffer offsets - _sg_wgpu_uniform_buffer_on_commit(); } _SOKOL_PRIVATE void _sg_wgpu_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { @@ -13424,6 +13436,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ const uint32_t alignment = _sg.wgpu.limits.limits.minUniformBufferOffsetAlignment; SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); + SOKOL_ASSERT(_sg.wgpu.uniform.stage); SOKOL_ASSERT((_sg.wgpu.uniform.offset + data->size) <= _sg.wgpu.uniform.num_bytes); SOKOL_ASSERT((_sg.wgpu.uniform.offset & (alignment - 1)) == 0); SOKOL_ASSERT(_sg.wgpu.cur_pipeline && _sg.wgpu.cur_pipeline->shader); @@ -13433,16 +13446,14 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - // FIXME: memcpy into an intermediate memory buffer here, and do a single big - // wgpuQueueWriteBuffer at the end of the frame - wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, _sg.wgpu.uniform.offset, data->ptr, data->size); + memcpy(_sg.wgpu.uniform.stage + _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; + _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_UNIFORM_BINDGROUP_INDEX, _sg.wgpu.uniform.bind.group, SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_UBS, &_sg.wgpu.uniform.bind.offsets[0][0]); - _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); } _SOKOL_PRIVATE void _sg_wgpu_draw(int base_element, int num_elements, int num_instances) { From e0e88804af6368177b404b9e715d5d694870ccd7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 16 Sep 2023 17:38:47 +0200 Subject: [PATCH 185/292] sokol_gfx.h wgpu: better naming for the intermediate uniform staging memory block --- sokol_gfx.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a96eaa857..59e225523 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4898,7 +4898,7 @@ typedef _sg_wgpu_context_t _sg_context_t; typedef struct { uint32_t num_bytes; uint32_t offset; // current offset into buf - uint8_t* stage; // intermediate buffer for uniform data updates + uint8_t* staging; // intermediate buffer for uniform data updates WGPUBuffer buf; // the GPU-side uniform buffer struct { WGPUBindGroupLayout group_layout; @@ -12427,7 +12427,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { - SOKOL_ASSERT(0 == _sg.wgpu.uniform.stage); + SOKOL_ASSERT(0 == _sg.wgpu.uniform.staging); SOKOL_ASSERT(0 == _sg.wgpu.uniform.buf); SOKOL_ASSERT(0 == _sg.wgpu.uniform.bind.group_layout); SOKOL_ASSERT(0 == _sg.wgpu.uniform.bind.group); @@ -12439,7 +12439,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_init(const sg_desc* desc) { // // FIXME: is this still needed? _sg.wgpu.uniform.num_bytes = (uint32_t)(desc->uniform_buffer_size + _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - _sg.wgpu.uniform.stage = (uint8_t*)_sg_malloc(_sg.wgpu.uniform.num_bytes); + _sg.wgpu.uniform.staging = (uint8_t*)_sg_malloc(_sg.wgpu.uniform.num_bytes); WGPUBufferDescriptor ub_desc; _sg_clear(&ub_desc, sizeof(ub_desc)); @@ -12500,9 +12500,9 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_discard(void) { wgpuBindGroupLayoutRelease(_sg.wgpu.uniform.bind.group_layout); _sg.wgpu.uniform.bind.group_layout = 0; } - if (_sg.wgpu.uniform.stage) { - _sg_free(_sg.wgpu.uniform.stage); - _sg.wgpu.uniform.stage = 0; + if (_sg.wgpu.uniform.staging) { + _sg_free(_sg.wgpu.uniform.staging); + _sg.wgpu.uniform.staging = 0; } } @@ -12515,7 +12515,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { } _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { - wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.stage, _sg.wgpu.uniform.offset); + wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.staging, _sg.wgpu.uniform.offset); _sg.wgpu.uniform.offset = 0; _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } @@ -13436,7 +13436,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ const uint32_t alignment = _sg.wgpu.limits.limits.minUniformBufferOffsetAlignment; SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - SOKOL_ASSERT(_sg.wgpu.uniform.stage); + SOKOL_ASSERT(_sg.wgpu.uniform.staging); SOKOL_ASSERT((_sg.wgpu.uniform.offset + data->size) <= _sg.wgpu.uniform.num_bytes); SOKOL_ASSERT((_sg.wgpu.uniform.offset & (alignment - 1)) == 0); SOKOL_ASSERT(_sg.wgpu.cur_pipeline && _sg.wgpu.cur_pipeline->shader); @@ -13446,7 +13446,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - memcpy(_sg.wgpu.uniform.stage + _sg.wgpu.uniform.offset, data->ptr, data->size); + memcpy(_sg.wgpu.uniform.staging + _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, From cd8ed49f1b3bbe9441c3a2a946654e9070b3bd95 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 17 Sep 2023 16:32:36 +0200 Subject: [PATCH 186/292] sokol_gfx.h metal: add debug labels and support push/pop debug group --- sokol_gfx.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 6cf8fd4ec..921673ae9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -10883,12 +10883,17 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { _sg.mtl.sem = dispatch_semaphore_create(SG_NUM_INFLIGHT_FRAMES); _sg.mtl.device = (__bridge id) desc->context.metal.device; _sg.mtl.cmd_queue = [_sg.mtl.device newCommandQueue]; + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { _sg.mtl.uniform_buffers[i] = [_sg.mtl.device newBufferWithLength:(NSUInteger)_sg.mtl.ub_size options:MTLResourceCPUCacheModeWriteCombined|MTLResourceStorageModeShared ]; + #if defined(SOKOL_DEBUG) + _sg.mtl.uniform_buffers[i].label = [NSString stringWithFormat:@"sg-uniform-buffer.%d", i]; + #endif } + if (@available(macOS 10.15, iOS 13.0, *)) { _sg.mtl.has_unified_memory = _sg.mtl.device.hasUnifiedMemory; } else { @@ -10983,6 +10988,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_buffer(_sg_buffer_t* buf, const mtl_buf = [_sg.mtl.device newBufferWithLength:(NSUInteger)buf->cmn.size options:mtl_options]; } } + #if defined(SOKOL_DEBUG) + if (desc->label) { + mtl_buf.label = [NSString stringWithFormat:@"%s.%d", desc->label, slot]; + } + #endif buf->mtl.buf[slot] = _sg_mtl_add_resource(mtl_buf); _SG_OBJC_RELEASE(mtl_buf); } @@ -11126,6 +11136,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_image(_sg_image_t* img, const sg _sg_mtl_copy_image_data(img, mtl_tex, &desc->data); } } + #if defined(SOKOL_DEBUG) + if (desc->label) { + mtl_tex.label = [NSString stringWithFormat:@"%s.%d", desc->label, slot]; + } + #endif img->mtl.tex[slot] = _sg_mtl_add_resource(mtl_tex); _SG_OBJC_RELEASE(mtl_tex); } @@ -11167,6 +11182,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, cons mtl_desc.maxAnisotropy = desc->max_anisotropy; mtl_desc.normalizedCoordinates = YES; mtl_desc.compareFunction = _sg_mtl_compare_func(desc->compare); + #if defined(SOKOL_DEBUG) + if (desc->label) { + mtl_desc.label = [NSString stringWithUTF8String:desc->label]; + } + #endif mtl_smp = [_sg.mtl.device newSamplerStateWithDescriptor:mtl_desc]; _SG_OBJC_RELEASE(mtl_desc); } @@ -11246,6 +11266,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_shader(_sg_shader_t* shd, const _SG_ERROR(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND); goto failed; } + #if defined(SOKOL_DEBUG) + if (desc->label) { + vs_lib.label = [NSString stringWithFormat:@"%s.vs", desc->label]; + fs_lib.label = [NSString stringWithFormat:@"%s.fs", desc->label]; + } + #endif // it is legal to call _sg_mtl_add_resource with a nil value, this will return a special 0xFFFFFFFF index shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib = _sg_mtl_add_resource(vs_lib); _SG_OBJC_RELEASE(vs_lib); @@ -11361,6 +11387,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s rp_desc.colorAttachments[i].sourceAlphaBlendFactor = _sg_mtl_blend_factor(cs->blend.src_factor_alpha); rp_desc.colorAttachments[i].sourceRGBBlendFactor = _sg_mtl_blend_factor(cs->blend.src_factor_rgb); } + #if defined(SOKOL_DEBUG) + if (desc->label) { + rp_desc.label = [NSString stringWithFormat:@"%s", desc->label]; + } + #endif NSError* err = NULL; id mtl_rps = [_sg.mtl.device newRenderPipelineStateWithDescriptor:rp_desc error:&err]; _SG_OBJC_RELEASE(rp_desc); @@ -11393,6 +11424,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s ds_desc.frontFaceStencil.readMask = desc->stencil.read_mask; ds_desc.frontFaceStencil.writeMask = desc->stencil.write_mask; } + #if defined(SOKOL_DEBUG) + if (desc->label) { + ds_desc.label = [NSString stringWithFormat:@"%s.dss", desc->label]; + } + #endif // FIXME: can this actually fail? id mtl_dss = [_sg.mtl.device newDepthStencilStateWithDescriptor:ds_desc]; _SG_OBJC_RELEASE(ds_desc); @@ -11931,6 +11967,19 @@ _SOKOL_PRIVATE void _sg_mtl_update_image(_sg_image_t* img, const sg_image_data* _sg_mtl_copy_image_data(img, mtl_tex, data); } +_SOKOL_PRIVATE void _sg_mtl_push_debug_group(const char* name) { + SOKOL_ASSERT(name); + if (_sg.mtl.cmd_encoder) { + [_sg.mtl.cmd_encoder pushDebugGroup:[NSString stringWithUTF8String:name]]; + } +} + +_SOKOL_PRIVATE void _sg_mtl_pop_debug_group(void) { + if (_sg.mtl.cmd_encoder) { + [_sg.mtl.cmd_encoder popDebugGroup]; + } +} + // ██ ██ ███████ ██████ ██████ ██████ ██ ██ ██████ █████ ██████ ██ ██ ███████ ███ ██ ██████ // ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ // ██ █ ██ █████ ██████ ██ ███ ██████ ██ ██ ██████ ███████ ██ █████ █████ ██ ██ ██ ██ ██ @@ -14160,6 +14209,22 @@ static inline void _sg_update_image(_sg_image_t* img, const sg_image_data* data) #endif } +static inline void _sg_push_debug_group(const char* name) { + #if defined(SOKOL_METAL) + _sg_mtl_push_debug_group(name); + #else + _SOKOL_UNUSED(name); + #endif +} + +static inline void _sg_pop_debug_group(void) { + #if defined(SOKOL_METAL) + _sg_mtl_pop_debug_group(); + #else + _SOKOL_UNUSED(name); + #endif +} + // ██████ ██████ ██████ ██ // ██ ██ ██ ██ ██ ██ ██ // ██████ ██ ██ ██ ██ ██ @@ -17002,12 +17067,13 @@ SOKOL_API_IMPL void sg_update_image(sg_image img_id, const sg_image_data* data) SOKOL_API_IMPL void sg_push_debug_group(const char* name) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(name); - _SOKOL_UNUSED(name); + _sg_push_debug_group(name); _SG_TRACE_ARGS(push_debug_group, name); } SOKOL_API_IMPL void sg_pop_debug_group(void) { SOKOL_ASSERT(_sg.valid); + _sg_pop_debug_group(); _SG_TRACE_NOARGS(pop_debug_group); } From 45d2489137120c31160ea273dc640f3f5cdc8ccc Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 17 Sep 2023 16:42:21 +0200 Subject: [PATCH 187/292] update changelog and readme (Metal debug labels) --- CHANGELOG.md | 13 +++++++++++++ README.md | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e389bdc..351016419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ ## Updates +#### 17-Sep-2023 + +- The sokol-gfx Metal backend now adds debug labels to Metal resource objects and + also passes through the `sg_push/pop_debug_group()` calls. If you use the push/pop + debug group calls, please be aware of the following limitations: + + - a push inside a render pass must have an associated pop inside the same render pass + - a push outside any render pass must have an associated pop outside any render pass + - Metal will ignore any push/pop calls outside render passes (this is because in Metal + these are MTLCommandEncoder methods) + + Associated issue: https://github.com/floooh/sokol/issues/889, and PR: https://github.com/floooh/sokol/pull/890. + #### 09-Sep-2023 - a small PR has been merged which fixes a redundant glBindFramebuffer() in the GLES3 backend diff --git a/README.md b/README.md index 90eba58d4..8823dfb86 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Jul-2023** proper image/sampler pair support in sokol_nuklear.h) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Set-2023** debug label support in sokol_gfx.h Metal backend) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From db9a6b7940f363b5169e3335c3f156624f428c34 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 17 Sep 2023 16:43:24 +0200 Subject: [PATCH 188/292] sokol_gfx.h fix error in _sg_pop_debug_group() on non-Metal backends --- sokol_gfx.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 921673ae9..7bb6868f6 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -14220,8 +14220,6 @@ static inline void _sg_push_debug_group(const char* name) { static inline void _sg_pop_debug_group(void) { #if defined(SOKOL_METAL) _sg_mtl_pop_debug_group(); - #else - _SOKOL_UNUSED(name); #endif } From 46f89e190ce963bdc106fb1d10444b8182ab9ca4 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Sun, 17 Sep 2023 18:33:51 -0400 Subject: [PATCH 189/292] take texture target into account when binding to framebuffer --- sokol_gfx.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7bb6868f6..d730d0cee 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7523,11 +7523,13 @@ _SOKOL_PRIVATE void _sg_gl_fb_attach_texture(const _sg_gl_attachment_t* gl_att, SOKOL_ASSERT(img); const GLuint gl_tex = img->gl.tex[0]; SOKOL_ASSERT(gl_tex); + const GLuint gl_target = img->gl.target; + SOKOL_ASSERT(gl_target); const int mip_level = cmn_att->mip_level; const int slice = cmn_att->slice; switch (img->cmn.type) { case SG_IMAGETYPE_2D: - glFramebufferTexture2D(GL_FRAMEBUFFER, gl_att_type, GL_TEXTURE_2D, gl_tex, mip_level); + glFramebufferTexture2D(GL_FRAMEBUFFER, gl_att_type, gl_target, gl_tex, mip_level); break; case SG_IMAGETYPE_CUBE: glFramebufferTexture2D(GL_FRAMEBUFFER, gl_att_type, _sg_gl_cubeface_target(slice), gl_tex, mip_level); From 5081b337877140e0c196a4bd308e3bb3e70c8b3e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 13:59:29 +0200 Subject: [PATCH 190/292] sokol_gfx.h add missing error path if Metal resource creation calls fail --- sokol_gfx.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index d730d0cee..8cf25a4d9 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2894,7 +2894,10 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(D3D11_MAP_FOR_UPDATE_BUFFER_FAILED, "Map() failed when updating buffer (d3d11)") \ _SG_LOGITEM_XMACRO(D3D11_MAP_FOR_APPEND_BUFFER_FAILED, "Map() failed when appending to buffer (d3d11)") \ _SG_LOGITEM_XMACRO(D3D11_MAP_FOR_UPDATE_IMAGE_FAILED, "Map() failed when updating image (d3d11)") \ + _SG_LOGITEM_XMACRO(METAL_CREATE_BUFFER_FAILED, "failed to create buffer object (metal)") \ _SG_LOGITEM_XMACRO(METAL_TEXTURE_FORMAT_NOT_SUPPORTED, "pixel format not supported for texture (metal)") \ + _SG_LOGITEM_XMACRO(METAL_CREATE_TEXTURE_FAILED, "failed to create texture object (metal)") \ + _SG_LOGITEM_XMACRO(METAL_CREATE_SAMPLER_FAILED, "failed to create sampler object (metal)") \ _SG_LOGITEM_XMACRO(METAL_SHADER_COMPILATION_FAILED, "shader compilation failed (metal)") \ _SG_LOGITEM_XMACRO(METAL_SHADER_CREATION_FAILED, "shader creation failed (metal)") \ _SG_LOGITEM_XMACRO(METAL_SHADER_COMPILATION_OUTPUT, "") \ @@ -2902,6 +2905,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND, "fragment shader entry not found (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ + _SG_LOGITEM_XMACRO(METAL_CREATE_DSS_FAILED, "failed to create depth stencil state (metal)") \ _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "mapping uniform buffer failed (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_STAGING_BUFFER_FULL_COPY_TO_BUFFER, "per frame staging buffer full when copying to buffer (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_STAGING_BUFFER_FULL_COPY_TO_TEXTURE, "per frame staging buffer full when copying to texture (wgpu)") \ @@ -10989,6 +10993,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_buffer(_sg_buffer_t* buf, const } else { mtl_buf = [_sg.mtl.device newBufferWithLength:(NSUInteger)buf->cmn.size options:mtl_options]; } + if (nil == mtl_buf) { + _SG_ERROR(METAL_CREATE_BUFFER_FAILED); + return SG_RESOURCESTATE_FAILED; + } } #if defined(SOKOL_DEBUG) if (desc->label) { @@ -11134,6 +11142,11 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_image(_sg_image_t* img, const sg mtl_tex = (__bridge id) desc->mtl_textures[slot]; } else { mtl_tex = [_sg.mtl.device newTextureWithDescriptor:mtl_desc]; + if (nil == mtl_tex) { + _SG_OBJC_RELEASE(mtl_desc); + _SG_ERROR(METAL_CREATE_TEXTURE_FAILED); + return SG_RESOURCESTATE_FAILED; + } if ((img->cmn.usage == SG_USAGE_IMMUTABLE) && !img->cmn.render_target) { _sg_mtl_copy_image_data(img, mtl_tex, &desc->data); } @@ -11191,6 +11204,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_sampler(_sg_sampler_t* smp, cons #endif mtl_smp = [_sg.mtl.device newSamplerStateWithDescriptor:mtl_desc]; _SG_OBJC_RELEASE(mtl_desc); + if (nil == mtl_smp) { + _SG_ERROR(METAL_CREATE_SAMPLER_FAILED); + return SG_RESOURCESTATE_FAILED; + } } smp->mtl.sampler_state = _sg_mtl_add_resource(mtl_smp); _SG_OBJC_RELEASE(mtl_smp); @@ -11403,6 +11420,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s _SG_LOGMSG(METAL_CREATE_RPS_OUTPUT, [err.localizedDescription UTF8String]); return SG_RESOURCESTATE_FAILED; } + pip->mtl.rps = _sg_mtl_add_resource(mtl_rps); + _SG_OBJC_RELEASE(mtl_rps); // depth-stencil-state MTLDepthStencilDescriptor* ds_desc = [[MTLDepthStencilDescriptor alloc] init]; @@ -11431,11 +11450,12 @@ _SOKOL_PRIVATE sg_resource_state _sg_mtl_create_pipeline(_sg_pipeline_t* pip, _s ds_desc.label = [NSString stringWithFormat:@"%s.dss", desc->label]; } #endif - // FIXME: can this actually fail? id mtl_dss = [_sg.mtl.device newDepthStencilStateWithDescriptor:ds_desc]; _SG_OBJC_RELEASE(ds_desc); - pip->mtl.rps = _sg_mtl_add_resource(mtl_rps); - _SG_OBJC_RELEASE(mtl_rps); + if (nil == mtl_dss) { + _SG_ERROR(METAL_CREATE_DSS_FAILED); + return SG_RESOURCESTATE_FAILED; + } pip->mtl.dss = _sg_mtl_add_resource(mtl_dss); _SG_OBJC_RELEASE(mtl_dss); return SG_RESOURCESTATE_VALID; From 1d767d2587b8fb1ef498a2f32345ce335170e1f4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 14:31:25 +0200 Subject: [PATCH 191/292] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 351016419..1cbb1844f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Updates +#### 18-Sep-2023 + +- PR https://github.com/floooh/sokol/pull/893 has been merged, this fixes a small issue + in the GL backend when using an injected texture as framebuffer texture. +- Issue https://github.com/floooh/sokol/issues/884 has been fixed via PR https://github.com/floooh/sokol/pull/894, + this adds missing error code paths in the Metal backend when Metal object creation fails. + #### 17-Sep-2023 - The sokol-gfx Metal backend now adds debug labels to Metal resource objects and From d10614a5a25ba934b4cc3f4b1e43498931df89a4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 14:50:54 +0200 Subject: [PATCH 192/292] sokol_app.h: clarify sapp_run() behaviour in documentation header --- CHANGELOG.md | 1 + sokol_app.h | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cbb1844f..9eb9f77c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ in the GL backend when using an injected texture as framebuffer texture. - Issue https://github.com/floooh/sokol/issues/884 has been fixed via PR https://github.com/floooh/sokol/pull/894, this adds missing error code paths in the Metal backend when Metal object creation fails. +- Clarified `sapp_run()` behaviour in the sokol_app.h documentation header (search for `OPTIONAL: DON'T HIJACK main()`) #### 17-Sep-2023 diff --git a/sokol_app.h b/sokol_app.h index a1f45b6b1..c57c98b06 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -951,9 +951,11 @@ OPTIONAL: DON'T HIJACK main() (#define SOKOL_NO_ENTRY) ====================================================== + NOTE: SOKOL_NO_ENTRY and sapp_run() is currently not supported on Android. + In its default configuration, sokol_app.h "hijacks" the platform's standard main() function. This was done because different platforms - have different main functions which are not compatible with + have different entry point conventions which are not compatible with C's main() (for instance WinMain on Windows has completely different arguments). However, this "main hijacking" posed a problem for usage scenarios like integrating sokol_app.h with other languages than @@ -965,12 +967,30 @@ - instead provide the standard main() function of the platform - from the main function, call the function ```sapp_run()``` which takes a pointer to an ```sapp_desc``` structure. - - ```sapp_run()``` takes over control and calls the provided init-, frame-, - shutdown- and event-callbacks just like in the default model, it - will only return when the application quits (or not at all on some - platforms, like emscripten) - - NOTE: SOKOL_NO_ENTRY is currently not supported on Android. + - from here on```sapp_run()``` takes over control and calls the provided + init-, frame-, event- and cleanup-callbacks just like in the default model. + + sapp_run() behaves differently across platforms: + + - on some platforms, sapp_run() will return when the application quits + - on other platforms, sapp_run() will never return, even when the + application quits (the operating system is free to simply terminate + the application at any time) + - on Emscripten specifically, sapp_run() will return immediately while + the frame callback keeps being called + + This different behaviour of sapp_run() essentially means that there shouldn't + be any code *after* sapp_run(), because that may either never be called, or in + case of Emscripten will be called at an unexpected time (at application start). + + An application also should not depend on the cleanup-callback being called + when cross-platform compatibility is required. + + Since sapp_run() returns immediately on Emscripten you shouldn't activate + the 'EXIT_RUNTIME' linker option (this is disabled by default when compiling + for the browser target), since this would be called immediately at + application start, causing any global objects to be destroyed and global + variables to be zeroed. WINDOWS CONSOLE OUTPUT ====================== From 751fc4c14a0cb80130ad8014f965ac62c7e89d34 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 14:59:53 +0200 Subject: [PATCH 193/292] sokol_app.h: tweak sapp_run() behaviour documentation --- sokol_app.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_app.h b/sokol_app.h index c57c98b06..f3b68ebcf 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -988,7 +988,7 @@ Since sapp_run() returns immediately on Emscripten you shouldn't activate the 'EXIT_RUNTIME' linker option (this is disabled by default when compiling - for the browser target), since this would be called immediately at + for the browser target), since the C/C++ exit runtime would be called immediately at application start, causing any global objects to be destroyed and global variables to be zeroed. From 737c263ff8fc522b54862a55dabfd3e2d6a27fec Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 16:22:56 +0200 Subject: [PATCH 194/292] sokol_args.h: support key-only args (see documentation for details) fixes #876 --- sokol_args.h | 104 ++++++++++++++++++----------- tests/functional/sokol_args_test.c | 48 +++++++++++++ 2 files changed, 112 insertions(+), 40 deletions(-) diff --git a/sokol_args.h b/sokol_args.h index 4d37907c5..d33ba3a0d 100644 --- a/sokol_args.h +++ b/sokol_args.h @@ -35,11 +35,22 @@ When running as WebAssembly app, arguments are taken from the page URL: - https://floooh.github.io/tiny8bit/kc85.html?type=kc85_3&mod=m022&snapshot=kc85/jungle.kcc + https://floooh.github.io/tiny8bit/kc85.html?type=kc85_3&mod=m022&snapshot=kc85/jungle.kcc The same arguments provided to a command line app: - kc85 type=kc85_3 mod=m022 snapshot=kc85/jungle.kcc + kc85 type=kc85_3 mod=m022 snapshot=kc85/jungle.kcc + + You can also use standalone keys without value: + + https://floooh.github.io/tiny8bit/kc85.html?bla&blub + + On the command line: + + kc85 bla blub + + Such value-less keys are reported as the value being an empty string, but they + can be tested with `sapp_exists("bla")` or `sapp_boolean("blub")`. ARGUMENT FORMATTING =================== @@ -57,6 +68,12 @@ key=value + or + + key + + When a key has no value, the value will be assigned an empty string. + Key/value pairs are separated by 'whitespace', valid whitespace characters are space and tab. @@ -71,9 +88,6 @@ The 'key' string must be a simple string without escape sequences or whitespace. - Currently 'single keys' without values are not allowed, but may be - in the future. - The 'value' string can be quoted, and quoted value strings can contain whitespace: @@ -123,7 +137,7 @@ ... } - // check if a key's value is "true", "yes" or "on" + // check if a key's value is "true", "yes" or "on" or if this is a standalone key if (sargs_boolean("joystick_enabled")) { ... } @@ -183,23 +197,23 @@ Return true between sargs_setup() and sargs_shutdown() bool sargs_exists(const char* key) - Test if a key arg exists. + Test if an argument exists by its key name. const char* sargs_value(const char* key) - Return value associated with key. Returns an empty - string ("") if the key doesn't exist. + Return value associated with key. Returns an empty string ("") if the + key doesn't exist, or if the key doesn't have a value. const char* sargs_value_def(const char* key, const char* default) - Return value associated with key, or the provided default - value if the value doesn't exist. + Return value associated with key, or the provided default value if the + key doesn't exist, or this is a value-less key. bool sargs_equals(const char* key, const char* val); Return true if the value associated with key matches the 'val' argument. bool sargs_boolean(const char* key) - Return true if the value string of 'key' is one - of 'true', 'yes', 'on'. + Return true if the value string of 'key' is one of 'true', 'yes', 'on', + or this is a key without value. int sargs_find(const char* key) Find argument by key name and return its index, or -1 if not found. @@ -213,7 +227,7 @@ const char* sargs_value_at(int index) Return the value of argument at index. Returns empty string - if index is outside range. + if the key at index has no value, or the index is out-of-range. MEMORY ALLOCATION OVERRIDE @@ -327,13 +341,13 @@ SOKOL_ARGS_API_DECL void sargs_shutdown(void); SOKOL_ARGS_API_DECL bool sargs_isvalid(void); /* test if an argument exists by key name */ SOKOL_ARGS_API_DECL bool sargs_exists(const char* key); -/* get value by key name, return empty string if key doesn't exist */ +/* get value by key name, return empty string if key doesn't exist or an existing key has no value */ SOKOL_ARGS_API_DECL const char* sargs_value(const char* key); -/* get value by key name, return provided default if key doesn't exist */ +/* get value by key name, return provided default if key doesn't exist or has no value */ SOKOL_ARGS_API_DECL const char* sargs_value_def(const char* key, const char* def); /* return true if val arg matches the value associated with key */ SOKOL_ARGS_API_DECL bool sargs_equals(const char* key, const char* val); -/* return true if key's value is "true", "yes" or "on" */ +/* return true if key's value is "true", "yes", "on" or an existing key has no value */ SOKOL_ARGS_API_DECL bool sargs_boolean(const char* key); /* get index of arg by key name, return -1 if not exists */ SOKOL_ARGS_API_DECL int sargs_find(const char* key); @@ -486,8 +500,8 @@ _SOKOL_PRIVATE bool _sargs_val_expected(void) { return 0 != (_sargs.parse_state & _SARGS_EXPECT_VAL); } -_SOKOL_PRIVATE void _sargs_expect_sep(void) { - _sargs.parse_state = _SARGS_EXPECT_SEP; +_SOKOL_PRIVATE void _sargs_expect_sep_or_key(void) { + _sargs.parse_state = _SARGS_EXPECT_SEP | _SARGS_EXPECT_KEY; } _SOKOL_PRIVATE bool _sargs_any_expected(void) { @@ -524,14 +538,17 @@ _SOKOL_PRIVATE bool _sargs_is_whitespace(char c) { } _SOKOL_PRIVATE void _sargs_start_key(void) { - SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); + SOKOL_ASSERT((_sargs.num_args >= 0) && (_sargs.num_args < _sargs.max_args)); _sargs.parse_state = _SARGS_PARSING_KEY; _sargs.args[_sargs.num_args].key = _sargs.buf_pos; } _SOKOL_PRIVATE void _sargs_end_key(void) { - SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); + SOKOL_ASSERT((_sargs.num_args >= 0) && (_sargs.num_args < _sargs.max_args)); _sargs_putc(0); + // declare val as empty string in case this is a key-only arg + _sargs.args[_sargs.num_args].val = _sargs.buf_pos - 1; + _sargs.num_args++; _sargs.parse_state = 0; } @@ -540,15 +557,13 @@ _SOKOL_PRIVATE bool _sargs_parsing_key(void) { } _SOKOL_PRIVATE void _sargs_start_val(void) { - SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); + SOKOL_ASSERT((_sargs.num_args > 0) && (_sargs.num_args <= _sargs.max_args)); _sargs.parse_state = _SARGS_PARSING_VAL; - _sargs.args[_sargs.num_args].val = _sargs.buf_pos; + _sargs.args[_sargs.num_args - 1].val = _sargs.buf_pos; } _SOKOL_PRIVATE void _sargs_end_val(void) { - SOKOL_ASSERT(_sargs.num_args < _sargs.max_args); _sargs_putc(0); - _sargs.num_args++; _sargs.parse_state = 0; } @@ -596,7 +611,12 @@ _SOKOL_PRIVATE bool _sargs_parse_carg(const char* src) { if (_sargs_any_expected()) { if (!_sargs_is_whitespace(c)) { /* start of key, value or separator */ - if (_sargs_key_expected()) { + if (_sargs_is_separator(c)) { + /* skip separator and expect value */ + _sargs_expect_val(); + continue; + } + else if (_sargs_key_expected()) { /* start of new key */ _sargs_start_key(); } @@ -608,13 +628,6 @@ _SOKOL_PRIVATE bool _sargs_parse_carg(const char* src) { } _sargs_start_val(); } - else { - /* separator */ - if (_sargs_is_separator(c)) { - _sargs_expect_val(); - continue; - } - } } else { /* skip white space */ @@ -629,7 +642,7 @@ _SOKOL_PRIVATE bool _sargs_parse_carg(const char* src) { _sargs_expect_val(); } else { - _sargs_expect_sep(); + _sargs_expect_sep_or_key(); } continue; } @@ -657,7 +670,7 @@ _SOKOL_PRIVATE bool _sargs_parse_carg(const char* src) { } if (_sargs_parsing_key()) { _sargs_end_key(); - _sargs_expect_sep(); + _sargs_expect_sep_or_key(); } else if (_sargs_parsing_val() && !_sargs_in_quotes()) { _sargs_end_val(); @@ -823,7 +836,13 @@ SOKOL_API_IMPL const char* sargs_value_def(const char* key, const char* def) { SOKOL_ASSERT(_sargs.valid && key && def); int arg_index = sargs_find(key); if (-1 != arg_index) { - return sargs_value_at(arg_index); + const char* res = sargs_value_at(arg_index); + SOKOL_ASSERT(res); + if (res[0] == 0) { + return def; + } else { + return res; + } } else { return def; @@ -836,10 +855,15 @@ SOKOL_API_IMPL bool sargs_equals(const char* key, const char* val) { } SOKOL_API_IMPL bool sargs_boolean(const char* key) { - const char* val = sargs_value(key); - return (0 == strcmp("true", val)) || - (0 == strcmp("yes", val)) || - (0 == strcmp("on", val)); + if (sargs_exists(key)) { + const char* val = sargs_value(key); + return (0 == strcmp("true", val)) || + (0 == strcmp("yes", val)) || + (0 == strcmp("on", val)) || + (0 == strcmp("", val)); + } else { + return false; + } } #endif /* SOKOL_ARGS_IMPL */ diff --git a/tests/functional/sokol_args_test.c b/tests/functional/sokol_args_test.c index 097395f29..e2928d10d 100644 --- a/tests/functional/sokol_args_test.c +++ b/tests/functional/sokol_args_test.c @@ -252,3 +252,51 @@ UTEST(sokol_args, escape_sequence) { TSTR(sargs_value_at(2), "val2\tval3"); sargs_shutdown(); } + +static char* argv_11[] = { "exe_name", "kvp0 kvp1", "kvp2 = val2", "kvp3", "kvp4=val4" }; +UTEST(sokol_args, key_only_args) { + sargs_setup(&(sargs_desc){ + .argc = NUM_ARGS(argv_11), + .argv = argv_11, + }); + T(sargs_isvalid()); + T(sargs_num_args() == 5); + T(0 == sargs_find("kvp0")); + T(1 == sargs_find("kvp1")); + T(2 == sargs_find("kvp2")); + T(3 == sargs_find("kvp3")); + T(4 == sargs_find("kvp4")) + T(-1 == sargs_find("kvp5")); + T(-1 == sargs_find("val2")); + T(-1 == sargs_find("val4")); + T(sargs_exists("kvp0")); + T(sargs_exists("kvp1")); + T(sargs_exists("kvp2")); + T(sargs_exists("kvp3")); + T(sargs_exists("kvp4")); + T(!sargs_exists("kvp5")); + TSTR(sargs_value("kvp0"), ""); + TSTR(sargs_value("kvp1"), ""); + TSTR(sargs_value("kvp2"), "val2"); + TSTR(sargs_value("kvp3"), ""); + TSTR(sargs_value("kvp4"), "val4"); + TSTR(sargs_value("kvp5"), ""); + TSTR(sargs_value_def("kvp0", "bla0"), "bla0"); + TSTR(sargs_value_def("kvp1", "bla1"), "bla1"); + TSTR(sargs_value_def("kvp2", "bla2"), "val2"); + TSTR(sargs_value_def("kvp3", "bla3"), "bla3"); + TSTR(sargs_value_def("kvp4", "bla4"), "val4"); + TSTR(sargs_value_def("kvp5", "bla5"), "bla5"); + TSTR(sargs_key_at(0), "kvp0"); + TSTR(sargs_key_at(1), "kvp1"); + TSTR(sargs_key_at(2), "kvp2"); + TSTR(sargs_key_at(3), "kvp3"); + TSTR(sargs_key_at(4), "kvp4"); + TSTR(sargs_key_at(5), ""); + TSTR(sargs_value_at(0), ""); + TSTR(sargs_value_at(1), ""); + TSTR(sargs_value_at(2), "val2"); + TSTR(sargs_value_at(3), ""); + TSTR(sargs_value_at(4), "val4"); + TSTR(sargs_value_at(5), ""); +} From 0c1d6780707462ffefe5ba584e800d1dac6f7b61 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 17:00:20 +0200 Subject: [PATCH 195/292] update changelog (key-only args in sokol_args.h) --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb9f77c5..264efe6b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - Issue https://github.com/floooh/sokol/issues/884 has been fixed via PR https://github.com/floooh/sokol/pull/894, this adds missing error code paths in the Metal backend when Metal object creation fails. - Clarified `sapp_run()` behaviour in the sokol_app.h documentation header (search for `OPTIONAL: DON'T HIJACK main()`) +- sokol_args.h now fully supports "key-only args", see issue https://github.com/floooh/sokol/issues/876 for details, + fixed via PR https://github.com/floooh/sokol/pull/896 #### 17-Sep-2023 From a7e6ff10d9955190133b76da53208ce49ded6aea Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 17:33:28 +0200 Subject: [PATCH 196/292] changelog: fix minor typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 264efe6b4..8ae545813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ #### 18-Sep-2023 - PR https://github.com/floooh/sokol/pull/893 has been merged, this fixes a small issue - in the GL backend when using an injected texture as framebuffer texture. + in the GL backend when using an injected texture as framebuffer attachment. - Issue https://github.com/floooh/sokol/issues/884 has been fixed via PR https://github.com/floooh/sokol/pull/894, this adds missing error code paths in the Metal backend when Metal object creation fails. - Clarified `sapp_run()` behaviour in the sokol_app.h documentation header (search for `OPTIONAL: DON'T HIJACK main()`) From bf42cad7a8511908c08c93022eaef9a6b3b6b49a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 18 Sep 2023 17:33:59 +0200 Subject: [PATCH 197/292] changelog: fix another minor (literally) typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae545813..350e65d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### 18-Sep-2023 -- PR https://github.com/floooh/sokol/pull/893 has been merged, this fixes a small issue +- PR https://github.com/floooh/sokol/pull/893 has been merged, this fixes a minor issue in the GL backend when using an injected texture as framebuffer attachment. - Issue https://github.com/floooh/sokol/issues/884 has been fixed via PR https://github.com/floooh/sokol/pull/894, this adds missing error code paths in the Metal backend when Metal object creation fails. From 14d05eb2dc36c4fdee0ee3eda8e435523e797799 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 19 Sep 2023 11:53:32 +0200 Subject: [PATCH 198/292] fix readme typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8823dfb86..bf78c85bf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Set-2023** debug label support in sokol_gfx.h Metal backend) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Sep-2023** debug label support in sokol_gfx.h Metal backend) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 29b381a9abc35c06a036ef8421a782d13621ff26 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 12:03:05 -0400 Subject: [PATCH 199/292] make error message match validation logic --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 8cf25a4d9..0fbc4aee8 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3086,7 +3086,7 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to fragment stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_UB_AT_SLOT, "sg_apply_uniforms: no uniform block declaration at this shader stage UB slot") \ - _SG_LOGITEM_XMACRO(VALIDATE_AUB_SIZE, "sg_apply_uniforms: data size exceeds declared uniform block size") \ + _SG_LOGITEM_XMACRO(VALIDATE_AUB_SIZE, "sg_apply_uniforms: data size doesn't match declared uniform block size") \ _SG_LOGITEM_XMACRO(VALIDATE_UPDATEBUF_USAGE, "sg_update_buffer: cannot update immutable buffer") \ _SG_LOGITEM_XMACRO(VALIDATE_UPDATEBUF_SIZE, "sg_update_buffer: update size is bigger than buffer size") \ _SG_LOGITEM_XMACRO(VALIDATE_UPDATEBUF_ONCE, "sg_update_buffer: only one update allowed per buffer and frame") \ From 1561979793ed58de119d953a8ee481d0149ed217 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 19 Sep 2023 18:40:17 +0200 Subject: [PATCH 200/292] sokol_fetch.h: clean up cancel behaviour (fixes #882) --- sokol_fetch.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/sokol_fetch.h b/sokol_fetch.h index 21e9b5d19..50167f8a2 100644 --- a/sokol_fetch.h +++ b/sokol_fetch.h @@ -2457,6 +2457,12 @@ _SOKOL_PRIVATE void _sfetch_invoke_response_callback(_sfetch_item_t* item) { item->callback(&response); } +_SOKOL_PRIVATE void _sfetch_cancel_item(_sfetch_item_t* item) { + item->state = _SFETCH_STATE_FAILED; + item->user.finished = true; + item->user.error_code = SFETCH_ERROR_CANCELLED; +} + /* per-frame channel stuff: move requests in and out of the IO threads, call response callbacks */ _SOKOL_PRIVATE void _sfetch_channel_dowork(_sfetch_channel_t* chn, _sfetch_pool_t* pool) { @@ -2469,9 +2475,16 @@ _SOKOL_PRIVATE void _sfetch_channel_dowork(_sfetch_channel_t* chn, _sfetch_pool_ _sfetch_item_t* item = _sfetch_pool_item_lookup(pool, slot_id); SOKOL_ASSERT(item); SOKOL_ASSERT(item->state == _SFETCH_STATE_ALLOCATED); + // if the item was cancelled early, kick it out immediately + if (item->user.cancel) { + _sfetch_cancel_item(item); + _sfetch_invoke_response_callback(item); + _sfetch_pool_item_free(pool, slot_id); + continue; + } item->state = _SFETCH_STATE_DISPATCHED; item->lane = _sfetch_ring_dequeue(&chn->free_lanes); - /* if no buffer provided yet, invoke response callback to do so */ + // if no buffer provided yet, invoke response callback to do so if (0 == item->buffer.ptr) { _sfetch_invoke_response_callback(item); } @@ -2498,8 +2511,7 @@ _SOKOL_PRIVATE void _sfetch_channel_dowork(_sfetch_channel_t* chn, _sfetch_pool_ item->user.cont = false; } if (item->user.cancel) { - item->state = _SFETCH_STATE_FAILED; - item->user.finished = true; + _sfetch_cancel_item(item); } switch (item->state) { case _SFETCH_STATE_DISPATCHED: @@ -2541,7 +2553,7 @@ _SOKOL_PRIVATE void _sfetch_channel_dowork(_sfetch_channel_t* chn, _sfetch_pool_ item->user.fetched_offset = item->thread.fetched_offset; item->user.fetched_size = item->thread.fetched_size; if (item->user.cancel) { - item->user.error_code = SFETCH_ERROR_CANCELLED; + _sfetch_cancel_item(item); } else { item->user.error_code = item->thread.error_code; @@ -2558,7 +2570,7 @@ _SOKOL_PRIVATE void _sfetch_channel_dowork(_sfetch_channel_t* chn, _sfetch_pool_ } _sfetch_invoke_response_callback(item); - /* when the request is finish, free the lane for another request, + /* when the request is finished, free the lane for another request, otherwise feed it back into the incoming queue */ if (item->user.finished) { From 565ec519777a0a10259c7a768dfed728e090e36e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 19 Sep 2023 18:40:49 +0200 Subject: [PATCH 201/292] sokol_fetch_test.c: add more tests for cancelling requests --- tests/functional/sokol_fetch_test.c | 77 +++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/tests/functional/sokol_fetch_test.c b/tests/functional/sokol_fetch_test.c index 417979d57..8318a9e26 100644 --- a/tests/functional/sokol_fetch_test.c +++ b/tests/functional/sokol_fetch_test.c @@ -612,9 +612,9 @@ UTEST(sokol_fetch, load_file_chunked) { /* load N big files in small chunks interleaved on the same channel via lanes */ #define LOAD_FILE_LANES_NUM_LANES (4) -uint8_t load_file_lanes_chunk_buf[LOAD_FILE_LANES_NUM_LANES][8192]; -uint8_t load_file_lanes_content[LOAD_FILE_LANES_NUM_LANES][500000]; -int load_file_lanes_passed[LOAD_FILE_LANES_NUM_LANES]; +static uint8_t load_file_lanes_chunk_buf[LOAD_FILE_LANES_NUM_LANES][8192]; +static uint8_t load_file_lanes_content[LOAD_FILE_LANES_NUM_LANES][500000]; +static int load_file_lanes_passed[LOAD_FILE_LANES_NUM_LANES]; static void load_file_lanes_callback(const sfetch_response_t* response) { assert((response->channel == 0) && (response->lane < LOAD_FILE_LANES_NUM_LANES)); if (response->fetched) { @@ -669,9 +669,9 @@ UTEST(sokol_fetch, load_file_lanes) { #define LOAD_FILE_THROTTLE_NUM_PASSES (3) #define LOAD_FILE_THROTTLE_NUM_REQUESTS (12) // lanes * passes -uint8_t load_file_throttle_chunk_buf[LOAD_FILE_THROTTLE_NUM_LANES][128000]; -uint8_t load_file_throttle_content[LOAD_FILE_THROTTLE_NUM_PASSES][LOAD_FILE_THROTTLE_NUM_LANES][500000]; -int load_file_throttle_passed[LOAD_FILE_THROTTLE_NUM_LANES]; +static uint8_t load_file_throttle_chunk_buf[LOAD_FILE_THROTTLE_NUM_LANES][128000]; +static uint8_t load_file_throttle_content[LOAD_FILE_THROTTLE_NUM_PASSES][LOAD_FILE_THROTTLE_NUM_LANES][500000]; +static int load_file_throttle_passed[LOAD_FILE_THROTTLE_NUM_LANES]; static void load_file_throttle_callback(const sfetch_response_t* response) { assert((response->channel == 0) && (response->lane < LOAD_FILE_LANES_NUM_LANES)); @@ -733,8 +733,8 @@ UTEST(sokol_fetch, load_file_throttle) { /* test parallel fetches on multiple channels */ #define LOAD_CHANNEL_NUM_CHANNELS (16) -uint8_t load_channel_buf[LOAD_CHANNEL_NUM_CHANNELS][500000]; -bool load_channel_passed[LOAD_CHANNEL_NUM_CHANNELS]; +static uint8_t load_channel_buf[LOAD_CHANNEL_NUM_CHANNELS][500000]; +static bool load_channel_passed[LOAD_CHANNEL_NUM_CHANNELS]; void load_channel_callback(const sfetch_response_t* response) { assert(response->channel < LOAD_CHANNEL_NUM_CHANNELS); @@ -781,15 +781,13 @@ UTEST(sokol_fetch, load_channel) { sfetch_shutdown(); } -bool load_file_cancel_passed = false; -void load_file_cancel_callback(const sfetch_response_t* response) { +static bool load_file_cancel_passed = false; +static void load_file_cancel_callback(const sfetch_response_t* response) { if (response->dispatched) { sfetch_cancel(response->handle); } - if (response->failed) { - if (response->cancelled && response->finished && (response->error_code == SFETCH_ERROR_CANCELLED)) { - load_file_cancel_passed = true; - } + if (response->cancelled && response->finished && response->failed && (response->error_code == SFETCH_ERROR_CANCELLED)) { + load_file_cancel_passed = true; } } @@ -811,3 +809,54 @@ UTEST(sokol_fetch, load_file_cancel) { T(load_file_cancel_passed); sfetch_shutdown(); } + +static bool load_file_cancel_before_dispatch_passed = false; +static void load_file_cancel_before_dispatch_callback(const sfetch_response_t* response) { + // cancelled, finished, failed and error code must all be set + if (response->cancelled && response->finished && response->failed && (response->error_code == SFETCH_ERROR_CANCELLED)) { + load_file_cancel_before_dispatch_passed = true; + } +} + +UTEST(sokol_fetch, load_file_cancel_before_dispatch) { + sfetch_setup(&(sfetch_desc_t){ + .num_channels = 1, + }); + sfetch_handle_t h = sfetch_send(&(sfetch_request_t){ + .path = "comsi.s3m", + .callback = load_file_cancel_before_dispatch_callback, + }); + sfetch_cancel(h); + sfetch_dowork(); + T(load_file_cancel_before_dispatch_passed); + sfetch_shutdown(); +} + +static bool load_file_cancel_after_dispatch_passed = false; +static void load_file_cancel_after_dispatch_callback(const sfetch_response_t* response) { + // when cancelled, then finished, failed and error code must all be set + if (response->cancelled && response->finished && response->failed && (response->error_code == SFETCH_ERROR_CANCELLED)) { + load_file_cancel_after_dispatch_passed = true; + } +} + +UTEST(sokol_fetch, load_file_cancel_after_dispatch) { + sfetch_setup(&(sfetch_desc_t){ + .num_channels = 1, + }); + sfetch_handle_t h = sfetch_send(&(sfetch_request_t){ + .path = "comsi.s3m", + .callback = load_file_cancel_after_dispatch_callback, + .buffer = SFETCH_RANGE(load_file_buf), + }); + int frame_count = 0; + const int max_frames = 10000; + while (sfetch_handle_valid(h) && (frame_count++ < max_frames)) { + sfetch_dowork(); + sfetch_cancel(h); + sleep_ms(1); + } + T(frame_count < max_frames); + T(load_file_cancel_after_dispatch_passed); + sfetch_shutdown(); +} From 9d4a9e98dac5e003d4943f41e09e55973664c001 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 19 Sep 2023 18:54:26 +0200 Subject: [PATCH 202/292] sokol_gfx.h: fix an outdated comment in _sg_validate_apply_uniforms() --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0fbc4aee8..4eec242dd 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -15370,7 +15370,7 @@ _SOKOL_PRIVATE bool _sg_validate_apply_uniforms(sg_shader_stage stage_index, int const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[stage_index]; _SG_VALIDATE(ub_index < stage->num_uniform_blocks, VALIDATE_AUB_NO_UB_AT_SLOT); - // check that the provided data size doesn't exceed the uniform block size + // check that the provided data size matches the uniform block size _SG_VALIDATE(data->size == stage->uniform_blocks[ub_index].size, VALIDATE_AUB_SIZE); return _sg_validate_end(); From f3858d262c160f3672572437a6b2e1ab1c0a1d07 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 19 Sep 2023 18:59:58 +0200 Subject: [PATCH 203/292] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 350e65d35..e581eed89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Updates +#### 19-Sep-2023 + +- sokol_fetch.h: fixed a minor issue where a request that was cancelled before it was dispatched + had an incomplete response state set in the response callback (the `finished`, `failed` and + `error_code` fields were not set). This fixes issue https://github.com/floooh/sokol/issues/882 + via PR https://github.com/floooh/sokol/pull/898 + #### 18-Sep-2023 - PR https://github.com/floooh/sokol/pull/893 has been merged, this fixes a minor issue From 0670030cd09345f06e08177b31e98547a3cfc227 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 15:00:17 -0400 Subject: [PATCH 204/292] add callbacks for default gl framebuffer. fixes #892 --- sokol_gfx.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 4eec242dd..b6dbc84c3 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3245,6 +3245,12 @@ typedef struct sg_wgpu_context_desc { void* user_data; } sg_wgpu_context_desc; +typedef struct sg_gl_context_desc { + GLuint (*default_framebuffer_cb)(void); + GLuint (*default_framebuffer_userdata_cb)(void*); + void* user_data; +} sg_gl_context_desc; + typedef struct sg_context_desc { sg_pixel_format color_format; sg_pixel_format depth_format; @@ -3252,6 +3258,7 @@ typedef struct sg_context_desc { sg_metal_context_desc metal; sg_d3d11_context_desc d3d11; sg_wgpu_context_desc wgpu; + sg_gl_context_desc gl; } sg_context_desc; /* @@ -7036,7 +7043,8 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { } _SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) { - _SOKOL_UNUSED(desc); + SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == NULL || desc->context.gl.default_framebuffer_userdata_cb == NULL); + // assumes that _sg.gl is already zero-initialized _sg.gl.valid = true; @@ -7725,6 +7733,12 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(_sg_pass_t* pass, const sg_pass_action* ac #if defined(SOKOL_GLCORE33) glDisable(GL_FRAMEBUFFER_SRGB); #endif + if (_sg.desc.context.gl.default_framebuffer_userdata_cb) { + _sg.gl.cur_context->default_framebuffer = _sg.desc.context.gl.default_framebuffer_userdata_cb(_sg.desc.context.gl.user_data); + } else if (_sg.desc.context.gl.default_framebuffer_cb) { + _sg.gl.cur_context->default_framebuffer = _sg.desc.context.gl.default_framebuffer_cb(); + } + glBindFramebuffer(GL_FRAMEBUFFER, _sg.gl.cur_context->default_framebuffer); } glViewport(0, 0, w, h); From 583e9b94c97d4b79fb8351d694a7fae97d17061b Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 15:10:16 -0400 Subject: [PATCH 205/292] fix type errors --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b6dbc84c3..3fae67cff 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3246,8 +3246,8 @@ typedef struct sg_wgpu_context_desc { } sg_wgpu_context_desc; typedef struct sg_gl_context_desc { - GLuint (*default_framebuffer_cb)(void); - GLuint (*default_framebuffer_userdata_cb)(void*); + unsigned int (*default_framebuffer_cb)(void); + unsigned int (*default_framebuffer_userdata_cb)(void*); void* user_data; } sg_gl_context_desc; From c3c04f16d979b2d60f52f3b7b20450f51e747c69 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 15:14:34 -0400 Subject: [PATCH 206/292] fix unused parameter warning. --- sokol_gfx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3fae67cff..ff4ce669a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7043,6 +7043,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { } _SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) { + _SOKOL_UNUSED(desc); SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == NULL || desc->context.gl.default_framebuffer_userdata_cb == NULL); // assumes that _sg.gl is already zero-initialized From 6d939a0f2ed12c2c991bb83871e81aab55bdf1bf Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 15:24:45 -0400 Subject: [PATCH 207/292] try to appease the odin bindings generator. --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index ff4ce669a..097755940 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3246,8 +3246,8 @@ typedef struct sg_wgpu_context_desc { } sg_wgpu_context_desc; typedef struct sg_gl_context_desc { - unsigned int (*default_framebuffer_cb)(void); - unsigned int (*default_framebuffer_userdata_cb)(void*); + uint32_t (*default_framebuffer_cb)(void); + uint32_t (*default_framebuffer_userdata_cb)(void*); void* user_data; } sg_gl_context_desc; From d26015535a3ddc958709097bf41497535ae063cc Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 19:57:38 -0400 Subject: [PATCH 208/292] replace NULL with 0 --- sokol_gfx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 097755940..a1d3758b4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -7044,7 +7044,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { _SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) { _SOKOL_UNUSED(desc); - SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == NULL || desc->context.gl.default_framebuffer_userdata_cb == NULL); + SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == 0 || desc->context.gl.default_framebuffer_userdata_cb == 0); // assumes that _sg.gl is already zero-initialized _sg.gl.valid = true; From cac5fa5ee440ec7f5b7c8420ea2831439ae1281e Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 19:59:01 -0400 Subject: [PATCH 209/292] add support to gen_zig.py for function pointers that return primitive types --- bindgen/gen_zig.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py index b1631ebc2..cef75e9eb 100644 --- a/bindgen/gen_zig.py +++ b/bindgen/gen_zig.py @@ -271,6 +271,8 @@ def funcptr_result_c(field_type): res_type = field_type[:field_type.index('(*)')].strip() if res_type == 'void': return 'void' + elif is_prim_type(res_type): + return as_zig_prim_type(res_type) elif util.is_const_void_ptr(res_type): return '?*const anyopaque' elif util.is_void_ptr(res_type): From 2ead539d32a7b507ebcf3848598a97b5de114088 Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Tue, 19 Sep 2023 20:17:41 -0400 Subject: [PATCH 210/292] add support to gen_rust.py for function pointers that return a primitive type --- bindgen/gen_rust.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindgen/gen_rust.py b/bindgen/gen_rust.py index 5578d0838..2a7a7ebb2 100644 --- a/bindgen/gen_rust.py +++ b/bindgen/gen_rust.py @@ -355,6 +355,8 @@ def funcptr_result_c(field_type): res_type = field_type[: field_type.index("(*)")].strip() if res_type == "void": return "" + elif is_prim_type(res_type): + return as_rust_prim_type(res_type) elif util.is_const_void_ptr(res_type): return " -> *const core::ffi::c_void" elif util.is_void_ptr(res_type): From 7277c7f44f03c96dee74f288d0320e89b10d48e0 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 22 Sep 2023 19:26:44 +0200 Subject: [PATCH 211/292] sokol_gfx.h metal: fix Intel Mac compilation and validation layer problems. (#907) Fixes #905 --- CHANGELOG.md | 7 +++++++ sokol_gfx.h | 32 ++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e581eed89..ddf871d79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Updates +#### 22-Sep-2023 + +- sokol_gfx.h: Fixed a Metal validation error on Intel Macs when creating textures (Intel Macs + have unified memory, but don't support textures in shared storage mode). This was a regression + in the image/sampler split update in mid-July 2023. Fixes issue https://github.com/floooh/sokol/issues/905 + via PR https://github.com/floooh/sokol/pull/907. + #### 19-Sep-2023 - sokol_fetch.h: fixed a minor issue where a request that was cancelled before it was dispatched diff --git a/sokol_gfx.h b/sokol_gfx.h index 4eec242dd..1f0d6f6d4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4769,8 +4769,7 @@ typedef struct { typedef struct { bool valid; - bool has_unified_memory; - bool force_managed_storage_mode; + bool use_shared_storage_mode; const void*(*renderpass_descriptor_cb)(void); const void*(*renderpass_descriptor_userdata_cb)(void*); const void*(*drawable_cb)(void); @@ -10272,12 +10271,13 @@ _SOKOL_PRIVATE MTLStoreAction _sg_mtl_store_action(sg_store_action a, bool resol _SOKOL_PRIVATE MTLResourceOptions _sg_mtl_resource_options_storage_mode_managed_or_shared(void) { #if defined(_SG_TARGET_MACOS) - if (_sg.mtl.force_managed_storage_mode || !_sg.mtl.has_unified_memory) { - return MTLResourceStorageModeManaged; - } else { + if (_sg.mtl.use_shared_storage_mode) { return MTLResourceStorageModeShared; + } else { + return MTLResourceStorageModeManaged; } #else + // MTLResourceStorageModeManaged is not even defined on iOS SDK return MTLResourceStorageModeShared; #endif } @@ -10739,16 +10739,20 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { _sg.features.mrt_independent_write_mask = true; _sg.features.image_clamp_to_border = false; + #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 120000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) if (@available(macOS 12.0, iOS 14.0, *)) { _sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyApple7] || [_sg.mtl.device supportsFamily:MTLGPUFamilyApple8] || [_sg.mtl.device supportsFamily:MTLGPUFamilyMac2]; + #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 160000) if (!_sg.features.image_clamp_to_border) { if (@available(macOS 13.0, iOS 16.0, *)) { _sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyMetal3]; } } + #endif } + #endif #if defined(_SG_TARGET_MACOS) _sg.limits.max_image_size_2d = 16 * 1024; @@ -10900,16 +10904,24 @@ _SOKOL_PRIVATE void _sg_mtl_setup_backend(const sg_desc* desc) { #endif } - if (@available(macOS 10.15, iOS 13.0, *)) { - _sg.mtl.has_unified_memory = _sg.mtl.device.hasUnifiedMemory; + if (desc->mtl_force_managed_storage_mode) { + _sg.mtl.use_shared_storage_mode = false; + } else if (@available(macOS 10.15, iOS 13.0, *)) { + // on Intel Macs, always use managed resources even though the + // device says it supports unified memory (because of texture restrictions) + const bool is_apple_gpu = [_sg.mtl.device supportsFamily:MTLGPUFamilyApple1]; + if (!is_apple_gpu) { + _sg.mtl.use_shared_storage_mode = false; + } else { + _sg.mtl.use_shared_storage_mode = true; + } } else { #if defined(_SG_TARGET_MACOS) - _sg.mtl.has_unified_memory = false; + _sg.mtl.use_shared_storage_mode = false; #else - _sg.mtl.has_unified_memory = true; + _sg.mtl.use_shared_storage_mode = true; #endif } - _sg.mtl.force_managed_storage_mode = desc->mtl_force_managed_storage_mode; _sg_mtl_init_caps(); } From fe76ca5810355c22fc7059d675d2de570f122329 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 23 Sep 2023 19:25:13 +0200 Subject: [PATCH 212/292] update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddf871d79..d15e89778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## Updates +#### 23-Sep-2023 + +- sokol_gfx.h gl: Allow to inject an external GL framebuffer id into the sokol-gfx default + pass. See PR https://github.com/floooh/sokol/pull/899 and issue https://github.com/floooh/sokol/issues/892 + for details. Many thanks to @danielchasehooper for the discussion and PR! + + Further down the road I want to make the whole topic more flexible while at the same time + simplifying the sokol-gfx API, see here: https://github.com/floooh/sokol/issues/904 + #### 22-Sep-2023 - sokol_gfx.h: Fixed a Metal validation error on Intel Macs when creating textures (Intel Macs From 56cb4a4e1549e3f00df8a018bfaadd0bf3bf8767 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 23 Sep 2023 19:59:10 +0200 Subject: [PATCH 213/292] fix rust bindings generation --- bindgen/gen_rust.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindgen/gen_rust.py b/bindgen/gen_rust.py index 2a7a7ebb2..0b6384c45 100644 --- a/bindgen/gen_rust.py +++ b/bindgen/gen_rust.py @@ -356,7 +356,7 @@ def funcptr_result_c(field_type): if res_type == "void": return "" elif is_prim_type(res_type): - return as_rust_prim_type(res_type) + return f" -> {as_rust_prim_type(res_type)}" elif util.is_const_void_ptr(res_type): return " -> *const core::ffi::c_void" elif util.is_void_ptr(res_type): From 0bc47658c816e9b9fd556fc074787ca613a97979 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 23 Sep 2023 20:10:06 +0200 Subject: [PATCH 214/292] gh actions: fix the artifact download path for the test-rust step (facepalm) --- .github/workflows/gen_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 57e7d2718..5d39900f6 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -227,7 +227,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: ignore-me-rust - path: src/sokol + path: src - uses: dtolnay/rust-toolchain@master with: toolchain: stable From 754d32619fef272efeeaaa5ba629b68ba9f3c74e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 25 Sep 2023 16:30:57 +0200 Subject: [PATCH 215/292] rename custom allocator callbacks to alloc_fn/free_fn --- CHANGELOG.md | 10 ++++++++++ README.md | 2 +- sokol_app.h | 23 +++++++++++------------ sokol_args.h | 24 +++++++++++------------- sokol_audio.h | 26 ++++++++++++-------------- sokol_fetch.h | 24 +++++++++++------------- sokol_gfx.h | 26 +++++++++++++------------- util/sokol_debugtext.h | 20 ++++++++++---------- util/sokol_fontstash.h | 20 ++++++++++---------- util/sokol_gfx_imgui.h | 22 +++++++++++----------- util/sokol_gl.h | 18 +++++++++--------- util/sokol_imgui.h | 20 ++++++++++---------- util/sokol_memtrack.h | 4 ++-- util/sokol_nuklear.h | 18 +++++++++--------- util/sokol_spine.h | 22 +++++++++++----------- 15 files changed, 141 insertions(+), 138 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d15e89778..e130b0aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## Updates +#### 25-Sep-2023 + +- The allocator callback functions in all headers that support custom allocators have been renamed + from `alloc` and `free` to `alloc_fn` and `free_fn`, this is because the symbol `free` is quite + likely to collide with a preprocessor macro of the same name if the standard C allocator is + replaced with a custom allocator. + + This is a breaking change only if you've been providing your own allocator functions to + the sokol headers. + #### 23-Sep-2023 - sokol_gfx.h gl: Allow to inject an external GL framebuffer id into the sokol-gfx default diff --git a/README.md b/README.md index bf78c85bf..8349a6d80 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**17-Sep-2023** debug label support in sokol_gfx.h Metal backend) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**25-Sep-2023** POTENTIALLY BREAKING: allocator callbacks have been renamed) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) diff --git a/sokol_app.h b/sokol_app.h index f3b68ebcf..4d1f2b6b3 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1039,8 +1039,8 @@ return (sapp_desc){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }; @@ -1493,12 +1493,12 @@ typedef struct sapp_icon_desc { Used in sapp_desc to provide custom memory-alloc and -free functions to sokol_app.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fb and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sapp_allocator { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sapp_allocator; @@ -2862,10 +2862,9 @@ _SOKOL_PRIVATE void _sapp_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _sapp_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sapp.desc.allocator.alloc) { - ptr = _sapp.desc.allocator.alloc(size, _sapp.desc.allocator.user_data); - } - else { + if (_sapp.desc.allocator.alloc_fn) { + ptr = _sapp.desc.allocator.alloc_fn(size, _sapp.desc.allocator.user_data); + } else { ptr = malloc(size); } if (0 == ptr) { @@ -2881,8 +2880,8 @@ _SOKOL_PRIVATE void* _sapp_malloc_clear(size_t size) { } _SOKOL_PRIVATE void _sapp_free(void* ptr) { - if (_sapp.desc.allocator.free) { - _sapp.desc.allocator.free(ptr, _sapp.desc.allocator.user_data); + if (_sapp.desc.allocator.free_fn) { + _sapp.desc.allocator.free_fn(ptr, _sapp.desc.allocator.user_data); } else { free(ptr); @@ -2986,7 +2985,7 @@ _SOKOL_PRIVATE bool _sapp_strcpy(const char* src, char* dst, int max_len) { } _SOKOL_PRIVATE sapp_desc _sapp_desc_defaults(const sapp_desc* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sapp_desc res = *desc; res.sample_count = _sapp_def(res.sample_count, 1); res.swap_interval = _sapp_def(res.swap_interval, 1); diff --git a/sokol_args.h b/sokol_args.h index d33ba3a0d..bce6bbad7 100644 --- a/sokol_args.h +++ b/sokol_args.h @@ -247,8 +247,8 @@ sargs_setup(&(sargs_desc){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }); @@ -316,12 +316,12 @@ extern "C" { Used in sargs_desc to provide custom memory-alloc and -free functions to sokol_args.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sargs_allocator { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sargs_allocator; @@ -447,10 +447,9 @@ _SOKOL_PRIVATE void _sargs_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _sargs_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sargs.allocator.alloc) { - ptr = _sargs.allocator.alloc(size, _sargs.allocator.user_data); - } - else { + if (_sargs.allocator.alloc_fn) { + ptr = _sargs.allocator.alloc_fn(size, _sargs.allocator.user_data); + } else { ptr = malloc(size); } SOKOL_ASSERT(ptr); @@ -464,10 +463,9 @@ _SOKOL_PRIVATE void* _sargs_malloc_clear(size_t size) { } _SOKOL_PRIVATE void _sargs_free(void* ptr) { - if (_sargs.allocator.free) { - _sargs.allocator.free(ptr, _sargs.allocator.user_data); - } - else { + if (_sargs.allocator.free_fn) { + _sargs.allocator.free_fn(ptr, _sargs.allocator.user_data); + } else { free(ptr); } } diff --git a/sokol_audio.h b/sokol_audio.h index bdd69530b..6b60937cb 100644 --- a/sokol_audio.h +++ b/sokol_audio.h @@ -397,8 +397,8 @@ saudio_setup(&(saudio_desc){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }); @@ -575,12 +575,12 @@ typedef struct saudio_logger { Used in saudio_desc to provide custom memory-alloc and -free functions to sokol_audio.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct saudio_allocator { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } saudio_allocator; @@ -1146,10 +1146,9 @@ _SOKOL_PRIVATE void _saudio_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _saudio_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_saudio.desc.allocator.alloc) { - ptr = _saudio.desc.allocator.alloc(size, _saudio.desc.allocator.user_data); - } - else { + if (_saudio.desc.allocator.alloc_fn) { + ptr = _saudio.desc.allocator.alloc_fn(size, _saudio.desc.allocator.user_data); + } else { ptr = malloc(size); } if (0 == ptr) { @@ -1165,10 +1164,9 @@ _SOKOL_PRIVATE void* _saudio_malloc_clear(size_t size) { } _SOKOL_PRIVATE void _saudio_free(void* ptr) { - if (_saudio.desc.allocator.free) { - _saudio.desc.allocator.free(ptr, _saudio.desc.allocator.user_data); - } - else { + if (_saudio.desc.allocator.free_fn) { + _saudio.desc.allocator.free_fn(ptr, _saudio.desc.allocator.user_data); + } else { free(ptr); } } @@ -2485,7 +2483,7 @@ void _saudio_backend_shutdown(void) { SOKOL_API_IMPL void saudio_setup(const saudio_desc* desc) { SOKOL_ASSERT(!_saudio.valid); SOKOL_ASSERT(desc); - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); _saudio_clear(&_saudio, sizeof(_saudio)); _saudio.desc = *desc; _saudio.stream_cb = desc->stream_cb; diff --git a/sokol_fetch.h b/sokol_fetch.h index 50167f8a2..510c5b5b2 100644 --- a/sokol_fetch.h +++ b/sokol_fetch.h @@ -820,8 +820,8 @@ sfetch_setup(&(sfetch_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }); @@ -1024,8 +1024,8 @@ typedef struct sfetch_range_t { override one function but not the other). */ typedef struct sfetch_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sfetch_allocator_t; @@ -1424,10 +1424,9 @@ _SOKOL_PRIVATE void _sfetch_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _sfetch_malloc_with_allocator(const sfetch_allocator_t* allocator, size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (allocator->alloc) { - ptr = allocator->alloc(size, allocator->user_data); - } - else { + if (allocator->alloc_fn) { + ptr = allocator->alloc_fn(size, allocator->user_data); + } else { ptr = malloc(size); } if (0 == ptr) { @@ -1447,10 +1446,9 @@ _SOKOL_PRIVATE void* _sfetch_malloc_clear(size_t size) { } _SOKOL_PRIVATE void _sfetch_free(void* ptr) { - if (_sfetch->desc.allocator.free) { - _sfetch->desc.allocator.free(ptr, _sfetch->desc.allocator.user_data); - } - else { + if (_sfetch->desc.allocator.free_fn) { + _sfetch->desc.allocator.free_fn(ptr, _sfetch->desc.allocator.user_data); + } else { free(ptr); } } @@ -2620,7 +2618,7 @@ _SOKOL_PRIVATE bool _sfetch_validate_request(_sfetch_t* ctx, const sfetch_reques } _SOKOL_PRIVATE sfetch_desc_t _sfetch_desc_defaults(const sfetch_desc_t* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sfetch_desc_t res = *desc; res.max_requests = _sfetch_def(desc->max_requests, 128); res.num_channels = _sfetch_def(desc->num_channels, 1); diff --git a/sokol_gfx.h b/sokol_gfx.h index 729754de7..063c70c91 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -939,8 +939,8 @@ sg_setup(&(sg_desc){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }); @@ -3131,8 +3131,8 @@ typedef enum sg_log_item { .max_commit_listeners 1024 .disable_validation false - .allocator.alloc 0 (in this case, malloc() will be called) - .allocator.free 0 (in this case, free() will be called) + .allocator.alloc_fn 0 (in this case, malloc() will be called) + .allocator.free_fn 0 (in this case, free() will be called) .allocator.user_data 0 .context.color_format: default value depends on selected backend: @@ -3280,12 +3280,12 @@ typedef struct sg_commit_listener { Used in sg_desc to provide custom memory-alloc and -free functions to sokol_gfx.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sg_allocator { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sg_allocator; @@ -5067,8 +5067,8 @@ _SOKOL_PRIVATE void _sg_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _sg_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sg.desc.allocator.alloc) { - ptr = _sg.desc.allocator.alloc(size, _sg.desc.allocator.user_data); + if (_sg.desc.allocator.alloc_fn) { + ptr = _sg.desc.allocator.alloc_fn(size, _sg.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -5085,8 +5085,8 @@ _SOKOL_PRIVATE void* _sg_malloc_clear(size_t size) { } _SOKOL_PRIVATE void _sg_free(void* ptr) { - if (_sg.desc.allocator.free) { - _sg.desc.allocator.free(ptr, _sg.desc.allocator.user_data); + if (_sg.desc.allocator.free_fn) { + _sg.desc.allocator.free_fn(ptr, _sg.desc.allocator.user_data); } else { free(ptr); } @@ -7044,7 +7044,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { _SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) { _SOKOL_UNUSED(desc); SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == 0 || desc->context.gl.default_framebuffer_userdata_cb == 0); - + // assumes that _sg.gl is already zero-initialized _sg.gl.valid = true; @@ -16059,7 +16059,7 @@ _SOKOL_PRIVATE sg_desc _sg_desc_defaults(const sg_desc* desc) { SOKOL_API_IMPL void sg_setup(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT((desc->_start_canary == 0) && (desc->_end_canary == 0)); - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); _SG_CLEAR_ARC_STRUCT(_sg_state_t, _sg); _sg.desc = _sg_desc_defaults(desc); _sg_setup_pools(&_sg.pools, &_sg.desc); diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index 4d4ee6e1f..104be7eff 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -427,8 +427,8 @@ sdtx_setup(&(sdtx_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -658,12 +658,12 @@ typedef struct sdtx_context_desc_t { Used in sdtx_desc_t to provide custom memory-alloc and -free functions to sokol_debugtext.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sdtx_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sdtx_allocator_t; @@ -3660,8 +3660,8 @@ static void _sdtx_clear(void* ptr, size_t size) { static void* _sdtx_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sdtx.desc.allocator.alloc) { - ptr = _sdtx.desc.allocator.alloc(size, _sdtx.desc.allocator.user_data); + if (_sdtx.desc.allocator.alloc_fn) { + ptr = _sdtx.desc.allocator.alloc_fn(size, _sdtx.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -3678,8 +3678,8 @@ static void* _sdtx_malloc_clear(size_t size) { } static void _sdtx_free(void* ptr) { - if (_sdtx.desc.allocator.free) { - _sdtx.desc.allocator.free(ptr, _sdtx.desc.allocator.user_data); + if (_sdtx.desc.allocator.free_fn) { + _sdtx.desc.allocator.free_fn(ptr, _sdtx.desc.allocator.user_data); } else { free(ptr); } @@ -4259,7 +4259,7 @@ SOKOL_API_IMPL void _sdtx_draw_layer(_sdtx_context_t* ctx, int layer_id) { static sdtx_desc_t _sdtx_desc_defaults(const sdtx_desc_t* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sdtx_desc_t res = *desc; res.context_pool_size = _sdtx_def(res.context_pool_size, _SDTX_DEFAULT_CONTEXT_POOL_SIZE); res.printf_buf_size = _sdtx_def(res.printf_buf_size, _SDTX_DEFAULT_PRINTF_BUF_SIZE); diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index 9719e3802..fe2944ba8 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -147,8 +147,8 @@ FONScontext* fons_context = sfons_create(&(sfons_desc_t){ ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., } }); @@ -213,15 +213,15 @@ extern "C" { Used in sfons_desc_t to provide custom memory-alloc and -free functions to sokol_fontstash.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). NOTE that this does not affect memory allocation calls inside fontstash.h */ typedef struct sfons_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sfons_allocator_t; @@ -1610,8 +1610,8 @@ static void _sfons_clear(void* ptr, size_t size) { static void* _sfons_malloc(const sfons_allocator_t* allocator, size_t size) { SOKOL_ASSERT(allocator && (size > 0)); void* ptr; - if (allocator->alloc) { - ptr = allocator->alloc(size, allocator->user_data); + if (allocator->alloc_fn) { + ptr = allocator->alloc_fn(size, allocator->user_data); } else { ptr = malloc(size); } @@ -1627,8 +1627,8 @@ static void* _sfons_malloc_clear(const sfons_allocator_t* allocator, size_t size static void _sfons_free(const sfons_allocator_t* allocator, void* ptr) { SOKOL_ASSERT(allocator); - if (allocator->free) { - allocator->free(ptr, allocator->user_data); + if (allocator->free_fn) { + allocator->free_fn(ptr, allocator->user_data); } else { free(ptr); } @@ -1809,7 +1809,7 @@ static sfons_desc_t _sfons_desc_defaults(const sfons_desc_t* desc) { SOKOL_API_IMPL FONScontext* sfons_create(const sfons_desc_t* desc) { SOKOL_ASSERT(desc); - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); _sfons_t* sfons = (_sfons_t*) _sfons_malloc_clear(&desc->allocator, sizeof(_sfons_t)); sfons->desc = _sfons_desc_defaults(desc); FONSparams params; diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index f9106f1bb..82c62c680 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -73,8 +73,8 @@ sg_imgui_init(&sg_imgui, &(sg_imgui_desc_t){ .allocator = { - .alloc = my_malloc, - .free = my_free, + .alloc_fn = my_malloc, + .free_fn = my_free, } }); @@ -169,8 +169,8 @@ sg_imgui_init(&(&ctx, &(sg_imgui_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -718,8 +718,8 @@ typedef struct sg_imgui_caps_t { override one function but not the other). */ typedef struct sg_imgui_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sg_imgui_allocator_t; @@ -914,8 +914,8 @@ _SOKOL_PRIVATE void _sg_imgui_clear(void* ptr, size_t size) { _SOKOL_PRIVATE void* _sg_imgui_malloc(const sg_imgui_allocator_t* allocator, size_t size) { SOKOL_ASSERT(allocator && (size > 0)); void* ptr; - if (allocator->alloc) { - ptr = allocator->alloc(size, allocator->user_data); + if (allocator->alloc_fn) { + ptr = allocator->alloc_fn(size, allocator->user_data); } else { ptr = malloc(size); } @@ -931,8 +931,8 @@ _SOKOL_PRIVATE void* _sg_imgui_malloc_clear(const sg_imgui_allocator_t* allocato _SOKOL_PRIVATE void _sg_imgui_free(const sg_imgui_allocator_t* allocator, void* ptr) { SOKOL_ASSERT(allocator); - if (allocator->free) { - allocator->free(ptr, allocator->user_data); + if (allocator->free_fn) { + allocator->free_fn(ptr, allocator->user_data); } else { free(ptr); } @@ -4145,7 +4145,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_caps_panel(void) { #define _sg_imgui_def(val, def) (((val) == 0) ? (def) : (val)) _SOKOL_PRIVATE sg_imgui_desc_t _sg_imgui_desc_defaults(const sg_imgui_desc_t* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sg_imgui_desc_t res = *desc; // FIXME: any additional default overrides would go here return res; diff --git a/util/sokol_gl.h b/util/sokol_gl.h index f17da4788..1bc4e1c09 100644 --- a/util/sokol_gl.h +++ b/util/sokol_gl.h @@ -606,8 +606,8 @@ sgl_setup(&(sgl_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -796,8 +796,8 @@ typedef struct sgl_context_desc_t { override one function but not the other). */ typedef struct sgl_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sgl_allocator_t; @@ -2503,8 +2503,8 @@ static void _sgl_clear(void* ptr, size_t size) { static void* _sgl_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sgl.desc.allocator.alloc) { - ptr = _sgl.desc.allocator.alloc(size, _sgl.desc.allocator.user_data); + if (_sgl.desc.allocator.alloc_fn) { + ptr = _sgl.desc.allocator.alloc_fn(size, _sgl.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -2521,8 +2521,8 @@ static void* _sgl_malloc_clear(size_t size) { } static void _sgl_free(void* ptr) { - if (_sgl.desc.allocator.free) { - _sgl.desc.allocator.free(ptr, _sgl.desc.allocator.user_data); + if (_sgl.desc.allocator.free_fn) { + _sgl.desc.allocator.free_fn(ptr, _sgl.desc.allocator.user_data); } else { free(ptr); } @@ -3283,7 +3283,7 @@ static _sgl_matrix_t* _sgl_matrix(_sgl_context_t* ctx) { // return sg_context_desc_t with patched defaults static sgl_desc_t _sgl_desc_defaults(const sgl_desc_t* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sgl_desc_t res = *desc; res.max_vertices = _sgl_def(desc->max_vertices, _SGL_DEFAULT_MAX_VERTICES); res.max_commands = _sgl_def(desc->max_commands, _SGL_DEFAULT_MAX_COMMANDS); diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 2d4cd9454..f34736b6e 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -288,8 +288,8 @@ simgui_setup(&(simgui_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -467,12 +467,12 @@ typedef enum simgui_log_item_t { Used in simgui_desc_t to provide custom memory-alloc and -free functions to sokol_imgui.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct simgui_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } simgui_allocator_t; @@ -1965,8 +1965,8 @@ static void _simgui_clear(void* ptr, size_t size) { static void* _simgui_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_simgui.desc.allocator.alloc) { - ptr = _simgui.desc.allocator.alloc(size, _simgui.desc.allocator.user_data); + if (_simgui.desc.allocator.alloc_fn) { + ptr = _simgui.desc.allocator.alloc_fn(size, _simgui.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -1983,8 +1983,8 @@ static void* _simgui_malloc_clear(size_t size) { } static void _simgui_free(void* ptr) { - if (_simgui.desc.allocator.free) { - _simgui.desc.allocator.free(ptr, _simgui.desc.allocator.user_data); + if (_simgui.desc.allocator.free_fn) { + _simgui.desc.allocator.free_fn(ptr, _simgui.desc.allocator.user_data); } else { free(ptr); } @@ -2197,7 +2197,7 @@ static bool _simgui_is_osx(void) { } static simgui_desc_t _simgui_desc_defaults(const simgui_desc_t* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); simgui_desc_t res = *desc; res.max_vertices = _simgui_def(res.max_vertices, 65536); res.image_pool_size = _simgui_def(res.image_pool_size, 256); diff --git a/util/sokol_memtrack.h b/util/sokol_memtrack.h index dc0b469f7..47f70fcae 100644 --- a/util/sokol_memtrack.h +++ b/util/sokol_memtrack.h @@ -27,8 +27,8 @@ sg_setup(&(sg_desc){ //... .allocator = { - .alloc = smemtrack_alloc, - .free = smemtrack_free, + .alloc_fn = smemtrack_alloc, + .free_fn = smemtrack_free, } }); diff --git a/util/sokol_nuklear.h b/util/sokol_nuklear.h index ae4e9ae09..21ff55dd5 100644 --- a/util/sokol_nuklear.h +++ b/util/sokol_nuklear.h @@ -223,8 +223,8 @@ snk_setup(&(snk_desc_t){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -383,12 +383,12 @@ typedef enum snk_log_item_t { Used in snk_desc_t to provide custom memory-alloc and -free functions to sokol_nuklear.h. If memory management should be overridden, both the - alloc and free function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct snk_allocator_t { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } snk_allocator_t; @@ -1891,8 +1891,8 @@ static void _snk_clear(void* ptr, size_t size) { static void* _snk_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_snuklear.desc.allocator.alloc) { - ptr = _snuklear.desc.allocator.alloc(size, _snuklear.desc.allocator.user_data); + if (_snuklear.desc.allocator.alloc_fn) { + ptr = _snuklear.desc.allocator.alloc_fn(size, _snuklear.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -1909,8 +1909,8 @@ static void* _snk_malloc_clear(size_t size) { } static void _snk_free(void* ptr) { - if (_snuklear.desc.allocator.free) { - _snuklear.desc.allocator.free(ptr, _snuklear.desc.allocator.user_data); + if (_snuklear.desc.allocator.free_fn) { + _snuklear.desc.allocator.free_fn(ptr, _snuklear.desc.allocator.user_data); } else { free(ptr); } diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 5a9125aea..e09afbed7 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -202,8 +202,8 @@ sspine_setup(&(sspine_desc){ .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ..., }, .logger = { @@ -908,8 +908,8 @@ sspine_setup(&(sspine_desc){ // ... .allocator = { - .alloc = my_alloc, - .free = my_free, + .alloc_fn = my_alloc, + .free_fn = my_free, .user_data = ...; } }); @@ -1198,8 +1198,8 @@ typedef struct sspine_instance_desc { } sspine_instance_desc; typedef struct sspine_allocator { - void* (*alloc)(size_t size, void* user_data); - void (*free)(void* ptr, void* user_data); + void* (*alloc_fn)(size_t size, void* user_data); + void (*free_fn)(void* ptr, void* user_data); void* user_data; } sspine_allocator; @@ -2893,8 +2893,8 @@ static sspine_string _sspine_string(const char* cstr) { static void* _sspine_malloc(size_t size) { SOKOL_ASSERT(size > 0); void* ptr; - if (_sspine.desc.allocator.alloc) { - ptr = _sspine.desc.allocator.alloc(size, _sspine.desc.allocator.user_data); + if (_sspine.desc.allocator.alloc_fn) { + ptr = _sspine.desc.allocator.alloc_fn(size, _sspine.desc.allocator.user_data); } else { ptr = malloc(size); } @@ -2911,8 +2911,8 @@ static void* _sspine_malloc_clear(size_t size) { } static void _sspine_free(void* ptr) { - if (_sspine.desc.allocator.free) { - _sspine.desc.allocator.free(ptr, _sspine.desc.allocator.user_data); + if (_sspine.desc.allocator.free_fn) { + _sspine.desc.allocator.free_fn(ptr, _sspine.desc.allocator.user_data); } else { free(ptr); } @@ -4392,7 +4392,7 @@ static void _sspine_draw_layer(_sspine_context_t* ctx, int layer, const sspine_l // return sspine_desc with patched defaults static sspine_desc _sspine_desc_defaults(const sspine_desc* desc) { - SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free)); + SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn)); sspine_desc res = *desc; res.max_vertices = _sspine_def(desc->max_vertices, _SSPINE_DEFAULT_MAX_VERTICES); res.max_commands = _sspine_def(desc->max_commands, _SSPINE_DEFAULT_MAX_COMMANDS); From 995a3d571b1852a9f1597cfd1a146b93e0c18637 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 25 Sep 2023 16:34:17 +0200 Subject: [PATCH 216/292] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e130b0aae..706f8c85b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ This is a breaking change only if you've been providing your own allocator functions to the sokol headers. + See issue https://github.com/floooh/sokol/issues/903 and PR https://github.com/floooh/sokol/pull/908 + for details. + #### 23-Sep-2023 - sokol_gfx.h gl: Allow to inject an external GL framebuffer id into the sokol-gfx default From 573c566e23089b4b2bcb96f38dd952e530e0e334 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 26 Sep 2023 20:07:52 +0200 Subject: [PATCH 217/292] sokol_gfx.h wgpu: bindgroup cache wip --- sokol_gfx.h | 64 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 59e225523..2853090cb 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3330,6 +3330,8 @@ typedef struct sg_desc { int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests bool mtl_force_managed_storage_mode; // for debugging: use Metal managed storage mode for resources even with UMA + bool wgpu_disable_bindgroup_cache; // set to false to disable the WebGPU backend BindGroup cache + int wgpu_bindgroup_cache_size; // number of slots in the WebGPU bindgroup cache (must be 2^N) sg_allocator allocator; sg_logger logger; // optional log function override sg_context_desc context; @@ -4021,6 +4023,14 @@ typedef struct { sg_resource_state state; } _sg_slot_t; +// a common resource pool housekeeping struct +typedef struct { + int size; + int queue_top; + uint32_t* gen_ctrs; + int* free_queue; +} _sg_pool_t; + // constants enum { _SG_STRING_SIZE = 16, @@ -4036,6 +4046,7 @@ enum { _SG_DEFAULT_CONTEXT_POOL_SIZE = 16, _SG_DEFAULT_UB_SIZE = 4 * 1024 * 1024, _SG_DEFAULT_MAX_COMMIT_LISTENERS = 1024, + _SG_DEFAULT_WGPU_BINDGROUP_CACHE_SIZE = 1024, }; // fixed-size string @@ -4907,6 +4918,25 @@ typedef struct { } bind; } _sg_wgpu_uniform_buffer_t; +// an internal bindgroup wrapper object (referenced by bindgroup cache) +#define _SG_WGPU_BINDGROUP_KEY_NUM (1+SG_NUM_SHADER_STAGES*(SG_MAX_SHADERSTAGE_IMAGES+SG_MAX_SHADERSTAGE_SAMPLERS)) +typedef struct { + _sg_slot_t slot; + WGPUBindGroup bg; + uint64_t hash; + uint32_t key[_SG_WGPU_BINDGROUP_KEY_NUM]; // pipeline + image + sampler ids +} _sg_wgpu_bindgroup_t; + +typedef struct { + uint32_t id; +} _sg_wgpu_bindgroup_handle_t; + +typedef struct { + size_t num; // must be 2^n + uint64_t index_mask; // mask to turn hash into valid index + _sg_wgpu_bindgroup_handle_t* items; +} _sg_wgpu_bindgroup_cache_t; + typedef struct { struct { sg_buffer buffer; @@ -4916,7 +4946,13 @@ typedef struct { sg_buffer buffer; int offset; } ib; -} _sg_wgpu_bindcache_t; + _sg_wgpu_bindgroup_handle_t bindgroup; +} _sg_wgpu_bindings_cache_t; + +typedef struct { + _sg_pool_t pool; + _sg_wgpu_bindgroup_t* bindgroups; +} _sg_wgpu_bindgroup_pool_t; // the WGPU backend state typedef struct { @@ -4941,7 +4977,9 @@ typedef struct { const _sg_pipeline_t* cur_pipeline; sg_pipeline cur_pipeline_id; _sg_wgpu_uniform_buffer_t uniform; - _sg_wgpu_bindcache_t bindcache; + _sg_wgpu_bindings_cache_t bindings_cache; + _sg_wgpu_bindgroup_cache_t bingroup_cache; + _sg_wgpu_bindgroup_pool_t bindgroup_pool; } _sg_wgpu_backend_t; #endif @@ -4950,13 +4988,6 @@ typedef struct { // this *MUST* remain 0 #define _SG_INVALID_SLOT_INDEX (0) -typedef struct { - int size; - int queue_top; - uint32_t* gen_ctrs; - int* free_queue; -} _sg_pool_t; - typedef struct { _sg_pool_t buffer_pool; _sg_pool_t image_pool; @@ -12521,29 +12552,29 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { } _SOKOL_PRIVATE void _sg_wgpu_bindcache_clear(void) { - memset(&_sg.wgpu.bindcache, 0, sizeof(_sg.wgpu.bindcache)); + memset(&_sg.wgpu.bindings_cache, 0, sizeof(_sg.wgpu.bindings_cache)); } _SOKOL_PRIVATE bool _sg_wgpu_bindcache_vb_dirty(int index, const _sg_buffer_t* vb, int offset) { SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); - return (vb->slot.id != _sg.wgpu.bindcache.vbs[index].buffer.id) || (offset != _sg.wgpu.bindcache.vbs[index].offset); + return (vb->slot.id != _sg.wgpu.bindings_cache.vbs[index].buffer.id) || (offset != _sg.wgpu.bindings_cache.vbs[index].offset); } _SOKOL_PRIVATE void _sg_wgpu_bindcache_vb_update(int index, const _sg_buffer_t* vb, int offset) { SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); - _sg.wgpu.bindcache.vbs[index].buffer.id = vb->slot.id; - _sg.wgpu.bindcache.vbs[index].offset = offset; + _sg.wgpu.bindings_cache.vbs[index].buffer.id = vb->slot.id; + _sg.wgpu.bindings_cache.vbs[index].offset = offset; } _SOKOL_PRIVATE bool _sg_wgpu_bindcache_ib_dirty(const _sg_buffer_t* ib, int ib_offset) { SOKOL_ASSERT(ib); - return (ib->slot.id != _sg.wgpu.bindcache.ib.buffer.id) || (ib_offset != _sg.wgpu.bindcache.ib.offset); + return (ib->slot.id != _sg.wgpu.bindings_cache.ib.buffer.id) || (ib_offset != _sg.wgpu.bindings_cache.ib.offset); } _SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_offset) { SOKOL_ASSERT(ib); - _sg.wgpu.bindcache.ib.buffer.id = ib->slot.id; - _sg.wgpu.bindcache.ib.offset = ib_offset; + _sg.wgpu.bindings_cache.ib.buffer.id = ib->slot.id; + _sg.wgpu.bindings_cache.ib.offset = ib_offset; } _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { @@ -15852,6 +15883,7 @@ _SOKOL_PRIVATE sg_desc _sg_desc_defaults(const sg_desc* desc) { res.context_pool_size = _sg_def(res.context_pool_size, _SG_DEFAULT_CONTEXT_POOL_SIZE); res.uniform_buffer_size = _sg_def(res.uniform_buffer_size, _SG_DEFAULT_UB_SIZE); res.max_commit_listeners = _sg_def(res.max_commit_listeners, _SG_DEFAULT_MAX_COMMIT_LISTENERS); + res.wgpu_bindgroup_cache_size = _sg_def(res.wgpu_bindgroup_cache_size, _SG_DEFAULT_WGPU_BINDGROUP_CACHE_SIZE); return res; } From fff648f9028e3be4c469bdee2558736852fcf06d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 27 Sep 2023 19:40:50 +0200 Subject: [PATCH 218/292] sokol_gfx.h wgpu: bindgroup cache wip --- sokol_gfx.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 11 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 2853090cb..053ca5505 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3330,8 +3330,8 @@ typedef struct sg_desc { int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests bool mtl_force_managed_storage_mode; // for debugging: use Metal managed storage mode for resources even with UMA - bool wgpu_disable_bindgroup_cache; // set to false to disable the WebGPU backend BindGroup cache - int wgpu_bindgroup_cache_size; // number of slots in the WebGPU bindgroup cache (must be 2^N) + bool wgpu_disable_bindgroups_cache; // set to false to disable the WebGPU backend BindGroup cache + int wgpu_bindgroups_cache_size; // number of slots in the WebGPU bindgroup cache (must be 2^N) sg_allocator allocator; sg_logger logger; // optional log function override sg_context_desc context; @@ -4031,6 +4031,14 @@ typedef struct { int* free_queue; } _sg_pool_t; +_SOKOL_PRIVATE void _sg_init_pool(_sg_pool_t* pool, int num); +_SOKOL_PRIVATE void _sg_discard_pool(_sg_pool_t* pool); +_SOKOL_PRIVATE int _sg_pool_alloc_index(_sg_pool_t* pool); +_SOKOL_PRIVATE void _sg_pool_free_index(_sg_pool_t* pool, int slot_index); +_SOKOL_PRIVATE void _sg_reset_slot(_sg_slot_t* slot); +_SOKOL_PRIVATE uint32_t _sg_slot_alloc(_sg_pool_t* pool, _sg_slot_t* slot, int slot_index); +_SOKOL_PRIVATE int _sg_slot_index(uint32_t id); + // constants enum { _SG_STRING_SIZE = 16, @@ -4935,7 +4943,12 @@ typedef struct { size_t num; // must be 2^n uint64_t index_mask; // mask to turn hash into valid index _sg_wgpu_bindgroup_handle_t* items; -} _sg_wgpu_bindgroup_cache_t; +} _sg_wgpu_bindgroups_cache_t; + +typedef struct { + _sg_pool_t pool; + _sg_wgpu_bindgroup_t* bindgroups; +} _sg_wgpu_bindgroups_pool_t; typedef struct { struct { @@ -4949,11 +4962,6 @@ typedef struct { _sg_wgpu_bindgroup_handle_t bindgroup; } _sg_wgpu_bindings_cache_t; -typedef struct { - _sg_pool_t pool; - _sg_wgpu_bindgroup_t* bindgroups; -} _sg_wgpu_bindgroup_pool_t; - // the WGPU backend state typedef struct { bool valid; @@ -4978,8 +4986,8 @@ typedef struct { sg_pipeline cur_pipeline_id; _sg_wgpu_uniform_buffer_t uniform; _sg_wgpu_bindings_cache_t bindings_cache; - _sg_wgpu_bindgroup_cache_t bingroup_cache; - _sg_wgpu_bindgroup_pool_t bindgroup_pool; + _sg_wgpu_bindgroups_cache_t bingroups_cache; + _sg_wgpu_bindgroups_pool_t bindgroups_pool; } _sg_wgpu_backend_t; #endif @@ -12551,6 +12559,52 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_init(const sg_desc* desc) { + SOKOL_ASSERT(!desc->wgpu_disable_bindgroups_cache); + SOKOL_ASSERT((desc->wgpu_bindgroups_cache_size > 0) && (desc->wgpu_bindgroups_cache_size < _SG_MAX_POOL_SIZE)); + SOKOL_ASSERT(0 == _sg.wgpu.bindgroups_pool.bindgroups); + const int pool_size = desc->wgpu_bindgroups_cache_size; + _sg_init_pool(&_sg.wgpu.bindgroups_pool.pool, pool_size); + size_t pool_byte_size = sizeof(_sg_wgpu_bindgroup_t) * (size_t)pool_size; + _sg.wgpu.bindgroups_pool.bindgroups = _sg_malloc_clear(pool_byte_size); +} + +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_discard(_sg_wgpu_bindgroups_pool_t* p) { + SOKOL_ASSERT(p && p->bindgroups); + _sg_free(p->bindgroups); p->bindgroups = 0; + _sg_discard_pool(&p->pool); +} + +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_bindgroup_at(_sg_wgpu_bindgroups_pool_t* p, uint32_t bg_id) { + SOKOL_ASSERT(p && (SG_INVALID_ID != bg_id)); + int slot_index = _sg_slot_index(bg_id); + SOKOL_ASSERT((slot_index > _SG_INVALID_SLOT_INDEX) && (slot_index < p->pool.size)); + return &p->bindgroups[slot_index]; +} + +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_lookup_bindgroup(_sg_wgpu_bindgroups_pool_t* p, uint32_t bg_id) { + if (SG_INVALID_ID != bg_id) { + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(p, bg_id); + if (bg->slot.id == bg_id) { + return bg; + } + } + return 0; +} + +_SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { + // FIXME! +} + +_SOKOL_PRIVATE void _sg_wgpu_discard_all_bindgroups(_sg_wgpu_bindgroups_pool_t* p) { + for (int i = 0; i < p->pool.size; i++) { + sg_resource_state state = p->bindgroups[i].slot.state; + if ((state == SG_RESOURCESTATE_VALID) || (state == SG_RESOURCESTATE_FAILED)) { + _sg_wgpu_discard_bindgroup(&p->bindgroups[i]); + } + } +} + _SOKOL_PRIVATE void _sg_wgpu_bindcache_clear(void) { memset(&_sg.wgpu.bindings_cache, 0, sizeof(_sg.wgpu.bindings_cache)); } @@ -12600,6 +12654,9 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_wgpu_bindcache_clear(); _sg_wgpu_init_caps(); _sg_wgpu_uniform_buffer_init(desc); + if (!desc->wgpu_disable_bindgroups_cache) { + _sg_wgpu_bindgroups_pool_init(desc); + } // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -12624,6 +12681,10 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); SOKOL_ASSERT(_sg.wgpu.cmd_enc); _sg.wgpu.valid = false; + if (!_sg.desc.wgpu_disable_bindgroups_cache) { + _sg_wgpu_discard_all_bindgroups(&_sg.wgpu.bindgroups_pool); + _sg_wgpu_bindgroups_pool_discard(&_sg.wgpu.bindgroups_pool); + } _sg_wgpu_uniform_buffer_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; wgpuCommandEncoderRelease(_sg.wgpu.cmd_enc); _sg.wgpu.cmd_enc = 0; @@ -15883,7 +15944,7 @@ _SOKOL_PRIVATE sg_desc _sg_desc_defaults(const sg_desc* desc) { res.context_pool_size = _sg_def(res.context_pool_size, _SG_DEFAULT_CONTEXT_POOL_SIZE); res.uniform_buffer_size = _sg_def(res.uniform_buffer_size, _SG_DEFAULT_UB_SIZE); res.max_commit_listeners = _sg_def(res.max_commit_listeners, _SG_DEFAULT_MAX_COMMIT_LISTENERS); - res.wgpu_bindgroup_cache_size = _sg_def(res.wgpu_bindgroup_cache_size, _SG_DEFAULT_WGPU_BINDGROUP_CACHE_SIZE); + res.wgpu_bindgroups_cache_size = _sg_def(res.wgpu_bindgroups_cache_size, _SG_DEFAULT_WGPU_BINDGROUP_CACHE_SIZE); return res; } From daf519e99ecfc1be93b5922bdd472766b35d6786 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 30 Sep 2023 12:49:00 +0200 Subject: [PATCH 219/292] sokol_gfx.h wgpu: implement internal bindgroup resource pool --- sokol_gfx.h | 313 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 225 insertions(+), 88 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 053ca5505..bc56dff90 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2904,7 +2904,8 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND, "fragment shader entry not found (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ - _SG_LOGITEM_XMACRO(WGPU_MAP_UNIFORM_BUFFER_FAILED, "failed to map uniform buffer (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_BINDGROUPS_POOL_EXHAUSTED, "wgpu BindGroups pool exhausted (increase sg_desc.bindgroups_cache_size)") \ + _SG_LOGITEM_XMACRO(WGPU_CREATEBINDGROUP_FAILED, "wgpuDeviceCreateBindGroup failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "wgpuDeviceCreateBuffer() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_FAILED, "wgpuDeviceCreateTexture() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_VIEW_FAILED, "wgpuTextureCreateView() failed") \ @@ -4926,25 +4927,28 @@ typedef struct { } bind; } _sg_wgpu_uniform_buffer_t; -// an internal bindgroup wrapper object (referenced by bindgroup cache) -#define _SG_WGPU_BINDGROUP_KEY_NUM (1+SG_NUM_SHADER_STAGES*(SG_MAX_SHADERSTAGE_IMAGES+SG_MAX_SHADERSTAGE_SAMPLERS)) -typedef struct { - _sg_slot_t slot; - WGPUBindGroup bg; - uint64_t hash; - uint32_t key[_SG_WGPU_BINDGROUP_KEY_NUM]; // pipeline + image + sampler ids -} _sg_wgpu_bindgroup_t; - typedef struct { uint32_t id; } _sg_wgpu_bindgroup_handle_t; +#define _SG_WGPU_BINDGROUPSCACHE_NUM_ITEMS (1 + SG_NUM_SHADER_STAGES * (SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS)) +typedef struct { + uint64_t hash; + uint32_t items[_SG_WGPU_BINDGROUPSCACHE_NUM_ITEMS]; +} _sg_wgpu_bindgroupscache_key_t; + typedef struct { size_t num; // must be 2^n uint64_t index_mask; // mask to turn hash into valid index _sg_wgpu_bindgroup_handle_t* items; } _sg_wgpu_bindgroups_cache_t; +typedef struct { + _sg_slot_t slot; + WGPUBindGroup bindgroup; + _sg_wgpu_bindgroupscache_key_t key; +} _sg_wgpu_bindgroup_t; + typedef struct { _sg_pool_t pool; _sg_wgpu_bindgroup_t* bindgroups; @@ -5870,7 +5874,7 @@ _SOKOL_PRIVATE void _sg_dummy_update_buffer(_sg_buffer_t* buf, const sg_range* d } } -_SOKOL_PRIVATE void _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { +_SOKOL_PRIVATE bool _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* data, bool new_frame) { SOKOL_ASSERT(buf && data && data->ptr && (data->size > 0)); _SOKOL_UNUSED(data); if (new_frame) { @@ -5878,6 +5882,7 @@ _SOKOL_PRIVATE void _sg_dummy_append_buffer(_sg_buffer_t* buf, const sg_range* d buf->cmn.active_slot = 0; } } + return true; } _SOKOL_PRIVATE void _sg_dummy_update_image(_sg_image_t* img, const sg_image_data* data) { @@ -8158,7 +8163,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _SG_GL_CHECK_ERROR(); } -_SOKOL_PRIVATE void _sg_gl_apply_bindings( +_SOKOL_PRIVATE bool _sg_gl_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, @@ -8252,6 +8257,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_bindings( } } _SG_GL_CHECK_ERROR(); + return true; } _SOKOL_PRIVATE void _sg_gl_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -10130,7 +10136,7 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_pipeline(_sg_pipeline_t* pip) { _sg_d3d11_PSSetConstantBuffers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_UBS, pip->shader->d3d11.stage[SG_SHADERSTAGE_FS].cbufs); } -_SOKOL_PRIVATE void _sg_d3d11_apply_bindings( +_SOKOL_PRIVATE bool _sg_d3d11_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, @@ -10178,6 +10184,7 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_bindings( _sg_d3d11_PSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_srvs); _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_vs_smps); _sg_d3d11_PSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_fs_smps); + return true; } _SOKOL_PRIVATE void _sg_d3d11_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -11812,7 +11819,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_pipeline(_sg_pipeline_t* pip) { } } -_SOKOL_PRIVATE void _sg_mtl_apply_bindings( +_SOKOL_PRIVATE bool _sg_mtl_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, @@ -11899,6 +11906,7 @@ _SOKOL_PRIVATE void _sg_mtl_apply_bindings( [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(smp->mtl.sampler_state) atIndex:slot]; } } + return true; } _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -12560,7 +12568,6 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { } _SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_init(const sg_desc* desc) { - SOKOL_ASSERT(!desc->wgpu_disable_bindgroups_cache); SOKOL_ASSERT((desc->wgpu_bindgroups_cache_size > 0) && (desc->wgpu_bindgroups_cache_size < _SG_MAX_POOL_SIZE)); SOKOL_ASSERT(0 == _sg.wgpu.bindgroups_pool.bindgroups); const int pool_size = desc->wgpu_bindgroups_cache_size; @@ -12592,8 +12599,163 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_lookup_bindgroup(_sg_wgpu_bindgrou return 0; } -_SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { +_SOKOL_PRIVATE _sg_wgpu_bindgroup_handle_t _sg_wgpu_alloc_bindgroup(_sg_wgpu_bindgroups_pool_t* p) { + _sg_wgpu_bindgroup_handle_t res; + int slot_index = _sg_pool_alloc_index(&p->pool); + if (_SG_INVALID_SLOT_INDEX != slot_index) { + res.id = _sg_slot_alloc(&p->pool, &p->bindgroups[slot_index].slot, slot_index); + } else { + res.id = SG_INVALID_ID; + _SG_ERROR(WGPU_BINDGROUPS_POOL_EXHAUSTED); + } + return res; +} + +_SOKOL_PRIVATE void _sg_wgpu_dealloc_bindgroup(_sg_wgpu_bindgroups_pool_t* p, _sg_wgpu_bindgroup_t* bg) { + SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_ALLOC) && (bg->slot.id != SG_INVALID_ID)); + _sg_pool_free_index(&p->pool, _sg_slot_index(bg->slot.id)); + _sg_reset_slot(&bg->slot); +} + +_SOKOL_PRIVATE void _sg_wgpu_reset_bindgroup_to_alloc_state(_sg_wgpu_bindgroup_t* bg) { + SOKOL_ASSERT(bg); + _sg_slot_t slot = bg->slot; + _sg_clear(bg, sizeof(_sg_wgpu_bindgroup_t)); + bg->slot = slot; + bg->slot.state = SG_RESOURCESTATE_ALLOC; +} + +_SOKOL_PRIVATE uint64_t _sg_wgpu_hash(void* ptr, size_t num_bytes) { // FIXME! + (void)ptr; (void)num_bytes; + return 0; +} + +_SOKOL_PRIVATE void _sg_wgpu_init_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* key, + _sg_pipeline_t* pip, + _sg_image_t** vs_imgs, int num_vs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** fs_smps, int num_fs_smps) +{ + SOKOL_ASSERT(pip); + SOKOL_ASSERT(vs_imgs && (num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); + SOKOL_ASSERT(vs_smps && (num_vs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); + SOKOL_ASSERT(fs_imgs && (num_fs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); + SOKOL_ASSERT(fs_smps && (num_fs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); + + _sg_clear(key->items, sizeof(key->items)); + key->items[0] = pip->slot.id; + const int vs_imgs_offset = 1; + const int vs_smps_offset = vs_imgs_offset + SG_MAX_SHADERSTAGE_IMAGES; + const int fs_imgs_offset = vs_smps_offset + SG_MAX_SHADERSTAGE_SAMPLERS; + const int fs_smps_offset = fs_imgs_offset + SG_MAX_SHADERSTAGE_IMAGES; + SOKOL_ASSERT((fs_smps_offset + SG_MAX_SHADERSTAGE_SAMPLERS) == _SG_WGPU_BINDGROUPSCACHE_NUM_ITEMS); + for (int i = 0; i < num_vs_imgs; i++) { + SOKOL_ASSERT(vs_imgs[i]); + key->items[vs_imgs_offset + i] = vs_imgs[i]->slot.id; + } + for (int i = 0; i < num_vs_smps; i++) { + SOKOL_ASSERT(vs_smps[i]); + key->items[vs_smps_offset + i] = vs_smps[i]->slot.id; + } + for (int i = 0; i < num_fs_imgs; i++) { + SOKOL_ASSERT(fs_imgs[i]); + key->items[fs_imgs_offset + i] = fs_imgs[i]->slot.id; + } + for (int i = 0; i < num_fs_smps; i++) { + SOKOL_ASSERT(fs_smps[i]); + key->items[fs_smps_offset + i] = fs_smps[i]->slot.id; + } + key->hash = _sg_wgpu_hash(&key->items, sizeof(key->items)); +} + +_SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* k0, _sg_wgpu_bindgroupscache_key_t* k1) { + SOKOL_ASSERT(k0 && k1); + if (k0->hash != k1->hash) { + return false; + } + if (memcmp(&k0->items, &k1->items, sizeof(k0->items)) != 0) { + return false; + } + return true; +} + +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup( + _sg_pipeline_t* pip, + _sg_image_t** vs_imgs, int num_vs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** fs_smps, int num_fs_smps) +{ + SOKOL_ASSERT(_sg.wgpu.dev); + SOKOL_ASSERT(pip); + SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); + _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(&_sg.wgpu.bindgroups_pool); + if (bg_id.id == SG_INVALID_ID) { + return 0; + } + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(&_sg.wgpu.bindgroups_pool, bg_id.id); + SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_ALLOC)); + + // create wgpu bindgroup object + WGPUBindGroupLayout bgl = pip->shader->wgpu.bind_group_layout; + SOKOL_ASSERT(bgl); + WGPUBindGroupEntry wgpu_entries[SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; + _sg_clear(&wgpu_entries, sizeof(wgpu_entries)); + int bge_index = 0; + for (int i = 0; i < num_vs_imgs; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_VS, i); + wgpu_entry->textureView = vs_imgs[i]->wgpu.view; + } + for (int i = 0; i < num_vs_smps; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_VS, i); + wgpu_entry->sampler = vs_smps[i]->wgpu.smp; + } + for (int i = 0; i < num_fs_imgs; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_FS, i); + wgpu_entry->textureView = fs_imgs[i]->wgpu.view; + } + for (int i = 0; i < num_fs_smps; i++) { + WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; + wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_FS, i); + wgpu_entry->sampler = fs_smps[i]->wgpu.smp; + } + WGPUBindGroupDescriptor bg_desc; + _sg_clear(&bg_desc, sizeof(bg_desc)); + bg_desc.layout = bgl; + bg_desc.entryCount = (size_t)bge_index; + bg_desc.entries = &wgpu_entries[0]; + bg->bindgroup = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); + if (bg->bindgroup == 0) { + _SG_ERROR(WGPU_CREATEBINDGROUP_FAILED); + bg->slot.state = SG_RESOURCESTATE_FAILED; + return bg; + } + + _sg_wgpu_init_bindgroupscache_key(&bg->key, pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + + bg->slot.state = SG_RESOURCESTATE_VALID; + return bg; +} + +_SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { + SOKOL_ASSERT(bg); + if (bg->slot.state == SG_RESOURCESTATE_VALID) { + if (bg->bindgroup) { + wgpuBindGroupRelease(bg->bindgroup); + bg->bindgroup = 0; + } + _sg_wgpu_reset_bindgroup_to_alloc_state(bg); + SOKOL_ASSERT(bg->slot.state == SG_RESOURCESTATE_ALLOC); + } + if (bg->slot.state == SG_RESOURCESTATE_ALLOC) { + _sg_wgpu_dealloc_bindgroup(&_sg.wgpu.bindgroups_pool, bg); + SOKOL_ASSERT(bg->slot.state == SG_RESOURCESTATE_INITIAL); + } } _SOKOL_PRIVATE void _sg_wgpu_discard_all_bindgroups(_sg_wgpu_bindgroups_pool_t* p) { @@ -12631,6 +12793,31 @@ _SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_ _sg.wgpu.bindings_cache.ib.offset = ib_offset; } +_SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup( + _sg_pipeline_t* pip, + _sg_image_t** vs_imgs, int num_vs_imgs, + _sg_sampler_t** vs_smps, int num_vs_smps, + _sg_image_t** fs_imgs, int num_fs_imgs, + _sg_sampler_t** fs_smps, int num_fs_smps) +{ + if ((num_vs_imgs + num_vs_smps + num_fs_imgs + num_fs_smps) > 0) { + // FIXME: use bindgroups cache! + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + if (bg) { + if (bg->slot.state == SG_RESOURCESTATE_VALID) { + SOKOL_ASSERT(bg->bindgroup); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + } + _sg_wgpu_discard_bindgroup(bg); + } else { + return false; + } + } else { + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); + } + return true; +} + _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { SOKOL_ASSERT(desc); SOKOL_ASSERT(desc->context.wgpu.device); @@ -12654,9 +12841,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_wgpu_bindcache_clear(); _sg_wgpu_init_caps(); _sg_wgpu_uniform_buffer_init(desc); - if (!desc->wgpu_disable_bindgroups_cache) { - _sg_wgpu_bindgroups_pool_init(desc); - } + _sg_wgpu_bindgroups_pool_init(desc); // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -12681,10 +12866,8 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); SOKOL_ASSERT(_sg.wgpu.cmd_enc); _sg.wgpu.valid = false; - if (!_sg.desc.wgpu_disable_bindgroups_cache) { - _sg_wgpu_discard_all_bindgroups(&_sg.wgpu.bindgroups_pool); - _sg_wgpu_bindgroups_pool_discard(&_sg.wgpu.bindgroups_pool); - } + _sg_wgpu_discard_all_bindgroups(&_sg.wgpu.bindgroups_pool); + _sg_wgpu_bindgroups_pool_discard(&_sg.wgpu.bindgroups_pool); _sg_wgpu_uniform_buffer_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; wgpuCommandEncoderRelease(_sg.wgpu.cmd_enc); _sg.wgpu.cmd_enc = 0; @@ -13425,53 +13608,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->cmn.stencil.ref); } -_SOKOL_PRIVATE WGPUBindGroup _sg_wgpu_create_bindgroup( - WGPUBindGroupLayout bgl, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - SOKOL_ASSERT(_sg.wgpu.dev); - SOKOL_ASSERT(vs_imgs && (num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); - SOKOL_ASSERT(vs_smps && (num_vs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); - SOKOL_ASSERT(fs_imgs && (num_fs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); - SOKOL_ASSERT(fs_smps && (num_fs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); - - WGPUBindGroupEntry wgpu_entries[2 * SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; - _sg_clear(&wgpu_entries, sizeof(wgpu_entries)); - int bge_index = 0; - for (int i = 0; i < num_vs_imgs; i++) { - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; - wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_VS, i); - wgpu_entry->textureView = vs_imgs[i]->wgpu.view; - } - for (int i = 0; i < num_vs_smps; i++) { - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; - wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_VS, i); - wgpu_entry->sampler = vs_smps[i]->wgpu.smp; - } - for (int i = 0; i < num_fs_imgs; i++) { - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; - wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_FS, i); - wgpu_entry->textureView = fs_imgs[i]->wgpu.view; - } - for (int i = 0; i < num_fs_smps; i++) { - WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; - wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_FS, i); - wgpu_entry->sampler = fs_smps[i]->wgpu.smp; - } - WGPUBindGroupDescriptor bg_desc; - _sg_clear(&bg_desc, sizeof(bg_desc)); - bg_desc.layout = bgl; - bg_desc.entryCount = (size_t)bge_index; - bg_desc.entries = &wgpu_entries[0]; - WGPUBindGroup bg = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc); - SOKOL_ASSERT(bg); - return bg; -} - -_SOKOL_PRIVATE void _sg_wgpu_apply_bindings( +_SOKOL_PRIVATE bool _sg_wgpu_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, @@ -13483,6 +13620,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); + bool retval = true; // index buffer if (ib) { @@ -13511,17 +13649,9 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_bindings( // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } - // FIXME: create adhoc bind group object for images and samplers - // (either use a bindgroup-cache or introduce bindgroups as sokol-gfx objects) - if ((num_vs_imgs + num_vs_smps + num_fs_imgs + num_fs_smps) > 0) { - WGPUBindGroupLayout bgl = pip->shader->wgpu.bind_group_layout; - SOKOL_ASSERT(bgl); - WGPUBindGroup bg = _sg_wgpu_create_bindgroup(bgl, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg, 0, 0); - wgpuBindGroupRelease(bg); - } else { - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); - } + _sg_wgpu_apply_bindgroup(pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + + return retval; } _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -14000,7 +14130,7 @@ static inline void _sg_apply_pipeline(_sg_pipeline_t* pip) { #endif } -static inline void _sg_apply_bindings( +static inline bool _sg_apply_bindings( _sg_pipeline_t* pip, _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, _sg_buffer_t* ib, int ib_offset, @@ -14010,15 +14140,15 @@ static inline void _sg_apply_bindings( _sg_sampler_t** fs_smps, int num_fs_smps) { #if defined(_SOKOL_ANY_GL) - _sg_gl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_gl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_METAL) - _sg_mtl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_mtl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_D3D11) - _sg_d3d11_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_d3d11_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_WGPU) - _sg_wgpu_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_wgpu_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #elif defined(SOKOL_DUMMY_BACKEND) - _sg_dummy_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_dummy_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); #else #error("INVALID BACKEND"); #endif @@ -16841,7 +16971,14 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { if (_sg.next_draw_valid) { const int* vb_offsets = bindings->vertex_buffer_offsets; int ib_offset = bindings->index_buffer_offset; - _sg_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + _sg.next_draw_valid = _sg_apply_bindings( + pip, + vbs, vb_offsets, num_vbs, + ib, ib_offset, + vs_imgs, num_vs_imgs, + fs_imgs, num_fs_imgs, + vs_smps, num_vs_smps, + fs_smps, num_fs_smps); _SG_TRACE_ARGS(apply_bindings, bindings); } } From 59bf444ae8a7ec1c78bc66457824f341dfd47ae3 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 30 Sep 2023 13:40:09 +0200 Subject: [PATCH 220/292] sokol_gfx.h: simplify bindings code across all backends --- sokol_gfx.h | 474 +++++++++++++++++++++++----------------------------- 1 file changed, 212 insertions(+), 262 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index bc56dff90..c453a6cad 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5023,6 +5023,24 @@ typedef struct { sg_commit_listener* items; } _sg_commit_listeners_t; +// resolved resource bindings struct +typedef struct { + _sg_pipeline_t* pip; + int num_vbs; + int num_vs_imgs; + int num_vs_smps; + int num_fs_imgs; + int num_fs_smps; + int vb_offsets[SG_MAX_VERTEX_BUFFERS]; + int ib_offset; + _sg_buffer_t* vbs[SG_MAX_VERTEX_BUFFERS]; + _sg_buffer_t* ib; + _sg_image_t* vs_imgs[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_sampler_t* vs_smps[SG_MAX_SHADERSTAGE_SAMPLERS]; + _sg_image_t* fs_imgs[SG_MAX_SHADERSTAGE_IMAGES]; + _sg_sampler_t* fs_smps[SG_MAX_SHADERSTAGE_SAMPLERS]; +} _sg_bindings_t; + typedef struct { bool valid; sg_desc desc; // original desc with default values patched in @@ -5031,7 +5049,7 @@ typedef struct { sg_pass cur_pass; sg_pipeline cur_pipeline; bool pass_valid; - bool bindings_valid; + bool bindings_applied; bool next_draw_valid; #if defined(SOKOL_DEBUG) sg_log_item validate_error; @@ -5830,28 +5848,11 @@ _SOKOL_PRIVATE void _sg_dummy_apply_pipeline(_sg_pipeline_t* pip) { _SOKOL_UNUSED(pip); } -_SOKOL_PRIVATE void _sg_dummy_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - SOKOL_ASSERT(pip); - SOKOL_ASSERT(vbs && vb_offsets); - SOKOL_ASSERT(vs_imgs); - SOKOL_ASSERT(fs_imgs); - SOKOL_ASSERT(vs_smps); - SOKOL_ASSERT(fs_smps); - _SOKOL_UNUSED(pip); - _SOKOL_UNUSED(vbs); _SOKOL_UNUSED(vb_offsets); _SOKOL_UNUSED(num_vbs); - _SOKOL_UNUSED(ib); _SOKOL_UNUSED(ib_offset); - _SOKOL_UNUSED(vs_imgs); _SOKOL_UNUSED(num_vs_imgs); - _SOKOL_UNUSED(fs_imgs); _SOKOL_UNUSED(num_fs_imgs); - _SOKOL_UNUSED(vs_smps); _SOKOL_UNUSED(num_vs_smps); - _SOKOL_UNUSED(fs_smps); _SOKOL_UNUSED(num_fs_smps); +_SOKOL_PRIVATE bool _sg_dummy_apply_bindings(_sg_bindings_t* bnd) { + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip); + _SOKOL_UNUSED(bnd); + return true; } _SOKOL_PRIVATE void _sg_dummy_apply_uniforms(sg_shader_stage stage_index, int ub_index, const sg_range* data) { @@ -8163,28 +8164,20 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _SG_GL_CHECK_ERROR(); } -_SOKOL_PRIVATE bool _sg_gl_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - SOKOL_ASSERT(pip); - _SOKOL_UNUSED(num_vbs); +_SOKOL_PRIVATE bool _sg_gl_apply_bindings(_sg_bindings_t* bnd) { + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip); _SG_GL_CHECK_ERROR(); // bind combined image-samplers _SG_GL_CHECK_ERROR(); for (int stage_index = 0; stage_index < SG_NUM_SHADER_STAGES; stage_index++) { - const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[stage_index]; - const _sg_gl_shader_stage_t* gl_stage = &pip->shader->gl.stage[stage_index]; - _sg_image_t** imgs = (stage_index == SG_SHADERSTAGE_VS) ? vs_imgs : fs_imgs; - _sg_sampler_t** smps = (stage_index == SG_SHADERSTAGE_VS) ? vs_smps : fs_smps; - const int num_imgs = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_imgs : num_fs_imgs; - const int num_smps = (stage_index == SG_SHADERSTAGE_VS) ? num_vs_smps : num_fs_smps; + const _sg_shader_stage_t* stage = &bnd->pip->shader->cmn.stage[stage_index]; + const _sg_gl_shader_stage_t* gl_stage = &bnd->pip->shader->gl.stage[stage_index]; + _sg_image_t** imgs = (stage_index == SG_SHADERSTAGE_VS) ? bnd->vs_imgs : bnd->fs_imgs; + _sg_sampler_t** smps = (stage_index == SG_SHADERSTAGE_VS) ? bnd->vs_smps : bnd->fs_smps; + const int num_imgs = (stage_index == SG_SHADERSTAGE_VS) ? bnd->num_vs_imgs : bnd->num_fs_imgs; + const int num_smps = (stage_index == SG_SHADERSTAGE_VS) ? bnd->num_vs_smps : bnd->num_fs_smps; SOKOL_ASSERT(num_imgs == stage->num_images); _SOKOL_UNUSED(num_imgs); SOKOL_ASSERT(num_smps == stage->num_samplers); _SOKOL_UNUSED(num_smps); for (int img_smp_index = 0; img_smp_index < stage->num_image_samplers; img_smp_index++) { @@ -8206,24 +8199,24 @@ _SOKOL_PRIVATE bool _sg_gl_apply_bindings( _SG_GL_CHECK_ERROR(); // index buffer (can be 0) - const GLuint gl_ib = ib ? ib->gl.buf[ib->cmn.active_slot] : 0; + const GLuint gl_ib = bnd->ib ? bnd->ib->gl.buf[bnd->ib->cmn.active_slot] : 0; _sg_gl_cache_bind_buffer(GL_ELEMENT_ARRAY_BUFFER, gl_ib); - _sg.gl.cache.cur_ib_offset = ib_offset; + _sg.gl.cache.cur_ib_offset = bnd->ib_offset; // vertex attributes for (GLuint attr_index = 0; attr_index < (GLuint)_sg.limits.max_vertex_attrs; attr_index++) { - _sg_gl_attr_t* attr = &pip->gl.attrs[attr_index]; + _sg_gl_attr_t* attr = &bnd->pip->gl.attrs[attr_index]; _sg_gl_cache_attr_t* cache_attr = &_sg.gl.cache.attrs[attr_index]; bool cache_attr_dirty = false; int vb_offset = 0; GLuint gl_vb = 0; if (attr->vb_index >= 0) { // attribute is enabled - SOKOL_ASSERT(attr->vb_index < num_vbs); - _sg_buffer_t* vb = vbs[attr->vb_index]; + SOKOL_ASSERT(attr->vb_index < bnd->num_vbs); + _sg_buffer_t* vb = bnd->vbs[attr->vb_index]; SOKOL_ASSERT(vb); gl_vb = vb->gl.buf[vb->cmn.active_slot]; - vb_offset = vb_offsets[attr->vb_index] + attr->offset; + vb_offset = bnd->vb_offsets[attr->vb_index] + attr->offset; if ((gl_vb != cache_attr->gl_vbuf) || (attr->size != cache_attr->gl_attr.size) || (attr->type != cache_attr->gl_attr.type) || @@ -8233,9 +8226,7 @@ _SOKOL_PRIVATE bool _sg_gl_apply_bindings( (cache_attr->gl_attr.divisor != attr->divisor)) { _sg_gl_cache_bind_buffer(GL_ARRAY_BUFFER, gl_vb); - glVertexAttribPointer(attr_index, attr->size, attr->type, - attr->normalized, attr->stride, - (const GLvoid*)(GLintptr)vb_offset); + glVertexAttribPointer(attr_index, attr->size, attr->type, attr->normalized, attr->stride, (const GLvoid*)(GLintptr)vb_offset); glVertexAttribDivisor(attr_index, (GLuint)attr->divisor); cache_attr_dirty = true; } @@ -10136,50 +10127,43 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_pipeline(_sg_pipeline_t* pip) { _sg_d3d11_PSSetConstantBuffers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_UBS, pip->shader->d3d11.stage[SG_SHADERSTAGE_FS].cbufs); } -_SOKOL_PRIVATE bool _sg_d3d11_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - SOKOL_ASSERT(pip); +_SOKOL_PRIVATE bool _sg_d3d11_apply_bindings(_sg_bindings_t* bnd) { + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(_sg.d3d11.ctx); SOKOL_ASSERT(_sg.d3d11.in_pass); // gather all the D3D11 resources into arrays - ID3D11Buffer* d3d11_ib = ib ? ib->d3d11.buf : 0; + ID3D11Buffer* d3d11_ib = bnd->ib ? ib->d3d11.buf : 0; ID3D11Buffer* d3d11_vbs[SG_MAX_VERTEX_BUFFERS] = {0}; UINT d3d11_vb_offsets[SG_MAX_VERTEX_BUFFERS] = {0}; ID3D11ShaderResourceView* d3d11_vs_srvs[SG_MAX_SHADERSTAGE_IMAGES] = {0}; ID3D11ShaderResourceView* d3d11_fs_srvs[SG_MAX_SHADERSTAGE_IMAGES] = {0}; ID3D11SamplerState* d3d11_vs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = {0}; ID3D11SamplerState* d3d11_fs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = {0}; - for (int i = 0; i < num_vbs; i++) { - SOKOL_ASSERT(vbs[i]->d3d11.buf); - d3d11_vbs[i] = vbs[i]->d3d11.buf; - d3d11_vb_offsets[i] = (UINT)vb_offsets[i]; + for (int i = 0; i < bnd->num_vbs; i++) { + SOKOL_ASSERT(bnd->vbs[i]->d3d11.buf); + d3d11_vbs[i] = bnd->vbs[i]->d3d11.buf; + d3d11_vb_offsets[i] = (UINT)bnd->vb_offsets[i]; } - for (int i = 0; i < num_vs_imgs; i++) { - SOKOL_ASSERT(vs_imgs[i]->d3d11.srv); - d3d11_vs_srvs[i] = vs_imgs[i]->d3d11.srv; + for (int i = 0; i < bnd->num_vs_imgs; i++) { + SOKOL_ASSERT(bnd->vs_imgs[i]->d3d11.srv); + d3d11_vs_srvs[i] = bnd->vs_imgs[i]->d3d11.srv; } - for (int i = 0; i < num_fs_imgs; i++) { - SOKOL_ASSERT(fs_imgs[i]->d3d11.srv); - d3d11_fs_srvs[i] = fs_imgs[i]->d3d11.srv; + for (int i = 0; i < bnd->num_fs_imgs; i++) { + SOKOL_ASSERT(bnd->fs_imgs[i]->d3d11.srv); + d3d11_fs_srvs[i] = bnd->fs_imgs[i]->d3d11.srv; } - for (int i = 0; i < num_vs_smps; i++) { - SOKOL_ASSERT(vs_smps[i]->d3d11.smp); - d3d11_vs_smps[i] = vs_smps[i]->d3d11.smp; + for (int i = 0; i < bnd->num_vs_smps; i++) { + SOKOL_ASSERT(bnd->vs_smps[i]->d3d11.smp); + d3d11_vs_smps[i] = bnd->vs_smps[i]->d3d11.smp; } - for (int i = 0; i < num_fs_smps; i++) { - SOKOL_ASSERT(fs_smps[i]->d3d11.smp); - d3d11_fs_smps[i] = fs_smps[i]->d3d11.smp; + for (int i = 0; i < bnd->num_fs_smps; i++) { + SOKOL_ASSERT(bnd->fs_smps[i]->d3d11.smp); + d3d11_fs_smps[i] = bnd->fs_smps[i]->d3d11.smp; } - _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, pip->d3d11.vb_strides, d3d11_vb_offsets); - _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)ib_offset); + _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, bnd->pip->d3d11.vb_strides, d3d11_vb_offsets); + _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)bnd->ib_offset); _sg_d3d11_VSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_srvs); _sg_d3d11_PSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_srvs); _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_vs_smps); @@ -11819,53 +11803,47 @@ _SOKOL_PRIVATE void _sg_mtl_apply_pipeline(_sg_pipeline_t* pip) { } } -_SOKOL_PRIVATE bool _sg_mtl_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - _SOKOL_UNUSED(pip); +_SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(_sg.mtl.in_pass); if (!_sg.mtl.pass_valid) { - return; + return false; } SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); // store index buffer binding, this will be needed later in sg_draw() - _sg.mtl.state_cache.cur_indexbuffer = ib; - _sg.mtl.state_cache.cur_indexbuffer_offset = ib_offset; - if (ib) { - SOKOL_ASSERT(pip->cmn.index_type != SG_INDEXTYPE_NONE); - _sg.mtl.state_cache.cur_indexbuffer_id.id = ib->slot.id; + _sg.mtl.state_cache.cur_indexbuffer = bnd->ib; + _sg.mtl.state_cache.cur_indexbuffer_offset = bnd->ib_offset; + if (bnd->ib) { + SOKOL_ASSERT(bnd->pip->cmn.index_type != SG_INDEXTYPE_NONE); + _sg.mtl.state_cache.cur_indexbuffer_id.id = bnd->ib->slot.id; } else { - SOKOL_ASSERT(pip->cmn.index_type == SG_INDEXTYPE_NONE); + SOKOL_ASSERT(bnd->pip->cmn.index_type == SG_INDEXTYPE_NONE); _sg.mtl.state_cache.cur_indexbuffer_id.id = SG_INVALID_ID; } // apply vertex buffers - for (NSUInteger slot = 0; slot < (NSUInteger)num_vbs; slot++) { - const _sg_buffer_t* vb = vbs[slot]; + for (NSUInteger slot = 0; slot < (NSUInteger)bnd->num_vbs; slot++) { + const _sg_buffer_t* vb = bnd->vbs[slot]; + const int vb_offset = bnd->vb_offsets[slot]; if ((_sg.mtl.state_cache.cur_vertexbuffer_ids[slot].id != vb->slot.id) || - (_sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] != vb_offsets[slot])) + (_sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] != vb_offset)) { _sg.mtl.state_cache.cur_vertexbuffers[slot] = vb; - _sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] = vb_offsets[slot]; + _sg.mtl.state_cache.cur_vertexbuffer_offsets[slot] = vb_offset; _sg.mtl.state_cache.cur_vertexbuffer_ids[slot].id = vb->slot.id; const NSUInteger mtl_slot = SG_MAX_SHADERSTAGE_UBS + slot; SOKOL_ASSERT(vb->mtl.buf[vb->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setVertexBuffer:_sg_mtl_id(vb->mtl.buf[vb->cmn.active_slot]) - offset:(NSUInteger)vb_offsets[slot] + offset:(NSUInteger)vb_offset atIndex:mtl_slot]; } } // apply vertex shader images - for (NSUInteger slot = 0; slot < (NSUInteger)num_vs_imgs; slot++) { - const _sg_image_t* img = vs_imgs[slot]; + for (NSUInteger slot = 0; slot < (NSUInteger)bnd->num_vs_imgs; slot++) { + const _sg_image_t* img = bnd->vs_imgs[slot]; if (_sg.mtl.state_cache.cur_vs_image_ids[slot].id != img->slot.id) { _sg.mtl.state_cache.cur_vs_images[slot] = img; _sg.mtl.state_cache.cur_vs_image_ids[slot].id = img->slot.id; @@ -11874,20 +11852,9 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings( } } - // apply fragment shader images - for (NSUInteger slot = 0; slot < (NSUInteger)num_fs_imgs; slot++) { - const _sg_image_t* img = fs_imgs[slot]; - if (_sg.mtl.state_cache.cur_fs_image_ids[slot].id != img->slot.id) { - _sg.mtl.state_cache.cur_fs_images[slot] = img; - _sg.mtl.state_cache.cur_fs_image_ids[slot].id = img->slot.id; - SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); - [_sg.mtl.cmd_encoder setFragmentTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; - } - } - // apply vertex shader samplers - for (NSUInteger slot = 0; slot < (NSUInteger)num_vs_smps; slot++) { - const _sg_sampler_t* smp = vs_smps[slot]; + for (NSUInteger slot = 0; slot < (NSUInteger)bnd->num_vs_smps; slot++) { + const _sg_sampler_t* smp = bnd->vs_smps[slot]; if (_sg.mtl.state_cache.cur_vs_sampler_ids[slot].id != smp->slot.id) { _sg.mtl.state_cache.cur_vs_samplers[slot] = smp; _sg.mtl.state_cache.cur_vs_sampler_ids[slot].id = smp->slot.id; @@ -11896,9 +11863,20 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings( } } + // apply fragment shader images + for (NSUInteger slot = 0; slot < (NSUInteger)bnd->num_fs_imgs; slot++) { + const _sg_image_t* img = bnd->fs_imgs[slot]; + if (_sg.mtl.state_cache.cur_fs_image_ids[slot].id != img->slot.id) { + _sg.mtl.state_cache.cur_fs_images[slot] = img; + _sg.mtl.state_cache.cur_fs_image_ids[slot].id = img->slot.id; + SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); + [_sg.mtl.cmd_encoder setFragmentTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; + } + } + // apply fragment shader samplers - for (NSUInteger slot = 0; slot < (NSUInteger)num_fs_smps; slot++) { - const _sg_sampler_t* smp = fs_smps[slot]; + for (NSUInteger slot = 0; slot < (NSUInteger)bnd->num_fs_smps; slot++) { + const _sg_sampler_t* smp = bnd->fs_smps[slot]; if (_sg.mtl.state_cache.cur_fs_sampler_ids[slot].id != smp->slot.id) { _sg.mtl.state_cache.cur_fs_samplers[slot] = smp; _sg.mtl.state_cache.cur_fs_sampler_ids[slot].id = smp->slot.id; @@ -12631,41 +12609,36 @@ _SOKOL_PRIVATE uint64_t _sg_wgpu_hash(void* ptr, size_t num_bytes) { return 0; } -_SOKOL_PRIVATE void _sg_wgpu_init_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* key, - _sg_pipeline_t* pip, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - SOKOL_ASSERT(pip); - SOKOL_ASSERT(vs_imgs && (num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); - SOKOL_ASSERT(vs_smps && (num_vs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); - SOKOL_ASSERT(fs_imgs && (num_fs_imgs <= SG_MAX_SHADERSTAGE_IMAGES)); - SOKOL_ASSERT(fs_smps && (num_fs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS)); +_SOKOL_PRIVATE void _sg_wgpu_init_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* key, const _sg_bindings_t* bnd) { + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip); + SOKOL_ASSERT(bnd->num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES); + SOKOL_ASSERT(bnd->num_vs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS); + SOKOL_ASSERT(bnd->num_fs_imgs <= SG_MAX_SHADERSTAGE_IMAGES); + SOKOL_ASSERT(bnd->num_fs_smps <= SG_MAX_SHADERSTAGE_SAMPLERS); _sg_clear(key->items, sizeof(key->items)); - key->items[0] = pip->slot.id; + key->items[0] = bnd->pip->slot.id; const int vs_imgs_offset = 1; const int vs_smps_offset = vs_imgs_offset + SG_MAX_SHADERSTAGE_IMAGES; const int fs_imgs_offset = vs_smps_offset + SG_MAX_SHADERSTAGE_SAMPLERS; const int fs_smps_offset = fs_imgs_offset + SG_MAX_SHADERSTAGE_IMAGES; SOKOL_ASSERT((fs_smps_offset + SG_MAX_SHADERSTAGE_SAMPLERS) == _SG_WGPU_BINDGROUPSCACHE_NUM_ITEMS); - for (int i = 0; i < num_vs_imgs; i++) { - SOKOL_ASSERT(vs_imgs[i]); - key->items[vs_imgs_offset + i] = vs_imgs[i]->slot.id; + for (int i = 0; i < bnd->num_vs_imgs; i++) { + SOKOL_ASSERT(bnd->vs_imgs[i]); + key->items[vs_imgs_offset + i] = bnd->vs_imgs[i]->slot.id; } - for (int i = 0; i < num_vs_smps; i++) { - SOKOL_ASSERT(vs_smps[i]); - key->items[vs_smps_offset + i] = vs_smps[i]->slot.id; + for (int i = 0; i < bnd->num_vs_smps; i++) { + SOKOL_ASSERT(bnd->vs_smps[i]); + key->items[vs_smps_offset + i] = bnd->vs_smps[i]->slot.id; } - for (int i = 0; i < num_fs_imgs; i++) { - SOKOL_ASSERT(fs_imgs[i]); - key->items[fs_imgs_offset + i] = fs_imgs[i]->slot.id; + for (int i = 0; i < bnd->num_fs_imgs; i++) { + SOKOL_ASSERT(bnd->fs_imgs[i]); + key->items[fs_imgs_offset + i] = bnd->fs_imgs[i]->slot.id; } - for (int i = 0; i < num_fs_smps; i++) { - SOKOL_ASSERT(fs_smps[i]); - key->items[fs_smps_offset + i] = fs_smps[i]->slot.id; + for (int i = 0; i < bnd->num_fs_smps; i++) { + SOKOL_ASSERT(bnd->fs_smps[i]); + key->items[fs_smps_offset + i] = bnd->fs_smps[i]->slot.id; } key->hash = _sg_wgpu_hash(&key->items, sizeof(key->items)); } @@ -12681,16 +12654,10 @@ _SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroupscache_key(_sg_wgpu_bindgroupscach return true; } -_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup( - _sg_pipeline_t* pip, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* bnd) { SOKOL_ASSERT(_sg.wgpu.dev); - SOKOL_ASSERT(pip); - SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); + SOKOL_ASSERT(bnd->pip); + SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(&_sg.wgpu.bindgroups_pool); if (bg_id.id == SG_INVALID_ID) { return 0; @@ -12699,30 +12666,30 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup( SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_ALLOC)); // create wgpu bindgroup object - WGPUBindGroupLayout bgl = pip->shader->wgpu.bind_group_layout; + WGPUBindGroupLayout bgl = bnd->pip->shader->wgpu.bind_group_layout; SOKOL_ASSERT(bgl); WGPUBindGroupEntry wgpu_entries[SG_NUM_SHADER_STAGES * SG_MAX_SHADERSTAGE_IMAGES + SG_MAX_SHADERSTAGE_SAMPLERS]; _sg_clear(&wgpu_entries, sizeof(wgpu_entries)); int bge_index = 0; - for (int i = 0; i < num_vs_imgs; i++) { + for (int i = 0; i < bnd->num_vs_imgs; i++) { WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_VS, i); - wgpu_entry->textureView = vs_imgs[i]->wgpu.view; + wgpu_entry->textureView = bnd->vs_imgs[i]->wgpu.view; } - for (int i = 0; i < num_vs_smps; i++) { + for (int i = 0; i < bnd->num_vs_smps; i++) { WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_VS, i); - wgpu_entry->sampler = vs_smps[i]->wgpu.smp; + wgpu_entry->sampler = bnd->vs_smps[i]->wgpu.smp; } - for (int i = 0; i < num_fs_imgs; i++) { + for (int i = 0; i < bnd->num_fs_imgs; i++) { WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; wgpu_entry->binding = _sg_wgpu_image_binding(SG_SHADERSTAGE_FS, i); - wgpu_entry->textureView = fs_imgs[i]->wgpu.view; + wgpu_entry->textureView = bnd->fs_imgs[i]->wgpu.view; } - for (int i = 0; i < num_fs_smps; i++) { + for (int i = 0; i < bnd->num_fs_smps; i++) { WGPUBindGroupEntry* wgpu_entry = &wgpu_entries[bge_index++]; wgpu_entry->binding = _sg_wgpu_sampler_binding(SG_SHADERSTAGE_FS, i); - wgpu_entry->sampler = fs_smps[i]->wgpu.smp; + wgpu_entry->sampler = bnd->fs_smps[i]->wgpu.smp; } WGPUBindGroupDescriptor bg_desc; _sg_clear(&bg_desc, sizeof(bg_desc)); @@ -12736,7 +12703,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup( return bg; } - _sg_wgpu_init_bindgroupscache_key(&bg->key, pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + _sg_wgpu_init_bindgroupscache_key(&bg->key, bnd); bg->slot.state = SG_RESOURCESTATE_VALID; return bg; @@ -12793,16 +12760,10 @@ _SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_ _sg.wgpu.bindings_cache.ib.offset = ib_offset; } -_SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup( - _sg_pipeline_t* pip, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ - if ((num_vs_imgs + num_vs_smps + num_fs_imgs + num_fs_smps) > 0) { +_SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { + if ((bnd->num_vs_imgs + bnd->num_vs_smps + bnd->num_fs_imgs + bnd->num_fs_smps) > 0) { // FIXME: use bindgroups cache! - _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(bnd); if (bg) { if (bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); @@ -13608,48 +13569,41 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_pipeline(_sg_pipeline_t* pip) { wgpuRenderPassEncoderSetStencilReference(_sg.wgpu.pass_enc, pip->cmn.stencil.ref); } -_SOKOL_PRIVATE bool _sg_wgpu_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ +_SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - SOKOL_ASSERT(pip->shader && (pip->cmn.shader_id.id == pip->shader->slot.id)); + SOKOL_ASSERT(bnd); + SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); bool retval = true; // index buffer - if (ib) { - if (_sg_wgpu_bindcache_ib_dirty(ib, ib_offset)) { - _sg_wgpu_bindcache_ib_update(ib, ib_offset); - const WGPUIndexFormat format = _sg_wgpu_indexformat(pip->cmn.index_type); - const uint64_t buf_size = (uint64_t)ib->cmn.size; - const uint64_t offset = (uint64_t)ib_offset; + if (bnd->ib) { + if (_sg_wgpu_bindcache_ib_dirty(bnd->ib, bnd->ib_offset)) { + _sg_wgpu_bindcache_ib_update(bnd->ib, bnd->ib_offset); + const WGPUIndexFormat format = _sg_wgpu_indexformat(bnd->pip->cmn.index_type); + const uint64_t buf_size = (uint64_t)bnd->ib->cmn.size; + const uint64_t offset = (uint64_t)bnd->ib_offset; SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, ib->wgpu.buf, format, offset, max_bytes); + wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); } } // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) // vertex buffers - for (int slot = 0; slot < num_vbs; slot++) { - if (_sg_wgpu_bindcache_vb_dirty(slot, vbs[slot], vb_offsets[slot])) { - _sg_wgpu_bindcache_vb_update(slot, vbs[slot], vb_offsets[slot]); - const uint64_t buf_size = (uint64_t)vbs[slot]->cmn.size; - const uint64_t offset = (uint64_t)vb_offsets[slot]; + for (int slot = 0; slot < bnd->num_vbs; slot++) { + if (_sg_wgpu_bindcache_vb_dirty(slot, bnd->vbs[slot], bnd->vb_offsets[slot])) { + _sg_wgpu_bindcache_vb_update(slot, bnd->vbs[slot], bnd->vb_offsets[slot]); + const uint64_t buf_size = (uint64_t)bnd->vbs[slot]->cmn.size; + const uint64_t offset = (uint64_t)bnd->vb_offsets[slot]; SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, vbs[slot]->wgpu.buf, offset, max_bytes); + wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); } // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } - _sg_wgpu_apply_bindgroup(pip, vs_imgs, num_vs_imgs, vs_smps, num_vs_smps, fs_imgs, num_fs_imgs, fs_smps, num_fs_smps); + _sg_wgpu_apply_bindgroup(bnd); return retval; } @@ -14130,25 +14084,17 @@ static inline void _sg_apply_pipeline(_sg_pipeline_t* pip) { #endif } -static inline bool _sg_apply_bindings( - _sg_pipeline_t* pip, - _sg_buffer_t** vbs, const int* vb_offsets, int num_vbs, - _sg_buffer_t* ib, int ib_offset, - _sg_image_t** vs_imgs, int num_vs_imgs, - _sg_image_t** fs_imgs, int num_fs_imgs, - _sg_sampler_t** vs_smps, int num_vs_smps, - _sg_sampler_t** fs_smps, int num_fs_smps) -{ +static inline bool _sg_apply_bindings(_sg_bindings_t* bnd) { #if defined(_SOKOL_ANY_GL) - return _sg_gl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_gl_apply_bindings(bnd); #elif defined(SOKOL_METAL) - return _sg_mtl_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_mtl_apply_bindings(bnd); #elif defined(SOKOL_D3D11) - return _sg_d3d11_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_d3d11_apply_bindings(bnd); #elif defined(SOKOL_WGPU) - return _sg_wgpu_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_wgpu_apply_bindings(bnd); #elif defined(SOKOL_DUMMY_BACKEND) - return _sg_dummy_apply_bindings(pip, vbs, vb_offsets, num_vbs, ib, ib_offset, vs_imgs, num_vs_imgs, fs_imgs, num_fs_imgs, vs_smps, num_vs_smps, fs_smps, num_fs_smps); + return _sg_dummy_apply_bindings(bnd); #else #error("INVALID BACKEND"); #endif @@ -16869,7 +16815,7 @@ SOKOL_API_IMPL void sg_apply_scissor_rectf(float x, float y, float width, float SOKOL_API_IMPL void sg_apply_pipeline(sg_pipeline pip_id) { SOKOL_ASSERT(_sg.valid); - _sg.bindings_valid = false; + _sg.bindings_applied = false; if (!_sg_validate_apply_pipeline(pip_id)) { _sg.next_draw_valid = false; return; @@ -16894,91 +16840,95 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { _sg.next_draw_valid = false; return; } - _sg.bindings_valid = true; + _sg.bindings_applied = true; - _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, _sg.cur_pipeline.id); - SOKOL_ASSERT(pip); + _sg_bindings_t bnd; + _sg_clear(&bnd, sizeof(bnd)); + bnd.pip = _sg_lookup_pipeline(&_sg.pools, _sg.cur_pipeline.id); + if (0 == bnd.pip) { + _sg.next_draw_valid = false; + } - _sg_buffer_t* vbs[SG_MAX_VERTEX_BUFFERS] = { 0 }; - int num_vbs = 0; - for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++, num_vbs++) { + for (int i = 0; i < SG_MAX_VERTEX_BUFFERS; i++, bnd.num_vbs++) { if (bindings->vertex_buffers[i].id) { - vbs[i] = _sg_lookup_buffer(&_sg.pools, bindings->vertex_buffers[i].id); - SOKOL_ASSERT(vbs[i]); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vbs[i]->slot.state); - _sg.next_draw_valid &= !vbs[i]->cmn.append_overflow; + bnd.vbs[i] = _sg_lookup_buffer(&_sg.pools, bindings->vertex_buffers[i].id); + bnd.vb_offsets[i] = bindings->vertex_buffer_offsets[i]; + if (bnd.vbs[i]) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.vbs[i]->slot.state); + _sg.next_draw_valid &= !bnd.vbs[i]->cmn.append_overflow; + } else { + _sg.next_draw_valid = false; + } } else { break; } } - _sg_buffer_t* ib = 0; if (bindings->index_buffer.id) { - ib = _sg_lookup_buffer(&_sg.pools, bindings->index_buffer.id); - SOKOL_ASSERT(ib); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == ib->slot.state); - _sg.next_draw_valid &= !ib->cmn.append_overflow; + bnd.ib = _sg_lookup_buffer(&_sg.pools, bindings->index_buffer.id); + bnd.ib_offset = bindings->index_buffer_offset; + if (bnd.ib) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.ib->slot.state); + _sg.next_draw_valid &= !bnd.ib->cmn.append_overflow; + } else { + _sg.next_draw_valid = false; + } } - _sg_image_t* vs_imgs[SG_MAX_SHADERSTAGE_IMAGES] = { 0 }; - int num_vs_imgs = 0; - for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, num_vs_imgs++) { + for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, bnd.num_vs_imgs++) { if (bindings->vs.images[i].id) { - vs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); - SOKOL_ASSERT(vs_imgs[i]); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vs_imgs[i]->slot.state); + bnd.vs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->vs.images[i].id); + if (bnd.vs_imgs[i]) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.vs_imgs[i]->slot.state); + } else { + _sg.next_draw_valid = false; + } } else { break; } } - _sg_image_t* fs_imgs[SG_MAX_SHADERSTAGE_IMAGES] = { 0 }; - int num_fs_imgs = 0; - for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, num_fs_imgs++) { - if (bindings->fs.images[i].id) { - fs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); - SOKOL_ASSERT(fs_imgs[i]); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == fs_imgs[i]->slot.state); + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, bnd.num_vs_smps++) { + if (bindings->vs.samplers[i].id) { + bnd.vs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); + if (bnd.vs_smps[i]) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.vs_smps[i]->slot.state); + } else { + _sg.next_draw_valid = false; + } } else { break; } } - _sg_sampler_t* vs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = { 0 }; - int num_vs_smps = 0; - for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, num_vs_smps++) { - if (bindings->vs.samplers[i].id) { - vs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[i].id); - SOKOL_ASSERT(vs_smps[i]); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == vs_smps[i]->slot.state); + for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++, bnd.num_fs_imgs++) { + if (bindings->fs.images[i].id) { + bnd.fs_imgs[i] = _sg_lookup_image(&_sg.pools, bindings->fs.images[i].id); + if (bnd.fs_imgs[i]) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.fs_imgs[i]->slot.state); + } else { + _sg.next_draw_valid = false; + } } else { break; } } - _sg_sampler_t* fs_smps[SG_MAX_SHADERSTAGE_SAMPLERS] = { 0 }; - int num_fs_smps = 0; - for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, num_fs_smps++) { + for (int i = 0; i < SG_MAX_SHADERSTAGE_SAMPLERS; i++, bnd.num_fs_smps++) { if (bindings->fs.samplers[i].id) { - fs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); - SOKOL_ASSERT(fs_smps[i]); - _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == fs_smps[i]->slot.state); + bnd.fs_smps[i] = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[i].id); + if (bnd.fs_smps[i]) { + _sg.next_draw_valid &= (SG_RESOURCESTATE_VALID == bnd.fs_smps[i]->slot.state); + } else { + _sg.next_draw_valid = false; + } } else { break; } } if (_sg.next_draw_valid) { - const int* vb_offsets = bindings->vertex_buffer_offsets; - int ib_offset = bindings->index_buffer_offset; - _sg.next_draw_valid = _sg_apply_bindings( - pip, - vbs, vb_offsets, num_vbs, - ib, ib_offset, - vs_imgs, num_vs_imgs, - fs_imgs, num_fs_imgs, - vs_smps, num_vs_smps, - fs_smps, num_fs_smps); + _sg.next_draw_valid &= _sg_apply_bindings(&bnd); _SG_TRACE_ARGS(apply_bindings, bindings); } } @@ -17008,7 +16958,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_ASSERT(num_elements >= 0); SOKOL_ASSERT(num_instances >= 0); #if defined(SOKOL_DEBUG) - if (!_sg.bindings_valid) { + if (!_sg.bindings_applied) { _SG_WARN(DRAW_WITHOUT_BINDINGS); } #endif @@ -17018,7 +16968,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance if (!_sg.next_draw_valid) { return; } - if (!_sg.bindings_valid) { + if (!_sg.bindings_applied) { return; } /* attempting to draw with zero elements or instances is not technically an From 60cb9f409553c3473090a0cb203a87d7afb38aa0 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 30 Sep 2023 13:44:49 +0200 Subject: [PATCH 221/292] sokol_gfx.h d3d11: fix compile errors --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index c453a6cad..0bdefcd5c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -10134,7 +10134,7 @@ _SOKOL_PRIVATE bool _sg_d3d11_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(_sg.d3d11.in_pass); // gather all the D3D11 resources into arrays - ID3D11Buffer* d3d11_ib = bnd->ib ? ib->d3d11.buf : 0; + ID3D11Buffer* d3d11_ib = bnd->ib ? bnd->ib->d3d11.buf : 0; ID3D11Buffer* d3d11_vbs[SG_MAX_VERTEX_BUFFERS] = {0}; UINT d3d11_vb_offsets[SG_MAX_VERTEX_BUFFERS] = {0}; ID3D11ShaderResourceView* d3d11_vs_srvs[SG_MAX_SHADERSTAGE_IMAGES] = {0}; @@ -10163,7 +10163,7 @@ _SOKOL_PRIVATE bool _sg_d3d11_apply_bindings(_sg_bindings_t* bnd) { d3d11_fs_smps[i] = bnd->fs_smps[i]->d3d11.smp; } _sg_d3d11_IASetVertexBuffers(_sg.d3d11.ctx, 0, SG_MAX_VERTEX_BUFFERS, d3d11_vbs, bnd->pip->d3d11.vb_strides, d3d11_vb_offsets); - _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, pip->d3d11.index_format, (UINT)bnd->ib_offset); + _sg_d3d11_IASetIndexBuffer(_sg.d3d11.ctx, d3d11_ib, bnd->pip->d3d11.index_format, (UINT)bnd->ib_offset); _sg_d3d11_VSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_vs_srvs); _sg_d3d11_PSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_srvs); _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_vs_smps); From 7e15e72639e6f2b5d636072e0866cb63a4fbd44c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 30 Sep 2023 17:38:40 +0200 Subject: [PATCH 222/292] sokol_gfx.h wgpu: implement bindgroups cache --- sokol_gfx.h | 188 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 150 insertions(+), 38 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 0bdefcd5c..adf860bd8 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2904,7 +2904,9 @@ typedef struct sg_pass_info { _SG_LOGITEM_XMACRO(METAL_FRAGMENT_SHADER_ENTRY_NOT_FOUND, "fragment shader entry not found (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_FAILED, "failed to create render pipeline state (metal)") \ _SG_LOGITEM_XMACRO(METAL_CREATE_RPS_OUTPUT, "") \ - _SG_LOGITEM_XMACRO(WGPU_BINDGROUPS_POOL_EXHAUSTED, "wgpu BindGroups pool exhausted (increase sg_desc.bindgroups_cache_size)") \ + _SG_LOGITEM_XMACRO(WGPU_BINDGROUPS_POOL_EXHAUSTED, "bindgroups pool exhausted (increase sg_desc.bindgroups_cache_size) (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_BINDGROUPSCACHE_SIZE_GREATER_ONE, "sg_desc.wgpu_bindgroups_cache_size must be > 1 (wgpu)") \ + _SG_LOGITEM_XMACRO(WGPU_BINDGROUPSCACHE_SIZE_POW2, "sg_desc.wgpu_bindgroups_cache_size must be a power of 2 (wgpu)") \ _SG_LOGITEM_XMACRO(WGPU_CREATEBINDGROUP_FAILED, "wgpuDeviceCreateBindGroup failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_BUFFER_FAILED, "wgpuDeviceCreateBuffer() failed") \ _SG_LOGITEM_XMACRO(WGPU_CREATE_TEXTURE_FAILED, "wgpuDeviceCreateTexture() failed") \ @@ -4070,6 +4072,7 @@ typedef struct { #define _sg_max(a,b) (((a)>(b))?(a):(b)) #define _sg_clamp(v,v0,v1) (((v)<(v0))?(v0):(((v)>(v1))?(v1):(v))) #define _sg_fequal(val,cmp,delta) ((((val)-(cmp))> -(delta))&&(((val)-(cmp))<(delta))) +#define _sg_ispow2(val) ((val&(val-1))==0) _SOKOL_PRIVATE void* _sg_malloc_clear(size_t size); _SOKOL_PRIVATE void _sg_free(void* ptr); @@ -4935,18 +4938,18 @@ typedef struct { typedef struct { uint64_t hash; uint32_t items[_SG_WGPU_BINDGROUPSCACHE_NUM_ITEMS]; -} _sg_wgpu_bindgroupscache_key_t; +} _sg_wgpu_bindgroups_cache_key_t; typedef struct { - size_t num; // must be 2^n - uint64_t index_mask; // mask to turn hash into valid index + uint32_t num; // must be 2^n + uint32_t index_mask; // mask to turn hash into valid index _sg_wgpu_bindgroup_handle_t* items; } _sg_wgpu_bindgroups_cache_t; typedef struct { _sg_slot_t slot; WGPUBindGroup bindgroup; - _sg_wgpu_bindgroupscache_key_t key; + _sg_wgpu_bindgroups_cache_key_t key; } _sg_wgpu_bindgroup_t; typedef struct { @@ -4963,7 +4966,6 @@ typedef struct { sg_buffer buffer; int offset; } ib; - _sg_wgpu_bindgroup_handle_t bindgroup; } _sg_wgpu_bindings_cache_t; // the WGPU backend state @@ -4990,7 +4992,7 @@ typedef struct { sg_pipeline cur_pipeline_id; _sg_wgpu_uniform_buffer_t uniform; _sg_wgpu_bindings_cache_t bindings_cache; - _sg_wgpu_bindgroups_cache_t bingroups_cache; + _sg_wgpu_bindgroups_cache_t bindgroups_cache; _sg_wgpu_bindgroups_pool_t bindgroups_pool; } _sg_wgpu_backend_t; #endif @@ -12547,29 +12549,32 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { _SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_init(const sg_desc* desc) { SOKOL_ASSERT((desc->wgpu_bindgroups_cache_size > 0) && (desc->wgpu_bindgroups_cache_size < _SG_MAX_POOL_SIZE)); - SOKOL_ASSERT(0 == _sg.wgpu.bindgroups_pool.bindgroups); + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; + SOKOL_ASSERT(0 == p->bindgroups); const int pool_size = desc->wgpu_bindgroups_cache_size; - _sg_init_pool(&_sg.wgpu.bindgroups_pool.pool, pool_size); + _sg_init_pool(&p->pool, pool_size); size_t pool_byte_size = sizeof(_sg_wgpu_bindgroup_t) * (size_t)pool_size; - _sg.wgpu.bindgroups_pool.bindgroups = _sg_malloc_clear(pool_byte_size); + p->bindgroups = _sg_malloc_clear(pool_byte_size); } -_SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_discard(_sg_wgpu_bindgroups_pool_t* p) { - SOKOL_ASSERT(p && p->bindgroups); +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_discard(void) { + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; + SOKOL_ASSERT(p->bindgroups); _sg_free(p->bindgroups); p->bindgroups = 0; _sg_discard_pool(&p->pool); } -_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_bindgroup_at(_sg_wgpu_bindgroups_pool_t* p, uint32_t bg_id) { - SOKOL_ASSERT(p && (SG_INVALID_ID != bg_id)); +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_bindgroup_at(uint32_t bg_id) { + SOKOL_ASSERT(SG_INVALID_ID != bg_id); + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; int slot_index = _sg_slot_index(bg_id); SOKOL_ASSERT((slot_index > _SG_INVALID_SLOT_INDEX) && (slot_index < p->pool.size)); return &p->bindgroups[slot_index]; } -_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_lookup_bindgroup(_sg_wgpu_bindgroups_pool_t* p, uint32_t bg_id) { +_SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_lookup_bindgroup(uint32_t bg_id) { if (SG_INVALID_ID != bg_id) { - _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(p, bg_id); + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(bg_id); if (bg->slot.id == bg_id) { return bg; } @@ -12577,7 +12582,8 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_lookup_bindgroup(_sg_wgpu_bindgrou return 0; } -_SOKOL_PRIVATE _sg_wgpu_bindgroup_handle_t _sg_wgpu_alloc_bindgroup(_sg_wgpu_bindgroups_pool_t* p) { +_SOKOL_PRIVATE _sg_wgpu_bindgroup_handle_t _sg_wgpu_alloc_bindgroup(void) { + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; _sg_wgpu_bindgroup_handle_t res; int slot_index = _sg_pool_alloc_index(&p->pool); if (_SG_INVALID_SLOT_INDEX != slot_index) { @@ -12589,8 +12595,9 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_handle_t _sg_wgpu_alloc_bindgroup(_sg_wgpu_bin return res; } -_SOKOL_PRIVATE void _sg_wgpu_dealloc_bindgroup(_sg_wgpu_bindgroups_pool_t* p, _sg_wgpu_bindgroup_t* bg) { +_SOKOL_PRIVATE void _sg_wgpu_dealloc_bindgroup(_sg_wgpu_bindgroup_t* bg) { SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_ALLOC) && (bg->slot.id != SG_INVALID_ID)); + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; _sg_pool_free_index(&p->pool, _sg_slot_index(bg->slot.id)); _sg_reset_slot(&bg->slot); } @@ -12603,13 +12610,45 @@ _SOKOL_PRIVATE void _sg_wgpu_reset_bindgroup_to_alloc_state(_sg_wgpu_bindgroup_t bg->slot.state = SG_RESOURCESTATE_ALLOC; } -_SOKOL_PRIVATE uint64_t _sg_wgpu_hash(void* ptr, size_t num_bytes) { - // FIXME! - (void)ptr; (void)num_bytes; - return 0; +// MurmurHash64B (see: https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L142) +_SOKOL_PRIVATE uint64_t _sg_wgpu_hash(const void* key, int len, uint64_t seed) { + const uint32_t m = 0x5bd1e995; + const int r = 24; + uint32_t h1 = (uint32_t)seed ^ (uint32_t)len; + uint32_t h2 = (uint32_t)(seed >> 32); + const uint32_t * data = (const uint32_t *)key; + while (len >= 8) { + uint32_t k1 = *data++; + k1 *= m; k1 ^= k1 >> r; k1 *= m; + h1 *= m; h1 ^= k1; + len -= 4; + uint32_t k2 = *data++; + k2 *= m; k2 ^= k2 >> r; k2 *= m; + h2 *= m; h2 ^= k2; + len -= 4; + } + if (len >= 4) { + uint32_t k1 = *data++; + k1 *= m; k1 ^= k1 >> r; k1 *= m; + h1 *= m; h1 ^= k1; + len -= 4; + } + switch(len) { + case 3: h2 ^= (uint32_t)(((unsigned char*)data)[2] << 16); + case 2: h2 ^= (uint32_t)(((unsigned char*)data)[1] << 8); + case 1: h2 ^= ((unsigned char*)data)[0]; + h2 *= m; + }; + h1 ^= h2 >> 18; h1 *= m; + h2 ^= h1 >> 22; h2 *= m; + h1 ^= h2 >> 17; h1 *= m; + h2 ^= h1 >> 19; h2 *= m; + uint64_t h = h1; + h = (h << 32) | h2; + return h; } -_SOKOL_PRIVATE void _sg_wgpu_init_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* key, const _sg_bindings_t* bnd) { +_SOKOL_PRIVATE void _sg_wgpu_init_bindgroups_cache_key(_sg_wgpu_bindgroups_cache_key_t* key, const _sg_bindings_t* bnd) { SOKOL_ASSERT(bnd); SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(bnd->num_vs_imgs <= SG_MAX_SHADERSTAGE_IMAGES); @@ -12640,10 +12679,10 @@ _SOKOL_PRIVATE void _sg_wgpu_init_bindgroupscache_key(_sg_wgpu_bindgroupscache_k SOKOL_ASSERT(bnd->fs_smps[i]); key->items[fs_smps_offset + i] = bnd->fs_smps[i]->slot.id; } - key->hash = _sg_wgpu_hash(&key->items, sizeof(key->items)); + key->hash = _sg_wgpu_hash(&key->items, (int)sizeof(key->items), 0x1234567887654321); } -_SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroupscache_key(_sg_wgpu_bindgroupscache_key_t* k0, _sg_wgpu_bindgroupscache_key_t* k1) { +_SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroups_cache_key(_sg_wgpu_bindgroups_cache_key_t* k0, _sg_wgpu_bindgroups_cache_key_t* k1) { SOKOL_ASSERT(k0 && k1); if (k0->hash != k1->hash) { return false; @@ -12658,11 +12697,11 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); - _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(&_sg.wgpu.bindgroups_pool); + _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(); if (bg_id.id == SG_INVALID_ID) { return 0; } - _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(&_sg.wgpu.bindgroups_pool, bg_id.id); + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_bindgroup_at(bg_id.id); SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_ALLOC)); // create wgpu bindgroup object @@ -12703,7 +12742,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b return bg; } - _sg_wgpu_init_bindgroupscache_key(&bg->key, bnd); + _sg_wgpu_init_bindgroups_cache_key(&bg->key, bnd); bg->slot.state = SG_RESOURCESTATE_VALID; return bg; @@ -12720,12 +12759,13 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { SOKOL_ASSERT(bg->slot.state == SG_RESOURCESTATE_ALLOC); } if (bg->slot.state == SG_RESOURCESTATE_ALLOC) { - _sg_wgpu_dealloc_bindgroup(&_sg.wgpu.bindgroups_pool, bg); + _sg_wgpu_dealloc_bindgroup(bg); SOKOL_ASSERT(bg->slot.state == SG_RESOURCESTATE_INITIAL); } } -_SOKOL_PRIVATE void _sg_wgpu_discard_all_bindgroups(_sg_wgpu_bindgroups_pool_t* p) { +_SOKOL_PRIVATE void _sg_wgpu_discard_all_bindgroups(void) { + _sg_wgpu_bindgroups_pool_t* p = &_sg.wgpu.bindgroups_pool; for (int i = 0; i < p->pool.size; i++) { sg_resource_state state = p->bindgroups[i].slot.state; if ((state == SG_RESOURCESTATE_VALID) || (state == SG_RESOURCESTATE_FAILED)) { @@ -12734,6 +12774,47 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_all_bindgroups(_sg_wgpu_bindgroups_pool_t* } } +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_cache_init(const sg_desc* desc) { + SOKOL_ASSERT(desc); + SOKOL_ASSERT(_sg.wgpu.bindgroups_cache.num == 0); + SOKOL_ASSERT(_sg.wgpu.bindgroups_cache.index_mask == 0); + SOKOL_ASSERT(_sg.wgpu.bindgroups_cache.items == 0); + const int num = desc->wgpu_bindgroups_cache_size; + if (num <= 1) { + _SG_PANIC(WGPU_BINDGROUPSCACHE_SIZE_GREATER_ONE); + } + if (!_sg_ispow2(num)) { + _SG_PANIC(WGPU_BINDGROUPSCACHE_SIZE_POW2); + } + _sg.wgpu.bindgroups_cache.num = (uint32_t)desc->wgpu_bindgroups_cache_size; + _sg.wgpu.bindgroups_cache.index_mask = _sg.wgpu.bindgroups_cache.num - 1; + size_t size_in_bytes = sizeof(_sg_wgpu_bindgroup_handle_t) * (size_t)num; + _sg.wgpu.bindgroups_cache.items = _sg_malloc_clear(size_in_bytes); +} + +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_cache_discard(void) { + if (_sg.wgpu.bindgroups_cache.items) { + _sg_free(_sg.wgpu.bindgroups_cache.items); + _sg.wgpu.bindgroups_cache.items = 0; + } + _sg.wgpu.bindgroups_cache.num = 0; + _sg.wgpu.bindgroups_cache.index_mask = 0; +} + +_SOKOL_PRIVATE void _sg_wgpu_bindgroups_cache_set(uint64_t hash, uint32_t bg_id) { + uint32_t index = hash & _sg.wgpu.bindgroups_cache.index_mask; + SOKOL_ASSERT(index < _sg.wgpu.bindgroups_cache.num); + SOKOL_ASSERT(_sg.wgpu.bindgroups_cache.items); + _sg.wgpu.bindgroups_cache.items[index].id = bg_id; +} + +_SOKOL_PRIVATE uint32_t _sg_wgpu_bindgroups_cache_get(uint64_t hash) { + uint32_t index = hash & _sg.wgpu.bindgroups_cache.index_mask; + SOKOL_ASSERT(index < _sg.wgpu.bindgroups_cache.num); + SOKOL_ASSERT(_sg.wgpu.bindgroups_cache.items); + return _sg.wgpu.bindgroups_cache.items[index].id; +} + _SOKOL_PRIVATE void _sg_wgpu_bindcache_clear(void) { memset(&_sg.wgpu.bindings_cache, 0, sizeof(_sg.wgpu.bindings_cache)); } @@ -12762,16 +12843,45 @@ _SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { if ((bnd->num_vs_imgs + bnd->num_vs_smps + bnd->num_fs_imgs + bnd->num_fs_smps) > 0) { - // FIXME: use bindgroups cache! - _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(bnd); - if (bg) { - if (bg->slot.state == SG_RESOURCESTATE_VALID) { + if (!_sg.desc.wgpu_disable_bindgroups_cache) { + _sg_wgpu_bindgroup_t* bg = 0; + _sg_wgpu_bindgroups_cache_key_t key; + _sg_wgpu_init_bindgroups_cache_key(&key, bnd); + uint32_t bg_id = _sg_wgpu_bindgroups_cache_get(key.hash); + if (bg_id != SG_INVALID_ID) { + // potential cache hit + bg = _sg_wgpu_lookup_bindgroup(bg_id); + SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_VALID)); + if (!_sg_wgpu_compare_bindgroups_cache_key(&key, &bg->key)) { + // cache collision, need to delete cached bindgroup + _sg_wgpu_discard_bindgroup(bg); + _sg_wgpu_bindgroups_cache_set(key.hash, SG_INVALID_ID); + bg = 0; + } + } + if (bg == 0) { + // either no cache entry yet, or cache collision, create new bindgroup and store in cache + bg = _sg_wgpu_create_bindgroup(bnd); + _sg_wgpu_bindgroups_cache_set(key.hash, bg->slot.id); + } + if (bg && bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + } else { + return false; } - _sg_wgpu_discard_bindgroup(bg); } else { - return false; + // bindgroups cache disabled, create and destroy bindgroup on the fly (expensive!) + _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(bnd); + if (bg) { + if (bg->slot.state == SG_RESOURCESTATE_VALID) { + SOKOL_ASSERT(bg->bindgroup); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + } + _sg_wgpu_discard_bindgroup(bg); + } else { + return false; + } } } else { wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); @@ -12803,6 +12913,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_wgpu_init_caps(); _sg_wgpu_uniform_buffer_init(desc); _sg_wgpu_bindgroups_pool_init(desc); + _sg_wgpu_bindgroups_cache_init(desc); // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -12827,8 +12938,9 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { SOKOL_ASSERT(_sg.wgpu.valid); SOKOL_ASSERT(_sg.wgpu.cmd_enc); _sg.wgpu.valid = false; - _sg_wgpu_discard_all_bindgroups(&_sg.wgpu.bindgroups_pool); - _sg_wgpu_bindgroups_pool_discard(&_sg.wgpu.bindgroups_pool); + _sg_wgpu_discard_all_bindgroups(); + _sg_wgpu_bindgroups_cache_discard(); + _sg_wgpu_bindgroups_pool_discard(); _sg_wgpu_uniform_buffer_discard(); wgpuBindGroupRelease(_sg.wgpu.empty_bind_group); _sg.wgpu.empty_bind_group = 0; wgpuCommandEncoderRelease(_sg.wgpu.cmd_enc); _sg.wgpu.cmd_enc = 0; From 1b9f90bd2b7eeb5c978a40dc1995be907a81b384 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 30 Sep 2023 19:00:49 +0200 Subject: [PATCH 223/292] sokol_gfx.h wgpu: fix C++ compile problem, and a memory corruption in the new bindgroups cache --- sokol_gfx.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index adf860bd8..1d0057f1a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12553,8 +12553,8 @@ _SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_init(const sg_desc* desc) { SOKOL_ASSERT(0 == p->bindgroups); const int pool_size = desc->wgpu_bindgroups_cache_size; _sg_init_pool(&p->pool, pool_size); - size_t pool_byte_size = sizeof(_sg_wgpu_bindgroup_t) * (size_t)pool_size; - p->bindgroups = _sg_malloc_clear(pool_byte_size); + size_t pool_byte_size = sizeof(_sg_wgpu_bindgroup_t) * (size_t)p->pool.size; + p->bindgroups = (_sg_wgpu_bindgroup_t*) _sg_malloc_clear(pool_byte_size); } _SOKOL_PRIVATE void _sg_wgpu_bindgroups_pool_discard(void) { @@ -12789,7 +12789,7 @@ _SOKOL_PRIVATE void _sg_wgpu_bindgroups_cache_init(const sg_desc* desc) { _sg.wgpu.bindgroups_cache.num = (uint32_t)desc->wgpu_bindgroups_cache_size; _sg.wgpu.bindgroups_cache.index_mask = _sg.wgpu.bindgroups_cache.num - 1; size_t size_in_bytes = sizeof(_sg_wgpu_bindgroup_handle_t) * (size_t)num; - _sg.wgpu.bindgroups_cache.items = _sg_malloc_clear(size_in_bytes); + _sg.wgpu.bindgroups_cache.items = (_sg_wgpu_bindgroup_handle_t*)_sg_malloc_clear(size_in_bytes); } _SOKOL_PRIVATE void _sg_wgpu_bindgroups_cache_discard(void) { @@ -14504,7 +14504,8 @@ _SOKOL_PRIVATE uint32_t _sg_slot_alloc(_sg_pool_t* pool, _sg_slot_t* slot, int s */ SOKOL_ASSERT(pool && pool->gen_ctrs); SOKOL_ASSERT((slot_index > _SG_INVALID_SLOT_INDEX) && (slot_index < pool->size)); - SOKOL_ASSERT((slot->state == SG_RESOURCESTATE_INITIAL) && (slot->id == SG_INVALID_ID)); + SOKOL_ASSERT(slot->id == SG_INVALID_ID); + SOKOL_ASSERT(slot->state == SG_RESOURCESTATE_INITIAL); uint32_t ctr = ++pool->gen_ctrs[slot_index]; slot->id = (ctr<<_SG_SLOT_SHIFT)|(slot_index & _SG_SLOT_MASK); slot->state = SG_RESOURCESTATE_ALLOC; From fcfda2e104bf25b7fb505326e574959a1c6c909c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 1 Oct 2023 18:49:03 +0200 Subject: [PATCH 224/292] sokol_gfx.h: start implementing frame stats tracking --- sokol_gfx.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 1d0057f1a..224978744 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -350,6 +350,10 @@ to sokol_gfx.h internals, and may change more often than other public API functions and structs. + --- you can query various internal per-frame stats via: + + sg_query_frame_stats() + --- you can ask at runtime what backend sokol_gfx.h has been compiled for: sg_backend sg_query_backend(void) @@ -2854,6 +2858,54 @@ typedef struct sg_pass_info { sg_slot_info slot; // resource pool slot info } sg_pass_info; +/* + sg_frame_stats + + Allows to track generic and backend-specific tracking stats about a + render frame. Obtained by calling sg_query_frame_stats(). The returned + struct will contains information about the *previous* frame. +*/ +typedef struct sg_frame_stats_gl { + uint32_t fixme; +} sg_frame_stats_gl; + +typedef struct sg_frame_stats_d3d11 { + uint32_t fixme; +} sg_frame_stats_d3d11; + +typedef struct sg_frame_stats_metal { + uint32_t fixme; +} sg_frame_stats_metal; + +typedef struct sg_frame_stats_wgpu { + uint32_t fixme; +} sg_frame_stats_wgpu; + +typedef struct sg_frame_stats { + uint32_t frame_index; // current frame counter, starts at 0 + + uint32_t num_passes; + uint32_t num_apply_viewport; + uint32_t num_apply_scissor_rect; + uint32_t num_apply_pipeline; + uint32_t num_apply_bindings; + uint32_t num_apply_uniforms; + uint32_t num_draw; + uint32_t num_update_buffer; + uint32_t num_append_buffer; + uint32_t num_update_image; + + uint32_t size_apply_uniforms; + uint32_t size_update_buffer; + uint32_t size_append_buffer; + uint32_t size_update_image; + + sg_frame_stats_gl gl; + sg_frame_stats_d3d11 d3d11; + sg_frame_stats_metal metal; + sg_frame_stats_wgpu wgpu; +} sg_frame_stats; + /* sg_log_item @@ -3392,6 +3444,7 @@ SOKOL_GFX_API_DECL sg_backend sg_query_backend(void); SOKOL_GFX_API_DECL sg_features sg_query_features(void); SOKOL_GFX_API_DECL sg_limits sg_query_limits(void); SOKOL_GFX_API_DECL sg_pixelformat_info sg_query_pixelformat(sg_pixel_format fmt); +SOKOL_GFX_API_DECL sg_frame_stats sg_query_frame_stats(void); // get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) SOKOL_GFX_API_DECL sg_resource_state sg_query_buffer_state(sg_buffer buf); SOKOL_GFX_API_DECL sg_resource_state sg_query_image_state(sg_image img); @@ -5061,6 +5114,8 @@ typedef struct { sg_features features; sg_limits limits; sg_pixelformat_info formats[_SG_PIXELFORMAT_NUM]; + sg_frame_stats stats; + sg_frame_stats prev_stats; #if defined(_SOKOL_ANY_GL) _sg_gl_backend_t gl; #elif defined(SOKOL_METAL) @@ -16902,6 +16957,7 @@ SOKOL_API_IMPL void sg_begin_pass(sg_pass pass_id, const sg_pass_action* pass_ac SOKOL_API_IMPL void sg_apply_viewport(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); + _sg.stats.num_apply_viewport++; if (!_sg.pass_valid) { return; } @@ -16915,6 +16971,7 @@ SOKOL_API_IMPL void sg_apply_viewportf(float x, float y, float width, float heig SOKOL_API_IMPL void sg_apply_scissor_rect(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); + _sg.stats.num_apply_scissor_rect++; if (!_sg.pass_valid) { return; } @@ -16928,6 +16985,7 @@ SOKOL_API_IMPL void sg_apply_scissor_rectf(float x, float y, float width, float SOKOL_API_IMPL void sg_apply_pipeline(sg_pipeline pip_id) { SOKOL_ASSERT(_sg.valid); + _sg.stats.num_apply_pipeline++; _sg.bindings_applied = false; if (!_sg_validate_apply_pipeline(pip_id)) { _sg.next_draw_valid = false; @@ -16949,6 +17007,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(bindings); SOKOL_ASSERT((bindings->_start_canary == 0) && (bindings->_end_canary==0)); + _sg.stats.num_apply_bindings++; if (!_sg_validate_apply_bindings(bindings)) { _sg.next_draw_valid = false; return; @@ -17051,6 +17110,8 @@ SOKOL_API_IMPL void sg_apply_uniforms(sg_shader_stage stage, int ub_index, const SOKOL_ASSERT((stage == SG_SHADERSTAGE_VS) || (stage == SG_SHADERSTAGE_FS)); SOKOL_ASSERT((ub_index >= 0) && (ub_index < SG_MAX_SHADERSTAGE_UBS)); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); + _sg.stats.num_apply_uniforms++; + _sg.stats.size_apply_uniforms += data->size; if (!_sg_validate_apply_uniforms(stage, ub_index, data)) { _sg.next_draw_valid = false; return; @@ -17070,6 +17131,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_ASSERT(base_element >= 0); SOKOL_ASSERT(num_elements >= 0); SOKOL_ASSERT(num_instances >= 0); + _sg.stats.num_draw++; #if defined(SOKOL_DEBUG) if (!_sg.bindings_applied) { _SG_WARN(DRAW_WITHOUT_BINDINGS); @@ -17096,6 +17158,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_API_IMPL void sg_end_pass(void) { SOKOL_ASSERT(_sg.valid); + _sg.stats.num_passes++; if (!_sg.pass_valid) { return; } @@ -17109,6 +17172,9 @@ SOKOL_API_IMPL void sg_end_pass(void) { SOKOL_API_IMPL void sg_commit(void) { SOKOL_ASSERT(_sg.valid); _sg_commit(); + _sg.stats.frame_index = _sg.frame_index; + _sg.prev_stats = _sg.stats; + _sg_clear(&_sg.stats, sizeof(_sg.stats)); _sg_notify_commit_listeners(); _SG_TRACE_NOARGS(commit); _sg.frame_index++; @@ -17123,6 +17189,8 @@ SOKOL_API_IMPL void sg_reset_state_cache(void) { SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); + _sg.stats.num_update_buffer++; + _sg.stats.size_update_buffer += data->size; _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); if ((data->size > 0) && buf && (buf->slot.state == SG_RESOURCESTATE_VALID)) { if (_sg_validate_update_buffer(buf, data)) { @@ -17141,6 +17209,8 @@ SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr); + _sg.stats.num_append_buffer++; + _sg.stats.size_append_buffer += data->size; _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); int result; if (buf) { @@ -17202,6 +17272,15 @@ SOKOL_API_IMPL bool sg_query_buffer_will_overflow(sg_buffer buf_id, size_t size) SOKOL_API_IMPL void sg_update_image(sg_image img_id, const sg_image_data* data) { SOKOL_ASSERT(_sg.valid); + _sg.stats.num_update_image++; + for (int face_index = 0; face_index < SG_CUBEFACE_NUM; face_index++) { + for (int mip_index = 0; mip_index < SG_MAX_MIPMAPS; mip_index++) { + if (data->subimage[face_index][mip_index].size == 0) { + break; + } + _sg.stats.size_update_image += data->subimage[face_index][mip_index].size; + } + } _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); if (img && img->slot.state == SG_RESOURCESTATE_VALID) { if (_sg_validate_update_image(img, data)) { From c2a5d9768b73ff3bb010fcb89cfdf760df94df98 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 1 Oct 2023 19:26:09 +0200 Subject: [PATCH 225/292] sokol_gfx.h wgpu: webgpu specific frame stats --- sokol_gfx.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 224978744..f070e2c4b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2877,8 +2877,25 @@ typedef struct sg_frame_stats_metal { uint32_t fixme; } sg_frame_stats_metal; +typedef struct sg_frame_stats_wgpu_bindings { + uint32_t num_set_vertex_buffer; + uint32_t num_redundant_vertex_buffer; + uint32_t num_set_index_buffer; + uint32_t num_redundant_index_buffer; + uint32_t num_create_bindgroup; + uint32_t num_discard_bindgroup; + uint32_t num_set_bindgroup; + uint32_t num_set_empty_bindgroup; + uint32_t num_cache_hits; + uint32_t num_cache_misses; + uint32_t num_cache_collisions; + uint32_t num_hash_vs_key_mismatch; +} sg_frame_stats_wgpu_bindings; + typedef struct sg_frame_stats_wgpu { - uint32_t fixme; + uint32_t num_uniform_set_bindgroup; + uint32_t size_uniform_write_buffer; + sg_frame_stats_wgpu_bindings bindings; } sg_frame_stats_wgpu; typedef struct sg_frame_stats { @@ -12598,6 +12615,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.staging, _sg.wgpu.uniform.offset); + _sg.stats.wgpu.size_uniform_write_buffer += _sg.wgpu.uniform.offset; _sg.wgpu.uniform.offset = 0; _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } @@ -12743,6 +12761,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroups_cache_key(_sg_wgpu_bindgroups_ca return false; } if (memcmp(&k0->items, &k1->items, sizeof(k0->items)) != 0) { + _sg.stats.wgpu.bindings.num_hash_vs_key_mismatch++; return false; } return true; @@ -12752,6 +12771,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); + _sg.stats.wgpu.bindings.num_create_bindgroup++; _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(); if (bg_id.id == SG_INVALID_ID) { return 0; @@ -12805,6 +12825,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b _SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { SOKOL_ASSERT(bg); + _sg.stats.wgpu.bindings.num_discard_bindgroup++; if (bg->slot.state == SG_RESOURCESTATE_VALID) { if (bg->bindgroup) { wgpuBindGroupRelease(bg->bindgroup); @@ -12909,10 +12930,15 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_VALID)); if (!_sg_wgpu_compare_bindgroups_cache_key(&key, &bg->key)) { // cache collision, need to delete cached bindgroup + _sg.stats.wgpu.bindings.num_cache_collisions++; _sg_wgpu_discard_bindgroup(bg); _sg_wgpu_bindgroups_cache_set(key.hash, SG_INVALID_ID); bg = 0; + } else { + _sg.stats.wgpu.bindings.num_cache_hits++; } + } else { + _sg.stats.wgpu.bindings.num_cache_misses++; } if (bg == 0) { // either no cache entry yet, or cache collision, create new bindgroup and store in cache @@ -12921,6 +12947,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { } if (bg && bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); + _sg.stats.wgpu.bindings.num_set_bindgroup++; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); } else { return false; @@ -12931,6 +12958,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { if (bg) { if (bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); + _sg.stats.wgpu.bindings.num_set_bindgroup++; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); } _sg_wgpu_discard_bindgroup(bg); @@ -12939,6 +12967,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { } } } else { + _sg.stats.wgpu.bindings.num_set_empty_bindgroup++; wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); } return true; @@ -13753,6 +13782,9 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); + _sg.stats.wgpu.bindings.num_set_index_buffer++; + } else { + _sg.stats.wgpu.bindings.num_redundant_index_buffer++; } } // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) @@ -13766,6 +13798,9 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); + _sg.stats.wgpu.bindings.num_set_vertex_buffer++; + } else { + _sg.stats.wgpu.bindings.num_redundant_vertex_buffer++; } // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } @@ -13789,6 +13824,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); + _sg.stats.wgpu.num_uniform_set_bindgroup++; memcpy(_sg.wgpu.uniform.staging + _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); From 79f70be1db87483ae65d1b6fc06c19837e8ff41d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 1 Oct 2023 19:30:13 +0200 Subject: [PATCH 226/292] sokol_gfx.h: fix msvc errors --- sokol_gfx.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index f070e2c4b..10e418d68 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -17147,7 +17147,7 @@ SOKOL_API_IMPL void sg_apply_uniforms(sg_shader_stage stage, int ub_index, const SOKOL_ASSERT((ub_index >= 0) && (ub_index < SG_MAX_SHADERSTAGE_UBS)); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); _sg.stats.num_apply_uniforms++; - _sg.stats.size_apply_uniforms += data->size; + _sg.stats.size_apply_uniforms += (uint32_t)data->size; if (!_sg_validate_apply_uniforms(stage, ub_index, data)) { _sg.next_draw_valid = false; return; @@ -17226,7 +17226,7 @@ SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); _sg.stats.num_update_buffer++; - _sg.stats.size_update_buffer += data->size; + _sg.stats.size_update_buffer += (uint32_t)data->size; _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); if ((data->size > 0) && buf && (buf->slot.state == SG_RESOURCESTATE_VALID)) { if (_sg_validate_update_buffer(buf, data)) { @@ -17246,7 +17246,7 @@ SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr); _sg.stats.num_append_buffer++; - _sg.stats.size_append_buffer += data->size; + _sg.stats.size_append_buffer += (uint32_t)data->size; _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); int result; if (buf) { @@ -17314,7 +17314,7 @@ SOKOL_API_IMPL void sg_update_image(sg_image img_id, const sg_image_data* data) if (data->subimage[face_index][mip_index].size == 0) { break; } - _sg.stats.size_update_image += data->subimage[face_index][mip_index].size; + _sg.stats.size_update_image += (uint32_t)data->subimage[face_index][mip_index].size; } } _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); From 2754f96c8eb4db77d0771ca845046056e6438eac Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 12:09:16 +0200 Subject: [PATCH 227/292] sokol_gfx_imgui.h: add helper function sg_imgui_draw_menu() --- util/sokol_gfx_imgui.h | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 7614f61a7..d357f13b9 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -84,7 +84,12 @@ this won't draw anything yet, since no windows are open. - --- open and close windows directly by setting the following public + --- call the convenience function sg_imgui_draw_menu(ctx, title) + to render a menu which allows to open/close the provided debug windows + + sg_imgui_draw_menu(&sg_imgui, "sokol-gfx"); + + --- alternative, open and close windows directly by setting the following public booleans in the sg_imgui_t struct: sg_imgui.buffers.open = true; @@ -751,6 +756,8 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_init(sg_imgui_t* ctx, const sg_imgui_desc SOKOL_GFX_IMGUI_API_DECL void sg_imgui_discard(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw(sg_imgui_t* ctx); +SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_menu(sg_imgui_t* ctx, const char* title); + SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_buffers_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_images_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_samplers_content(sg_imgui_t* ctx); @@ -900,6 +907,15 @@ _SOKOL_PRIVATE bool igBegin(const char* name,bool* p_open,ImGuiWindowFlags flags _SOKOL_PRIVATE void igEnd() { return ImGui::End(); } +_SOKOL_PRIVATE bool igBeginMenu(const char* label, bool enabled) { + return ImGui::BeginMenu(label, enabled); +} +_SOKOL_PRIVATE void igEndMenu(void) { + ImGui::EndMenu(); +} +_SOKOL_PRIVATE bool igMenuItem_BoolPtr(const char* label, const char* shortcut, bool* p_selected, bool enabled) { + return ImGui::MenuItem(label, shortcut, p_selected, enabled); +} #else #define IMVEC2(x,y) (ImVec2){x,y} #define IMVEC4(x,y,z,w) (ImVec4){x,y,z,w} @@ -4328,6 +4344,22 @@ SOKOL_API_IMPL void sg_imgui_draw(sg_imgui_t* ctx) { sg_imgui_draw_capabilities_window(ctx); } +SOKOL_API_IMPL void sg_imgui_draw_menu(sg_imgui_t* ctx, const char* title) { + SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); + SOKOL_ASSERT(title); + if (igBeginMenu(title, true)) { + igMenuItem_BoolPtr("Capabilities", 0, &ctx->caps.open, true); + igMenuItem_BoolPtr("Buffers", 0, &ctx->buffers.open, true); + igMenuItem_BoolPtr("Images", 0, &ctx->images.open, true); + igMenuItem_BoolPtr("Samplers", 0, &ctx->samplers.open, true); + igMenuItem_BoolPtr("Shaders", 0, &ctx->shaders.open, true); + igMenuItem_BoolPtr("Pipelines", 0, &ctx->pipelines.open, true); + igMenuItem_BoolPtr("Passes", 0, &ctx->passes.open, true); + igMenuItem_BoolPtr("Calls", 0, &ctx->capture.open, true); + igEndMenu(); + } +} + SOKOL_API_IMPL void sg_imgui_draw_buffers_window(sg_imgui_t* ctx) { SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); if (!ctx->buffers.open) { From 4331539315641ad4fe477a954f4603b91e1e7c5b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 12:14:30 +0200 Subject: [PATCH 228/292] sokol_gfx_imgui.h: tweak function call colors --- util/sokol_gfx_imgui.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index d357f13b9..7bb9c251e 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -827,6 +827,8 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capabilities_window(sg_imgui_t* ctx) #define _SG_IMGUI_LIST_WIDTH (192) #define _SG_IMGUI_COLOR_OTHER 0xFFCCCCCC #define _SG_IMGUI_COLOR_RSRC 0xFF00FFFF +#define _SG_IMGUI_COLOR_PASS 0xFFFFFF00 +#define _SG_IMGUI_COLOR_APPLY 0xFFCCCC00 #define _SG_IMGUI_COLOR_DRAW 0xFF00FF00 #define _SG_IMGUI_COLOR_ERR 0xFF8888FF @@ -2457,7 +2459,7 @@ _SOKOL_PRIVATE void _sg_imgui_begin_default_pass(const sg_pass_action* pass_acti if (item) { SOKOL_ASSERT(pass_action); item->cmd = SG_IMGUI_CMD_BEGIN_DEFAULT_PASS; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_PASS; item->args.begin_default_pass.action = *pass_action; item->args.begin_default_pass.width = width; item->args.begin_default_pass.height = height; @@ -2474,7 +2476,7 @@ _SOKOL_PRIVATE void _sg_imgui_begin_pass(sg_pass pass, const sg_pass_action* pas if (item) { SOKOL_ASSERT(pass_action); item->cmd = SG_IMGUI_CMD_BEGIN_PASS; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_PASS; item->args.begin_pass.pass = pass; item->args.begin_pass.action = *pass_action; } @@ -2489,7 +2491,7 @@ _SOKOL_PRIVATE void _sg_imgui_apply_viewport(int x, int y, int width, int height sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_APPLY_VIEWPORT; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_APPLY; item->args.apply_viewport.x = x; item->args.apply_viewport.y = y; item->args.apply_viewport.width = width; @@ -2507,7 +2509,7 @@ _SOKOL_PRIVATE void _sg_imgui_apply_scissor_rect(int x, int y, int width, int he sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_APPLY_SCISSOR_RECT; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_APPLY; item->args.apply_scissor_rect.x = x; item->args.apply_scissor_rect.y = y; item->args.apply_scissor_rect.width = width; @@ -2526,7 +2528,7 @@ _SOKOL_PRIVATE void _sg_imgui_apply_pipeline(sg_pipeline pip, void* user_data) { sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_APPLY_PIPELINE; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_APPLY; item->args.apply_pipeline.pipeline = pip; } if (ctx->hooks.apply_pipeline) { @@ -2541,7 +2543,7 @@ _SOKOL_PRIVATE void _sg_imgui_apply_bindings(const sg_bindings* bindings, void* if (item) { SOKOL_ASSERT(bindings); item->cmd = SG_IMGUI_CMD_APPLY_BINDINGS; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_APPLY; item->args.apply_bindings.bindings = *bindings; } if (ctx->hooks.apply_bindings) { @@ -2556,7 +2558,7 @@ _SOKOL_PRIVATE void _sg_imgui_apply_uniforms(sg_shader_stage stage, int ub_index sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_APPLY_UNIFORMS; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_APPLY; sg_imgui_args_apply_uniforms_t* args = &item->args.apply_uniforms; args->stage = stage; args->ub_index = ub_index; @@ -2592,7 +2594,7 @@ _SOKOL_PRIVATE void _sg_imgui_end_pass(void* user_data) { sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_END_PASS; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_PASS; } if (ctx->hooks.end_pass) { ctx->hooks.end_pass(ctx->hooks.user_data); @@ -2605,7 +2607,7 @@ _SOKOL_PRIVATE void _sg_imgui_commit(void* user_data) { sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_COMMIT; - item->color = _SG_IMGUI_COLOR_DRAW; + item->color = _SG_IMGUI_COLOR_OTHER; } _sg_imgui_capture_next_frame(ctx); if (ctx->hooks.commit) { From 4f41feb0e474e3d24af3ae13396edd912067fd5a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 13:39:52 +0200 Subject: [PATCH 229/292] sokol_gfx.h: code cleanup --- sokol_gfx.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 10e418d68..4efd202be 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2879,17 +2879,17 @@ typedef struct sg_frame_stats_metal { typedef struct sg_frame_stats_wgpu_bindings { uint32_t num_set_vertex_buffer; - uint32_t num_redundant_vertex_buffer; + uint32_t num_skip_set_vertex_buffer; uint32_t num_set_index_buffer; - uint32_t num_redundant_index_buffer; + uint32_t num_skip_set_index_buffer; uint32_t num_create_bindgroup; uint32_t num_discard_bindgroup; uint32_t num_set_bindgroup; uint32_t num_set_empty_bindgroup; - uint32_t num_cache_hits; - uint32_t num_cache_misses; - uint32_t num_cache_collisions; - uint32_t num_hash_vs_key_mismatch; + uint32_t num_bindgroup_cache_hits; + uint32_t num_bindgroup_cache_misses; + uint32_t num_bindgroup_cache_collisions; + uint32_t num_bindgroup_cache_hash_vs_key_mismatch; } sg_frame_stats_wgpu_bindings; typedef struct sg_frame_stats_wgpu { @@ -12761,7 +12761,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroups_cache_key(_sg_wgpu_bindgroups_ca return false; } if (memcmp(&k0->items, &k1->items, sizeof(k0->items)) != 0) { - _sg.stats.wgpu.bindings.num_hash_vs_key_mismatch++; + _sg.stats.wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch++; return false; } return true; @@ -12930,15 +12930,15 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_VALID)); if (!_sg_wgpu_compare_bindgroups_cache_key(&key, &bg->key)) { // cache collision, need to delete cached bindgroup - _sg.stats.wgpu.bindings.num_cache_collisions++; + _sg.stats.wgpu.bindings.num_bindgroup_cache_collisions++; _sg_wgpu_discard_bindgroup(bg); _sg_wgpu_bindgroups_cache_set(key.hash, SG_INVALID_ID); bg = 0; } else { - _sg.stats.wgpu.bindings.num_cache_hits++; + _sg.stats.wgpu.bindings.num_bindgroup_cache_hits++; } } else { - _sg.stats.wgpu.bindings.num_cache_misses++; + _sg.stats.wgpu.bindings.num_bindgroup_cache_misses++; } if (bg == 0) { // either no cache entry yet, or cache collision, create new bindgroup and store in cache @@ -13784,7 +13784,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); _sg.stats.wgpu.bindings.num_set_index_buffer++; } else { - _sg.stats.wgpu.bindings.num_redundant_index_buffer++; + _sg.stats.wgpu.bindings.num_skip_set_index_buffer++; } } // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) @@ -13800,7 +13800,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); _sg.stats.wgpu.bindings.num_set_vertex_buffer++; } else { - _sg.stats.wgpu.bindings.num_redundant_vertex_buffer++; + _sg.stats.wgpu.bindings.num_skip_set_vertex_buffer++; } // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } @@ -16298,6 +16298,11 @@ SOKOL_API_IMPL sg_pixelformat_info sg_query_pixelformat(sg_pixel_format fmt) { return _sg.formats[fmt_index]; } +SOKOL_API_IMPL sg_frame_stats sg_query_frame_stats(void) { + SOKOL_ASSERT(_sg.valid); + return _sg.prev_stats; +} + SOKOL_API_IMPL sg_context sg_setup_context(void) { SOKOL_ASSERT(_sg.valid); sg_context res; From 94321b2beb436dc45205e9b0a7cc475a136bd5cf Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 13:40:28 +0200 Subject: [PATCH 230/292] sokol_gfx_imgui.h: add frame stats window --- util/sokol_gfx_imgui.h | 111 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 7bb9c251e..149ee1463 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -92,6 +92,8 @@ --- alternative, open and close windows directly by setting the following public booleans in the sg_imgui_t struct: + sg_imgui.caps.open = true; + sg_imgui.frame_stats.open = true; sg_imgui.buffers.open = true; sg_imgui.images.open = true; sg_imgui.samplers.open = true; @@ -99,12 +101,15 @@ sg_imgui.pipelines.open = true; sg_imgui.passes.open = true; sg_imgui.capture.open = true; + sg_imgui.frame_stats.open = true; ...for instance, to control the window visibility through menu items, the following code can be used: if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("sokol-gfx")) { + ImGui::MenuItem("Capabilities", 0, &sg_imgui.caps.open); + ImGui::MenuItem("Frame Stats", 0, &sg_imgui.frame_stats.open); ImGui::MenuItem("Buffers", 0, &sg_imgui.buffers.open); ImGui::MenuItem("Images", 0, &sg_imgui.images.open); ImGui::MenuItem("Samplers", 0, &sg_imgui.samplers.open); @@ -714,6 +719,12 @@ typedef struct sg_imgui_caps_t { bool open; } sg_imgui_caps_t; +typedef struct sg_imgui_frame_stats_t { + bool open; + sg_frame_stats stats; + // FIXME: add a ringbuffer for a stats history here +} sg_imgui_frame_stats_t; + /* sg_imgui_allocator_t @@ -748,6 +759,7 @@ typedef struct sg_imgui_t { sg_imgui_passes_t passes; sg_imgui_capture_t capture; sg_imgui_caps_t caps; + sg_imgui_frame_stats_t frame_stats; sg_pipeline cur_pipeline; sg_trace_hooks hooks; } sg_imgui_t; @@ -766,6 +778,7 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_pipelines_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_passes_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capture_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capabilities_content(sg_imgui_t* ctx); +SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_frame_stats_content(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_buffers_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_images_window(sg_imgui_t* ctx); @@ -775,6 +788,7 @@ SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_pipelines_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_passes_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capture_window(sg_imgui_t* ctx); SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_capabilities_window(sg_imgui_t* ctx); +SOKOL_GFX_IMGUI_API_DECL void sg_imgui_draw_frame_stats_window(sg_imgui_t* ctx); #if defined(__cplusplus) } /* extern "C" */ @@ -918,6 +932,27 @@ _SOKOL_PRIVATE void igEndMenu(void) { _SOKOL_PRIVATE bool igMenuItem_BoolPtr(const char* label, const char* shortcut, bool* p_selected, bool enabled) { return ImGui::MenuItem(label, shortcut, p_selected, enabled); } +_SOKOL_PRIVATE bool igBeginTable(const char* str_id, int column, ImGuiTableFlags flags, const ImVec2 outer_size, float inner_width) { + return ImGui::BeginTable(str_id, column, flags, outer_size, inner_width); +} +_SOKOL_PRIVATE void igEndTable(void) { + ImGui::EndTable(); +} +_SOKOL_PRIVATE void igTableSetupScrollFreeze(int cols, int rows) { + ImGui::TableSetupScrollFreeze(cols, rows); +} +_SOKOL_PRIVATE void igTableSetupColumn(const char* label, ImGuiTableColumnFlags flags, float init_width_or_weight, ImGuiID user_id) { + ImGui::TableSetupColumn(label, flags, init_width_or_weight, user_id); +} +_SOKOL_PRIVATE void igTableHeadersRow(void) { + ImGui::TableHeadersRow(); +} +_SOKOL_PRIVATE void igTableNextRow(ImGuiTableRowFlags row_flags, float min_row_height) { + ImGui::TableNextRow(row_flags, min_row_height); +} +_SOKOL_PRIVATE bool igTableSetColumnIndex(int column_n) { + return ImGui::TableSetColumnIndex(column_n); +} #else #define IMVEC2(x,y) (ImVec2){x,y} #define IMVEC4(x,y,z,w) (ImVec4){x,y,z,w} @@ -4163,6 +4198,62 @@ _SOKOL_PRIVATE void _sg_imgui_draw_caps_panel(void) { } } +_SOKOL_PRIVATE void _sg_imgui_frame_stats_row(const char* key, uint32_t value) { + igTableNextRow(0, 0.0f); + igTableSetColumnIndex(0); + igText(key); + igTableSetColumnIndex(1); + igText("%d", value); +} + +_SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { + _SOKOL_UNUSED(ctx); + const sg_frame_stats* stats = &ctx->frame_stats.stats; + const ImGuiTableFlags flags = + ImGuiTableFlags_Resizable | + ImGuiTableFlags_ScrollY | + ImGuiTableFlags_SizingFixedFit | + ImGuiTableFlags_Borders; + if (igBeginTable("##frame_stats_table", 2, flags, IMVEC2(0, 0), 0)) { + igTableSetupScrollFreeze(0, 1); + igTableSetupColumn("key", ImGuiTableColumnFlags_None, 0, 0); + igTableSetupColumn("value", ImGuiTableColumnFlags_None, 0, 0); + igTableHeadersRow(); + _sg_imgui_frame_stats_row("frame_index", stats->frame_index); + _sg_imgui_frame_stats_row("num_passes", stats->num_passes); + _sg_imgui_frame_stats_row("num_apply_viewport", stats->num_apply_viewport); + _sg_imgui_frame_stats_row("num_apply_scissor_rect", stats->num_apply_scissor_rect); + _sg_imgui_frame_stats_row("num_apply_pipeline", stats->num_apply_pipeline); + _sg_imgui_frame_stats_row("num_apply_bindings", stats->num_apply_bindings); + _sg_imgui_frame_stats_row("num_apply_uniforms", stats->num_apply_uniforms); + _sg_imgui_frame_stats_row("num_draw", stats->num_draw); + _sg_imgui_frame_stats_row("num_update_buffer", stats->num_update_buffer); + _sg_imgui_frame_stats_row("num_append_buffer", stats->num_append_buffer); + _sg_imgui_frame_stats_row("num_update_image", stats->num_update_image); + _sg_imgui_frame_stats_row("size_apply_uniforms", stats->size_apply_uniforms); + _sg_imgui_frame_stats_row("size_update_buffer", stats->size_update_buffer); + _sg_imgui_frame_stats_row("size_append_buffer", stats->size_append_buffer); + _sg_imgui_frame_stats_row("size_update_image", stats->size_update_image); + if (sg_query_backend() == SG_BACKEND_WGPU) { + _sg_imgui_frame_stats_row("wgpu.num_uniform_set_bindgroup", stats->wgpu.num_uniform_set_bindgroup); + _sg_imgui_frame_stats_row("wgpu.size_uniform_write_buffer", stats->wgpu.size_uniform_write_buffer); + _sg_imgui_frame_stats_row("wgpu.bindings.num_set_vertex_buffer", stats->wgpu.bindings.num_set_vertex_buffer); + _sg_imgui_frame_stats_row("wgpu.bindings.num_skip_set_vertex_buffer", stats->wgpu.bindings.num_skip_set_vertex_buffer); + _sg_imgui_frame_stats_row("wgpu.bindings.num_set_index_buffer", stats->wgpu.bindings.num_set_index_buffer); + _sg_imgui_frame_stats_row("wgpu.bindings.num_skip_set_index_buffer", stats->wgpu.bindings.num_skip_set_index_buffer); + _sg_imgui_frame_stats_row("wgpu.bindings.num_create_bindgroup", stats->wgpu.bindings.num_create_bindgroup); + _sg_imgui_frame_stats_row("wgpu.bindings.num_discard_bindgroup", stats->wgpu.bindings.num_discard_bindgroup); + _sg_imgui_frame_stats_row("wgpu.bindings.num_set_bindgroup", stats->wgpu.bindings.num_set_bindgroup); + _sg_imgui_frame_stats_row("wgpu.bindings.num_set_empty_bindgroup", stats->wgpu.bindings.num_set_empty_bindgroup); + _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_hits", stats->wgpu.bindings.num_bindgroup_cache_hits); + _sg_imgui_frame_stats_row("wpgu.bindings.num_bindgroup_cache_misses", stats->wgpu.bindings.num_bindgroup_cache_misses); + _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_collisions", stats->wgpu.bindings.num_bindgroup_cache_collisions); + _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatches", stats->wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch); + } + igEndTable(); + } +} + #define _sg_imgui_def(val, def) (((val) == 0) ? (def) : (val)) _SOKOL_PRIVATE sg_imgui_desc_t _sg_imgui_desc_defaults(const sg_imgui_desc_t* desc) { @@ -4344,6 +4435,7 @@ SOKOL_API_IMPL void sg_imgui_draw(sg_imgui_t* ctx) { sg_imgui_draw_passes_window(ctx); sg_imgui_draw_capture_window(ctx); sg_imgui_draw_capabilities_window(ctx); + sg_imgui_draw_frame_stats_window(ctx); } SOKOL_API_IMPL void sg_imgui_draw_menu(sg_imgui_t* ctx, const char* title) { @@ -4351,6 +4443,7 @@ SOKOL_API_IMPL void sg_imgui_draw_menu(sg_imgui_t* ctx, const char* title) { SOKOL_ASSERT(title); if (igBeginMenu(title, true)) { igMenuItem_BoolPtr("Capabilities", 0, &ctx->caps.open, true); + igMenuItem_BoolPtr("Frame Stats", 0, &ctx->frame_stats.open, true); igMenuItem_BoolPtr("Buffers", 0, &ctx->buffers.open, true); igMenuItem_BoolPtr("Images", 0, &ctx->images.open, true); igMenuItem_BoolPtr("Samplers", 0, &ctx->samplers.open, true); @@ -4458,6 +4551,18 @@ SOKOL_API_IMPL void sg_imgui_draw_capabilities_window(sg_imgui_t* ctx) { igEnd(); } +SOKOL_API_IMPL void sg_imgui_draw_frame_stats_window(sg_imgui_t* ctx) { + SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); + if (!ctx->frame_stats.open) { + return; + } + igSetNextWindowSize(IMVEC2(512, 400), ImGuiCond_Once); + if (igBegin("Frame Stats", &ctx->frame_stats.open, 0)) { + sg_imgui_draw_frame_stats_content(ctx); + } + igEnd(); +} + SOKOL_API_IMPL void sg_imgui_draw_buffers_content(sg_imgui_t* ctx) { SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); _sg_imgui_draw_buffer_list(ctx); @@ -4513,4 +4618,10 @@ SOKOL_API_IMPL void sg_imgui_draw_capabilities_content(sg_imgui_t* ctx) { _sg_imgui_draw_caps_panel(); } +SOKOL_API_IMPL void sg_imgui_draw_frame_stats_content(sg_imgui_t* ctx) { + SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD)); + ctx->frame_stats.stats = sg_query_frame_stats(); + _sg_imgui_draw_frame_stats_panel(ctx); +} + #endif /* SOKOL_GFX_IMGUI_IMPL */ From 10439891ac735360be753ad1872122b325a841f1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 16:04:42 +0200 Subject: [PATCH 231/292] sokol_gfx.h: frame stats code cleanup --- sokol_gfx.h | 87 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 4efd202be..d02a27f2a 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -350,9 +350,12 @@ to sokol_gfx.h internals, and may change more often than other public API functions and structs. - --- you can query various internal per-frame stats via: + --- you can query frame stats and control stats collection via: sg_query_frame_stats() + sg_enable_frame_stats() + sg_disable_frame_stats() + sg_frame_stats_enabled() --- you can ask at runtime what backend sokol_gfx.h has been compiled for: @@ -3461,7 +3464,6 @@ SOKOL_GFX_API_DECL sg_backend sg_query_backend(void); SOKOL_GFX_API_DECL sg_features sg_query_features(void); SOKOL_GFX_API_DECL sg_limits sg_query_limits(void); SOKOL_GFX_API_DECL sg_pixelformat_info sg_query_pixelformat(sg_pixel_format fmt); -SOKOL_GFX_API_DECL sg_frame_stats sg_query_frame_stats(void); // get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID) SOKOL_GFX_API_DECL sg_resource_state sg_query_buffer_state(sg_buffer buf); SOKOL_GFX_API_DECL sg_resource_state sg_query_image_state(sg_image img); @@ -3523,6 +3525,12 @@ SOKOL_GFX_API_DECL void sg_fail_shader(sg_shader shd); SOKOL_GFX_API_DECL void sg_fail_pipeline(sg_pipeline pip); SOKOL_GFX_API_DECL void sg_fail_pass(sg_pass pass); +// frame stats +SOKOL_GFX_API_DECL void sg_enable_frame_stats(void); +SOKOL_GFX_API_DECL void sg_disable_frame_stats(void); +SOKOL_GFX_API_DECL bool sg_frame_stats_enabled(void); +SOKOL_GFX_API_DECL sg_frame_stats sg_query_frame_stats(void); + // rendering contexts (optional) SOKOL_GFX_API_DECL sg_context sg_setup_context(void); SOKOL_GFX_API_DECL void sg_activate_context(sg_context ctx_id); @@ -4143,6 +4151,7 @@ typedef struct { #define _sg_clamp(v,v0,v1) (((v)<(v0))?(v0):(((v)>(v1))?(v1):(v))) #define _sg_fequal(val,cmp,delta) ((((val)-(cmp))> -(delta))&&(((val)-(cmp))<(delta))) #define _sg_ispow2(val) ((val&(val-1))==0) +#define _sg_stats_add(key,val) {if(_sg.stats_enabled){ _sg.stats.key+=val;}} _SOKOL_PRIVATE void* _sg_malloc_clear(size_t size); _SOKOL_PRIVATE void _sg_free(void* ptr); @@ -5131,6 +5140,7 @@ typedef struct { sg_features features; sg_limits limits; sg_pixelformat_info formats[_SG_PIXELFORMAT_NUM]; + bool stats_enabled; sg_frame_stats stats; sg_frame_stats prev_stats; #if defined(_SOKOL_ANY_GL) @@ -12615,7 +12625,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.staging, _sg.wgpu.uniform.offset); - _sg.stats.wgpu.size_uniform_write_buffer += _sg.wgpu.uniform.offset; + _sg_stats_add(wgpu.size_uniform_write_buffer, _sg.wgpu.uniform.offset); _sg.wgpu.uniform.offset = 0; _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } @@ -12761,7 +12771,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_compare_bindgroups_cache_key(_sg_wgpu_bindgroups_ca return false; } if (memcmp(&k0->items, &k1->items, sizeof(k0->items)) != 0) { - _sg.stats.wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch++; + _sg_stats_add(wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch, 1); return false; } return true; @@ -12771,7 +12781,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b SOKOL_ASSERT(_sg.wgpu.dev); SOKOL_ASSERT(bnd->pip); SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); - _sg.stats.wgpu.bindings.num_create_bindgroup++; + _sg_stats_add(wgpu.bindings.num_create_bindgroup, 1); _sg_wgpu_bindgroup_handle_t bg_id = _sg_wgpu_alloc_bindgroup(); if (bg_id.id == SG_INVALID_ID) { return 0; @@ -12825,7 +12835,7 @@ _SOKOL_PRIVATE _sg_wgpu_bindgroup_t* _sg_wgpu_create_bindgroup(_sg_bindings_t* b _SOKOL_PRIVATE void _sg_wgpu_discard_bindgroup(_sg_wgpu_bindgroup_t* bg) { SOKOL_ASSERT(bg); - _sg.stats.wgpu.bindings.num_discard_bindgroup++; + _sg_stats_add(wgpu.bindings.num_discard_bindgroup, 1); if (bg->slot.state == SG_RESOURCESTATE_VALID) { if (bg->bindgroup) { wgpuBindGroupRelease(bg->bindgroup); @@ -12930,15 +12940,15 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { SOKOL_ASSERT(bg && (bg->slot.state == SG_RESOURCESTATE_VALID)); if (!_sg_wgpu_compare_bindgroups_cache_key(&key, &bg->key)) { // cache collision, need to delete cached bindgroup - _sg.stats.wgpu.bindings.num_bindgroup_cache_collisions++; + _sg_stats_add(wgpu.bindings.num_bindgroup_cache_collisions, 1); _sg_wgpu_discard_bindgroup(bg); _sg_wgpu_bindgroups_cache_set(key.hash, SG_INVALID_ID); bg = 0; } else { - _sg.stats.wgpu.bindings.num_bindgroup_cache_hits++; + _sg_stats_add(wgpu.bindings.num_bindgroup_cache_hits, 1); } } else { - _sg.stats.wgpu.bindings.num_bindgroup_cache_misses++; + _sg_stats_add(wgpu.bindings.num_bindgroup_cache_misses, 1); } if (bg == 0) { // either no cache entry yet, or cache collision, create new bindgroup and store in cache @@ -12947,7 +12957,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { } if (bg && bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); - _sg.stats.wgpu.bindings.num_set_bindgroup++; + _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); } else { return false; @@ -12958,7 +12968,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { if (bg) { if (bg->slot.state == SG_RESOURCESTATE_VALID) { SOKOL_ASSERT(bg->bindgroup); - _sg.stats.wgpu.bindings.num_set_bindgroup++; + _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); } _sg_wgpu_discard_bindgroup(bg); @@ -12967,7 +12977,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { } } } else { - _sg.stats.wgpu.bindings.num_set_empty_bindgroup++; + _sg_stats_add(wgpu.bindings.num_set_empty_bindgroup, 1); wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); } return true; @@ -13782,9 +13792,9 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); - _sg.stats.wgpu.bindings.num_set_index_buffer++; + _sg_stats_add(wgpu.bindings.num_set_index_buffer, 1); } else { - _sg.stats.wgpu.bindings.num_skip_set_index_buffer++; + _sg_stats_add(wgpu.bindings.num_skip_set_index_buffer, 1); } } // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) @@ -13798,9 +13808,9 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(buf_size > offset); const uint64_t max_bytes = buf_size - offset; wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); - _sg.stats.wgpu.bindings.num_set_vertex_buffer++; + _sg_stats_add(wgpu.bindings.num_set_vertex_buffer, 1); } else { - _sg.stats.wgpu.bindings.num_skip_set_vertex_buffer++; + _sg_stats_add(wgpu.bindings.num_skip_set_vertex_buffer, 1); } // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) } @@ -13824,7 +13834,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - _sg.stats.wgpu.num_uniform_set_bindgroup++; + _sg_stats_add(wgpu.num_uniform_set_bindgroup, 1); memcpy(_sg.wgpu.uniform.staging + _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); @@ -16244,6 +16254,7 @@ SOKOL_API_IMPL void sg_setup(const sg_desc* desc) { _sg_setup_pools(&_sg.pools, &_sg.desc); _sg_setup_commit_listeners(&_sg.desc); _sg.frame_index = 1; + _sg.stats_enabled = true; _sg_setup_backend(&_sg.desc); _sg.valid = true; sg_setup_context(); @@ -16998,7 +17009,7 @@ SOKOL_API_IMPL void sg_begin_pass(sg_pass pass_id, const sg_pass_action* pass_ac SOKOL_API_IMPL void sg_apply_viewport(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); - _sg.stats.num_apply_viewport++; + _sg_stats_add(num_apply_viewport, 1); if (!_sg.pass_valid) { return; } @@ -17012,7 +17023,7 @@ SOKOL_API_IMPL void sg_apply_viewportf(float x, float y, float width, float heig SOKOL_API_IMPL void sg_apply_scissor_rect(int x, int y, int width, int height, bool origin_top_left) { SOKOL_ASSERT(_sg.valid); - _sg.stats.num_apply_scissor_rect++; + _sg_stats_add(num_apply_scissor_rect, 1); if (!_sg.pass_valid) { return; } @@ -17026,7 +17037,7 @@ SOKOL_API_IMPL void sg_apply_scissor_rectf(float x, float y, float width, float SOKOL_API_IMPL void sg_apply_pipeline(sg_pipeline pip_id) { SOKOL_ASSERT(_sg.valid); - _sg.stats.num_apply_pipeline++; + _sg_stats_add(num_apply_pipeline, 1); _sg.bindings_applied = false; if (!_sg_validate_apply_pipeline(pip_id)) { _sg.next_draw_valid = false; @@ -17048,7 +17059,7 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(bindings); SOKOL_ASSERT((bindings->_start_canary == 0) && (bindings->_end_canary==0)); - _sg.stats.num_apply_bindings++; + _sg_stats_add(num_apply_bindings, 1); if (!_sg_validate_apply_bindings(bindings)) { _sg.next_draw_valid = false; return; @@ -17151,8 +17162,8 @@ SOKOL_API_IMPL void sg_apply_uniforms(sg_shader_stage stage, int ub_index, const SOKOL_ASSERT((stage == SG_SHADERSTAGE_VS) || (stage == SG_SHADERSTAGE_FS)); SOKOL_ASSERT((ub_index >= 0) && (ub_index < SG_MAX_SHADERSTAGE_UBS)); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); - _sg.stats.num_apply_uniforms++; - _sg.stats.size_apply_uniforms += (uint32_t)data->size; + _sg_stats_add(num_apply_uniforms, 1); + _sg_stats_add(size_apply_uniforms, (uint32_t)data->size); if (!_sg_validate_apply_uniforms(stage, ub_index, data)) { _sg.next_draw_valid = false; return; @@ -17172,7 +17183,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_ASSERT(base_element >= 0); SOKOL_ASSERT(num_elements >= 0); SOKOL_ASSERT(num_instances >= 0); - _sg.stats.num_draw++; + _sg_stats_add(num_draw, 1); #if defined(SOKOL_DEBUG) if (!_sg.bindings_applied) { _SG_WARN(DRAW_WITHOUT_BINDINGS); @@ -17199,7 +17210,7 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance SOKOL_API_IMPL void sg_end_pass(void) { SOKOL_ASSERT(_sg.valid); - _sg.stats.num_passes++; + _sg_stats_add(num_passes, 1); if (!_sg.pass_valid) { return; } @@ -17230,8 +17241,8 @@ SOKOL_API_IMPL void sg_reset_state_cache(void) { SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr && (data->size > 0)); - _sg.stats.num_update_buffer++; - _sg.stats.size_update_buffer += (uint32_t)data->size; + _sg_stats_add(num_update_buffer, 1); + _sg_stats_add(size_update_buffer, (uint32_t)data->size); _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); if ((data->size > 0) && buf && (buf->slot.state == SG_RESOURCESTATE_VALID)) { if (_sg_validate_update_buffer(buf, data)) { @@ -17250,8 +17261,8 @@ SOKOL_API_IMPL void sg_update_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_API_IMPL int sg_append_buffer(sg_buffer buf_id, const sg_range* data) { SOKOL_ASSERT(_sg.valid); SOKOL_ASSERT(data && data->ptr); - _sg.stats.num_append_buffer++; - _sg.stats.size_append_buffer += (uint32_t)data->size; + _sg_stats_add(num_append_buffer, 1); + _sg_stats_add(size_append_buffer, (uint32_t)data->size); _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); int result; if (buf) { @@ -17313,13 +17324,13 @@ SOKOL_API_IMPL bool sg_query_buffer_will_overflow(sg_buffer buf_id, size_t size) SOKOL_API_IMPL void sg_update_image(sg_image img_id, const sg_image_data* data) { SOKOL_ASSERT(_sg.valid); - _sg.stats.num_update_image++; + _sg_stats_add(num_update_image, 1); for (int face_index = 0; face_index < SG_CUBEFACE_NUM; face_index++) { for (int mip_index = 0; mip_index < SG_MAX_MIPMAPS; mip_index++) { if (data->subimage[face_index][mip_index].size == 0) { break; } - _sg.stats.size_update_image += (uint32_t)data->subimage[face_index][mip_index].size; + _sg_stats_add(size_update_image, (uint32_t)data->subimage[face_index][mip_index].size); } } _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); @@ -17355,6 +17366,20 @@ SOKOL_API_IMPL bool sg_remove_commit_listener(sg_commit_listener listener) { return _sg_remove_commit_listener(&listener); } +SOKOL_API_IMPL void sg_enable_frame_stats(void) { + SOKOL_ASSERT(_sg.valid); + _sg.stats_enabled = true; +} + +SOKOL_API_IMPL void sg_disable_frame_stats(void) { + SOKOL_ASSERT(_sg.valid); + _sg.stats_enabled = false; +} + +SOKOL_API_IMPL bool sg_frame_stats_enabled(void) { + return _sg.stats_enabled; +} + SOKOL_API_IMPL sg_buffer_info sg_query_buffer_info(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); sg_buffer_info info; From 66abd127d2910b695474f19ded1ba589899c190f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 16:05:26 +0200 Subject: [PATCH 232/292] sokol_gfx_imgui.h: allow to ignore sokol_imgui.h frame stats --- util/sokol_gfx_imgui.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 149ee1463..0cd60ae98 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -721,6 +721,8 @@ typedef struct sg_imgui_caps_t { typedef struct sg_imgui_frame_stats_t { bool open; + bool disable_sokol_imgui_stats; + bool in_sokol_imgui; sg_frame_stats stats; // FIXME: add a ringbuffer for a stats history here } sg_imgui_frame_stats_t; @@ -953,6 +955,9 @@ _SOKOL_PRIVATE void igTableNextRow(ImGuiTableRowFlags row_flags, float min_row_h _SOKOL_PRIVATE bool igTableSetColumnIndex(int column_n) { return ImGui::TableSetColumnIndex(column_n); } +_SOKOL_PRIVATE bool igCheckbox(const char* label, bool* v) { + return ImGui::Checkbox(label, v); +} #else #define IMVEC2(x,y) (ImVec2){x,y} #define IMVEC4(x,y,z,w) (ImVec4){x,y,z,w} @@ -3109,6 +3114,12 @@ _SOKOL_PRIVATE void _sg_imgui_fail_pass(sg_pass pass_id, void* user_data) { _SOKOL_PRIVATE void _sg_imgui_push_debug_group(const char* name, void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); + if (0 == strcmp(name, "sokol-imgui")) { + ctx->frame_stats.in_sokol_imgui = true; + if (ctx->frame_stats.disable_sokol_imgui_stats) { + sg_disable_frame_stats(); + } + } sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_PUSH_DEBUG_GROUP; @@ -3123,6 +3134,12 @@ _SOKOL_PRIVATE void _sg_imgui_push_debug_group(const char* name, void* user_data _SOKOL_PRIVATE void _sg_imgui_pop_debug_group(void* user_data) { sg_imgui_t* ctx = (sg_imgui_t*) user_data; SOKOL_ASSERT(ctx); + if (ctx->frame_stats.in_sokol_imgui) { + ctx->frame_stats.in_sokol_imgui = false; + if (ctx->frame_stats.disable_sokol_imgui_stats) { + sg_enable_frame_stats(); + } + } sg_imgui_capture_item_t* item = _sg_imgui_capture_next_write_item(ctx); if (item) { item->cmd = SG_IMGUI_CMD_POP_DEBUG_GROUP; @@ -4208,6 +4225,7 @@ _SOKOL_PRIVATE void _sg_imgui_frame_stats_row(const char* key, uint32_t value) { _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { _SOKOL_UNUSED(ctx); + igCheckbox("Ignore sokol_imgui.h", &ctx->frame_stats.disable_sokol_imgui_stats); const sg_frame_stats* stats = &ctx->frame_stats.stats; const ImGuiTableFlags flags = ImGuiTableFlags_Resizable | From 776dfbdfde5011d4fa38228abf281d54c7074a8e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 16:56:36 +0200 Subject: [PATCH 233/292] sokol_gfx.h metal: add frame stats counters --- sokol_gfx.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index d02a27f2a..9d1aed452 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2876,10 +2876,47 @@ typedef struct sg_frame_stats_d3d11 { uint32_t fixme; } sg_frame_stats_d3d11; +typedef struct sg_frame_stats_metal_idpool { + uint32_t num_added; + uint32_t num_released; + uint32_t num_garbage_collected; +} sg_frame_stats_metal_idpool; + +typedef struct sg_frame_stats_metal_pipeline { + uint32_t num_set_blend_color; + uint32_t num_set_cull_mode; + uint32_t num_set_front_facing_winding; + uint32_t num_set_stencil_reference_value; + uint32_t num_set_depth_bias; + uint32_t num_set_render_pipeline_state; + uint32_t num_set_depth_stencil_state; +} sg_frame_stats_metal_pipeline; + +typedef struct sg_frame_stats_metal_bindings { + uint32_t num_set_vertex_buffer; + uint32_t num_set_vertex_texture; + uint32_t num_set_vertex_sampler_state; + uint32_t num_set_fragment_texture; + uint32_t num_set_fragment_sampler_state; +} sg_frame_stats_metal_bindings; + +typedef struct sg_frame_stats_metal_uniforms { + uint32_t num_set_vertex_buffer_offset; + uint32_t num_set_fragment_buffer_offset; +} sg_frame_stats_metal_uniforms; + typedef struct sg_frame_stats_metal { - uint32_t fixme; + sg_frame_stats_metal_idpool idpool; + sg_frame_stats_metal_pipeline pipeline; + sg_frame_stats_metal_bindings bindings; + sg_frame_stats_metal_uniforms uniforms; } sg_frame_stats_metal; +typedef struct sg_frame_stats_wgpu_uniforms { + uint32_t num_set_bindgroup; + uint32_t size_write_buffer; +} sg_frame_stats_wgpu_uniforms; + typedef struct sg_frame_stats_wgpu_bindings { uint32_t num_set_vertex_buffer; uint32_t num_skip_set_vertex_buffer; @@ -2896,8 +2933,7 @@ typedef struct sg_frame_stats_wgpu_bindings { } sg_frame_stats_wgpu_bindings; typedef struct sg_frame_stats_wgpu { - uint32_t num_uniform_set_bindgroup; - uint32_t size_uniform_write_buffer; + sg_frame_stats_wgpu_uniforms uniforms; sg_frame_stats_wgpu_bindings bindings; } sg_frame_stats_wgpu; @@ -10795,6 +10831,7 @@ _SOKOL_PRIVATE int _sg_mtl_add_resource(id res) { if (nil == res) { return _SG_MTL_INVALID_SLOT_INDEX; } + _sg_stats_add(metal.idpool.num_added, 1); const int slot_index = _sg_mtl_alloc_pool_slot(); // NOTE: the NSMutableArray will take ownership of its items SOKOL_ASSERT([NSNull null] == _sg.mtl.idpool.pool[(NSUInteger)slot_index]); @@ -10811,6 +10848,7 @@ _SOKOL_PRIVATE void _sg_mtl_release_resource(uint32_t frame_index, int slot_inde if (slot_index == _SG_MTL_INVALID_SLOT_INDEX) { return; } + _sg_stats_add(metal.idpool.num_released, 1); SOKOL_ASSERT((slot_index > 0) && (slot_index < _sg.mtl.idpool.num_slots)); SOKOL_ASSERT([NSNull null] != _sg.mtl.idpool.pool[(NSUInteger)slot_index]); int release_index = _sg.mtl.idpool.release_queue_front++; @@ -10833,6 +10871,7 @@ _SOKOL_PRIVATE void _sg_mtl_garbage_collect(uint32_t frame_index) { // don't need to check further, release-items past this are too young break; } + _sg_stats_add(metal.idpool.num_garbage_collected, 1); // safe to release this resource const int slot_index = _sg.mtl.idpool.release_queue[_sg.mtl.idpool.release_queue_back].slot_index; SOKOL_ASSERT((slot_index > 0) && (slot_index < _sg.mtl.idpool.num_slots)); @@ -11876,14 +11915,21 @@ _SOKOL_PRIVATE void _sg_mtl_apply_pipeline(_sg_pipeline_t* pip) { _sg.mtl.state_cache.cur_pipeline_id.id = pip->slot.id; sg_color c = pip->cmn.blend_color; [_sg.mtl.cmd_encoder setBlendColorRed:c.r green:c.g blue:c.b alpha:c.a]; + _sg_stats_add(metal.pipeline.num_set_blend_color, 1); [_sg.mtl.cmd_encoder setCullMode:pip->mtl.cull_mode]; + _sg_stats_add(metal.pipeline.num_set_cull_mode, 1); [_sg.mtl.cmd_encoder setFrontFacingWinding:pip->mtl.winding]; + _sg_stats_add(metal.pipeline.num_set_front_facing_winding, 1); [_sg.mtl.cmd_encoder setStencilReferenceValue:pip->mtl.stencil_ref]; + _sg_stats_add(metal.pipeline.num_set_stencil_reference_value, 1); [_sg.mtl.cmd_encoder setDepthBias:pip->cmn.depth.bias slopeScale:pip->cmn.depth.bias_slope_scale clamp:pip->cmn.depth.bias_clamp]; + _sg_stats_add(metal.pipeline.num_set_depth_bias, 1); SOKOL_ASSERT(pip->mtl.rps != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setRenderPipelineState:_sg_mtl_id(pip->mtl.rps)]; + _sg_stats_add(metal.pipeline.num_set_render_pipeline_state, 1); SOKOL_ASSERT(pip->mtl.dss != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setDepthStencilState:_sg_mtl_id(pip->mtl.dss)]; + _sg_stats_add(metal.pipeline.num_set_depth_stencil_state, 1); } } @@ -11922,6 +11968,7 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { [_sg.mtl.cmd_encoder setVertexBuffer:_sg_mtl_id(vb->mtl.buf[vb->cmn.active_slot]) offset:(NSUInteger)vb_offset atIndex:mtl_slot]; + _sg_stats_add(metal.bindings.num_set_vertex_buffer, 1); } } @@ -11933,6 +11980,7 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { _sg.mtl.state_cache.cur_vs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setVertexTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; + _sg_stats_add(metal.bindings.num_set_vertex_texture, 1); } } @@ -11944,6 +11992,7 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { _sg.mtl.state_cache.cur_vs_sampler_ids[slot].id = smp->slot.id; SOKOL_ASSERT(smp->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setVertexSamplerState:_sg_mtl_id(smp->mtl.sampler_state) atIndex:slot]; + _sg_stats_add(metal.bindings.num_set_vertex_sampler_state, 1); } } @@ -11955,6 +12004,7 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { _sg.mtl.state_cache.cur_fs_image_ids[slot].id = img->slot.id; SOKOL_ASSERT(img->mtl.tex[img->cmn.active_slot] != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setFragmentTexture:_sg_mtl_id(img->mtl.tex[img->cmn.active_slot]) atIndex:slot]; + _sg_stats_add(metal.bindings.num_set_fragment_texture, 1); } } @@ -11966,6 +12016,7 @@ _SOKOL_PRIVATE bool _sg_mtl_apply_bindings(_sg_bindings_t* bnd) { _sg.mtl.state_cache.cur_fs_sampler_ids[slot].id = smp->slot.id; SOKOL_ASSERT(smp->mtl.sampler_state != _SG_MTL_INVALID_SLOT_INDEX); [_sg.mtl.cmd_encoder setFragmentSamplerState:_sg_mtl_id(smp->mtl.sampler_state) atIndex:slot]; + _sg_stats_add(metal.bindings.num_set_fragment_sampler_state, 1); } } return true; @@ -11990,8 +12041,10 @@ _SOKOL_PRIVATE void _sg_mtl_apply_uniforms(sg_shader_stage stage_index, int ub_i memcpy(dst, data->ptr, data->size); if (stage_index == SG_SHADERSTAGE_VS) { [_sg.mtl.cmd_encoder setVertexBufferOffset:(NSUInteger)_sg.mtl.cur_ub_offset atIndex:(NSUInteger)ub_index]; + _sg_stats_add(metal.uniforms.num_set_vertex_buffer_offset, 1); } else { [_sg.mtl.cmd_encoder setFragmentBufferOffset:(NSUInteger)_sg.mtl.cur_ub_offset atIndex:(NSUInteger)ub_index]; + _sg_stats_add(metal.uniforms.num_set_fragment_buffer_offset, 1); } _sg.mtl.cur_ub_offset = _sg_roundup(_sg.mtl.cur_ub_offset + (int)data->size, _SG_MTL_UB_ALIGN); } From f9e62ce7b9051513ca4bed3aa18c5ea414781877 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 17:06:07 +0200 Subject: [PATCH 234/292] sokol_gfx.h wgpu: stats tracking cleanup --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9d1aed452..9d3b8b574 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12678,7 +12678,7 @@ _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_begin_pass(void) { _SOKOL_PRIVATE void _sg_wgpu_uniform_buffer_on_commit(void) { wgpuQueueWriteBuffer(_sg.wgpu.queue, _sg.wgpu.uniform.buf, 0, _sg.wgpu.uniform.staging, _sg.wgpu.uniform.offset); - _sg_stats_add(wgpu.size_uniform_write_buffer, _sg.wgpu.uniform.offset); + _sg_stats_add(wgpu.uniforms.size_write_buffer, _sg.wgpu.uniform.offset); _sg.wgpu.uniform.offset = 0; _sg_clear(&_sg.wgpu.uniform.bind.offsets[0][0], sizeof(_sg.wgpu.uniform.bind.offsets)); } @@ -13887,7 +13887,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(sg_shader_stage stage_index, int ub_ SOKOL_ASSERT(data->size <= _sg.wgpu.cur_pipeline->shader->cmn.stage[stage_index].uniform_blocks[ub_index].size); SOKOL_ASSERT(data->size <= _SG_WGPU_MAX_UNIFORM_UPDATE_SIZE); - _sg_stats_add(wgpu.num_uniform_set_bindgroup, 1); + _sg_stats_add(wgpu.uniforms.num_set_bindgroup, 1); memcpy(_sg.wgpu.uniform.staging + _sg.wgpu.uniform.offset, data->ptr, data->size); _sg.wgpu.uniform.bind.offsets[stage_index][ub_index] = _sg.wgpu.uniform.offset; _sg.wgpu.uniform.offset = _sg_roundup_u32(_sg.wgpu.uniform.offset + (uint32_t)data->size, alignment); From b2db2d5234e00fe3719815b383d8b902ec46c058 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 17:06:40 +0200 Subject: [PATCH 235/292] sokol_gfx_imgui.h: stats tracking panel cleanup --- util/sokol_gfx_imgui.h | 87 +++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 0cd60ae98..00c27baf1 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -4215,7 +4215,7 @@ _SOKOL_PRIVATE void _sg_imgui_draw_caps_panel(void) { } } -_SOKOL_PRIVATE void _sg_imgui_frame_stats_row(const char* key, uint32_t value) { +_SOKOL_PRIVATE void _sg_imgui_frame_add_stats_row(const char* key, uint32_t value) { igTableNextRow(0, 0.0f); igTableSetColumnIndex(0); igText(key); @@ -4223,6 +4223,8 @@ _SOKOL_PRIVATE void _sg_imgui_frame_stats_row(const char* key, uint32_t value) { igText("%d", value); } +#define _sg_imgui_frame_stats(key) _sg_imgui_frame_add_stats_row(#key, stats->key) + _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { _SOKOL_UNUSED(ctx); igCheckbox("Ignore sokol_imgui.h", &ctx->frame_stats.disable_sokol_imgui_stats); @@ -4237,36 +4239,59 @@ _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { igTableSetupColumn("key", ImGuiTableColumnFlags_None, 0, 0); igTableSetupColumn("value", ImGuiTableColumnFlags_None, 0, 0); igTableHeadersRow(); - _sg_imgui_frame_stats_row("frame_index", stats->frame_index); - _sg_imgui_frame_stats_row("num_passes", stats->num_passes); - _sg_imgui_frame_stats_row("num_apply_viewport", stats->num_apply_viewport); - _sg_imgui_frame_stats_row("num_apply_scissor_rect", stats->num_apply_scissor_rect); - _sg_imgui_frame_stats_row("num_apply_pipeline", stats->num_apply_pipeline); - _sg_imgui_frame_stats_row("num_apply_bindings", stats->num_apply_bindings); - _sg_imgui_frame_stats_row("num_apply_uniforms", stats->num_apply_uniforms); - _sg_imgui_frame_stats_row("num_draw", stats->num_draw); - _sg_imgui_frame_stats_row("num_update_buffer", stats->num_update_buffer); - _sg_imgui_frame_stats_row("num_append_buffer", stats->num_append_buffer); - _sg_imgui_frame_stats_row("num_update_image", stats->num_update_image); - _sg_imgui_frame_stats_row("size_apply_uniforms", stats->size_apply_uniforms); - _sg_imgui_frame_stats_row("size_update_buffer", stats->size_update_buffer); - _sg_imgui_frame_stats_row("size_append_buffer", stats->size_append_buffer); - _sg_imgui_frame_stats_row("size_update_image", stats->size_update_image); - if (sg_query_backend() == SG_BACKEND_WGPU) { - _sg_imgui_frame_stats_row("wgpu.num_uniform_set_bindgroup", stats->wgpu.num_uniform_set_bindgroup); - _sg_imgui_frame_stats_row("wgpu.size_uniform_write_buffer", stats->wgpu.size_uniform_write_buffer); - _sg_imgui_frame_stats_row("wgpu.bindings.num_set_vertex_buffer", stats->wgpu.bindings.num_set_vertex_buffer); - _sg_imgui_frame_stats_row("wgpu.bindings.num_skip_set_vertex_buffer", stats->wgpu.bindings.num_skip_set_vertex_buffer); - _sg_imgui_frame_stats_row("wgpu.bindings.num_set_index_buffer", stats->wgpu.bindings.num_set_index_buffer); - _sg_imgui_frame_stats_row("wgpu.bindings.num_skip_set_index_buffer", stats->wgpu.bindings.num_skip_set_index_buffer); - _sg_imgui_frame_stats_row("wgpu.bindings.num_create_bindgroup", stats->wgpu.bindings.num_create_bindgroup); - _sg_imgui_frame_stats_row("wgpu.bindings.num_discard_bindgroup", stats->wgpu.bindings.num_discard_bindgroup); - _sg_imgui_frame_stats_row("wgpu.bindings.num_set_bindgroup", stats->wgpu.bindings.num_set_bindgroup); - _sg_imgui_frame_stats_row("wgpu.bindings.num_set_empty_bindgroup", stats->wgpu.bindings.num_set_empty_bindgroup); - _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_hits", stats->wgpu.bindings.num_bindgroup_cache_hits); - _sg_imgui_frame_stats_row("wpgu.bindings.num_bindgroup_cache_misses", stats->wgpu.bindings.num_bindgroup_cache_misses); - _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_collisions", stats->wgpu.bindings.num_bindgroup_cache_collisions); - _sg_imgui_frame_stats_row("wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatches", stats->wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch); + _sg_imgui_frame_stats(num_passes); + _sg_imgui_frame_stats(num_apply_viewport); + _sg_imgui_frame_stats(num_apply_scissor_rect); + _sg_imgui_frame_stats(num_apply_pipeline); + _sg_imgui_frame_stats(num_apply_bindings); + _sg_imgui_frame_stats(num_apply_uniforms); + _sg_imgui_frame_stats(num_draw); + _sg_imgui_frame_stats(num_update_buffer); + _sg_imgui_frame_stats(num_append_buffer); + _sg_imgui_frame_stats(num_update_image); + _sg_imgui_frame_stats(size_apply_uniforms); + _sg_imgui_frame_stats(size_update_buffer); + _sg_imgui_frame_stats(size_append_buffer); + _sg_imgui_frame_stats(size_update_image); + switch (sg_query_backend()) { + case SG_BACKEND_WGPU: + _sg_imgui_frame_stats(wgpu.uniforms.num_set_bindgroup); + _sg_imgui_frame_stats(wgpu.uniforms.size_write_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_set_vertex_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_skip_set_vertex_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_set_index_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_skip_set_index_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_create_bindgroup); + _sg_imgui_frame_stats(wgpu.bindings.num_discard_bindgroup); + _sg_imgui_frame_stats(wgpu.bindings.num_set_bindgroup); + _sg_imgui_frame_stats(wgpu.bindings.num_set_empty_bindgroup); + _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_hits); + _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_misses); + _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_collisions); + _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_hash_vs_key_mismatch); + break; + case SG_BACKEND_METAL_MACOS: + case SG_BACKEND_METAL_IOS: + case SG_BACKEND_METAL_SIMULATOR: + _sg_imgui_frame_stats(metal.idpool.num_added); + _sg_imgui_frame_stats(metal.idpool.num_released); + _sg_imgui_frame_stats(metal.idpool.num_garbage_collected); + _sg_imgui_frame_stats(metal.pipeline.num_set_blend_color); + _sg_imgui_frame_stats(metal.pipeline.num_set_cull_mode); + _sg_imgui_frame_stats(metal.pipeline.num_set_front_facing_winding); + _sg_imgui_frame_stats(metal.pipeline.num_set_stencil_reference_value); + _sg_imgui_frame_stats(metal.pipeline.num_set_depth_bias); + _sg_imgui_frame_stats(metal.pipeline.num_set_render_pipeline_state); + _sg_imgui_frame_stats(metal.pipeline.num_set_depth_stencil_state); + _sg_imgui_frame_stats(metal.bindings.num_set_vertex_buffer); + _sg_imgui_frame_stats(metal.bindings.num_set_vertex_texture); + _sg_imgui_frame_stats(metal.bindings.num_set_vertex_sampler_state); + _sg_imgui_frame_stats(metal.bindings.num_set_fragment_texture); + _sg_imgui_frame_stats(metal.bindings.num_set_fragment_sampler_state); + _sg_imgui_frame_stats(metal.uniforms.num_set_vertex_buffer_offset); + _sg_imgui_frame_stats(metal.uniforms.num_set_fragment_buffer_offset); + break; + default: break; } igEndTable(); } From 44183993c520b5b161a6ad719d5157dced72031b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 19:45:36 +0200 Subject: [PATCH 236/292] sokol_gfx.h gl: add frame stats --- sokol_gfx.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 9d3b8b574..8fae65eb1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2869,7 +2869,17 @@ typedef struct sg_pass_info { struct will contains information about the *previous* frame. */ typedef struct sg_frame_stats_gl { - uint32_t fixme; + uint32_t num_bind_buffer; + uint32_t num_active_texture; + uint32_t num_bind_texture; + uint32_t num_bind_sampler; + uint32_t num_use_program; + uint32_t num_render_state; + uint32_t num_vertex_attrib_pointer; + uint32_t num_vertex_attrib_divisor; + uint32_t num_enable_vertex_attrib_array; + uint32_t num_disable_vertex_attrib_array; + uint32_t num_uniform; } sg_frame_stats_gl; typedef struct sg_frame_stats_d3d11 { @@ -6965,10 +6975,12 @@ _SOKOL_PRIVATE void _sg_gl_cache_clear_buffer_bindings(bool force) { if (force || (_sg.gl.cache.vertex_buffer != 0)) { glBindBuffer(GL_ARRAY_BUFFER, 0); _sg.gl.cache.vertex_buffer = 0; + _sg_stats_add(gl.num_bind_buffer, 1); } if (force || (_sg.gl.cache.index_buffer != 0)) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); _sg.gl.cache.index_buffer = 0; + _sg_stats_add(gl.num_bind_buffer, 1); } } @@ -6978,11 +6990,13 @@ _SOKOL_PRIVATE void _sg_gl_cache_bind_buffer(GLenum target, GLuint buffer) { if (_sg.gl.cache.vertex_buffer != buffer) { _sg.gl.cache.vertex_buffer = buffer; glBindBuffer(target, buffer); + _sg_stats_add(gl.num_bind_buffer, 1); } } else { if (_sg.gl.cache.index_buffer != buffer) { _sg.gl.cache.index_buffer = buffer; glBindBuffer(target, buffer); + _sg_stats_add(gl.num_bind_buffer, 1); } } } @@ -7016,10 +7030,12 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_buffer(GLuint buf) { if (buf == _sg.gl.cache.vertex_buffer) { _sg.gl.cache.vertex_buffer = 0; glBindBuffer(GL_ARRAY_BUFFER, 0); + _sg_stats_add(gl.num_bind_buffer, 1); } if (buf == _sg.gl.cache.index_buffer) { _sg.gl.cache.index_buffer = 0; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + _sg_stats_add(gl.num_bind_buffer, 1); } if (buf == _sg.gl.cache.stored_vertex_buffer) { _sg.gl.cache.stored_vertex_buffer = 0; @@ -7039,6 +7055,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_active_texture(GLenum texture) { if (_sg.gl.cache.cur_active_texture != texture) { _sg.gl.cache.cur_active_texture = texture; glActiveTexture(texture); + _sg_stats_add(gl.num_active_texture, 1); } _SG_GL_CHECK_ERROR(); } @@ -7049,11 +7066,14 @@ _SOKOL_PRIVATE void _sg_gl_cache_clear_texture_sampler_bindings(bool force) { if (force || (_sg.gl.cache.texture_samplers[i].texture != 0)) { GLenum gl_texture_unit = (GLenum) (GL_TEXTURE0 + i); glActiveTexture(gl_texture_unit); + _sg_stats_add(gl.num_active_texture, 1); glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_CUBE_MAP, 0); glBindTexture(GL_TEXTURE_3D, 0); glBindTexture(GL_TEXTURE_2D_ARRAY, 0); + _sg_stats_add(gl.num_bind_texture, 4); glBindSampler((GLuint)i, 0); + _sg_stats_add(gl.num_bind_sampler, 1); _sg.gl.cache.texture_samplers[i].target = 0; _sg.gl.cache.texture_samplers[i].texture = 0; _sg.gl.cache.texture_samplers[i].sampler = 0; @@ -7080,15 +7100,18 @@ _SOKOL_PRIVATE void _sg_gl_cache_bind_texture_sampler(int slot_index, GLenum tar if ((target != slot->target) && (slot->target != 0)) { glBindTexture(slot->target, 0); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_bind_texture, 1); } // apply new binding (can be 0 to unbind) if (target != 0) { glBindTexture(target, texture); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_bind_texture, 1); } // apply new sampler (can be 0 to unbind) glBindSampler((GLuint)slot_index, sampler); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_bind_sampler, 1); slot->target = target; slot->texture = texture; @@ -7123,8 +7146,10 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_texture_sampler(GLuint tex, GLuint s _sg_gl_cache_active_texture((GLenum)(GL_TEXTURE0 + i)); glBindTexture(slot->target, 0); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_bind_texture, 1); glBindSampler((GLuint)i, 0); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_bind_sampler, 1); slot->target = 0; slot->texture = 0; slot->sampler = 0; @@ -7142,6 +7167,7 @@ _SOKOL_PRIVATE void _sg_gl_cache_invalidate_program(GLuint prog) { if (prog == _sg.gl.cache.prog) { _sg.gl.cache.prog = 0; glUseProgram(0); + _sg_stats_add(gl.num_use_program, 1); } } @@ -7169,6 +7195,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { attr->divisor = -1; glDisableVertexAttribArray((GLuint)i); _SG_GL_CHECK_ERROR(); + _sg_stats_add(gl.num_disable_vertex_attrib_array, 1); } _sg.gl.cache.cur_primitive_type = GL_TRIANGLES; @@ -7193,6 +7220,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { glStencilFunc(GL_ALWAYS, 0, 0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0); + _sg_stats_add(gl.num_render_state, 7); // blend state _sg.gl.cache.blend.src_factor_rgb = SG_BLENDFACTOR_ONE; @@ -7205,6 +7233,7 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); glBlendColor(0.0f, 0.0f, 0.0f, 0.0f); + _sg_stats_add(gl.num_render_state, 4); // standalone state for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { @@ -7223,9 +7252,11 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) { glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); glEnable(GL_DITHER); glDisable(GL_POLYGON_OFFSET_FILL); + _sg_stats_add(gl.num_render_state, 10); #if defined(SOKOL_GLCORE33) glEnable(GL_MULTISAMPLE); glEnable(GL_PROGRAM_POINT_SIZE); + _sg_stats_add(gl.num_render_state, 2); #endif } } @@ -8095,10 +8126,12 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { if (state_ds->compare != cache_ds->compare) { cache_ds->compare = state_ds->compare; glDepthFunc(_sg_gl_compare_func(state_ds->compare)); + _sg_stats_add(gl.num_render_state, 1); } if (state_ds->write_enabled != cache_ds->write_enabled) { cache_ds->write_enabled = state_ds->write_enabled; glDepthMask(state_ds->write_enabled); + _sg_stats_add(gl.num_render_state, 1); } if (!_sg_fequal(state_ds->bias, cache_ds->bias, 0.000001f) || !_sg_fequal(state_ds->bias_slope_scale, cache_ds->bias_slope_scale, 0.000001f)) @@ -8111,6 +8144,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { cache_ds->bias = state_ds->bias; cache_ds->bias_slope_scale = state_ds->bias_slope_scale; glPolygonOffset(state_ds->bias_slope_scale, state_ds->bias); + _sg_stats_add(gl.num_render_state, 1); bool po_enabled = true; if (_sg_fequal(state_ds->bias, 0.0f, 0.000001f) && _sg_fequal(state_ds->bias_slope_scale, 0.0f, 0.000001f)) @@ -8124,6 +8158,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } else { glDisable(GL_POLYGON_OFFSET_FILL); } + _sg_stats_add(gl.num_render_state, 1); } } } @@ -8139,10 +8174,12 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } else { glDisable(GL_STENCIL_TEST); } + _sg_stats_add(gl.num_render_state, 1); } if (state_ss->write_mask != cache_ss->write_mask) { cache_ss->write_mask = state_ss->write_mask; glStencilMask(state_ss->write_mask); + _sg_stats_add(gl.num_render_state, 1); } for (int i = 0; i < 2; i++) { const sg_stencil_face_state* state_sfs = (i==0)? &state_ss->front : &state_ss->back; @@ -8157,6 +8194,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _sg_gl_compare_func(state_sfs->compare), state_ss->ref, state_ss->read_mask); + _sg_stats_add(gl.num_render_state, 1); } if ((state_sfs->fail_op != cache_sfs->fail_op) || (state_sfs->depth_fail_op != cache_sfs->depth_fail_op) || @@ -8169,6 +8207,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _sg_gl_stencil_op(state_sfs->fail_op), _sg_gl_stencil_op(state_sfs->depth_fail_op), _sg_gl_stencil_op(state_sfs->pass_op)); + _sg_stats_add(gl.num_render_state, 1); } } cache_ss->read_mask = state_ss->read_mask; @@ -8187,6 +8226,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } else { glDisable(GL_BLEND); } + _sg_stats_add(gl.num_render_state, 1); } if ((state_bs->src_factor_rgb != cache_bs->src_factor_rgb) || (state_bs->dst_factor_rgb != cache_bs->dst_factor_rgb) || @@ -8201,11 +8241,13 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _sg_gl_blend_factor(state_bs->dst_factor_rgb), _sg_gl_blend_factor(state_bs->src_factor_alpha), _sg_gl_blend_factor(state_bs->dst_factor_alpha)); + _sg_stats_add(gl.num_render_state, 1); } if ((state_bs->op_rgb != cache_bs->op_rgb) || (state_bs->op_alpha != cache_bs->op_alpha)) { cache_bs->op_rgb = state_bs->op_rgb; cache_bs->op_alpha = state_bs->op_alpha; glBlendEquationSeparate(_sg_gl_blend_op(state_bs->op_rgb), _sg_gl_blend_op(state_bs->op_alpha)); + _sg_stats_add(gl.num_render_state, 1); } // standalone color target state @@ -8227,6 +8269,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { (cm & SG_COLORMASK_A) != 0); } #endif + _sg_stats_add(gl.num_render_state, 1); } } @@ -8238,6 +8281,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { sg_color c = pip->cmn.blend_color; _sg.gl.cache.blend_color = c; glBlendColor(c.r, c.g, c.b, c.a); + _sg_stats_add(gl.num_render_state, 1); } } // pip->cmn.color_count > 0 @@ -8245,16 +8289,19 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { _sg.gl.cache.cull_mode = pip->gl.cull_mode; if (SG_CULLMODE_NONE == pip->gl.cull_mode) { glDisable(GL_CULL_FACE); + _sg_stats_add(gl.num_render_state, 1); } else { glEnable(GL_CULL_FACE); GLenum gl_mode = (SG_CULLMODE_FRONT == pip->gl.cull_mode) ? GL_FRONT : GL_BACK; glCullFace(gl_mode); + _sg_stats_add(gl.num_render_state, 2); } } if (pip->gl.face_winding != _sg.gl.cache.face_winding) { _sg.gl.cache.face_winding = pip->gl.face_winding; GLenum gl_winding = (SG_FACEWINDING_CW == pip->gl.face_winding) ? GL_CW : GL_CCW; glFrontFace(gl_winding); + _sg_stats_add(gl.num_render_state, 1); } if (pip->gl.alpha_to_coverage_enabled != _sg.gl.cache.alpha_to_coverage_enabled) { _sg.gl.cache.alpha_to_coverage_enabled = pip->gl.alpha_to_coverage_enabled; @@ -8263,6 +8310,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } else { glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); } + _sg_stats_add(gl.num_render_state, 1); } #ifdef SOKOL_GLCORE33 if (pip->gl.sample_count != _sg.gl.cache.sample_count) { @@ -8272,6 +8320,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { } else { glDisable(GL_MULTISAMPLE); } + _sg_stats_add(gl.num_render_state, 1); } #endif @@ -8279,6 +8328,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_pipeline(_sg_pipeline_t* pip) { if (pip->shader->gl.prog != _sg.gl.cache.prog) { _sg.gl.cache.prog = pip->shader->gl.prog; glUseProgram(pip->shader->gl.prog); + _sg_stats_add(gl.num_use_program, 1); } } _SG_GL_CHECK_ERROR(); @@ -8347,17 +8397,21 @@ _SOKOL_PRIVATE bool _sg_gl_apply_bindings(_sg_bindings_t* bnd) { { _sg_gl_cache_bind_buffer(GL_ARRAY_BUFFER, gl_vb); glVertexAttribPointer(attr_index, attr->size, attr->type, attr->normalized, attr->stride, (const GLvoid*)(GLintptr)vb_offset); + _sg_stats_add(gl.num_vertex_attrib_pointer, 1); glVertexAttribDivisor(attr_index, (GLuint)attr->divisor); + _sg_stats_add(gl.num_vertex_attrib_divisor, 1); cache_attr_dirty = true; } if (cache_attr->gl_attr.vb_index == -1) { glEnableVertexAttribArray(attr_index); + _sg_stats_add(gl.num_enable_vertex_attrib_array, 1); cache_attr_dirty = true; } } else { // attribute is disabled if (cache_attr->gl_attr.vb_index != -1) { glDisableVertexAttribArray(attr_index); + _sg_stats_add(gl.num_disable_vertex_attrib_array, 1); cache_attr_dirty = true; } } @@ -8385,6 +8439,7 @@ _SOKOL_PRIVATE void _sg_gl_apply_uniforms(sg_shader_stage stage_index, int ub_in if (u->gl_loc == -1) { continue; } + _sg_stats_add(gl.num_uniform, 1); GLfloat* fptr = (GLfloat*) (((uint8_t*)data->ptr) + u->offset); GLint* iptr = (GLint*) (((uint8_t*)data->ptr) + u->offset); switch (u->type) { From 43be6e751683a134292bbdd747fbba7a727962e5 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 2 Oct 2023 19:45:51 +0200 Subject: [PATCH 237/292] sokol_gfx_imgui.h: add gl stats to frame stats panel --- util/sokol_gfx_imgui.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index 00c27baf1..ac9cf13e0 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -4254,6 +4254,20 @@ _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { _sg_imgui_frame_stats(size_append_buffer); _sg_imgui_frame_stats(size_update_image); switch (sg_query_backend()) { + case SG_BACKEND_GLCORE33: + case SG_BACKEND_GLES3: + _sg_imgui_frame_stats(gl.num_bind_buffer); + _sg_imgui_frame_stats(gl.num_active_texture); + _sg_imgui_frame_stats(gl.num_bind_texture); + _sg_imgui_frame_stats(gl.num_bind_sampler); + _sg_imgui_frame_stats(gl.num_use_program); + _sg_imgui_frame_stats(gl.num_render_state); + _sg_imgui_frame_stats(gl.num_vertex_attrib_pointer); + _sg_imgui_frame_stats(gl.num_vertex_attrib_divisor); + _sg_imgui_frame_stats(gl.num_enable_vertex_attrib_array); + _sg_imgui_frame_stats(gl.num_disable_vertex_attrib_array); + _sg_imgui_frame_stats(gl.num_uniform); + break; case SG_BACKEND_WGPU: _sg_imgui_frame_stats(wgpu.uniforms.num_set_bindgroup); _sg_imgui_frame_stats(wgpu.uniforms.size_write_buffer); From 08897aeb5980fb6a86b79c88c65d76603a8e3ba6 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 11:24:43 +0200 Subject: [PATCH 238/292] sokol_gfx.h gl: coding style fixes for PR #886 --- sokol_app.h | 61 +++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index cdfbf27be..e0b061321 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -6596,7 +6596,8 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { SOKOL_ASSERT(_sapp.wgl.arb_pixel_format); const _sapp_gl_fbconfig* closest; - const int QUERY_TAGS[] = { + #define _sapp_wgl_num_query_tags (12) + const int query_tags[_sapp_wgl_num_query_tags] = { WGL_SUPPORT_OPENGL_ARB, WGL_DRAW_TO_WINDOW_ARB, WGL_PIXEL_TYPE_ARB, @@ -6610,25 +6611,25 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { WGL_STENCIL_BITS_ARB, WGL_SAMPLES_ARB, }; - const int RESULT_SUPPORT_OPENGL_INDEX = 0; - const int RESULT_DRAW_TO_WINDOW_INDEX = 1; - const int RESULT_PIXEL_TYPE_INDEX = 2; - const int RESULT_ACCELERATION_INDEX = 3; - const int RESULT_DOUBLE_BUFFER_INDEX = 4; - const int RESULT_RED_BITS_INDEX = 5; - const int RESULT_GREEN_BITS_INDEX = 6; - const int RESULT_BLUE_BITS_INDEX = 7; - const int RESULT_ALPHA_BITS_INDEX = 8; - const int RESULT_DEPTH_BITS_INDEX = 9; - const int RESULT_STENCIL_BITS_INDEX = 10; - const int RESULT_SAMPLES_INDEX = 11; - - int query_results[12] = {0}; + const int result_support_opengl_index = 0; + const int result_draw_to_window_index = 1; + const int result_pixel_type_index = 2; + const int result_acceleration_index = 3; + const int result_double_buffer_index = 4; + const int result_red_bits_index = 5; + const int result_green_bits_index = 6; + const int result_blue_bits_index = 7; + const int result_alpha_bits_index = 8; + const int result_depth_bits_index = 9; + const int result_stencil_bits_index = 10; + const int result_samples_index = 11; + + int query_results[_sapp_wgl_num_query_tags] = {0}; // Drop the last item if multisample extension is not supported. // If in future querying with multiple extensions, will have to shuffle index values to have active extensions on the end. - int query_count = 12; + int query_count = _sapp_wgl_num_query_tags; if (!_sapp.wgl.arb_multisample) { - query_count = 11; + query_count = _sapp_wgl_num_query_tags - 1; } int native_count = _sapp_wgl_attrib(1, WGL_NUMBER_PIXEL_FORMATS_ARB); @@ -6639,26 +6640,26 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { const int n = i + 1; _sapp_gl_fbconfig* u = usable_configs + usable_count; _sapp_gl_init_fbconfig(u); - _sapp_wgl_attribiv(n, query_count, QUERY_TAGS, query_results); + _sapp_wgl_attribiv(n, query_count, query_tags, query_results); - if (query_results[RESULT_SUPPORT_OPENGL_INDEX] == 0 - || query_results[RESULT_DRAW_TO_WINDOW_INDEX] == 0 - || query_results[RESULT_PIXEL_TYPE_INDEX] != WGL_TYPE_RGBA_ARB - || query_results[RESULT_ACCELERATION_INDEX] == WGL_NO_ACCELERATION_ARB) + if (query_results[result_support_opengl_index] == 0 + || query_results[result_draw_to_window_index] == 0 + || query_results[result_pixel_type_index] != WGL_TYPE_RGBA_ARB + || query_results[result_acceleration_index] == WGL_NO_ACCELERATION_ARB) { continue; } - u->red_bits = query_results[RESULT_RED_BITS_INDEX]; - u->green_bits = query_results[RESULT_GREEN_BITS_INDEX]; - u->blue_bits = query_results[RESULT_BLUE_BITS_INDEX]; - u->alpha_bits = query_results[RESULT_ALPHA_BITS_INDEX]; - u->depth_bits = query_results[RESULT_DEPTH_BITS_INDEX]; - u->stencil_bits = query_results[RESULT_STENCIL_BITS_INDEX]; - if (query_results[RESULT_DOUBLE_BUFFER_INDEX]) { + u->red_bits = query_results[result_red_bits_index]; + u->green_bits = query_results[result_green_bits_index]; + u->blue_bits = query_results[result_blue_bits_index]; + u->alpha_bits = query_results[result_alpha_bits_index]; + u->depth_bits = query_results[result_depth_bits_index]; + u->stencil_bits = query_results[result_stencil_bits_index]; + if (query_results[result_double_buffer_index]) { u->doublebuffer = true; } - u->samples = query_results[RESULT_SAMPLES_INDEX]; // Note: If arb_multisample is not supported - just takes the default 0 + u->samples = query_results[result_samples_index]; // NOTE: If arb_multisample is not supported - just takes the default 0 u->handle = (uintptr_t)n; usable_count++; From 5bfa84212b7428ed8ca3b55ffce214aff9e4954b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 11:27:08 +0200 Subject: [PATCH 239/292] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 706f8c85b..d5af7653f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Updates +#### 03-Oct-2023 + +- sokol_app.h win/gl: PR https://github.com/floooh/sokol/pull/886 has been merged, this makes + GL context initialization on Windows slightly more efficient. Many thanks to @dtrebilco! + #### 25-Sep-2023 - The allocator callback functions in all headers that support custom allocators have been renamed From a61ae2dd38ce3a7d2d6c105bc36ba9bb3c9e7c08 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 14:20:16 +0200 Subject: [PATCH 240/292] sokol_gfx.h d3d11: add d3d11 specific frame stats --- sokol_gfx.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 8fae65eb1..cf3ee1a5b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2882,8 +2882,53 @@ typedef struct sg_frame_stats_gl { uint32_t num_uniform; } sg_frame_stats_gl; +typedef struct sg_frame_stats_d3d11_pass { + uint32_t num_om_set_render_targets; + uint32_t num_clear_render_target_view; + uint32_t num_clear_depth_stencil_view; + uint32_t num_resolve_subresource; +} sg_frame_stats_d3d11_pass; + +typedef struct sg_frame_stats_d3d11_pipeline { + uint32_t num_rs_set_state; + uint32_t num_om_set_depth_stencil_state; + uint32_t num_om_set_blend_state; + uint32_t num_ia_set_primitive_topology; + uint32_t num_ia_set_input_layout; + uint32_t num_vs_set_shader; + uint32_t num_vs_set_constant_buffers; + uint32_t num_ps_set_shader; + uint32_t num_ps_set_constant_buffers; +} sg_frame_stats_d3d11_pipeline; + +typedef struct sg_frame_stats_d3d11_bindings { + uint32_t num_ia_set_vertex_buffers; + uint32_t num_ia_set_index_buffer; + uint32_t num_vs_set_shader_resources; + uint32_t num_ps_set_shader_resources; + uint32_t num_vs_set_samplers; + uint32_t num_ps_set_samplers; +} sg_frame_stats_d3d11_bindings; + +typedef struct sg_frame_stats_d3d11_uniforms { + uint32_t num_update_subresource; +} sg_frame_stats_d3d11_uniforms; + +typedef struct sg_frame_stats_d3d11_draw { + uint32_t num_draw_indexed_instanced; + uint32_t num_draw_indexed; + uint32_t num_draw_instanced; + uint32_t num_draw; +} sg_frame_stats_d3d11_draw; + typedef struct sg_frame_stats_d3d11 { - uint32_t fixme; + sg_frame_stats_d3d11_pass pass; + sg_frame_stats_d3d11_pipeline pipeline; + sg_frame_stats_d3d11_bindings bindings; + sg_frame_stats_d3d11_uniforms uniforms; + sg_frame_stats_d3d11_draw draw; + uint32_t num_map; + uint32_t num_unmap; } sg_frame_stats_d3d11; typedef struct sg_frame_stats_metal_idpool { @@ -10171,6 +10216,7 @@ _SOKOL_PRIVATE void _sg_d3d11_begin_pass(_sg_pass_t* pass, const sg_pass_action* } // apply the render-target- and depth-stencil-views _sg_d3d11_OMSetRenderTargets(_sg.d3d11.ctx, SG_MAX_COLOR_ATTACHMENTS, _sg.d3d11.cur_rtvs, _sg.d3d11.cur_dsv); + _sg_stats_add(d3d11.pass.num_om_set_render_targets, 1); // set viewport and scissor rect to cover whole screen D3D11_VIEWPORT vp; @@ -10190,6 +10236,7 @@ _SOKOL_PRIVATE void _sg_d3d11_begin_pass(_sg_pass_t* pass, const sg_pass_action* for (int i = 0; i < _sg.d3d11.num_rtvs; i++) { if (action->colors[i].load_action == SG_LOADACTION_CLEAR) { _sg_d3d11_ClearRenderTargetView(_sg.d3d11.ctx, _sg.d3d11.cur_rtvs[i], &action->colors[i].clear_value.r); + _sg_stats_add(d3d11.pass.num_clear_render_target_view, 1); } } UINT ds_flags = 0; @@ -10201,6 +10248,7 @@ _SOKOL_PRIVATE void _sg_d3d11_begin_pass(_sg_pass_t* pass, const sg_pass_action* } if ((0 != ds_flags) && _sg.d3d11.cur_dsv) { _sg_d3d11_ClearDepthStencilView(_sg.d3d11.ctx, _sg.d3d11.cur_dsv, ds_flags, action->depth.clear_value, action->stencil.clear_value); + _sg_stats_add(d3d11.pass.num_clear_depth_stencil_view, 1); } } @@ -10240,6 +10288,7 @@ _SOKOL_PRIVATE void _sg_d3d11_end_pass(void) { color_img->d3d11.res, src_subres, color_img->d3d11.format); + _sg_stats_add(d3d11.pass.num_resolve_subresource, 1); } } } @@ -10300,6 +10349,15 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_pipeline(_sg_pipeline_t* pip) { _sg_d3d11_VSSetConstantBuffers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_UBS, pip->shader->d3d11.stage[SG_SHADERSTAGE_VS].cbufs); _sg_d3d11_PSSetShader(_sg.d3d11.ctx, pip->shader->d3d11.fs, NULL, 0); _sg_d3d11_PSSetConstantBuffers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_UBS, pip->shader->d3d11.stage[SG_SHADERSTAGE_FS].cbufs); + _sg_stats_add(d3d11.pipeline.num_rs_set_state, 1); + _sg_stats_add(d3d11.pipeline.num_om_set_depth_stencil_state, 1); + _sg_stats_add(d3d11.pipeline.num_om_set_blend_state, 1); + _sg_stats_add(d3d11.pipeline.num_ia_set_primitive_topology, 1); + _sg_stats_add(d3d11.pipeline.num_ia_set_input_layout, 1); + _sg_stats_add(d3d11.pipeline.num_vs_set_shader, 1); + _sg_stats_add(d3d11.pipeline.num_vs_set_constant_buffers, 1); + _sg_stats_add(d3d11.pipeline.num_ps_set_shader, 1); + _sg_stats_add(d3d11.pipeline.num_ps_set_constant_buffers, 1); } _SOKOL_PRIVATE bool _sg_d3d11_apply_bindings(_sg_bindings_t* bnd) { @@ -10343,6 +10401,12 @@ _SOKOL_PRIVATE bool _sg_d3d11_apply_bindings(_sg_bindings_t* bnd) { _sg_d3d11_PSSetShaderResources(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_IMAGES, d3d11_fs_srvs); _sg_d3d11_VSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_vs_smps); _sg_d3d11_PSSetSamplers(_sg.d3d11.ctx, 0, SG_MAX_SHADERSTAGE_SAMPLERS, d3d11_fs_smps); + _sg_stats_add(d3d11.bindings.num_ia_set_vertex_buffers, 1); + _sg_stats_add(d3d11.bindings.num_ia_set_index_buffer, 1); + _sg_stats_add(d3d11.bindings.num_vs_set_shader_resources, 1); + _sg_stats_add(d3d11.bindings.num_ps_set_shader_resources, 1); + _sg_stats_add(d3d11.bindings.num_vs_set_samplers, 1); + _sg_stats_add(d3d11.bindings.num_ps_set_samplers, 1); return true; } @@ -10355,6 +10419,7 @@ _SOKOL_PRIVATE void _sg_d3d11_apply_uniforms(sg_shader_stage stage_index, int ub ID3D11Buffer* cb = _sg.d3d11.cur_pipeline->shader->d3d11.stage[stage_index].cbufs[ub_index]; SOKOL_ASSERT(cb); _sg_d3d11_UpdateSubresource(_sg.d3d11.ctx, (ID3D11Resource*)cb, 0, NULL, data->ptr, 0, 0); + _sg_stats_add(d3d11.uniforms.num_update_subresource, 1); } _SOKOL_PRIVATE void _sg_d3d11_draw(int base_element, int num_elements, int num_instances) { @@ -10362,14 +10427,18 @@ _SOKOL_PRIVATE void _sg_d3d11_draw(int base_element, int num_elements, int num_i if (_sg.d3d11.use_indexed_draw) { if (_sg.d3d11.use_instanced_draw) { _sg_d3d11_DrawIndexedInstanced(_sg.d3d11.ctx, (UINT)num_elements, (UINT)num_instances, (UINT)base_element, 0, 0); + _sg_stats_add(d3d11.draw.num_draw_indexed_instanced, 1); } else { _sg_d3d11_DrawIndexed(_sg.d3d11.ctx, (UINT)num_elements, (UINT)base_element, 0); + _sg_stats_add(d3d11.draw.num_draw_indexed, 1); } } else { if (_sg.d3d11.use_instanced_draw) { _sg_d3d11_DrawInstanced(_sg.d3d11.ctx, (UINT)num_elements, (UINT)num_instances, (UINT)base_element, 0); + _sg_stats_add(d3d11.draw.num_draw_instanced, 1); } else { _sg_d3d11_Draw(_sg.d3d11.ctx, (UINT)num_elements, (UINT)base_element); + _sg_stats_add(d3d11.draw.num_draw, 1); } } } @@ -10384,9 +10453,11 @@ _SOKOL_PRIVATE void _sg_d3d11_update_buffer(_sg_buffer_t* buf, const sg_range* d SOKOL_ASSERT(buf->d3d11.buf); D3D11_MAPPED_SUBRESOURCE d3d11_msr; HRESULT hr = _sg_d3d11_Map(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0, D3D11_MAP_WRITE_DISCARD, 0, &d3d11_msr); + _sg_stats_add(d3d11.num_map, 1); if (SUCCEEDED(hr)) { memcpy(d3d11_msr.pData, data->ptr, data->size); _sg_d3d11_Unmap(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0); + _sg_stats_add(d3d11.num_unmap, 1); } else { _SG_ERROR(D3D11_MAP_FOR_UPDATE_BUFFER_FAILED); } @@ -10399,10 +10470,12 @@ _SOKOL_PRIVATE void _sg_d3d11_append_buffer(_sg_buffer_t* buf, const sg_range* d D3D11_MAP map_type = new_frame ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE; D3D11_MAPPED_SUBRESOURCE d3d11_msr; HRESULT hr = _sg_d3d11_Map(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0, map_type, 0, &d3d11_msr); + _sg_stats_add(d3d11.num_map, 1); if (SUCCEEDED(hr)) { uint8_t* dst_ptr = (uint8_t*)d3d11_msr.pData + buf->cmn.append_pos; memcpy(dst_ptr, data->ptr, data->size); _sg_d3d11_Unmap(_sg.d3d11.ctx, (ID3D11Resource*)buf->d3d11.buf, 0); + _sg_stats_add(d3d11.num_unmap, 1); } else { _SG_ERROR(D3D11_MAP_FOR_APPEND_BUFFER_FAILED); } @@ -10429,6 +10502,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data const size_t slice_offset = slice_size * (size_t)slice_index; const uint8_t* slice_ptr = ((const uint8_t*)subimg_data->ptr) + slice_offset; hr = _sg_d3d11_Map(_sg.d3d11.ctx, img->d3d11.res, subres_index, D3D11_MAP_WRITE_DISCARD, 0, &d3d11_msr); + _sg_stats_add(d3d11.num_map, 1); if (SUCCEEDED(hr)) { // FIXME: need to handle difference in depth-pitch for 3D textures as well! if (src_pitch == (int)d3d11_msr.RowPitch) { @@ -10444,6 +10518,7 @@ _SOKOL_PRIVATE void _sg_d3d11_update_image(_sg_image_t* img, const sg_image_data } } _sg_d3d11_Unmap(_sg.d3d11.ctx, img->d3d11.res, subres_index); + _sg_stats_add(d3d11.num_unmap, 1); } else { _SG_ERROR(D3D11_MAP_FOR_UPDATE_IMAGE_FAILED); } From df394f8e0105030ead34776048e1a4236b1f3c69 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 14:20:46 +0200 Subject: [PATCH 241/292] sokol_gfx_imgui.h: add d3d11 frame stats to stats panel --- util/sokol_gfx_imgui.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index ac9cf13e0..4d29a7418 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -4235,10 +4235,11 @@ _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders; if (igBeginTable("##frame_stats_table", 2, flags, IMVEC2(0, 0), 0)) { - igTableSetupScrollFreeze(0, 1); + igTableSetupScrollFreeze(0, 2); igTableSetupColumn("key", ImGuiTableColumnFlags_None, 0, 0); igTableSetupColumn("value", ImGuiTableColumnFlags_None, 0, 0); igTableHeadersRow(); + _sg_imgui_frame_stats(frame_index); _sg_imgui_frame_stats(num_passes); _sg_imgui_frame_stats(num_apply_viewport); _sg_imgui_frame_stats(num_apply_scissor_rect); @@ -4305,6 +4306,34 @@ _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { _sg_imgui_frame_stats(metal.uniforms.num_set_vertex_buffer_offset); _sg_imgui_frame_stats(metal.uniforms.num_set_fragment_buffer_offset); break; + case SG_BACKEND_D3D11: + _sg_imgui_frame_stats(d3d11.pass.num_om_set_render_targets); + _sg_imgui_frame_stats(d3d11.pass.num_clear_render_target_view); + _sg_imgui_frame_stats(d3d11.pass.num_clear_depth_stencil_view); + _sg_imgui_frame_stats(d3d11.pass.num_resolve_subresource); + _sg_imgui_frame_stats(d3d11.pipeline.num_rs_set_state); + _sg_imgui_frame_stats(d3d11.pipeline.num_om_set_depth_stencil_state); + _sg_imgui_frame_stats(d3d11.pipeline.num_om_set_blend_state); + _sg_imgui_frame_stats(d3d11.pipeline.num_ia_set_primitive_topology); + _sg_imgui_frame_stats(d3d11.pipeline.num_ia_set_input_layout); + _sg_imgui_frame_stats(d3d11.pipeline.num_vs_set_shader); + _sg_imgui_frame_stats(d3d11.pipeline.num_vs_set_constant_buffers); + _sg_imgui_frame_stats(d3d11.pipeline.num_ps_set_shader); + _sg_imgui_frame_stats(d3d11.pipeline.num_ps_set_constant_buffers); + _sg_imgui_frame_stats(d3d11.bindings.num_ia_set_vertex_buffers); + _sg_imgui_frame_stats(d3d11.bindings.num_ia_set_index_buffer); + _sg_imgui_frame_stats(d3d11.bindings.num_vs_set_shader_resources); + _sg_imgui_frame_stats(d3d11.bindings.num_ps_set_shader_resources); + _sg_imgui_frame_stats(d3d11.bindings.num_vs_set_samplers); + _sg_imgui_frame_stats(d3d11.bindings.num_ps_set_samplers); + _sg_imgui_frame_stats(d3d11.uniforms.num_update_subresource); + _sg_imgui_frame_stats(d3d11.draw.num_draw_indexed_instanced); + _sg_imgui_frame_stats(d3d11.draw.num_draw_indexed); + _sg_imgui_frame_stats(d3d11.draw.num_draw_instanced); + _sg_imgui_frame_stats(d3d11.draw.num_draw); + _sg_imgui_frame_stats(d3d11.num_map); + _sg_imgui_frame_stats(d3d11.num_unmap); + break; default: break; } igEndTable(); From 639c202b7d8718aa56a906df78fff53fc91f5091 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 15:24:09 +0200 Subject: [PATCH 242/292] add webgpu compilation tests --- tests/CMakeLists.txt | 7 ++++++- tests/CMakePresets.json | 28 ++++++++++++++++++++++++++++ tests/test_emscripten.sh | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3545b7584..c30d5571f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -69,7 +69,12 @@ endif() if (EMSCRIPTEN) set(CMAKE_EXECUTABLE_SUFFIX ".html") - set(link_flags ${link-flags} -sNO_FILESYSTEM=1 -sASSERTIONS=0 -sMALLOC=emmalloc -sINITIAL_MEMORY=33554432 --closure=1) + set(link_flags ${link_flags} -sNO_FILESYSTEM=1 -sASSERTIONS=0 -sMALLOC=emmalloc -sINITIAL_MEMORY=33554432 --closure=1) + if (SOKOL_BACKEND STREQUAL SOKOL_WGPU) + set(link_flags ${link_flags} -sUSE_WEBGPU=1) + else() + set(link_flags ${link_flags} -sUSE_WEBGL2=1) + endif() elseif (OSX_IOS) set(exe_type MACOSX_BUNDLE) if (USE_ARC) diff --git a/tests/CMakePresets.json b/tests/CMakePresets.json index df7a56599..fe0b89640 100644 --- a/tests/CMakePresets.json +++ b/tests/CMakePresets.json @@ -390,6 +390,26 @@ "CMAKE_BUILD_TYPE": "Release" } }, + { + "name": "emsc_wgpu_debug", + "generator": "Ninja", + "binaryDir": "build/emsc_wgpu_debug", + "toolchainFile": "build/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake", + "cacheVariables": { + "SOKOL_BACKEND": "SOKOL_WGPU", + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "emsc_wgpu_release", + "generator": "Ninja", + "binaryDir": "build/emsc_wgpu_release", + "toolchainFile": "build/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake", + "cacheVariables": { + "SOKOL_BACKEND": "SOKOL_WGPU", + "CMAKE_BUILD_TYPE": "Release" + } + }, { "name": "android_debug", "generator": "Ninja", @@ -644,6 +664,14 @@ "name": "emsc_webgl2_release", "configurePreset": "emsc_webgl2_release" }, + { + "name": "emsc_wgpu_debug", + "configurePreset": "emsc_wgpu_debug" + }, + { + "name": "emsc_wgpu_release", + "configurePreset": "emsc_wgpu_release" + }, { "name": "android_debug", "configurePreset": "android_debug" diff --git a/tests/test_emscripten.sh b/tests/test_emscripten.sh index 74f0ad1ba..aff4b08ed 100755 --- a/tests/test_emscripten.sh +++ b/tests/test_emscripten.sh @@ -4,3 +4,5 @@ source test_common.sh setup_emsdk build emsc_webgl2_debug emsc_webgl2_debug build emsc_webgl2_release emsc_webgl2_release +build emsc_wgpu_debug emsc_wgpu_debug +build emsc_wgpu_release emsc_wgpu_release From e81a05e2cbc73d96c62610837547e13781616f45 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Oct 2023 15:25:06 +0200 Subject: [PATCH 243/292] sokol_app.h: fix comment typo --- sokol_app.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_app.h b/sokol_app.h index 32b41daa2..ed7431dfd 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -1493,7 +1493,7 @@ typedef struct sapp_icon_desc { Used in sapp_desc to provide custom memory-alloc and -free functions to sokol_app.h. If memory management should be overridden, both the - alloc_fb and free_fn function must be provided (e.g. it's not valid to + alloc_fn and free_fn function must be provided (e.g. it's not valid to override one function but not the other). */ typedef struct sapp_allocator { From 88d03f50ebef965877dd483dad044de6f60ff962 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 4 Oct 2023 19:21:30 +0200 Subject: [PATCH 244/292] sokol_gfx.h gl: enable GL_TEXTURE_CUBE_MAP_SEAMLESS (see #910) --- sokol_gfx.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 11035bad0..06ef6e735 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4103,6 +4103,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_REF_TO_TEXTURE 0x884E + #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #endif #ifndef GL_UNSIGNED_INT_2_10_10_10_REV @@ -7366,6 +7367,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_context(_sg_context_t* ctx) { _SG_GL_CHECK_ERROR(); // incoming texture data is generally expected to be packed tightly glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + #if defined(SOKOL_GLCORE33) + // enable seamless cubemap sampling (only desktop GL) + glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); + #endif return SG_RESOURCESTATE_VALID; } From ca02b4aeb4cb8630a49b730c86f16a7a8729678e Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 5 Oct 2023 19:58:03 +0200 Subject: [PATCH 245/292] sokol_gfx.h metal, wgpu: unify scissor rect clipping, wgpu: add viewport clipping (even if this is wrong) --- sokol_gfx.h | 74 ++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 06ef6e735..00ac30480 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -5387,6 +5387,23 @@ _SOKOL_PRIVATE uint32_t _sg_align_u32(uint32_t val, uint32_t align) { return (val + (align - 1)) & ~(align - 1); } +typedef struct { int x, y, w, h; } _sg_recti_t; + +_SOKOL_PRIVATE _sg_recti_t _sg_clipi(int x, int y, int w, int h, int clip_width, int clip_height) { + x = _sg_min(_sg_max(0, x), clip_width-1); + y = _sg_min(_sg_max(0, y), clip_height-1); + if ((x + w) > clip_width) { + w = clip_width - x; + } + if ((y + h) > clip_height) { + h = clip_height - y; + } + w = _sg_max(w, 1); + h = _sg_max(h, 1); + const _sg_recti_t res = { x, y, w, h }; + return res; +} + _SOKOL_PRIVATE int _sg_vertexformat_bytesize(sg_vertex_format fmt) { switch (fmt) { case SG_VERTEXFORMAT_FLOAT: return 4; @@ -12102,22 +12119,12 @@ _SOKOL_PRIVATE void _sg_mtl_apply_scissor_rect(int x, int y, int w, int h, bool } SOKOL_ASSERT(nil != _sg.mtl.cmd_encoder); // clip against framebuffer rect - x = _sg_min(_sg_max(0, x), _sg.mtl.cur_width-1); - y = _sg_min(_sg_max(0, y), _sg.mtl.cur_height-1); - if ((x + w) > _sg.mtl.cur_width) { - w = _sg.mtl.cur_width - x; - } - if ((y + h) > _sg.mtl.cur_height) { - h = _sg.mtl.cur_height - y; - } - w = _sg_max(w, 1); - h = _sg_max(h, 1); - + const _sg_recti_t clip = _sg_clipi(x, y, w, h, _sg.mtl.cur_width, _sg.mtl.cur_height); MTLScissorRect r; - r.x = (NSUInteger)x; - r.y = (NSUInteger) (origin_top_left ? y : (_sg.mtl.cur_height - (y + h))); - r.width = (NSUInteger)w; - r.height = (NSUInteger)h; + r.x = (NSUInteger)clip.x; + r.y = (NSUInteger) (origin_top_left ? clip.y : (_sg.mtl.cur_height - (clip.y + clip.h))); + r.width = (NSUInteger)clip.w; + r.height = (NSUInteger)clip.h; [_sg.mtl.cmd_encoder setScissorRect:r]; } @@ -14016,35 +14023,26 @@ _SOKOL_PRIVATE void _sg_wgpu_commit(void) { _SOKOL_PRIVATE void _sg_wgpu_apply_viewport(int x, int y, int w, int h, bool origin_top_left) { SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - float xf = (float) x; - float yf = (float) (origin_top_left ? y : (_sg.wgpu.cur_height - (y + h))); - float wf = (float) w; - float hf = (float) h; + // FIXME FIXME FIXME: CLIPPING THE VIEWPORT HERE IS WRONG!!! + // (but currently required because WebGPU insists that the viewport rectangle must be + // fully contained inside the framebuffer, but this doesn't make any sense, and also + // isn't required by the backend APIs) + const _sg_recti_t clip = _sg_clipi(x, y, w, h, _sg.wgpu.cur_width, _sg.wgpu.cur_height); + float xf = (float) clip.x; + float yf = (float) (origin_top_left ? clip.y : (_sg.wgpu.cur_height - (clip.y + clip.h))); + float wf = (float) clip.w; + float hf = (float) clip.h; wgpuRenderPassEncoderSetViewport(_sg.wgpu.pass_enc, xf, yf, wf, hf, 0.0f, 1.0f); } _SOKOL_PRIVATE void _sg_wgpu_apply_scissor_rect(int x, int y, int w, int h, bool origin_top_left) { SOKOL_ASSERT(_sg.wgpu.in_pass); SOKOL_ASSERT(_sg.wgpu.pass_enc); - SOKOL_ASSERT(_sg.wgpu.in_pass); - SOKOL_ASSERT(_sg.wgpu.pass_enc); - - // clip against framebuffer rect - x = _sg_min(_sg_max(0, x), _sg.wgpu.cur_width-1); - y = _sg_min(_sg_max(0, y), _sg.wgpu.cur_height-1); - if ((x + w) > _sg.wgpu.cur_width) { - w = _sg.wgpu.cur_width - x; - } - if ((y + h) > _sg.wgpu.cur_height) { - h = _sg.wgpu.cur_height - y; - } - w = _sg_max(w, 1); - h = _sg_max(h, 1); - - uint32_t sx = (uint32_t) x; - uint32_t sy = (uint32_t) (origin_top_left ? y : (_sg.wgpu.cur_height - (y + h))); - uint32_t sw = (uint32_t) w; - uint32_t sh = (uint32_t) h; + const _sg_recti_t clip = _sg_clipi(x, y, w, h, _sg.wgpu.cur_width, _sg.wgpu.cur_height); + uint32_t sx = (uint32_t) clip.x; + uint32_t sy = (uint32_t) (origin_top_left ? clip.y : (_sg.wgpu.cur_height - (clip.y + clip.h))); + uint32_t sw = (uint32_t) clip.w; + uint32_t sh = (uint32_t) clip.h; wgpuRenderPassEncoderSetScissorRect(_sg.wgpu.pass_enc, sx, sy, sw, sh); } From d98c8b92c25070f13d0491f5fade1d9d2ca885ad Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 6 Oct 2023 19:25:41 +0200 Subject: [PATCH 246/292] sokol_gfx.h metal: remove redundant MTLGPUFamilyApple8 check (see #914) --- sokol_gfx.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 063c70c91..decfd385c 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -10757,7 +10757,6 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) { #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 120000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) if (@available(macOS 12.0, iOS 14.0, *)) { _sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyApple7] - || [_sg.mtl.device supportsFamily:MTLGPUFamilyApple8] || [_sg.mtl.device supportsFamily:MTLGPUFamilyMac2]; #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 160000) if (!_sg.features.image_clamp_to_border) { From dff70598b1eba16f53cfb5de60ea89cbea6a4d1b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 8 Oct 2023 16:36:53 +0200 Subject: [PATCH 247/292] sokol_gfx.h wgpu: fix 3d texture view creation, use aspect DepthOnly for depth-stencil textures --- sokol_gfx.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 00ac30480..75148c9fe 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13506,10 +13506,13 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s if (img->cmn.type == SG_IMAGETYPE_CUBE) { wgpu_texview_desc.arrayLayerCount = 6; } else { - wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + wgpu_texview_desc.arrayLayerCount = 1; + } + if (_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format)) { + wgpu_texview_desc.aspect = WGPUTextureAspect_DepthOnly; + } else { + wgpu_texview_desc.aspect = WGPUTextureAspect_All; } - // FIXME: should aspect be DepthOnly for all depth texture formats? - wgpu_texview_desc.aspect = WGPUTextureAspect_All; img->wgpu.view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_texview_desc); if (0 == img->wgpu.view) { _SG_ERROR(WGPU_CREATE_TEXTURE_VIEW_FAILED); From 61675b5c621563619c19ca99dbf42d7fcf5d2165 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 8 Oct 2023 16:48:08 +0200 Subject: [PATCH 248/292] sokol_gfx.h wgpu: fix ETC2 texture compression support --- sokol_gfx.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 75148c9fe..e2866b671 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12606,6 +12606,11 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_BC6H_RGBF: return WGPUTextureFormat_BC6HRGBFloat; case SG_PIXELFORMAT_BC6H_RGBUF: return WGPUTextureFormat_BC6HRGBUfloat; case SG_PIXELFORMAT_BC7_RGBA: return WGPUTextureFormat_BC7RGBAUnorm; + case SG_PIXELFORMAT_ETC2_RGB8: return WGPUTextureFormat_ETC2RGB8Unorm; + case SG_PIXELFORMAT_ETC2_RGB8A1: return WGPUTextureFormat_ETC2RGB8A1Unorm; + case SG_PIXELFORMAT_ETC2_RGBA8: return WGPUTextureFormat_ETC2RGBA8Unorm; + case SG_PIXELFORMAT_ETC2_RG11: return WGPUTextureFormat_EACR11Unorm; + case SG_PIXELFORMAT_ETC2_RG11SN: return WGPUTextureFormat_EACR11Snorm; // NOT SUPPORTED case SG_PIXELFORMAT_R16: @@ -12620,11 +12625,6 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_PVRTC_RGB_4BPP: case SG_PIXELFORMAT_PVRTC_RGBA_2BPP: case SG_PIXELFORMAT_PVRTC_RGBA_4BPP: - case SG_PIXELFORMAT_ETC2_RGB8: - case SG_PIXELFORMAT_ETC2_RGB8A1: - case SG_PIXELFORMAT_ETC2_RGBA8: - case SG_PIXELFORMAT_ETC2_RG11: - case SG_PIXELFORMAT_ETC2_RG11SN: default: SOKOL_UNREACHABLE; return WGPUTextureFormat_Force32; From be548e5a0d11a62cf0e9d2ec2d860f89d819cebb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 8 Oct 2023 18:12:50 +0200 Subject: [PATCH 249/292] sokol_gfx.h wgpu: fix array texture creation --- sokol_gfx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index e2866b671..356358435 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13505,6 +13505,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; if (img->cmn.type == SG_IMAGETYPE_CUBE) { wgpu_texview_desc.arrayLayerCount = 6; + } else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { + wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; } else { wgpu_texview_desc.arrayLayerCount = 1; } From 06ea82c65c51f26c0ff8697146555e07d7b41013 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 9 Oct 2023 14:37:58 +0200 Subject: [PATCH 250/292] sokol_gfx.h wgpu: cleanup comments and wgpu bindings cache code --- sokol_gfx.h | 240 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 162 insertions(+), 78 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 356358435..22ba72742 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -68,7 +68,7 @@ sokol_gfx DOES NOT: =================== - - create a window or the 3D-API context/device, you must do this + - create a window, swapchain or the 3D-API context/device, you must do this before sokol_gfx is initialized, and pass any required information (like 3D device pointers) to the sokol_gfx initialization call @@ -404,7 +404,7 @@ - https://floooh.github.io/sokol-html5/mrt-sapp.html - https://floooh.github.io/sokol-html5/mrt-pixelformats-sapp.html - A render pass wraps rendering commands into a common set of render target images + A render pass groups rendering commands into a set of render target images (called 'pass attachments'). Render target images can be used in subsequent passes as textures (it is invalid to use the same image both as render target and as texture in the same pass). @@ -1259,7 +1259,7 @@ extern "C" { sg_buffer: vertex- and index-buffers sg_image: images used as textures and render targets sg_sampler sampler object describing how a texture is sampled in a shader - sg_shader: vertex- and fragment-shaders, uniform blocks + sg_shader: vertex- and fragment-shaders and shader interface information 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 @@ -2974,13 +2974,13 @@ typedef struct sg_frame_stats_wgpu_uniforms { typedef struct sg_frame_stats_wgpu_bindings { uint32_t num_set_vertex_buffer; - uint32_t num_skip_set_vertex_buffer; + uint32_t num_skip_redundant_vertex_buffer; uint32_t num_set_index_buffer; - uint32_t num_skip_set_index_buffer; + uint32_t num_skip_redundant_index_buffer; uint32_t num_create_bindgroup; uint32_t num_discard_bindgroup; uint32_t num_set_bindgroup; - uint32_t num_set_empty_bindgroup; + uint32_t num_skip_redundant_bindgroup; uint32_t num_bindgroup_cache_hits; uint32_t num_bindgroup_cache_misses; uint32_t num_bindgroup_cache_collisions; @@ -3313,6 +3313,9 @@ typedef enum sg_log_item { .uniform_buffer_size 4 MB (4*1024*1024) .max_commit_listeners 1024 .disable_validation false + .mtl_force_managed_storage_mode false + .wgpu_disable_bindgroups_cache false + .wgpu_bindgroups_cache_size 1024 .allocator.alloc_fn 0 (in this case, malloc() will be called) .allocator.free_fn 0 (in this case, free() will be called) @@ -3333,6 +3336,10 @@ typedef enum sg_log_item { must hold a strong reference to the Objective-C object for the duration of the sokol_gfx call! + .mtl_force_managed_storage_mode + when enabled, Metal buffers and texture resources are created in managed storage + mode, otherwise sokol-gfx will decide whether to create buffers and + textures in managed or shared storage mode (this is mainly a debugging option) .context.metal.device a pointer to the MTLDevice object .context.metal.renderpass_descriptor_cb @@ -3372,6 +3379,19 @@ typedef enum sg_log_item { callback functions WebGPU specific: + .wgpu_disable_bindgroups_cache + When this is true, the WebGPU backend will create and immediately + release a BindGroup object in the sg_apply_bindings() call, only + use this for debugging purposes. + .wgpu_bindgroups_cache_size + The size of the bindgroups cache for re-using BindGroup objects + between sg_apply_bindings() calls. The smaller the cache size, + the more likely are cache slot collisions which will cause + a BindGroups object to be destroyed and a new one created. + Use the information returned by sg_query_stats() to check + if this is a frequent occurence, and increase the cache size as + needed (the default is 1024). + NOTE: wgpu_bindgroups_cache_size must be a power-of-2 number! .context.wgpu.device a WGPUDevice handle .context.wgpu.render_format @@ -3507,7 +3527,7 @@ typedef struct sg_desc { int max_commit_listeners; bool disable_validation; // disable validation layer even in debug mode, useful for tests bool mtl_force_managed_storage_mode; // for debugging: use Metal managed storage mode for resources even with UMA - bool wgpu_disable_bindgroups_cache; // set to false to disable the WebGPU backend BindGroup cache + bool wgpu_disable_bindgroups_cache; // set to true to disable the WebGPU backend BindGroup cache int wgpu_bindgroups_cache_size; // number of slots in the WebGPU bindgroup cache (must be 2^N) sg_allocator allocator; sg_logger logger; // optional log function override @@ -4207,7 +4227,7 @@ typedef struct { sg_resource_state state; } _sg_slot_t; -// a common resource pool housekeeping struct +// resource pool housekeeping struct typedef struct { int size; int queue_top; @@ -5147,6 +5167,7 @@ typedef struct { sg_buffer buffer; int offset; } ib; + _sg_wgpu_bindgroup_handle_t bg; } _sg_wgpu_bindings_cache_t; // the WGPU backend state @@ -12526,8 +12547,8 @@ _SOKOL_PRIVATE WGPUVertexFormat _sg_wgpu_vertexformat(sg_vertex_format f) { case SG_VERTEXFORMAT_USHORT4N: return WGPUVertexFormat_Unorm16x4; case SG_VERTEXFORMAT_HALF2: return WGPUVertexFormat_Float16x2; case SG_VERTEXFORMAT_HALF4: return WGPUVertexFormat_Float16x4; - // FIXME! UINT10_N2 - case SG_VERTEXFORMAT_UINT10_N2: + // FIXME! UINT10_N2 (see https://github.com/gpuweb/gpuweb/issues/4275) + case SG_VERTEXFORMAT_UINT10_N2: return WGPUVertexFormat_Undefined; default: SOKOL_UNREACHABLE; return WGPUVertexFormat_Force32; @@ -12541,7 +12562,9 @@ _SOKOL_PRIVATE WGPUPrimitiveTopology _sg_wgpu_topology(sg_primitive_type t) { case SG_PRIMITIVETYPE_LINE_STRIP: return WGPUPrimitiveTopology_LineStrip; case SG_PRIMITIVETYPE_TRIANGLES: return WGPUPrimitiveTopology_TriangleList; case SG_PRIMITIVETYPE_TRIANGLE_STRIP: return WGPUPrimitiveTopology_TriangleStrip; - default: SOKOL_UNREACHABLE; return WGPUPrimitiveTopology_Force32; + default: + SOKOL_UNREACHABLE; + return WGPUPrimitiveTopology_Force32; } } @@ -12554,7 +12577,9 @@ _SOKOL_PRIVATE WGPUCullMode _sg_wgpu_cullmode(sg_cull_mode cm) { case SG_CULLMODE_NONE: return WGPUCullMode_None; case SG_CULLMODE_FRONT: return WGPUCullMode_Front; case SG_CULLMODE_BACK: return WGPUCullMode_Back; - default: SOKOL_UNREACHABLE; return WGPUCullMode_Force32; + default: + SOKOL_UNREACHABLE; + return WGPUCullMode_Force32; } } @@ -12625,6 +12650,8 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_PVRTC_RGB_4BPP: case SG_PIXELFORMAT_PVRTC_RGBA_2BPP: case SG_PIXELFORMAT_PVRTC_RGBA_4BPP: + return WGPUTextureFormat_Undefined; + default: SOKOL_UNREACHABLE; return WGPUTextureFormat_Force32; @@ -12641,7 +12668,9 @@ _SOKOL_PRIVATE WGPUCompareFunction _sg_wgpu_comparefunc(sg_compare_func f) { case SG_COMPAREFUNC_NOT_EQUAL: return WGPUCompareFunction_NotEqual; case SG_COMPAREFUNC_GREATER_EQUAL: return WGPUCompareFunction_GreaterEqual; case SG_COMPAREFUNC_ALWAYS: return WGPUCompareFunction_Always; - default: SOKOL_UNREACHABLE; return WGPUCompareFunction_Force32; + default: + SOKOL_UNREACHABLE; + return WGPUCompareFunction_Force32; } } @@ -12655,7 +12684,9 @@ _SOKOL_PRIVATE WGPUStencilOperation _sg_wgpu_stencilop(sg_stencil_op op) { case SG_STENCILOP_INVERT: return WGPUStencilOperation_Invert; case SG_STENCILOP_INCR_WRAP: return WGPUStencilOperation_IncrementWrap; case SG_STENCILOP_DECR_WRAP: return WGPUStencilOperation_DecrementWrap; - default: SOKOL_UNREACHABLE; return WGPUStencilOperation_Force32; + default: + SOKOL_UNREACHABLE; + return WGPUStencilOperation_Force32; } } @@ -12664,7 +12695,9 @@ _SOKOL_PRIVATE WGPUBlendOperation _sg_wgpu_blendop(sg_blend_op op) { case SG_BLENDOP_ADD: return WGPUBlendOperation_Add; case SG_BLENDOP_SUBTRACT: return WGPUBlendOperation_Subtract; case SG_BLENDOP_REVERSE_SUBTRACT: return WGPUBlendOperation_ReverseSubtract; - default: SOKOL_UNREACHABLE; return WGPUBlendOperation_Force32; + default: + SOKOL_UNREACHABLE; + return WGPUBlendOperation_Force32; } } @@ -12687,7 +12720,8 @@ _SOKOL_PRIVATE WGPUBlendFactor _sg_wgpu_blendfactor(sg_blend_factor f) { case SG_BLENDFACTOR_BLEND_ALPHA: return WGPUBlendFactor_Constant; case SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA: return WGPUBlendFactor_OneMinusConstant; default: - SOKOL_UNREACHABLE; return WGPUBlendFactor_Force32; + SOKOL_UNREACHABLE; + return WGPUBlendFactor_Force32; } } @@ -12751,6 +12785,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { // FIXME: in webgpu.h, wgpuDeviceGetLimits() has a boolean return value, but // the JS shim doesn't actually return anything + // (see: https://github.com/emscripten-core/emscripten/issues/20278) wgpuDeviceGetLimits(_sg.wgpu.dev, &_sg.wgpu.limits); const WGPULimits* l = &_sg.wgpu.limits.limits; @@ -13194,30 +13229,81 @@ _SOKOL_PRIVATE uint32_t _sg_wgpu_bindgroups_cache_get(uint64_t hash) { return _sg.wgpu.bindgroups_cache.items[index].id; } -_SOKOL_PRIVATE void _sg_wgpu_bindcache_clear(void) { +_SOKOL_PRIVATE void _sg_wgpu_bindings_cache_clear(void) { memset(&_sg.wgpu.bindings_cache, 0, sizeof(_sg.wgpu.bindings_cache)); } -_SOKOL_PRIVATE bool _sg_wgpu_bindcache_vb_dirty(int index, const _sg_buffer_t* vb, int offset) { - SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); - return (vb->slot.id != _sg.wgpu.bindings_cache.vbs[index].buffer.id) || (offset != _sg.wgpu.bindings_cache.vbs[index].offset); +_SOKOL_PRIVATE bool _sg_wgpu_bindings_cache_vb_dirty(int index, const _sg_buffer_t* vb, int offset) { + SOKOL_ASSERT((index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); + if (vb) { + return (_sg.wgpu.bindings_cache.vbs[index].buffer.id != vb->slot.id) + || (_sg.wgpu.bindings_cache.vbs[index].offset != offset); + } else { + return _sg.wgpu.bindings_cache.vbs[index].buffer.id != SG_INVALID_ID; + } } -_SOKOL_PRIVATE void _sg_wgpu_bindcache_vb_update(int index, const _sg_buffer_t* vb, int offset) { - SOKOL_ASSERT(vb && (index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); - _sg.wgpu.bindings_cache.vbs[index].buffer.id = vb->slot.id; - _sg.wgpu.bindings_cache.vbs[index].offset = offset; +_SOKOL_PRIVATE void _sg_wgpu_bindings_cache_vb_update(int index, const _sg_buffer_t* vb, int offset) { + SOKOL_ASSERT((index >= 0) && (index < SG_MAX_VERTEX_BUFFERS)); + if (vb) { + _sg.wgpu.bindings_cache.vbs[index].buffer.id = vb->slot.id; + _sg.wgpu.bindings_cache.vbs[index].offset = offset; + } else { + _sg.wgpu.bindings_cache.vbs[index].buffer.id = SG_INVALID_ID; + _sg.wgpu.bindings_cache.vbs[index].offset = 0; + } } -_SOKOL_PRIVATE bool _sg_wgpu_bindcache_ib_dirty(const _sg_buffer_t* ib, int ib_offset) { - SOKOL_ASSERT(ib); - return (ib->slot.id != _sg.wgpu.bindings_cache.ib.buffer.id) || (ib_offset != _sg.wgpu.bindings_cache.ib.offset); +_SOKOL_PRIVATE bool _sg_wgpu_bindings_cache_ib_dirty(const _sg_buffer_t* ib, int offset) { + if (ib) { + return (_sg.wgpu.bindings_cache.ib.buffer.id != ib->slot.id) + || (_sg.wgpu.bindings_cache.ib.offset != offset); + } else { + return _sg.wgpu.bindings_cache.ib.buffer.id != SG_INVALID_ID; + } } -_SOKOL_PRIVATE void _sg_wgpu_bindcache_ib_update(const _sg_buffer_t* ib, int ib_offset) { - SOKOL_ASSERT(ib); - _sg.wgpu.bindings_cache.ib.buffer.id = ib->slot.id; - _sg.wgpu.bindings_cache.ib.offset = ib_offset; +_SOKOL_PRIVATE void _sg_wgpu_bindings_cache_ib_update(const _sg_buffer_t* ib, int offset) { + if (ib) { + _sg.wgpu.bindings_cache.ib.buffer.id = ib->slot.id; + _sg.wgpu.bindings_cache.ib.offset = offset; + } else { + _sg.wgpu.bindings_cache.ib.buffer.id = SG_INVALID_ID; + _sg.wgpu.bindings_cache.ib.offset = 0; + } +} + +_SOKOL_PRIVATE bool _sg_wgpu_bindings_cache_bg_dirty(const _sg_wgpu_bindgroup_t* bg) { + if (bg) { + return _sg.wgpu.bindings_cache.bg.id != bg->slot.id; + } else { + return _sg.wgpu.bindings_cache.bg.id != SG_INVALID_ID; + } +} + +_SOKOL_PRIVATE void _sg_wgpu_bindings_cache_bg_update(const _sg_wgpu_bindgroup_t* bg) { + if (bg) { + _sg.wgpu.bindings_cache.bg.id = bg->slot.id; + } else { + _sg.wgpu.bindings_cache.bg.id = SG_INVALID_ID; + } +} + +_SOKOL_PRIVATE void _sg_wgpu_set_image_sampler_bindgroup(_sg_wgpu_bindgroup_t* bg) { + if (_sg_wgpu_bindings_cache_bg_dirty(bg)) { + _sg_wgpu_bindings_cache_bg_update(bg); + _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); + if (bg) { + SOKOL_ASSERT(bg->slot.state == SG_RESOURCESTATE_VALID); + SOKOL_ASSERT(bg->bindgroup); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + } else { + // a nullptr bindgroup means setting the empty bindgroup + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); + } + } else { + _sg_stats_add(wgpu.bindings.num_skip_redundant_bindgroup, 1); + } } _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { @@ -13249,9 +13335,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { _sg_wgpu_bindgroups_cache_set(key.hash, bg->slot.id); } if (bg && bg->slot.state == SG_RESOURCESTATE_VALID) { - SOKOL_ASSERT(bg->bindgroup); - _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + _sg_wgpu_set_image_sampler_bindgroup(bg); } else { return false; } @@ -13260,9 +13344,7 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { _sg_wgpu_bindgroup_t* bg = _sg_wgpu_create_bindgroup(bnd); if (bg) { if (bg->slot.state == SG_RESOURCESTATE_VALID) { - SOKOL_ASSERT(bg->bindgroup); - _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, bg->bindgroup, 0, 0); + _sg_wgpu_set_image_sampler_bindgroup(bg); } _sg_wgpu_discard_bindgroup(bg); } else { @@ -13270,9 +13352,44 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindgroup(_sg_bindings_t* bnd) { } } } else { - _sg_stats_add(wgpu.bindings.num_set_empty_bindgroup, 1); - wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); + _sg_wgpu_set_image_sampler_bindgroup(0); + } + return true; +} +_SOKOL_PRIVATE bool _sg_wgpu_apply_index_buffer(_sg_bindings_t* bnd) { + if (_sg_wgpu_bindings_cache_ib_dirty(bnd->ib, bnd->ib_offset)) { + _sg_wgpu_bindings_cache_ib_update(bnd->ib, bnd->ib_offset); + if (bnd->ib) { + const WGPUIndexFormat format = _sg_wgpu_indexformat(bnd->pip->cmn.index_type); + const uint64_t buf_size = (uint64_t)bnd->ib->cmn.size; + const uint64_t offset = (uint64_t)bnd->ib_offset; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); + _sg_stats_add(wgpu.bindings.num_set_index_buffer, 1); + } + // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) + } else { + _sg_stats_add(wgpu.bindings.num_skip_redundant_index_buffer, 1); + } + return true; +} + +_SOKOL_PRIVATE bool _sg_wgpu_apply_vertex_buffers(_sg_bindings_t* bnd) { + for (int slot = 0; slot < bnd->num_vbs; slot++) { + if (_sg_wgpu_bindings_cache_vb_dirty(slot, bnd->vbs[slot], bnd->vb_offsets[slot])) { + _sg_wgpu_bindings_cache_vb_update(slot, bnd->vbs[slot], bnd->vb_offsets[slot]); + const uint64_t buf_size = (uint64_t)bnd->vbs[slot]->cmn.size; + const uint64_t offset = (uint64_t)bnd->vb_offsets[slot]; + SOKOL_ASSERT(buf_size > offset); + const uint64_t max_bytes = buf_size - offset; + wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); + _sg_stats_add(wgpu.bindings.num_set_vertex_buffer, 1); + } else { + _sg_stats_add(wgpu.bindings.num_skip_redundant_vertex_buffer, 1); + } } + // FIXME: remaining vb slots should actually set a null vertex buffer (this was just recently implemented in WebGPU) return true; } @@ -13296,11 +13413,11 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg.wgpu.queue = wgpuDeviceGetQueue(_sg.wgpu.dev); SOKOL_ASSERT(_sg.wgpu.queue); - _sg_wgpu_bindcache_clear(); _sg_wgpu_init_caps(); _sg_wgpu_uniform_buffer_init(desc); _sg_wgpu_bindgroups_pool_init(desc); _sg_wgpu_bindgroups_cache_init(desc); + _sg_wgpu_bindings_cache_clear(); // create an empty bind group for shader stages without bound images WGPUBindGroupLayoutDescriptor bgl_desc; @@ -13335,7 +13452,7 @@ _SOKOL_PRIVATE void _sg_wgpu_discard_backend(void) { } _SOKOL_PRIVATE void _sg_wgpu_reset_state_cache(void) { - // FIXME + _sg_wgpu_bindings_cache_clear(); } _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_context(_sg_context_t* ctx) { @@ -13956,7 +14073,7 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.cur_height = h; _sg.wgpu.cur_pipeline = 0; _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; - _sg_wgpu_bindcache_clear(); + _sg_wgpu_bindings_cache_clear(); WGPURenderPassDescriptor wgpu_pass_desc; WGPURenderPassColorAttachment wgpu_color_att[SG_MAX_COLOR_ATTACHMENTS]; @@ -14070,42 +14187,9 @@ _SOKOL_PRIVATE bool _sg_wgpu_apply_bindings(_sg_bindings_t* bnd) { SOKOL_ASSERT(bnd); SOKOL_ASSERT(bnd->pip->shader && (bnd->pip->cmn.shader_id.id == bnd->pip->shader->slot.id)); bool retval = true; - - // index buffer - if (bnd->ib) { - if (_sg_wgpu_bindcache_ib_dirty(bnd->ib, bnd->ib_offset)) { - _sg_wgpu_bindcache_ib_update(bnd->ib, bnd->ib_offset); - const WGPUIndexFormat format = _sg_wgpu_indexformat(bnd->pip->cmn.index_type); - const uint64_t buf_size = (uint64_t)bnd->ib->cmn.size; - const uint64_t offset = (uint64_t)bnd->ib_offset; - SOKOL_ASSERT(buf_size > offset); - const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetIndexBuffer(_sg.wgpu.pass_enc, bnd->ib->wgpu.buf, format, offset, max_bytes); - _sg_stats_add(wgpu.bindings.num_set_index_buffer, 1); - } else { - _sg_stats_add(wgpu.bindings.num_skip_set_index_buffer, 1); - } - } - // FIXME: else-path should actually set a null index buffer (this was just recently implemented in WebGPU) - - // vertex buffers - for (int slot = 0; slot < bnd->num_vbs; slot++) { - if (_sg_wgpu_bindcache_vb_dirty(slot, bnd->vbs[slot], bnd->vb_offsets[slot])) { - _sg_wgpu_bindcache_vb_update(slot, bnd->vbs[slot], bnd->vb_offsets[slot]); - const uint64_t buf_size = (uint64_t)bnd->vbs[slot]->cmn.size; - const uint64_t offset = (uint64_t)bnd->vb_offsets[slot]; - SOKOL_ASSERT(buf_size > offset); - const uint64_t max_bytes = buf_size - offset; - wgpuRenderPassEncoderSetVertexBuffer(_sg.wgpu.pass_enc, (uint32_t)slot, bnd->vbs[slot]->wgpu.buf, offset, max_bytes); - _sg_stats_add(wgpu.bindings.num_set_vertex_buffer, 1); - } else { - _sg_stats_add(wgpu.bindings.num_skip_set_vertex_buffer, 1); - } - // FIXME: else-path should actually set a null vertex buffer (this was just recently implemented in WebGPU) - } - - _sg_wgpu_apply_bindgroup(bnd); - + retval &= _sg_wgpu_apply_index_buffer(bnd); + retval &= _sg_wgpu_apply_vertex_buffers(bnd); + retval &= _sg_wgpu_apply_bindgroup(bnd); return retval; } From d5e986c52b796f371f2a022e1601ee9774048e9c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 9 Oct 2023 14:38:20 +0200 Subject: [PATCH 251/292] sokol_gfx_imgui.h: fixes for sokol_gfx.h stats member renames --- util/sokol_gfx_imgui.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index ec9193847..53304bd69 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -4273,13 +4273,13 @@ _SOKOL_PRIVATE void _sg_imgui_draw_frame_stats_panel(sg_imgui_t* ctx) { _sg_imgui_frame_stats(wgpu.uniforms.num_set_bindgroup); _sg_imgui_frame_stats(wgpu.uniforms.size_write_buffer); _sg_imgui_frame_stats(wgpu.bindings.num_set_vertex_buffer); - _sg_imgui_frame_stats(wgpu.bindings.num_skip_set_vertex_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_skip_redundant_vertex_buffer); _sg_imgui_frame_stats(wgpu.bindings.num_set_index_buffer); - _sg_imgui_frame_stats(wgpu.bindings.num_skip_set_index_buffer); + _sg_imgui_frame_stats(wgpu.bindings.num_skip_redundant_index_buffer); _sg_imgui_frame_stats(wgpu.bindings.num_create_bindgroup); _sg_imgui_frame_stats(wgpu.bindings.num_discard_bindgroup); _sg_imgui_frame_stats(wgpu.bindings.num_set_bindgroup); - _sg_imgui_frame_stats(wgpu.bindings.num_set_empty_bindgroup); + _sg_imgui_frame_stats(wgpu.bindings.num_skip_redundant_bindgroup); _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_hits); _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_misses); _sg_imgui_frame_stats(wgpu.bindings.num_bindgroup_cache_collisions); From 4e0d7ce6b57f5a6debfac95021a3f35d00ab22d7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 9 Oct 2023 14:43:45 +0200 Subject: [PATCH 252/292] sokol_gfx.h wgpu: fix wgpu sampler not being released when destroyed --- sokol_gfx.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 22ba72742..b7dbba619 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13420,6 +13420,7 @@ _SOKOL_PRIVATE void _sg_wgpu_setup_backend(const sg_desc* desc) { _sg_wgpu_bindings_cache_clear(); // create an empty bind group for shader stages without bound images + // FIXME: once WebGPU supports setting null objects, this can be removed WGPUBindGroupLayoutDescriptor bgl_desc; _sg_clear(&bgl_desc, sizeof(bgl_desc)); WGPUBindGroupLayout empty_bgl = wgpuDeviceCreateBindGroupLayout(_sg.wgpu.dev, &bgl_desc); @@ -13689,7 +13690,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_sampler(_sg_sampler_t* smp, con _SOKOL_PRIVATE void _sg_wgpu_discard_sampler(_sg_sampler_t* smp) { SOKOL_ASSERT(smp); if (smp->wgpu.smp) { - wgpuSamplerReference(smp->wgpu.smp); + wgpuSamplerRelease(smp->wgpu.smp); smp->wgpu.smp = 0; } } From f2ca0cfa3127a14f1310dfaf69bbf3b1c2e70bb1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 9 Oct 2023 15:53:37 +0200 Subject: [PATCH 253/292] sokol_gfx.h wgpu: fix empty image-sampler bindings behaviour --- sokol_gfx.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index b7dbba619..3a2e778a4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -14074,7 +14074,6 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.cur_height = h; _sg.wgpu.cur_pipeline = 0; _sg.wgpu.cur_pipeline_id.id = SG_INVALID_ID; - _sg_wgpu_bindings_cache_clear(); WGPURenderPassDescriptor wgpu_pass_desc; WGPURenderPassColorAttachment wgpu_color_att[SG_MAX_COLOR_ATTACHMENTS]; @@ -14108,6 +14107,11 @@ _SOKOL_PRIVATE void _sg_wgpu_begin_pass(_sg_pass_t* pass, const sg_pass_action* _sg.wgpu.pass_enc = wgpuCommandEncoderBeginRenderPass(_sg.wgpu.cmd_enc, &wgpu_pass_desc); SOKOL_ASSERT(_sg.wgpu.pass_enc); + // clear bindings cache and apply an empty image-sampler bindgroup + _sg_wgpu_bindings_cache_clear(); + wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc, _SG_WGPU_IMAGE_SAMPLER_BINDGROUP_INDEX, _sg.wgpu.empty_bind_group, 0, 0); + _sg_stats_add(wgpu.bindings.num_set_bindgroup, 1); + // initial uniform buffer binding (required even if no uniforms are set in the frame) _sg_wgpu_uniform_buffer_on_begin_pass(); } From 5891728d6a6ba3502cfbc084058cb581400978e4 Mon Sep 17 00:00:00 2001 From: "Desktop\\Damian" Date: Wed, 11 Oct 2023 22:23:12 +1000 Subject: [PATCH 254/292] Optimize the selection of pixel format in WGL to early exit if found early - saves ~20ms --- sokol_app.h | 162 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 129 insertions(+), 33 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index e0b061321..bff27815d 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -5907,6 +5907,98 @@ _SOKOL_PRIVATE void _sapp_gl_init_fbconfig(_sapp_gl_fbconfig* fbconfig) { fbconfig->samples = -1; } +typedef struct { + int least_missing; + int least_color_diff; + int least_extra_diff; + bool best_match; +} _sapp_gl_fbselect; + +_SOKOL_PRIVATE void _sapp_gl_init_fbselect(_sapp_gl_fbselect* fbselect) { + _sapp_clear(fbselect, sizeof(_sapp_gl_fbselect)); + fbselect->least_missing = 1000000; + fbselect->least_color_diff = 10000000; + fbselect->least_extra_diff = 10000000; + fbselect->best_match = false; +} + +_SOKOL_PRIVATE const bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* current) { + int missing = 0; + if (desired->doublebuffer != current->doublebuffer) { + return false; + } + + if (desired->alpha_bits > 0 && current->alpha_bits == 0) { + missing++; + } + if (desired->depth_bits > 0 && current->depth_bits == 0) { + missing++; + } + if (desired->stencil_bits > 0 && current->stencil_bits == 0) { + missing++; + } + if (desired->samples > 0 && current->samples == 0) { + /* Technically, several multisampling buffers could be + involved, but that's a lower level implementation detail and + not important to us here, so we count them as one + */ + missing++; + } + + /* These polynomials make many small channel size differences matter + less than one large channel size difference + Calculate color channel size difference value + */ + int color_diff = 0; + if (desired->red_bits != -1) { + color_diff += (desired->red_bits - current->red_bits) * (desired->red_bits - current->red_bits); + } + if (desired->green_bits != -1) { + color_diff += (desired->green_bits - current->green_bits) * (desired->green_bits - current->green_bits); + } + if (desired->blue_bits != -1) { + color_diff += (desired->blue_bits - current->blue_bits) * (desired->blue_bits - current->blue_bits); + } + + /* Calculate non-color channel size difference value */ + int extra_diff = 0; + if (desired->alpha_bits != -1) { + extra_diff += (desired->alpha_bits - current->alpha_bits) * (desired->alpha_bits - current->alpha_bits); + } + if (desired->depth_bits != -1) { + extra_diff += (desired->depth_bits - current->depth_bits) * (desired->depth_bits - current->depth_bits); + } + if (desired->stencil_bits != -1) { + extra_diff += (desired->stencil_bits - current->stencil_bits) * (desired->stencil_bits - current->stencil_bits); + } + if (desired->samples != -1) { + extra_diff += (desired->samples - current->samples) * (desired->samples - current->samples); + } + + /* Figure out if the current one is better than the best one found so far + Least number of missing buffers is the most important heuristic, + then color buffer size match and lastly size match for other buffers + */ + bool new_closest = false; + if (missing < fbselect->least_missing) { + new_closest = true; + } + else if (missing == fbselect->least_missing) { + if ((color_diff < fbselect->least_color_diff) || + (color_diff == fbselect->least_color_diff && extra_diff < fbselect->least_extra_diff)) + { + new_closest = true; + } + } + if (new_closest) { + fbselect->least_missing = missing; + fbselect->least_color_diff = color_diff; + fbselect->least_extra_diff = extra_diff; + fbselect->best_match = (missing | color_diff | extra_diff) == 0; + } + return new_closest; +} + _SOKOL_PRIVATE const _sapp_gl_fbconfig* _sapp_gl_choose_fbconfig(const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* alternatives, int count) { int missing, least_missing = 1000000; int color_diff, least_color_diff = 10000000; @@ -6594,7 +6686,6 @@ _SOKOL_PRIVATE void _sapp_wgl_attribiv(int pixel_format, int num_attribs, const _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { SOKOL_ASSERT(_sapp.win32.dc); SOKOL_ASSERT(_sapp.wgl.arb_pixel_format); - const _sapp_gl_fbconfig* closest; #define _sapp_wgl_num_query_tags (12) const int query_tags[_sapp_wgl_num_query_tags] = { @@ -6633,13 +6724,26 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { } int native_count = _sapp_wgl_attrib(1, WGL_NUMBER_PIXEL_FORMATS_ARB); - _sapp_gl_fbconfig* usable_configs = (_sapp_gl_fbconfig*) _sapp_malloc_clear((size_t)native_count * sizeof(_sapp_gl_fbconfig)); - SOKOL_ASSERT(usable_configs); - int usable_count = 0; + + _sapp_gl_fbconfig desired; + _sapp_gl_init_fbconfig(&desired); + desired.red_bits = 8; + desired.green_bits = 8; + desired.blue_bits = 8; + desired.alpha_bits = 8; + desired.depth_bits = 24; + desired.stencil_bits = 8; + desired.doublebuffer = true; + desired.samples = _sapp.sample_count > 1 ? _sapp.sample_count : 0; + + int pixel_format = 0; + _sapp_gl_fbconfig u; + _sapp_gl_init_fbconfig(&u); + + _sapp_gl_fbselect fbselect; + _sapp_gl_init_fbselect(&fbselect); for (int i = 0; i < native_count; i++) { const int n = i + 1; - _sapp_gl_fbconfig* u = usable_configs + usable_count; - _sapp_gl_init_fbconfig(u); _sapp_wgl_attribiv(n, query_count, query_tags, query_results); if (query_results[result_support_opengl_index] == 0 @@ -6649,38 +6753,30 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { { continue; } - u->red_bits = query_results[result_red_bits_index]; - u->green_bits = query_results[result_green_bits_index]; - u->blue_bits = query_results[result_blue_bits_index]; - u->alpha_bits = query_results[result_alpha_bits_index]; - u->depth_bits = query_results[result_depth_bits_index]; - u->stencil_bits = query_results[result_stencil_bits_index]; + + u.red_bits = query_results[result_red_bits_index]; + u.green_bits = query_results[result_green_bits_index]; + u.blue_bits = query_results[result_blue_bits_index]; + u.alpha_bits = query_results[result_alpha_bits_index]; + u.depth_bits = query_results[result_depth_bits_index]; + u.stencil_bits = query_results[result_stencil_bits_index]; if (query_results[result_double_buffer_index]) { - u->doublebuffer = true; + u.doublebuffer = true; } - u->samples = query_results[result_samples_index]; // NOTE: If arb_multisample is not supported - just takes the default 0 + u.samples = query_results[result_samples_index]; // NOTE: If arb_multisample is not supported - just takes the default 0 - u->handle = (uintptr_t)n; - usable_count++; - } - SOKOL_ASSERT(usable_count > 0); - _sapp_gl_fbconfig desired; - _sapp_gl_init_fbconfig(&desired); - desired.red_bits = 8; - desired.green_bits = 8; - desired.blue_bits = 8; - desired.alpha_bits = 8; - desired.depth_bits = 24; - desired.stencil_bits = 8; - desired.doublebuffer = true; - desired.samples = _sapp.sample_count > 1 ? _sapp.sample_count : 0; - closest = _sapp_gl_choose_fbconfig(&desired, usable_configs, usable_count); - int pixel_format = 0; - if (closest) { - pixel_format = (int) closest->handle; + // Test if this pixel format is better than the previous one + if (_sapp_gl_select_fbconfig(&fbselect, &desired, &u)) { + pixel_format = (uintptr_t)n; + + // Early exit if matching as good as possible + if (fbselect.best_match) { + break; + } + } } - _sapp_free(usable_configs); + return pixel_format; } From 2f4e48cfac8eda48ffb249143c28b0189c13bc31 Mon Sep 17 00:00:00 2001 From: "Desktop\\Damian" Date: Wed, 11 Oct 2023 22:33:03 +1000 Subject: [PATCH 255/292] Remove unneeded const --- sokol_app.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sokol_app.h b/sokol_app.h index bff27815d..ea80022d3 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -5922,7 +5922,7 @@ _SOKOL_PRIVATE void _sapp_gl_init_fbselect(_sapp_gl_fbselect* fbselect) { fbselect->best_match = false; } -_SOKOL_PRIVATE const bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* current) { +_SOKOL_PRIVATE bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* current) { int missing = 0; if (desired->doublebuffer != current->doublebuffer) { return false; From 13787112361be66df4daeecb893a907894d498a7 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 16 Oct 2023 14:41:11 +0200 Subject: [PATCH 256/292] sokol_gfx.h wgpu: support SRGB8A8 and RGB9E5 pixel formats --- sokol_gfx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 3a2e778a4..f08318b28 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12603,7 +12603,8 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RG16UI: return WGPUTextureFormat_RG16Uint; case SG_PIXELFORMAT_RG16SI: return WGPUTextureFormat_RG16Sint; case SG_PIXELFORMAT_RG16F: return WGPUTextureFormat_RG16Float; - case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8Unorm; + case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8UnormSrgb; + case SG_PIXELFORMAT_SRGB8A8: return WGPUTextureFormat_RGBA8Unorm; case SG_PIXELFORMAT_RGBA8SN: return WGPUTextureFormat_RGBA8Snorm; case SG_PIXELFORMAT_RGBA8UI: return WGPUTextureFormat_RGBA8Uint; case SG_PIXELFORMAT_RGBA8SI: return WGPUTextureFormat_RGBA8Sint; @@ -12636,6 +12637,7 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_ETC2_RGBA8: return WGPUTextureFormat_ETC2RGBA8Unorm; case SG_PIXELFORMAT_ETC2_RG11: return WGPUTextureFormat_EACR11Unorm; case SG_PIXELFORMAT_ETC2_RG11SN: return WGPUTextureFormat_EACR11Snorm; + case SG_PIXELFORMAT_RGB9E5: return WGPUTextureFormat_RGB9E5Ufloat; // NOT SUPPORTED case SG_PIXELFORMAT_R16: @@ -12644,8 +12646,6 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RG16SN: case SG_PIXELFORMAT_RGBA16: case SG_PIXELFORMAT_RGBA16SN: - case SG_PIXELFORMAT_SRGB8A8: - case SG_PIXELFORMAT_RGB9E5: case SG_PIXELFORMAT_PVRTC_RGB_2BPP: case SG_PIXELFORMAT_PVRTC_RGB_4BPP: case SG_PIXELFORMAT_PVRTC_RGBA_2BPP: From d9d64a5a43c99c4388377e84490ab226e86ef9cd Mon Sep 17 00:00:00 2001 From: Daniel Hooper Date: Thu, 19 Oct 2023 13:05:10 -0400 Subject: [PATCH 257/292] Allow overriding the gl error check macro --- sokol_gfx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index decfd385c..d2d14e631 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3994,7 +3994,9 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #ifndef GL_LUMINANCE #define GL_LUMINANCE 0x1909 #endif + #ifndef _SG_GL_CHECK_ERROR #define _SG_GL_CHECK_ERROR() { SOKOL_ASSERT(glGetError() == GL_NO_ERROR); } + #endif #endif // ███████ ████████ ██████ ██ ██ ██████ ████████ ███████ From 9a4cd059770e31c2840c4e5376bd8d405fc1a713 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 19 Oct 2023 20:12:36 +0200 Subject: [PATCH 258/292] sokol_gfx.h wgpu: start adding WebGPU backend details to the documentation --- sokol_gfx.h | 94 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 13 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index f08318b28..a0c3d6be5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -602,9 +602,9 @@ ================== sokol-gfx doesn't come with an integrated shader cross-compiler, instead backend-specific shader sources or binary blobs need to be provided when - creating a shader object, along with information about the shader interface - needed in the sokol-gfx validation layer and to properly bind shader resources - on the CPU-side to be consumable by the GPU-side. + creating a shader object, along with information about the shader resource + binding interface needed in the sokol-gfx validation layer and to properly + bind shader resources on the CPU-side to be consumable by the GPU-side. The easiest way to provide all this shader creation data is to use the sokol-shdc shader compiler tool to compile shaders from a common @@ -643,6 +643,7 @@ load 'd3dcompiler_47.dll' - for the Metal backends, shaders can be provided as source or binary blobs, the MSL version should be in 'metal-1.1' (other versions may work but are not tested) + - for the WebGPU backend, shader must be provided as WGSL source code - optionally the following shader-code related attributes can be provided: - an entry function name (only on D3D11 or Metal, but not OpenGL) - on D3D11 only, a compilation target (default is "vs_4_0" and "ps_4_0") @@ -651,6 +652,8 @@ vertex shader: - Metal: no information needed since vertex attributes are always bound by their attribute location defined in the shader via '[[attribute(N)]]' + - WebGPU: no information needed since vertex attributes are always + bound by their attribute location defined in the shader via `@location(N)` - GLSL: vertex attribute names can be optionally provided, in that case their location will be looked up by name, otherwise, the vertex attribute location can be defined with 'layout(location = N)', PLEASE NOTE that the name-lookup method @@ -671,23 +674,36 @@ and CROSS-BACKEND COMMON UNIFORM DATA LAYOUT below! - A description of each texture/image used in the shader: - - the expected image type (e.g. 2D, 3D, etc...) - - the 'image sample type' (e.g. float, depth, signed- or unsigned-int) + - the expected image type: + - SG_IMAGETYPE_2D + - SG_IMAGETYPE_CUBE + - SG_IMAGETYPE_3D + - SG_IMAGETYPE_ARRAY + - the expected 'image sample type': + - SG_IMAGESAMPLETYPE_FLOAT + - SG_IMAGESAMPLETYPE_DEPTH + - SG_IMAGESAMPLETYPE_SINT + - SG_IMAGESAMPLETYPE_UINT + - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT - a flag whether the texture is expected to be multisampled (currently it's not supported to fetch data from multisampled textures in shaders, but this is planned for a later time) - A description of each sampler used in the shader: - - just wether the sampler is a regular 'sampling sampler', - or a 'comparison sampler' (which is usually used for - shadow mapping) + - SG_SAMPLERTYPE_FILTERING, + - SG_SAMPLERTYPE_NONFILTERING, + - SG_SAMPLERTYPE_COMPARISON, - An array of 'image-sampler-pairs' used by the shader to sample textures, - for D3D11 and Metal this is only used for validation purposes to check - whether the texture and sampler are compatible with each other. For GLSL - an additional 'combined-image-sampler name' must be provided because - 'OpenGL style GLSL' cannot handle separate texture and sampler objects, - but still groups them into a tradtional GLSL 'sampler object'. + for D3D11, Metal and WebGPU this is used for validation purposes to check + whether the texture and sampler are compatible with each other (especially + WebGPU is very picky about combining the correct + texture-sample-type with the correct sampler-type). For GLSL an + additional 'combined-image-sampler name' must be provided because 'OpenGL + style GLSL' cannot handle separate texture and sampler objects, but still + groups them into a tradtional GLSL 'sampler object'. + + For example code of how to create backend-specific shader objects, please refer to the following samples: @@ -696,6 +712,47 @@ - for Metal: https://github.com/floooh/sokol-samples/tree/master/metal - for OpenGL: https://github.com/floooh/sokol-samples/tree/master/glfw - for GLES3: https://github.com/floooh/sokol-samples/tree/master/html5 + - for WebGPI: https://github.com/floooh/sokol-samples/tree/master/wgpu + + + ON SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT AND SG_SAMPLERTYPE_NONFILTERING + ======================================================================== + The WebGPU backend introduces the concept of 'unfilterable-float' textures, + which can only be combined with 'nonfiltering' samplers (this is a restriction + specific to WebGPU, but since the same sokol-gfx code should work across + all backend, the sokol-gfx validation layer also enforces this restriction + - the alternative would be undefined behaviour in some backend APIs on + some devices). + + The background is that some mobile devices (most notably iOS devices) can + not perform linear filtering when sampling textures with certain pixel + formats, most notable the 32F formats: + + - SG_PIXELFORMAT_R32F + - SG_PIXELFORMAT_RG32F + - SG_PIXELFORMAT_RGBA32F + + The information of whether a shader is going to be used with such an + unfilterable-float texture must already be provided in the sg_shader_desc + struct when creating the shader (see the above section "ON SHADER CREATION"). + + If you are using the sokol-shdc shader compiler, the information whether a + texture/sampler binding expects an 'unfilterable-float/nonfiltering' + texture/sampler combination cannot be inferred from the shader source + alone, you'll need to provide this hint via annotation-tags. For instance + here is an example from the ozz-skin-sapp.c sample shader which samples an + RGBA32F texture with skinning matrices in the vertex shader: + + ```glsl + @image_sample_type joint_tex unfilterable_float + uniform texture2D joint_tex; + @sampler_type smp nonfiltering + uniform sampler smp; + ``` + + This will result in SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT and + SG_SAMPLERTYPE_NONFILTERING being written to the code-generated + sg_shader_desc struct. UNIFORM DATA LAYOUT: @@ -1206,6 +1263,17 @@ result in a pipeline object in FAILED state. Same when trying to create a pass object with invalid image objects. + + + WEBGPU CAVEATS + ============== + For a general overview and design notes of the WebGPU backend see: + + https://floooh.github.io/2023/10/16/sokol-webgpu.html + + TODO! + + LICENSE ======= zlib/libpng license From ed51699cd17ad638ba82d9084727a5404acac7df Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 21 Oct 2023 16:26:05 +0200 Subject: [PATCH 259/292] sokol_gfx.h: add a WEBGPU CAVEATS documentation section --- sokol_gfx.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a0c3d6be5..71787431d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1264,14 +1264,99 @@ a pass object with invalid image objects. - WEBGPU CAVEATS ============== For a general overview and design notes of the WebGPU backend see: https://floooh.github.io/2023/10/16/sokol-webgpu.html - TODO! + In general, don't expect an automatic speedup when switching from the WebGL2 + backend to the WebGPU backend. Some WebGPU functions currently actually + have a higher CPU overhead than similar WebGL2 functions, leading to the + paradoxical situation that WebGPU code is slower than similar WebGL2 + code. + + - when writing WGSL shader code by hand, a specific bind-slot convention + must be used: + + All uniform block structs must use `@group(0)`, with up to + 4 uniform blocks per shader stage. + - Vertex shader uniform block bindings must start at `@group(0) @binding(0)` + - Fragment shader uniform blocks bindings must start at `@group(0) @binding(4)` + + All textures and samplers must use `@group(1)` and start at specific + offsets depending on resource type and shader stage. + - Vertex shader textures must start at `@group(1) @binding(0)` + - Vertex shader samplers must start at `@group(1) @binding(16)` + - Fragment shader textures must start at `@group(1) @binding(32)` + - Fragment shader samplers must start at `@group(1) @binding(48)` + + Note that the actual number of allowed per-stage texture- and sampler-bindings + in sokol-gfx is currently lower than the above ranges (currently only up to + 12 textures and 8 samplers per shader stage are allowed). + + If you use sokol-shdc to generate WGSL shader code, you don't need to worry + about the above binding convention since sokol-shdc assigns bind slots + automatically. + + - The sokol-gfx WebGPU backend uses the sg_desc.uniform_buffer_size item + to allocate a single per-frame uniform buffer which must be big enough + to hold all data written by sg_apply_uniforms() during a single frame, + including a worst-case 256-byte alignment (e.g. each sg_apply_uniform + call will cost 256 bytes of uniform buffer size). The default size + is 4 MB, which is enough for 16384 sg_apply_uniform() calls per + frame (assuming the uniform data 'payload' is less than 256 bytes + per call). These rules are the same as for the Metal backend, so if + you are already using the Metal backend you'll be fine. + + - sg_apply_bindings(): the sokol-gfx WebGPU backend implements a bindgroup + cache to prevent excessive creation and destruction of BindGroup objects + when calling sg_apply_bindings(). The number of slots in the bindgroups + cache is defined in sg_desc.wgpu_bindgroups_cache_size when calling + sg_setup. The cache size must be a power-of-2 numbers, with the default being + 1024. The bindgroups cache behaviour can be observed by calling the new + function sg_query_frame_stats(), where the following struct items are + of interest: + + .wgpu.num_bindgroup_cache_hits + .wgpu.num_bindgroup_cache_misses + .wgpu.num_bindgroup_cache_collisions + .wgpu.num_bindgroup_cache_vs_hash_key_mismatch + + The value to pay attention to is `.wgpu.num_bindgroup_cache_collisions`, + if this number if consistently higher than a few percent of the + .wgpu.num_set_bindgroup value, it might be a good idea to bump the + bindgroups cache size to the next power-of-2. + + - sg_apply_viewport(): WebGPU currently has a unique restriction that viewport + rectangles must be contained entirely within the framebuffer. As a shitty + workaround sokol_gfx.h will clip incoming viewport rectangles against + the framebuffer, but this will distort the clipspace-to-screenspace mapping. + There's no proper way to handle this inside sokol_gfx.h, this must be fixed + in a future WebGPU update. + + - The sokol shader compiler generally adds `diagnostic(off, derivative_uniformity);` + into the WGSL output. Currently only the Chrome WebGPU implementation seems + to accept this. + + - The vertex format SG_VERTEXFORMAT_UINT10_N2 is currently not supported because + WebGPU lacks a matching vertex format (this is currently being worked on though, + as soon as the vertex format shows up in webgpu.h, sokol_gfx.h will add support. + + - Likewise, the following sokol-gfx vertex formats are not supported in WebGPU: + R16, R16SN, RG16, RG16SN, RGBA16, RGBA16SN and all PVRTC compressed format. + Unlike unsupported vertex formats, unsupported pixel formats can be queried + in cross-backend code via sg_query_pixel_format() though. + + - The Emscripten WebGPU shim currently doesn't support the Closure minification + post-link-step (e.g. currently the emcc argument '--closure 1' or '--closure 2' + will generate broken Javascript code. + + - sokol-gfx requires the WebGPU device feature `depth32float-stencil8` to be enabled + (this should be supported widely supported) + + - sokol-gfx expects that the WebGPU device feature `float32-filterable` to *not* be + enabled (this would exclude all iOS devices) LICENSE From eaa6075e1a25a4ee50f853035b79246e7352302b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 21 Oct 2023 16:33:05 +0200 Subject: [PATCH 260/292] sokol_gfx.h: add details to sg_image_sample_type and sg_sampler_type doc header --- sokol_gfx.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 71787431d..7208fbd6b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1802,6 +1802,17 @@ typedef enum sg_image_type { layer in sg_apply_bindings() to check if the provided image object is compatible with what the shader expects, and also required by the WebGPU backend. + + NOTE that the following texture pixel formats require the use + of SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT, combined with a sampler + of type SG_SAMPLERTYPE_NONFILTERING: + + - SG_PIXELFORMAT_R32F + - SG_PIXELFORMAT_RG32F + - SG_PIXELFORMAT_RGBA32F + + (when using sokol-shdc, also check out the tags `@image_sample_type` + and `@sampler_type`) */ typedef enum sg_image_sample_type { _SG_IMAGESAMPLETYPE_DEFAULT, // value 0 reserved for default-init @@ -1819,6 +1830,16 @@ typedef enum sg_image_sample_type { The basic type of a texture sampler (sampling vs comparison) as defined in a shader. Must be provided in sg_shader_sampler_desc. + + sg_image_sample_type and sg_sampler_type for a texture/sampler + pair must be compatible with each other, specifically only + the following pairs are allowed: + + - SG_IMAGESAMPLETYPE_FLOAT / (SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING) + - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT / SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_SINT / SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_UINT / SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_DEPTH / SG_SAMPLERTYPE_COMPARISON */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, From e05c84807d0991b15ad48a8717c6552fe091ddb3 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 21 Oct 2023 16:36:38 +0200 Subject: [PATCH 261/292] sokol_gfx.h: more documentation updates --- sokol_gfx.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7208fbd6b..1ceda6c19 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -703,7 +703,13 @@ style GLSL' cannot handle separate texture and sampler objects, but still groups them into a tradtional GLSL 'sampler object'. + Compatibility rules for image-sample-type vs sampler-type are as follows: + - SG_IMAGESAMPLETYPE_FLOAT => (SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING) + - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_SINT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_UINT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_DEPTH => SG_SAMPLERTYPE_COMPARISON For example code of how to create backend-specific shader objects, please refer to the following samples: @@ -1835,11 +1841,11 @@ typedef enum sg_image_sample_type { pair must be compatible with each other, specifically only the following pairs are allowed: - - SG_IMAGESAMPLETYPE_FLOAT / (SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING) - - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT / SG_SAMPLERTYPE_NONFILTERING - - SG_IMAGESAMPLETYPE_SINT / SG_SAMPLERTYPE_NONFILTERING - - SG_IMAGESAMPLETYPE_UINT / SG_SAMPLERTYPE_NONFILTERING - - SG_IMAGESAMPLETYPE_DEPTH / SG_SAMPLERTYPE_COMPARISON + - SG_IMAGESAMPLETYPE_FLOAT => (SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING) + - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_SINT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_UINT => SG_SAMPLERTYPE_NONFILTERING + - SG_IMAGESAMPLETYPE_DEPTH => SG_SAMPLERTYPE_COMPARISON */ typedef enum sg_sampler_type { _SG_SAMPLERTYPE_DEFAULT, From 0f710472671c9c85093922cf69010947b4139d73 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 21 Oct 2023 17:23:56 +0200 Subject: [PATCH 262/292] update changelog --- CHANGELOG.md | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5af7653f..ee613c59c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,102 @@ ## Updates +#### 21-Oct-2023 + +The major topic of this update is the 'finalized' WebGPU support in sokol_gfx.h and sokol_app.h. + +- WebGPU samples are hosted here: + + https://floooh.github.io/sokol-webgpu/ + +- WebGL2 samples remain hosted here: + + https://floooh.github.io/sokol-html5/ + +- Please read the following blog post as introduction: + + https://floooh.github.io/2023/10/16/sokol-webgpu.html + +- ...and the changelog and updated documentation in the sokol-shdc repository: + + https://github.com/floooh/sokol-tools + +- You'll also need to update the sokol-shdc binaries: + + https://github.com/floooh/sokol-tools-bin + +- Please also read the following new or updated sections in the embedded sokol_gfx.h header documentation: + + - `ON SHADER CREATION` + - `ON SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT AND SG_SAMPLERTYPE_NONFILTERING` + - `WEBGPU CAVEATS` + + Please do this especially when using any of the following texture pixel formats, as you will most likely encounter new validation layer errors: + + - `SG_PIXELFORMAT_R32F` + - `SG_PIXELFORMAT_RG32F` + - `SG_PIXELFORMAT_RGBA32F` + +- There is a tiny breaking change in the sokol_gfx.h API (only requires action when not using sokol-shdc): + + - the following `sg_sampler_type` enum items have been renamed to better harmonize with WebGPU: + - SG_SAMPLERTYPE_SAMPLE => SG_SAMPLERTYPE_FILTERING + - SG_SAMPLERTYPE_COMPARE => SG_SAMPLERTYPE_COMPARISON + + - the enum `sg_image_sample_type` gained a new item: + - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT + + - the enum `sg_sampler_type` gained a new item: + - SG_SAMPLERTYPE_NONFILTERING + +- The sokol_gfx.h struct `sg_desc` has two new items: + - `.wgpu_bindgroups_cache_size` - must be power-of-2, default: 1024 + - `.wgpu_disable_bindgroups_cache` - default: false + +- sokol_gfx.h gained the following new public API functions to query per-frame information: + - `sg_frame_stats sg_query_frame_stats()` + - `void sg_enable_frame_stats(void)` + - `void sg_disable_frame_stats(void)` + - `bool sg_frame_stats_enabled(void)` + + Frame statistics gathering is enabled after startup, but can be temporarily + disabled and enabled again via `sg_disable_frame_stats()` and `sg_enable_frame_stats`. + +- The sokol_gfx.h validation layer has new validation checks in `sg_make_shader()` + regarding image/sampler pair compatibility (WebGPU is particularly strict about + this stuff). + +- In sokol_app.h, the old wip WebGPU device and swapchain setup code is now implemented + in pure C code (previously this was a mix of Javascript and C). + +- Also note that sokol_app.h currently only supports WebGPU setup in the Emscripten backend. + If you want to use sokol_gfx.h with the WebGPU backend in a native scenario, you'll have + to use a different window system glue library (like GLFW). The sokol-samples directory + has a handful of examples for using sokol_gfx.h + Dawn + GLFW. + +- The following headers have been made compatible with the sokol_gfx.h WebGPU backend + (mainly by embedding WGSL shader code): + - sokol_debugtext.h + - sokol_fontstash.h + - sokol_gl.h + - sokol_spine.h + - sokol_imgui.h (also required some more changes for embedding `unfilterable-float` + textures, since these now require separate shader and pipeline objects) + - sokol_nuklear.h (works in WebGPU, but doesn't contain the work from sokol_imgui.h + to support `unfilterable-float` user textures) + +- sokol_gfx_imgui.h gained a new function `sg_imgui_draw_menu()` which renders a + menu panel to show/hide all debug windows. Previously this had to be done + outside the header. + +- sokol_gfx_imgui.h gained a new 'frame stats' window, which allows to peak into + sokol_gfx.h frame-rendering internals. This basically visualizes the struct + `sg_frame_stats` returned by the new sokol_gfx.h function `sg_query_frame_stats()`. + +- The sokol-samples repository gained 3 new samples: + - cubemap-jpeg-sapp.c (load a cubemap from seperate JPEG files) + - cubemaprt-sapp.c (render into cubemap faces - this demo actually existed a while but wasn't "official" so far) + - drawcallperf-sapp.c (a sample to explore the performance overhead of sg_apply_bindings, sg_apply_uniforms and sg_draw) + #### 03-Oct-2023 - sokol_app.h win/gl: PR https://github.com/floooh/sokol/pull/886 has been merged, this makes From 61c40b7a351d18bf0909ec94f9abe4640d8e017c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 21 Oct 2023 17:27:04 +0200 Subject: [PATCH 263/292] update readme and changelog --- CHANGELOG.md | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee613c59c..f67abcce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ The major topic of this update is the 'finalized' WebGPU support in sokol_gfx.h - There is a tiny breaking change in the sokol_gfx.h API (only requires action when not using sokol-shdc): - - the following `sg_sampler_type` enum items have been renamed to better harmonize with WebGPU: + - the following `sg_sampler_type` enum items have been renamed to better match their WebGPU counterparts: - SG_SAMPLERTYPE_SAMPLE => SG_SAMPLERTYPE_FILTERING - SG_SAMPLERTYPE_COMPARE => SG_SAMPLERTYPE_COMPARISON @@ -68,7 +68,7 @@ The major topic of this update is the 'finalized' WebGPU support in sokol_gfx.h - In sokol_app.h, the old wip WebGPU device and swapchain setup code is now implemented in pure C code (previously this was a mix of Javascript and C). -- Also note that sokol_app.h currently only supports WebGPU setup in the Emscripten backend. +- Also note that sokol_app.h currently only supports WebGPU in the Emscripten backend. If you want to use sokol_gfx.h with the WebGPU backend in a native scenario, you'll have to use a different window system glue library (like GLFW). The sokol-samples directory has a handful of examples for using sokol_gfx.h + Dawn + GLFW. diff --git a/README.md b/README.md index 8349a6d80..36e257732 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**25-Sep-2023** POTENTIALLY BREAKING: allocator callbacks have been renamed) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**21-Oct-2023** WebGPU!) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 08ae58e275decf36ca932ac8be3469556a46992f Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 22 Oct 2023 16:13:02 +0200 Subject: [PATCH 264/292] tiny readme tweak --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36e257732..b9db2ba8b 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ useful details for integrating the Sokol headers into your own project with your ## Core libraries -- [**sokol\_gfx.h**](https://github.com/floooh/sokol/blob/master/sokol_gfx.h): 3D-API wrapper (GL + Metal + D3D11) +- [**sokol\_gfx.h**](https://github.com/floooh/sokol/blob/master/sokol_gfx.h): 3D-API wrapper (GL/GLES3/WebGL2 + Metal + D3D11 + WebGPU) - [**sokol\_app.h**](https://github.com/floooh/sokol/blob/master/sokol_app.h): app framework wrapper (entry + window + 3D-context + input) - [**sokol\_time.h**](https://github.com/floooh/sokol/blob/master/sokol_time.h): time measurement - [**sokol\_audio.h**](https://github.com/floooh/sokol/blob/master/sokol_audio.h): minimal buffer-streaming audio playback From 526aff4a53dbd73aebe45f2cc662493ccc41dd3c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 23 Oct 2023 11:03:07 +0200 Subject: [PATCH 265/292] sokol_gfx.h wgpu: fix pixel format confusion (fixes #920) - SG_PIXELFORMAT_RGBA and SG_PIXELFORMAT_SRGBA8 were mixed up - SRGBA8 and RGB9E5 were not added to the pixel format capabilities table --- sokol_gfx.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 26c6e4603..dcee64fb5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12784,8 +12784,8 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RG16UI: return WGPUTextureFormat_RG16Uint; case SG_PIXELFORMAT_RG16SI: return WGPUTextureFormat_RG16Sint; case SG_PIXELFORMAT_RG16F: return WGPUTextureFormat_RG16Float; - case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8UnormSrgb; - case SG_PIXELFORMAT_SRGB8A8: return WGPUTextureFormat_RGBA8Unorm; + case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8Unorm; + case SG_PIXELFORMAT_SRGB8A8: return WGPUTextureFormat_RGBA8UnormSrgb; case SG_PIXELFORMAT_RGBA8SN: return WGPUTextureFormat_RGBA8Snorm; case SG_PIXELFORMAT_RGBA8UI: return WGPUTextureFormat_RGBA8Uint; case SG_PIXELFORMAT_RGBA8SI: return WGPUTextureFormat_RGBA8Sint; @@ -12981,6 +12981,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA8]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_SRGB8A8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_BGRA8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG16F]); @@ -13023,6 +13024,8 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH]); _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH_STENCIL]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RGB9E5]); + if (wgpuDeviceHasFeature(_sg.wgpu.dev, WGPUFeatureName_TextureCompressionBC)) { _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC1_RGBA]); _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC2_RGBA]); From 89cdc55b92e5bb8f59b2c988f061298b83418901 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 23 Oct 2023 13:16:17 +0200 Subject: [PATCH 266/292] sokol_gfx.h: improve validation messages (fixes #918) --- sokol_gfx.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index dcee64fb5..03b43b0f1 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3420,28 +3420,28 @@ typedef struct sg_frame_stats { _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_EXISTS, "sg_apply_bindings: index buffer no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_TYPE, "sg_apply_bindings: buffer in index buffer slot is not a SG_BUFFERTYPE_INDEXBUFFER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_IB_OVERFLOW, "sg_apply_bindings: buffer in index buffer slot is overflown") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: image binding on vertex stage is missing or the image handle is invalid") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_EXISTS, "sg_apply_bindings: image bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to vertex stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_FILTERABLE_IMAGE, "sg_apply_bindings: filterable image expected on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_DEPTH_IMAGE, "sg_apply_bindings: depth image expected on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on vertex stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on vertex stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: sampler binding on vertex stage is missing or the sampler handle is invalid") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on vertex stage but sampler has SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING on vertex stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on vertex stage, but sampler has SG_FILTER_LINEAR filters") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to vertex stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: missing image binding on fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: image binding on fragment stage is missing or the image handle is invalid") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_MSAA, "sg_apply_bindings: cannot bind image with sample_count>1 to fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_FILTERABLE_IMAGE, "sg_apply_bindings: filterable image expected on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_DEPTH_IMAGE, "sg_apply_bindings: depth image expected on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_IMAGE_BINDING, "sg_apply_bindings: unexpected image binding on fragment stage") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: missing sampler binding on fragment stage") \ + _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_BINDING, "sg_apply_bindings: sampler binding on fragment stage is missing or the sampler handle is invalid") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_COMPARISON on fragment stage but sampler has SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_SAMPLER_COMPARE_NEVER, "sg_apply_bindings: shader expects SG_SAMPLERTYPE_FILTERING on fragment stage but sampler doesn't have SG_COMPAREFUNC_NEVER") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on fragment stage, but sampler has SG_FILTER_LINEAR filters") \ From 1db04318439b18fa775ce58eee3a75cb4341c763 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 23 Oct 2023 14:53:54 +0200 Subject: [PATCH 267/292] sokol_app.h: coding style fixes for PR #916 --- sokol_app.h | 57 +++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index e213d576d..3b6602b02 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -5983,27 +5983,28 @@ _SOKOL_PRIVATE void _sapp_gl_init_fbselect(_sapp_gl_fbselect* fbselect) { fbselect->best_match = false; } +// NOTE: this is used only in the WGL code path _SOKOL_PRIVATE bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* current) { int missing = 0; if (desired->doublebuffer != current->doublebuffer) { return false; } - if (desired->alpha_bits > 0 && current->alpha_bits == 0) { + if ((desired->alpha_bits > 0) && (current->alpha_bits == 0)) { missing++; } - if (desired->depth_bits > 0 && current->depth_bits == 0) { + if ((desired->depth_bits > 0) && (current->depth_bits == 0)) { missing++; } - if (desired->stencil_bits > 0 && current->stencil_bits == 0) { + if ((desired->stencil_bits > 0) && (current->stencil_bits == 0)) { missing++; } - if (desired->samples > 0 && current->samples == 0) { - /* Technically, several multisampling buffers could be - involved, but that's a lower level implementation detail and - not important to us here, so we count them as one - */ - missing++; + if ((desired->samples > 0) && (current->samples == 0)) { + /* Technically, several multisampling buffers could be + involved, but that's a lower level implementation detail and + not important to us here, so we count them as one + */ + missing++; } /* These polynomials make many small channel size differences matter @@ -6043,10 +6044,9 @@ _SOKOL_PRIVATE bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const bool new_closest = false; if (missing < fbselect->least_missing) { new_closest = true; - } - else if (missing == fbselect->least_missing) { + } else if (missing == fbselect->least_missing) { if ((color_diff < fbselect->least_color_diff) || - (color_diff == fbselect->least_color_diff && extra_diff < fbselect->least_extra_diff)) + ((color_diff == fbselect->least_color_diff) && (extra_diff < fbselect->least_extra_diff))) { new_closest = true; } @@ -6060,6 +6060,7 @@ _SOKOL_PRIVATE bool _sapp_gl_select_fbconfig(_sapp_gl_fbselect* fbselect, const return new_closest; } +// NOTE: this is used only in the GLX code path _SOKOL_PRIVATE const _sapp_gl_fbconfig* _sapp_gl_choose_fbconfig(const _sapp_gl_fbconfig* desired, const _sapp_gl_fbconfig* alternatives, int count) { int missing, least_missing = 1000000; int color_diff, least_color_diff = 10000000; @@ -6750,18 +6751,18 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { #define _sapp_wgl_num_query_tags (12) const int query_tags[_sapp_wgl_num_query_tags] = { - WGL_SUPPORT_OPENGL_ARB, - WGL_DRAW_TO_WINDOW_ARB, - WGL_PIXEL_TYPE_ARB, - WGL_ACCELERATION_ARB, - WGL_DOUBLE_BUFFER_ARB, - WGL_RED_BITS_ARB, - WGL_GREEN_BITS_ARB, - WGL_BLUE_BITS_ARB, - WGL_ALPHA_BITS_ARB, - WGL_DEPTH_BITS_ARB, - WGL_STENCIL_BITS_ARB, - WGL_SAMPLES_ARB, + WGL_SUPPORT_OPENGL_ARB, + WGL_DRAW_TO_WINDOW_ARB, + WGL_PIXEL_TYPE_ARB, + WGL_ACCELERATION_ARB, + WGL_DOUBLE_BUFFER_ARB, + WGL_RED_BITS_ARB, + WGL_GREEN_BITS_ARB, + WGL_BLUE_BITS_ARB, + WGL_ALPHA_BITS_ARB, + WGL_DEPTH_BITS_ARB, + WGL_STENCIL_BITS_ARB, + WGL_SAMPLES_ARB, }; const int result_support_opengl_index = 0; const int result_draw_to_window_index = 1; @@ -6795,7 +6796,7 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { desired.depth_bits = 24; desired.stencil_bits = 8; desired.doublebuffer = true; - desired.samples = _sapp.sample_count > 1 ? _sapp.sample_count : 0; + desired.samples = (_sapp.sample_count > 1) ? _sapp.sample_count : 0; int pixel_format = 0; _sapp_gl_fbconfig u; @@ -6808,9 +6809,9 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { _sapp_wgl_attribiv(n, query_count, query_tags, query_results); if (query_results[result_support_opengl_index] == 0 - || query_results[result_draw_to_window_index] == 0 - || query_results[result_pixel_type_index] != WGL_TYPE_RGBA_ARB - || query_results[result_acceleration_index] == WGL_NO_ACCELERATION_ARB) + || query_results[result_draw_to_window_index] == 0 + || query_results[result_pixel_type_index] != WGL_TYPE_RGBA_ARB + || query_results[result_acceleration_index] == WGL_NO_ACCELERATION_ARB) { continue; } From 4eb208b2d9a0eb87567f0817551ecea2934d7bcb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 23 Oct 2023 14:59:15 +0200 Subject: [PATCH 268/292] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f67abcce1..2b0c3fa54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Updates +#### 23-Oct-2023 + +- sokol_app.h gl: some further startup optimizations in the WGL code path + via PR https://github.com/floooh/sokol/pull/916 + #### 21-Oct-2023 The major topic of this update is the 'finalized' WebGPU support in sokol_gfx.h and sokol_app.h. From 2bbba599635ba8bb6e53609f55a80ed1219c3e6b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 25 Oct 2023 20:48:27 +0200 Subject: [PATCH 269/292] sokol_gfx.h gl: explicitely set GL_TEXTURE_MAX_LEVEL, and more detailed framebuffer status logging (fixes #923) --- sokol_gfx.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 03b43b0f1..838146e68 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3213,8 +3213,12 @@ typedef struct sg_frame_stats { _SG_LOGITEM_XMACRO(GL_SHADER_LINKING_FAILED, "shader linking failed (gl)") \ _SG_LOGITEM_XMACRO(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, "vertex attribute not found in shader (gl)") \ _SG_LOGITEM_XMACRO(GL_TEXTURE_NAME_NOT_FOUND_IN_SHADER, "texture name not found in shader (gl)") \ - _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_INCOMPLETE, "framebuffer completeness check failed (gl)") \ - _SG_LOGITEM_XMACRO(GL_MSAA_FRAMEBUFFER_INCOMPLETE, "completeness check failed for msaa resolve framebuffer (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_UNDEFINED, "framebuffer completeness check failed with GL_FRAMEBUFFER_UNDEFINED (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_INCOMPLETE_ATTACHMENT, "framebuffer completeness check failed with GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MISSING_ATTACHMENT, "framebuffer completeness check failed with GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_UNSUPPORTED, "framebuffer completeness check failed with GL_FRAMEBUFFER_UNSUPPORTED (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MULTISAMPLE, "framebuffer completeness check failed with GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE (gl)") \ + _SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_UNKNOWN, "framebuffer completeness check failed (unknown reason) (gl)") \ _SG_LOGITEM_XMACRO(D3D11_CREATE_BUFFER_FAILED, "CreateBuffer() failed (d3d11)") \ _SG_LOGITEM_XMACRO(D3D11_CREATE_DEPTH_TEXTURE_UNSUPPORTED_PIXEL_FORMAT, "pixel format not supported for depth-stencil texture (d3d11)") \ _SG_LOGITEM_XMACRO(D3D11_CREATE_DEPTH_TEXTURE_FAILED, "CreateTexture2D() failed for depth-stencil texture (d3d11)") \ @@ -4304,6 +4308,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F + #define GL_TEXTURE_MAX_LEVEL 0x813D #endif #ifndef GL_UNSIGNED_INT_2_10_10_10_REV @@ -7689,6 +7694,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_image(_sg_image_t* img, const sg_ SOKOL_ASSERT(img->gl.tex[slot]); _sg_gl_cache_store_texture_sampler_binding(0); _sg_gl_cache_bind_texture_sampler(0, img->gl.target, img->gl.tex[slot], 0); + glTexParameteri(img->gl.target, GL_TEXTURE_MAX_LEVEL, img->cmn.num_mipmaps - 1); const int num_faces = img->cmn.type == SG_IMAGETYPE_CUBE ? 6 : 1; int data_index = 0; for (int face_index = 0; face_index < num_faces; face_index++) { @@ -8127,9 +8133,31 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pass(_sg_pass_t* pass, _sg_image_ } // check if framebuffer is complete - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - _SG_ERROR(GL_FRAMEBUFFER_INCOMPLETE); - return SG_RESOURCESTATE_FAILED; + { + const GLenum fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (fb_status != GL_FRAMEBUFFER_COMPLETE) { + switch (fb_status) { + case GL_FRAMEBUFFER_UNDEFINED: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNDEFINED); + break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_ATTACHMENT); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MISSING_ATTACHMENT); + break; + case GL_FRAMEBUFFER_UNSUPPORTED: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNSUPPORTED); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MULTISAMPLE); + break; + default: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNKNOWN); + break; + } + return SG_RESOURCESTATE_FAILED; + } } // setup color attachments for the framebuffer @@ -8151,8 +8179,28 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_pass(_sg_pass_t* pass, _sg_image_ glBindFramebuffer(GL_FRAMEBUFFER, pass->gl.msaa_resolve_framebuffer[i]); _sg_gl_fb_attach_texture(gl_resolve_att, cmn_resolve_att, GL_COLOR_ATTACHMENT0); // check if framebuffer is complete - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - _SG_ERROR(GL_MSAA_FRAMEBUFFER_INCOMPLETE); + const GLenum fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (fb_status != GL_FRAMEBUFFER_COMPLETE) { + switch (fb_status) { + case GL_FRAMEBUFFER_UNDEFINED: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNDEFINED); + break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_ATTACHMENT); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MISSING_ATTACHMENT); + break; + case GL_FRAMEBUFFER_UNSUPPORTED: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNSUPPORTED); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MULTISAMPLE); + break; + default: + _SG_ERROR(GL_FRAMEBUFFER_STATUS_UNKNOWN); + break; + } return SG_RESOURCESTATE_FAILED; } // setup color attachments for the framebuffer From 56572917418763aae3878fb98bf4f203596288ce Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 26 Oct 2023 18:37:05 +0200 Subject: [PATCH 270/292] sokol_gfx.h gl: add GL_FRAMEBUFFER defines to win32 gl loader --- sokol_gfx.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 838146e68..189185612 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -4309,6 +4309,11 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_ #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #define GL_TEXTURE_MAX_LEVEL 0x813D + #define GL_FRAMEBUFFER_UNDEFINED 0x8219 + #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 + #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 + #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #endif #ifndef GL_UNSIGNED_INT_2_10_10_10_REV From 85d65418c145b2b809498122d0d2bb75e4a96573 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 26 Oct 2023 19:58:05 +0200 Subject: [PATCH 271/292] sokol_gfx.h gl win32: important regression fix in GL context setup --- CHANGELOG.md | 8 ++++++++ README.md | 2 +- sokol_app.h | 9 +++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b0c3fa54..d920f3732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Updates +#### 26-Oct-2023 + +- sokol_app.h gl: fix a regression introduced in https://github.com/floooh/sokol/pull/916 + which could select the wrong framebuffer pixel format and break rendering + on some GL drivers (in my case: an older Intel GPU). + + If you are using the GL backend on Windows, please make sure to upgrade! + #### 23-Oct-2023 - sokol_app.h gl: some further startup optimizations in the WGL code path diff --git a/README.md b/README.md index b9db2ba8b..50947d61a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**21-Oct-2023** WebGPU!) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Oct-2023** IMPORTANT REGRESSION FIX FOR GL ON WINDOWS!) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) diff --git a/sokol_app.h b/sokol_app.h index 3b6602b02..3b811607c 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -6799,8 +6799,6 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { desired.samples = (_sapp.sample_count > 1) ? _sapp.sample_count : 0; int pixel_format = 0; - _sapp_gl_fbconfig u; - _sapp_gl_init_fbconfig(&u); _sapp_gl_fbselect fbselect; _sapp_gl_init_fbselect(&fbselect); @@ -6816,16 +6814,15 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { continue; } + _sapp_gl_fbconfig u; + _sapp_clear(&u, sizeof(u)); u.red_bits = query_results[result_red_bits_index]; u.green_bits = query_results[result_green_bits_index]; u.blue_bits = query_results[result_blue_bits_index]; u.alpha_bits = query_results[result_alpha_bits_index]; u.depth_bits = query_results[result_depth_bits_index]; u.stencil_bits = query_results[result_stencil_bits_index]; - if (query_results[result_double_buffer_index]) { - u.doublebuffer = true; - } - + u.doublebuffer = 0 != query_results[result_double_buffer_index]; u.samples = query_results[result_samples_index]; // NOTE: If arb_multisample is not supported - just takes the default 0 // Test if this pixel format is better than the previous one From 227df3a3f9623fda949011d0e88c4f40c1855fbe Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 26 Oct 2023 20:01:31 +0200 Subject: [PATCH 272/292] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50947d61a..20e4e5d06 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Oct-2023** IMPORTANT REGRESSION FIX FOR GL ON WINDOWS!) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Oct-2023** IMPORTANT REGRESSION FIX IN sokol_app.h FOR GL ON WINDOWS!) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) From 97d6d001ead26499d2a955e2b4342cc5ffef0ee8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 27 Oct 2023 18:38:54 +0200 Subject: [PATCH 273/292] sokol_gfx.h: remove validation check which requires SG_FILTER_NONE for an image with .num_mipmap = 1 --- sokol_gfx.h | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 189185612..fbde3309f 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -1920,13 +1920,6 @@ typedef enum sg_primitive_type { For min_filter and mag_filter the default is SG_FILTER_NEAREST. For mipmap_filter the default is SG_FILTER_NONE. - - The following restrictions apply: - - - an image object with (num_mipmaps == 1) must use SG_FILTER_NONE - - min_filter and mag_filter cannot be SG_FILTER_NONE - - Those restrictions are checked in the validation layer. */ typedef enum sg_filter { _SG_FILTER_DEFAULT, // value 0 reserved for default-init @@ -3437,7 +3430,6 @@ typedef struct sg_frame_stats { _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on vertex stage, but sampler has SG_FILTER_LINEAR filters") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on vertex stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_SMP_EXISTS, "sg_apply_bindings: sampler bound to vertex stage no longer alive") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_VS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to vertex stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING, "sg_apply_bindings: image binding on fragment stage is missing or the image handle is invalid") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_EXISTS, "sg_apply_bindings: image bound to fragment stage no longer alive") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMAGE_TYPE_MISMATCH, "sg_apply_bindings: type of image bound to fragment stage doesn't match shader desc") \ @@ -3451,7 +3443,6 @@ typedef struct sg_frame_stats { _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_EXPECTED_NONFILTERING_SAMPLER, "sg_apply_bindings: shader expected SG_SAMPLERTYPE_NONFILTERING on fragment stage, but sampler has SG_FILTER_LINEAR filters") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING, "sg_apply_bindings: unexpected sampler binding on fragment stage") \ _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_SMP_EXISTS, "sg_apply_bindings: sampler bound to fragment stage no longer alive") \ - _SG_LOGITEM_XMACRO(VALIDATE_ABND_FS_IMG_SMP_MIPMAPS, "sg_apply_bindings: image bound to fragment stage has mipmap_count == 1, but associated sampler mipmap filer is not SG_MIPMAPFILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_PIPELINE, "sg_apply_uniforms: must be called after sg_apply_pipeline()") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_NO_UB_AT_SLOT, "sg_apply_uniforms: no uniform block declaration at this shader stage UB slot") \ _SG_LOGITEM_XMACRO(VALIDATE_AUB_SIZE, "sg_apply_uniforms: data size doesn't match declared uniform block size") \ @@ -16161,34 +16152,6 @@ _SOKOL_PRIVATE bool _sg_validate_apply_bindings(const sg_bindings* bindings) { _SG_VALIDATE(bindings->fs.samplers[i].id == SG_INVALID_ID, VALIDATE_ABND_FS_UNEXPECTED_SAMPLER_BINDING); } } - - // if image-sampler-pair info was provided in shader desc, check that that the mipmap filter matches image num mipmaps - for (int img_smp_index = 0; img_smp_index < pip->shader->cmn.stage[SG_SHADERSTAGE_VS].num_image_samplers; img_smp_index++) { - const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_VS]; - const int img_index = stage->image_samplers[img_smp_index].image_slot; - const int smp_index = stage->image_samplers[img_smp_index].sampler_slot; - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->vs.images[img_index].id); - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->vs.samplers[smp_index].id); - if (img && smp) { - if (img->cmn.num_mipmaps == 1) { - _SG_VALIDATE(smp->cmn.mipmap_filter == SG_FILTER_NONE, VALIDATE_ABND_VS_IMG_SMP_MIPMAPS); - } - } - } - for (int img_smp_index = 0; img_smp_index < pip->shader->cmn.stage[SG_SHADERSTAGE_FS].num_image_samplers; img_smp_index++) { - const _sg_shader_stage_t* stage = &pip->shader->cmn.stage[SG_SHADERSTAGE_FS]; - const int img_index = stage->image_samplers[img_smp_index].image_slot; - const int smp_index = stage->image_samplers[img_smp_index].sampler_slot; - SOKOL_ASSERT(img_index < stage->num_images); - SOKOL_ASSERT(smp_index < stage->num_samplers); - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, bindings->fs.images[img_index].id); - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, bindings->fs.samplers[smp_index].id); - if (img && smp) { - if (img->cmn.num_mipmaps == 1) { - _SG_VALIDATE(smp->cmn.mipmap_filter == SG_FILTER_NONE, VALIDATE_ABND_FS_IMG_SMP_MIPMAPS); - } - } - } return _sg_validate_end(); #endif } From f8a0d78c26a47802df3e2ccb426d62f943b4c15a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 27 Oct 2023 18:51:05 +0200 Subject: [PATCH 274/292] update changelog (GL_MAX_TEXTURE_LEVEL) --- CHANGELOG.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d920f3732..0fb4b8780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ ## Updates +#### 27-Oct-2023 + +Fix broken render-to-mipmap in the sokol_gfx.h GL backend. + +There was a subtle bug / feature gap lurking in sokol_gfx.h GL backend: trying +to render to any mipmap except the top-level mipmap resulted in a black screen +because of an incomplete-framebuffer error. This is fixed now. The changes in detail: + +- creating a texture in the GL backend now sets the GL_TEXTURE_MAX_LEVEL property + (this is the fix to make everything work) +- the framebuffer completeness check in the GL backend now has more detailed error logging +- in the validation layer, the requirement that a sampler that's used with a + single-mipmap-texture must use `.mipmap_filter = SG_FILTER_NONE` has been + relaxed (a later update will remove SG_FILTER_NONE entirely since it's not needed anymore + and the concept of a "none" mipmap filter only exists in GL and Metal, but not D3D, WebGPU + and Vulkan) + +There's also a new render-to-mipmap sample which covers to close this 'feature gap': + +https://floooh.github.io/sokol-html5/miprender-sapp.html + +A couple of similar samples will follow over the next few days +(rendering to texture array layers and 3d texture slices). + #### 26-Oct-2023 - sokol_app.h gl: fix a regression introduced in https://github.com/floooh/sokol/pull/916 From 12a27458b04bf46929a099edccd9cdce02adb520 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 27 Oct 2023 19:03:07 +0200 Subject: [PATCH 275/292] changelog: add ticket and pr link --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fb4b8780..99a972c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Fix broken render-to-mipmap in the sokol_gfx.h GL backend. -There was a subtle bug / feature gap lurking in sokol_gfx.h GL backend: trying +There was a subtle bug / "feature gap" lurking in sokol_gfx.h GL backend: trying to render to any mipmap except the top-level mipmap resulted in a black screen because of an incomplete-framebuffer error. This is fixed now. The changes in detail: @@ -17,6 +17,9 @@ because of an incomplete-framebuffer error. This is fixed now. The changes in de and the concept of a "none" mipmap filter only exists in GL and Metal, but not D3D, WebGPU and Vulkan) +Ticket: https://github.com/floooh/sokol/issues/923 +PR: https://github.com/floooh/sokol/pull/924 + There's also a new render-to-mipmap sample which covers to close this 'feature gap': https://floooh.github.io/sokol-html5/miprender-sapp.html From 20b7483fa1043eae2492af3e2b3acdd0e2724a14 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Fri, 27 Oct 2023 19:03:25 +0200 Subject: [PATCH 276/292] tweak changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a972c24..31d0865e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ because of an incomplete-framebuffer error. This is fixed now. The changes in de and Vulkan) Ticket: https://github.com/floooh/sokol/issues/923 + PR: https://github.com/floooh/sokol/pull/924 There's also a new render-to-mipmap sample which covers to close this 'feature gap': From 1652c37feb981455c9b2d665f8c35f9c496604cb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 10:04:28 +0100 Subject: [PATCH 277/292] sokol_gfx.h d3d11: add missing sg_d3d11_device_context() function --- sokol_gfx.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index fbde3309f..ca363c87e 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3833,7 +3833,7 @@ SOKOL_GFX_API_DECL sg_context sg_setup_context(void); SOKOL_GFX_API_DECL void sg_activate_context(sg_context ctx_id); SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); -/* Backend-specific helper functions, these may come in handy for mixing +/* Backend-specific structs and functions, these may come in handy for mixing sokol-gfx rendering with 'native backend' rendering functions. This group of functions will be expanded as needed. @@ -3841,6 +3841,8 @@ SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); +// D3D11: return ID3D11DeviceContext +SOKOL_GFX_API_DECL const void* sg_d3d11_device_context(void); // Metal: return __bridge-casted MTLDevice SOKOL_GFX_API_DECL const void* sg_mtl_device(void); // Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) @@ -18245,6 +18247,14 @@ SOKOL_API_IMPL const void* sg_d3d11_device(void) { #endif } +SOKOL_API_IMPL const void* sg_d3d11_device_context(void) { +#if defined(SOKOL_D3D11) + return (const void*) _sg.d3d11.ctx; +#else + return 0; +#endif +} + SOKOL_API_IMPL const void* sg_mtl_device(void) { #if defined(SOKOL_METAL) if (nil != _sg.mtl.device) { From 2093942ac325c1e68e6dd5cce6d0bfed5ca97d4b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 10:53:32 +0100 Subject: [PATCH 278/292] sokol_gfx.h d3d11: add internal resource query functions --- sokol_gfx.h | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index ca363c87e..5b839b8af 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3839,10 +3839,58 @@ SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); This group of functions will be expanded as needed. */ +typedef struct sg_d3d11_buffer_info { + void* buf; // ID3D11Buffer* +} sg_d3d11_buffer_info; + +typedef struct sg_d3d11_image_info { + void* tex2d; // ID3D11Texture2D* + void* tex3d; // ID3D11Texture3D* + void* res; // ID3D11Resource* (either tex2d or tex3d) + void* srv; // ID3D11ShaderResourceView* +} sg_d3d11_image_info; + +typedef struct sg_d3d11_sampler_info { + void* smp; // ID3D11SamplerState* +} sg_d3d11_sampler_info; + +typedef struct sg_d3d11_shader_info { + void* vs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11Buffer* (vertex stage constant buffers) + void* fs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11BUffer* (fragment stage constant buffers) + void* vs; // ID3D11VertexShader* + void* fs; // ID3D11PixelShader* +} sg_d3d11_shader_info; + +typedef struct sg_d3d11_pipeline_info { + void* il; // ID3D11InputLayout* + void* rs; // ID3D11RasterizerState* + void* dss; // ID3D11DepthStencilState* + void* bs; // ID3D11BlendState* +} sg_d3d11_pipeline_info; + +typedef struct sg_d3d11_pass_info { + void* color_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView + void* resolve_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView + void* dsv; // ID3D11DepthStencilView +} sg_d3d11_pass_info; + // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); // D3D11: return ID3D11DeviceContext SOKOL_GFX_API_DECL const void* sg_d3d11_device_context(void); +// D3D11: get internal buffer resource objects +SOKOL_GFX_API_DECL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf); +// D3D11: get internal image resource objects +SOKOL_GFX_API_DECL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img); +// D3D11: get internal sampler resource objects +SOKOL_GFX_API_DECL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp); +// D3D11: get internal shader resource objects +SOKOL_GFX_API_DECL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd); +// D3D11: get internal pipeline resource objects +SOKOL_GFX_API_DECL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline pip); +// D3D11: get internal pass resource objects +SOKOL_GFX_API_DECL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass); + // Metal: return __bridge-casted MTLDevice SOKOL_GFX_API_DECL const void* sg_mtl_device(void); // Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) @@ -18255,6 +18303,99 @@ SOKOL_API_IMPL const void* sg_d3d11_device_context(void) { #endif } +SOKOL_GFX_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_buffer_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + res.buf = (void*) buf->d3d11.buf; + } +#endif + return res; +} + +SOKOL_GFX_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_image_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + res.tex2d = (void*) img->d3d11.tex2d; + res.tex3d = (void*) img->d3d11.tex3d; + res.res = (void*) img->d3d11.res; + res.srv = (void*) img->d3d11.srv; + } +#endif + return res; +} + +SOKOL_GFX_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_sampler_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + res.smp = (void*) smp->d3d11.smp; + } +#endif + return res; +} + +SOKOL_GFX_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_shader_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { + res.vs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_VS].cbufs[i]; + res.fs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_FS].cbufs[i]; + } + res.vs = (void*) shd->d3d11.vs; + res.fs = (void*) shd->d3d11.fs; + } +#endif + return res; +} + +SOKOL_GFX_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline pip_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_pipeline_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); + if (pip) { + res.il = pip->d3d11.il; + res.rs = pip->d3d11.rs; + res.dss = pip->d3d11.dss; + res.bs = pip->d3d11.bs; + } +#endif + return res; +} + +SOKOL_GFX_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) { + SOKOL_ASSERT(_sg.valid); + sg_d3d11_pass_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_D3D11) + const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); + if (pass) { + for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { + res.color_rtv[i] = pass->d3d11.color_atts[i].rtv; + res.resolve_rtv[i] = pass->d3d11.resolve_attrs[i].rtv; + } + res.dsv = pass->d3d11.ds_att.dsv; + } +#endif + return res; +} + SOKOL_API_IMPL const void* sg_mtl_device(void) { #if defined(SOKOL_METAL) if (nil != _sg.mtl.device) { From f841f54b77c1998d25eaeabb52a49a96653e0127 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 11:12:55 +0100 Subject: [PATCH 279/292] sokol_gfx.h d3d11: fix compilation errors --- sokol_gfx.h | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 5b839b8af..2a1d7751b 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -18303,7 +18303,7 @@ SOKOL_API_IMPL const void* sg_d3d11_device_context(void) { #endif } -SOKOL_GFX_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf_id) { +SOKOL_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_buffer_info res; _sg_clear(&res, sizeof(res)); @@ -18312,11 +18312,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf if (buf) { res.buf = (void*) buf->d3d11.buf; } +#else + _SOKOL_UNUSED(buf_id); #endif return res; } -SOKOL_GFX_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id) { +SOKOL_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_image_info res; _sg_clear(&res, sizeof(res)); @@ -18328,11 +18330,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id res.res = (void*) img->d3d11.res; res.srv = (void*) img->d3d11.srv; } +#else + _SOKOL_UNUSED(img_id); #endif return res; } -SOKOL_GFX_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp_id) { +SOKOL_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_sampler_info res; _sg_clear(&res, sizeof(res)); @@ -18341,11 +18345,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler if (smp) { res.smp = (void*) smp->d3d11.smp; } +#else + _SOKOL_UNUSED(smp_id); #endif return res; } -SOKOL_GFX_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd_id) { +SOKOL_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_shader_info res; _sg_clear(&res, sizeof(res)); @@ -18359,11 +18365,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd res.vs = (void*) shd->d3d11.vs; res.fs = (void*) shd->d3d11.fs; } +#else + _SOKOL_UNUSED(shd_id); #endif return res; } -SOKOL_GFX_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline pip_id) { +SOKOL_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline pip_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_pipeline_info res; _sg_clear(&res, sizeof(res)); @@ -18375,11 +18383,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeli res.dss = pip->d3d11.dss; res.bs = pip->d3d11.bs; } +#else + _SOKOL_UNUSED(pip_id); #endif return res; } -SOKOL_GFX_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) { +SOKOL_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_pass_info res; _sg_clear(&res, sizeof(res)); @@ -18387,11 +18397,13 @@ SOKOL_GFX_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); if (pass) { for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { - res.color_rtv[i] = pass->d3d11.color_atts[i].rtv; - res.resolve_rtv[i] = pass->d3d11.resolve_attrs[i].rtv; + res.color_rtv[i] = pass->d3d11.color_atts[i].view.rtv; + res.resolve_rtv[i] = pass->d3d11.resolve_atts[i].view.rtv; } - res.dsv = pass->d3d11.ds_att.dsv; + res.dsv = pass->d3d11.ds_att.view.dsv; } +#else + _SOKOL_UNUSED(pass_id); #endif return res; } From 37accae5b0fff85d6b0e35914da8a8fe80295075 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 15:38:52 +0100 Subject: [PATCH 280/292] sokol_gfx.h metal: add internal resource query functions --- sokol_gfx.h | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index 2a1d7751b..7ffc760d3 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3874,6 +3874,32 @@ typedef struct sg_d3d11_pass_info { void* dsv; // ID3D11DepthStencilView } sg_d3d11_pass_info; +typedef struct sg_mtl_buffer_info { + void* buf[SG_NUM_INFLIGHT_FRAMES]; // id + int active_slot; +} sg_mtl_buffer_info; + +typedef struct sg_mtl_image_info { + void* tex[SG_NUM_INFLIGHT_FRAMES]; // id + int active_slot; +} sg_mtl_image_info; + +typedef struct sg_mtl_sampler_info { + void* smp; // id +} sg_mtl_sampler_info; + +typedef struct sg_mtl_shader_info { + void* vs_lib; // id + void* fs_lib; // id + void* vs_func; // id + void* fs_func; // id +} sg_mtl_shader_info; + +typedef struct sg_mtl_pipeline_info { + void* rps; // id + void* dss; // id +} sg_mtl_pipeline_info; + // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); // D3D11: return ID3D11DeviceContext @@ -3895,6 +3921,17 @@ SOKOL_GFX_API_DECL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass); SOKOL_GFX_API_DECL const void* sg_mtl_device(void); // Metal: return __bridge-casted MTLRenderCommandEncoder in current pass (or zero if outside pass) SOKOL_GFX_API_DECL const void* sg_mtl_render_command_encoder(void); +// Metal: get internal __bridge-casted buffer resource objects +SOKOL_GFX_API_DECL sg_mtl_buffer_info sg_mtl_query_buffer_info(sg_buffer buf); +// Metal: get internal __bridge-casted image resource objects +SOKOL_GFX_API_DECL sg_mtl_image_info sg_mtl_query_image_info(sg_image img); +// Metal: get internal __bridge-casted sampler resource objects +SOKOL_GFX_API_DECL sg_mtl_sampler_info sg_mtl_query_sampler_info(sg_sampler smp); +// Metal: get internal __bridge-casted shader resource objects +SOKOL_GFX_API_DECL sg_mtl_shader_info sg_mtl_query_shader_info(sg_shader shd); +// Metal: get internal __bridge-casted pipeline resource objects +SOKOL_GFX_API_DECL sg_mtl_pipeline_info sg_mtl_query_pipeline_info(sg_pipeline pip); + // WebGPU: return WGPUDevice object SOKOL_GFX_API_DECL const void* sg_wgpu_device(void); // WebGPU: return WGPUQueue object @@ -18432,6 +18469,113 @@ SOKOL_API_IMPL const void* sg_mtl_render_command_encoder(void) { #endif } +SOKOL_API_IMPL sg_mtl_buffer_info sg_mtl_query_buffer_info(sg_buffer buf_id) { + SOKOL_ASSERT(_sg.valid); + sg_mtl_buffer_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_METAL) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + if (buf->mtl.buf[i] != 0) { + res.buf[i] = (__bridge void*) _sg_mtl_id(buf->mtl.buf[i]); + } + } + res.active_slot = buf->cmn.active_slot; + } +#else + _SOKOL_UNUSED(buf_id); +#endif + return res; +} + +SOKOL_API_IMPL sg_mtl_image_info sg_mtl_query_image_info(sg_image img_id) { + SOKOL_ASSERT(_sg.valid); + sg_mtl_image_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_METAL) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + if (img->mtl.tex[i] != 0) { + res.tex[i] = (__bridge void*) _sg_mtl_id(img->mtl.tex[i]); + } + } + res.active_slot = img->cmn.active_slot; + } +#else + _SOKOL_UNUSED(img_id); +#endif + return res; +} + +SOKOL_API_IMPL sg_mtl_sampler_info sg_mtl_query_sampler_info(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_mtl_sampler_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_METAL) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if (smp->mtl.sampler_state != 0) { + res.smp = (__bridge void*) _sg_mtl_id(smp->mtl.sampler_state); + } + } +#else + _SOKOL_UNUSED(smp_id); +#endif + return res; +} + +SOKOL_API_IMPL sg_mtl_shader_info sg_mtl_query_shader_info(sg_shader shd_id) { + SOKOL_ASSERT(_sg.valid); + sg_mtl_shader_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_METAL) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + const int vs_lib = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib; + const int vs_func = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func; + const int fs_lib = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib; + const int fs_func = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func; + if (vs_lib != 0) { + res.vs_lib = (__bridge void*) _sg_mtl_id(vs_lib); + } + if (fs_lib != 0) { + res.fs_lib = (__bridge void*) _sg_mtl_id(fs_lib); + } + if (vs_func != 0) { + res.vs_func = (__bridge void*) _sg_mtl_id(vs_func); + } + if (fs_func != 0) { + res.fs_func = (__bridge void*) _sg_mtl_id(fs_func); + } + } +#else + _SOKOL_UNUSED(shd_id); +#endif + return res; +} + +SOKOL_API_IMPL sg_mtl_pipeline_info sg_mtl_query_pipeline_info(sg_pipeline pip_id) { + SOKOL_ASSERT(_sg.valid); + sg_mtl_pipeline_info res; + _sg_clear(&res, sizeof(res)); +#if defined(SOKOL_METAL) + const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); + if (pip) { + if (pip->mtl.rps != 0) { + res.rps = (__bridge void*) _sg_mtl_id(pip->mtl.rps); + } + if (pip->mtl.dss != 0) { + res.dss = (__bridge void*) _sg_mtl_id(pip->mtl.dss); + } + } +#else + _SOKOL_UNUSED(pip_id); +#endif + return res; +} + SOKOL_API_IMPL const void* sg_wgpu_device(void) { #if defined(SOKOL_WGPU) return _sg.wgpu.dev; From e5d3c9244ceb61643eb7aa18af043d2017f7f6d2 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 16:49:46 +0100 Subject: [PATCH 281/292] sokol_gfx.h wgpu: add internal resource query functions --- sokol_gfx.h | 426 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 282 insertions(+), 144 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7ffc760d3..78d01cdfe 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3900,6 +3900,35 @@ typedef struct sg_mtl_pipeline_info { void* dss; // id } sg_mtl_pipeline_info; +typedef struct sg_wgpu_buffer_info { + void* buf; // WGPUBuffer +} sg_wgpu_buffer_info; + +typedef struct sg_wgpu_image_info { + void* tex; // WGPUTexture + void* view; // WGPUTextureView +} sg_wgpu_image_info; + +typedef struct sg_wgpu_sampler_info { + void* smp; // WGPUSampler +} sg_wgpu_sampler_info; + +typedef struct sg_wgpu_shader_info { + void* vs_mod; // WGPUShaderModule + void* fs_mod; // WGPUShaderModule + void* bgl; // WGPUBindGroupLayout; +} sg_wgpu_shader_info; + +typedef struct sg_wgpu_pipeline_info { + void* pip; // WGPURenderPipeline +} sg_wgpu_pipeline_info; + +typedef struct sg_wgpu_pass_info { + void* color_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView + void* resolve_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView + void* ds_view; // WGPUTextureView +} sg_wgpu_pass_info; + // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); // D3D11: return ID3D11DeviceContext @@ -3940,6 +3969,18 @@ SOKOL_GFX_API_DECL const void* sg_wgpu_queue(void); SOKOL_GFX_API_DECL const void* sg_wgpu_command_encoder(void); // WebGPU: return WGPURenderPassEncoder of currrent pass SOKOL_GFX_API_DECL const void* sg_wgpu_render_pass_encoder(void); +// WebGPU: get internal buffer resource objects +SOKOL_GFX_API_DECL sg_wgpu_buffer_info sg_wgpu_query_buffer_info(sg_buffer buf); +// WebGPU: get internal image resource objects +SOKOL_GFX_API_DECL sg_wgpu_image_info sg_wgpu_query_image_info(sg_image img); +// WebGPU: get internal sampler resource objects +SOKOL_GFX_API_DECL sg_wgpu_sampler_info sg_wgpu_query_sampler_info(sg_sampler smp); +// WebGPU: get internal shader resource objects +SOKOL_GFX_API_DECL sg_wgpu_shader_info sg_wgpu_query_shader_info(sg_shader shd); +// WebGPU: get internal pipeline resource objects +SOKOL_GFX_API_DECL sg_wgpu_pipeline_info sg_wgpu_query_pipeline_info(sg_pipeline pip); +// WebGPU: get internal pass resource objects +SOKOL_GFX_API_DECL sg_wgpu_pass_info sg_wgpu_query_pass_info(sg_pass pass); #ifdef __cplusplus } // extern "C" @@ -18325,33 +18366,33 @@ SOKOL_API_IMPL sg_pass_desc sg_query_pass_defaults(const sg_pass_desc* desc) { } SOKOL_API_IMPL const void* sg_d3d11_device(void) { -#if defined(SOKOL_D3D11) - return (const void*) _sg.d3d11.dev; -#else - return 0; -#endif + #if defined(SOKOL_D3D11) + return (const void*) _sg.d3d11.dev; + #else + return 0; + #endif } SOKOL_API_IMPL const void* sg_d3d11_device_context(void) { -#if defined(SOKOL_D3D11) - return (const void*) _sg.d3d11.ctx; -#else - return 0; -#endif + #if defined(SOKOL_D3D11) + return (const void*) _sg.d3d11.ctx; + #else + return 0; + #endif } SOKOL_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_buffer_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); - if (buf) { - res.buf = (void*) buf->d3d11.buf; - } -#else - _SOKOL_UNUSED(buf_id); -#endif + #if defined(SOKOL_D3D11) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + res.buf = (void*) buf->d3d11.buf; + } + #else + _SOKOL_UNUSED(buf_id); + #endif return res; } @@ -18359,17 +18400,17 @@ SOKOL_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_image_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); - if (img) { - res.tex2d = (void*) img->d3d11.tex2d; - res.tex3d = (void*) img->d3d11.tex3d; - res.res = (void*) img->d3d11.res; - res.srv = (void*) img->d3d11.srv; - } -#else - _SOKOL_UNUSED(img_id); -#endif + #if defined(SOKOL_D3D11) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + res.tex2d = (void*) img->d3d11.tex2d; + res.tex3d = (void*) img->d3d11.tex3d; + res.res = (void*) img->d3d11.res; + res.srv = (void*) img->d3d11.srv; + } + #else + _SOKOL_UNUSED(img_id); + #endif return res; } @@ -18377,14 +18418,14 @@ SOKOL_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp_ SOKOL_ASSERT(_sg.valid); sg_d3d11_sampler_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); - if (smp) { - res.smp = (void*) smp->d3d11.smp; - } -#else - _SOKOL_UNUSED(smp_id); -#endif + #if defined(SOKOL_D3D11) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + res.smp = (void*) smp->d3d11.smp; + } + #else + _SOKOL_UNUSED(smp_id); + #endif return res; } @@ -18392,19 +18433,19 @@ SOKOL_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd_id) SOKOL_ASSERT(_sg.valid); sg_d3d11_shader_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); - if (shd) { - for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { - res.vs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_VS].cbufs[i]; - res.fs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_FS].cbufs[i]; + #if defined(SOKOL_D3D11) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { + res.vs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_VS].cbufs[i]; + res.fs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_FS].cbufs[i]; + } + res.vs = (void*) shd->d3d11.vs; + res.fs = (void*) shd->d3d11.fs; } - res.vs = (void*) shd->d3d11.vs; - res.fs = (void*) shd->d3d11.fs; - } -#else - _SOKOL_UNUSED(shd_id); -#endif + #else + _SOKOL_UNUSED(shd_id); + #endif return res; } @@ -18412,17 +18453,17 @@ SOKOL_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline p SOKOL_ASSERT(_sg.valid); sg_d3d11_pipeline_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); - if (pip) { - res.il = pip->d3d11.il; - res.rs = pip->d3d11.rs; - res.dss = pip->d3d11.dss; - res.bs = pip->d3d11.bs; - } -#else - _SOKOL_UNUSED(pip_id); -#endif + #if defined(SOKOL_D3D11) + const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); + if (pip) { + res.il = pip->d3d11.il; + res.rs = pip->d3d11.rs; + res.dss = pip->d3d11.dss; + res.bs = pip->d3d11.bs; + } + #else + _SOKOL_UNUSED(pip_id); + #endif return res; } @@ -18430,31 +18471,31 @@ SOKOL_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) { SOKOL_ASSERT(_sg.valid); sg_d3d11_pass_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_D3D11) - const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); - if (pass) { - for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { - res.color_rtv[i] = pass->d3d11.color_atts[i].view.rtv; - res.resolve_rtv[i] = pass->d3d11.resolve_atts[i].view.rtv; + #if defined(SOKOL_D3D11) + const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); + if (pass) { + for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { + res.color_rtv[i] = pass->d3d11.color_atts[i].view.rtv; + res.resolve_rtv[i] = pass->d3d11.resolve_atts[i].view.rtv; + } + res.dsv = pass->d3d11.ds_att.view.dsv; } - res.dsv = pass->d3d11.ds_att.view.dsv; - } -#else - _SOKOL_UNUSED(pass_id); -#endif + #else + _SOKOL_UNUSED(pass_id); + #endif return res; } SOKOL_API_IMPL const void* sg_mtl_device(void) { -#if defined(SOKOL_METAL) - if (nil != _sg.mtl.device) { - return (__bridge const void*) _sg.mtl.device; - } else { + #if defined(SOKOL_METAL) + if (nil != _sg.mtl.device) { + return (__bridge const void*) _sg.mtl.device; + } else { + return 0; + } + #else return 0; - } -#else - return 0; -#endif + #endif } SOKOL_API_IMPL const void* sg_mtl_render_command_encoder(void) { @@ -18473,19 +18514,19 @@ SOKOL_API_IMPL sg_mtl_buffer_info sg_mtl_query_buffer_info(sg_buffer buf_id) { SOKOL_ASSERT(_sg.valid); sg_mtl_buffer_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_METAL) - const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); - if (buf) { - for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { - if (buf->mtl.buf[i] != 0) { - res.buf[i] = (__bridge void*) _sg_mtl_id(buf->mtl.buf[i]); + #if defined(SOKOL_METAL) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + if (buf->mtl.buf[i] != 0) { + res.buf[i] = (__bridge void*) _sg_mtl_id(buf->mtl.buf[i]); + } } + res.active_slot = buf->cmn.active_slot; } - res.active_slot = buf->cmn.active_slot; - } -#else - _SOKOL_UNUSED(buf_id); -#endif + #else + _SOKOL_UNUSED(buf_id); + #endif return res; } @@ -18493,19 +18534,19 @@ SOKOL_API_IMPL sg_mtl_image_info sg_mtl_query_image_info(sg_image img_id) { SOKOL_ASSERT(_sg.valid); sg_mtl_image_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_METAL) - const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); - if (img) { - for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { - if (img->mtl.tex[i] != 0) { - res.tex[i] = (__bridge void*) _sg_mtl_id(img->mtl.tex[i]); + #if defined(SOKOL_METAL) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + if (img->mtl.tex[i] != 0) { + res.tex[i] = (__bridge void*) _sg_mtl_id(img->mtl.tex[i]); + } } + res.active_slot = img->cmn.active_slot; } - res.active_slot = img->cmn.active_slot; - } -#else - _SOKOL_UNUSED(img_id); -#endif + #else + _SOKOL_UNUSED(img_id); + #endif return res; } @@ -18513,16 +18554,16 @@ SOKOL_API_IMPL sg_mtl_sampler_info sg_mtl_query_sampler_info(sg_sampler smp_id) SOKOL_ASSERT(_sg.valid); sg_mtl_sampler_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_METAL) - const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); - if (smp) { - if (smp->mtl.sampler_state != 0) { - res.smp = (__bridge void*) _sg_mtl_id(smp->mtl.sampler_state); + #if defined(SOKOL_METAL) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + if (smp->mtl.sampler_state != 0) { + res.smp = (__bridge void*) _sg_mtl_id(smp->mtl.sampler_state); + } } - } -#else - _SOKOL_UNUSED(smp_id); -#endif + #else + _SOKOL_UNUSED(smp_id); + #endif return res; } @@ -18530,29 +18571,29 @@ SOKOL_API_IMPL sg_mtl_shader_info sg_mtl_query_shader_info(sg_shader shd_id) { SOKOL_ASSERT(_sg.valid); sg_mtl_shader_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_METAL) - const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); - if (shd) { - const int vs_lib = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib; - const int vs_func = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func; - const int fs_lib = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib; - const int fs_func = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func; - if (vs_lib != 0) { - res.vs_lib = (__bridge void*) _sg_mtl_id(vs_lib); - } - if (fs_lib != 0) { - res.fs_lib = (__bridge void*) _sg_mtl_id(fs_lib); - } - if (vs_func != 0) { - res.vs_func = (__bridge void*) _sg_mtl_id(vs_func); - } - if (fs_func != 0) { - res.fs_func = (__bridge void*) _sg_mtl_id(fs_func); + #if defined(SOKOL_METAL) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + const int vs_lib = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_lib; + const int vs_func = shd->mtl.stage[SG_SHADERSTAGE_VS].mtl_func; + const int fs_lib = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_lib; + const int fs_func = shd->mtl.stage[SG_SHADERSTAGE_FS].mtl_func; + if (vs_lib != 0) { + res.vs_lib = (__bridge void*) _sg_mtl_id(vs_lib); + } + if (fs_lib != 0) { + res.fs_lib = (__bridge void*) _sg_mtl_id(fs_lib); + } + if (vs_func != 0) { + res.vs_func = (__bridge void*) _sg_mtl_id(vs_func); + } + if (fs_func != 0) { + res.fs_func = (__bridge void*) _sg_mtl_id(fs_func); + } } - } -#else - _SOKOL_UNUSED(shd_id); -#endif + #else + _SOKOL_UNUSED(shd_id); + #endif return res; } @@ -18560,19 +18601,19 @@ SOKOL_API_IMPL sg_mtl_pipeline_info sg_mtl_query_pipeline_info(sg_pipeline pip_i SOKOL_ASSERT(_sg.valid); sg_mtl_pipeline_info res; _sg_clear(&res, sizeof(res)); -#if defined(SOKOL_METAL) - const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); - if (pip) { - if (pip->mtl.rps != 0) { - res.rps = (__bridge void*) _sg_mtl_id(pip->mtl.rps); - } - if (pip->mtl.dss != 0) { - res.dss = (__bridge void*) _sg_mtl_id(pip->mtl.dss); + #if defined(SOKOL_METAL) + const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); + if (pip) { + if (pip->mtl.rps != 0) { + res.rps = (__bridge void*) _sg_mtl_id(pip->mtl.rps); + } + if (pip->mtl.dss != 0) { + res.dss = (__bridge void*) _sg_mtl_id(pip->mtl.dss); + } } - } -#else - _SOKOL_UNUSED(pip_id); -#endif + #else + _SOKOL_UNUSED(pip_id); + #endif return res; } @@ -18608,6 +18649,103 @@ SOKOL_API_IMPL const void* sg_wgpu_render_pass_encoder(void) { #endif } +SOKOL_API_IMPL sg_wgpu_buffer_info sg_wgpu_query_buffer_info(sg_buffer buf_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_buffer_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + res.buf = (void*) buf->wgpu.buf; + } + #else + _SOKOL_UNUSED(buf_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_wgpu_image_info sg_wgpu_query_image_info(sg_image img_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_image_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + res.tex = (void*) img->wgpu.tex; + res.view = (void*) img->wgpu.view; + } + #else + _SOKOL_UNUSED(img_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_wgpu_sampler_info sg_wgpu_query_sampler_info(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_sampler_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + res.smp = (void*) smp->wgpu.smp; + } + #else + _SOKOL_UNUSED(smp_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_wgpu_shader_info sg_wgpu_query_shader_info(sg_shader shd_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_shader_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + res.vs_mod = (void*) shd->wgpu.stage[SG_SHADERSTAGE_VS].module; + res.fs_mod = (void*) shd->wgpu.stage[SG_SHADERSTAGE_FS].module; + res.bgl = (void*) shd->wgpu.bind_group_layout; + } + #else + _SOKOL_UNUSED(shd_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_wgpu_pipeline_info sg_wgpu_query_pipeline_info(sg_pipeline pip_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_pipeline_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); + if (pip) { + res.pip = (void*) pip->wgpu.pip; + } + #else + _SOKOL_UNUSED(pip_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_wgpu_pass_info sg_wgpu_query_pass_info(sg_pass pass_id) { + SOKOL_ASSERT(_sg.valid); + sg_wgpu_pass_info res; + _sg_clear(&res, sizeof(res)); + #if defined(SOKOL_WGPU) + const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); + if (pass) { + for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { + res.color_view[i] = (void*) pass->wgpu.color_atts[i].view; + res.resolve_view[i] = (void*) pass->wgpu.resolve_atts[i].view; + } + res.ds_view = (void*) pass->wgpu.ds_att.view; + } + #else + _SOKOL_UNUSED(pass_id); + #endif + return res; +} + #ifdef _MSC_VER #pragma warning(pop) #endif From 79c582f12bec009aed92c9fe1ec3fe3fb46414f8 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 18:11:21 +0100 Subject: [PATCH 282/292] sokol_gfx.h wgpu: make texture view injectable --- sokol_gfx.h | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 78d01cdfe..a78837afc 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2562,6 +2562,7 @@ typedef struct sg_image_desc { const void* d3d11_texture; const void* d3d11_shader_resource_view; const void* wgpu_texture; + const void* wgpu_texture_view; uint32_t _end_canary; } sg_image_desc; @@ -13944,6 +13945,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s if (injected) { img->wgpu.tex = (WGPUTexture)desc->wgpu_texture; wgpuTextureReference(img->wgpu.tex); + img->wgpu.view = (WGPUTextureView)desc->wgpu_texture_view; + if (img->wgpu.view) { + wgpuTextureViewReference(img->wgpu.view); + } } else { WGPUTextureDescriptor wgpu_tex_desc; _sg_clear(&wgpu_tex_desc, sizeof(wgpu_tex_desc)); @@ -13971,28 +13976,28 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_image(_sg_image_t* img, const s if ((img->cmn.usage == SG_USAGE_IMMUTABLE) && !img->cmn.render_target) { _sg_wgpu_copy_image_data(img, img->wgpu.tex, &desc->data); } - } - WGPUTextureViewDescriptor wgpu_texview_desc; - _sg_clear(&wgpu_texview_desc, sizeof(wgpu_texview_desc)); - wgpu_texview_desc.label = desc->label; - wgpu_texview_desc.dimension = _sg_wgpu_texture_view_dimension(img->cmn.type); - wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; - if (img->cmn.type == SG_IMAGETYPE_CUBE) { - wgpu_texview_desc.arrayLayerCount = 6; - } else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { - wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; - } else { - wgpu_texview_desc.arrayLayerCount = 1; - } - if (_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format)) { - wgpu_texview_desc.aspect = WGPUTextureAspect_DepthOnly; - } else { - wgpu_texview_desc.aspect = WGPUTextureAspect_All; - } - img->wgpu.view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_texview_desc); - if (0 == img->wgpu.view) { - _SG_ERROR(WGPU_CREATE_TEXTURE_VIEW_FAILED); - return SG_RESOURCESTATE_FAILED; + WGPUTextureViewDescriptor wgpu_texview_desc; + _sg_clear(&wgpu_texview_desc, sizeof(wgpu_texview_desc)); + wgpu_texview_desc.label = desc->label; + wgpu_texview_desc.dimension = _sg_wgpu_texture_view_dimension(img->cmn.type); + wgpu_texview_desc.mipLevelCount = (uint32_t)img->cmn.num_mipmaps; + if (img->cmn.type == SG_IMAGETYPE_CUBE) { + wgpu_texview_desc.arrayLayerCount = 6; + } else if (img->cmn.type == SG_IMAGETYPE_ARRAY) { + wgpu_texview_desc.arrayLayerCount = (uint32_t)img->cmn.num_slices; + } else { + wgpu_texview_desc.arrayLayerCount = 1; + } + if (_sg_is_depth_or_depth_stencil_format(img->cmn.pixel_format)) { + wgpu_texview_desc.aspect = WGPUTextureAspect_DepthOnly; + } else { + wgpu_texview_desc.aspect = WGPUTextureAspect_All; + } + img->wgpu.view = wgpuTextureCreateView(img->wgpu.tex, &wgpu_texview_desc); + if (0 == img->wgpu.view) { + _SG_ERROR(WGPU_CREATE_TEXTURE_VIEW_FAILED); + return SG_RESOURCESTATE_FAILED; + } } return SG_RESOURCESTATE_VALID; } From c22a0fd54b12b404d44d498a3f4b0a8b94f9190c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 18:55:04 +0100 Subject: [PATCH 283/292] sokol_gfx.h gl: add internal resource query functions --- sokol_gfx.h | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/sokol_gfx.h b/sokol_gfx.h index a78837afc..f6954096f 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3930,6 +3930,31 @@ typedef struct sg_wgpu_pass_info { void* ds_view; // WGPUTextureView } sg_wgpu_pass_info; +typedef struct sg_gl_buffer_info { + uint32_t buf[SG_NUM_INFLIGHT_FRAMES]; + int active_slot; +} sg_gl_buffer_info; + +typedef struct sg_gl_image_info { + uint32_t tex[SG_NUM_INFLIGHT_FRAMES]; + uint32_t tex_target; + uint32_t msaa_render_buffer; + int active_slot; +} sg_gl_image_info; + +typedef struct sg_gl_sampler_info { + uint32_t smp; +} sg_gl_sampler_info; + +typedef struct sg_gl_shader_info { + uint32_t prog; +} sg_gl_shader_info; + +typedef struct sg_gl_pass_info { + uint32_t frame_buffer; + uint32_t msaa_resolve_framebuffer[SG_MAX_COLOR_ATTACHMENTS]; +} sg_gl_pass_info; + // D3D11: return ID3D11Device SOKOL_GFX_API_DECL const void* sg_d3d11_device(void); // D3D11: return ID3D11DeviceContext @@ -3983,6 +4008,17 @@ SOKOL_GFX_API_DECL sg_wgpu_pipeline_info sg_wgpu_query_pipeline_info(sg_pipeline // WebGPU: get internal pass resource objects SOKOL_GFX_API_DECL sg_wgpu_pass_info sg_wgpu_query_pass_info(sg_pass pass); +// GL: get internal buffer resource objects +SOKOL_GFX_API_DECL sg_gl_buffer_info sg_gl_query_buffer_info(sg_buffer buf); +// GL: get internal image resource objects +SOKOL_GFX_API_DECL sg_gl_image_info sg_gl_query_image_info(sg_image img); +// GL: get internal sampler resource objects +SOKOL_GFX_API_DECL sg_gl_sampler_info sg_gl_query_sampler_info(sg_sampler smp); +// GL: get internal shader resource objects +SOKOL_GFX_API_DECL sg_gl_shader_info sg_gl_query_shader_info(sg_shader shd); +// GL: get internal pass resource objects +SOKOL_GFX_API_DECL sg_gl_pass_info sg_gl_query_pass_info(sg_pass pass); + #ifdef __cplusplus } // extern "C" @@ -18751,6 +18787,92 @@ SOKOL_API_IMPL sg_wgpu_pass_info sg_wgpu_query_pass_info(sg_pass pass_id) { return res; } +SOKOL_API_IMPL sg_gl_buffer_info sg_gl_query_buffer_info(sg_buffer buf_id) { + SOKOL_ASSERT(_sg.valid); + sg_gl_buffer_info res; + _sg_clear(&res, sizeof(res)); + #if defined(_SOKOL_ANY_GL) + const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); + if (buf) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + res.buf[i] = buf->gl.buf[i]; + } + res.active_slot = buf->cmn.active_slot; + } + #else + _SOKOL_UNUSED(buf_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_gl_image_info sg_gl_query_image_info(sg_image img_id) { + SOKOL_ASSERT(_sg.valid); + sg_gl_image_info res; + _sg_clear(&res, sizeof(res)); + #if defined(_SOKOL_ANY_GL) + const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); + if (img) { + for (int i = 0; i < SG_NUM_INFLIGHT_FRAMES; i++) { + res.tex[i] = img->gl.tex[i]; + } + res.tex_target = img->gl.target; + res.msaa_render_buffer = img->gl.msaa_render_buffer; + res.active_slot = img->cmn.active_slot; + } + #else + _SOKOL_UNUSED(img_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_gl_sampler_info sg_gl_query_sampler_info(sg_sampler smp_id) { + SOKOL_ASSERT(_sg.valid); + sg_gl_sampler_info res; + _sg_clear(&res, sizeof(res)); + #if defined(_SOKOL_ANY_GL) + const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); + if (smp) { + res.smp = smp->gl.smp; + } + #else + _SOKOL_UNUSED(smp_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_gl_shader_info sg_gl_query_shader_info(sg_shader shd_id) { + SOKOL_ASSERT(_sg.valid); + sg_gl_shader_info res; + _sg_clear(&res, sizeof(res)); + #if defined(_SOKOL_ANY_GL) + const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); + if (shd) { + res.prog = shd->gl.prog; + } + #else + _SOKOL_UNUSED(shd_id); + #endif + return res; +} + +SOKOL_API_IMPL sg_gl_pass_info sg_gl_query_pass_info(sg_pass pass_id) { + SOKOL_ASSERT(_sg.valid); + sg_gl_pass_info res; + _sg_clear(&res, sizeof(res)); + #if defined(_SOKOL_ANY_GL) + const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); + if (pass) { + res.frame_buffer = pass->gl.fb; + for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { + res.msaa_resolve_framebuffer[i] = pass->gl.msaa_resolve_framebuffer[i]; + } + } + #else + _SOKOL_UNUSED(pass_id); + #endif + return res; +} + #ifdef _MSC_VER #pragma warning(pop) #endif From fb6d7c6bcc05fe6d761a1999abf90989112e3bcc Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 19:06:20 +0100 Subject: [PATCH 284/292] sokol_gfx.h: change type-erased backend-specific resource pointers to 'const void*' --- sokol_gfx.h | 138 ++++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index f6954096f..a1476e7b5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -3841,93 +3841,93 @@ SOKOL_GFX_API_DECL void sg_discard_context(sg_context ctx_id); */ typedef struct sg_d3d11_buffer_info { - void* buf; // ID3D11Buffer* + const void* buf; // ID3D11Buffer* } sg_d3d11_buffer_info; typedef struct sg_d3d11_image_info { - void* tex2d; // ID3D11Texture2D* - void* tex3d; // ID3D11Texture3D* - void* res; // ID3D11Resource* (either tex2d or tex3d) - void* srv; // ID3D11ShaderResourceView* + const void* tex2d; // ID3D11Texture2D* + const void* tex3d; // ID3D11Texture3D* + const void* res; // ID3D11Resource* (either tex2d or tex3d) + const void* srv; // ID3D11ShaderResourceView* } sg_d3d11_image_info; typedef struct sg_d3d11_sampler_info { - void* smp; // ID3D11SamplerState* + const void* smp; // ID3D11SamplerState* } sg_d3d11_sampler_info; typedef struct sg_d3d11_shader_info { - void* vs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11Buffer* (vertex stage constant buffers) - void* fs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11BUffer* (fragment stage constant buffers) - void* vs; // ID3D11VertexShader* - void* fs; // ID3D11PixelShader* + const void* vs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11Buffer* (vertex stage constant buffers) + const void* fs_cbufs[SG_MAX_SHADERSTAGE_UBS]; // ID3D11BUffer* (fragment stage constant buffers) + const void* vs; // ID3D11VertexShader* + const void* fs; // ID3D11PixelShader* } sg_d3d11_shader_info; typedef struct sg_d3d11_pipeline_info { - void* il; // ID3D11InputLayout* - void* rs; // ID3D11RasterizerState* - void* dss; // ID3D11DepthStencilState* - void* bs; // ID3D11BlendState* + const void* il; // ID3D11InputLayout* + const void* rs; // ID3D11RasterizerState* + const void* dss; // ID3D11DepthStencilState* + const void* bs; // ID3D11BlendState* } sg_d3d11_pipeline_info; typedef struct sg_d3d11_pass_info { - void* color_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView - void* resolve_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView - void* dsv; // ID3D11DepthStencilView + const void* color_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView + const void* resolve_rtv[SG_MAX_COLOR_ATTACHMENTS]; // ID3D11RenderTargetView + const void* dsv; // ID3D11DepthStencilView } sg_d3d11_pass_info; typedef struct sg_mtl_buffer_info { - void* buf[SG_NUM_INFLIGHT_FRAMES]; // id + const void* buf[SG_NUM_INFLIGHT_FRAMES]; // id int active_slot; } sg_mtl_buffer_info; typedef struct sg_mtl_image_info { - void* tex[SG_NUM_INFLIGHT_FRAMES]; // id + const void* tex[SG_NUM_INFLIGHT_FRAMES]; // id int active_slot; } sg_mtl_image_info; typedef struct sg_mtl_sampler_info { - void* smp; // id + const void* smp; // id } sg_mtl_sampler_info; typedef struct sg_mtl_shader_info { - void* vs_lib; // id - void* fs_lib; // id - void* vs_func; // id - void* fs_func; // id + const void* vs_lib; // id + const void* fs_lib; // id + const void* vs_func; // id + const void* fs_func; // id } sg_mtl_shader_info; typedef struct sg_mtl_pipeline_info { - void* rps; // id - void* dss; // id + const void* rps; // id + const void* dss; // id } sg_mtl_pipeline_info; typedef struct sg_wgpu_buffer_info { - void* buf; // WGPUBuffer + const void* buf; // WGPUBuffer } sg_wgpu_buffer_info; typedef struct sg_wgpu_image_info { - void* tex; // WGPUTexture - void* view; // WGPUTextureView + const void* tex; // WGPUTexture + const void* view; // WGPUTextureView } sg_wgpu_image_info; typedef struct sg_wgpu_sampler_info { - void* smp; // WGPUSampler + const void* smp; // WGPUSampler } sg_wgpu_sampler_info; typedef struct sg_wgpu_shader_info { - void* vs_mod; // WGPUShaderModule - void* fs_mod; // WGPUShaderModule - void* bgl; // WGPUBindGroupLayout; + const void* vs_mod; // WGPUShaderModule + const void* fs_mod; // WGPUShaderModule + const void* bgl; // WGPUBindGroupLayout; } sg_wgpu_shader_info; typedef struct sg_wgpu_pipeline_info { - void* pip; // WGPURenderPipeline + const void* pip; // WGPURenderPipeline } sg_wgpu_pipeline_info; typedef struct sg_wgpu_pass_info { - void* color_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView - void* resolve_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView - void* ds_view; // WGPUTextureView + const void* color_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView + const void* resolve_view[SG_MAX_COLOR_ATTACHMENTS]; // WGPUTextureView + const void* ds_view; // WGPUTextureView } sg_wgpu_pass_info; typedef struct sg_gl_buffer_info { @@ -18429,7 +18429,7 @@ SOKOL_API_IMPL sg_d3d11_buffer_info sg_d3d11_query_buffer_info(sg_buffer buf_id) #if defined(SOKOL_D3D11) const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); if (buf) { - res.buf = (void*) buf->d3d11.buf; + res.buf = (const void*) buf->d3d11.buf; } #else _SOKOL_UNUSED(buf_id); @@ -18444,10 +18444,10 @@ SOKOL_API_IMPL sg_d3d11_image_info sg_d3d11_query_image_info(sg_image img_id) { #if defined(SOKOL_D3D11) const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); if (img) { - res.tex2d = (void*) img->d3d11.tex2d; - res.tex3d = (void*) img->d3d11.tex3d; - res.res = (void*) img->d3d11.res; - res.srv = (void*) img->d3d11.srv; + res.tex2d = (const void*) img->d3d11.tex2d; + res.tex3d = (const void*) img->d3d11.tex3d; + res.res = (const void*) img->d3d11.res; + res.srv = (const void*) img->d3d11.srv; } #else _SOKOL_UNUSED(img_id); @@ -18462,7 +18462,7 @@ SOKOL_API_IMPL sg_d3d11_sampler_info sg_d3d11_query_sampler_info(sg_sampler smp_ #if defined(SOKOL_D3D11) const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); if (smp) { - res.smp = (void*) smp->d3d11.smp; + res.smp = (const void*) smp->d3d11.smp; } #else _SOKOL_UNUSED(smp_id); @@ -18478,11 +18478,11 @@ SOKOL_API_IMPL sg_d3d11_shader_info sg_d3d11_query_shader_info(sg_shader shd_id) const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); if (shd) { for (int i = 0; i < SG_MAX_SHADERSTAGE_UBS; i++) { - res.vs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_VS].cbufs[i]; - res.fs_cbufs[i] = (void*) shd->d3d11.stage[SG_SHADERSTAGE_FS].cbufs[i]; + res.vs_cbufs[i] = (const void*) shd->d3d11.stage[SG_SHADERSTAGE_VS].cbufs[i]; + res.fs_cbufs[i] = (const void*) shd->d3d11.stage[SG_SHADERSTAGE_FS].cbufs[i]; } - res.vs = (void*) shd->d3d11.vs; - res.fs = (void*) shd->d3d11.fs; + res.vs = (const void*) shd->d3d11.vs; + res.fs = (const void*) shd->d3d11.fs; } #else _SOKOL_UNUSED(shd_id); @@ -18497,10 +18497,10 @@ SOKOL_API_IMPL sg_d3d11_pipeline_info sg_d3d11_query_pipeline_info(sg_pipeline p #if defined(SOKOL_D3D11) const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); if (pip) { - res.il = pip->d3d11.il; - res.rs = pip->d3d11.rs; - res.dss = pip->d3d11.dss; - res.bs = pip->d3d11.bs; + res.il = (const void*) pip->d3d11.il; + res.rs = (const void*) pip->d3d11.rs; + res.dss = (const void*) pip->d3d11.dss; + res.bs = (const void*) pip->d3d11.bs; } #else _SOKOL_UNUSED(pip_id); @@ -18516,10 +18516,10 @@ SOKOL_API_IMPL sg_d3d11_pass_info sg_d3d11_query_pass_info(sg_pass pass_id) { const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); if (pass) { for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { - res.color_rtv[i] = pass->d3d11.color_atts[i].view.rtv; - res.resolve_rtv[i] = pass->d3d11.resolve_atts[i].view.rtv; + res.color_rtv[i] = (const void*) pass->d3d11.color_atts[i].view.rtv; + res.resolve_rtv[i] = (const void*) pass->d3d11.resolve_atts[i].view.rtv; } - res.dsv = pass->d3d11.ds_att.view.dsv; + res.dsv = (const void*) pass->d3d11.ds_att.view.dsv; } #else _SOKOL_UNUSED(pass_id); @@ -18660,7 +18660,7 @@ SOKOL_API_IMPL sg_mtl_pipeline_info sg_mtl_query_pipeline_info(sg_pipeline pip_i SOKOL_API_IMPL const void* sg_wgpu_device(void) { #if defined(SOKOL_WGPU) - return _sg.wgpu.dev; + return (const void*) _sg.wgpu.dev; #else return 0; #endif @@ -18668,7 +18668,7 @@ SOKOL_API_IMPL const void* sg_wgpu_device(void) { SOKOL_API_IMPL const void* sg_wgpu_queue(void) { #if defined(SOKOL_WGPU) - return _sg.wgpu.queue; + return (const void*) _sg.wgpu.queue; #else return 0; #endif @@ -18676,7 +18676,7 @@ SOKOL_API_IMPL const void* sg_wgpu_queue(void) { SOKOL_API_IMPL const void* sg_wgpu_command_encoder(void) { #if defined(SOKOL_WGPU) - return _sg.wgpu.cmd_enc; + return (const void*) _sg.wgpu.cmd_enc; #else return 0; #endif @@ -18684,7 +18684,7 @@ SOKOL_API_IMPL const void* sg_wgpu_command_encoder(void) { SOKOL_API_IMPL const void* sg_wgpu_render_pass_encoder(void) { #if defined(SOKOL_WGPU) - return _sg.wgpu.pass_enc; + return (const void*) _sg.wgpu.pass_enc; #else return 0; #endif @@ -18697,7 +18697,7 @@ SOKOL_API_IMPL sg_wgpu_buffer_info sg_wgpu_query_buffer_info(sg_buffer buf_id) { #if defined(SOKOL_WGPU) const _sg_buffer_t* buf = _sg_lookup_buffer(&_sg.pools, buf_id.id); if (buf) { - res.buf = (void*) buf->wgpu.buf; + res.buf = (const void*) buf->wgpu.buf; } #else _SOKOL_UNUSED(buf_id); @@ -18712,8 +18712,8 @@ SOKOL_API_IMPL sg_wgpu_image_info sg_wgpu_query_image_info(sg_image img_id) { #if defined(SOKOL_WGPU) const _sg_image_t* img = _sg_lookup_image(&_sg.pools, img_id.id); if (img) { - res.tex = (void*) img->wgpu.tex; - res.view = (void*) img->wgpu.view; + res.tex = (const void*) img->wgpu.tex; + res.view = (const void*) img->wgpu.view; } #else _SOKOL_UNUSED(img_id); @@ -18728,7 +18728,7 @@ SOKOL_API_IMPL sg_wgpu_sampler_info sg_wgpu_query_sampler_info(sg_sampler smp_id #if defined(SOKOL_WGPU) const _sg_sampler_t* smp = _sg_lookup_sampler(&_sg.pools, smp_id.id); if (smp) { - res.smp = (void*) smp->wgpu.smp; + res.smp = (const void*) smp->wgpu.smp; } #else _SOKOL_UNUSED(smp_id); @@ -18743,9 +18743,9 @@ SOKOL_API_IMPL sg_wgpu_shader_info sg_wgpu_query_shader_info(sg_shader shd_id) { #if defined(SOKOL_WGPU) const _sg_shader_t* shd = _sg_lookup_shader(&_sg.pools, shd_id.id); if (shd) { - res.vs_mod = (void*) shd->wgpu.stage[SG_SHADERSTAGE_VS].module; - res.fs_mod = (void*) shd->wgpu.stage[SG_SHADERSTAGE_FS].module; - res.bgl = (void*) shd->wgpu.bind_group_layout; + res.vs_mod = (const void*) shd->wgpu.stage[SG_SHADERSTAGE_VS].module; + res.fs_mod = (const void*) shd->wgpu.stage[SG_SHADERSTAGE_FS].module; + res.bgl = (const void*) shd->wgpu.bind_group_layout; } #else _SOKOL_UNUSED(shd_id); @@ -18760,7 +18760,7 @@ SOKOL_API_IMPL sg_wgpu_pipeline_info sg_wgpu_query_pipeline_info(sg_pipeline pip #if defined(SOKOL_WGPU) const _sg_pipeline_t* pip = _sg_lookup_pipeline(&_sg.pools, pip_id.id); if (pip) { - res.pip = (void*) pip->wgpu.pip; + res.pip = (const void*) pip->wgpu.pip; } #else _SOKOL_UNUSED(pip_id); @@ -18776,10 +18776,10 @@ SOKOL_API_IMPL sg_wgpu_pass_info sg_wgpu_query_pass_info(sg_pass pass_id) { const _sg_pass_t* pass = _sg_lookup_pass(&_sg.pools, pass_id.id); if (pass) { for (int i = 0; i < SG_MAX_COLOR_ATTACHMENTS; i++) { - res.color_view[i] = (void*) pass->wgpu.color_atts[i].view; - res.resolve_view[i] = (void*) pass->wgpu.resolve_atts[i].view; + res.color_view[i] = (const void*) pass->wgpu.color_atts[i].view; + res.resolve_view[i] = (const void*) pass->wgpu.resolve_atts[i].view; } - res.ds_view = (void*) pass->wgpu.ds_att.view; + res.ds_view = (const void*) pass->wgpu.ds_att.view; } #else _SOKOL_UNUSED(pass_id); From 4ee9094afe53d7966fa59abfbf6f2c0250f86158 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 19:36:41 +0100 Subject: [PATCH 285/292] sokol_gfx.h d3d11: remove fallback to create srv if only a texture is injected in sg_make_image (fixes #930) --- sokol_gfx.h | 98 ++++++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a1476e7b5..7c525f388 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -9972,10 +9972,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const if (img->d3d11.srv) { _sg_d3d11_AddRef(img->d3d11.srv); } - } - - if (0 == img->d3d11.tex2d) { - // if not injected, create texture + } else { + // if not injected, create 2D texture D3D11_TEXTURE2D_DESC d3d11_tex_desc; _sg_clear(&d3d11_tex_desc, sizeof(d3d11_tex_desc)); d3d11_tex_desc.Width = (UINT)img->cmn.width; @@ -10012,40 +10010,40 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const _SG_ERROR(D3D11_CREATE_2D_TEXTURE_FAILED); return SG_RESOURCESTATE_FAILED; } + + // create shader-resource-view for 2D texture + // FIXME: currently we don't support setting MSAA texture as shader resource + if (!msaa) { + D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; + _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); + d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); + switch (img->cmn.type) { + case SG_IMAGETYPE_2D: + d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + d3d11_srv_desc.Texture2D.MipLevels = (UINT)img->cmn.num_mipmaps; + break; + case SG_IMAGETYPE_CUBE: + d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; + d3d11_srv_desc.TextureCube.MipLevels = (UINT)img->cmn.num_mipmaps; + break; + case SG_IMAGETYPE_ARRAY: + d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; + d3d11_srv_desc.Texture2DArray.MipLevels = (UINT)img->cmn.num_mipmaps; + d3d11_srv_desc.Texture2DArray.ArraySize = (UINT)img->cmn.num_slices; + break; + default: + SOKOL_UNREACHABLE; break; + } + hr = _sg_d3d11_CreateShaderResourceView(_sg.d3d11.dev, (ID3D11Resource*)img->d3d11.tex2d, &d3d11_srv_desc, &img->d3d11.srv); + if (!(SUCCEEDED(hr) && img->d3d11.srv)) { + _SG_ERROR(D3D11_CREATE_2D_SRV_FAILED); + return SG_RESOURCESTATE_FAILED; + } + } } SOKOL_ASSERT(img->d3d11.tex2d); img->d3d11.res = (ID3D11Resource*)img->d3d11.tex2d; _sg_d3d11_AddRef(img->d3d11.res); - - // ...and similar, if not injected, create shader-resource-view - // FIXME: currently we don't support setting MSAA texture as shader resource - if ((0 == img->d3d11.srv) && !msaa) { - D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; - _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); - d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); - switch (img->cmn.type) { - case SG_IMAGETYPE_2D: - d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; - d3d11_srv_desc.Texture2D.MipLevels = (UINT)img->cmn.num_mipmaps; - break; - case SG_IMAGETYPE_CUBE: - d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; - d3d11_srv_desc.TextureCube.MipLevels = (UINT)img->cmn.num_mipmaps; - break; - case SG_IMAGETYPE_ARRAY: - d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; - d3d11_srv_desc.Texture2DArray.MipLevels = (UINT)img->cmn.num_mipmaps; - d3d11_srv_desc.Texture2DArray.ArraySize = (UINT)img->cmn.num_slices; - break; - default: - SOKOL_UNREACHABLE; break; - } - hr = _sg_d3d11_CreateShaderResourceView(_sg.d3d11.dev, img->d3d11.res, &d3d11_srv_desc, &img->d3d11.srv); - if (!(SUCCEEDED(hr) && img->d3d11.srv)) { - _SG_ERROR(D3D11_CREATE_2D_SRV_FAILED); - return SG_RESOURCESTATE_FAILED; - } - } } else { // 3D texture - same procedure, first check if injected, than create non-injected if (injected) { @@ -10061,9 +10059,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const if (img->d3d11.srv) { _sg_d3d11_AddRef(img->d3d11.srv); } - } - - if (0 == img->d3d11.tex3d) { + } else { + // not injected, create 3d texture D3D11_TEXTURE3D_DESC d3d11_tex_desc; _sg_clear(&d3d11_tex_desc, sizeof(d3d11_tex_desc)); d3d11_tex_desc.Width = (UINT)img->cmn.width; @@ -10089,23 +10086,24 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const _SG_ERROR(D3D11_CREATE_3D_TEXTURE_FAILED); return SG_RESOURCESTATE_FAILED; } + + // create shader-resource-view for 3D texture + if (!msaa) { + D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; + _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); + d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); + d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; + d3d11_srv_desc.Texture3D.MipLevels = (UINT)img->cmn.num_mipmaps; + hr = _sg_d3d11_CreateShaderResourceView(_sg.d3d11.dev, (ID3D11Resource*)img->d3d11.tex3d, &d3d11_srv_desc, &img->d3d11.srv); + if (!(SUCCEEDED(hr) && img->d3d11.srv)) { + _SG_ERROR(D3D11_CREATE_3D_SRV_FAILED); + return SG_RESOURCESTATE_FAILED; + } + } } SOKOL_ASSERT(img->d3d11.tex3d); img->d3d11.res = (ID3D11Resource*)img->d3d11.tex3d; _sg_d3d11_AddRef(img->d3d11.res); - - if ((0 == img->d3d11.srv) && !msaa) { - D3D11_SHADER_RESOURCE_VIEW_DESC d3d11_srv_desc; - _sg_clear(&d3d11_srv_desc, sizeof(d3d11_srv_desc)); - d3d11_srv_desc.Format = _sg_d3d11_srv_pixel_format(img->cmn.pixel_format); - d3d11_srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; - d3d11_srv_desc.Texture3D.MipLevels = (UINT)img->cmn.num_mipmaps; - hr = _sg_d3d11_CreateShaderResourceView(_sg.d3d11.dev, img->d3d11.res, &d3d11_srv_desc, &img->d3d11.srv); - if (!(SUCCEEDED(hr) && img->d3d11.srv)) { - _SG_ERROR(D3D11_CREATE_3D_SRV_FAILED); - return SG_RESOURCESTATE_FAILED; - } - } } return SG_RESOURCESTATE_VALID; } From 8708e7538b0ee34dbac7190ce01d7730fe0ab3a9 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 19:45:49 +0100 Subject: [PATCH 286/292] sokol_gfx.h: fix documentation for new texture injection rules --- sokol_gfx.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 7c525f388..a0480287f 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2529,15 +2529,16 @@ typedef struct sg_image_data { .mtl_textures[SG_NUM_INFLIGHT_FRAMES] .d3d11_texture .d3d11_shader_resource_view + .wgpu_texture + .wgpu_texture_view For GL, you can also specify the texture target or leave it empty to use the default texture target for the image type (GL_TEXTURE_2D for SG_IMAGETYPE_2D etc) - For D3D11, you can provide either a D3D11 texture, or a - shader-resource-view, or both. If only a texture is provided, a matching - shader-resource-view will be created. If only a shader-resource-view is - provided, the texture will be looked up from the shader-resource-view. + For D3D11 and WebGPU, either only provide a texture, or both a texture and + shader-resource-view / texture-view object. If you want to use access the + injected texture in a shader you *must* provide a shader-resource-view. The same rules apply as for injecting native buffers (see sg_buffer_desc documentation for more details). From 3da0fa69928ba968a487c794a8f622bce58cac26 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 19:50:55 +0100 Subject: [PATCH 287/292] sokol_gfx.h d3d11: same simpified/explicit texture/view injection rules as in wgpu --- sokol_gfx.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index a0480287f..5727cbc15 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -9941,7 +9941,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const SOKOL_ASSERT((0 == img->d3d11.tex2d) && (0 == img->d3d11.tex3d) && (0 == img->d3d11.res) && (0 == img->d3d11.srv)); HRESULT hr; - const bool injected = (0 != desc->d3d11_texture) || (0 != desc->d3d11_shader_resource_view); + const bool injected = (0 != desc->d3d11_texture); const bool msaa = (img->cmn.sample_count > 1); img->d3d11.format = _sg_d3d11_texture_pixel_format(img->cmn.pixel_format); if (img->d3d11.format == DXGI_FORMAT_UNKNOWN) { @@ -9960,16 +9960,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const // first check for injected texture and/or resource view if (injected) { img->d3d11.tex2d = (ID3D11Texture2D*) desc->d3d11_texture; + _sg_d3d11_AddRef(img->d3d11.tex2d); img->d3d11.srv = (ID3D11ShaderResourceView*) desc->d3d11_shader_resource_view; - if (img->d3d11.tex2d) { - _sg_d3d11_AddRef(img->d3d11.tex2d); - } else { - // if only a shader-resource-view was provided, but no texture, lookup - // the texture from the shader-resource-view, this also bumps the refcount - SOKOL_ASSERT(img->d3d11.srv); - _sg_d3d11_GetResource((ID3D11View*)img->d3d11.srv, (ID3D11Resource**)&img->d3d11.tex2d); - SOKOL_ASSERT(img->d3d11.tex2d); - } if (img->d3d11.srv) { _sg_d3d11_AddRef(img->d3d11.srv); } @@ -10049,14 +10041,8 @@ _SOKOL_PRIVATE sg_resource_state _sg_d3d11_create_image(_sg_image_t* img, const // 3D texture - same procedure, first check if injected, than create non-injected if (injected) { img->d3d11.tex3d = (ID3D11Texture3D*) desc->d3d11_texture; + _sg_d3d11_AddRef(img->d3d11.tex3d); img->d3d11.srv = (ID3D11ShaderResourceView*) desc->d3d11_shader_resource_view; - if (img->d3d11.tex3d) { - _sg_d3d11_AddRef(img->d3d11.tex3d); - } else { - SOKOL_ASSERT(img->d3d11.srv); - _sg_d3d11_GetResource((ID3D11View*)img->d3d11.srv, (ID3D11Resource**)&img->d3d11.tex3d); - SOKOL_ASSERT(img->d3d11.tex3d); - } if (img->d3d11.srv) { _sg_d3d11_AddRef(img->d3d11.srv); } From abe16f841b3dad2f2ba541504e4c43809fad4ff4 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 20:03:13 +0100 Subject: [PATCH 288/292] update changelog --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d0865e6..8f28f7c90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ ## Updates +#### 30-Oct-2023 + +Some sokol_gfx.h backend-specific updates and tweaks (very minor chance that this is breaking): + +- a new set of public API functions to access the native backend 3D-API resource objects of + sokol-gfx resource objects: + + ``` + sg_[api]_[type]_info sg_[api]_query_[type]_info(sg_[type]) + ``` + ...where `[api]` is any of `[gl, d3d11, mtl, wgpu]` and `[type]` is any of `[buffer, image, sampler, shader, pipeline, pass]`. + + This is mainly useful when mixing native 3D-API code with sokol-gfx code. + + See issue https://github.com/floooh/sokol/issues/931 for details. + +- WebGPU backend: `sg_make_image()` will no longer automatically create a WebGPU texture-view object when injecting a WebGPU texture object, instead +this must now be explicitly provided. + +- D3D11 backend: `sg_make_image()` will no longer automatically create a +shader-resource-view object when injecting a D3D11 texture object, and +vice versa, a texture object will no longer be looked up from an injected +shader-resource-view object (e.g. the injection rules are now more straightforward and explicit). See issue https://github.com/floooh/sokol/issues/930 for details. + +For the detailed changes, see PR https://github.com/floooh/sokol/pull/932. + #### 27-Oct-2023 Fix broken render-to-mipmap in the sokol_gfx.h GL backend. From fbcb001266c0f3686c5e16ef47bfb8d066102be1 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 30 Oct 2023 20:19:56 +0100 Subject: [PATCH 289/292] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f28f7c90..eb4767c34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### 30-Oct-2023 -Some sokol_gfx.h backend-specific updates and tweaks (very minor chance that this is breaking): +Some sokol_gfx.h backend-specific updates and tweaks (very minor chance that this is breaking if you are injecting textures into the D3D11 backend). - a new set of public API functions to access the native backend 3D-API resource objects of sokol-gfx resource objects: From 1ad3eda2267de91d29978d5c3f5127d5e77ff10a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 6 Nov 2023 16:16:45 +0100 Subject: [PATCH 290/292] sokol_gfx.h d3d11: fix depth-stencil pixel format problems - SG_PIXELFORMAT_DEPTH_STENCIL is now reported as renderable in sg_query_pixelformat() - depth-stencil textures are now created as DXGI_FORMAT_R24G8_TYPELESS - depth-stencil SRVs are now created as DXGI_FORMAT_R24_UNORM_X8_TYPELESS - depth-stencil DSVs are created as DXGI_FORMAT_D24_UNORM_S8_UINT --- sokol_gfx.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 5727cbc15..1df4009e5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -9554,7 +9554,7 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_texture_pixel_format(sg_pixel_format fmt) { case SG_PIXELFORMAT_RGBA32SI: return DXGI_FORMAT_R32G32B32A32_SINT; case SG_PIXELFORMAT_RGBA32F: return DXGI_FORMAT_R32G32B32A32_FLOAT; case SG_PIXELFORMAT_DEPTH: return DXGI_FORMAT_R32_TYPELESS; - case SG_PIXELFORMAT_DEPTH_STENCIL: return DXGI_FORMAT_D24_UNORM_S8_UINT; + case SG_PIXELFORMAT_DEPTH_STENCIL: return DXGI_FORMAT_R24G8_TYPELESS; case SG_PIXELFORMAT_BC1_RGBA: return DXGI_FORMAT_BC1_UNORM; case SG_PIXELFORMAT_BC2_RGBA: return DXGI_FORMAT_BC2_UNORM; case SG_PIXELFORMAT_BC3_RGBA: return DXGI_FORMAT_BC3_UNORM; @@ -9572,6 +9572,8 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_texture_pixel_format(sg_pixel_format fmt) { _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_srv_pixel_format(sg_pixel_format fmt) { if (fmt == SG_PIXELFORMAT_DEPTH) { return DXGI_FORMAT_R32_FLOAT; + } else if (fmt == SG_PIXELFORMAT_DEPTH_STENCIL) { + return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; } else { return _sg_d3d11_texture_pixel_format(fmt); } @@ -9580,6 +9582,8 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_srv_pixel_format(sg_pixel_format fmt) { _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_dsv_pixel_format(sg_pixel_format fmt) { if (fmt == SG_PIXELFORMAT_DEPTH) { return DXGI_FORMAT_D32_FLOAT; + } else if (fmt == SG_PIXELFORMAT_DEPTH_STENCIL) { + return DXGI_FORMAT_D24_UNORM_S8_UINT; } else { return _sg_d3d11_texture_pixel_format(fmt); } @@ -9588,6 +9592,8 @@ _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_dsv_pixel_format(sg_pixel_format fmt) { _SOKOL_PRIVATE DXGI_FORMAT _sg_d3d11_rtv_pixel_format(sg_pixel_format fmt) { if (fmt == SG_PIXELFORMAT_DEPTH) { return DXGI_FORMAT_R32_FLOAT; + } else if (fmt == SG_PIXELFORMAT_DEPTH_STENCIL) { + return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; } else { return _sg_d3d11_texture_pixel_format(fmt); } @@ -9811,12 +9817,14 @@ _SOKOL_PRIVATE void _sg_d3d11_init_caps(void) { const UINT rtv_dxgi_fmt_caps = _sg_d3d11_dxgi_fmt_caps(_sg_d3d11_rtv_pixel_format((sg_pixel_format)fmt)); const UINT dsv_dxgi_fmt_caps = _sg_d3d11_dxgi_fmt_caps(_sg_d3d11_dsv_pixel_format((sg_pixel_format)fmt)); sg_pixelformat_info* info = &_sg.formats[fmt]; + const bool render = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_RENDER_TARGET); + const bool depth = 0 != (dsv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL); info->sample = 0 != (srv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_TEXTURE2D); info->filter = 0 != (srv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE); - info->render = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_RENDER_TARGET); + info->render = render || depth; info->blend = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_BLENDABLE); info->msaa = 0 != (rtv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET); - info->depth = 0 != (dsv_dxgi_fmt_caps & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL); + info->depth = depth; } } From 0a51374797e03424565d25d34ef58e09e56ddb6d Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 6 Nov 2023 16:37:08 +0100 Subject: [PATCH 291/292] update changelog (d3d11 depth-stencil image fix) --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4767c34..07dfb9dd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ ## Updates +#### 06-Nov-2023 + +A bugfix in the sokol_gfx.h D3D11 backend, and some related cleanup when creating depth-stencil +render target images and resource views: + +- fixed: render target images with format SG_PIXELFORMAT_DEPTH_STENCIL triggered a validation + error because the pixel format capabilities code marked them as non-renderable. Now + the SG_PIXELFORMAT_DEPTH_STENCIL pixel format is properly reported as renderable. +- the DXGIFormats for SG_PIXELFORMAT_DEPTH_STENCIL images are now as follows: + - D3D11 texture object: DXGI_FORMAT_R24G8_TYPELESS + - D3D11 shader-resource-view object: DXGI_FORMAT_R24_UNORM_X8_TYPELESS + - D3D11 depth-stencil-view object: DXGI_FORMAT_D24_UNORM_S8_UINT + #### 30-Oct-2023 Some sokol_gfx.h backend-specific updates and tweaks (very minor chance that this is breaking if you are injecting textures into the D3D11 backend). From 3315fcd4c149a5b700bc1698f074ccd5e2ab0366 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 6 Nov 2023 16:46:38 +0100 Subject: [PATCH 292/292] add PR link to latest changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07dfb9dd3..0c0beb25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ render target images and resource views: - D3D11 shader-resource-view object: DXGI_FORMAT_R24_UNORM_X8_TYPELESS - D3D11 depth-stencil-view object: DXGI_FORMAT_D24_UNORM_S8_UINT +Related PR: https://github.com/floooh/sokol/pull/937 + #### 30-Oct-2023 Some sokol_gfx.h backend-specific updates and tweaks (very minor chance that this is breaking if you are injecting textures into the D3D11 backend).