-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix voxel GI issues #76437
Fix voxel GI issues #76437
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3493,6 +3493,9 @@ void GI::init(SkyRD *p_sky) { | |
if (RendererSceneRenderRD::get_singleton()->is_vrs_supported()) { | ||
defines += "\n#define USE_VRS\n"; | ||
} | ||
if (!RD::get_singleton()->sampler_is_format_supported_for_filter(RD::DATA_FORMAT_R8G8_UINT, RD::SAMPLER_FILTER_LINEAR)) { | ||
defines += "\n#define SAMPLE_VOXEL_GI_NEAREST\n"; | ||
} | ||
|
||
Vector<String> gi_modes; | ||
|
||
|
@@ -3695,14 +3698,16 @@ void GI::setup_voxel_gi_instances(RenderDataRD *p_render_data, Ref<RenderSceneBu | |
if (p_render_buffers->has_custom_data(RB_SCOPE_FOG)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this block of checks would belong better to just before using the uniform sets. They will be invalid by that time because of deletion of dependencies, so doing the check there is to me more correct. The idea would be being reactive to what actually happened instead of being proactive in guessing what may have happened. That, of course, without detriment of being proactive as an optimization in cases where that can save some checks (a bit like this PR does by assuming the whole group of sets is either valid or invalid). In any case, this is a suggestion to the rendering maintainers. I didn't want to attempt something like that in this PR, which would broaden its scope needlessly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense. There isn't much of a reason to be caching this so early |
||
Ref<Fog::VolumetricFog> fog = p_render_buffers->get_custom_data(RB_SCOPE_FOG); | ||
|
||
if (RD::get_singleton()->uniform_set_is_valid(fog->fog_uniform_set)) { | ||
RD::get_singleton()->free(fog->fog_uniform_set); | ||
RD::get_singleton()->free(fog->process_uniform_set); | ||
RD::get_singleton()->free(fog->process_uniform_set2); | ||
#ifdef DEV_ENABLED | ||
fog->gi_dependent_sets.assert_actual_validity(); | ||
#endif | ||
if (fog->gi_dependent_sets.valid) { | ||
RD::get_singleton()->free(fog->gi_dependent_sets.copy_uniform_set); | ||
RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set_density); | ||
RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set); | ||
RD::get_singleton()->free(fog->gi_dependent_sets.process_uniform_set2); | ||
fog->gi_dependent_sets.valid = false; | ||
} | ||
fog->fog_uniform_set = RID(); | ||
fog->process_uniform_set = RID(); | ||
fog->process_uniform_set2 = RID(); | ||
} | ||
} | ||
|
||
|
@@ -3929,7 +3934,6 @@ void GI::process_gi(Ref<RenderSceneBuffersRD> p_render_buffers, const RID *p_nor | |
u.append_id(material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED)); | ||
uniforms.push_back(u); | ||
} | ||
|
||
{ | ||
RD::Uniform u; | ||
u.uniform_type = RD::UNIFORM_TYPE_IMAGE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying the format here feels too hard-coded to my taste, but I couldn't find a way of querying the format of the actual texture. This is not the end of the world, but has a risk of getting out of sync with the code that creates the texture.