-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add a wgpu
backend
#63
base: master
Are you sure you want to change the base?
Conversation
on wgpu 0.7.1, spirv_cross is used to compile shader to metal, and
So we can either A) not the wgpu backend on macos or B) use the git version of wgpu, which uses naga instead and let's you catch the errors. |
Yikes, I got the git version of wgpu to work on macOS but it hangs the GPU 😟. Perhaps because naga creates less optimised metal shaders than spirv-opt does at present? I've got a branch here: https://github.com/expenses/shadertoy-browser/pull/new/wgpu-git-backend if you want to try it and see if you have more luck. |
It works pretty well on my eGPU actually, so I think that using the git version is the way to go for now. Some shaders stall (which causes the whole grid to stall when that's enabled) and some feel a bit unoptimised but in general it works well. |
Cool will try it out |
Oh on Windows getting a bunch of linking errors with shaderc from spirv-cross, dll vs static linking issue: = note: libspirv_cross-0fc766aebb3b8d0a.rlib(wrapper.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_cross.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_cross_util.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_glsl.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_hlsl.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_msl.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_cfg.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_cross_parsed_ir.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
libspirv_cross-0fc766aebb3b8d0a.rlib(spirv_parser.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in libshaderc_sys-74ac287a3a40a409.rlib(shaderc.obj)
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
libshaderc-b97a02d3fb476473.rlib(shaderc-b97a02d3fb476473.shaderc.1on52s2i-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol shaderc_compile_options_set_target_spirv referenced
in function _ZN7shaderc14CompileOptions16set_target_spirv17h04af859c75cbe1bbE
libshaderc-b97a02d3fb476473.rlib(shaderc-b97a02d3fb476473.shaderc.1on52s2i-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol shaderc_compile_options_set_invert_y referenced in function _ZN7shaderc14CompileOptions12set_invert_y17h7ea8b52b62d1889eE
libshaderc-b97a02d3fb476473.rlib(shaderc-b97a02d3fb476473.shaderc.1on52s2i-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol shaderc_compile_options_set_nan_clamp referenced in
function _ZN7shaderc14CompileOptions13set_nan_clamp17haebce51401d88381E
C:\git\private\shadertoy-browser\target\release\deps\shadertoy_browser.exe : fatal error LNK1120: 3 unresolved externals |
Hmm, I don't use Windows that often so I can't really help you there. One of the env variables from https://github.com/google/shaderc-rs#setup might help. |
Now that wgpu 0.8 is out, we can use that instead. I didn't encounter the same shaderc problem as you, probably because I had the vulkan sdk installed. We could set the |
This wgpu backend creates all the pipelines in about 30 seconds on linux, which imo is good enough and doesn't mean we require a pipeline cache as suggested in #62 (comment).
It works flawlessly on linux via vulkan, but I'm still trying it out on macos so better to wait to see how that goes before merging.