aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2024-04-21 16:20:42 +0200
committerAndre Weissflog <floooh@gmail.com>2024-04-21 16:20:42 +0200
commit4fac1bb845c011ed91446f511d86c7ce50e15e42 (patch)
tree1d3d6fc599265add468ec3cbf135fef6bff30270 /util
parent7e1035cb0dff181ca5ded241914ae128318e7d46 (diff)
parent4534e02d6c83e23fa212ac29c1fd90d8a22f5419 (diff)
Merge branch 'master' into storage-buffers
Diffstat (limited to 'util')
-rw-r--r--util/sokol_debugtext.h4
-rw-r--r--util/sokol_gfx_imgui.h2
-rw-r--r--util/sokol_imgui.h12
3 files changed, 15 insertions, 3 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h
index 7cc3fd5b..12ca7a64 100644
--- a/util/sokol_debugtext.h
+++ b/util/sokol_debugtext.h
@@ -3855,8 +3855,8 @@ static void _sdtx_init_context(sdtx_context ctx_id, const sdtx_context_desc_t* i
pip_desc.colors[0].blend.enabled = true;
pip_desc.colors[0].blend.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA;
pip_desc.colors[0].blend.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA;
- pip_desc.colors[0].blend.src_factor_alpha = SG_BLENDFACTOR_ZERO;
- pip_desc.colors[0].blend.dst_factor_alpha = SG_BLENDFACTOR_ONE;
+ pip_desc.colors[0].blend.src_factor_alpha = SG_BLENDFACTOR_ONE;
+ pip_desc.colors[0].blend.dst_factor_alpha = SG_BLENDFACTOR_ZERO;
pip_desc.label = "sdtx-pipeline";
ctx->pip = sg_make_pipeline(&pip_desc);
SOKOL_ASSERT(SG_INVALID_ID != ctx->pip.id);
diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h
index b13ce211..217f74f1 100644
--- a/util/sokol_gfx_imgui.h
+++ b/util/sokol_gfx_imgui.h
@@ -2156,7 +2156,7 @@ _SOKOL_PRIVATE sgimgui_str_t _sgimgui_capture_item_string(sgimgui_t* ctx, int in
case SGIMGUI_CMD_UNINIT_ATTACHMENTS:
{
sgimgui_str_t res_id = _sgimgui_attachments_id_string(ctx, item->args.uninit_attachments.attachments);
- _sgimgui_snprintf(&str, "%d: sg_uninit_attachemnts(atts=%s)", index, res_id.buf);
+ _sgimgui_snprintf(&str, "%d: sg_uninit_attachments(atts=%s)", index, res_id.buf);
}
break;
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index e533ad34..810890c0 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -2385,6 +2385,9 @@ SOKOL_API_IMPL void simgui_setup(const simgui_desc_t* desc) {
SOKOL_API_IMPL void simgui_create_fonts_texture(const simgui_font_tex_desc_t* desc) {
SOKOL_ASSERT(desc);
+ SOKOL_ASSERT(SG_INVALID_ID == _simgui.font_smp.id);
+ SOKOL_ASSERT(SG_INVALID_ID == _simgui.font_img.id);
+ SOKOL_ASSERT(SIMGUI_INVALID_ID == _simgui.default_font.id);
#if defined(__cplusplus)
ImGuiIO* io = &ImGui::GetIO();
@@ -2434,6 +2437,9 @@ SOKOL_API_IMPL void simgui_destroy_fonts_texture(void) {
sg_destroy_sampler(_simgui.font_smp);
sg_destroy_image(_simgui.font_img);
simgui_destroy_image(_simgui.default_font);
+ _simgui.font_smp.id = SG_INVALID_ID;
+ _simgui.font_img.id = SG_INVALID_ID;
+ _simgui.default_font.id = SIMGUI_INVALID_ID;
}
SOKOL_API_IMPL void simgui_shutdown(void) {
@@ -2519,6 +2525,12 @@ SOKOL_API_IMPL void simgui_new_frame(const simgui_frame_desc_t* desc) {
#else
ImGuiIO* io = igGetIO();
#endif
+ if (!io->Fonts->TexReady) {
+ simgui_destroy_fonts_texture();
+ simgui_font_tex_desc_t simgui_font_smp_desc;
+ _simgui_clear(&simgui_font_smp_desc, sizeof(simgui_font_smp_desc));
+ simgui_create_fonts_texture(&simgui_font_smp_desc);
+ }
io->DisplaySize.x = ((float)desc->width) / _simgui.cur_dpi_scale;
io->DisplaySize.y = ((float)desc->height) / _simgui.cur_dpi_scale;
io->DeltaTime = (float)desc->delta_time;