#emu #glsl #compute #em #computer-vision #emu-glsl

emu_core

A low-level GPGPU compute library featuring cross-platform support and SPIR-V as input

2 releases

0.1.1 Apr 9, 2020
0.1.0 Apr 9, 2020

#330 in Rendering

34 downloads per month

MIT license

120KB
1.5K SLoC

To get started with Emu, check out the repository or documentation for information.


lib.rs:

emu_core is a library that serves as a compute-focused abstraction over WebGPU. Despite its name, WebGPU allows Emu to support most platforms (through Vulkan, Metal, DX) and eventually even the web itself (through WebAssembly - API changes to support this should be minimal).

You can see the crate for how to add Emu to your Rust project (emu_core = "*") and the examples for how to use Emu. The following link to documentation of what are essentially the building blocks of Emu.

Note that Device and pool are the lowest-level building blocks for the rest of Emu and as such, you could technically use either just Device and pool or just the rest of Emu. In practice though, you will probably do both. You will use the rest of Emu for most of your application/library and then drop down to low-level Device-and-pool usage in rare cases when you want to work with the underlying WebGPU data (maybe to mix in graphics with your compute) structures or to have finer control over certain parameters.

And about features - there is 1 feature that by default is switched off - glsl-compile. You should enable this feature if you would like to use Glsl or GlslKernel. This feature has one important dependency - shaderc. In the future, when a Rust-based GLSL-to-SPIR-V compiler is finished (there is work going towards this), there will be a simpler pure-Rust dependency but until then, you should follow steps here to ensure the platforms you target will have shaderc. Of course, if you really don't want to use shaderc, you could always compile your code to SPIR-V at compile time and then use SPIR-V as input to Emu.

Also, some basic guides that will likely be helpful in using Emu are the following.

  • How to use CUDA - This explains the idea of launching kernels on a 3-dimensional space of threads, which Emu and CUDA share
  • How to write GLSL compute shaders - This explains some of the stuff that is specific to SPIR-V, which Emu uses as input The module to import to import everything else

Dependencies

~7–14MB
~278K SLoC