aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md15
-rw-r--r--tests/compile/sokol_gfx_imgui.c5
-rw-r--r--tests/compile/sokol_gfx_imgui.cc5
-rw-r--r--util/sokol_gfx_imgui.h2271
4 files changed, 1168 insertions, 1128 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78851c06..5a9ca88a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
## Updates
+### 05-Dec-2025
+
+- sokol_gfx_imgui.h: a breaking update to harmonize the API with the other sokol
+ headers, and make the sokol_gfx_imgui.h header more language-binding-friendly:
+ - all 'internal state' structs have been moved from the public API into the
+ private implementation block
+ - the 'context arg' has been removed from the public API functions
+ - `sgimgui_init()` has been renamed to `sgimgui_setup()`
+ - `sgimgui_discard()` has been renamed to `sgimgui_shutdown()`
+ - optional functions to draw inidividual menu items have been added
+ (as alternative to the all-in-one `sgimgui_draw_menu()`)
+ - the optional window drawing functions now take a `title` argument
+
+ PR: https://github.com/floooh/sokol/pull/1394
+
### 04-Dev-2025
- sokol_gfx.h: a minor breaking change for querying runtime statistics: the function
diff --git a/tests/compile/sokol_gfx_imgui.c b/tests/compile/sokol_gfx_imgui.c
index be9fe9b1..b523f135 100644
--- a/tests/compile/sokol_gfx_imgui.c
+++ b/tests/compile/sokol_gfx_imgui.c
@@ -10,7 +10,6 @@
#include "sokol_gfx_imgui.h"
void use_gfx_imgui_impl(void) {
- sgimgui_t ctx = {0};
- sgimgui_init(&ctx, &(sgimgui_desc_t){0});
- sgimgui_discard(&ctx);
+ sgimgui_setup(&(sgimgui_desc_t){0});
+ sgimgui_shutdown();
}
diff --git a/tests/compile/sokol_gfx_imgui.cc b/tests/compile/sokol_gfx_imgui.cc
index 2e64dbcf..ecef9d12 100644
--- a/tests/compile/sokol_gfx_imgui.cc
+++ b/tests/compile/sokol_gfx_imgui.cc
@@ -6,7 +6,6 @@
#include "sokol_gfx_imgui.h"
void use_gfx_imgui_impl() {
- sgimgui_t ctx = {};
- sgimgui_init(&ctx, { });
- sgimgui_discard(&ctx);
+ sgimgui_setup({ });
+ sgimgui_shutdown();
}
diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h
index b7c998e2..ed363143 100644
--- a/util/sokol_gfx_imgui.h
+++ b/util/sokol_gfx_imgui.h
@@ -60,19 +60,9 @@
STEP BY STEP:
=============
- --- create an sgimgui_t struct (which must be preserved between frames)
- and initialize it with:
+ --- call sgimgui_init() with optional allocator overrides:
- sgimgui_init(&sgimgui, &(sgimgui_desc_t){ 0 });
-
- Note that from C++ you can't inline the desc structure initialization:
-
- const sgimgui_desc_t desc = { };
- sgimgui_init(&sgimgui, &desc);
-
- Provide optional memory allocator override functions (compatible with malloc/free) like this:
-
- sgimgui_init(&sgimgui, &(sgimgui_desc_t){
+ sgimgui_init(&(sgimgui_desc_t){
.allocator = {
.alloc_fn = my_malloc,
.free_fn = my_free,
@@ -81,50 +71,36 @@
--- somewhere in the per-frame code call:
- sgimgui_draw(&sgimgui)
+ sgimgui_draw()
this won't draw anything yet, since no windows are open.
--- call the convenience function sgimgui_draw_menu(ctx, title)
to render a menu which allows to open/close the provided debug windows
- sgimgui_draw_menu(&sgimgui, "sokol-gfx");
-
- --- alternative, open and close windows directly by setting the following public
- booleans in the sgimgui_t struct:
-
- sgimgui.caps_window.open = true;
- sgimgui.frame_stats_window.open = true;
- sgimgui.buffer_window.open = true;
- sgimgui.image_window.open = true;
- sgimgui.sampler_window.open = true;
- sgimgui.shader_window.open = true;
- sgimgui.pipeline_window.open = true;
- sgimgui.view_window.open = true;
- sgimgui.capture_window.open = true;
- sgimgui.frame_stats_window.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, &sgimgui.caps_window.open);
- ImGui::MenuItem("Frame Stats", 0, &sgimgui.frame_stats_window.open);
- ImGui::MenuItem("Buffers", 0, &sgimgui.buffer_window.open);
- ImGui::MenuItem("Images", 0, &sgimgui.image_window.open);
- ImGui::MenuItem("Samplers", 0, &sgimgui.sampler_window.open);
- ImGui::MenuItem("Shaders", 0, &sgimgui.shader_window.open);
- ImGui::MenuItem("Pipelines", 0, &sgimgui.pipeline_window.open);
- ImGui::MenuItem("Views", 0, &sgimgui.view_window.open);
- ImGui::MenuItem("Calls", 0, &sgimgui.capture_window.open);
- ImGui::EndMenu();
- }
- ImGui::EndMainMenuBar();
+ sgimgui_draw_menu("sokol-gfx");
+
+ --- alternatively the individual single menu items via:
+
+ if (ImGui::BeginMainMenuBar()) {
+ if (ImGui::BeginMenu("sokol-gfx")) {
+ sgimgui_draw_buffer_window_menu_item("Buffers");
+ sgimgui_draw_image_window_menu_item("Images");
+ sgimgui_draw_sampler_window_menu_item("Samplers");
+ sgimgui_draw_shader_window_menu_item("Shaders");
+ sgimgui_draw_pipeline_window_menu_item("Pipelines");
+ sgimgui_draw_view_window_menu_item("Views");
+ sgimgui_draw_capture_window_menu_item("Calls");
+ sgimgui_draw_capabilities_window_menu_item("Capabilities");
+ sgimgui_draw_frame_stats_window_menu_item("Frame Stats");
+ ImGui::EndMenu();
}
+ ImGui::EndMainMenuBar();
+ }
--- before application shutdown, call:
- sgimgui_discard(&sgimgui);
+ sgimgui_discard();
...this is not strictly necessary because the application exits
anyway, but not doing this may trigger memory leak detection tools.
@@ -134,62 +110,38 @@
ALTERNATIVE DRAWING FUNCTIONS:
==============================
- Instead of the convenient, but all-in-one sgimgui_draw() function,
+ Instead of the convenient but all-in-one sgimgui_draw() function,
you can also use the following granular functions which might allow
better integration with your existing UI:
The following functions only render the window *content* (so you
can integrate the UI into you own windows):
- void sgimgui_draw_buffer_window_content(sgimgui_t* ctx);
- void sgimgui_draw_image_window_content(sgimgui_t* ctx);
- void sgimgui_draw_sampler_window_content(sgimgui_t* ctx);
- void sgimgui_draw_shader_window_content(sgimgui_t* ctx);
- void sgimgui_draw_pipeline_window_content(sgimgui_t* ctx);
- void sgimgui_draw_view_window_content(sgimgui_t* ctx);
- void sgimgui_draw_capture_window_content(sgimgui_t* ctx);
+ void sgimgui_draw_buffer_window_content();
+ void sgimgui_draw_image_window_content();
+ void sgimgui_draw_sampler_window_content();
+ void sgimgui_draw_shader_window_content();
+ void sgimgui_draw_pipeline_window_content();
+ void sgimgui_draw_view_window_content();
+ void sgimgui_draw_capture_window_content();
+ void sgimgui_draw_capabilities_window_content();
+ void sgimgui_draw_frame_stats_window_content();
And these are the 'full window' drawing functions:
- void sgimgui_draw_buffer_window(sgimgui_t* ctx);
- void sgimgui_draw_image_window(sgimgui_t* ctx);
- void sgimgui_draw_sampler_window(sgimgui_t* ctx);
- void sgimgui_draw_shader_window(sgimgui_t* ctx);
- void sgimgui_draw_pipeline_window(sgimgui_t* ctx);
- void sgimgui_draw_view_window(sgimgui_t* ctx);
- void sgimgui_draw_capture_window(sgimgui_t* ctx);
+ void sgimgui_draw_buffer_window("Buffers");
+ void sgimgui_draw_image_window("Images");
+ void sgimgui_draw_sampler_window("Samplers");
+ void sgimgui_draw_shader_window("Shaders");
+ void sgimgui_draw_pipeline_window("Pipelines");
+ void sgimgui_draw_view_window("Views");
+ void sgimgui_draw_capture_window("Frame Capture");
+ void sgimgui_draw_capabilities_window("Capabilities");
+ void sgimgui_draw_frame_stats_window("Frame Stats");
Finer-grained drawing functions may be moved to the public API
in the future as needed.
- 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);
- }
-
- ...
- sgimgui_init(&(&ctx, &(sgimgui_desc_t){
- // ...
- .allocator = {
- .alloc_fn = my_alloc,
- .free_fn = my_free,
- .user_data = ...;
- }
- });
- ...
-
- This only affects memory allocation calls done by sokol_gfx_imgui.h
- itself though, not any allocations in OS libraries.
-
-
LICENSE
=======
zlib/libpng license
@@ -241,606 +193,620 @@
extern "C" {
#endif
-#define sgimgui_STRBUF_LEN (96)
+/*
+ sgimgui_allocator_t
+
+ Used in sgimgui_desc_t to provide custom memory-alloc and -free functions
+ to sokol_gfx_imgui.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 sgimgui_allocator_t {
+ void* (*alloc_fn)(size_t size, void* user_data);
+ void (*free_fn)(void* ptr, void* user_data);
+ void* user_data;
+} sgimgui_allocator_t;
+
+/*
+ sgimgui_desc_t
+
+ Initialization options for sgimgui_init().
+*/
+typedef struct sgimgui_desc_t {
+ sgimgui_allocator_t allocator; // optional memory allocation overrides (default: malloc/free)
+} sgimgui_desc_t;
+
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_setup(const sgimgui_desc_t* desc);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_shutdown(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_menu(const char* title);
+
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_buffer_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_image_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_sampler_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_shader_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_pipeline_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_view_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capture_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capabilities_window_content(void);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_frame_stats_window_content(void);
+
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_buffer_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_image_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_sampler_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_shader_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_pipeline_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_view_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capture_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capabilities_window(const char* title);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_frame_stats_window(const char* title);
+
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_buffer_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_image_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_sampler_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_shader_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_pipeline_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_view_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capture_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capabilities_menu_item(const char* label);
+SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_frame_stats_menu_item(const char* label);
+
+#if defined(__cplusplus)
+} // extern "C"
+
+// reference-based equivalents for c++
+inline void sgimgui_setup(const sgimgui_desc_t& desc) { return sgimgui_setup(&desc); }
+
+#endif
+#endif /* SOKOL_GFX_IMGUI_INCLUDED */
+
+/*=== IMPLEMENTATION =========================================================*/
+#ifdef SOKOL_GFX_IMGUI_IMPL
+#define SOKOL_GFX_IMGUI_IMPL_INCLUDED (1)
+
+#if defined(SOKOL_MALLOC) || defined(SOKOL_CALLOC) || defined(SOKOL_FREE)
+#error "SOKOL_MALLOC/CALLOC/FREE macros are no longer supported, please use sgimgui_desc_t.allocator to override memory allocation functions"
+#endif
+
+#if defined(__cplusplus)
+ #if !defined(IMGUI_VERSION)
+ #error "Please include imgui.h before the sokol_imgui.h implementation"
+ #endif
+#else
+ #if !defined(CIMGUI_API)
+ #error "Please include cimgui.h before the sokol_imgui.h implementation"
+ #endif
+#endif
+#ifndef SOKOL_ASSERT
+ #include <assert.h>
+ #define SOKOL_ASSERT(c) assert(c)
+#endif
+#ifndef SOKOL_UNREACHABLE
+ #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
+#endif
+#ifndef _SOKOL_PRIVATE
+ #if defined(__GNUC__) || defined(__clang__)
+ #define _SOKOL_PRIVATE __attribute__((unused)) static
+ #else
+ #define _SOKOL_PRIVATE static
+ #endif
+#endif
+#ifndef _SOKOL_UNUSED
+#define _SOKOL_UNUSED(x) (void)(x)
+#endif
+#ifndef SOKOL_API_IMPL
+#define SOKOL_API_IMPL
+#endif
+
+#include <string.h>
+#include <stdio.h> // snprintf
+#include <stdlib.h> // malloc, free
+
+#define _SGIMGUI_STRBUF_LEN (96)
/* max number of captured calls per frame */
-#define sgimgui_MAX_FRAMECAPTURE_ITEMS (4096)
+#define _SGIMGUI_MAX_FRAMECAPTURE_ITEMS (4096)
-typedef struct sgimgui_str_t {
- char buf[sgimgui_STRBUF_LEN];
-} sgimgui_str_t;
+typedef struct {
+ char buf[_SGIMGUI_STRBUF_LEN];
+} _sgimgui_str_t;
-typedef struct sgimgui_buffer_t {
+typedef struct {
sg_buffer res_id;
- sgimgui_str_t label;
+ _sgimgui_str_t label;
sg_buffer_desc desc;
-} sgimgui_buffer_t;
+} _sgimgui_buffer_t;
-typedef struct sgimgui_image_t {
+typedef struct {
sg_image res_id;
float ui_scale;
- sgimgui_str_t label;
+ _sgimgui_str_t label;
sg_image_desc desc;
-} sgimgui_image_t;
+} _sgimgui_image_t;
-typedef struct sgimgui_sampler_t {
+typedef struct {
sg_sampler res_id;
- sgimgui_str_t label;
+ _sgimgui_str_t label;
sg_sampler_desc desc;
-} sgimgui_sampler_t;
+} _sgimgui_sampler_t;
-typedef struct sgimgui_shader_t {
+typedef struct {
sg_shader res_id;
- sgimgui_str_t label;
- sgimgui_str_t vs_entry;
- sgimgui_str_t vs_d3d11_target;
- sgimgui_str_t fs_entry;
- sgimgui_str_t fs_d3d11_target;
- sgimgui_str_t glsl_texture_sampler_name[SG_MAX_TEXTURE_SAMPLER_PAIRS];
- sgimgui_str_t glsl_uniform_name[SG_MAX_UNIFORMBLOCK_BINDSLOTS][SG_MAX_UNIFORMBLOCK_MEMBERS];
- sgimgui_str_t attr_glsl_name[SG_MAX_VERTEX_ATTRIBUTES];
- sgimgui_str_t attr_hlsl_sem_name[SG_MAX_VERTEX_ATTRIBUTES];
+ _sgimgui_str_t label;
+ _sgimgui_str_t vs_entry;
+ _sgimgui_str_t vs_d3d11_target;
+ _sgimgui_str_t fs_entry;
+ _sgimgui_str_t fs_d3d11_target;
+ _sgimgui_str_t glsl_texture_sampler_name[SG_MAX_TEXTURE_SAMPLER_PAIRS];
+ _sgimgui_str_t glsl_uniform_name[SG_MAX_UNIFORMBLOCK_BINDSLOTS][SG_MAX_UNIFORMBLOCK_MEMBERS];
+ _sgimgui_str_t attr_glsl_name[SG_MAX_VERTEX_ATTRIBUTES];
+ _sgimgui_str_t attr_hlsl_sem_name[SG_MAX_VERTEX_ATTRIBUTES];
sg_shader_desc desc;
-} sgimgui_shader_t;
+} _sgimgui_shader_t;
-typedef struct sgimgui_pipeline_t {
+typedef struct {
sg_pipeline res_id;
- sgimgui_str_t label;
+ _sgimgui_str_t label;
sg_pipeline_desc desc;
-} sgimgui_pipeline_t;
+} _sgimgui_pipeline_t;
-typedef struct sgimgui_view_t {
+typedef struct {
sg_view res_id;
float ui_scale;
- sgimgui_str_t label;
+ _sgimgui_str_t label;
sg_view_desc desc;
-} sgimgui_view_t;
+} _sgimgui_view_t;
-typedef struct sgimgui_buffer_window_t {
+typedef struct {
bool open;
sg_buffer sel_buf;
int num_slots;
- sgimgui_buffer_t* slots;
-} sgimgui_buffer_window_t;
+ _sgimgui_buffer_t* slots;
+} _sgimgui_buffer_window_t;
-typedef struct sgimgui_image_window_t {
+typedef struct {
bool open;
sg_image sel_img;
int num_slots;
- sgimgui_image_t* slots;
-} sgimgui_image_window_t;
+ _sgimgui_image_t* slots;
+} _sgimgui_image_window_t;
-typedef struct sgimgui_sampler_window_t {
+typedef struct {
bool open;
sg_sampler sel_smp;
int num_slots;
- sgimgui_sampler_t* slots;
-} sgimgui_sampler_window_t;
+ _sgimgui_sampler_t* slots;
+} _sgimgui_sampler_window_t;
-typedef struct sgimgui_shader_window_t {
+typedef struct {
bool open;
sg_shader sel_shd;
int num_slots;
- sgimgui_shader_t* slots;
-} sgimgui_shader_window_t;
+ _sgimgui_shader_t* slots;
+} _sgimgui_shader_window_t;
-typedef struct sgimgui_pipeline_window_t {
+typedef struct {
bool open;
sg_pipeline sel_pip;
int num_slots;
- sgimgui_pipeline_t* slots;
-} sgimgui_pipeline_window_t;
+ _sgimgui_pipeline_t* slots;
+} _sgimgui_pipeline_window_t;
-typedef struct sgimgui_view_window_t {
+typedef struct {
bool open;
sg_view sel_view;
int num_slots;
- sgimgui_view_t* slots;
-} sgimgui_view_window_t;
-
-typedef enum sgimgui_cmd_t {
- SGIMGUI_CMD_INVALID,
- SGIMGUI_CMD_RESET_STATE_CACHE,
- SGIMGUI_CMD_MAKE_BUFFER,
- SGIMGUI_CMD_MAKE_IMAGE,
- SGIMGUI_CMD_MAKE_SAMPLER,
- SGIMGUI_CMD_MAKE_SHADER,
- SGIMGUI_CMD_MAKE_PIPELINE,
- SGIMGUI_CMD_MAKE_VIEW,
- SGIMGUI_CMD_DESTROY_BUFFER,
- SGIMGUI_CMD_DESTROY_IMAGE,
- SGIMGUI_CMD_DESTROY_SAMPLER,
- SGIMGUI_CMD_DESTROY_SHADER,
- SGIMGUI_CMD_DESTROY_PIPELINE,
- SGIMGUI_CMD_DESTROY_VIEW,
- SGIMGUI_CMD_UPDATE_BUFFER,
- SGIMGUI_CMD_UPDATE_IMAGE,
- SGIMGUI_CMD_APPEND_BUFFER,
- SGIMGUI_CMD_BEGIN_PASS,
- SGIMGUI_CMD_APPLY_VIEWPORT,
- SGIMGUI_CMD_APPLY_SCISSOR_RECT,
- SGIMGUI_CMD_APPLY_PIPELINE,
- SGIMGUI_CMD_APPLY_BINDINGS,
- SGIMGUI_CMD_APPLY_UNIFORMS,
- SGIMGUI_CMD_DRAW,
- SGIMGUI_CMD_DRAW_EX,
- SGIMGUI_CMD_DISPATCH,
- SGIMGUI_CMD_END_PASS,
- SGIMGUI_CMD_COMMIT,
- SGIMGUI_CMD_ALLOC_BUFFER,
- SGIMGUI_CMD_ALLOC_IMAGE,
- SGIMGUI_CMD_ALLOC_SAMPLER,
- SGIMGUI_CMD_ALLOC_SHADER,
- SGIMGUI_CMD_ALLOC_PIPELINE,
- SGIMGUI_CMD_ALLOC_VIEW,
- SGIMGUI_CMD_DEALLOC_BUFFER,
- SGIMGUI_CMD_DEALLOC_IMAGE,
- SGIMGUI_CMD_DEALLOC_SAMPLER,
- SGIMGUI_CMD_DEALLOC_SHADER,
- SGIMGUI_CMD_DEALLOC_PIPELINE,
- SGIMGUI_CMD_DEALLOC_VIEW,
- SGIMGUI_CMD_INIT_BUFFER,
- SGIMGUI_CMD_INIT_IMAGE,
- SGIMGUI_CMD_INIT_SAMPLER,
- SGIMGUI_CMD_INIT_SHADER,
- SGIMGUI_CMD_INIT_PIPELINE,
- SGIMGUI_CMD_INIT_VIEW,
- SGIMGUI_CMD_UNINIT_BUFFER,
- SGIMGUI_CMD_UNINIT_IMAGE,
- SGIMGUI_CMD_UNINIT_SAMPLER,
- SGIMGUI_CMD_UNINIT_SHADER,
- SGIMGUI_CMD_UNINIT_PIPELINE,
- SGIMGUI_CMD_UNINIT_VIEW,
- SGIMGUI_CMD_FAIL_BUFFER,
- SGIMGUI_CMD_FAIL_IMAGE,
- SGIMGUI_CMD_FAIL_SAMPLER,
- SGIMGUI_CMD_FAIL_SHADER,
- SGIMGUI_CMD_FAIL_PIPELINE,
- SGIMGUI_CMD_FAIL_VIEW,
- SGIMGUI_CMD_PUSH_DEBUG_GROUP,
- SGIMGUI_CMD_POP_DEBUG_GROUP,
-} sgimgui_cmd_t;
-
-typedef struct sgimgui_args_make_buffer_t {
+ _sgimgui_view_t* slots;
+} _sgimgui_view_window_t;
+
+typedef enum {
+ _SGIMGUI_CMD_INVALID,
+ _SGIMGUI_CMD_RESET_STATE_CACHE,
+ _SGIMGUI_CMD_MAKE_BUFFER,
+ _SGIMGUI_CMD_MAKE_IMAGE,
+ _SGIMGUI_CMD_MAKE_SAMPLER,
+ _SGIMGUI_CMD_MAKE_SHADER,
+ _SGIMGUI_CMD_MAKE_PIPELINE,
+ _SGIMGUI_CMD_MAKE_VIEW,
+ _SGIMGUI_CMD_DESTROY_BUFFER,
+ _SGIMGUI_CMD_DESTROY_IMAGE,
+ _SGIMGUI_CMD_DESTROY_SAMPLER,
+ _SGIMGUI_CMD_DESTROY_SHADER,
+ _SGIMGUI_CMD_DESTROY_PIPELINE,
+ _SGIMGUI_CMD_DESTROY_VIEW,
+ _SGIMGUI_CMD_UPDATE_BUFFER,
+ _SGIMGUI_CMD_UPDATE_IMAGE,
+ _SGIMGUI_CMD_APPEND_BUFFER,
+ _SGIMGUI_CMD_BEGIN_PASS,
+ _SGIMGUI_CMD_APPLY_VIEWPORT,
+ _SGIMGUI_CMD_APPLY_SCISSOR_RECT,
+ _SGIMGUI_CMD_APPLY_PIPELINE,
+ _SGIMGUI_CMD_APPLY_BINDINGS,
+ _SGIMGUI_CMD_APPLY_UNIFORMS,
+ _SGIMGUI_CMD_DRAW,
+ _SGIMGUI_CMD_DRAW_EX,
+ _SGIMGUI_CMD_DISPATCH,
+ _SGIMGUI_CMD_END_PASS,
+ _SGIMGUI_CMD_COMMIT,
+ _SGIMGUI_CMD_ALLOC_BUFFER,
+ _SGIMGUI_CMD_ALLOC_IMAGE,
+ _SGIMGUI_CMD_ALLOC_SAMPLER,
+ _SGIMGUI_CMD_ALLOC_SHADER,
+ _SGIMGUI_CMD_ALLOC_PIPELINE,
+ _SGIMGUI_CMD_ALLOC_VIEW,
+ _SGIMGUI_CMD_DEALLOC_BUFFER,
+ _SGIMGUI_CMD_DEALLOC_IMAGE,
+ _SGIMGUI_CMD_DEALLOC_SAMPLER,
+ _SGIMGUI_CMD_DEALLOC_SHADER,
+ _SGIMGUI_CMD_DEALLOC_PIPELINE,
+ _SGIMGUI_CMD_DEALLOC_VIEW,
+ _SGIMGUI_CMD_INIT_BUFFER,
+ _SGIMGUI_CMD_INIT_IMAGE,
+ _SGIMGUI_CMD_INIT_SAMPLER,
+ _SGIMGUI_CMD_INIT_SHADER,
+ _SGIMGUI_CMD_INIT_PIPELINE,
+ _SGIMGUI_CMD_INIT_VIEW,
+ _SGIMGUI_CMD_UNINIT_BUFFER,
+ _SGIMGUI_CMD_UNINIT_IMAGE,
+ _SGIMGUI_CMD_UNINIT_SAMPLER,
+ _SGIMGUI_CMD_UNINIT_SHADER,
+ _SGIMGUI_CMD_UNINIT_PIPELINE,
+ _SGIMGUI_CMD_UNINIT_VIEW,
+ _SGIMGUI_CMD_FAIL_BUFFER,
+ _SGIMGUI_CMD_FAIL_IMAGE,
+ _SGIMGUI_CMD_FAIL_SAMPLER,
+ _SGIMGUI_CMD_FAIL_SHADER,
+ _SGIMGUI_CMD_FAIL_PIPELINE,
+ _SGIMGUI_CMD_FAIL_VIEW,
+ _SGIMGUI_CMD_PUSH_DEBUG_GROUP,
+ _SGIMGUI_CMD_POP_DEBUG_GROUP,
+} _sgimgui_cmd_t;
+
+typedef struct {
sg_buffer result;
-} sgimgui_args_make_buffer_t;
+} _sgimgui_args_make_buffer_t;
-typedef struct sgimgui_args_make_image_t {
+typedef struct {
sg_image result;
-} sgimgui_args_make_image_t;
+} _sgimgui_args_make_image_t;
-typedef struct sgimgui_args_make_sampler_t {
+typedef struct {
sg_sampler result;
-} sgimgui_args_make_sampler_t;
+} _sgimgui_args_make_sampler_t;
-typedef struct sgimgui_args_make_shader_t {
+typedef struct {
sg_shader result;
-} sgimgui_args_make_shader_t;
+} _sgimgui_args_make_shader_t;
-typedef struct sgimgui_args_make_pipeline_t {
+typedef struct {
sg_pipeline result;
-} sgimgui_args_make_pipeline_t;
+} _sgimgui_args_make_pipeline_t;
-typedef struct sgimgui_args_make_view_t {
+typedef struct {
sg_view result;
-} sgimgui_args_make_view_t;
+} _sgimgui_args_make_view_t;
-typedef struct sgimgui_args_destroy_buffer_t {
+typedef struct {
sg_buffer buffer;
-} sgimgui_args_destroy_buffer_t;
+} _sgimgui_args_destroy_buffer_t;
-typedef struct sgimgui_args_destroy_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_destroy_image_t;
+} _sgimgui_args_destroy_image_t;
-typedef struct sgimgui_args_destroy_sampler_t {
+typedef struct {
sg_sampler sampler;
-} sgimgui_args_destroy_sampler_t;
+} _sgimgui_args_destroy_sampler_t;
-typedef struct sgimgui_args_destroy_shader_t {
+typedef struct {
sg_shader shader;
-} sgimgui_args_destroy_shader_t;
+} _sgimgui_args_destroy_shader_t;
-typedef struct sgimgui_args_destroy_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_destroy_pipeline_t;
+} _sgimgui_args_destroy_pipeline_t;
-typedef struct sgimgui_args_destroy_view_t {
+typedef struct {
sg_view view;
-} sgimgui_args_destroy_view_t;
+} _sgimgui_args_destroy_view_t;
-typedef struct sgimgui_args_update_buffer_t {
+typedef struct {
sg_buffer buffer;
size_t data_size;
-} sgimgui_args_update_buffer_t;
+} _sgimgui_args_update_buffer_t;
-typedef struct sgimgui_args_update_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_update_image_t;
+} _sgimgui_args_update_image_t;
-typedef struct sgimgui_args_append_buffer_t {
+typedef struct {
sg_buffer buffer;
size_t data_size;
int result;
-} sgimgui_args_append_buffer_t;
+} _sgimgui_args_append_buffer_t;
-typedef struct sgimgui_args_begin_pass_t {
+typedef struct {
sg_pass pass;
-} sgimgui_args_begin_pass_t;
+} _sgimgui_args_begin_pass_t;
-typedef struct sgimgui_args_apply_viewport_t {
+typedef struct {
int x, y, width, height;
bool origin_top_left;
-} sgimgui_args_apply_viewport_t;
+} _sgimgui_args_apply_viewport_t;
-typedef struct sgimgui_args_apply_scissor_rect_t {
+typedef struct {
int x, y, width, height;
bool origin_top_left;
-} sgimgui_args_apply_scissor_rect_t;
+} _sgimgui_args_apply_scissor_rect_t;
-typedef struct sgimgui_args_apply_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_apply_pipeline_t;
+} _sgimgui_args_apply_pipeline_t;
-typedef struct sgimgui_args_apply_bindings_t {
+typedef struct {
sg_bindings bindings;
-} sgimgui_args_apply_bindings_t;
+} _sgimgui_args_apply_bindings_t;
-typedef struct sgimgui_args_apply_uniforms_t {
+typedef struct {
int ub_slot;
size_t data_size;
sg_pipeline pipeline; /* the pipeline which was active at this call */
size_t ubuf_pos; /* start of copied data in capture buffer */
-} sgimgui_args_apply_uniforms_t;
+} _sgimgui_args_apply_uniforms_t;
-typedef struct sgimgui_args_draw_t {
+typedef struct {
int base_element;
int num_elements;
int num_instances;
-} sgimgui_args_draw_t;
+} _sgimgui_args_draw_t;
-typedef struct sgimgui_args_draw_ex_t {
+typedef struct {
int base_element;
int num_elements;
int num_instances;
int base_vertex;
int base_instance;
-} sgimgui_args_draw_ex_t;
+} _sgimgui_args_draw_ex_t;
-typedef struct sgimgui_args_dispatch_t {
+typedef struct {
int num_groups_x;
int num_groups_y;
int num_groups_z;
-} sgimgui_args_dispatch_t;
+} _sgimgui_args_dispatch_t;
-typedef struct sgimgui_args_alloc_buffer_t {
+typedef struct {
sg_buffer result;
-} sgimgui_args_alloc_buffer_t;
+} _sgimgui_args_alloc_buffer_t;
-typedef struct sgimgui_args_alloc_image_t {
+typedef struct {
sg_image result;
-} sgimgui_args_alloc_image_t;
+} _sgimgui_args_alloc_image_t;
-typedef struct sgimgui_args_alloc_sampler_t {
+typedef struct {
sg_sampler result;
-} sgimgui_args_alloc_sampler_t;
+} _sgimgui_args_alloc_sampler_t;
-typedef struct sgimgui_args_alloc_shader_t {
+typedef struct {
sg_shader result;
-} sgimgui_args_alloc_shader_t;
+} _sgimgui_args_alloc_shader_t;
-typedef struct sgimgui_args_alloc_pipeline_t {
+typedef struct {
sg_pipeline result;
-} sgimgui_args_alloc_pipeline_t;
+} _sgimgui_args_alloc_pipeline_t;
-typedef struct sgimgui_args_alloc_view_t {
+typedef struct {
sg_view result;
-} sgimgui_args_alloc_view_t;
+} _sgimgui_args_alloc_view_t;
-typedef struct sgimgui_args_dealloc_buffer_t {
+typedef struct {
sg_buffer buffer;
-} sgimgui_args_dealloc_buffer_t;
+} _sgimgui_args_dealloc_buffer_t;
-typedef struct sgimgui_args_dealloc_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_dealloc_image_t;
+} _sgimgui_args_dealloc_image_t;
-typedef struct sgimgui_args_dealloc_sampler_t {
+typedef struct {
sg_sampler sampler;
-} sgimgui_args_dealloc_sampler_t;
+} _sgimgui_args_dealloc_sampler_t;
-typedef struct sgimgui_args_dealloc_shader_t {
+typedef struct {
sg_shader shader;
-} sgimgui_args_dealloc_shader_t;
+} _sgimgui_args_dealloc_shader_t;
-typedef struct sgimgui_args_dealloc_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_dealloc_pipeline_t;
+} _sgimgui_args_dealloc_pipeline_t;
-typedef struct sgimgui_args_dealloc_view_t {
+typedef struct {
sg_view view;
-} sgimgui_args_dealloc_view_t;
+} _sgimgui_args_dealloc_view_t;
-typedef struct sgimgui_args_init_buffer_t {
+typedef struct {
sg_buffer buffer;
-} sgimgui_args_init_buffer_t;
+} _sgimgui_args_init_buffer_t;
-typedef struct sgimgui_args_init_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_init_image_t;
+} _sgimgui_args_init_image_t;
-typedef struct sgimgui_args_init_sampler_t {
+typedef struct {
sg_sampler sampler;
-} sgimgui_args_init_sampler_t;
+} _sgimgui_args_init_sampler_t;
-typedef struct sgimgui_args_init_shader_t {
+typedef struct {
sg_shader shader;
-} sgimgui_args_init_shader_t;
+} _sgimgui_args_init_shader_t;
-typedef struct sgimgui_args_init_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_init_pipeline_t;
+} _sgimgui_args_init_pipeline_t;
-typedef struct sgimgui_args_init_view_t {
+typedef struct {
sg_view view;
-} sgimgui_args_init_view_t;
+} _sgimgui_args_init_view_t;
-typedef struct sgimgui_args_uninit_buffer_t {
+typedef struct {
sg_buffer buffer;
-} sgimgui_args_uninit_buffer_t;
+} _sgimgui_args_uninit_buffer_t;
-typedef struct sgimgui_args_uninit_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_uninit_image_t;
+} _sgimgui_args_uninit_image_t;
-typedef struct sgimgui_args_uninit_sampler_t {
+typedef struct {
sg_sampler sampler;
-} sgimgui_args_uninit_sampler_t;
+} _sgimgui_args_uninit_sampler_t;
-typedef struct sgimgui_args_uninit_shader_t {
+typedef struct {
sg_shader shader;
-} sgimgui_args_uninit_shader_t;
+} _sgimgui_args_uninit_shader_t;
-typedef struct sgimgui_args_uninit_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_uninit_pipeline_t;
+} _sgimgui_args_uninit_pipeline_t;
-typedef struct sgimgui_args_uninit_view_t {
+typedef struct {
sg_view view;
-} sgimgui_args_uninit_view_t;
+} _sgimgui_args_uninit_view_t;
-typedef struct sgimgui_args_fail_buffer_t {
+typedef struct {
sg_buffer buffer;
-} sgimgui_args_fail_buffer_t;
+} _sgimgui_args_fail_buffer_t;
-typedef struct sgimgui_args_fail_image_t {
+typedef struct {
sg_image image;
-} sgimgui_args_fail_image_t;
+} _sgimgui_args_fail_image_t;
-typedef struct sgimgui_args_fail_sampler_t {
+typedef struct {
sg_sampler sampler;
-} sgimgui_args_fail_sampler_t;
+} _sgimgui_args_fail_sampler_t;
-typedef struct sgimgui_args_fail_shader_t {
+typedef struct {
sg_shader shader;
-} sgimgui_args_fail_shader_t;
+} _sgimgui_args_fail_shader_t;
-typedef struct sgimgui_args_fail_pipeline_t {
+typedef struct {
sg_pipeline pipeline;
-} sgimgui_args_fail_pipeline_t;
+} _sgimgui_args_fail_pipeline_t;
-typedef struct sgimgui_args_fail_view_t {
+typedef struct {
sg_view view;
-} sgimgui_args_fail_view_t;
-
-typedef struct sgimgui_args_push_debug_group_t {
- sgimgui_str_t name;
-} sgimgui_args_push_debug_group_t;
-
-typedef union sgimgui_args_t {
- sgimgui_args_make_buffer_t make_buffer;
- sgimgui_args_make_image_t make_image;
- sgimgui_args_make_sampler_t make_sampler;
- sgimgui_args_make_shader_t make_shader;
- sgimgui_args_make_pipeline_t make_pipeline;
- sgimgui_args_make_view_t make_view;
- sgimgui_args_destroy_buffer_t destroy_buffer;
- sgimgui_args_destroy_image_t destroy_image;
- sgimgui_args_destroy_sampler_t destroy_sampler;
- sgimgui_args_destroy_shader_t destroy_shader;
- sgimgui_args_destroy_pipeline_t destroy_pipeline;
- sgimgui_args_destroy_view_t destroy_view;
- sgimgui_args_update_buffer_t update_buffer;
- sgimgui_args_update_image_t update_image;
- sgimgui_args_append_buffer_t append_buffer;
- sgimgui_args_begin_pass_t begin_pass;
- sgimgui_args_apply_viewport_t apply_viewport;
- sgimgui_args_apply_scissor_rect_t apply_scissor_rect;
- sgimgui_args_apply_pipeline_t apply_pipeline;
- sgimgui_args_apply_bindings_t apply_bindings;
- sgimgui_args_apply_uniforms_t apply_uniforms;
- sgimgui_args_draw_t draw;
- sgimgui_args_draw_ex_t draw_ex;
- sgimgui_args_dispatch_t dispatch;
- sgimgui_args_alloc_buffer_t alloc_buffer;
- sgimgui_args_alloc_image_t alloc_image;
- sgimgui_args_alloc_sampler_t alloc_sampler;
- sgimgui_args_alloc_shader_t alloc_shader;
- sgimgui_args_alloc_pipeline_t alloc_pipeline;
- sgimgui_args_alloc_view_t alloc_view;
- sgimgui_args_dealloc_buffer_t dealloc_buffer;
- sgimgui_args_dealloc_image_t dealloc_image;
- sgimgui_args_dealloc_sampler_t dealloc_sampler;
- sgimgui_args_dealloc_shader_t dealloc_shader;
- sgimgui_args_dealloc_pipeline_t dealloc_pipeline;
- sgimgui_args_dealloc_view_t dealloc_view;
- sgimgui_args_init_buffer_t init_buffer;
- sgimgui_args_init_image_t init_image;
- sgimgui_args_init_sampler_t init_sampler;
- sgimgui_args_init_shader_t init_shader;
- sgimgui_args_init_pipeline_t init_pipeline;
- sgimgui_args_init_view_t init_view;
- sgimgui_args_uninit_buffer_t uninit_buffer;
- sgimgui_args_uninit_image_t uninit_image;
- sgimgui_args_uninit_sampler_t uninit_sampler;
- sgimgui_args_uninit_shader_t uninit_shader;
- sgimgui_args_uninit_pipeline_t uninit_pipeline;
- sgimgui_args_uninit_view_t uninit_view;
- sgimgui_args_fail_buffer_t fail_buffer;
- sgimgui_args_fail_image_t fail_image;
- sgimgui_args_fail_sampler_t fail_sampler;
- sgimgui_args_fail_shader_t fail_shader;
- sgimgui_args_fail_pipeline_t fail_pipeline;
- sgimgui_args_fail_view_t fail_view;
- sgimgui_args_push_debug_group_t push_debug_group;
-} sgimgui_args_t;
-
-typedef struct sgimgui_capture_item_t {
- sgimgui_cmd_t cmd;
+} _sgimgui_args_fail_view_t;
+
+typedef struct {
+ _sgimgui_str_t name;
+} _sgimgui_args_push_debug_group_t;
+
+typedef union {
+ _sgimgui_args_make_buffer_t make_buffer;
+ _sgimgui_args_make_image_t make_image;
+ _sgimgui_args_make_sampler_t make_sampler;
+ _sgimgui_args_make_shader_t make_shader;
+ _sgimgui_args_make_pipeline_t make_pipeline;
+ _sgimgui_args_make_view_t make_view;
+ _sgimgui_args_destroy_buffer_t destroy_buffer;
+ _sgimgui_args_destroy_image_t destroy_image;
+ _sgimgui_args_destroy_sampler_t destroy_sampler;
+ _sgimgui_args_destroy_shader_t destroy_shader;
+ _sgimgui_args_destroy_pipeline_t destroy_pipeline;
+ _sgimgui_args_destroy_view_t destroy_view;
+ _sgimgui_args_update_buffer_t update_buffer;
+ _sgimgui_args_update_image_t update_image;
+ _sgimgui_args_append_buffer_t append_buffer;
+ _sgimgui_args_begin_pass_t begin_pass;
+ _sgimgui_args_apply_viewport_t apply_viewport;
+ _sgimgui_args_apply_scissor_rect_t apply_scissor_rect;
+ _sgimgui_args_apply_pipeline_t apply_pipeline;
+ _sgimgui_args_apply_bindings_t apply_bindings;
+ _sgimgui_args_apply_uniforms_t apply_uniforms;
+ _sgimgui_args_draw_t draw;
+ _sgimgui_args_draw_ex_t draw_ex;
+ _sgimgui_args_dispatch_t dispatch;
+ _sgimgui_args_alloc_buffer_t alloc_buffer;
+ _sgimgui_args_alloc_image_t alloc_image;
+ _sgimgui_args_alloc_sampler_t alloc_sampler;
+ _sgimgui_args_alloc_shader_t alloc_shader;
+ _sgimgui_args_alloc_pipeline_t alloc_pipeline;
+ _sgimgui_args_alloc_view_t alloc_view;
+ _sgimgui_args_dealloc_buffer_t dealloc_buffer;
+ _sgimgui_args_dealloc_image_t dealloc_image;
+ _sgimgui_args_dealloc_sampler_t dealloc_sampler;
+ _sgimgui_args_dealloc_shader_t dealloc_shader;
+ _sgimgui_args_dealloc_pipeline_t dealloc_pipeline;
+ _sgimgui_args_dealloc_view_t dealloc_view;
+ _sgimgui_args_init_buffer_t init_buffer;
+ _sgimgui_args_init_image_t init_image;
+ _sgimgui_args_init_sampler_t init_sampler;
+ _sgimgui_args_init_shader_t init_shader;
+ _sgimgui_args_init_pipeline_t init_pipeline;
+ _sgimgui_args_init_view_t init_view;
+ _sgimgui_args_uninit_buffer_t uninit_buffer;
+ _sgimgui_args_uninit_image_t uninit_image;
+ _sgimgui_args_uninit_sampler_t uninit_sampler;
+ _sgimgui_args_uninit_shader_t uninit_shader;
+ _sgimgui_args_uninit_pipeline_t uninit_pipeline;
+ _sgimgui_args_uninit_view_t uninit_view;
+ _sgimgui_args_fail_buffer_t fail_buffer;
+ _sgimgui_args_fail_image_t fail_image;
+ _sgimgui_args_fail_sampler_t fail_sampler;
+ _sgimgui_args_fail_shader_t fail_shader;
+ _sgimgui_args_fail_pipeline_t fail_pipeline;
+ _sgimgui_args_fail_view_t fail_view;
+ _sgimgui_args_push_debug_group_t push_debug_group;
+} _sgimgui_args_t;
+
+typedef struct {
+ _sgimgui_cmd_t cmd;
uint32_t color;
- sgimgui_args_t args;
-} sgimgui_capture_item_t;
+ _sgimgui_args_t args;
+} _sgimgui_capture_item_t;
-typedef struct sgimgui_capture_bucket_t {
+typedef struct {
size_t ubuf_size; /* size of uniform capture buffer in bytes */
size_t ubuf_pos; /* current uniform buffer pos */
uint8_t* ubuf; /* buffer for capturing uniform updates */
int num_items;
- sgimgui_capture_item_t items[sgimgui_MAX_FRAMECAPTURE_ITEMS];
-} sgimgui_capture_bucket_t;
+ _sgimgui_capture_item_t items[_SGIMGUI_MAX_FRAMECAPTURE_ITEMS];
+} _sgimgui_capture_bucket_t;
/* double-buffered call-capture buckets, one bucket is currently recorded,
the previous bucket is displayed
*/
-typedef struct sgimgui_capture_window_t {
+typedef struct {
bool open;
int bucket_index; /* which bucket to record to, 0 or 1 */
int sel_item; /* currently selected capture item by index */
- sgimgui_capture_bucket_t bucket[2];
-} sgimgui_capture_window_t;
+ _sgimgui_capture_bucket_t bucket[2];
+} _sgimgui_capture_window_t;
-typedef struct sgimgui_caps_window_t {
+typedef struct {
bool open;
-} sgimgui_caps_window_t;
+} _sgimgui_caps_window_t;
-typedef struct sgimgui_frame_stats_window_t {
+typedef struct {
bool open;
bool disable_sokol_imgui_stats;
bool in_sokol_imgui;
sg_stats stats;
// FIXME: add a ringbuffer for a stats history here
-} sgimgui_frame_stats_window_t;
-
-/*
- sgimgui_allocator_t
+} _sgimgui_frame_stats_window_t;
- Used in sgimgui_desc_t to provide custom memory-alloc and -free functions
- to sokol_gfx_imgui.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 sgimgui_allocator_t {
- void* (*alloc_fn)(size_t size, void* user_data);
- void (*free_fn)(void* ptr, void* user_data);
- void* user_data;
-} sgimgui_allocator_t;
-
-/*
- sgimgui_desc_t
-
- Initialization options for sgimgui_init().
-*/
-typedef struct sgimgui_desc_t {
- sgimgui_allocator_t allocator; // optional memory allocation overrides (default: malloc/free)
-} sgimgui_desc_t;
-
-typedef struct sgimgui_t {
+typedef struct {
uint32_t init_tag;
sgimgui_desc_t desc;
- sgimgui_buffer_window_t buffer_window;
- sgimgui_image_window_t image_window;
- sgimgui_sampler_window_t sampler_window;
- sgimgui_shader_window_t shader_window;
- sgimgui_pipeline_window_t pipeline_window;
- sgimgui_view_window_t view_window;
- sgimgui_capture_window_t capture_window;
- sgimgui_caps_window_t caps_window;
- sgimgui_frame_stats_window_t frame_stats_window;
+ _sgimgui_buffer_window_t buffer_window;
+ _sgimgui_image_window_t image_window;
+ _sgimgui_sampler_window_t sampler_window;
+ _sgimgui_shader_window_t shader_window;
+ _sgimgui_pipeline_window_t pipeline_window;
+ _sgimgui_view_window_t view_window;
+ _sgimgui_capture_window_t capture_window;
+ _sgimgui_caps_window_t caps_window;
+ _sgimgui_frame_stats_window_t frame_stats_window;
sg_pipeline cur_pipeline;
sg_trace_hooks hooks;
-} sgimgui_t;
-
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_init(sgimgui_t* ctx, const sgimgui_desc_t* desc);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_discard(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw(sgimgui_t* ctx);
-
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_menu(sgimgui_t* ctx, const char* title);
-
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_buffer_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_image_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_sampler_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_shader_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_pipeline_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_view_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capture_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capabilities_window_content(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_frame_stats_window_content(sgimgui_t* ctx);
-
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_buffer_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_image_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_sampler_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_shader_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_pipeline_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_view_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capture_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_capabilities_window(sgimgui_t* ctx);
-SOKOL_GFX_IMGUI_API_DECL void sgimgui_draw_frame_stats_window(sgimgui_t* ctx);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-#endif /* SOKOL_GFX_IMGUI_INCLUDED */
-
-/*=== IMPLEMENTATION =========================================================*/
-#ifdef SOKOL_GFX_IMGUI_IMPL
-#define SOKOL_GFX_IMGUI_IMPL_INCLUDED (1)
-
-#if defined(SOKOL_MALLOC) || defined(SOKOL_CALLOC) || defined(SOKOL_FREE)
-#error "SOKOL_MALLOC/CALLOC/FREE macros are no longer supported, please use sgimgui_desc_t.allocator to override memory allocation functions"
-#endif
-
-#if defined(__cplusplus)
- #if !defined(IMGUI_VERSION)
- #error "Please include imgui.h before the sokol_imgui.h implementation"
- #endif
-#else
- #if !defined(CIMGUI_API)
- #error "Please include cimgui.h before the sokol_imgui.h implementation"
- #endif
-#endif
-#ifndef SOKOL_ASSERT
- #include <assert.h>
- #define SOKOL_ASSERT(c) assert(c)
-#endif
-#ifndef SOKOL_UNREACHABLE
- #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
-#endif
-#ifndef _SOKOL_PRIVATE
- #if defined(__GNUC__) || defined(__clang__)
- #define _SOKOL_PRIVATE __attribute__((unused)) static
- #else
- #define _SOKOL_PRIVATE static
- #endif
-#endif
-#ifndef _SOKOL_UNUSED
-#define _SOKOL_UNUSED(x) (void)(x)
-#endif
-#ifndef SOKOL_API_IMPL
-#define SOKOL_API_IMPL
-#endif
-
-#include <string.h>
-#include <stdio.h> // snprintf
-#include <stdlib.h> // malloc, free
+} _sgimgui_t;
+static _sgimgui_t _sgimgui;
#define _SGIMGUI_SLOT_MASK (0xFFFF)
#define _SGIMGUI_LIST_WIDTH (192)
@@ -1169,22 +1135,22 @@ _SOKOL_PRIVATE uint32_t _sgimgui_std140_uniform_size(sg_uniform_type type, int a
}
}
-_SOKOL_PRIVATE void _sgimgui_strcpy(sgimgui_str_t* dst, const char* src) {
+_SOKOL_PRIVATE void _sgimgui_strcpy(_sgimgui_str_t* dst, const char* src) {
SOKOL_ASSERT(dst);
if (src) {
#if defined(_MSC_VER)
- strncpy_s(dst->buf, sgimgui_STRBUF_LEN, src, (sgimgui_STRBUF_LEN-1));
+ strncpy_s(dst->buf, _SGIMGUI_STRBUF_LEN, src, (_SGIMGUI_STRBUF_LEN-1));
#else
- strncpy(dst->buf, src, sgimgui_STRBUF_LEN);
+ strncpy(dst->buf, src, _SGIMGUI_STRBUF_LEN);
#endif
- dst->buf[sgimgui_STRBUF_LEN-1] = 0;
+ dst->buf[_SGIMGUI_STRBUF_LEN-1] = 0;
} else {
- _sgimgui_clear(dst->buf, sgimgui_STRBUF_LEN);
+ _sgimgui_clear(dst->buf, _SGIMGUI_STRBUF_LEN);
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_make_str(const char* str) {
- sgimgui_str_t res;
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_make_str(const char* str) {
+ _sgimgui_str_t res;
_sgimgui_strcpy(&res, str);
return res;
}
@@ -1204,7 +1170,7 @@ _SOKOL_PRIVATE const void* _sgimgui_bin_dup(const sgimgui_allocator_t* allocator
return (const void*) dst;
}
-_SOKOL_PRIVATE void _sgimgui_snprintf(sgimgui_str_t* dst, const char* fmt, ...) {
+_SOKOL_PRIVATE void _sgimgui_snprintf(_sgimgui_str_t* dst, const char* fmt, ...) {
SOKOL_ASSERT(dst);
va_list args;
va_start(args, fmt);
@@ -1581,14 +1547,14 @@ _SOKOL_PRIVATE const char* _sgimgui_bool_string(bool b) {
return b ? "true" : "false";
}
-_SOKOL_PRIVATE const char* _sgimgui_color_string(sgimgui_str_t* dst_str, sg_color color) {
+_SOKOL_PRIVATE const char* _sgimgui_color_string(_sgimgui_str_t* dst_str, sg_color color) {
_sgimgui_snprintf(dst_str, "%.3f %.3f %.3f %.3f", color.r, color.g, color.b, color.a);
return dst_str->buf;
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_res_id_string(uint32_t res_id, const char* label) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_res_id_string(uint32_t res_id, const char* label) {
SOKOL_ASSERT(label);
- sgimgui_str_t res;
+ _sgimgui_str_t res;
if (label[0]) {
_sgimgui_snprintf(&res, "'%s'", label);
} else {
@@ -1597,54 +1563,54 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_res_id_string(uint32_t res_id, const char*
return res;
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_buffer_id_string(sgimgui_t* ctx, sg_buffer buf_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_buffer_id_string(_sgimgui_t* ctx, sg_buffer buf_id) {
if (buf_id.id != SG_INVALID_ID) {
- const sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf_id.id)];
+ const _sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf_id.id)];
return _sgimgui_res_id_string(buf_id.id, buf_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_image_id_string(sgimgui_t* ctx, sg_image img_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_image_id_string(_sgimgui_t* ctx, sg_image img_id) {
if (img_id.id != SG_INVALID_ID) {
- const sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img_id.id)];
+ const _sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img_id.id)];
return _sgimgui_res_id_string(img_id.id, img_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_sampler_id_string(sgimgui_t* ctx, sg_sampler smp_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_sampler_id_string(_sgimgui_t* ctx, sg_sampler smp_id) {
if (smp_id.id != SG_INVALID_ID) {
- const sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp_id.id)];
+ const _sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp_id.id)];
return _sgimgui_res_id_string(smp_id.id, smp_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_shader_id_string(sgimgui_t* ctx, sg_shader shd_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_shader_id_string(_sgimgui_t* ctx, sg_shader shd_id) {
if (shd_id.id != SG_INVALID_ID) {
- const sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd_id.id)];
+ const _sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd_id.id)];
return _sgimgui_res_id_string(shd_id.id, shd_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_pipeline_id_string(sgimgui_t* ctx, sg_pipeline pip_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_pipeline_id_string(_sgimgui_t* ctx, sg_pipeline pip_id) {
if (pip_id.id != SG_INVALID_ID) {
- const sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(pip_id.id)];
+ const _sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(pip_id.id)];
return _sgimgui_res_id_string(pip_id.id, pip_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
}
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_view_id_string(sgimgui_t* ctx, sg_view view_id) {
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_view_id_string(_sgimgui_t* ctx, sg_view view_id) {
if (view_id.id != SG_INVALID_ID) {
- const sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view_id.id)];
+ const _sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view_id.id)];
return _sgimgui_res_id_string(view_id.id, view_ui->label.buf);
} else {
return _sgimgui_make_str("<invalid>");
@@ -1652,52 +1618,52 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_view_id_string(sgimgui_t* ctx, sg_view vie
}
/*--- RESOURCE HELPERS -------------------------------------------------------*/
-_SOKOL_PRIVATE void _sgimgui_buffer_created(sgimgui_t* ctx, sg_buffer res_id, int slot_index, const sg_buffer_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_buffer_created(_sgimgui_t* ctx, sg_buffer res_id, int slot_index, const sg_buffer_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->buffer_window.num_slots));
- sgimgui_buffer_t* buf = &ctx->buffer_window.slots[slot_index];
+ _sgimgui_buffer_t* buf = &ctx->buffer_window.slots[slot_index];
buf->res_id = res_id;
buf->desc = *desc;
buf->label = _sgimgui_make_str(desc->label);
}
-_SOKOL_PRIVATE void _sgimgui_buffer_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_buffer_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->buffer_window.num_slots));
- sgimgui_buffer_t* buf = &ctx->buffer_window.slots[slot_index];
+ _sgimgui_buffer_t* buf = &ctx->buffer_window.slots[slot_index];
buf->res_id.id = SG_INVALID_ID;
}
-_SOKOL_PRIVATE void _sgimgui_image_created(sgimgui_t* ctx, sg_image res_id, int slot_index, const sg_image_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_image_created(_sgimgui_t* ctx, sg_image res_id, int slot_index, const sg_image_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->image_window.num_slots));
- sgimgui_image_t* img = &ctx->image_window.slots[slot_index];
+ _sgimgui_image_t* img = &ctx->image_window.slots[slot_index];
img->res_id = res_id;
img->desc = *desc;
img->ui_scale = 1.0f;
img->label = _sgimgui_make_str(desc->label);
}
-_SOKOL_PRIVATE void _sgimgui_image_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_image_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->image_window.num_slots));
- sgimgui_image_t* img = &ctx->image_window.slots[slot_index];
+ _sgimgui_image_t* img = &ctx->image_window.slots[slot_index];
img->res_id.id = SG_INVALID_ID;
}
-_SOKOL_PRIVATE void _sgimgui_sampler_created(sgimgui_t* ctx, sg_sampler res_id, int slot_index, const sg_sampler_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_sampler_created(_sgimgui_t* ctx, sg_sampler res_id, int slot_index, const sg_sampler_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->sampler_window.num_slots));
- sgimgui_sampler_t* smp = &ctx->sampler_window.slots[slot_index];
+ _sgimgui_sampler_t* smp = &ctx->sampler_window.slots[slot_index];
smp->res_id = res_id;
smp->desc = *desc;
smp->label = _sgimgui_make_str(desc->label);
}
-_SOKOL_PRIVATE void _sgimgui_sampler_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_sampler_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->sampler_window.num_slots));
- sgimgui_sampler_t* smp = &ctx->sampler_window.slots[slot_index];
+ _sgimgui_sampler_t* smp = &ctx->sampler_window.slots[slot_index];
smp->res_id.id = SG_INVALID_ID;
}
-_SOKOL_PRIVATE void _sgimgui_shader_created(sgimgui_t* ctx, sg_shader res_id, int slot_index, const sg_shader_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_shader_created(_sgimgui_t* ctx, sg_shader res_id, int slot_index, const sg_shader_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->shader_window.num_slots));
- sgimgui_shader_t* shd = &ctx->shader_window.slots[slot_index];
+ _sgimgui_shader_t* shd = &ctx->shader_window.slots[slot_index];
shd->res_id = res_id;
shd->desc = *desc;
shd->label = _sgimgui_make_str(desc->label);
@@ -1757,9 +1723,9 @@ _SOKOL_PRIVATE void _sgimgui_shader_created(sgimgui_t* ctx, sg_shader res_id, in
}
}
-_SOKOL_PRIVATE void _sgimgui_shader_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_shader_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->shader_window.num_slots));
- sgimgui_shader_t* shd = &ctx->shader_window.slots[slot_index];
+ _sgimgui_shader_t* shd = &ctx->shader_window.slots[slot_index];
shd->res_id.id = SG_INVALID_ID;
if (shd->desc.vertex_func.source) {
_sgimgui_free(&ctx->desc.allocator, (void*)shd->desc.vertex_func.source);
@@ -1779,72 +1745,72 @@ _SOKOL_PRIVATE void _sgimgui_shader_destroyed(sgimgui_t* ctx, int slot_index) {
}
}
-_SOKOL_PRIVATE void _sgimgui_pipeline_created(sgimgui_t* ctx, sg_pipeline res_id, int slot_index, const sg_pipeline_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_pipeline_created(_sgimgui_t* ctx, sg_pipeline res_id, int slot_index, const sg_pipeline_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->pipeline_window.num_slots));
- sgimgui_pipeline_t* pip = &ctx->pipeline_window.slots[slot_index];
+ _sgimgui_pipeline_t* pip = &ctx->pipeline_window.slots[slot_index];
pip->res_id = res_id;
pip->label = _sgimgui_make_str(desc->label);
pip->desc = *desc;
}
-_SOKOL_PRIVATE void _sgimgui_pipeline_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_pipeline_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->pipeline_window.num_slots));
- sgimgui_pipeline_t* pip = &ctx->pipeline_window.slots[slot_index];
+ _sgimgui_pipeline_t* pip = &ctx->pipeline_window.slots[slot_index];
pip->res_id.id = SG_INVALID_ID;
}
-_SOKOL_PRIVATE void _sgimgui_view_created(sgimgui_t* ctx, sg_view res_id, int slot_index, const sg_view_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_view_created(_sgimgui_t* ctx, sg_view res_id, int slot_index, const sg_view_desc* desc) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->view_window.num_slots));
- sgimgui_view_t* view = &ctx->view_window.slots[slot_index];
+ _sgimgui_view_t* view = &ctx->view_window.slots[slot_index];
view->res_id = res_id;
view->ui_scale = 1.0f;
view->label = _sgimgui_make_str(desc->label);
view->desc = *desc;
}
-_SOKOL_PRIVATE void _sgimgui_view_destroyed(sgimgui_t* ctx, int slot_index) {
+_SOKOL_PRIVATE void _sgimgui_view_destroyed(_sgimgui_t* ctx, int slot_index) {
SOKOL_ASSERT((slot_index > 0) && (slot_index < ctx->view_window.num_slots));
- sgimgui_view_t* view = &ctx->view_window.slots[slot_index];
+ _sgimgui_view_t* view = &ctx->view_window.slots[slot_index];
view->res_id.id = SG_INVALID_ID;
}
/*--- COMMAND CAPTURING ------------------------------------------------------*/
-_SOKOL_PRIVATE void _sgimgui_capture_init(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_capture_init(_sgimgui_t* ctx) {
const size_t ubuf_initial_size = 256 * 1024;
for (int i = 0; i < 2; i++) {
- sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[i];
+ _sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[i];
bucket->ubuf_size = ubuf_initial_size;
bucket->ubuf = (uint8_t*) _sgimgui_malloc(&ctx->desc.allocator, bucket->ubuf_size);
}
}
-_SOKOL_PRIVATE void _sgimgui_capture_discard(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_capture_discard(_sgimgui_t* ctx) {
for (int i = 0; i < 2; i++) {
- sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[i];
+ _sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[i];
SOKOL_ASSERT(bucket->ubuf);
_sgimgui_free(&ctx->desc.allocator, bucket->ubuf);
bucket->ubuf = 0;
}
}
-_SOKOL_PRIVATE sgimgui_capture_bucket_t* _sgimgui_capture_get_write_bucket(sgimgui_t* ctx) {
+_SOKOL_PRIVATE _sgimgui_capture_bucket_t* _sgimgui_capture_get_write_bucket(_sgimgui_t* ctx) {
return &ctx->capture_window.bucket[ctx->capture_window.bucket_index & 1];
}
-_SOKOL_PRIVATE sgimgui_capture_bucket_t* _sgimgui_capture_get_read_bucket(sgimgui_t* ctx) {
+_SOKOL_PRIVATE _sgimgui_capture_bucket_t* _sgimgui_capture_get_read_bucket(_sgimgui_t* ctx) {
return &ctx->capture_window.bucket[(ctx->capture_window.bucket_index + 1) & 1];
}
-_SOKOL_PRIVATE void _sgimgui_capture_next_frame(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_capture_next_frame(_sgimgui_t* ctx) {
ctx->capture_window.bucket_index = (ctx->capture_window.bucket_index + 1) & 1;
- sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[ctx->capture_window.bucket_index];
+ _sgimgui_capture_bucket_t* bucket = &ctx->capture_window.bucket[ctx->capture_window.bucket_index];
bucket->num_items = 0;
bucket->ubuf_pos = 0;
}
-_SOKOL_PRIVATE void _sgimgui_capture_grow_ubuf(sgimgui_t* ctx, size_t required_size) {
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
+_SOKOL_PRIVATE void _sgimgui_capture_grow_ubuf(_sgimgui_t* ctx, size_t required_size) {
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
SOKOL_ASSERT(required_size > bucket->ubuf_size);
size_t old_size = bucket->ubuf_size;
size_t new_size = required_size + (required_size>>1); /* allocate a bit ahead */
@@ -1852,29 +1818,29 @@ _SOKOL_PRIVATE void _sgimgui_capture_grow_ubuf(sgimgui_t* ctx, size_t required_s
bucket->ubuf = (uint8_t*) _sgimgui_realloc(&ctx->desc.allocator, bucket->ubuf, old_size, new_size);
}
-_SOKOL_PRIVATE sgimgui_capture_item_t* _sgimgui_capture_next_write_item(sgimgui_t* ctx) {
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
- if (bucket->num_items < sgimgui_MAX_FRAMECAPTURE_ITEMS) {
- sgimgui_capture_item_t* item = &bucket->items[bucket->num_items++];
+_SOKOL_PRIVATE _sgimgui_capture_item_t* _sgimgui_capture_next_write_item(_sgimgui_t* ctx) {
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
+ if (bucket->num_items < _SGIMGUI_MAX_FRAMECAPTURE_ITEMS) {
+ _sgimgui_capture_item_t* item = &bucket->items[bucket->num_items++];
return item;
} else {
return 0;
}
}
-_SOKOL_PRIVATE int _sgimgui_capture_num_read_items(sgimgui_t* ctx) {
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
+_SOKOL_PRIVATE int _sgimgui_capture_num_read_items(_sgimgui_t* ctx) {
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
return bucket->num_items;
}
-_SOKOL_PRIVATE sgimgui_capture_item_t* _sgimgui_capture_read_item_at(sgimgui_t* ctx, int index) {
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
+_SOKOL_PRIVATE _sgimgui_capture_item_t* _sgimgui_capture_read_item_at(_sgimgui_t* ctx, int index) {
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
SOKOL_ASSERT(index < bucket->num_items);
return &bucket->items[index];
}
-_SOKOL_PRIVATE size_t _sgimgui_capture_uniforms(sgimgui_t* ctx, const sg_range* data) {
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
+_SOKOL_PRIVATE size_t _sgimgui_capture_uniforms(_sgimgui_t* ctx, const sg_range* data) {
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_write_bucket(ctx);
const size_t required_size = bucket->ubuf_pos + data->size;
if (required_size > bucket->ubuf_size) {
_sgimgui_capture_grow_ubuf(ctx, required_size);
@@ -1887,115 +1853,115 @@ _SOKOL_PRIVATE size_t _sgimgui_capture_uniforms(sgimgui_t* ctx, const sg_range*
return pos;
}
-_SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int index, const sgimgui_capture_item_t* item) {
- sgimgui_str_t str = _sgimgui_make_str(0);
+_SOKOL_PRIVATE _sgimgui_str_t _sgimgui_capture_item_string(_sgimgui_t* ctx, int index, const _sgimgui_capture_item_t* item) {
+ _sgimgui_str_t str = _sgimgui_make_str(0);
switch (item->cmd) {
- case SGIMGUI_CMD_RESET_STATE_CACHE:
+ case _SGIMGUI_CMD_RESET_STATE_CACHE:
_sgimgui_snprintf(&str, "%d: sg_reset_state_cache()", index);
break;
- case SGIMGUI_CMD_MAKE_BUFFER:
+ case _SGIMGUI_CMD_MAKE_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.make_buffer.result);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.make_buffer.result);
_sgimgui_snprintf(&str, "%d: sg_make_buffer(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_MAKE_IMAGE:
+ case _SGIMGUI_CMD_MAKE_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.make_image.result);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.make_image.result);
_sgimgui_snprintf(&str, "%d: sg_make_image(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_MAKE_SAMPLER:
+ case _SGIMGUI_CMD_MAKE_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.make_sampler.result);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.make_sampler.result);
_sgimgui_snprintf(&str, "%d: sg_make_sampler(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_MAKE_SHADER:
+ case _SGIMGUI_CMD_MAKE_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.make_shader.result);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.make_shader.result);
_sgimgui_snprintf(&str, "%d: sg_make_shader(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_MAKE_PIPELINE:
+ case _SGIMGUI_CMD_MAKE_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.make_pipeline.result);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.make_pipeline.result);
_sgimgui_snprintf(&str, "%d: sg_make_pipeline(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_MAKE_VIEW:
+ case _SGIMGUI_CMD_MAKE_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.make_view.result);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.make_view.result);
_sgimgui_snprintf(&str, "%d: sg_make_views(desc=..) => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_BUFFER:
+ case _SGIMGUI_CMD_DESTROY_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.destroy_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.destroy_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_destroy_buffer(buf=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_IMAGE:
+ case _SGIMGUI_CMD_DESTROY_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.destroy_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.destroy_image.image);
_sgimgui_snprintf(&str, "%d: sg_destroy_image(img=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_SAMPLER:
+ case _SGIMGUI_CMD_DESTROY_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.destroy_sampler.sampler);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.destroy_sampler.sampler);
_sgimgui_snprintf(&str, "%d: sg_destroy_sampler(smp=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_SHADER:
+ case _SGIMGUI_CMD_DESTROY_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.destroy_shader.shader);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.destroy_shader.shader);
_sgimgui_snprintf(&str, "%d: sg_destroy_shader(shd=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_PIPELINE:
+ case _SGIMGUI_CMD_DESTROY_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.destroy_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.destroy_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_destroy_pipeline(pip=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DESTROY_VIEW:
+ case _SGIMGUI_CMD_DESTROY_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.destroy_view.view);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.destroy_view.view);
_sgimgui_snprintf(&str, "%d: sg_destroy_view(view=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UPDATE_BUFFER:
+ case _SGIMGUI_CMD_UPDATE_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.update_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.update_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_update_buffer(buf=%s, data.size=%d)",
index, res_id.buf,
item->args.update_buffer.data_size);
}
break;
- case SGIMGUI_CMD_UPDATE_IMAGE:
+ case _SGIMGUI_CMD_UPDATE_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.update_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.update_image.image);
_sgimgui_snprintf(&str, "%d: sg_update_image(img=%s, data=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_APPEND_BUFFER:
+ case _SGIMGUI_CMD_APPEND_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.append_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.append_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_append_buffer(buf=%s, data.size=%d) => %d",
index, res_id.buf,
item->args.append_buffer.data_size,
@@ -2003,13 +1969,13 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
}
break;
- case SGIMGUI_CMD_BEGIN_PASS:
+ case _SGIMGUI_CMD_BEGIN_PASS:
{
_sgimgui_snprintf(&str, "%d: sg_begin_pass(pass=...)", index);
}
break;
- case SGIMGUI_CMD_APPLY_VIEWPORT:
+ case _SGIMGUI_CMD_APPLY_VIEWPORT:
_sgimgui_snprintf(&str, "%d: sg_apply_viewport(x=%d, y=%d, width=%d, height=%d, origin_top_left=%s)",
index,
item->args.apply_viewport.x,
@@ -2019,7 +1985,7 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
_sgimgui_bool_string(item->args.apply_viewport.origin_top_left));
break;
- case SGIMGUI_CMD_APPLY_SCISSOR_RECT:
+ case _SGIMGUI_CMD_APPLY_SCISSOR_RECT:
_sgimgui_snprintf(&str, "%d: sg_apply_scissor_rect(x=%d, y=%d, width=%d, height=%d, origin_top_left=%s)",
index,
item->args.apply_scissor_rect.x,
@@ -2029,25 +1995,25 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
_sgimgui_bool_string(item->args.apply_scissor_rect.origin_top_left));
break;
- case SGIMGUI_CMD_APPLY_PIPELINE:
+ case _SGIMGUI_CMD_APPLY_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.apply_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.apply_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_apply_pipeline(pip=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_APPLY_BINDINGS:
+ case _SGIMGUI_CMD_APPLY_BINDINGS:
_sgimgui_snprintf(&str, "%d: sg_apply_bindings(bindings=..)", index);
break;
- case SGIMGUI_CMD_APPLY_UNIFORMS:
+ case _SGIMGUI_CMD_APPLY_UNIFORMS:
_sgimgui_snprintf(&str, "%d: sg_apply_uniforms(ub_slot=%d, data.size=%d)",
index,
item->args.apply_uniforms.ub_slot,
item->args.apply_uniforms.data_size);
break;
- case SGIMGUI_CMD_DRAW:
+ case _SGIMGUI_CMD_DRAW:
_sgimgui_snprintf(&str, "%d: sg_draw(base_element=%d, num_elements=%d, num_instances=%d)",
index,
item->args.draw.base_element,
@@ -2055,7 +2021,7 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
item->args.draw.num_instances);
break;
- case SGIMGUI_CMD_DRAW_EX:
+ case _SGIMGUI_CMD_DRAW_EX:
_sgimgui_snprintf(&str, "%d: sg_draw_ex(base_element=%d, num_elements=%d, num_instances=%d, base_vertex=%d, base_instance=%d)",
index,
item->args.draw_ex.base_element,
@@ -2065,7 +2031,7 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
item->args.draw_ex.base_instance);
break;
- case SGIMGUI_CMD_DISPATCH:
+ case _SGIMGUI_CMD_DISPATCH:
_sgimgui_snprintf(&str, "%d: sg_dispatch(num_groups_x=%d, num_groups_y=%d, num_groups_z=%d)",
index,
item->args.dispatch.num_groups_x,
@@ -2073,230 +2039,230 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
item->args.dispatch.num_groups_z);
break;
- case SGIMGUI_CMD_END_PASS:
+ case _SGIMGUI_CMD_END_PASS:
_sgimgui_snprintf(&str, "%d: sg_end_pass()", index);
break;
- case SGIMGUI_CMD_COMMIT:
+ case _SGIMGUI_CMD_COMMIT:
_sgimgui_snprintf(&str, "%d: sg_commit()", index);
break;
- case SGIMGUI_CMD_ALLOC_BUFFER:
+ case _SGIMGUI_CMD_ALLOC_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.alloc_buffer.result);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.alloc_buffer.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_buffer() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_ALLOC_IMAGE:
+ case _SGIMGUI_CMD_ALLOC_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.alloc_image.result);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.alloc_image.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_image() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_ALLOC_SAMPLER:
+ case _SGIMGUI_CMD_ALLOC_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.alloc_sampler.result);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.alloc_sampler.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_sampler() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_ALLOC_SHADER:
+ case _SGIMGUI_CMD_ALLOC_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.alloc_shader.result);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.alloc_shader.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_shader() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_ALLOC_PIPELINE:
+ case _SGIMGUI_CMD_ALLOC_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.alloc_pipeline.result);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.alloc_pipeline.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_pipeline() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_ALLOC_VIEW:
+ case _SGIMGUI_CMD_ALLOC_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.alloc_view.result);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.alloc_view.result);
_sgimgui_snprintf(&str, "%d: sg_alloc_view() => %s", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_BUFFER:
+ case _SGIMGUI_CMD_DEALLOC_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.dealloc_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.dealloc_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_dealloc_buffer(buf=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_IMAGE:
+ case _SGIMGUI_CMD_DEALLOC_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.dealloc_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.dealloc_image.image);
_sgimgui_snprintf(&str, "%d: sg_dealloc_image(img=%d)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_SAMPLER:
+ case _SGIMGUI_CMD_DEALLOC_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.dealloc_sampler.sampler);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.dealloc_sampler.sampler);
_sgimgui_snprintf(&str, "%d: sg_dealloc_sampler(smp=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_SHADER:
+ case _SGIMGUI_CMD_DEALLOC_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.dealloc_shader.shader);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.dealloc_shader.shader);
_sgimgui_snprintf(&str, "%d: sg_dealloc_shader(shd=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_PIPELINE:
+ case _SGIMGUI_CMD_DEALLOC_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.dealloc_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.dealloc_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_dealloc_pipeline(pip=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_DEALLOC_VIEW:
+ case _SGIMGUI_CMD_DEALLOC_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.dealloc_view.view);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.dealloc_view.view);
_sgimgui_snprintf(&str, "%d: sg_dealloc_view(view=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_BUFFER:
+ case _SGIMGUI_CMD_INIT_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.init_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.init_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_init_buffer(buf=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_IMAGE:
+ case _SGIMGUI_CMD_INIT_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.init_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.init_image.image);
_sgimgui_snprintf(&str, "%d: sg_init_image(img=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_SAMPLER:
+ case _SGIMGUI_CMD_INIT_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.init_sampler.sampler);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.init_sampler.sampler);
_sgimgui_snprintf(&str, "%d: sg_init_sampler(smp=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_SHADER:
+ case _SGIMGUI_CMD_INIT_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.init_shader.shader);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.init_shader.shader);
_sgimgui_snprintf(&str, "%d: sg_init_shader(shd=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_PIPELINE:
+ case _SGIMGUI_CMD_INIT_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.init_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.init_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_init_pipeline(pip=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_INIT_VIEW:
+ case _SGIMGUI_CMD_INIT_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.init_view.view);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.init_view.view);
_sgimgui_snprintf(&str, "%d: sg_init_view(view=%s, desc=..)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_BUFFER:
+ case _SGIMGUI_CMD_UNINIT_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.uninit_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.uninit_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_uninit_buffer(buf=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_IMAGE:
+ case _SGIMGUI_CMD_UNINIT_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.uninit_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.uninit_image.image);
_sgimgui_snprintf(&str, "%d: sg_uninit_image(img=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_SAMPLER:
+ case _SGIMGUI_CMD_UNINIT_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.uninit_sampler.sampler);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.uninit_sampler.sampler);
_sgimgui_snprintf(&str, "%d: sg_uninit_sampler(smp=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_SHADER:
+ case _SGIMGUI_CMD_UNINIT_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.uninit_shader.shader);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.uninit_shader.shader);
_sgimgui_snprintf(&str, "%d: sg_uninit_shader(shd=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_PIPELINE:
+ case _SGIMGUI_CMD_UNINIT_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.uninit_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.uninit_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_uninit_pipeline(pip=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_UNINIT_VIEW:
+ case _SGIMGUI_CMD_UNINIT_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.uninit_view.view);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.uninit_view.view);
_sgimgui_snprintf(&str, "%d: sg_uninit_view(view=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_BUFFER:
+ case _SGIMGUI_CMD_FAIL_BUFFER:
{
- sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.fail_buffer.buffer);
+ _sgimgui_str_t res_id = _sgimgui_buffer_id_string(ctx, item->args.fail_buffer.buffer);
_sgimgui_snprintf(&str, "%d: sg_fail_buffer(buf=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_IMAGE:
+ case _SGIMGUI_CMD_FAIL_IMAGE:
{
- sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.fail_image.image);
+ _sgimgui_str_t res_id = _sgimgui_image_id_string(ctx, item->args.fail_image.image);
_sgimgui_snprintf(&str, "%d: sg_fail_image(img=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_SAMPLER:
+ case _SGIMGUI_CMD_FAIL_SAMPLER:
{
- sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.fail_sampler.sampler);
+ _sgimgui_str_t res_id = _sgimgui_sampler_id_string(ctx, item->args.fail_sampler.sampler);
_sgimgui_snprintf(&str, "%d: sg_fail_sampler(smp=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_SHADER:
+ case _SGIMGUI_CMD_FAIL_SHADER:
{
- sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.fail_shader.shader);
+ _sgimgui_str_t res_id = _sgimgui_shader_id_string(ctx, item->args.fail_shader.shader);
_sgimgui_snprintf(&str, "%d: sg_fail_shader(shd=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_PIPELINE:
+ case _SGIMGUI_CMD_FAIL_PIPELINE:
{
- sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.fail_pipeline.pipeline);
+ _sgimgui_str_t res_id = _sgimgui_pipeline_id_string(ctx, item->args.fail_pipeline.pipeline);
_sgimgui_snprintf(&str, "%d: sg_fail_pipeline(shd=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_FAIL_VIEW:
+ case _SGIMGUI_CMD_FAIL_VIEW:
{
- sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.fail_view.view);
+ _sgimgui_str_t res_id = _sgimgui_view_id_string(ctx, item->args.fail_view.view);
_sgimgui_snprintf(&str, "%d: sg_fail_view(view=%s)", index, res_id.buf);
}
break;
- case SGIMGUI_CMD_PUSH_DEBUG_GROUP:
+ case _SGIMGUI_CMD_PUSH_DEBUG_GROUP:
_sgimgui_snprintf(&str, "%d: sg_push_debug_group(name=%s)", index,
item->args.push_debug_group.name.buf);
break;
- case SGIMGUI_CMD_POP_DEBUG_GROUP:
+ case _SGIMGUI_CMD_POP_DEBUG_GROUP:
_sgimgui_snprintf(&str, "%d: sg_pop_debug_group()", index);
break;
@@ -2309,11 +2275,11 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
/*--- CAPTURE CALLBACKS ------------------------------------------------------*/
_SOKOL_PRIVATE void _sgimgui_reset_state_cache(void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_RESET_STATE_CACHE;
+ item->cmd = _SGIMGUI_CMD_RESET_STATE_CACHE;
item->color = _SGIMGUI_COLOR_OTHER;
}
if (ctx->hooks.reset_state_cache) {
@@ -2322,11 +2288,11 @@ _SOKOL_PRIVATE void _sgimgui_reset_state_cache(void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_make_buffer(const sg_buffer_desc* desc, sg_buffer buf_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_BUFFER;
+ item->cmd = _SGIMGUI_CMD_MAKE_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_buffer.result = buf_id;
}
@@ -2339,11 +2305,11 @@ _SOKOL_PRIVATE void _sgimgui_make_buffer(const sg_buffer_desc* desc, sg_buffer b
}
_SOKOL_PRIVATE void _sgimgui_make_image(const sg_image_desc* desc, sg_image img_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_IMAGE;
+ item->cmd = _SGIMGUI_CMD_MAKE_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_image.result = img_id;
}
@@ -2356,11 +2322,11 @@ _SOKOL_PRIVATE void _sgimgui_make_image(const sg_image_desc* desc, sg_image img_
}
_SOKOL_PRIVATE void _sgimgui_make_sampler(const sg_sampler_desc* desc, sg_sampler smp_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_MAKE_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_sampler.result = smp_id;
}
@@ -2373,11 +2339,11 @@ _SOKOL_PRIVATE void _sgimgui_make_sampler(const sg_sampler_desc* desc, sg_sample
}
_SOKOL_PRIVATE void _sgimgui_make_shader(const sg_shader_desc* desc, sg_shader shd_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_SHADER;
+ item->cmd = _SGIMGUI_CMD_MAKE_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_shader.result = shd_id;
}
@@ -2390,11 +2356,11 @@ _SOKOL_PRIVATE void _sgimgui_make_shader(const sg_shader_desc* desc, sg_shader s
}
_SOKOL_PRIVATE void _sgimgui_make_pipeline(const sg_pipeline_desc* desc, sg_pipeline pip_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_MAKE_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_pipeline.result = pip_id;
}
@@ -2407,11 +2373,11 @@ _SOKOL_PRIVATE void _sgimgui_make_pipeline(const sg_pipeline_desc* desc, sg_pipe
}
_SOKOL_PRIVATE void _sgimgui_make_view(const sg_view_desc* desc, sg_view view_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_MAKE_VIEW;
+ item->cmd = _SGIMGUI_CMD_MAKE_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.make_view.result = view_id;
}
@@ -2424,11 +2390,11 @@ _SOKOL_PRIVATE void _sgimgui_make_view(const sg_view_desc* desc, sg_view view_id
}
_SOKOL_PRIVATE void _sgimgui_destroy_buffer(sg_buffer buf, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_BUFFER;
+ item->cmd = _SGIMGUI_CMD_DESTROY_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_buffer.buffer = buf;
}
@@ -2441,11 +2407,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_buffer(sg_buffer buf, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_destroy_image(sg_image img, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_IMAGE;
+ item->cmd = _SGIMGUI_CMD_DESTROY_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_image.image = img;
}
@@ -2458,11 +2424,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_image(sg_image img, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_destroy_sampler(sg_sampler smp, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_DESTROY_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_sampler.sampler = smp;
}
@@ -2475,11 +2441,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_sampler(sg_sampler smp, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_destroy_shader(sg_shader shd, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_SHADER;
+ item->cmd = _SGIMGUI_CMD_DESTROY_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_shader.shader = shd;
}
@@ -2492,11 +2458,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_shader(sg_shader shd, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_destroy_pipeline(sg_pipeline pip, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_DESTROY_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_pipeline.pipeline = pip;
}
@@ -2509,11 +2475,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_pipeline(sg_pipeline pip, void* user_data)
}
_SOKOL_PRIVATE void _sgimgui_destroy_view(sg_view view, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DESTROY_VIEW;
+ item->cmd = _SGIMGUI_CMD_DESTROY_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.destroy_view.view = view;
}
@@ -2526,11 +2492,11 @@ _SOKOL_PRIVATE void _sgimgui_destroy_view(sg_view view, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_update_buffer(sg_buffer buf, const sg_range* data, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UPDATE_BUFFER;
+ item->cmd = _SGIMGUI_CMD_UPDATE_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.update_buffer.buffer = buf;
item->args.update_buffer.data_size = data->size;
@@ -2541,11 +2507,11 @@ _SOKOL_PRIVATE void _sgimgui_update_buffer(sg_buffer buf, const sg_range* data,
}
_SOKOL_PRIVATE void _sgimgui_update_image(sg_image img, const sg_image_data* data, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UPDATE_IMAGE;
+ item->cmd = _SGIMGUI_CMD_UPDATE_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.update_image.image = img;
}
@@ -2555,11 +2521,11 @@ _SOKOL_PRIVATE void _sgimgui_update_image(sg_image img, const sg_image_data* dat
}
_SOKOL_PRIVATE void _sgimgui_append_buffer(sg_buffer buf, const sg_range* data, int result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_APPEND_BUFFER;
+ item->cmd = _SGIMGUI_CMD_APPEND_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.append_buffer.buffer = buf;
item->args.append_buffer.data_size = data->size;
@@ -2571,12 +2537,12 @@ _SOKOL_PRIVATE void _sgimgui_append_buffer(sg_buffer buf, const sg_range* data,
}
_SOKOL_PRIVATE void _sgimgui_begin_pass(const sg_pass* pass, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
SOKOL_ASSERT(pass);
- item->cmd = SGIMGUI_CMD_BEGIN_PASS;
+ item->cmd = _SGIMGUI_CMD_BEGIN_PASS;
item->color = _SGIMGUI_COLOR_PASS;
item->args.begin_pass.pass = *pass;
}
@@ -2586,11 +2552,11 @@ _SOKOL_PRIVATE void _sgimgui_begin_pass(const sg_pass* pass, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_apply_viewport(int x, int y, int width, int height, bool origin_top_left, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_APPLY_VIEWPORT;
+ item->cmd = _SGIMGUI_CMD_APPLY_VIEWPORT;
item->color = _SGIMGUI_COLOR_APPLY;
item->args.apply_viewport.x = x;
item->args.apply_viewport.y = y;
@@ -2604,11 +2570,11 @@ _SOKOL_PRIVATE void _sgimgui_apply_viewport(int x, int y, int width, int height,
}
_SOKOL_PRIVATE void _sgimgui_apply_scissor_rect(int x, int y, int width, int height, bool origin_top_left, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_APPLY_SCISSOR_RECT;
+ item->cmd = _SGIMGUI_CMD_APPLY_SCISSOR_RECT;
item->color = _SGIMGUI_COLOR_APPLY;
item->args.apply_scissor_rect.x = x;
item->args.apply_scissor_rect.y = y;
@@ -2622,12 +2588,12 @@ _SOKOL_PRIVATE void _sgimgui_apply_scissor_rect(int x, int y, int width, int hei
}
_SOKOL_PRIVATE void _sgimgui_apply_pipeline(sg_pipeline pip, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
ctx->cur_pipeline = pip; /* stored for _sgimgui_apply_uniforms */
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_APPLY_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_APPLY_PIPELINE;
item->color = _SGIMGUI_COLOR_APPLY;
item->args.apply_pipeline.pipeline = pip;
}
@@ -2637,12 +2603,12 @@ _SOKOL_PRIVATE void _sgimgui_apply_pipeline(sg_pipeline pip, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_apply_bindings(const sg_bindings* bindings, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
SOKOL_ASSERT(bindings);
- item->cmd = SGIMGUI_CMD_APPLY_BINDINGS;
+ item->cmd = _SGIMGUI_CMD_APPLY_BINDINGS;
item->color = _SGIMGUI_COLOR_APPLY;
item->args.apply_bindings.bindings = *bindings;
}
@@ -2652,14 +2618,14 @@ _SOKOL_PRIVATE void _sgimgui_apply_bindings(const sg_bindings* bindings, void* u
}
_SOKOL_PRIVATE void _sgimgui_apply_uniforms(int ub_slot, const sg_range* data, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
SOKOL_ASSERT(data);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_APPLY_UNIFORMS;
+ item->cmd = _SGIMGUI_CMD_APPLY_UNIFORMS;
item->color = _SGIMGUI_COLOR_APPLY;
- sgimgui_args_apply_uniforms_t* args = &item->args.apply_uniforms;
+ _sgimgui_args_apply_uniforms_t* args = &item->args.apply_uniforms;
args->ub_slot = ub_slot;
args->data_size = data->size;
args->pipeline = ctx->cur_pipeline;
@@ -2671,11 +2637,11 @@ _SOKOL_PRIVATE void _sgimgui_apply_uniforms(int ub_slot, const sg_range* data, v
}
_SOKOL_PRIVATE void _sgimgui_draw(int base_element, int num_elements, int num_instances, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DRAW;
+ item->cmd = _SGIMGUI_CMD_DRAW;
item->color = _SGIMGUI_COLOR_DRAW;
item->args.draw.base_element = base_element;
item->args.draw.num_elements = num_elements;
@@ -2687,11 +2653,11 @@ _SOKOL_PRIVATE void _sgimgui_draw(int base_element, int num_elements, int num_in
}
_SOKOL_PRIVATE void _sgimgui_draw_ex(int base_element, int num_elements, int num_instances, int base_vertex, int base_instance, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*)user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*)user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DRAW_EX;
+ item->cmd = _SGIMGUI_CMD_DRAW_EX;
item->color = _SGIMGUI_COLOR_DRAW;
item->args.draw_ex.base_element = base_element;
item->args.draw_ex.num_elements = num_elements;
@@ -2705,11 +2671,11 @@ _SOKOL_PRIVATE void _sgimgui_draw_ex(int base_element, int num_elements, int num
}
_SOKOL_PRIVATE void _sgimgui_dispatch(int num_groups_x, int num_groups_y, int num_groups_z, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DISPATCH;
+ item->cmd = _SGIMGUI_CMD_DISPATCH;
item->color = _SGIMGUI_COLOR_DRAW;
item->args.dispatch.num_groups_x = num_groups_x;
item->args.dispatch.num_groups_y = num_groups_y;
@@ -2721,12 +2687,12 @@ _SOKOL_PRIVATE void _sgimgui_dispatch(int num_groups_x, int num_groups_y, int nu
}
_SOKOL_PRIVATE void _sgimgui_end_pass(void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
ctx->cur_pipeline.id = SG_INVALID_ID;
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_END_PASS;
+ item->cmd = _SGIMGUI_CMD_END_PASS;
item->color = _SGIMGUI_COLOR_PASS;
}
if (ctx->hooks.end_pass) {
@@ -2735,11 +2701,11 @@ _SOKOL_PRIVATE void _sgimgui_end_pass(void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_commit(void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_COMMIT;
+ item->cmd = _SGIMGUI_CMD_COMMIT;
item->color = _SGIMGUI_COLOR_OTHER;
}
_sgimgui_capture_next_frame(ctx);
@@ -2749,11 +2715,11 @@ _SOKOL_PRIVATE void _sgimgui_commit(void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_alloc_buffer(sg_buffer result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_BUFFER;
+ item->cmd = _SGIMGUI_CMD_ALLOC_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_buffer.result = result;
}
@@ -2763,11 +2729,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_buffer(sg_buffer result, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_alloc_image(sg_image result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_IMAGE;
+ item->cmd = _SGIMGUI_CMD_ALLOC_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_image.result = result;
}
@@ -2777,11 +2743,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_image(sg_image result, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_alloc_sampler(sg_sampler result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_ALLOC_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_sampler.result = result;
}
@@ -2791,11 +2757,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_sampler(sg_sampler result, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_alloc_shader(sg_shader result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_SHADER;
+ item->cmd = _SGIMGUI_CMD_ALLOC_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_shader.result = result;
}
@@ -2805,11 +2771,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_shader(sg_shader result, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_alloc_pipeline(sg_pipeline result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_ALLOC_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_pipeline.result = result;
}
@@ -2819,11 +2785,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_pipeline(sg_pipeline result, void* user_data)
}
_SOKOL_PRIVATE void _sgimgui_alloc_view(sg_view result, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_ALLOC_VIEW;
+ item->cmd = _SGIMGUI_CMD_ALLOC_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.alloc_view.result = result;
}
@@ -2833,11 +2799,11 @@ _SOKOL_PRIVATE void _sgimgui_alloc_view(sg_view result, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_dealloc_buffer(sg_buffer buf_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_BUFFER;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_buffer.buffer = buf_id;
}
@@ -2847,11 +2813,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_buffer(sg_buffer buf_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_dealloc_image(sg_image img_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_IMAGE;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_image.image = img_id;
}
@@ -2861,11 +2827,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_image(sg_image img_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_dealloc_sampler(sg_sampler smp_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_sampler.sampler = smp_id;
}
@@ -2875,11 +2841,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_sampler(sg_sampler smp_id, void* user_data)
}
_SOKOL_PRIVATE void _sgimgui_dealloc_shader(sg_shader shd_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_SHADER;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_shader.shader = shd_id;
}
@@ -2889,11 +2855,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_shader(sg_shader shd_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_dealloc_pipeline(sg_pipeline pip_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_pipeline.pipeline = pip_id;
}
@@ -2903,11 +2869,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_pipeline(sg_pipeline pip_id, void* user_dat
}
_SOKOL_PRIVATE void _sgimgui_dealloc_view(sg_view view_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_DEALLOC_VIEW;
+ item->cmd = _SGIMGUI_CMD_DEALLOC_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.dealloc_view.view = view_id;
}
@@ -2917,11 +2883,11 @@ _SOKOL_PRIVATE void _sgimgui_dealloc_view(sg_view view_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_init_buffer(sg_buffer buf_id, const sg_buffer_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_BUFFER;
+ item->cmd = _SGIMGUI_CMD_INIT_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_buffer.buffer = buf_id;
}
@@ -2934,11 +2900,11 @@ _SOKOL_PRIVATE void _sgimgui_init_buffer(sg_buffer buf_id, const sg_buffer_desc*
}
_SOKOL_PRIVATE void _sgimgui_init_image(sg_image img_id, const sg_image_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_IMAGE;
+ item->cmd = _SGIMGUI_CMD_INIT_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_image.image = img_id;
}
@@ -2951,11 +2917,11 @@ _SOKOL_PRIVATE void _sgimgui_init_image(sg_image img_id, const sg_image_desc* de
}
_SOKOL_PRIVATE void _sgimgui_init_sampler(sg_sampler smp_id, const sg_sampler_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_INIT_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_sampler.sampler = smp_id;
}
@@ -2968,11 +2934,11 @@ _SOKOL_PRIVATE void _sgimgui_init_sampler(sg_sampler smp_id, const sg_sampler_de
}
_SOKOL_PRIVATE void _sgimgui_init_shader(sg_shader shd_id, const sg_shader_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_SHADER;
+ item->cmd = _SGIMGUI_CMD_INIT_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_shader.shader = shd_id;
}
@@ -2985,11 +2951,11 @@ _SOKOL_PRIVATE void _sgimgui_init_shader(sg_shader shd_id, const sg_shader_desc*
}
_SOKOL_PRIVATE void _sgimgui_init_pipeline(sg_pipeline pip_id, const sg_pipeline_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_INIT_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_pipeline.pipeline = pip_id;
}
@@ -3002,11 +2968,11 @@ _SOKOL_PRIVATE void _sgimgui_init_pipeline(sg_pipeline pip_id, const sg_pipeline
}
_SOKOL_PRIVATE void _sgimgui_init_view(sg_view view_id, const sg_view_desc* desc, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_INIT_VIEW;
+ item->cmd = _SGIMGUI_CMD_INIT_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.init_view.view = view_id;
}
@@ -3019,11 +2985,11 @@ _SOKOL_PRIVATE void _sgimgui_init_view(sg_view view_id, const sg_view_desc* desc
}
_SOKOL_PRIVATE void _sgimgui_uninit_buffer(sg_buffer buf, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_BUFFER;
+ item->cmd = _SGIMGUI_CMD_UNINIT_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_buffer.buffer = buf;
}
@@ -3036,11 +3002,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_buffer(sg_buffer buf, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_uninit_image(sg_image img, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_IMAGE;
+ item->cmd = _SGIMGUI_CMD_UNINIT_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_image.image = img;
}
@@ -3053,11 +3019,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_image(sg_image img, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_uninit_sampler(sg_sampler smp, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_UNINIT_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_sampler.sampler = smp;
}
@@ -3070,11 +3036,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_sampler(sg_sampler smp, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_uninit_shader(sg_shader shd, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_SHADER;
+ item->cmd = _SGIMGUI_CMD_UNINIT_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_shader.shader = shd;
}
@@ -3087,11 +3053,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_shader(sg_shader shd, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_uninit_pipeline(sg_pipeline pip, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_UNINIT_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_pipeline.pipeline = pip;
}
@@ -3104,11 +3070,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_pipeline(sg_pipeline pip, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_uninit_view(sg_view view, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_UNINIT_VIEW;
+ item->cmd = _SGIMGUI_CMD_UNINIT_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.uninit_view.view = view;
}
@@ -3121,11 +3087,11 @@ _SOKOL_PRIVATE void _sgimgui_uninit_view(sg_view view, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_fail_buffer(sg_buffer buf_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_BUFFER;
+ item->cmd = _SGIMGUI_CMD_FAIL_BUFFER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_buffer.buffer = buf_id;
}
@@ -3135,11 +3101,11 @@ _SOKOL_PRIVATE void _sgimgui_fail_buffer(sg_buffer buf_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_fail_image(sg_image img_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_IMAGE;
+ item->cmd = _SGIMGUI_CMD_FAIL_IMAGE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_image.image = img_id;
}
@@ -3149,11 +3115,11 @@ _SOKOL_PRIVATE void _sgimgui_fail_image(sg_image img_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_fail_sampler(sg_sampler smp_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_SAMPLER;
+ item->cmd = _SGIMGUI_CMD_FAIL_SAMPLER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_sampler.sampler = smp_id;
}
@@ -3163,11 +3129,11 @@ _SOKOL_PRIVATE void _sgimgui_fail_sampler(sg_sampler smp_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_fail_shader(sg_shader shd_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_SHADER;
+ item->cmd = _SGIMGUI_CMD_FAIL_SHADER;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_shader.shader = shd_id;
}
@@ -3177,11 +3143,11 @@ _SOKOL_PRIVATE void _sgimgui_fail_shader(sg_shader shd_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_fail_pipeline(sg_pipeline pip_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_PIPELINE;
+ item->cmd = _SGIMGUI_CMD_FAIL_PIPELINE;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_pipeline.pipeline = pip_id;
}
@@ -3191,11 +3157,11 @@ _SOKOL_PRIVATE void _sgimgui_fail_pipeline(sg_pipeline pip_id, void* user_data)
}
_SOKOL_PRIVATE void _sgimgui_fail_view(sg_view view_id, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_FAIL_VIEW;
+ item->cmd = _SGIMGUI_CMD_FAIL_VIEW;
item->color = _SGIMGUI_COLOR_RSRC;
item->args.fail_view.view = view_id;
}
@@ -3205,7 +3171,7 @@ _SOKOL_PRIVATE void _sgimgui_fail_view(sg_view view_id, void* user_data) {
}
_SOKOL_PRIVATE void _sgimgui_push_debug_group(const char* name, void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
if (0 == strcmp(name, "sokol-imgui")) {
ctx->frame_stats_window.in_sokol_imgui = true;
@@ -3213,9 +3179,9 @@ _SOKOL_PRIVATE void _sgimgui_push_debug_group(const char* name, void* user_data)
sg_disable_stats();
}
}
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_PUSH_DEBUG_GROUP;
+ item->cmd = _SGIMGUI_CMD_PUSH_DEBUG_GROUP;
item->color = _SGIMGUI_COLOR_OTHER;
item->args.push_debug_group.name = _sgimgui_make_str(name);
}
@@ -3225,7 +3191,7 @@ _SOKOL_PRIVATE void _sgimgui_push_debug_group(const char* name, void* user_data)
}
_SOKOL_PRIVATE void _sgimgui_pop_debug_group(void* user_data) {
- sgimgui_t* ctx = (sgimgui_t*) user_data;
+ _sgimgui_t* ctx = (_sgimgui_t*) user_data;
SOKOL_ASSERT(ctx);
if (ctx->frame_stats_window.in_sokol_imgui) {
ctx->frame_stats_window.in_sokol_imgui = false;
@@ -3233,9 +3199,9 @@ _SOKOL_PRIVATE void _sgimgui_pop_debug_group(void* user_data) {
sg_enable_stats();
}
}
- sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_next_write_item(ctx);
if (item) {
- item->cmd = SGIMGUI_CMD_POP_DEBUG_GROUP;
+ item->cmd = _SGIMGUI_CMD_POP_DEBUG_GROUP;
item->color = _SGIMGUI_COLOR_OTHER;
}
if (ctx->hooks.pop_debug_group) {
@@ -3244,7 +3210,7 @@ _SOKOL_PRIVATE void _sgimgui_pop_debug_group(void* user_data) {
}
/*--- IMGUI HELPERS ----------------------------------------------------------*/
-_SOKOL_PRIVATE void _sgimgui_draw_image(sgimgui_t* ctx, sg_image img, float* opt_scale_ptr, float max_width) {
+_SOKOL_PRIVATE void _sgimgui_draw_image(_sgimgui_t* ctx, sg_image img, float* opt_scale_ptr, float max_width) {
if (sg_query_image_state(img) != SG_RESOURCESTATE_VALID) {
_sgimgui_igtext("Image not in valid state.");
return;
@@ -3252,7 +3218,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_image(sgimgui_t* ctx, sg_image img, float* opt
// try to find a texture view for the image
sg_view view = {SG_INVALID_ID};
for (int i = 0; i < ctx->view_window.num_slots; i++) {
- const sgimgui_view_t* view_ui = &ctx->view_window.slots[i];
+ const _sgimgui_view_t* view_ui = &ctx->view_window.slots[i];
view = view_ui->res_id;
if (sg_query_view_type(view) == SG_VIEWTYPE_TEXTURE) {
sg_image view_img = sg_query_view_image(view);
@@ -3291,7 +3257,7 @@ _SOKOL_PRIVATE bool _sgimgui_draw_resid_list_item(uint32_t res_id, const char* l
if (label[0]) {
res = _sgimgui_igselectableex(label, selected, 0, IMVEC2(0,0));
} else {
- sgimgui_str_t str;
+ _sgimgui_str_t str;
_sgimgui_snprintf(&str, "0x%08X", res_id);
res = _sgimgui_igselectableex(str.buf, selected, 0, IMVEC2(0,0));
}
@@ -3301,7 +3267,7 @@ _SOKOL_PRIVATE bool _sgimgui_draw_resid_list_item(uint32_t res_id, const char* l
_SOKOL_PRIVATE bool _sgimgui_draw_resid_link(uint32_t res_type, uint32_t res_id, const char* label) {
SOKOL_ASSERT(label);
- sgimgui_str_t str_buf;
+ _sgimgui_str_t str_buf;
const char* str;
if (label[0]) {
str = label;
@@ -3315,46 +3281,46 @@ _SOKOL_PRIVATE bool _sgimgui_draw_resid_link(uint32_t res_type, uint32_t res_id,
return res;
}
-_SOKOL_PRIVATE bool _sgimgui_draw_buffer_link(sgimgui_t* ctx, sg_buffer buf) {
+_SOKOL_PRIVATE bool _sgimgui_draw_buffer_link(_sgimgui_t* ctx, sg_buffer buf) {
bool retval = false;
if (buf.id != SG_INVALID_ID) {
- const sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf.id)];
+ const _sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf.id)];
retval = _sgimgui_draw_resid_link(1, buf.id, buf_ui->label.buf);
}
return retval;
}
-_SOKOL_PRIVATE bool _sgimgui_draw_image_link(sgimgui_t* ctx, sg_image img) {
+_SOKOL_PRIVATE bool _sgimgui_draw_image_link(_sgimgui_t* ctx, sg_image img) {
bool retval = false;
if (img.id != SG_INVALID_ID) {
- const sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img.id)];
+ const _sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img.id)];
retval = _sgimgui_draw_resid_link(2, img.id, img_ui->label.buf);
}
return retval;
}
-_SOKOL_PRIVATE bool _sgimgui_draw_sampler_link(sgimgui_t* ctx, sg_sampler smp) {
+_SOKOL_PRIVATE bool _sgimgui_draw_sampler_link(_sgimgui_t* ctx, sg_sampler smp) {
bool retval = false;
if (smp.id != SG_INVALID_ID) {
- const sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp.id)];
+ const _sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp.id)];
retval = _sgimgui_draw_resid_link(3, smp.id, smp_ui->label.buf);
}
return retval;
}
-_SOKOL_PRIVATE bool _sgimgui_draw_shader_link(sgimgui_t* ctx, sg_shader shd) {
+_SOKOL_PRIVATE bool _sgimgui_draw_shader_link(_sgimgui_t* ctx, sg_shader shd) {
bool retval = false;
if (shd.id != SG_INVALID_ID) {
- const sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd.id)];
+ const _sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd.id)];
retval = _sgimgui_draw_resid_link(4, shd.id, shd_ui->label.buf);
}
return retval;
}
-_SOKOL_PRIVATE bool _sgimgui_draw_view_link(sgimgui_t* ctx, sg_view view) {
+_SOKOL_PRIVATE bool _sgimgui_draw_view_link(_sgimgui_t* ctx, sg_view view) {
bool retval = false;
if (view.id != SG_INVALID_ID) {
- const sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
+ const _sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
retval = _sgimgui_draw_resid_link(5, view.id, view_ui->label.buf);
if (_sgimgui_igisitemhovered(0)) {
sg_image img = sg_query_view_image(view);
@@ -3369,32 +3335,32 @@ _SOKOL_PRIVATE bool _sgimgui_draw_view_link(sgimgui_t* ctx, sg_view view) {
return retval;
}
-_SOKOL_PRIVATE void _sgimgui_show_buffer(sgimgui_t* ctx, sg_buffer buf) {
+_SOKOL_PRIVATE void _sgimgui_show_buffer(_sgimgui_t* ctx, sg_buffer buf) {
ctx->buffer_window.open = true;
ctx->buffer_window.sel_buf = buf;
}
-_SOKOL_PRIVATE void _sgimgui_show_image(sgimgui_t* ctx, sg_image img) {
+_SOKOL_PRIVATE void _sgimgui_show_image(_sgimgui_t* ctx, sg_image img) {
ctx->image_window.open = true;
ctx->image_window.sel_img = img;
}
-_SOKOL_PRIVATE void _sgimgui_show_sampler(sgimgui_t* ctx, sg_sampler smp) {
+_SOKOL_PRIVATE void _sgimgui_show_sampler(_sgimgui_t* ctx, sg_sampler smp) {
ctx->sampler_window.open = true;
ctx->sampler_window.sel_smp = smp;
}
-_SOKOL_PRIVATE void _sgimgui_show_shader(sgimgui_t* ctx, sg_shader shd) {
+_SOKOL_PRIVATE void _sgimgui_show_shader(_sgimgui_t* ctx, sg_shader shd) {
ctx->shader_window.open = true;
ctx->shader_window.sel_shd = shd;
}
-_SOKOL_PRIVATE void _sgimgui_show_view(sgimgui_t* ctx, sg_view view) {
+_SOKOL_PRIVATE void _sgimgui_show_view(_sgimgui_t* ctx, sg_view view) {
ctx->view_window.open = true;
ctx->view_window.sel_view = view;
}
-_SOKOL_PRIVATE void _sgimgui_draw_buffer_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_buffer_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("buffer_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 0; i < ctx->buffer_window.num_slots; i++) {
sg_buffer buf = ctx->buffer_window.slots[i].res_id;
@@ -3409,7 +3375,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_buffer_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_image_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_image_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("image_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 0; i < ctx->image_window.num_slots; i++) {
sg_image img = ctx->image_window.slots[i].res_id;
@@ -3424,7 +3390,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_image_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_sampler_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_sampler_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("sampler_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 0; i < ctx->sampler_window.num_slots; i++) {
sg_sampler smp = ctx->sampler_window.slots[i].res_id;
@@ -3439,7 +3405,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_sampler_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_shader_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_shader_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("shader_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 0; i < ctx->shader_window.num_slots; i++) {
sg_shader shd = ctx->shader_window.slots[i].res_id;
@@ -3454,7 +3420,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_shader_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_pipeline_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_pipeline_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("pipeline_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 1; i < ctx->pipeline_window.num_slots; i++) {
sg_pipeline pip = ctx->pipeline_window.slots[i].res_id;
@@ -3469,7 +3435,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_pipeline_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_view_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_view_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("view_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
for (int i = 1; i < ctx->view_window.num_slots; i++) {
sg_view view = ctx->view_window.slots[i].res_id;
@@ -3484,16 +3450,16 @@ _SOKOL_PRIVATE void _sgimgui_draw_view_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_capture_list(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_capture_list(_sgimgui_t* ctx) {
_sgimgui_igbeginchild("capture_list", IMVEC2(_SGIMGUI_LIST_WIDTH,0), true, 0);
const int num_items = _sgimgui_capture_num_read_items(ctx);
uint64_t group_stack = 1; /* bit set: group unfolded, cleared: folded */
for (int i = 0; i < num_items; i++) {
- const sgimgui_capture_item_t* item = _sgimgui_capture_read_item_at(ctx, i);
- sgimgui_str_t item_string = _sgimgui_capture_item_string(ctx, i, item);
+ const _sgimgui_capture_item_t* item = _sgimgui_capture_read_item_at(ctx, i);
+ _sgimgui_str_t item_string = _sgimgui_capture_item_string(ctx, i, item);
_sgimgui_igpushstylecolor(ImGuiCol_Text, item->color);
_sgimgui_igpushidint(i);
- if (item->cmd == SGIMGUI_CMD_PUSH_DEBUG_GROUP) {
+ if (item->cmd == _SGIMGUI_CMD_PUSH_DEBUG_GROUP) {
if (group_stack & 1) {
group_stack <<= 1;
const char* group_name = item->args.push_debug_group.name.buf;
@@ -3503,7 +3469,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_capture_list(sgimgui_t* ctx) {
} else {
group_stack <<= 1;
}
- } else if (item->cmd == SGIMGUI_CMD_POP_DEBUG_GROUP) {
+ } else if (item->cmd == _SGIMGUI_CMD_POP_DEBUG_GROUP) {
if (group_stack & 1) {
_sgimgui_igtreepop();
}
@@ -3522,12 +3488,12 @@ _SOKOL_PRIVATE void _sgimgui_draw_capture_list(sgimgui_t* ctx) {
_sgimgui_igendchild();
}
-_SOKOL_PRIVATE void _sgimgui_draw_buffer_panel(sgimgui_t* ctx, sg_buffer buf) {
+_SOKOL_PRIVATE void _sgimgui_draw_buffer_panel(_sgimgui_t* ctx, sg_buffer buf) {
if (buf.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("buffer", IMVEC2(0,0), false, 0);
sg_buffer_info info = sg_query_buffer_info(buf);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- const sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf.id)];
+ const _sgimgui_buffer_t* buf_ui = &ctx->buffer_window.slots[_sgimgui_slot_index(buf.id)];
_sgimgui_igtext("Label: %s", buf_ui->label.buf[0] ? buf_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
_sgimgui_igseparator();
@@ -3555,12 +3521,12 @@ _SOKOL_PRIVATE void _sgimgui_draw_buffer_panel(sgimgui_t* ctx, sg_buffer buf) {
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_image_panel(sgimgui_t* ctx, sg_image img) {
+_SOKOL_PRIVATE void _sgimgui_draw_image_panel(_sgimgui_t* ctx, sg_image img) {
if (img.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("image", IMVEC2(0,0), false, 0);
sg_image_info info = sg_query_image_info(img);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img.id)];
+ _sgimgui_image_t* img_ui = &ctx->image_window.slots[_sgimgui_slot_index(img.id)];
const sg_image_desc* desc = &img_ui->desc;
_sgimgui_igtext("Label: %s", img_ui->label.buf[0] ? img_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
@@ -3595,12 +3561,12 @@ _SOKOL_PRIVATE void _sgimgui_draw_image_panel(sgimgui_t* ctx, sg_image img) {
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_sampler_panel(sgimgui_t* ctx, sg_sampler smp) {
+_SOKOL_PRIVATE void _sgimgui_draw_sampler_panel(_sgimgui_t* ctx, sg_sampler smp) {
if (smp.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("sampler", IMVEC2(0,0), false, 0);
sg_sampler_info info = sg_query_sampler_info(smp);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp.id)];
+ _sgimgui_sampler_t* smp_ui = &ctx->sampler_window.slots[_sgimgui_slot_index(smp.id)];
const sg_sampler_desc* desc = &smp_ui->desc;
_sgimgui_igtext("Label: %s", smp_ui->label.buf[0] ? smp_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
@@ -3650,12 +3616,12 @@ _SOKOL_PRIVATE void _sgimgui_draw_shader_func(const char* title, const sg_shader
_sgimgui_igpopid();
}
-_SOKOL_PRIVATE void _sgimgui_draw_shader_panel(sgimgui_t* ctx, sg_shader shd) {
+_SOKOL_PRIVATE void _sgimgui_draw_shader_panel(_sgimgui_t* ctx, sg_shader shd) {
if (shd.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("shader", IMVEC2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar);
sg_shader_info info = sg_query_shader_info(shd);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- const sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd.id)];
+ const _sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(shd.id)];
_sgimgui_igtext("Label: %s", shd_ui->label.buf[0] ? shd_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
_sgimgui_igseparator();
@@ -3907,12 +3873,12 @@ _SOKOL_PRIVATE void _sgimgui_draw_color_target_state(const sg_color_target_state
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_pipeline_panel(sgimgui_t* ctx, sg_pipeline pip) {
+_SOKOL_PRIVATE void _sgimgui_draw_pipeline_panel(_sgimgui_t* ctx, sg_pipeline pip) {
if (pip.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("pipeline", IMVEC2(0,0), false, 0);
sg_pipeline_info info = sg_query_pipeline_info(pip);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- const sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(pip.id)];
+ const _sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(pip.id)];
_sgimgui_igtext("Label: %s", pip_ui->label.buf[0] ? pip_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
_sgimgui_igseparator();
@@ -3936,7 +3902,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_pipeline_panel(sgimgui_t* ctx, sg_pipeline pip
}
_sgimgui_igtext("Color Count: %d", pip_ui->desc.color_count);
for (int i = 0; i < pip_ui->desc.color_count; i++) {
- sgimgui_str_t str;
+ _sgimgui_str_t str;
_sgimgui_snprintf(&str, "Color Target %d", i);
if (_sgimgui_igtreenode(str.buf)) {
_sgimgui_draw_color_target_state(&pip_ui->desc.colors[i]);
@@ -3948,7 +3914,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_pipeline_panel(sgimgui_t* ctx, sg_pipeline pip
_sgimgui_igtext("Cull Mode: %s", _sgimgui_cullmode_string(pip_ui->desc.cull_mode));
_sgimgui_igtext("Face Winding: %s", _sgimgui_facewinding_string(pip_ui->desc.face_winding));
_sgimgui_igtext("Sample Count: %d", pip_ui->desc.sample_count);
- sgimgui_str_t blend_color_str;
+ _sgimgui_str_t blend_color_str;
_sgimgui_igtext("Blend Color: %s", _sgimgui_color_string(&blend_color_str, pip_ui->desc.blend_color));
_sgimgui_igtext("Alpha To Coverage: %s", _sgimgui_bool_string(pip_ui->desc.alpha_to_coverage_enabled));
}
@@ -3959,7 +3925,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_pipeline_panel(sgimgui_t* ctx, sg_pipeline pip
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_buffer_view(sgimgui_t* ctx, const char* title, const sg_buffer_view_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_draw_buffer_view(_sgimgui_t* ctx, const char* title, const sg_buffer_view_desc* desc) {
_sgimgui_igtext("%s: ", title);
_sgimgui_igtext(" Buffer: "); _sgimgui_igsameline();
if (_sgimgui_draw_buffer_link(ctx, desc->buffer)) {
@@ -3968,7 +3934,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_buffer_view(sgimgui_t* ctx, const char* title,
_sgimgui_igtext(" Offset: %d", desc->offset);
}
-_SOKOL_PRIVATE void _sgimgui_draw_image_view(sgimgui_t* ctx, const char* title, sg_view view, const sg_image_view_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_draw_image_view(_sgimgui_t* ctx, const char* title, sg_view view, const sg_image_view_desc* desc) {
_sgimgui_igtext("%s: ", title);
_sgimgui_igtext(" Image: "); _sgimgui_igsameline();
if (_sgimgui_draw_image_link(ctx, desc->image)) {
@@ -3977,11 +3943,11 @@ _SOKOL_PRIVATE void _sgimgui_draw_image_view(sgimgui_t* ctx, const char* title,
_sgimgui_igtext(" Mip Level: %d", desc->mip_level);
_sgimgui_igtext(" Slice: %d", desc->slice);
_sgimgui_igseparator();
- sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
+ _sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
_sgimgui_draw_image(ctx, desc->image, &view_ui->ui_scale, 4096.0f);
}
-_SOKOL_PRIVATE void _sgimgui_draw_texture_view(sgimgui_t* ctx, const char* title, sg_view view, const sg_texture_view_desc* desc) {
+_SOKOL_PRIVATE void _sgimgui_draw_texture_view(_sgimgui_t* ctx, const char* title, sg_view view, const sg_texture_view_desc* desc) {
_sgimgui_igtext("%s: ", title);
_sgimgui_igtext(" Image: "); _sgimgui_igsameline();
if (_sgimgui_draw_image_link(ctx, desc->image)) {
@@ -3992,16 +3958,16 @@ _SOKOL_PRIVATE void _sgimgui_draw_texture_view(sgimgui_t* ctx, const char* title
_sgimgui_igtext(" Slices Base: %d", desc->slices.base);
_sgimgui_igtext(" Slices Count: %d", desc->slices.count);
_sgimgui_igseparator();
- sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
+ _sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
_sgimgui_draw_image(ctx, desc->image, &view_ui->ui_scale, 4096.0f);
}
-_SOKOL_PRIVATE void _sgimgui_draw_view_panel(sgimgui_t* ctx, sg_view view) {
+_SOKOL_PRIVATE void _sgimgui_draw_view_panel(_sgimgui_t* ctx, sg_view view) {
if (view.id != SG_INVALID_ID) {
_sgimgui_igbeginchild("view", IMVEC2(0,0), false, 0);
sg_view_info info = sg_query_view_info(view);
if (info.slot.state == SG_RESOURCESTATE_VALID) {
- sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
+ _sgimgui_view_t* view_ui = &ctx->view_window.slots[_sgimgui_slot_index(view.id)];
_sgimgui_igtext("Label: %s", view_ui->label.buf[0] ? view_ui->label.buf : "---");
_sgimgui_draw_resource_slot(&info.slot);
_sgimgui_igseparator();
@@ -4036,7 +4002,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_view_panel(sgimgui_t* ctx, sg_view view) {
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_bindings_panel(sgimgui_t* ctx, const sg_bindings* bnd) {
+_SOKOL_PRIVATE void _sgimgui_draw_bindings_panel(_sgimgui_t* ctx, const sg_bindings* bnd) {
_sgimgui_igpushid("bnd_vbufs");
for (int i = 0; i < SG_MAX_VERTEXBUFFER_BINDSLOTS; i++) {
sg_buffer buf = bnd->vertex_buffers[i];
@@ -4087,22 +4053,22 @@ _SOKOL_PRIVATE void _sgimgui_draw_bindings_panel(sgimgui_t* ctx, const sg_bindin
_sgimgui_igpopid();
}
-_SOKOL_PRIVATE void _sgimgui_draw_uniforms_panel(sgimgui_t* ctx, const sgimgui_args_apply_uniforms_t* args) {
+_SOKOL_PRIVATE void _sgimgui_draw_uniforms_panel(_sgimgui_t* ctx, const _sgimgui_args_apply_uniforms_t* args) {
SOKOL_ASSERT(args->ub_slot < SG_MAX_UNIFORMBLOCK_BINDSLOTS);
/* check if all the required information for drawing the structured uniform block content
is available, otherwise just render a generic hexdump
*/
- if (sg_query_pipeline_state(args->pipeline) != SG_RESOURCESTATE_VALID) {
+ if (sg_query_pipeline_state(args->pipeline) != SG_RESOURCESTATE_VALID) {
_sgimgui_igtext("Pipeline object not valid!");
return;
- }
- sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(args->pipeline.id)];
+ }
+ _sgimgui_pipeline_t* pip_ui = &ctx->pipeline_window.slots[_sgimgui_slot_index(args->pipeline.id)];
if (sg_query_shader_state(pip_ui->desc.shader) != SG_RESOURCESTATE_VALID) {
_sgimgui_igtext("Shader object not valid!");
return;
}
- sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(pip_ui->desc.shader.id)];
+ _sgimgui_shader_t* shd_ui = &ctx->shader_window.slots[_sgimgui_slot_index(pip_ui->desc.shader.id)];
SOKOL_ASSERT(shd_ui->res_id.id == pip_ui->desc.shader.id);
const sg_shader_uniform_block* ub_desc = &shd_ui->desc.uniform_blocks[args->ub_slot];
SOKOL_ASSERT(args->data_size <= ub_desc->size);
@@ -4111,7 +4077,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_uniforms_panel(sgimgui_t* ctx, const sgimgui_a
draw_dump = true;
}
- sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
+ _sgimgui_capture_bucket_t* bucket = _sgimgui_capture_get_read_bucket(ctx);
SOKOL_ASSERT((args->ubuf_pos + args->data_size) <= bucket->ubuf_size);
const float* uptrf = (const float*) (bucket->ubuf + args->ubuf_pos);
const int32_t* uptri32 = (const int32_t*) uptrf;
@@ -4191,7 +4157,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_passaction_panel(const sg_pass_action* action,
for (int i = 0; i < num_color_atts; i++) {
const sg_color_attachment_action* c_att = &action->colors[i];
_sgimgui_igtext(" Color Attachment %d:", i);
- sgimgui_str_t color_str;
+ _sgimgui_str_t color_str;
switch (c_att->load_action) {
case SG_LOADACTION_LOAD: _sgimgui_igtext(" SG_LOADACTION_LOAD"); break;
case SG_LOADACTION_DONTCARE: _sgimgui_igtext(" SG_LOADACTION_DONTCARE"); break;
@@ -4234,7 +4200,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_passaction_panel(const sg_pass_action* action,
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_attachments_panel(sgimgui_t* ctx, const sg_attachments* atts, int num_color_atts) {
+_SOKOL_PRIVATE void _sgimgui_draw_attachments_panel(_sgimgui_t* ctx, const sg_attachments* atts, int num_color_atts) {
_sgimgui_igtext("Attachments:");
for (int i = 0; i < num_color_atts; i++) {
if (atts->colors[i].id!= SG_INVALID_ID) {
@@ -4314,7 +4280,7 @@ _SOKOL_PRIVATE void _sgimgui_draw_swapchain_panel(sg_swapchain* swapchain) {
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_pass_panel(sgimgui_t* ctx, sg_pass* pass) {
+_SOKOL_PRIVATE void _sgimgui_draw_pass_panel(_sgimgui_t* ctx, sg_pass* pass) {
bool is_compute_pass = pass->compute;
bool is_attachments_pass = false;
bool is_swapchain_pass = false;
@@ -4347,138 +4313,138 @@ _SOKOL_PRIVATE void _sgimgui_draw_pass_panel(sgimgui_t* ctx, sg_pass* pass) {
}
}
-_SOKOL_PRIVATE void _sgimgui_draw_capture_panel(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_capture_panel(_sgimgui_t* ctx) {
int sel_item_index = ctx->capture_window.sel_item;
if (sel_item_index >= _sgimgui_capture_num_read_items(ctx)) {
return;
}
- sgimgui_capture_item_t* item = _sgimgui_capture_read_item_at(ctx, sel_item_index);
+ _sgimgui_capture_item_t* item = _sgimgui_capture_read_item_at(ctx, sel_item_index);
_sgimgui_igbeginchild("capture_item", IMVEC2(0, 0), false, 0);
_sgimgui_igpushstylecolor(ImGuiCol_Text, item->color);
_sgimgui_igtext("%s", _sgimgui_capture_item_string(ctx, sel_item_index, item).buf);
_sgimgui_igpopstylecolor();
_sgimgui_igseparator();
switch (item->cmd) {
- case SGIMGUI_CMD_RESET_STATE_CACHE:
+ case _SGIMGUI_CMD_RESET_STATE_CACHE:
break;
- case SGIMGUI_CMD_MAKE_BUFFER:
+ case _SGIMGUI_CMD_MAKE_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.make_buffer.result);
break;
- case SGIMGUI_CMD_MAKE_IMAGE:
+ case _SGIMGUI_CMD_MAKE_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.make_image.result);
break;
- case SGIMGUI_CMD_MAKE_SAMPLER:
+ case _SGIMGUI_CMD_MAKE_SAMPLER:
_sgimgui_draw_sampler_panel(ctx, item->args.make_sampler.result);
break;
- case SGIMGUI_CMD_MAKE_SHADER:
+ case _SGIMGUI_CMD_MAKE_SHADER:
_sgimgui_draw_shader_panel(ctx, item->args.make_shader.result);
break;
- case SGIMGUI_CMD_MAKE_PIPELINE:
+ case _SGIMGUI_CMD_MAKE_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.make_pipeline.result);
break;
- case SGIMGUI_CMD_MAKE_VIEW:
+ case _SGIMGUI_CMD_MAKE_VIEW:
_sgimgui_draw_view_panel(ctx, item->args.make_view.result);
break;
- case SGIMGUI_CMD_DESTROY_BUFFER:
+ case _SGIMGUI_CMD_DESTROY_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.destroy_buffer.buffer);
break;
- case SGIMGUI_CMD_DESTROY_IMAGE:
+ case _SGIMGUI_CMD_DESTROY_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.destroy_image.image);
break;
- case SGIMGUI_CMD_DESTROY_SAMPLER:
+ case _SGIMGUI_CMD_DESTROY_SAMPLER:
_sgimgui_draw_sampler_panel(ctx, item->args.destroy_sampler.sampler);
break;
- case SGIMGUI_CMD_DESTROY_SHADER:
+ case _SGIMGUI_CMD_DESTROY_SHADER:
_sgimgui_draw_shader_panel(ctx, item->args.destroy_shader.shader);
break;
- case SGIMGUI_CMD_DESTROY_PIPELINE:
+ case _SGIMGUI_CMD_DESTROY_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.destroy_pipeline.pipeline);
break;
- case SGIMGUI_CMD_DESTROY_VIEW:
+ case _SGIMGUI_CMD_DESTROY_VIEW:
_sgimgui_draw_view_panel(ctx, item->args.destroy_view.view);
break;
- case SGIMGUI_CMD_UPDATE_BUFFER:
+ case _SGIMGUI_CMD_UPDATE_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.update_buffer.buffer);
break;
- case SGIMGUI_CMD_UPDATE_IMAGE:
+ case _SGIMGUI_CMD_UPDATE_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.update_image.image);
break;
- case SGIMGUI_CMD_APPEND_BUFFER:
+ case _SGIMGUI_CMD_APPEND_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.update_buffer.buffer);
break;
- case SGIMGUI_CMD_BEGIN_PASS:
+ case _SGIMGUI_CMD_BEGIN_PASS:
_sgimgui_draw_pass_panel(ctx, &item->args.begin_pass.pass);
break;
- case SGIMGUI_CMD_APPLY_VIEWPORT:
- case SGIMGUI_CMD_APPLY_SCISSOR_RECT:
+ case _SGIMGUI_CMD_APPLY_VIEWPORT:
+ case _SGIMGUI_CMD_APPLY_SCISSOR_RECT:
break;
- case SGIMGUI_CMD_APPLY_PIPELINE:
+ case _SGIMGUI_CMD_APPLY_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.apply_pipeline.pipeline);
break;
- case SGIMGUI_CMD_APPLY_BINDINGS:
+ case _SGIMGUI_CMD_APPLY_BINDINGS:
_sgimgui_draw_bindings_panel(ctx, &item->args.apply_bindings.bindings);
break;
- case SGIMGUI_CMD_APPLY_UNIFORMS:
+ case _SGIMGUI_CMD_APPLY_UNIFORMS:
_sgimgui_draw_uniforms_panel(ctx, &item->args.apply_uniforms);
break;
- case SGIMGUI_CMD_DRAW:
- case SGIMGUI_CMD_DRAW_EX:
- case SGIMGUI_CMD_DISPATCH:
- case SGIMGUI_CMD_END_PASS:
- case SGIMGUI_CMD_COMMIT:
+ case _SGIMGUI_CMD_DRAW:
+ case _SGIMGUI_CMD_DRAW_EX:
+ case _SGIMGUI_CMD_DISPATCH:
+ case _SGIMGUI_CMD_END_PASS:
+ case _SGIMGUI_CMD_COMMIT:
break;
- case SGIMGUI_CMD_ALLOC_BUFFER:
+ case _SGIMGUI_CMD_ALLOC_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.alloc_buffer.result);
break;
- case SGIMGUI_CMD_ALLOC_IMAGE:
+ case _SGIMGUI_CMD_ALLOC_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.alloc_image.result);
break;
- case SGIMGUI_CMD_ALLOC_SAMPLER:
+ case _SGIMGUI_CMD_ALLOC_SAMPLER:
_sgimgui_draw_sampler_panel(ctx, item->args.alloc_sampler.result);
break;
- case SGIMGUI_CMD_ALLOC_SHADER:
+ case _SGIMGUI_CMD_ALLOC_SHADER:
_sgimgui_draw_shader_panel(ctx, item->args.alloc_shader.result);
break;
- case SGIMGUI_CMD_ALLOC_PIPELINE:
+ case _SGIMGUI_CMD_ALLOC_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.alloc_pipeline.result);
break;
- case SGIMGUI_CMD_ALLOC_VIEW:
+ case _SGIMGUI_CMD_ALLOC_VIEW:
_sgimgui_draw_view_panel(ctx, item->args.alloc_view.result);
break;
- case SGIMGUI_CMD_INIT_BUFFER:
+ case _SGIMGUI_CMD_INIT_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.init_buffer.buffer);
break;
- case SGIMGUI_CMD_INIT_IMAGE:
+ case _SGIMGUI_CMD_INIT_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.init_image.image);
break;
- case SGIMGUI_CMD_INIT_SAMPLER:
+ case _SGIMGUI_CMD_INIT_SAMPLER:
_sgimgui_draw_sampler_panel(ctx, item->args.init_sampler.sampler);
break;
- case SGIMGUI_CMD_INIT_SHADER:
+ case _SGIMGUI_CMD_INIT_SHADER:
_sgimgui_draw_shader_panel(ctx, item->args.init_shader.shader);
break;
- case SGIMGUI_CMD_INIT_PIPELINE:
+ case _SGIMGUI_CMD_INIT_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.init_pipeline.pipeline);
break;
- case SGIMGUI_CMD_INIT_VIEW:
+ case _SGIMGUI_CMD_INIT_VIEW:
_sgimgui_draw_view_panel(ctx, item->args.init_view.view);
break;
- case SGIMGUI_CMD_FAIL_BUFFER:
+ case _SGIMGUI_CMD_FAIL_BUFFER:
_sgimgui_draw_buffer_panel(ctx, item->args.fail_buffer.buffer);
break;
- case SGIMGUI_CMD_FAIL_IMAGE:
+ case _SGIMGUI_CMD_FAIL_IMAGE:
_sgimgui_draw_image_panel(ctx, item->args.fail_image.image);
break;
- case SGIMGUI_CMD_FAIL_SAMPLER:
+ case _SGIMGUI_CMD_FAIL_SAMPLER:
_sgimgui_draw_sampler_panel(ctx, item->args.fail_sampler.sampler);
break;
- case SGIMGUI_CMD_FAIL_SHADER:
+ case _SGIMGUI_CMD_FAIL_SHADER:
_sgimgui_draw_shader_panel(ctx, item->args.fail_shader.shader);
break;
- case SGIMGUI_CMD_FAIL_PIPELINE:
+ case _SGIMGUI_CMD_FAIL_PIPELINE:
_sgimgui_draw_pipeline_panel(ctx, item->args.fail_pipeline.pipeline);
break;
- case SGIMGUI_CMD_FAIL_VIEW:
+ case _SGIMGUI_CMD_FAIL_VIEW:
_sgimgui_draw_view_panel(ctx, item->args.fail_view.view);
break;
default:
@@ -4558,7 +4524,7 @@ _SOKOL_PRIVATE void _sgimgui_frame_add_stats_row(const char* key, uint32_t value
#define _sgimgui_frame_stats(key) _sgimgui_frame_add_stats_row(#key, stats->key)
-_SOKOL_PRIVATE void _sgimgui_draw_frame_stats_panel(sgimgui_t* ctx) {
+_SOKOL_PRIVATE void _sgimgui_draw_frame_stats_panel(_sgimgui_t* ctx) {
_SOKOL_UNUSED(ctx);
_sgimgui_igcheckbox("Ignore sokol_imgui.h", &ctx->frame_stats_window.disable_sokol_imgui_stats);
const sg_stats* stats = &ctx->frame_stats_window.stats;
@@ -4772,17 +4738,17 @@ _SOKOL_PRIVATE sgimgui_desc_t _sgimgui_desc_defaults(const sgimgui_desc_t* desc)
}
/*--- PUBLIC FUNCTIONS -------------------------------------------------------*/
-SOKOL_API_IMPL void sgimgui_init(sgimgui_t* ctx, const sgimgui_desc_t* desc) {
- SOKOL_ASSERT(ctx && desc);
- _sgimgui_clear(ctx, sizeof(sgimgui_t));
- ctx->init_tag = 0xABCDABCD;
- ctx->desc = _sgimgui_desc_defaults(desc);
- _sgimgui_capture_init(ctx);
+SOKOL_API_IMPL void sgimgui_setup(const sgimgui_desc_t* desc) {
+ SOKOL_ASSERT(desc);
+ _sgimgui_clear(&_sgimgui, sizeof(_sgimgui_t));
+ _sgimgui.init_tag = 0xABCDABCD;
+ _sgimgui.desc = _sgimgui_desc_defaults(desc);
+ _sgimgui_capture_init(&_sgimgui);
/* hook into sokol_gfx functions */
sg_trace_hooks hooks;
_sgimgui_clear(&hooks, sizeof(hooks));
- hooks.user_data = (void*) ctx;
+ hooks.user_data = (void*)&_sgimgui;
hooks.reset_state_cache = _sgimgui_reset_state_cache;
hooks.make_buffer = _sgimgui_make_buffer;
hooks.make_image = _sgimgui_make_image;
@@ -4842,295 +4808,356 @@ SOKOL_API_IMPL void sgimgui_init(sgimgui_t* ctx, const sgimgui_desc_t* desc) {
hooks.fail_view = _sgimgui_fail_view;
hooks.push_debug_group = _sgimgui_push_debug_group;
hooks.pop_debug_group = _sgimgui_pop_debug_group;
- ctx->hooks = sg_install_trace_hooks(&hooks);
+ _sgimgui.hooks = sg_install_trace_hooks(&hooks);
/* allocate resource debug-info slots */
const sg_desc sgdesc = sg_query_desc();
- ctx->buffer_window.num_slots = sgdesc.buffer_pool_size;
- ctx->image_window.num_slots = sgdesc.image_pool_size;
- ctx->sampler_window.num_slots = sgdesc.sampler_pool_size;
- ctx->shader_window.num_slots = sgdesc.shader_pool_size;
- ctx->pipeline_window.num_slots = sgdesc.pipeline_pool_size;
- ctx->view_window.num_slots = sgdesc.view_pool_size;
+ _sgimgui.buffer_window.num_slots = sgdesc.buffer_pool_size;
+ _sgimgui.image_window.num_slots = sgdesc.image_pool_size;
+ _sgimgui.sampler_window.num_slots = sgdesc.sampler_pool_size;
+ _sgimgui.shader_window.num_slots = sgdesc.shader_pool_size;
+ _sgimgui.pipeline_window.num_slots = sgdesc.pipeline_pool_size;
+ _sgimgui.view_window.num_slots = sgdesc.view_pool_size;
- const size_t buffer_pool_size = (size_t)ctx->buffer_window.num_slots * sizeof(sgimgui_buffer_t);
- ctx->buffer_window.slots = (sgimgui_buffer_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, buffer_pool_size);
+ const size_t buffer_pool_size = (size_t)_sgimgui.buffer_window.num_slots * sizeof(_sgimgui_buffer_t);
+ _sgimgui.buffer_window.slots = (_sgimgui_buffer_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, buffer_pool_size);
- const size_t image_pool_size = (size_t)ctx->image_window.num_slots * sizeof(sgimgui_image_t);
- ctx->image_window.slots = (sgimgui_image_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, image_pool_size);
+ const size_t image_pool_size = (size_t)_sgimgui.image_window.num_slots * sizeof(_sgimgui_image_t);
+ _sgimgui.image_window.slots = (_sgimgui_image_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, image_pool_size);
- const size_t sampler_pool_size = (size_t)ctx->sampler_window.num_slots * sizeof(sgimgui_sampler_t);
- ctx->sampler_window.slots = (sgimgui_sampler_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, sampler_pool_size);
+ const size_t sampler_pool_size = (size_t)_sgimgui.sampler_window.num_slots * sizeof(_sgimgui_sampler_t);
+ _sgimgui.sampler_window.slots = (_sgimgui_sampler_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, sampler_pool_size);
- const size_t shader_pool_size = (size_t)ctx->shader_window.num_slots * sizeof(sgimgui_shader_t);
- ctx->shader_window.slots = (sgimgui_shader_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, shader_pool_size);
+ const size_t shader_pool_size = (size_t)_sgimgui.shader_window.num_slots * sizeof(_sgimgui_shader_t);
+ _sgimgui.shader_window.slots = (_sgimgui_shader_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, shader_pool_size);
- const size_t pipeline_pool_size = (size_t)ctx->pipeline_window.num_slots * sizeof(sgimgui_pipeline_t);
- ctx->pipeline_window.slots = (sgimgui_pipeline_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, pipeline_pool_size);
+ const size_t pipeline_pool_size = (size_t)_sgimgui.pipeline_window.num_slots * sizeof(_sgimgui_pipeline_t);
+ _sgimgui.pipeline_window.slots = (_sgimgui_pipeline_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, pipeline_pool_size);
- const size_t view_pool_size = (size_t)ctx->view_window.num_slots * sizeof(sgimgui_view_t);
- ctx->view_window.slots = (sgimgui_view_t*) _sgimgui_malloc_clear(&ctx->desc.allocator, view_pool_size);
+ const size_t view_pool_size = (size_t)_sgimgui.view_window.num_slots * sizeof(_sgimgui_view_t);
+ _sgimgui.view_window.slots = (_sgimgui_view_t*) _sgimgui_malloc_clear(&_sgimgui.desc.allocator, view_pool_size);
}
-SOKOL_API_IMPL void sgimgui_discard(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
+SOKOL_API_IMPL void sgimgui_shutdown(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
/* restore original trace hooks */
- sg_install_trace_hooks(&ctx->hooks);
- ctx->init_tag = 0;
- _sgimgui_capture_discard(ctx);
- if (ctx->buffer_window.slots) {
- for (int i = 0; i < ctx->buffer_window.num_slots; i++) {
- if (ctx->buffer_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_buffer_destroyed(ctx, i);
+ sg_install_trace_hooks(&_sgimgui.hooks);
+ _sgimgui.init_tag = 0;
+ _sgimgui_capture_discard(&_sgimgui);
+ if (_sgimgui.buffer_window.slots) {
+ for (int i = 0; i < _sgimgui.buffer_window.num_slots; i++) {
+ if (_sgimgui.buffer_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_buffer_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->buffer_window.slots);
- ctx->buffer_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.buffer_window.slots);
+ _sgimgui.buffer_window.slots = 0;
}
- if (ctx->image_window.slots) {
- for (int i = 0; i < ctx->image_window.num_slots; i++) {
- if (ctx->image_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_image_destroyed(ctx, i);
+ if (_sgimgui.image_window.slots) {
+ for (int i = 0; i < _sgimgui.image_window.num_slots; i++) {
+ if (_sgimgui.image_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_image_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->image_window.slots);
- ctx->image_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.image_window.slots);
+ _sgimgui.image_window.slots = 0;
}
- if (ctx->sampler_window.slots) {
- for (int i = 0; i < ctx->sampler_window.num_slots; i++) {
- if (ctx->sampler_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_sampler_destroyed(ctx, i);
+ if (_sgimgui.sampler_window.slots) {
+ for (int i = 0; i < _sgimgui.sampler_window.num_slots; i++) {
+ if (_sgimgui.sampler_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_sampler_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->sampler_window.slots);
- ctx->sampler_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.sampler_window.slots);
+ _sgimgui.sampler_window.slots = 0;
}
- if (ctx->shader_window.slots) {
- for (int i = 0; i < ctx->shader_window.num_slots; i++) {
- if (ctx->shader_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_shader_destroyed(ctx, i);
+ if (_sgimgui.shader_window.slots) {
+ for (int i = 0; i < _sgimgui.shader_window.num_slots; i++) {
+ if (_sgimgui.shader_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_shader_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->shader_window.slots);
- ctx->shader_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.shader_window.slots);
+ _sgimgui.shader_window.slots = 0;
}
- if (ctx->pipeline_window.slots) {
- for (int i = 0; i < ctx->pipeline_window.num_slots; i++) {
- if (ctx->pipeline_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_pipeline_destroyed(ctx, i);
+ if (_sgimgui.pipeline_window.slots) {
+ for (int i = 0; i < _sgimgui.pipeline_window.num_slots; i++) {
+ if (_sgimgui.pipeline_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_pipeline_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->pipeline_window.slots);
- ctx->pipeline_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.pipeline_window.slots);
+ _sgimgui.pipeline_window.slots = 0;
}
- if (ctx->view_window.slots) {
- for (int i = 0; i < ctx->view_window.num_slots; i++) {
- if (ctx->view_window.slots[i].res_id.id != SG_INVALID_ID) {
- _sgimgui_view_destroyed(ctx, i);
+ if (_sgimgui.view_window.slots) {
+ for (int i = 0; i < _sgimgui.view_window.num_slots; i++) {
+ if (_sgimgui.view_window.slots[i].res_id.id != SG_INVALID_ID) {
+ _sgimgui_view_destroyed(&_sgimgui, i);
}
}
- _sgimgui_free(&ctx->desc.allocator, (void*)ctx->view_window.slots);
- ctx->view_window.slots = 0;
+ _sgimgui_free(&_sgimgui.desc.allocator, (void*)_sgimgui.view_window.slots);
+ _sgimgui.view_window.slots = 0;
}
}
-SOKOL_API_IMPL void sgimgui_draw(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- sgimgui_draw_buffer_window(ctx);
- sgimgui_draw_image_window(ctx);
- sgimgui_draw_sampler_window(ctx);
- sgimgui_draw_shader_window(ctx);
- sgimgui_draw_pipeline_window(ctx);
- sgimgui_draw_view_window(ctx);
- sgimgui_draw_capture_window(ctx);
- sgimgui_draw_capabilities_window(ctx);
- sgimgui_draw_frame_stats_window(ctx);
+SOKOL_API_IMPL void sgimgui_draw(void) {
+ sgimgui_draw_buffer_window("Buffers");
+ sgimgui_draw_image_window("Images");
+ sgimgui_draw_sampler_window("Samplers");
+ sgimgui_draw_shader_window("Shaders");
+ sgimgui_draw_pipeline_window("Pipelines");
+ sgimgui_draw_view_window("Views");
+ sgimgui_draw_capture_window("Frame Capture");
+ sgimgui_draw_capabilities_window("Capabilities");
+ sgimgui_draw_frame_stats_window("Frame Stats");
}
-SOKOL_API_IMPL void sgimgui_draw_menu(sgimgui_t* ctx, const char* title) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
+SOKOL_API_IMPL void sgimgui_draw_menu(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
SOKOL_ASSERT(title);
if (_sgimgui_igbeginmenu(title)) {
- _sgimgui_igmenuitemboolptr("Capabilities", 0, &ctx->caps_window.open, true);
- _sgimgui_igmenuitemboolptr("Frame Stats", 0, &ctx->frame_stats_window.open, true);
- _sgimgui_igmenuitemboolptr("Buffers", 0, &ctx->buffer_window.open, true);
- _sgimgui_igmenuitemboolptr("Images", 0, &ctx->image_window.open, true);
- _sgimgui_igmenuitemboolptr("Views", 0, &ctx->view_window.open, true);
- _sgimgui_igmenuitemboolptr("Samplers", 0, &ctx->sampler_window.open, true);
- _sgimgui_igmenuitemboolptr("Shaders", 0, &ctx->shader_window.open, true);
- _sgimgui_igmenuitemboolptr("Pipelines", 0, &ctx->pipeline_window.open, true);
- _sgimgui_igmenuitemboolptr("Calls", 0, &ctx->capture_window.open, true);
+ sgimgui_draw_capabilities_menu_item("Capabilities");
+ sgimgui_draw_frame_stats_menu_item("Frame Stats");
+ sgimgui_draw_buffer_menu_item("Buffers");
+ sgimgui_draw_image_menu_item("Images");
+ sgimgui_draw_view_menu_item("Views");
+ sgimgui_draw_sampler_menu_item("Samplers");
+ sgimgui_draw_shader_menu_item("Shaders");
+ sgimgui_draw_pipeline_menu_item("Pipelines");
+ sgimgui_draw_capture_menu_item("Calls");
_sgimgui_igendmenu();
}
}
-SOKOL_API_IMPL void sgimgui_draw_buffer_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->buffer_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_buffer_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.buffer_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_image_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.image_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_sampler_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.sampler_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_shader_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.shader_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_pipeline_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.pipeline_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_view_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.view_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_capture_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.capture_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_capabilities_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.caps_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_frame_stats_menu_item(const char* label) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(label);
+ _sgimgui_igmenuitemboolptr(label, 0, &_sgimgui.frame_stats_window.open, true);
+}
+
+SOKOL_API_IMPL void sgimgui_draw_buffer_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.buffer_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 280), ImGuiCond_Once);
- if (_sgimgui_igbegin("Buffers", &ctx->buffer_window.open, 0)) {
- sgimgui_draw_buffer_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.buffer_window.open, 0)) {
+ sgimgui_draw_buffer_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_image_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->image_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_image_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.image_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Images", &ctx->image_window.open, 0)) {
- sgimgui_draw_image_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.image_window.open, 0)) {
+ sgimgui_draw_image_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_sampler_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->sampler_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_sampler_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.sampler_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Samplers", &ctx->sampler_window.open, 0)) {
- sgimgui_draw_sampler_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.sampler_window.open, 0)) {
+ sgimgui_draw_sampler_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_shader_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->shader_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_shader_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.shader_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Shaders", &ctx->shader_window.open, 0)) {
- sgimgui_draw_shader_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.shader_window.open, 0)) {
+ sgimgui_draw_shader_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_pipeline_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->pipeline_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_pipeline_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.pipeline_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(540, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Pipelines", &ctx->pipeline_window.open, 0)) {
- sgimgui_draw_pipeline_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.pipeline_window.open, 0)) {
+ sgimgui_draw_pipeline_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_view_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->view_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_view_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.view_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Views", &ctx->view_window.open, 0)) {
- sgimgui_draw_view_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.view_window.open, 0)) {
+ sgimgui_draw_view_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_capture_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->capture_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_capture_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.capture_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(640, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Frame Capture", &ctx->capture_window.open, 0)) {
- sgimgui_draw_capture_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.capture_window.open, 0)) {
+ sgimgui_draw_capture_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_capabilities_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->caps_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_capabilities_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.caps_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(440, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Capabilities", &ctx->caps_window.open, 0)) {
- sgimgui_draw_capabilities_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.caps_window.open, 0)) {
+ sgimgui_draw_capabilities_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_frame_stats_window(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- if (!ctx->frame_stats_window.open) {
+SOKOL_API_IMPL void sgimgui_draw_frame_stats_window(const char* title) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ SOKOL_ASSERT(title);
+ if (!_sgimgui.frame_stats_window.open) {
return;
}
_sgimgui_igsetnextwindowsize(IMVEC2(640, 400), ImGuiCond_Once);
- if (_sgimgui_igbegin("Frame Stats", &ctx->frame_stats_window.open, 0)) {
- sgimgui_draw_frame_stats_window_content(ctx);
+ if (_sgimgui_igbegin(title, &_sgimgui.frame_stats_window.open, 0)) {
+ sgimgui_draw_frame_stats_window_content();
}
_sgimgui_igend();
}
-SOKOL_API_IMPL void sgimgui_draw_buffer_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_buffer_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_buffer_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_buffer_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_buffer_panel(ctx, ctx->buffer_window.sel_buf);
+ _sgimgui_draw_buffer_panel(&_sgimgui, _sgimgui.buffer_window.sel_buf);
}
-SOKOL_API_IMPL void sgimgui_draw_image_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_image_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_image_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_image_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_image_panel(ctx, ctx->image_window.sel_img);
+ _sgimgui_draw_image_panel(&_sgimgui, _sgimgui.image_window.sel_img);
}
-SOKOL_API_IMPL void sgimgui_draw_sampler_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_sampler_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_sampler_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_sampler_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_sampler_panel(ctx, ctx->sampler_window.sel_smp);
+ _sgimgui_draw_sampler_panel(&_sgimgui, _sgimgui.sampler_window.sel_smp);
}
-SOKOL_API_IMPL void sgimgui_draw_shader_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_shader_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_shader_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_shader_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_shader_panel(ctx, ctx->shader_window.sel_shd);
+ _sgimgui_draw_shader_panel(&_sgimgui, _sgimgui.shader_window.sel_shd);
}
-SOKOL_API_IMPL void sgimgui_draw_pipeline_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_pipeline_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_pipeline_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_pipeline_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_pipeline_panel(ctx, ctx->pipeline_window.sel_pip);
+ _sgimgui_draw_pipeline_panel(&_sgimgui, _sgimgui.pipeline_window.sel_pip);
}
-SOKOL_API_IMPL void sgimgui_draw_view_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_view_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_view_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_view_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_view_panel(ctx, ctx->view_window.sel_view);
+ _sgimgui_draw_view_panel(&_sgimgui, _sgimgui.view_window.sel_view);
}
-SOKOL_API_IMPL void sgimgui_draw_capture_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _sgimgui_draw_capture_list(ctx);
+SOKOL_API_IMPL void sgimgui_draw_capture_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui_draw_capture_list(&_sgimgui);
_sgimgui_igsameline();
- _sgimgui_draw_capture_panel(ctx);
+ _sgimgui_draw_capture_panel(&_sgimgui);
}
-SOKOL_API_IMPL void sgimgui_draw_capabilities_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- _SOKOL_UNUSED(ctx);
+SOKOL_API_IMPL void sgimgui_draw_capabilities_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
_sgimgui_draw_caps_panel();
}
-SOKOL_API_IMPL void sgimgui_draw_frame_stats_window_content(sgimgui_t* ctx) {
- SOKOL_ASSERT(ctx && (ctx->init_tag == 0xABCDABCD));
- ctx->frame_stats_window.stats = sg_query_stats();
- _sgimgui_draw_frame_stats_panel(ctx);
+SOKOL_API_IMPL void sgimgui_draw_frame_stats_window_content(void) {
+ SOKOL_ASSERT(_sgimgui.init_tag == 0xABCDABCD);
+ _sgimgui.frame_stats_window.stats = sg_query_stats();
+ _sgimgui_draw_frame_stats_panel(&_sgimgui);
}
#endif /* SOKOL_GFX_IMGUI_IMPL */