-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Crash when using modf in own shader #16244
Comments
I just tried this and Godot doesn't crash for me. I do get a shader compiler error though:
|
@hpvb |
I get the errors on Windows 10 x64 with a Radeon RX 480, but it doesn't crash. Are your drivers up-to-date? |
This shader probably shouldn't be submitted to the driver at all though. I'd still call that a bug, irrespective of the driver bug. |
Second argument of modf() is actually an output parameter. Seems godot does not prevent using constants as outputs, which will cause glsl-error or crash depending on the driver. |
@binbitten |
Godot 3.0.5 I get broken rendering if I use this shader:
|
@Zylann as mentioned earlier, second argument of |
Godot version:
(3.0-Stable)
OS/device including version:
Windows 10
Radeon RX 570 with Radeon 18.1.1
Issue description:
Today I wanted to play around with the built in shaders and for that I wanted to use the modf command, but as soon as I typed in this line:
if( mod(UV.x,0.1) == 0.0)
{
ALBEDO = vec3(1.0,0.0,0.0);
}
It crashed immediatly and when I saved the shader before it got applied to the object, I couldn't reopen the project/scene until I manually edit the shader in the corresponding shaderfile to something else.
Steps to reproduce:
Create a new mesh, image or any type of objects that accept materials or own shaders. After that create a new "ShaderMaterial" for this object and open the builtin shaderedior. Type in a shader that is using modf or copy the following shader to the editor and wait until Godot wants to apply it:
shader_type spatial;
uniform float grid_size = 1.0;
void fragment()
{
if( modf(UV.x,0.1) == 0.0)
{
ALBEDO = vec3(1.0,0.0,0.0);
}
else
{
ALBEDO = vec3(0.0);
}
}
Note: Godot doesn't crash with the "mod"-Function, only with "modf" and I suggest you not to save the shader, except you want to edit the shaderfile all the time to reopen the project/scene ^^
Minimal reproduction project:
Please note that in this example project I used "mod" so Godot doesn't crash at the startup. Just replace "mod" with "modf" in the shader and you are "good to go".
ModfBug.zip
The text was updated successfully, but these errors were encountered: