-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
[MojoShader] Preshaders with bool outputs aren't supported #448
Comments
Looks like it's preshaders:
Compiling with /Op will likely work around this. |
Yeah, compiling with that option solved the problem. |
Looking at the asm, the issue is probably the output register - the VM currently assumes output goes to the float registers, it's probably parsed somewhere but I'm not sure where... Preshader parser: https://github.com/icculus/mojoshader/blob/main/mojoshader.c#L3957 VM runner: https://github.com/icculus/mojoshader/blob/main/mojoshader_effects.c#L1889-L1914 |
See the attached sample: BranchIfTest.zip
It has very simple shader that draws a shape in color, which is set in the following HLSL(see TestEffect.fx):
The
Color1
,Color2
are blue and green. TheChoose
is switched between 0.0f and 1.0 when Space is pressed.So basically the sample should draw the shape in blue or green color.
However, for some reason, it draws in blue and pink:
branchIfTestFNA.mp4
If the
[branch]
is removed or replaced with[flatten]
, then it works correctly.Similarly it works correctly in both MonoGame versions(DirectX and OpenGL):
branchIfTestMG.mp4
The text was updated successfully, but these errors were encountered: