Skip to content

Explicitly initialize ltcgi_output.color for diffuse and specular#33

Merged
PiMaker merged 1 commit intoPiMaker:mainfrom
techanon:main
Jun 7, 2024
Merged

Explicitly initialize ltcgi_output.color for diffuse and specular#33
PiMaker merged 1 commit intoPiMaker:mainfrom
techanon:main

Conversation

@techanon
Copy link
Contributor

This should mitigate a compiler failure which commonly affects the Mochie Standard shader for some reason.

The repro is difficult and inconsistent, but when it does get triggered, adding these two lines and then reimporting the affected shader (usually mochie standard as mentioned) fixes the issue.

This should mitigate a compiler failure which commonly affects the Mochie Standard shader for some reason.
Comment on lines 299 to +300
ltcgi_output diff;
diff.color = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

Does it work if you do this in both places too? That might be a bit cleaner, even though it's already cursed compiler territory.

Suggested change
ltcgi_output diff;
diff.color = 0;
ltcgi_output diff = (ltcgi_output)0;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if that resolves it due to when I add the fix and successfully compiles it, then try to undo the change, it continues to succeed compiling. So I don't have a project I can test it in currently since I don't know how to consistently repro it.

As long as the compiler things that its fields are initialized at that point it should work, in theory at least. If I run across it again, I'll certainly give that a test to confirm it.

@PiMaker
Copy link
Owner

PiMaker commented Jun 7, 2024

Eh, I'll just merge this as-is if you confirmed this to be working. Thanks for the contribution!

@PiMaker PiMaker merged commit d848f37 into PiMaker:main Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants