pub trait GpuAsyncReadBufferTrait: GpuAsyncReadBufferAsAny {
// Required methods
fn schedule_pixels_transfer(
&self,
framebuffer: &(dyn GpuFrameBufferTrait + 'static),
color_buffer_index: u32,
rect: Option<Rect<i32>>,
) -> Result<(), FrameworkError>;
fn is_request_running(&self) -> bool;
fn try_read(&self) -> Option<Vec<u8>>;
}Expand description
Trait for objects that represent a request to transfer pixel data from some frame buffer into a color buffer.
Required Methods§
Sourcefn schedule_pixels_transfer(
&self,
framebuffer: &(dyn GpuFrameBufferTrait + 'static),
color_buffer_index: u32,
rect: Option<Rect<i32>>,
) -> Result<(), FrameworkError>
fn schedule_pixels_transfer( &self, framebuffer: &(dyn GpuFrameBufferTrait + 'static), color_buffer_index: u32, rect: Option<Rect<i32>>, ) -> Result<(), FrameworkError>
Begin the pixel data transfer by specifying a particular attachment of a particular framebuffer to read from.
framebuffer: The source of the data.color_buffer_index: The index of the color attachment of the framebuffer.rect: The portion of the framebuffer to read.
After this is called, is_request_running will
return true.
Sourcefn is_request_running(&self) -> bool
fn is_request_running(&self) -> bool
Return true if a request has been made and the data has not yet been
retrieved with try_read.
Returning false does not indicate that the data is read; this method
will continue to return true long after the data is read, until try_read is
called to actually read the data.
Implementations§
Source§impl dyn GpuAsyncReadBufferTrait
impl dyn GpuAsyncReadBufferTrait
Sourcepub fn try_read_of_type<T>(&self) -> Option<Vec<T>>where
T: Pod,
pub fn try_read_of_type<T>(&self) -> Option<Vec<T>>where
T: Pod,
Check the state of the data and return the data if it is read, or else
return None. The data is converted into the given type before being returned.
After the data is returned, is_request_running
will return false.