more command stuff
This commit is contained in:
parent
dde3093536
commit
b8b9bf40a3
|
|
@ -2,6 +2,7 @@
|
|||
negative_impls,
|
||||
map_try_insert,
|
||||
debug_closure_helpers,
|
||||
core_io_borrowed_buf,
|
||||
slice_partition_dedup
|
||||
)]
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ use super::resources::*;
|
|||
// }
|
||||
|
||||
pub struct Copy<T: Resource, U: Resource> {
|
||||
pub src: Read<T>,
|
||||
pub dst: Write<U>,
|
||||
pub src: T,
|
||||
pub dst: U,
|
||||
}
|
||||
impl<T: Resource, U: Resource> Copy<T, U> {
|
||||
fn side_effects_inner(&self, mut map: SideEffectMap) {
|
||||
|
|
@ -273,9 +273,9 @@ impl Command for UpdateBuffer {
|
|||
}
|
||||
|
||||
pub struct BeginRendering {
|
||||
pub color_attachments: Vec<Write<TextureRegion>>,
|
||||
pub depth_attachment: Option<Write<TextureRegion>>,
|
||||
pub stencil_attachment: Option<Write<TextureRegion>>,
|
||||
pub color_attachments: Vec<TextureRegion>,
|
||||
pub depth_attachment: Option<TextureRegion>,
|
||||
pub stencil_attachment: Option<TextureRegion>,
|
||||
pub area: (u32, u32),
|
||||
pub layers: u32,
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ impl Command for EndRendering {
|
|||
fn apply(self, _recorder: &mut CommandRecorder) {}
|
||||
}
|
||||
|
||||
pub struct BindPipeline(pub Pipeline);
|
||||
pub struct BindPipeline;
|
||||
|
||||
impl Command for BindPipeline {
|
||||
fn side_effects(&self, _map: SideEffectMap) {
|
||||
|
|
@ -329,7 +329,7 @@ impl Command for BindPipeline {
|
|||
}
|
||||
|
||||
pub struct BindVertexBuffers {
|
||||
pub buffers: Vec<Read<BufferSlice>>,
|
||||
pub buffers: Vec<BufferSlice>,
|
||||
}
|
||||
|
||||
impl Command for BindVertexBuffers {
|
||||
|
|
@ -346,7 +346,7 @@ impl Command for BindVertexBuffers {
|
|||
fn apply(self, _recorder: &mut CommandRecorder) {}
|
||||
}
|
||||
|
||||
pub struct BindIndexBuffer(pub Read<BufferSlice>, pub IndexFormat);
|
||||
pub struct BindIndexBuffer(pub BufferSlice, pub IndexFormat);
|
||||
|
||||
impl Command for BindIndexBuffer {
|
||||
fn side_effects(&self, mut map: SideEffectMap) {
|
||||
|
|
@ -357,9 +357,7 @@ impl Command for BindIndexBuffer {
|
|||
fn apply(self, _recorder: &mut CommandRecorder) {}
|
||||
}
|
||||
|
||||
pub struct BindDescriptorSets {
|
||||
pub sets: Vec<DescriptorSet>,
|
||||
}
|
||||
pub struct BindDescriptorSets;
|
||||
|
||||
impl Command for BindDescriptorSets {
|
||||
fn side_effects(&self, _map: SideEffectMap) {
|
||||
|
|
@ -401,9 +399,7 @@ impl Command for SetScissor {
|
|||
fn apply(self, _recorder: &mut CommandRecorder) {}
|
||||
}
|
||||
|
||||
pub struct PushConstants {
|
||||
pub data: Box<[u8]>,
|
||||
}
|
||||
pub struct PushConstants;
|
||||
|
||||
impl Command for PushConstants {
|
||||
fn side_effects(&self, _map: SideEffectMap) {
|
||||
|
|
@ -429,11 +425,15 @@ pub struct DrawIndexedData {
|
|||
}
|
||||
|
||||
pub struct DrawIndirectData {
|
||||
pub indirect_buffer: Read<BufferSlice>,
|
||||
pub indirect_buffer: BufferSlice,
|
||||
pub count: u32,
|
||||
pub stride: u32,
|
||||
}
|
||||
|
||||
pub struct DrawIndexedIndirectData {
|
||||
pub indirect_buffer: Read<BufferSlice>,
|
||||
pub indirect_buffer: BufferSlice,
|
||||
pub count: u32,
|
||||
pub stride: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
|
|
@ -445,9 +445,8 @@ pub enum IndexFormat {
|
|||
|
||||
pub struct Draw<T: IsDrawData> {
|
||||
pub data: T,
|
||||
pub vertex_buffers: Vec<Read<BufferSlice>>,
|
||||
pub index_buffer: Option<(Read<BufferSlice>, IndexFormat)>,
|
||||
pub count_buffer: Option<Read<BufferSlice>>,
|
||||
pub vertex_buffers: Vec<BufferSlice>,
|
||||
pub index_buffer: Option<(BufferSlice, IndexFormat)>,
|
||||
}
|
||||
|
||||
impl<T: IsDrawData> Command for Draw<T> {
|
||||
|
|
@ -467,13 +466,6 @@ impl<T: IsDrawData> Command for Draw<T> {
|
|||
None,
|
||||
);
|
||||
}
|
||||
if let Some(count_buffer) = &self.count_buffer {
|
||||
count_buffer.side_effect(
|
||||
map.reborrow(),
|
||||
vk::AccessFlags2::VERTEX_ATTRIBUTE_READ,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply(self, _recorder: &mut CommandRecorder) {}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@ mod legacy;
|
|||
pub use legacy::*;
|
||||
|
||||
mod commands;
|
||||
mod graph_builder;
|
||||
mod recorder;
|
||||
mod resources;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ pub struct CommandList {
|
|||
num_commands: u32,
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub struct RenderPass<'a> {
|
||||
cmd_list: &'a mut CommandList,
|
||||
}
|
||||
|
|
@ -131,9 +132,9 @@ impl CommandList {
|
|||
|
||||
pub fn begin_rendering(
|
||||
&mut self,
|
||||
color_attachments: Vec<Write<TextureRegion>>,
|
||||
depth_attachment: Option<Write<TextureRegion>>,
|
||||
stencil_attachment: Option<Write<TextureRegion>>,
|
||||
color_attachments: Vec<TextureRegion>,
|
||||
depth_attachment: Option<TextureRegion>,
|
||||
stencil_attachment: Option<TextureRegion>,
|
||||
area: (u32, u32),
|
||||
layers: u32,
|
||||
) -> RenderPass<'_> {
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ pub struct Pipeline;
|
|||
pub struct DescriptorSet;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub struct ResourceId(u32);
|
||||
pub struct ResourceId(pub u32);
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub struct ResourceAccess {
|
||||
|
|
@ -497,8 +497,21 @@ impl TextureRange {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Buffer(ResourceId);
|
||||
pub struct Texture(ResourceId);
|
||||
pub struct Buffer(pub ResourceId);
|
||||
|
||||
impl Buffer {
|
||||
pub fn full_slice(self) -> BufferSlice {
|
||||
BufferSlice {
|
||||
buffer: self,
|
||||
range: BufferRange {
|
||||
offset: 0,
|
||||
size: u64::MAX,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Texture(pub ResourceId);
|
||||
|
||||
pub struct BufferSlice {
|
||||
pub buffer: Buffer,
|
||||
|
|
|
|||
Loading…
Reference in a new issue