From 70a03b20a2648bcf24782c945e64e3ac5f6ae31f Mon Sep 17 00:00:00 2001 From: grovesNL Date: Mon, 17 Sep 2018 23:12:30 -0600 Subject: [PATCH] Add more command types --- src/command/mod.rs | 59 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/command/mod.rs b/src/command/mod.rs index 762a4a2e7..ea31b64a6 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -6,13 +6,70 @@ pub use self::render::*; use hal; -use {CommandBufferHandle, ComputePassHandle, RenderPassHandle}; +use {BufferHandle, Color, CommandBufferHandle, ComputePassHandle, Origin3d, + RenderPassHandle, TextureViewHandle, TextureHandle}; +#[repr(C)] +pub enum LoadOp { + Clear = 0, + Load = 1, +} + +#[repr(C)] +pub enum StoreOp { + Store = 0, +} + +#[repr(C)] +pub struct RenderPassColorAttachmentDescriptor { + pub attachment: TextureViewHandle, + pub load_op: LoadOp, + pub store_op: StoreOp, + pub clear_color: Color, +} + +#[repr(C)] +pub struct RenderPassDepthStencilAttachmentDescriptor { + pub attachment: TextureViewHandle, + pub depth_load_op: LoadOp, + pub depth_store_op: StoreOp, + pub clear_depth: f32, + pub stencil_load_op: LoadOp, + pub stencil_store_op: StoreOp, + pub clear_stencil: u32, +} + +#[repr(C)] +pub struct RenderPassDescriptor<'a> { + pub color_attachments: &'a [RenderPassColorAttachmentDescriptor], + pub depth_stencil_attachment: RenderPassDepthStencilAttachmentDescriptor, +} + +#[repr(C)] +pub struct BufferCopyView { + pub buffer: BufferHandle, + pub offset: u32, + pub row_pitch: u32, + pub image_height: u32, +} + +#[repr(C)] +pub struct TextureCopyView { + pub texture: TextureHandle, + pub level: u32, + pub slice: u32, + pub origin: Origin3d, + //TODO: pub aspect: TextureAspect, +} + pub struct CommandBuffer { raw: B::CommandBuffer, } +#[repr(C)] +pub struct CommandBufferDescriptor; + pub extern "C" fn command_buffer_begin_render_pass( command_buffer: CommandBufferHandle