From c30381aa7228549b0c37585e45b072344e4333e5 Mon Sep 17 00:00:00 2001 From: katajisto Date: Sun, 19 Oct 2025 22:51:46 +0300 Subject: [PATCH] small improvements --- src/rendering/backend_sokol.jai | 30 +++++++++--------- src/rendering/pipelines.jai | 2 ++ src/rendering/tasks.jai | 1 + .../UserInterfaceState.xcuserstate | Bin 31788 -> 31788 bytes 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/rendering/backend_sokol.jai b/src/rendering/backend_sokol.jai index 5e62cae..a8fc691 100644 --- a/src/rendering/backend_sokol.jai +++ b/src/rendering/backend_sokol.jai @@ -235,7 +235,7 @@ backend_process_command_buckets :: () { } current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. - // 2. Reflection pass + // 3. Reflection pass sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = gPipelines.plane.attachments})); in_reflection_pass = true; for render_command_buckets.reflection { @@ -244,17 +244,8 @@ backend_process_command_buckets :: () { in_reflection_pass = false; sg_end_pass(); current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. - - - // 3. Main pass - sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = g_rendertex_attachments})); - for render_command_buckets.main { - backend_handle_command(it); - } - sg_end_pass(); - current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. - - // 3. G-Buffer pass + + // 4. G-Buffer pass in_gbuffer_pass = true; sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = g_gbuf_attachments})); for render_command_buckets.gbuffer { @@ -263,8 +254,19 @@ backend_process_command_buckets :: () { sg_end_pass(); in_gbuffer_pass = false; current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. + + // --- TODO: Do SSAO pass here: + + // 5. Main pass + sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = g_rendertex_attachments})); + for render_command_buckets.main { + backend_handle_command(it); + } + sg_end_pass(); + current_trile_offset_index = 0; // This is not optimal, but it is nice and simple. + - // Begin main pass + // Begin drawing to swapchain sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() })); // Draw the render texture and do post processing: @@ -281,8 +283,6 @@ backend_process_command_buckets :: () { sgl_ortho(0.0, sapp_widthf(), sapp_heightf(), 0.0, -1.0, +1.0); arb_tri_flush(); - // End the main pass - sg_end_pass(); sg_commit(); diff --git a/src/rendering/pipelines.jai b/src/rendering/pipelines.jai index b153cdc..999966e 100644 --- a/src/rendering/pipelines.jai +++ b/src/rendering/pipelines.jai @@ -23,6 +23,8 @@ g_gbuf_normal : sg_image; g_gbuf_depth : sg_image; g_gbuf_attachments : sg_attachments; +g_ssaobuf : sg_image; + gPipelines : struct { // G-Buffer generation for SSAO and other effects gbuffer: Pipeline_Binding; diff --git a/src/rendering/tasks.jai b/src/rendering/tasks.jai index 93af1c3..08b89b8 100644 --- a/src/rendering/tasks.jai +++ b/src/rendering/tasks.jai @@ -122,6 +122,7 @@ tasks_to_commands :: () { command := New(Render_Command_Set_Camera,, temp); command.camera = task.camera; array_add(*render_command_buckets.main, command); + array_add(*render_command_buckets.gbuffer, command); commandReflected := New(Render_Command_Set_Camera,, temp); commandReflected.camera = task.camera; commandReflected.camera.target *= Vector3.{1, -1, 1}; diff --git a/trueno/trueno.xcodeproj/project.xcworkspace/xcuserdata/tuomas.katajisto.xcuserdatad/UserInterfaceState.xcuserstate b/trueno/trueno.xcodeproj/project.xcworkspace/xcuserdata/tuomas.katajisto.xcuserdatad/UserInterfaceState.xcuserstate index 63e8759eb9846fd41f0bc232ea6069918e85e7a0..17f753529bd1e550d41d0332af2d6f61365054ed 100644 GIT binary patch delta 1137 zcmZvaTWnNC9LCQ~r#nNTZYx*|t(CUWLWFK9ft^$By0)e5)^-n_+3VSz(+0K$jcpTb zD^!#2U`SI#Ks_N`w6Sj0m`Lz)5)C0FYETHgm<7~mj2Pd%g$JX=2Xs#5!ML24$t2(Z zJKy*F&*@v>^eylnE?U`%cAzfQjRp`y97Rw9rJOZIbHLk#eYhEK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