Struct stark::graphics::GraphicsState[][src]

pub struct GraphicsState<B: Backend> {
Show fields surface_extent: Extent2D, instance: B::Instance, surface: Option<B::Surface>, adapter: Adapter<B>, device: B::Device, queue_group: QueueGroup<B>, surface_color_format: Format, render_passes: Vec<B::RenderPass>, framebuffer: Option<B::Framebuffer>, command_pool: Option<B::CommandPool>, command_buffers: Vec<B::CommandBuffer>, vertex_memory: Vec<B::Memory>, vertex_buffers: Vec<B::Buffer>, pipeline_layouts: Vec<B::PipelineLayout>, pipelines: Vec<B::GraphicsPipeline>, submission_complete_fence: Option<B::Fence>, rendering_complete_semaphore: Option<B::Semaphore>,
}
Expand description

Stores all persistent gfx-hal (Vulkan) objects

Fields

surface_extent: Extent2Dinstance: B::Instancesurface: Option<B::Surface>adapter: Adapter<B>device: B::Devicequeue_group: QueueGroup<B>surface_color_format: Formatrender_passes: Vec<B::RenderPass>framebuffer: Option<B::Framebuffer>command_pool: Option<B::CommandPool>command_buffers: Vec<B::CommandBuffer>vertex_memory: Vec<B::Memory>vertex_buffers: Vec<B::Buffer>pipeline_layouts: Vec<B::PipelineLayout>pipelines: Vec<B::GraphicsPipeline>submission_complete_fence: Option<B::Fence>rendering_complete_semaphore: Option<B::Semaphore>

Implementations

impl<B: Backend> GraphicsState<B>[src]

pub fn new(window: &FrameHandle, name: &str, width: u32, height: u32) -> Self[src]

Initialize the graphics system and track necessary state

pub fn draw_clear_frame(&mut self, color: [f32; 4]) -> Result<(), &str>[src]

Draw a frame that is cleared to the specified color

pub fn config_swapchain(&mut self)[src]

Reconfigure the swapchain (usually due to new surface extent)

pub fn set_extent(&mut self, width: u32, height: u32)[src]

Set the size of the 2D graphics surface, in pixels

unsafe fn make_buffer(
    &mut self,
    buffer_len: u64,
    usage: Usage,
    properties: Properties
) -> (B::Memory, B::Buffer)
[src]

Create a new buffer for graphics processing and bind its memory

fn compile_shader(glsl: &str, shader_kind: ShaderKind) -> Vec<u32>[src]

Compile GLSL shader code into SPIR-V

unsafe fn make_pipeline(
    &mut self,
    pipeline_layout: &B::PipelineLayout,
    vertex_shader: &str,
    fragment_shader: &str,
    primitive_type: Primitive
) -> B::GraphicsPipeline
[src]

Generate a basic graphics pipeline

Trait Implementations

impl<B: Backend> Drop for GraphicsState<B>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<B> RefUnwindSafe for GraphicsState<B> where
    <B as Backend>::Buffer: RefUnwindSafe,
    <B as Backend>::CommandBuffer: RefUnwindSafe,
    <B as Backend>::CommandPool: RefUnwindSafe,
    <B as Backend>::Device: RefUnwindSafe,
    <B as Backend>::Fence: RefUnwindSafe,
    <B as Backend>::Framebuffer: RefUnwindSafe,
    <B as Backend>::GraphicsPipeline: RefUnwindSafe,
    <B as Backend>::Instance: RefUnwindSafe,
    <B as Backend>::Memory: RefUnwindSafe,
    <B as Backend>::PhysicalDevice: RefUnwindSafe,
    <B as Backend>::PipelineLayout: RefUnwindSafe,
    <B as Backend>::Queue: RefUnwindSafe,
    <B as Backend>::QueueFamily: RefUnwindSafe,
    <B as Backend>::RenderPass: RefUnwindSafe,
    <B as Backend>::Semaphore: RefUnwindSafe,
    <B as Backend>::Surface: RefUnwindSafe

impl<B> Send for GraphicsState<B>

impl<B> Sync for GraphicsState<B>

impl<B> Unpin for GraphicsState<B> where
    <B as Backend>::Buffer: Unpin,
    <B as Backend>::CommandBuffer: Unpin,
    <B as Backend>::CommandPool: Unpin,
    <B as Backend>::Device: Unpin,
    <B as Backend>::Fence: Unpin,
    <B as Backend>::Framebuffer: Unpin,
    <B as Backend>::GraphicsPipeline: Unpin,
    <B as Backend>::Instance: Unpin,
    <B as Backend>::Memory: Unpin,
    <B as Backend>::PhysicalDevice: Unpin,
    <B as Backend>::PipelineLayout: Unpin,
    <B as Backend>::Queue: Unpin,
    <B as Backend>::QueueFamily: Unpin,
    <B as Backend>::RenderPass: Unpin,
    <B as Backend>::Semaphore: Unpin,
    <B as Backend>::Surface: Unpin

impl<B> UnwindSafe for GraphicsState<B> where
    <B as Backend>::Buffer: UnwindSafe,
    <B as Backend>::CommandBuffer: UnwindSafe,
    <B as Backend>::CommandPool: UnwindSafe,
    <B as Backend>::Device: UnwindSafe,
    <B as Backend>::Fence: UnwindSafe,
    <B as Backend>::Framebuffer: UnwindSafe,
    <B as Backend>::GraphicsPipeline: UnwindSafe,
    <B as Backend>::Instance: UnwindSafe,
    <B as Backend>::Memory: UnwindSafe,
    <B as Backend>::PhysicalDevice: UnwindSafe,
    <B as Backend>::PipelineLayout: UnwindSafe,
    <B as Backend>::Queue: UnwindSafe,
    <B as Backend>::QueueFamily: UnwindSafe,
    <B as Backend>::RenderPass: UnwindSafe,
    <B as Backend>::Semaphore: UnwindSafe,
    <B as Backend>::Surface: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.