This is a starting point for running compute shaders and drawing the image output into a window, based on wgpu. You should be able to change the shader (paint.wgsl) and run using simply cargo run
.
If there are syntax errors in the shader, the error message can be pretty cryptic. It might be useful to run naga from the commandline to validate the shader code.
The shading language for this example is WGSL, translated by naga, but it is possible to run wgpu in native mode with SPIR-V shaders as well. At the time of this writing, compute shaders are blocked on [naga#875], but when the fix for that lands, the experience should be better, and that will also open up features like atomics (and possibly subgroup operations) that are not presently supported by the wgpu stack.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。