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

crash on editing array in shader because Nvidia OpenGL compiler crash #41742

Closed
danilw opened this issue Sep 3, 2020 · 3 comments
Closed

crash on editing array in shader because Nvidia OpenGL compiler crash #41742

danilw opened this issue Sep 3, 2020 · 3 comments

Comments

@danilw
Copy link

danilw commented Sep 3, 2020

Godot version:
3.2.2 stable

OS/device including version:
Linux Godot editor
Nvidia driver 440.82

Issue description:

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x3c530) [0x7f5c7cf22530] (??:0)
[2] /usr/lib64/libnvidia-glcore.so.440.82(+0x49d430) [0x7f5c76110430] (??:0)
[3] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b1839) [0x7f5c75f24839] (??:0)
[4] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b5b1c) [0x7f5c75f28b1c] (??:0)
[5] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b1c16) [0x7f5c75f24c16] (??:0)
[6] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b1b1d) [0x7f5c75f24b1d] (??:0)
[7] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b8454) [0x7f5c75f2b454] (??:0)
[8] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b8e44) [0x7f5c75f2be44] (??:0)
[9] /usr/lib64/libnvidia-glcore.so.440.82(+0x2b91c4) [0x7f5c75f2c1c4] (??:0)
[10] /usr/lib64/libnvidia-glcore.so.440.82(+0x29008c) [0x7f5c75f0308c] (??:0)
[11] /usr/lib64/libnvidia-glcore.so.440.82(+0x2957a4) [0x7f5c75f087a4] (??:0)
[12] /usr/lib64/libnvidia-glcore.so.440.82(+0x296010) [0x7f5c75f09010] (??:0)
[13] /usr/lib64/libnvidia-glcore.so.440.82(+0xc2f8f0) [0x7f5c768a28f0] (??:0)
[14] /usr/lib64/libnvidia-glcore.so.440.82(+0xc37885) [0x7f5c768aa885] (??:0)
[15] /usr/lib64/libnvidia-glcore.so.440.82(+0xc45ea3) [0x7f5c768b8ea3] (??:0)
[16] /usr/lib64/libnvidia-glcore.so.440.82(+0xc057f3) [0x7f5c768787f3] (??:0)
[17] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x2363d25] (<artificial>:?)
[18] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x236446f] (??:?)
[19] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x9993a4] (??:?)
[20] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x238e5cd] (<artificial>:?)
[21] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0xffbfe3] (??:?)
[22] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x9971e8] (??:?)
[23] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x1037fda] (<artificial>:?)
[24] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x103a01a] (<artificial>:?)
[25] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x103a87f] (<artificial>:?)
[26] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x294a8e2] (??:?)
[27] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x8582dd] (??:?)
[28] /lib64/libc.so.6(__libc_start_main+0xea) [0x7f5c7cf0ccca] (??:0)
[29] /home/danil/bin/godot_3.2.2/Godot_v3.2.2-stable_x11.64() [0x86695e] (??:?)
-- END OF BACKTRACE --

Steps to reproduce:
shader code:

shader_type spatial;
render_mode blend_mix,depth_draw_alpha_prepass,cull_back,unshaded;
 

//bug
void crash_bug(out vec4 col)
{
    vec4 v[2];
    v[0] = vec4(1.0 );
    v[1] = vec4(1.0 );
    mat4 m = mat4(1.);
    float t = 0.0;
    for(int i = 0; i < 8; ++i)
    {
        vec4 s = m * v[i];
        if((s.w<=-1.001)){
            vec2 sp = s.xy / s.w;

            //BUG
            t = max(t,sp.x); // uncomment this
        }
    }
    col = vec4(t);
 
}

void fragment() {
	vec4 col=vec4(0.);
	
	//BUG
	//crash_bug(col); //uncomment this
	
    ALBEDO = col.rgb;
}

uncomment //crash_bug(col); in Godot editor

I was editing shader array and got a full Godot editor crash.

Nvidia bugreport

Minimal reproduction project:
BUG_crash_shader_array.zip

@clayjohn
Copy link
Member

clayjohn commented Sep 3, 2020

Thanks for the heads up! Hopefully NVidia fixes their drivers quickly.

@danilw
Copy link
Author

danilw commented Sep 3, 2020

Thanks for the heads up! Hopefully NVidia fixes their drivers quickly.

I think creating some like "dummy-compiler" as an external app (exe/bin file) outside editor and launch shader compilation on that "dummy.exe"(that just call OpenGL shader creation) and return status if no status returned then this shader crash and Godot Editor will show warning "this shader can not be compiled even if its valid"

because these crashes on shader compilation/loading precompiled SPIR-V happened even in Vulkan, glslangValidator application is not safe to "trust it" and SPIR-V output by glslang also can be broken because bugs in glslang, and loading SPIR-V may triger driver bugs that also will crash Godot Editor...

as examples:
glslangValidator bug KhronosGroup/glslang#2368
AMD driver bug on loading SPIR-V file that crash even AMD shader analyzer software https://community.amd.com/thread/248773

I mean "full editor crash" on shader compilation can be avoided

@danilw
Copy link
Author

danilw commented Nov 21, 2020

same as #43055

I think it can be closed because the latest Nvidia driver brings even more "GLSL" bugs than this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants