spvm
spvm copied to clipboard
Crashes and bugs and unexpected results
I have this repo https://github.com/danilw/GPU-my-list-of-bugs In this my "List of shader bugs" some shaders with UB and other "edge-cases". I tested shaders from this my lit with this project spvm.
Using spvm_shadertoy of this project to test.
To test with llvmpipe I use https://github.com/danilw/vulkan-shadertoy-launcher GPU detected as
Vulkan GPU - CPU: llvmpipe (LLVM 14.0.4, 256 bits) (id: 0x0000) from vendor 0x10005 [driver version: 0x0001, API version: 0x4030D3]
(I list only "broken" results, correct not listed) (multi-channel shaders not tested, just few where I copy Buf code as Image shader code)
| Shadertoy link | llvmpipe(CPU) result | spvm result |
|---|---|---|
| https://www.shadertoy.com/view/wdVyWD | freeze, can not render frame | crash segfault, even removing texture function from code |
| https://www.shadertoy.com/view/7ddfzr | ![]() |
![]() |
| https://www.shadertoy.com/view/ftXXW4 | works as expected | crash segfault, even removing texture function from code |
| https://www.shadertoy.com/view/7lt3Rl | ![]() |
![]() |
| https://www.shadertoy.com/view/NsBBDW | ![]() |
![]() |
| https://www.shadertoy.com/view/ftlcDS | works, screenshot in Shadertoy comments | crash segfault |
| https://www.shadertoy.com/view/slsXzs | white | black (not bug, its UB) |
| https://www.shadertoy.com/view/NsXBWr | works (use BufA as Image shader) | crash segfault, even removing texture function from code (use BufA as Image shader) |
More:
https://github.com/danilw/card-game-GLSL
Using original_bufA.glsl as Image shader (rename iChannel3 to iChannel0 for spvm_shadertoy). Expected result - background should be rendered. llvmpipe(CPU) result - render single frame after 1 min of "loading shader". spvm result - crash segfault.
Using unrolled_bufA.glsl as Image shader (same rename). llvmpipe result - render single frame after 1 min of "loading shader". spvm result - crash segfault.
My public shaders:
| Shadertoy link | llvmpipe(CPU) result | spvm result |
|---|---|---|
| https://www.shadertoy.com/view/NslGRN | works(after 1 min of shader loading) | crash segfault |
| https://www.shadertoy.com/view/sldGDf | works | crash segfault |
| https://www.shadertoy.com/view/4lKcDD | works | crash segfault |
| https://www.shadertoy.com/view/NljfzV | works as expected, 2-3 fps | 1 frame per 3 min.... and visual result does not look correct , to test I set #define iTime 2.0 and #define iMouse vec4(0.) ![]() |
| https://www.shadertoy.com/view/lttfR8 | works as expected | incorrect visual result ![]() |
| https://www.shadertoy.com/view/wt2fWw | works as expected | crash segfault |
| https://www.shadertoy.com/view/4sdBDn | works as expected | crash segfault |
| https://www.shadertoy.com/view/4dGBWy | (shader had one not initialized variable, this why result in llvmpile was incorrect) works as expected after fix | crash segfault (tested again, same crash) |
Surprisingly, this shader https://www.shadertoy.com/view/Nt2Szm works in spvm when it complex enough. And this same shader GLES2 port https://www.shadertoy.com/view/fdc3Dn works in spvm. (1 frame per min) When this same shader unrolled version https://www.shadertoy.com/view/sdcGDr - does not work in spvm. spvm result - crash segfault. llvmpipe(CPU) result - works as expected.
I made this "test" just for fun, idk if it can be considered "useful". Result is - most of my shaders dont work with spvm. llvmpipe is still best option to launch your shaders on CPU.
Thx for the testing ! I will check and fix all the cases list above
After several bugfix, most of the shader will not crash segfault any more, but some of the instructions still work different with GPU, and performance is still very slow, I'm going to reimplement the interpreter with SIMD support and maybe enable JIT/AOT support using llvm.
Test result update : (MacBook Pro (16-inch, 2019) AMD Radeon Pro 5300M 4 GB)
| Shadertoy link | WebGL result | SPVM result |
|---|---|---|
| https://www.shadertoy.com/view/4dGBWy | ![]() |
![]() |
| https://www.shadertoy.com/view/4sdBDn | ![]() |
![]() |
| https://www.shadertoy.com/view/wt2fWw | ![]() |
![]() |
| https://www.shadertoy.com/view/lttfR8 | ![]() |
![]() |
| https://www.shadertoy.com/view/NljfzV | ![]() |
crash |
| https://www.shadertoy.com/view/4lKcDD | ![]() |
![]() |
| https://www.shadertoy.com/view/sldGDf | ![]() |
![]() |
| https://www.shadertoy.com/view/NslGRN | ![]() |
![]() |
| https://www.shadertoy.com/view/slsXzs | ![]() |
![]() |
| https://www.shadertoy.com/view/ftlcDS | ![]() |
![]() |
| https://www.shadertoy.com/view/NsBBDW | ![]() |
![]() |
| https://www.shadertoy.com/view/ftXXW4 | ![]() |
![]() |
| https://www.shadertoy.com/view/7ddfzr | ![]() |
![]() |
| https://www.shadertoy.com/view/wdVyWD | ![]() |
![]() |


































