[][src]Trait emu_core::compile::CompileToSpirv

pub trait CompileToSpirv<I: Hash, P: BorrowMut<[u32]>> {
    fn compile_to_spirv(src: I) -> Result<Spirv<P>, CompileError>;
}

The trait to implement when adding support for a new source language (e.g. - HLSL, XLA, Swift SIL, etc.).

This trait is generic over the input language (which must be hash-able so we can do caching) and the target bytecode (which can be a Vec<u32> or &mut [u32] for example). We want the target bytecode to be mutable for a reason. We want people to be able to mutate the bytecode later on to do - for example - various linting, optimization, compression, etc. before finishing compilation to DeviceFnMut.

Also, the target bytecode should be a GLSL compute shader with a single entry point of interest.

Required methods

fn compile_to_spirv(src: I) -> Result<Spirv<P>, CompileError>

Compiles the source language into SPIR-V

Loading content...

Implementors

impl CompileToSpirv<Glsl, Vec<u32>> for GlslCompile[src]

impl CompileToSpirv<GlslKernel, Vec<u32>> for GlslKernelCompile[src]

impl<P: Hash + BorrowMut<[u32]>> CompileToSpirv<Spirv<P>, P> for SpirvCompile[src]

Loading content...