From ab3314e9555c954a1b7ce44e6f345215f2041842 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 3 Jul 2021 21:24:37 -0300 Subject: [PATCH] Fix SDFGI * Broken by 7513b73902f3ed7ac45aa9aefc2f6f333ae731ff, fixes #49631 --- .../rendering/renderer_rd/renderer_scene_gi_rd.cpp | 11 ++++++----- .../renderer_rd/renderer_scene_render_rd.cpp | 4 +--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp index 9228e06d7e4..98d08f68e8a 100644 --- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp @@ -3029,8 +3029,6 @@ void RendererSceneGIRD::setup_voxel_gi_instances(RID p_render_buffers, const Tra RID voxel_gi_buffer = p_scene_render->render_buffers_get_voxel_gi_buffer(p_render_buffers); - RD::get_singleton()->draw_command_begin_label("VoxelGIs Setup"); - VoxelGIData voxel_gi_data[MAX_VOXEL_GI_INSTANCES]; bool voxel_gi_instances_changed = false; @@ -3110,10 +3108,12 @@ void RendererSceneGIRD::setup_voxel_gi_instances(RID p_render_buffers, const Tra } if (p_voxel_gi_instances.size() > 0) { - RD::get_singleton()->buffer_update(voxel_gi_buffer, 0, sizeof(VoxelGIData) * MIN((uint64_t)MAX_VOXEL_GI_INSTANCES, p_voxel_gi_instances.size()), voxel_gi_data, RD::BARRIER_MASK_COMPUTE); - } + RD::get_singleton()->draw_command_begin_label("VoxelGIs Setup"); - RD::get_singleton()->draw_command_end_label(); + RD::get_singleton()->buffer_update(voxel_gi_buffer, 0, sizeof(VoxelGIData) * MIN((uint64_t)MAX_VOXEL_GI_INSTANCES, p_voxel_gi_instances.size()), voxel_gi_data, RD::BARRIER_MASK_COMPUTE); + + RD::get_singleton()->draw_command_end_label(); + } } void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_buffer, RID p_voxel_gi_buffer, RID p_environment, const CameraMatrix &p_projection, const Transform3D &p_transform, const PagedArray &p_voxel_gi_instances, RendererSceneRenderRD *p_scene_render) { @@ -3346,6 +3346,7 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ } else { mode = (use_sdfgi && use_voxel_gi_instances) ? MODE_COMBINED : (use_sdfgi ? MODE_SDFGI : MODE_VOXEL_GI); } + RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(true); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[mode]); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi.uniform_set, 0); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 44ca17e2738..46057bddab8 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -3759,9 +3759,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData rb->sdfgi->update_light(); } - if (p_voxel_gi_instances.size()) { - gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this); - } + gi.setup_voxel_gi_instances(render_data.render_buffers, render_data.cam_transform, *render_data.voxel_gi_instances, render_state.voxel_gi_count, this); } render_state.depth_prepass_used = false;