Fix SDFGI

* Broken by 7513b73902, fixes #49631
This commit is contained in:
reduz 2021-07-03 21:24:37 -03:00
parent cb4e42155d
commit ab3314e955
2 changed files with 7 additions and 8 deletions

View file

@ -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); 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]; VoxelGIData voxel_gi_data[MAX_VOXEL_GI_INSTANCES];
bool voxel_gi_instances_changed = false; 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) { 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<RID> &p_voxel_gi_instances, RendererSceneRenderRD *p_scene_render) { 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<RID> &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 { } else {
mode = (use_sdfgi && use_voxel_gi_instances) ? MODE_COMBINED : (use_sdfgi ? MODE_SDFGI : MODE_VOXEL_GI); 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::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_compute_pipeline(compute_list, pipelines[mode]);
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi.uniform_set, 0); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi.uniform_set, 0);

View file

@ -3759,9 +3759,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData
rb->sdfgi->update_light(); 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; render_state.depth_prepass_used = false;