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

Point lights with light probes causes warning and performance degradation. #2498

Open
Doprez opened this issue Oct 22, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Doprez
Copy link
Contributor

Doprez commented Oct 22, 2024

Release Type: official

Version: 4.2.0.2232

Platform(s): Windows

Describe the bug
When adding multiple Point lights to a scene with shadows on it will eventually throw warnings saying warning X3203: signed/unsigned mismatch, unsigned assumed

It seems like computing the lights sometimes removes the warnings but not consistently.

annoyingly I cant even share the project because it seems like at some point after rebuilding I cant create the problem anymore but it does sometimes come back when adding more lights.

To Reproduce
Steps to reproduce the behavior:

  1. create a new empty scene
  2. add 8 light probes in a box shape similar to the docs
  3. add point lights until when running the game the above error appears (it was not consistent for me when it popped up)

Expected behavior
Lights should not throw warnings when light probes are being used.

Screenshots

A view of the scene that used to throw the error:
Image

Log and callstacks

Warning: shader_StrideForwardShadingEffect_a0e5bf768ffbbe8f4fb2385c6bc54cb3.hlsl(804,59-97): warning X3203: signed/unsigned mismatch, unsigned assumed
		 
Warning: shader_StrideForwardShadingEffect_a0e5bf768ffbbe8f4fb2385c6bc54cb3.hlsl(804,59-97): warning X3203: signed/unsigned mismatch, unsigned assumed
		 
Warning: shader_StrideForwardShadingEffect_f12b514f9b803faf5b7be898130d2229.hlsl(924,59-97): warning X3203: signed/unsigned mismatch, unsigned assumed
		 
Warning: shader_StrideForwardShadingEffect_f12b514f9b803faf5b7be898130d2229.hlsl(924,59-97): warning X3203: signed/unsigned mismatch, unsigned assumed

the referenced files are here:
Shaderfiles.zip

Additional context
Linus in the Discord was the one who originally found the problem.

@Doprez Doprez added the bug Something isn't working label Oct 22, 2024
@Basewq
Copy link
Contributor

Basewq commented Oct 22, 2024

It's a bit annoying how the lines don't match up with the log file (even after stripping the initial comments), though the character positions did match up (59-97).

In any case, I've found the issue in shader_StrideForwardShadingEffect_a0e5bf768ffbbe8f4fb2385c6bc54cb3.hlsl on line 634 (which is part of the PrepareEnvironmentLight method)

tetrahedronFactors4 = lerp(tetrahedronFactors4, 0.0f, probeIndices >= IgnoredProbeStart_id175 ? float4(1.0f, 1.0f, 1.0f, 1.0f) : float4(0.0f, 0.0f, 0.0f, 0.0f));

probeIndices is a uint4 but IgnoredProbeStart_id175 is an int so the comparison throws this warning (whenever you compare uint vs int with operators like greater/less than, it'll throw this warning).
I suspect the quick fix is just casting to uint, eg. uint(IgnoredProbeStart).
Sadly I'm not well versed in the HLSL to understand how or why the ternary operator works with uint4 in this manner, so don't know if line in its entirety is correct or not.

@Basewq
Copy link
Contributor

Basewq commented Oct 22, 2024

Update to the above research, while I don't think Stride uses HLSL 2021, according to the following link, the ternary operator will would be invalid
microsoft/DirectXShaderCompiler#4070

Pinging @Jklawreszuk looking at the sub-link in the above link titled "Compilation problem on Linux: ternary error with non scalar" (I don't want to link it directly as it'll link back to this issue, lol).
Maybe this type of ternary operation one source of the "Error while compiling GLSL shader" error?

@BlackCurtainStudio
Copy link

For me, the warning goes away when I remove the Light Probes. However, there's still considerable lag when the Point Lights have shadows enabled, rendering the game unplayable. Spot Lights seems unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants