pub struct Gfx {
pub present: Present,
pub used: bool,
/* private fields */
}Fields§
§present: Presenthow video_present frames are shown (filter, integer scaling)
used: boolset by the guest calling any gfx draw API this frame (suppresses the 2D blit)
Implementations§
Source§impl Gfx
impl Gfx
Sourcepub fn offscreen(width: u32, height: u32) -> Result<Gfx, String>
pub fn offscreen(width: u32, height: u32) -> Result<Gfx, String>
Render into an RGBA texture that can be read back (headless screenshots).
pub fn size(&self) -> (u32, u32)
pub fn resize(&mut self, width: u32, height: u32)
Sourcepub fn destroy(&mut self, h: u32) -> Result<(), String>
pub fn destroy(&mut self, h: u32) -> Result<(), String>
Release an object: the handle becomes a tombstone (never reused). wgpu keeps the resource alive while bind groups or a recorded pass use it.
pub fn create_shader(&mut self, wgsl: &str) -> Result<u32, String>
pub fn create_buffer(&mut self, size: u32, usage: u32) -> Result<u32, String>
pub fn write_buffer( &mut self, h: u32, offset: u32, data: &[u8], ) -> Result<(), String>
pub fn create_pipeline(&mut self, json: &str) -> Result<u32, String>
pub fn create_bind_group(&mut self, json: &str) -> Result<u32, String>
pub fn create_bind_group_layout(&mut self, json: &str) -> Result<u32, String>
pub fn create_texture(&mut self, json: &str) -> Result<u32, String>
pub fn write_texture( &mut self, h: u32, mip: u32, x: u32, y: u32, w: u32, ht: u32, data: &[u8], ) -> Result<(), String>
pub fn create_sampler(&mut self, json: &str) -> Result<u32, String>
Sourcepub fn begin_frame(
&mut self,
clear: [f32; 4],
show: bool,
) -> Result<bool, String>
pub fn begin_frame( &mut self, clear: [f32; 4], show: bool, ) -> Result<bool, String>
Start a frame. show: whether the runner will display it.
pub fn set_pipeline(&mut self, h: u32) -> Result<(), String>
pub fn set_bind_group(&mut self, index: u32, h: u32) -> Result<(), String>
pub fn set_bind_group_offsets( &mut self, index: u32, h: u32, offsets: &[u32], ) -> Result<(), String>
pub fn set_viewport( &mut self, x: f32, y: f32, w: f32, h: f32, min_depth: f32, max_depth: f32, ) -> Result<(), String>
pub fn set_scissor_rect( &mut self, x: u32, y: u32, w: u32, h: u32, ) -> Result<(), String>
pub fn set_vertex_buffer( &mut self, slot: u32, h: u32, offset: u32, ) -> Result<(), String>
pub fn set_index_buffer( &mut self, h: u32, format: u32, offset: u32, ) -> Result<(), String>
pub fn draw(&mut self, vc: u32, ic: u32, fv: u32, fi: u32) -> Result<(), String>
pub fn draw_indexed( &mut self, ic: u32, inst: u32, first: u32, base: i32, fi: u32, ) -> Result<(), String>
Sourcepub fn end_frame(&mut self) -> Result<(), String>
pub fn end_frame(&mut self) -> Result<(), String>
End the frame: submit (inside an error scope, so GPU validation errors trap) and present.
Sourcepub fn present_video(
&mut self,
rgba: &[u8],
w: u32,
h: u32,
aspect: Option<(u32, u32)>,
)
pub fn present_video( &mut self, rgba: &[u8], w: u32, h: u32, aspect: Option<(u32, u32)>, )
Show an RGBA frame in the window, letterboxed and filtered (self.present).
Auto Trait Implementations§
impl !Freeze for Gfx
impl !RefUnwindSafe for Gfx
impl !UnwindSafe for Gfx
impl Send for Gfx
impl Sync for Gfx
impl Unpin for Gfx
impl UnsafeUnpin for Gfx
Blanket Implementations§
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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