Trait Device

Source
pub trait Device: Sized {
    type Resources: Resources;
    type CommandBuffer: Buffer<Self::Resources>;

    // Required methods
    fn get_capabilities(&self) -> &Capabilities;
    fn pin_submitted_resources(&mut self, _: &Manager<Self::Resources>);
    fn submit(
        &mut self,
        _: &mut Self::CommandBuffer,
        access: &AccessInfo<Self::Resources>,
    ) -> SubmissionResult<()>;
    fn fenced_submit(
        &mut self,
        _: &mut Self::CommandBuffer,
        access: &AccessInfo<Self::Resources>,
        after: Option<Fence<Self::Resources>>,
    ) -> SubmissionResult<Fence<Self::Resources>>;
    fn wait_fence(&mut self, _: &Fence<Self::Resources>);
    fn cleanup(&mut self);
}
Expand description

A Device is responsible for submitting CommandBuffers to the GPU.

Required Associated Types§

Source

type Resources: Resources

Associated Resources type.

Source

type CommandBuffer: Buffer<Self::Resources>

Associated CommandBuffer type. Every Device type can only work with one CommandBuffer type.

Required Methods§

Source

fn get_capabilities(&self) -> &Capabilities

Returns the capabilities of this Device.

Source

fn pin_submitted_resources(&mut self, _: &Manager<Self::Resources>)

Pin everything from this handle manager to live for a frame.

Source

fn submit( &mut self, _: &mut Self::CommandBuffer, access: &AccessInfo<Self::Resources>, ) -> SubmissionResult<()>

Submits a CommandBuffer to the GPU for execution.

Source

fn fenced_submit( &mut self, _: &mut Self::CommandBuffer, access: &AccessInfo<Self::Resources>, after: Option<Fence<Self::Resources>>, ) -> SubmissionResult<Fence<Self::Resources>>

Submits a CommandBuffer to the GPU for execution. returns a fence that is signaled after the GPU has executed all commands

Source

fn wait_fence(&mut self, _: &Fence<Self::Resources>)

Stalls the current thread until the fence is satisfied

Source

fn cleanup(&mut self)

Cleanup unused resources. This should be called between frames.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§