pub struct GpuState { /* private fields */ }Expand description
Per-module GPU state: device, queue, and resource tables.
Implementations§
Source§impl GpuState
impl GpuState
Sourcepub fn create_buffer(&mut self, size: u64, usage_bits: u32) -> GpuHandle
pub fn create_buffer(&mut self, size: u64, usage_bits: u32) -> GpuHandle
Create a GPU buffer with the given size and usage flags. Returns a handle, or 0 on failure.
Sourcepub fn create_texture(&mut self, width: u32, height: u32) -> GpuHandle
pub fn create_texture(&mut self, width: u32, height: u32) -> GpuHandle
Create a 2D RGBA8 texture. Returns a handle, or 0 on failure.
Sourcepub fn create_shader(&mut self, source: &str) -> GpuHandle
pub fn create_shader(&mut self, source: &str) -> GpuHandle
Compile a WGSL shader module. Returns a handle, or 0 on failure.
Sourcepub fn create_render_pipeline(
&mut self,
shader_handle: GpuHandle,
vertex_entry: &str,
fragment_entry: &str,
) -> GpuHandle
pub fn create_render_pipeline( &mut self, shader_handle: GpuHandle, vertex_entry: &str, fragment_entry: &str, ) -> GpuHandle
Create a render pipeline from a shader handle.
vertex_entry and fragment_entry name the WGSL entry points.
Returns a handle, or 0 if the shader handle is invalid.
Sourcepub fn create_compute_pipeline(
&mut self,
shader_handle: GpuHandle,
entry_point: &str,
) -> GpuHandle
pub fn create_compute_pipeline( &mut self, shader_handle: GpuHandle, entry_point: &str, ) -> GpuHandle
Create a compute pipeline from a shader handle.
Sourcepub fn write_buffer(&self, handle: GpuHandle, offset: u64, data: &[u8]) -> bool
pub fn write_buffer(&self, handle: GpuHandle, offset: u64, data: &[u8]) -> bool
Write data to a GPU buffer from guest memory.
Sourcepub fn draw(
&self,
pipeline_handle: GpuHandle,
target_texture: GpuHandle,
vertex_count: u32,
instance_count: u32,
) -> bool
pub fn draw( &self, pipeline_handle: GpuHandle, target_texture: GpuHandle, vertex_count: u32, instance_count: u32, ) -> bool
Submit a render pass that draws vertex_count vertices using the given pipeline,
targeting a texture.
Sourcepub fn dispatch_compute(
&self,
pipeline_handle: GpuHandle,
workgroups_x: u32,
workgroups_y: u32,
workgroups_z: u32,
) -> bool
pub fn dispatch_compute( &self, pipeline_handle: GpuHandle, workgroups_x: u32, workgroups_y: u32, workgroups_z: u32, ) -> bool
Submit a compute dispatch.
Sourcepub fn destroy_buffer(&mut self, handle: GpuHandle) -> bool
pub fn destroy_buffer(&mut self, handle: GpuHandle) -> bool
Destroy a buffer resource.
Sourcepub fn destroy_texture(&mut self, handle: GpuHandle) -> bool
pub fn destroy_texture(&mut self, handle: GpuHandle) -> bool
Destroy a texture resource.
Auto Trait Implementations§
impl Freeze for GpuState
impl !RefUnwindSafe for GpuState
impl Send for GpuState
impl Sync for GpuState
impl Unpin for GpuState
impl UnsafeUnpin for GpuState
impl !UnwindSafe for GpuState
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.