Skip to content

Fix OpenGL shadow textures not honoring texture type when reusing textures#96509

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
Rudolph-B:Issue-92091
Sep 8, 2024
Merged

Fix OpenGL shadow textures not honoring texture type when reusing textures#96509
akien-mga merged 1 commit into
godotengine:masterfrom
Rudolph-B:Issue-92091

Conversation

@Rudolph-B

Copy link
Copy Markdown
Contributor

Resolves #92091

When attempting to reuse old shadow textures in the compatibility renderer, it did not check whether the texture being reused matched the type of texture it was supposed to create (Cubemap texture for omnilights and 2D texture for spotlights). This led to the unexpected behavior described in #92091.

The solution I implemented now verifies that the new light instance is of the same type as the previous one.

I used this MRP for testing.

@Rudolph-B Rudolph-B requested a review from a team as a code owner September 3, 2024 05:28
@akien-mga akien-mga changed the title Fixed OpenGL shadow textures not honoring texture type when reusing textures Fix OpenGL shadow textures not honoring texture type when reusing textures Sep 3, 2024
@akien-mga akien-mga added bug topic:rendering cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Sep 3, 2024
@akien-mga akien-mga added this to the 4.4 milestone Sep 3, 2024

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally (rebased on top of master 05d9854) using the MRP from #92091, it works as expected.

@clayjohn clayjohn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, so I think we should merge it. But I don't understand why we don't see the same issue in the other renderers because the logic for them is the same.

@Rudolph-B

Rudolph-B commented Sep 7, 2024

Copy link
Copy Markdown
Contributor Author

@clayjohn I haven't checked the mobile renderer, but for the Forward+ renderer, it splits omni-lights into its own function called _shadow_atlas_find_omni_shadows() in servers/rendering/renderer_rd/storage_rd/light_storage.cpp. Copying this behavior to the OpenGL renderer to solve the issue seemed a bit excessive and is likely to result in a few more bugs later on.

@akien-mga akien-mga merged commit 584e5bb into godotengine:master Sep 8, 2024
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@Rudolph-B Rudolph-B deleted the Issue-92091 branch September 11, 2024 13:04
@akien-mga

Copy link
Copy Markdown
Member

Cherry-picked for 4.3.1.

@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenGL: SpotLight3D shadows occasionally use the wrong texture after moving the camera away from them

4 participants