[−][src]Struct emu_core::compile::SpirvBuilder
A builder for constructing a Spirv
You can use it in the case where you are starting from either u8
bytes or 4-byte u32
words.
let kernel: Vec<u8> = vec![ // Magic number. Version number: 1.0. 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // Generator number: 0. Bound: 0. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Reserved word: 0. 0x00, 0x00, 0x00, 0x00, // OpMemoryModel. Logical. 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // GLSL450. 0x01, 0x00, 0x00, 0x00]; // if we actually compile to a `DeviceFnMut` later on with `finish`, it will panic // at runtime because our SPIR-V doesn't actually include a main function let spirv: Spirv<Vec<u32>> = SpirvBuilder::new() .set_entry_point_name("main") .add_param_mut::<[f32]>() .add_param::<[f32]>() .set_code_with_u8(Cursor::new(kernel))? .build();
Methods
impl<P: BorrowMut<[u32]>> SpirvBuilder<P>
[src]
pub fn new() -> Self
[src]
Creates a new builder
pub fn set_entry_point_name(self, name: impl Into<String>) -> Self
[src]
Sets the name of the point in this chunk of SPIR-V where it should be entered
If you are compiling from GLSL, for example, your entry point name might be "main" if you have a "void main" function.
pub fn add_param<T: ?Sized>(self) -> Self
[src]
Appends a new constant parameter to the kernel in this SPIR-V
pub fn add_param_mut<T: ?Sized>(self) -> Self
[src]
Appends a new mutable parameter to the kernel in this SPIR-V
pub fn set_code_with_u32(self, code: P) -> Result<Self, Error>
[src]
Set the actual code itself using an owned or borrowed slice of u32
pub fn build(self) -> Spirv<P>
[src]
Finish building
impl SpirvBuilder<Vec<u32>>
[src]
pub fn set_code_with_u8(self, code: impl Read + Seek) -> Result<Self, Error>
[src]
Set the actual code itself using an owned `Vec
Auto Trait Implementations
impl<P> RefUnwindSafe for SpirvBuilder<P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for SpirvBuilder<P> where
P: Send,
P: Send,
impl<P> Sync for SpirvBuilder<P> where
P: Sync,
P: Sync,
impl<P> Unpin for SpirvBuilder<P> where
P: Unpin,
P: Unpin,
impl<P> UnwindSafe for SpirvBuilder<P> where
P: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> AsDeviceBoxed<T> for U where
T: AsBytes + ?Sized,
U: Borrow<T>,
[src]
T: AsBytes + ?Sized,
U: Borrow<T>,
fn as_device_boxed(&Self) -> Result<DeviceBox<T>, NoDeviceError>
[src]
fn as_device_boxed_mut(&Self) -> Result<DeviceBox<T>, NoDeviceError>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,