small improvements

This commit is contained in:
Tuomas Katajisto 2025-10-19 22:51:46 +03:00
parent 546067fda7
commit c30381aa72
4 changed files with 18 additions and 15 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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};