Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Shaders/LTCGI.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ void LTCGI_Contribution(
lmd = smoothstep(0.0, LTCGI_SPECULAR_LIGHTMAP_STEP, saturate(lm - LTCGI_LIGHTMAP_CUTOFF));
}
ltcgi_output diff;
diff.color = 0;
Comment on lines 299 to +300
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.

LTCGI_Evaluate(input, worldNorm, viewDir, identityBrdf, roughness, true, diff);
diff.intensity *= lmd;

Expand All @@ -316,6 +317,7 @@ void LTCGI_Contribution(
if (flags.specular)
{
ltcgi_output spec;
spec.color = 0;
LTCGI_Evaluate(input, worldNorm, viewDir, Minv, roughness, false, spec);
spec.intensity *= spec_amp * smoothstep(0.0, LTCGI_SPECULAR_LIGHTMAP_STEP, saturate(lm - LTCGI_LIGHTMAP_CUTOFF));

Expand Down Expand Up @@ -404,4 +406,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

#endif
#endif