From e6a73aba224904a5fe1971457093284e20a3ee0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ma=C5=A1karinec?= Date: Tue, 5 Mar 2024 20:02:47 +0100 Subject: [PATCH] Bump submodules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marek Maškarinec --- lib/sokol | 2 +- lib/umka | 2 +- src/image.c | 38 ++++++++++++++++++++++++++------------ src/tophat.h | 2 +- src/window.c | 17 ++++++++++++++--- 5 files changed, 43 insertions(+), 18 deletions(-) diff --git a/lib/sokol b/lib/sokol index d98010b..55dff3d 160000 --- a/lib/sokol +++ b/lib/sokol @@ -1 +1 @@ -Subproject commit d98010b3c8ab91d3963aa23a4696f3f2fa517e4c +Subproject commit 55dff3d0b9f67145582e13d3b184138260cbcc98 diff --git a/lib/umka b/lib/umka index 55336c2..3b1411d 160000 --- a/lib/umka +++ b/lib/umka @@ -1 +1 @@ -Subproject commit 55336c28ebc4f91d6328a86f78a6f36117699d6b +Subproject commit 3b1411d812b038b8ef878e65cf958823b8eb3991 diff --git a/src/image.c b/src/image.c index cb0d7e1..a1552cc 100644 --- a/src/image.c +++ b/src/image.c @@ -6,6 +6,7 @@ #include #include +#include #include "tophat.h" #include "umka_api.h" @@ -48,7 +49,6 @@ static void th_image_free_render_target(UmkaStackSlot *p, UmkaStackSlot *r) { th_render_target *t = p[0].ptrVal; - sg_destroy_pass(t->pass); sg_destroy_image(t->depth); th_image_free(t->image); } @@ -140,9 +140,10 @@ th_image_create_render_target(int width, int height, int filter) img_desc.pixel_format = SG_PIXELFORMAT_DEPTH; t->depth = sg_make_image(&img_desc); - t->pass = sg_make_pass(&(sg_pass_desc){.color_attachments[0].image = t->image->tex, - .depth_stencil_attachment.image = t->depth, - .label = "offscreen-pass"}); + t->attachments = sg_make_attachments(&(sg_attachments_desc){ + .colors[0].image = t->image->tex, + .depth_stencil.image = t->depth, + }); return t; } @@ -322,7 +323,10 @@ th_image_set_as_render_target(th_render_target *t) th_canvas_flush(); sg_end_pass(); - sg_begin_pass(t->pass, &thg->offscreen_pass_action); + sg_begin_pass(&(sg_pass){ + .action = thg->pass_action, + .attachments = t->attachments, + }); sg_apply_pipeline(thg->image_pip); thg->has_render_target = true; @@ -345,7 +349,10 @@ th_image_remove_render_target(th_render_target *t, th_vf2 wp) th_canvas_flush(); sg_end_pass(); - sg_begin_default_pass(&thg->pass_action, sapp_width(), sapp_height()); + sg_begin_pass(&(sg_pass){ + .action = thg->pass_action, + .swapchain = sglue_swapchain(), + }); sg_apply_pipeline(thg->canvas_pip); th_calculate_scaling(wp.x, wp.y); @@ -360,11 +367,17 @@ th_image_remove_render_target(th_render_target *t, th_vf2 wp) void th_image_init() { - thg->offscreen_pass_action = - (sg_pass_action){.colors[0] = {.store_action = SG_STOREACTION_STORE, - .load_action = SG_LOADACTION_CLEAR, - .clear_value = {0, 0, 0, 0}}}; - thg->image_pip = sg_make_pipeline(&(sg_pipeline_desc){.shader = thg->main_shader, + thg->offscreen_pass_action = (sg_pass_action){ + .colors[0] = + { + .store_action = SG_STOREACTION_STORE, + .load_action = SG_LOADACTION_CLEAR, + .clear_value = {0, 0, 0, 0}, + }, + }; + + thg->image_pip = sg_make_pipeline(&(sg_pipeline_desc){ + .shader = thg->main_shader, .layout = {.attrs = { [0].format = SG_VERTEXFORMAT_FLOAT2, // X, Y @@ -387,7 +400,8 @@ th_image_init() .dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, .op_rgb = SG_BLENDOP_ADD, }, - .label = "image-pip"}); + .label = "image-pip", + }); return; } diff --git a/src/tophat.h b/src/tophat.h index cee8b22..fb3b63b 100644 --- a/src/tophat.h +++ b/src/tophat.h @@ -86,7 +86,7 @@ typedef struct typedef struct { - sg_pass pass; + sg_attachments attachments; sg_image depth; th_image *image; } th_render_target; diff --git a/src/window.c b/src/window.c index 03e3062..918f9e2 100644 --- a/src/window.c +++ b/src/window.c @@ -53,7 +53,10 @@ static void init() { th_audio_init(); - sg_setup(&(sg_desc){.context = sapp_sgcontext(), .logger.func = slog_func}); + sg_setup(&(sg_desc){ + .environment = sglue_environment(), + .logger.func = slog_func, + }); thg->dpi_scale_factor = sapp_dpi_scale(); @@ -76,8 +79,16 @@ frame() thg->dpi_scale_factor = sapp_dpi_scale(); thg->pass_action = (sg_pass_action){ - .colors[0] = {.load_action = SG_LOADACTION_LOAD, .store_action = SG_STOREACTION_STORE}}; - sg_begin_default_pass(&thg->pass_action, sapp_width(), sapp_height()); + .colors[0] = + { + .load_action = SG_LOADACTION_LOAD, + .store_action = SG_STOREACTION_STORE, + }, + }; + sg_begin_pass(&(sg_pass){ + .action = thg->pass_action, + .swapchain = sglue_swapchain(), + }); sg_apply_pipeline(thg->canvas_pip); th_input_sync_fake_keys(); int window_width, window_height;