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 63e8759..17f7535 100644 Binary files a/trueno/trueno.xcodeproj/project.xcworkspace/xcuserdata/tuomas.katajisto.xcuserdatad/UserInterfaceState.xcuserstate and b/trueno/trueno.xcodeproj/project.xcworkspace/xcuserdata/tuomas.katajisto.xcuserdatad/UserInterfaceState.xcuserstate differ