aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2024-05-01 17:42:27 +0200
committerAndre Weissflog <floooh@gmail.com>2024-05-01 17:42:27 +0200
commitd50223aacf0086d9b4d13899702c21fc5621e8b5 (patch)
treeb61adebd406b1d49f30c2d80895fcda6c6c5c8bc /util
parent5d59b764715492443a4639802611d66e04c1e3d7 (diff)
sokol_gfx_imgui.h: add storage buffers to shader and apply-bindings panels
Diffstat (limited to 'util')
-rw-r--r--util/sokol_gfx_imgui.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h
index 217f74f1..e76f7d5f 100644
--- a/util/sokol_gfx_imgui.h
+++ b/util/sokol_gfx_imgui.h
@@ -3484,6 +3484,15 @@ _SOKOL_PRIVATE void _sgimgui_draw_shader_stage(const sg_shader_stage_desc* stage
break;
}
}
+ int num_valid_storage_buffers = 0;
+ for (int i = 0; i < SG_MAX_SHADERSTAGE_STORAGEBUFFERS; i++) {
+ if (stage->storage_buffers[i].used) {
+ num_valid_storage_buffers++;
+ } else {
+ break;
+ }
+ }
+
if (num_valid_ubs > 0) {
if (igTreeNode_Str("Uniform Blocks")) {
for (int i = 0; i < num_valid_ubs; i++) {
@@ -3538,6 +3547,15 @@ _SOKOL_PRIVATE void _sgimgui_draw_shader_stage(const sg_shader_stage_desc* stage
igTreePop();
}
}
+ if (num_valid_storage_buffers > 0) {
+ if (igTreeNode_Str("Storage Buffers")) {
+ for (int i = 0; i < num_valid_storage_buffers; i++) {
+ const sg_shader_storage_buffer_desc* sbuf_desc = &stage->storage_buffers[i];
+ igText("slot: %d\n readonly: %s\n", i, sbuf_desc->readonly ? "true" : "false");
+ }
+ igTreePop();
+ }
+ }
if (stage->entry) {
igText("Entry: %s", stage->entry);
}
@@ -3818,6 +3836,17 @@ _SOKOL_PRIVATE void _sgimgui_draw_bindings_panel(sgimgui_t* ctx, const sg_bindin
break;
}
}
+ for (int i = 0; i < SG_MAX_SHADERSTAGE_STORAGEBUFFERS; i++) {
+ sg_buffer buf = bnd->vs.storage_buffers[i];
+ if (buf.id != SG_INVALID_ID) {
+ igSeparator();
+ igText("Vertex Stage Storage Buffer Slot #%d:", i);
+ igText(" Buffer: "); igSameLine(0,-1);
+ if (_sgimgui_draw_buffer_link(ctx, buf)) {
+ _sgimgui_show_buffer(ctx, buf);
+ }
+ }
+ }
for (int i = 0; i < SG_MAX_SHADERSTAGE_IMAGES; i++) {
sg_image img = bnd->fs.images[i];
if (img.id != SG_INVALID_ID) {
@@ -3840,6 +3869,17 @@ _SOKOL_PRIVATE void _sgimgui_draw_bindings_panel(sgimgui_t* ctx, const sg_bindin
}
}
}
+ for (int i = 0; i < SG_MAX_SHADERSTAGE_STORAGEBUFFERS; i++) {
+ sg_buffer buf = bnd->fs.storage_buffers[i];
+ if (buf.id != SG_INVALID_ID) {
+ igSeparator();
+ igText("Fragment Stage Storage Buffer Slot #%d:", i);
+ igText(" Buffer: "); igSameLine(0,-1);
+ if (_sgimgui_draw_buffer_link(ctx, buf)) {
+ _sgimgui_show_buffer(ctx, buf);
+ }
+ }
+ }
}
_SOKOL_PRIVATE void _sgimgui_draw_uniforms_panel(sgimgui_t* ctx, const sgimgui_args_apply_uniforms_t* args) {