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

Avoid error spam when shaders fail to compile by freeing shader_data version when compilation fails #100128

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

clayjohn
Copy link
Member

@clayjohn clayjohn commented Dec 6, 2024

Fixes: #99263

#99263 is a regression from #90400

Previously the ShaderData class would set its member valid to false when about to compile and then set it to true if compilation was successful (both shader compilation and setting up pipelines). IIRC we removed that since we needed to shift around how the shader was compiled run asynchronously.

Then, when setting up geometry for drawing we checked if the shader_data of a material was valid, if not, we could fall back to the default material.

Now instead of checking if !shader_data->valid, we check if the shader_data->version.is_valid(). The version is allocated the first time the shader succeeds at compiling. After that, shader_data.is_valid() will always return true. Accordingly, a way to fix this is to free the version if it exists already and the compilation fails.

@clayjohn clayjohn added this to the 4.4 milestone Dec 6, 2024
@clayjohn clayjohn requested a review from DarioSamo December 6, 2024 23:35
@clayjohn clayjohn requested a review from a team as a code owner December 6, 2024 23:35
Copy link
Contributor

@Bonkahe Bonkahe left a comment

Choose a reason for hiding this comment

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

Tested Mono build on windows, does what it says on the tin, I was unable to reproduce the errors when editing shaders that I saw in the latest dev build available on the website.
All the code changes look good, not sure why the checks are failing though, of course that will need sorting out.

Copy link
Contributor

@DarioSamo DarioSamo left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Just needs small changes to pass CI.

@Repiteo Repiteo merged commit 5f5f86b into godotengine:master Dec 9, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 9, 2024

Thanks!

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.

Shader editor with invalid code prints many error messages, causing the editor to lag.
5 participants