Skip to content
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 crash in scenes with more than 8 shadowed directional lights #100423

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

Namey5
Copy link
Contributor

@Namey5 Namey5 commented Dec 15, 2024

Looks like there was an off-by-one bounds check when culling directional lights - this was only causing a crash when all lights were shadowed however, as the culling data for shadows uses a fixed-size array.

Fixes #73854

@Namey5 Namey5 requested a review from a team as a code owner December 15, 2024 08:16
@Namey5 Namey5 changed the title fix: crash in scenes with more than 8 shadowed directional lights Fix crash in scenes with more than 8 shadowed directional lights Dec 15, 2024
@BlueCube3310 BlueCube3310 added this to the 4.x milestone Dec 15, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.4 Dec 16, 2024
@akien-mga akien-mga added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Dec 16, 2024
@akien-mga
Copy link
Member

This seems consistent with the Compatibility renderer, and the only occurrence:

$ rg ">.*MAX_DIRECTIONAL_LIGHTS"
servers/rendering/renderer_scene_cull.cpp
3286:                   if (directional_lights.size() > RendererSceneRender::MAX_DIRECTIONAL_LIGHTS) {

drivers/gles3/rasterizer_scene_gles3.cpp
1644:                           if (r_directional_light_count >= RendererSceneRender::MAX_DIRECTIONAL_LIGHTS || light_storage->light_directional_get_sky_mode(base) == RS::LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY) {

@Repiteo Repiteo merged commit ea351e4 into godotengine:master Dec 16, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 16, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:rendering topic:3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when having more than 8 DirectionalLights with shadows enabled in the scene
5 participants