Merge pull request #104302 from brennennen/reflection_probe_count_error_check

Add error check for reflection probe invalid atlas index.
This commit is contained in:
Thaddeus Crews
2025-07-14 10:30:31 -05:00
3 changed files with 7 additions and 2 deletions

View File

@ -2494,7 +2494,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
}
GLuint fbo = 0;
if (is_reflection_probe) {
if (is_reflection_probe && GLES3::LightStorage::get_singleton()->reflection_probe_has_atlas_index(render_data.reflection_probe)) {
fbo = GLES3::LightStorage::get_singleton()->reflection_probe_instance_get_framebuffer(render_data.reflection_probe, render_data.reflection_probe_pass);
} else {
rb->set_apply_color_adjustments_in_post(apply_color_adjustments_in_post);

View File

@ -1032,6 +1032,7 @@ GLuint LightStorage::reflection_probe_instance_get_texture(RID p_instance) {
ReflectionAtlas *atlas = reflection_atlas_owner.get_or_null(rpi->atlas);
ERR_FAIL_NULL_V(atlas, 0);
ERR_FAIL_COND_V(rpi->atlas_index < 0, 0);
return atlas->reflections[rpi->atlas_index].radiance;
}
@ -1043,6 +1044,8 @@ GLuint LightStorage::reflection_probe_instance_get_framebuffer(RID p_instance, i
ReflectionAtlas *atlas = reflection_atlas_owner.get_or_null(rpi->atlas);
ERR_FAIL_NULL_V(atlas, 0);
ERR_FAIL_COND_V(rpi->atlas_index < 0, 0);
return atlas->reflections[rpi->atlas_index].fbos[p_index];
}