Skip to content

Commit e5ee191

Browse files
committed
Merge pull request #110853 from Kaleb-Reid/compat-fix-reflections
Ensure reflection atlas is valid before rendering
2 parents 7093ca3 + f2d0ea6 commit e5ee191

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

drivers/gles3/storage/light_storage.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,9 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
811811

812812
ERR_FAIL_NULL_V(atlas, false);
813813

814+
ERR_FAIL_COND_V_MSG(atlas->size < 4, false, "Attempted to render to a reflection atlas of invalid resolution.");
815+
ERR_FAIL_COND_V_MSG(atlas->count < 1, false, "Attempted to render to a reflection atlas of size < 1.");
816+
814817
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.get_or_null(p_instance);
815818
ERR_FAIL_NULL_V(rpi, false);
816819

servers/rendering/renderer_rd/storage_rd/light_storage.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,9 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_
14821482

14831483
ERR_FAIL_NULL_V(atlas, false);
14841484

1485+
ERR_FAIL_COND_V_MSG(atlas->size < 2, false, "Attempted to render to a reflection atlas of invalid resolution.");
1486+
ERR_FAIL_COND_V_MSG(atlas->count < 1, false, "Attempted to render to a reflection atlas of size < 1.");
1487+
14851488
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.get_or_null(p_instance);
14861489
ERR_FAIL_NULL_V(rpi, false);
14871490

servers/rendering/rendering_server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,9 +3649,9 @@ void RenderingServer::init() {
36493649
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/sky_reflections/ggx_samples", PROPERTY_HINT_RANGE, "0,256,1"), 32);
36503650
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/sky_reflections/ggx_samples.mobile", PROPERTY_HINT_RANGE, "0,128,1"), 16);
36513651
GLOBAL_DEF("rendering/reflections/sky_reflections/fast_filter_high_quality", false);
3652-
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size", PROPERTY_HINT_RANGE, "0,4096,1"), 256);
3653-
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size.mobile", PROPERTY_HINT_RANGE, "0,2048,1"), 128);
3654-
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_count", PROPERTY_HINT_RANGE, "0,256,1"), 64);
3652+
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size", PROPERTY_HINT_RANGE, "4,4096,1"), 256);
3653+
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_size.mobile", PROPERTY_HINT_RANGE, "4,2048,1"), 128);
3654+
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/reflections/reflection_atlas/reflection_count", PROPERTY_HINT_RANGE, "1,256,1"), 64);
36553655
GLOBAL_DEF_RST("rendering/reflections/specular_occlusion/enabled", true);
36563656

36573657
GLOBAL_DEF("rendering/global_illumination/gi/use_half_resolution", false);

0 commit comments

Comments
 (0)