mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-26 00:34:19 +00:00
Adding a command to a builder can now return an error
This commit is contained in:
parent
b61a89cb5c
commit
5de743221b
@ -180,10 +180,10 @@ fn main() {
|
|||||||
.begin_render_pass(
|
.begin_render_pass(
|
||||||
framebuffers[image_num].clone(), false,
|
framebuffers[image_num].clone(), false,
|
||||||
renderpass.desc().start_clear_values()
|
renderpass.desc().start_clear_values()
|
||||||
.color([0.0, 0.0, 1.0, 1.0]))
|
.color([0.0, 0.0, 1.0, 1.0])).unwrap()
|
||||||
.draw(pipeline.clone(), vulkano::command_buffer::DynamicState::none(), vertex_buffer.clone(),
|
.draw(pipeline.clone(), vulkano::command_buffer::DynamicState::none(), vertex_buffer.clone(),
|
||||||
set.clone(), ())
|
set.clone(), ()).unwrap()
|
||||||
.end_render_pass()
|
.end_render_pass().unwrap()
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
|
|
||||||
let future = future
|
let future = future
|
||||||
|
@ -184,12 +184,12 @@ fn main() {
|
|||||||
.begin_render_pass(
|
.begin_render_pass(
|
||||||
framebuffers[image_num].clone(), false,
|
framebuffers[image_num].clone(), false,
|
||||||
renderpass.desc().start_clear_values()
|
renderpass.desc().start_clear_values()
|
||||||
.color([0.0, 0.0, 1.0, 1.0]).depth((1f32)))
|
.color([0.0, 0.0, 1.0, 1.0]).depth((1f32))).unwrap()
|
||||||
.draw_indexed(
|
.draw_indexed(
|
||||||
pipeline.clone(), vulkano::command_buffer::DynamicState::none(),
|
pipeline.clone(), vulkano::command_buffer::DynamicState::none(),
|
||||||
(vertex_buffer.clone(), normals_buffer.clone()),
|
(vertex_buffer.clone(), normals_buffer.clone()),
|
||||||
index_buffer.clone(), set.clone(), ())
|
index_buffer.clone(), set.clone(), ()).unwrap()
|
||||||
.end_render_pass()
|
.end_render_pass().unwrap()
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
|
|
||||||
let future = future
|
let future = future
|
||||||
|
@ -384,17 +384,20 @@ fn main() {
|
|||||||
// only the attachments that use `load: Clear` appear in the list.
|
// only the attachments that use `load: Clear` appear in the list.
|
||||||
.begin_render_pass(framebuffers[image_num].clone(), false,
|
.begin_render_pass(framebuffers[image_num].clone(), false,
|
||||||
render_pass.desc().start_clear_values().color([0.0, 0.0, 1.0, 1.0]))
|
render_pass.desc().start_clear_values().color([0.0, 0.0, 1.0, 1.0]))
|
||||||
|
.unwrap()
|
||||||
|
|
||||||
// We are now inside the first subpass of the render pass. We add a draw command.
|
// We are now inside the first subpass of the render pass. We add a draw command.
|
||||||
//
|
//
|
||||||
// The last two parameters contain the list of resources to pass to the shaders.
|
// The last two parameters contain the list of resources to pass to the shaders.
|
||||||
// Since we used an `EmptyPipeline` object, the objects have to be `()`.
|
// Since we used an `EmptyPipeline` object, the objects have to be `()`.
|
||||||
.draw(pipeline.clone(), DynamicState::none(), vertex_buffer.clone(), (), ())
|
.draw(pipeline.clone(), DynamicState::none(), vertex_buffer.clone(), (), ())
|
||||||
|
.unwrap()
|
||||||
|
|
||||||
// We leave the render pass by calling `draw_end`. Note that if we had multiple
|
// We leave the render pass by calling `draw_end`. Note that if we had multiple
|
||||||
// subpasses we could have called `next_inline` (or `next_secondary`) to jump to the
|
// subpasses we could have called `next_inline` (or `next_secondary`) to jump to the
|
||||||
// next subpass.
|
// next subpass.
|
||||||
.end_render_pass()
|
.end_render_pass()
|
||||||
|
.unwrap()
|
||||||
|
|
||||||
// Finish building the command buffer by calling `build`.
|
// Finish building the command buffer by calling `build`.
|
||||||
.build().unwrap();
|
.build().unwrap();
|
||||||
|
@ -16,6 +16,7 @@ use command_buffer::commands_raw;
|
|||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
use command_buffer::cb::UnsafeCommandBuffer;
|
use command_buffer::cb::UnsafeCommandBuffer;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBuffer;
|
use command_buffer::CommandBuffer;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -142,10 +143,10 @@ macro_rules! pass_through {
|
|||||||
type Out = AutoCommandBufferBuilder<P>;
|
type Out = AutoCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
AutoCommandBufferBuilder {
|
Ok(AutoCommandBufferBuilder {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use std::error;
|
||||||
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use buffer::Buffer;
|
use buffer::Buffer;
|
||||||
@ -42,33 +44,45 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
/// > this function only for zeroing the content of a buffer by passing `0` for the data.
|
/// > this function only for zeroing the content of a buffer by passing `0` for the data.
|
||||||
// TODO: not safe because of signalling NaNs
|
// TODO: not safe because of signalling NaNs
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fill_buffer<B, O>(self, buffer: B, data: u32) -> Result<O, commands_raw::CmdFillBufferError>
|
fn fill_buffer<B, O>(self, buffer: B, data: u32) -> Result<O, CommandBufferBuilderError<commands_raw::CmdFillBufferError>>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdFillBuffer<B::Access>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdFillBuffer<B::Access>, Out = O>,
|
||||||
B: Buffer
|
B: Buffer
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdFillBuffer::new(buffer.access(), data)?;
|
let cmd = match commands_raw::CmdFillBuffer::new(buffer.access(), data) {
|
||||||
Ok(self.add(cmd))
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a command that writes data to a buffer.
|
/// Adds a command that writes data to a buffer.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn update_buffer<B, D, O>(self, buffer: B, data: D) -> Result<O, commands_raw::CmdUpdateBufferError>
|
fn update_buffer<B, D, O>(self, buffer: B, data: D) -> Result<O, CommandBufferBuilderError<commands_raw::CmdUpdateBufferError>>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdUpdateBuffer<B::Access, D>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdUpdateBuffer<B::Access, D>, Out = O>,
|
||||||
B: Buffer
|
B: Buffer
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdUpdateBuffer::new(buffer.access(), data)?;
|
let cmd = match commands_raw::CmdUpdateBuffer::new(buffer.access(), data) {
|
||||||
Ok(self.add(cmd))
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a command that copies from a buffer to another.
|
/// Adds a command that copies from a buffer to another.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn copy_buffer<S, D, O>(self, src: S, dest: D) -> Result<O, commands_raw::CmdCopyBufferError>
|
fn copy_buffer<S, D, O>(self, src: S, dest: D) -> Result<O, CommandBufferBuilderError<commands_raw::CmdCopyBufferError>>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdCopyBuffer<S::Access, D::Access>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdCopyBuffer<S::Access, D::Access>, Out = O>,
|
||||||
S: Buffer,
|
S: Buffer,
|
||||||
D: Buffer
|
D: Buffer
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdCopyBuffer::new(src.access(), dest.access())?;
|
let cmd = match commands_raw::CmdCopyBuffer::new(src.access(), dest.access()) {
|
||||||
Ok(self.add(cmd))
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a command that copies the content of a buffer to an image.
|
/// Adds a command that copies the content of a buffer to an image.
|
||||||
@ -84,26 +98,35 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
// TODO: not safe because of signalling NaNs
|
// TODO: not safe because of signalling NaNs
|
||||||
#[inline]
|
#[inline]
|
||||||
fn copy_buffer_to_image<B, I, O>(self, buffer: B, image: I)
|
fn copy_buffer_to_image<B, I, O>(self, buffer: B, image: I)
|
||||||
-> Result<O, commands_raw::CmdCopyBufferToImageError>
|
-> Result<O, CommandBufferBuilderError<commands_raw::CmdCopyBufferToImageError>>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
|
||||||
B: Buffer, I: Image
|
B: Buffer, I: Image
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdCopyBufferToImage::new(buffer.access(), image.access())?;
|
let cmd = match commands_raw::CmdCopyBufferToImage::new(buffer.access(), image.access()) {
|
||||||
Ok(self.add(cmd))
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as `copy_buffer_to_image` but lets you specify a range for the destination image.
|
/// Same as `copy_buffer_to_image` but lets you specify a range for the destination image.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn copy_buffer_to_image_dimensions<B, I, O>(self, buffer: B, image: I, offset: [u32; 3],
|
fn copy_buffer_to_image_dimensions<B, I, O>(self, buffer: B, image: I, offset: [u32; 3],
|
||||||
size: [u32; 3], first_layer: u32, num_layers: u32,
|
size: [u32; 3], first_layer: u32, num_layers: u32,
|
||||||
mipmap: u32) -> Result<O, commands_raw::CmdCopyBufferToImageError>
|
mipmap: u32) -> Result<O, CommandBufferBuilderError<commands_raw::CmdCopyBufferToImageError>>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
|
||||||
B: Buffer, I: Image
|
B: Buffer, I: Image
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdCopyBufferToImage::with_dimensions(buffer.access(),
|
let cmd = match commands_raw::CmdCopyBufferToImage::with_dimensions(buffer.access(),
|
||||||
image.access(), offset, size,
|
image.access(), offset, size,
|
||||||
first_layer, num_layers, mipmap)?;
|
first_layer, num_layers, mipmap)
|
||||||
Ok(self.add(cmd))
|
{
|
||||||
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a command that starts a render pass.
|
/// Adds a command that starts a render pass.
|
||||||
@ -115,7 +138,7 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
/// You must call this before you can add draw commands.
|
/// You must call this before you can add draw commands.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn begin_render_pass<F, C, O>(self, framebuffer: F, secondary: bool, clear_values: C)
|
fn begin_render_pass<F, C, O>(self, framebuffer: F, secondary: bool, clear_values: C)
|
||||||
-> O
|
-> Result<O, CommandAddError>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdBeginRenderPass<Arc<RenderPassAbstract + Send + Sync>, F>, Out = O>,
|
where Self: Sized + AddCommand<commands_raw::CmdBeginRenderPass<Arc<RenderPassAbstract + Send + Sync>, F>, Out = O>,
|
||||||
F: FramebufferAbstract + RenderPassDescClearValues<C>
|
F: FramebufferAbstract + RenderPassDescClearValues<C>
|
||||||
{
|
{
|
||||||
@ -125,7 +148,7 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
|
|
||||||
/// Adds a command that jumps to the next subpass of the current render pass.
|
/// Adds a command that jumps to the next subpass of the current render pass.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next_subpass<O>(self, secondary: bool) -> O
|
fn next_subpass<O>(self, secondary: bool) -> Result<O, CommandAddError>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdNextSubpass, Out = O>
|
where Self: Sized + AddCommand<commands_raw::CmdNextSubpass, Out = O>
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdNextSubpass::new(secondary);
|
let cmd = commands_raw::CmdNextSubpass::new(secondary);
|
||||||
@ -137,7 +160,7 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
/// This must be called after you went through all the subpasses and before you can build
|
/// This must be called after you went through all the subpasses and before you can build
|
||||||
/// the command buffer or add further commands.
|
/// the command buffer or add further commands.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn end_render_pass<O>(self) -> O
|
fn end_render_pass<O>(self) -> Result<O, CommandAddError>
|
||||||
where Self: Sized + AddCommand<commands_raw::CmdEndRenderPass, Out = O>
|
where Self: Sized + AddCommand<commands_raw::CmdEndRenderPass, Out = O>
|
||||||
{
|
{
|
||||||
let cmd = commands_raw::CmdEndRenderPass::new();
|
let cmd = commands_raw::CmdEndRenderPass::new();
|
||||||
@ -149,7 +172,7 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
/// Can only be used from inside a render pass.
|
/// Can only be used from inside a render pass.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn draw<P, S, Pc, V, O>(self, pipeline: P, dynamic: DynamicState, vertices: V, sets: S,
|
fn draw<P, S, Pc, V, O>(self, pipeline: P, dynamic: DynamicState, vertices: V, sets: S,
|
||||||
push_constants: Pc) -> O
|
push_constants: Pc) -> Result<O, CommandAddError>
|
||||||
where Self: Sized + AddCommand<commands_extra::CmdDraw<V, P, S, Pc>, Out = O>,
|
where Self: Sized + AddCommand<commands_extra::CmdDraw<V, P, S, Pc>, Out = O>,
|
||||||
S: DescriptorSetsCollection,
|
S: DescriptorSetsCollection,
|
||||||
P: VertexSource<V> + GraphicsPipelineAbstract + Clone
|
P: VertexSource<V> + GraphicsPipelineAbstract + Clone
|
||||||
@ -163,7 +186,7 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
/// Can only be used from inside a render pass.
|
/// Can only be used from inside a render pass.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn draw_indexed<P, S, Pc, V, Ib, I, O>(self, pipeline: P, dynamic: DynamicState,
|
fn draw_indexed<P, S, Pc, V, Ib, I, O>(self, pipeline: P, dynamic: DynamicState,
|
||||||
vertices: V, index_buffer: Ib, sets: S, push_constants: Pc) -> O
|
vertices: V, index_buffer: Ib, sets: S, push_constants: Pc) -> Result<O, CommandAddError>
|
||||||
where Self: Sized + AddCommand<commands_extra::CmdDrawIndexed<V, Ib::Access, P, S, Pc>, Out = O>,
|
where Self: Sized + AddCommand<commands_extra::CmdDrawIndexed<V, Ib::Access, P, S, Pc>, Out = O>,
|
||||||
S: DescriptorSetsCollection,
|
S: DescriptorSetsCollection,
|
||||||
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
|
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
|
||||||
@ -178,13 +201,17 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
|
|
||||||
/// Executes a compute shader.
|
/// Executes a compute shader.
|
||||||
fn dispatch<P, S, Pc, O>(self, dimensions: [u32; 3], pipeline: P, sets: S, push_constants: Pc)
|
fn dispatch<P, S, Pc, O>(self, dimensions: [u32; 3], pipeline: P, sets: S, push_constants: Pc)
|
||||||
-> Result<O, commands_extra::CmdDispatchError>
|
-> Result<O, CommandBufferBuilderError<commands_extra::CmdDispatchError>>
|
||||||
where Self: Sized + AddCommand<commands_extra::CmdDispatch<P, S, Pc>, Out = O>,
|
where Self: Sized + AddCommand<commands_extra::CmdDispatch<P, S, Pc>, Out = O>,
|
||||||
S: DescriptorSetsCollection,
|
S: DescriptorSetsCollection,
|
||||||
P: Clone + ComputePipelineAbstract,
|
P: Clone + ComputePipelineAbstract,
|
||||||
{
|
{
|
||||||
let cmd = try!(commands_extra::CmdDispatch::new(dimensions, pipeline, sets, push_constants));
|
let cmd = match commands_extra::CmdDispatch::new(dimensions, pipeline, sets, push_constants) {
|
||||||
Ok(self.add(cmd))
|
Ok(cmd) => cmd,
|
||||||
|
Err(err) => return Err(CommandBufferBuilderError::CommandBuildError(err)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(self.add(cmd)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the actual command buffer.
|
/// Builds the actual command buffer.
|
||||||
@ -206,11 +233,101 @@ pub unsafe trait CommandBufferBuilder: DeviceOwned {
|
|||||||
fn supports_compute(&self) -> bool;
|
fn supports_compute(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe trait CommandBufferBuilderBuffered {
|
/// Error that can happen when adding a command to a command buffer builder.
|
||||||
/// Adds a pipeline barrier to the underlying command buffer and bypasses the flushing
|
#[derive(Debug, Copy, Clone)]
|
||||||
/// mechanism.
|
pub enum CommandBufferBuilderError<E> {
|
||||||
fn add_non_buffered_pipeline_barrier(&mut self, cmd: &commands_raw::CmdPipelineBarrier);
|
/// Error while creating the command.
|
||||||
|
CommandBuildError(E),
|
||||||
|
|
||||||
/// Flushes all the commands that haven't been flushed to the inner builder.
|
/// Error while adding the command to the builder.
|
||||||
fn flush(&mut self);
|
CommandAddError(CommandAddError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E> From<CommandAddError> for CommandBufferBuilderError<E> {
|
||||||
|
#[inline]
|
||||||
|
fn from(err: CommandAddError) -> CommandBufferBuilderError<E> {
|
||||||
|
CommandBufferBuilderError::CommandAddError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E> error::Error for CommandBufferBuilderError<E> where E: error::Error {
|
||||||
|
#[inline]
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
CommandBufferBuilderError::CommandBuildError(_) => {
|
||||||
|
"error while creating a command to add to a builder"
|
||||||
|
},
|
||||||
|
CommandBufferBuilderError::CommandAddError(_) => {
|
||||||
|
"error while adding a command to the builder"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn cause(&self) -> Option<&error::Error> {
|
||||||
|
match *self {
|
||||||
|
CommandBufferBuilderError::CommandBuildError(ref err) => {
|
||||||
|
Some(err)
|
||||||
|
},
|
||||||
|
CommandBufferBuilderError::CommandAddError(ref err) => {
|
||||||
|
Some(err)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E> fmt::Display for CommandBufferBuilderError<E> where E: error::Error {
|
||||||
|
#[inline]
|
||||||
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
|
write!(fmt, "{}", error::Error::description(self))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Error that can happen when adding a command to a command buffer builder.
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub enum CommandAddError {
|
||||||
|
/// This command is forbidden when inside a render pass.
|
||||||
|
ForbiddenInsideRenderPass,
|
||||||
|
|
||||||
|
/// This command is forbidden when outside of a render pass.
|
||||||
|
ForbiddenOutsideRenderPass,
|
||||||
|
|
||||||
|
/// This command is forbidden in a secondary command buffer.
|
||||||
|
ForbiddenInSecondaryCommandBuffer,
|
||||||
|
|
||||||
|
/// The queue family doesn't support graphics operations.
|
||||||
|
GraphicsOperationsNotSupported,
|
||||||
|
|
||||||
|
/// The queue family doesn't support compute operations.
|
||||||
|
ComputeOperationsNotSupported,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl error::Error for CommandAddError {
|
||||||
|
#[inline]
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
CommandAddError::ForbiddenInsideRenderPass => {
|
||||||
|
"this command is forbidden when inside a render pass"
|
||||||
|
},
|
||||||
|
CommandAddError::ForbiddenOutsideRenderPass => {
|
||||||
|
"this command is forbidden when outside of a render pass"
|
||||||
|
},
|
||||||
|
CommandAddError::ForbiddenInSecondaryCommandBuffer => {
|
||||||
|
"this command is forbidden in a secondary command buffer"
|
||||||
|
},
|
||||||
|
CommandAddError::GraphicsOperationsNotSupported => {
|
||||||
|
"the queue family doesn't support graphics operations"
|
||||||
|
},
|
||||||
|
CommandAddError::ComputeOperationsNotSupported => {
|
||||||
|
"the queue family doesn't support compute operations"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for CommandAddError {
|
||||||
|
#[inline]
|
||||||
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
|
write!(fmt, "{}", error::Error::description(self))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ use command_buffer::cb::AddCommand;
|
|||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
use command_buffer::cb::UnsafeCommandBuffer;
|
use command_buffer::cb::UnsafeCommandBuffer;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBuffer;
|
use command_buffer::CommandBuffer;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
@ -115,15 +116,15 @@ macro_rules! pass_through {
|
|||||||
type Out = AbstractStorageLayer<I>;
|
type Out = AbstractStorageLayer<I>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: $cmd) -> Self::Out {
|
fn add(mut self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
let new_inner = AddCommand::add(self.inner, &command);
|
let new_inner = AddCommand::add(self.inner, &command)?;
|
||||||
// TODO: should store a lightweight version of the command
|
// TODO: should store a lightweight version of the command
|
||||||
self.commands.push(Box::new(command) as Box<_>);
|
self.commands.push(Box::new(command) as Box<_>);
|
||||||
|
|
||||||
AbstractStorageLayer {
|
Ok(AbstractStorageLayer {
|
||||||
inner: new_inner,
|
inner: new_inner,
|
||||||
commands: self.commands,
|
commands: self.commands,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
@ -84,10 +85,10 @@ macro_rules! pass_through {
|
|||||||
type Out = AutoPipelineBarriersLayer<O>;
|
type Out = AutoPipelineBarriersLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
AutoPipelineBarriersLayer {
|
Ok(AutoPipelineBarriersLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
@ -119,12 +120,12 @@ macro_rules! impl_always {
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: self.inside_render_pass,
|
inside_render_pass: self.inside_render_pass,
|
||||||
allow_render_pass_ops: self.allow_render_pass_ops,
|
allow_render_pass_ops: self.allow_render_pass_ops,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,14 +146,16 @@ macro_rules! impl_inside_only {
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.inside_render_pass); // TODO: proper error
|
if !self.inside_render_pass {
|
||||||
|
return Err(CommandAddError::ForbiddenOutsideRenderPass);
|
||||||
|
}
|
||||||
|
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: self.inside_render_pass,
|
inside_render_pass: self.inside_render_pass,
|
||||||
allow_render_pass_ops: self.allow_render_pass_ops,
|
allow_render_pass_ops: self.allow_render_pass_ops,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,14 +174,16 @@ macro_rules! impl_outside_only {
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(!self.inside_render_pass); // TODO: proper error
|
if self.inside_render_pass {
|
||||||
|
return Err(CommandAddError::ForbiddenInsideRenderPass);
|
||||||
|
}
|
||||||
|
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: self.inside_render_pass,
|
inside_render_pass: self.inside_render_pass,
|
||||||
allow_render_pass_ops: self.allow_render_pass_ops,
|
allow_render_pass_ops: self.allow_render_pass_ops,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,15 +205,20 @@ unsafe impl<'a, I, O, Rp, F> AddCommand<commands_raw::CmdBeginRenderPass<Rp, F>>
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdBeginRenderPass<Rp, F>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdBeginRenderPass<Rp, F>) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(!self.inside_render_pass); // TODO: proper error
|
if self.inside_render_pass {
|
||||||
assert!(self.allow_render_pass_ops); // TODO: proper error
|
return Err(CommandAddError::ForbiddenInsideRenderPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.allow_render_pass_ops {
|
||||||
|
return Err(CommandAddError::ForbiddenInSecondaryCommandBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: true,
|
inside_render_pass: true,
|
||||||
allow_render_pass_ops: true,
|
allow_render_pass_ops: true,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,16 +228,22 @@ unsafe impl<'a, I, O> AddCommand<commands_raw::CmdNextSubpass> for ContextCheckL
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdNextSubpass) -> Self::Out {
|
fn add(self, command: commands_raw::CmdNextSubpass) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.inside_render_pass); // TODO: proper error
|
if !self.inside_render_pass {
|
||||||
assert!(self.allow_render_pass_ops); // TODO: proper error
|
return Err(CommandAddError::ForbiddenOutsideRenderPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.allow_render_pass_ops {
|
||||||
|
return Err(CommandAddError::ForbiddenInSecondaryCommandBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: check number of subpasses
|
// FIXME: check number of subpasses
|
||||||
|
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: true,
|
inside_render_pass: true,
|
||||||
allow_render_pass_ops: true,
|
allow_render_pass_ops: true,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,15 +253,21 @@ unsafe impl<'a, I, O> AddCommand<commands_raw::CmdEndRenderPass> for ContextChec
|
|||||||
type Out = ContextCheckLayer<O>;
|
type Out = ContextCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdEndRenderPass) -> Self::Out {
|
fn add(self, command: commands_raw::CmdEndRenderPass) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.inside_render_pass); // TODO: proper error
|
if !self.inside_render_pass {
|
||||||
assert!(self.allow_render_pass_ops); // TODO: proper error
|
return Err(CommandAddError::ForbiddenOutsideRenderPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.allow_render_pass_ops {
|
||||||
|
return Err(CommandAddError::ForbiddenInSecondaryCommandBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: check number of subpasses
|
// FIXME: check number of subpasses
|
||||||
|
|
||||||
ContextCheckLayer {
|
Ok(ContextCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
inside_render_pass: false,
|
inside_render_pass: false,
|
||||||
allow_render_pass_ops: true,
|
allow_render_pass_ops: true,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
@ -81,14 +82,14 @@ macro_rules! pass_through {
|
|||||||
type Out = DeviceCheckLayer<O>;
|
type Out = DeviceCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
let inner_device = self.inner.device().internal_object();
|
let inner_device = self.inner.device().internal_object();
|
||||||
let cmd_device = command.device().internal_object();
|
let cmd_device = command.device().internal_object();
|
||||||
assert_eq!(inner_device, cmd_device);
|
assert_eq!(inner_device, cmd_device);
|
||||||
|
|
||||||
DeviceCheckLayer {
|
Ok(DeviceCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -100,10 +101,10 @@ macro_rules! pass_through {
|
|||||||
type Out = DeviceCheckLayer<O>;
|
type Out = DeviceCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
DeviceCheckLayer {
|
Ok(DeviceCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
@ -110,12 +111,12 @@ macro_rules! q_ty_impl_always {
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
QueueTyCheckLayer {
|
Ok(QueueTyCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,13 +136,16 @@ macro_rules! q_ty_impl_graphics {
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.supports_graphics()); // TODO: proper error
|
if !self.supports_graphics() {
|
||||||
QueueTyCheckLayer {
|
return Err(CommandAddError::GraphicsOperationsNotSupported);
|
||||||
inner: self.inner.add(command),
|
}
|
||||||
|
|
||||||
|
Ok(QueueTyCheckLayer {
|
||||||
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,13 +171,16 @@ macro_rules! q_ty_impl_compute {
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.supports_compute()); // TODO: proper error
|
if !self.supports_compute() {
|
||||||
QueueTyCheckLayer {
|
return Err(CommandAddError::ComputeOperationsNotSupported);
|
||||||
inner: self.inner.add(command),
|
}
|
||||||
|
|
||||||
|
Ok(QueueTyCheckLayer {
|
||||||
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,13 +196,13 @@ macro_rules! q_ty_impl_graphics_or_compute {
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
assert!(self.supports_graphics() || self.supports_compute()); // TODO: proper error
|
assert!(self.supports_graphics() || self.supports_compute()); // TODO: proper error?
|
||||||
QueueTyCheckLayer {
|
Ok(QueueTyCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,18 +218,22 @@ unsafe impl<I, O, Pl> AddCommand<commands_raw::CmdBindPipeline<Pl>> for QueueTyC
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdBindPipeline<Pl>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdBindPipeline<Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
if command.is_graphics() {
|
if command.is_graphics() {
|
||||||
assert!(self.supports_graphics()); // TODO: proper error
|
if !self.supports_graphics() {
|
||||||
|
return Err(CommandAddError::GraphicsOperationsNotSupported);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assert!(self.supports_compute()); // TODO: proper error
|
if !self.supports_compute() {
|
||||||
|
return Err(CommandAddError::ComputeOperationsNotSupported);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueTyCheckLayer {
|
Ok(QueueTyCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,17 +243,21 @@ unsafe impl<I, O, S, Pl> AddCommand<commands_raw::CmdBindDescriptorSets<S, Pl>>
|
|||||||
type Out = QueueTyCheckLayer<O>;
|
type Out = QueueTyCheckLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdBindDescriptorSets<S, Pl>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdBindDescriptorSets<S, Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
if command.is_graphics() {
|
if command.is_graphics() {
|
||||||
assert!(self.supports_graphics()); // TODO: proper error
|
if !self.supports_graphics() {
|
||||||
|
return Err(CommandAddError::GraphicsOperationsNotSupported);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assert!(self.supports_compute()); // TODO: proper error
|
if !self.supports_compute() {
|
||||||
|
return Err(CommandAddError::ComputeOperationsNotSupported);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueTyCheckLayer {
|
Ok(QueueTyCheckLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
supports_graphics: self.supports_graphics,
|
supports_graphics: self.supports_graphics,
|
||||||
supports_compute: self.supports_compute,
|
supports_compute: self.supports_compute,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
use command_buffer::DynamicState;
|
use command_buffer::DynamicState;
|
||||||
@ -95,7 +96,7 @@ unsafe impl<Pl, I, O> AddCommand<commands_raw::CmdBindPipeline<Pl>> for StateCac
|
|||||||
type Out = StateCacheLayer<O>;
|
type Out = StateCacheLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdBindPipeline<Pl>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdBindPipeline<Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
let raw_pipeline = command.sys().internal_object();
|
let raw_pipeline = command.sys().internal_object();
|
||||||
|
|
||||||
let new_command = {
|
let new_command = {
|
||||||
@ -116,12 +117,12 @@ unsafe impl<Pl, I, O> AddCommand<commands_raw::CmdBindPipeline<Pl>> for StateCac
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StateCacheLayer {
|
Ok(StateCacheLayer {
|
||||||
inner: self.inner.add(new_command),
|
inner: self.inner.add(new_command)?,
|
||||||
dynamic_state: DynamicState::none(),
|
dynamic_state: DynamicState::none(),
|
||||||
graphics_pipeline: self.graphics_pipeline,
|
graphics_pipeline: self.graphics_pipeline,
|
||||||
compute_pipeline: self.compute_pipeline,
|
compute_pipeline: self.compute_pipeline,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,16 +132,16 @@ unsafe impl<Cb, I, O> AddCommand<commands_raw::CmdExecuteCommands<Cb>> for State
|
|||||||
type Out = StateCacheLayer<O>;
|
type Out = StateCacheLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdExecuteCommands<Cb>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdExecuteCommands<Cb>) -> Result<Self::Out, CommandAddError> {
|
||||||
// After a secondary command buffer is added, all states at reset to the "unknown" state.
|
// After a secondary command buffer is added, all states at reset to the "unknown" state.
|
||||||
let new_inner = self.inner.add(command);
|
let new_inner = self.inner.add(command)?;
|
||||||
|
|
||||||
StateCacheLayer {
|
Ok(StateCacheLayer {
|
||||||
inner: new_inner,
|
inner: new_inner,
|
||||||
dynamic_state: DynamicState::none(),
|
dynamic_state: DynamicState::none(),
|
||||||
compute_pipeline: 0,
|
compute_pipeline: 0,
|
||||||
graphics_pipeline: 0,
|
graphics_pipeline: 0,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdSetState> for StateCacheLayer<I>
|
|||||||
type Out = StateCacheLayer<O>;
|
type Out = StateCacheLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdSetState) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdSetState) -> Result<Self::Out, CommandAddError> {
|
||||||
// We need to synchronize `self.dynamic_state` with the state in `command`.
|
// We need to synchronize `self.dynamic_state` with the state in `command`.
|
||||||
// While doing so, we tweak `command` to erase the states that are the same as what's
|
// While doing so, we tweak `command` to erase the states that are the same as what's
|
||||||
// already in `self.dynamic_state`.
|
// already in `self.dynamic_state`.
|
||||||
@ -168,12 +169,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdSetState> for StateCacheLayer<I>
|
|||||||
|
|
||||||
// TODO: missing implementations
|
// TODO: missing implementations
|
||||||
|
|
||||||
StateCacheLayer {
|
Ok(StateCacheLayer {
|
||||||
inner: self.inner.add(commands_raw::CmdSetState::new(command.device().clone(), command_state)),
|
inner: self.inner.add(commands_raw::CmdSetState::new(command.device().clone(), command_state))?,
|
||||||
dynamic_state: self.dynamic_state,
|
dynamic_state: self.dynamic_state,
|
||||||
graphics_pipeline: self.graphics_pipeline,
|
graphics_pipeline: self.graphics_pipeline,
|
||||||
compute_pipeline: self.compute_pipeline,
|
compute_pipeline: self.compute_pipeline,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,13 +198,13 @@ macro_rules! pass_through {
|
|||||||
type Out = StateCacheLayer<O>;
|
type Out = StateCacheLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
StateCacheLayer {
|
Ok(StateCacheLayer {
|
||||||
inner: self.inner.add(command),
|
inner: self.inner.add(command)?,
|
||||||
dynamic_state: self.dynamic_state,
|
dynamic_state: self.dynamic_state,
|
||||||
graphics_pipeline: self.graphics_pipeline,
|
graphics_pipeline: self.graphics_pipeline,
|
||||||
compute_pipeline: self.compute_pipeline,
|
compute_pipeline: self.compute_pipeline,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ use buffer::BufferAccess;
|
|||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::CommandBufferBuild;
|
use command_buffer::cb::CommandBufferBuild;
|
||||||
use command_buffer::cb::UnsafeCommandBuffer;
|
use command_buffer::cb::UnsafeCommandBuffer;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::CommandBuffer;
|
use command_buffer::CommandBuffer;
|
||||||
use command_buffer::CommandBufferBuilder;
|
use command_buffer::CommandBufferBuilder;
|
||||||
use command_buffer::commands_raw;
|
use command_buffer::commands_raw;
|
||||||
@ -126,12 +127,12 @@ macro_rules! pass_through {
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: $cmd) -> Self::Out {
|
fn add(self, command: $cmd) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,14 +151,14 @@ unsafe impl<I, O, B> AddCommand<commands_raw::CmdBindIndexBuffer<B>> for SubmitS
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdBindIndexBuffer<B>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdBindIndexBuffer<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_buffer(command.buffer(), false);
|
self.add_buffer(command.buffer(), false);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,12 +168,12 @@ unsafe impl<I, O, P> AddCommand<commands_raw::CmdBindPipeline<P>> for SubmitSync
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdBindPipeline<P>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdBindPipeline<P>) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,15 +185,15 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdBlitImage<S, D>> for SubmitS
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdBlitImage<S, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdBlitImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_image(command.source(), false);
|
self.add_image(command.source(), false);
|
||||||
self.add_image(command.destination(), true);
|
self.add_image(command.destination(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,12 +203,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdClearAttachments> for SubmitSyncBu
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdClearAttachments) -> Self::Out {
|
fn add(self, command: commands_raw::CmdClearAttachments) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,15 +220,15 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyBuffer<S, D>> for Submit
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdCopyBuffer<S, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdCopyBuffer<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_buffer(command.source(), false);
|
self.add_buffer(command.source(), false);
|
||||||
self.add_buffer(command.destination(), true);
|
self.add_buffer(command.destination(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,15 +240,15 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyBufferToImage<S, D>> for
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdCopyBufferToImage<S, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdCopyBufferToImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_buffer(command.source(), false);
|
self.add_buffer(command.source(), false);
|
||||||
self.add_image(command.destination(), true);
|
self.add_image(command.destination(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,15 +260,15 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdCopyImage<S, D>> for SubmitS
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdCopyImage<S, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdCopyImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_image(command.source(), false);
|
self.add_image(command.source(), false);
|
||||||
self.add_image(command.destination(), true);
|
self.add_image(command.destination(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,12 +278,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdDispatchRaw> for SubmitSyncBuilder
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdDispatchRaw) -> Self::Out {
|
fn add(self, command: commands_raw::CmdDispatchRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,12 +293,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdDrawRaw> for SubmitSyncBuilderLaye
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdDrawRaw) -> Self::Out {
|
fn add(self, command: commands_raw::CmdDrawRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,12 +308,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdDrawIndexedRaw> for SubmitSyncBuil
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdDrawIndexedRaw) -> Self::Out {
|
fn add(self, command: commands_raw::CmdDrawIndexedRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,12 +323,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdEndRenderPass> for SubmitSyncBuild
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdEndRenderPass) -> Self::Out {
|
fn add(self, command: commands_raw::CmdEndRenderPass) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,14 +339,14 @@ unsafe impl<I, O, B> AddCommand<commands_raw::CmdFillBuffer<B>> for SubmitSyncBu
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdFillBuffer<B>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdFillBuffer<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_buffer(command.buffer(), true);
|
self.add_buffer(command.buffer(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,12 +356,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdNextSubpass> for SubmitSyncBuilder
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdNextSubpass) -> Self::Out {
|
fn add(self, command: commands_raw::CmdNextSubpass) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,12 +371,12 @@ unsafe impl<I, O, Pc, Pl> AddCommand<commands_raw::CmdPushConstants<Pc, Pl>> for
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdPushConstants<Pc, Pl>) -> Self::Out {
|
fn add(self, command: commands_raw::CmdPushConstants<Pc, Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,15 +388,15 @@ unsafe impl<I, O, S, D> AddCommand<commands_raw::CmdResolveImage<S, D>> for Subm
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdResolveImage<S, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdResolveImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_image(command.source(), false);
|
self.add_image(command.source(), false);
|
||||||
self.add_image(command.destination(), true);
|
self.add_image(command.destination(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,12 +406,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdSetEvent> for SubmitSyncBuilderLay
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdSetEvent) -> Self::Out {
|
fn add(self, command: commands_raw::CmdSetEvent) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,12 +421,12 @@ unsafe impl<I, O> AddCommand<commands_raw::CmdSetState> for SubmitSyncBuilderLay
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: commands_raw::CmdSetState) -> Self::Out {
|
fn add(self, command: commands_raw::CmdSetState) -> Result<Self::Out, CommandAddError> {
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,14 +437,14 @@ unsafe impl<I, O, B, D> AddCommand<commands_raw::CmdUpdateBuffer<B, D>> for Subm
|
|||||||
type Out = SubmitSyncBuilderLayer<O>;
|
type Out = SubmitSyncBuilderLayer<O>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(mut self, command: commands_raw::CmdUpdateBuffer<B, D>) -> Self::Out {
|
fn add(mut self, command: commands_raw::CmdUpdateBuffer<B, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add_buffer(command.buffer(), true);
|
self.add_buffer(command.buffer(), true);
|
||||||
|
|
||||||
SubmitSyncBuilderLayer {
|
Ok(SubmitSyncBuilderLayer {
|
||||||
inner: AddCommand::add(self.inner, command),
|
inner: AddCommand::add(self.inner, command)?,
|
||||||
buffers: self.buffers,
|
buffers: self.buffers,
|
||||||
images: self.images,
|
images: self.images,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
|
|
||||||
/// Adds a command to a command buffer builder.
|
/// Adds a command to a command buffer builder.
|
||||||
pub unsafe trait AddCommand<C> {
|
pub unsafe trait AddCommand<C> {
|
||||||
/// The new command buffer builder type.
|
/// The new command buffer builder type.
|
||||||
@ -14,5 +16,5 @@ pub unsafe trait AddCommand<C> {
|
|||||||
|
|
||||||
/// Adds the command. This takes ownership of the builder and returns a new builder with the
|
/// Adds the command. This takes ownership of the builder and returns a new builder with the
|
||||||
/// command appended at the end of it.
|
/// command appended at the end of it.
|
||||||
fn add(self, cmd: C) -> Self::Out;
|
fn add(self, cmd: C) -> Result<Self::Out, CommandAddError>;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ use std::error;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
||||||
use command_buffer::commands_raw::CmdBindDescriptorSetsError;
|
use command_buffer::commands_raw::CmdBindDescriptorSetsError;
|
||||||
use command_buffer::commands_raw::CmdBindPipeline;
|
use command_buffer::commands_raw::CmdBindPipeline;
|
||||||
@ -60,11 +61,11 @@ unsafe impl<Cb, P, S, Pc, O, O1, O2, O3> AddCommand<CmdDispatch<P, S, Pc>> for C
|
|||||||
type Out = O;
|
type Out = O;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: CmdDispatch<P, S, Pc>) -> O {
|
fn add(self, command: CmdDispatch<P, S, Pc>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add(command.push_constants)
|
Ok(self.add(command.push_constants)?
|
||||||
.add(command.descriptor_sets)
|
.add(command.descriptor_sets)?
|
||||||
.add(command.bind_pipeline)
|
.add(command.bind_pipeline)?
|
||||||
.add(command.dispatch_raw)
|
.add(command.dispatch_raw)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ use command_buffer::commands_raw::CmdBindDescriptorSetsError;
|
|||||||
use command_buffer::commands_raw::CmdBindPipeline;
|
use command_buffer::commands_raw::CmdBindPipeline;
|
||||||
use command_buffer::commands_raw::CmdPushConstants;
|
use command_buffer::commands_raw::CmdPushConstants;
|
||||||
use command_buffer::commands_raw::CmdPushConstantsError;
|
use command_buffer::commands_raw::CmdPushConstantsError;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::DispatchIndirectCommand;
|
use command_buffer::DispatchIndirectCommand;
|
||||||
use command_buffer::RawCommandBufferPrototype;
|
use command_buffer::RawCommandBufferPrototype;
|
||||||
use command_buffer::CommandsList;
|
use command_buffer::CommandsList;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::DynamicState;
|
use command_buffer::DynamicState;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
||||||
@ -69,12 +70,12 @@ unsafe impl<Cb, V, P, S, Pc, O, O1, O2, O3, O4, O5> AddCommand<CmdDraw<V, P, S,
|
|||||||
type Out = O;
|
type Out = O;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: CmdDraw<V, P, S, Pc>) -> O {
|
fn add(self, command: CmdDraw<V, P, S, Pc>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add(command.vertex_buffers)
|
Ok(self.add(command.vertex_buffers)?
|
||||||
.add(command.push_constants)
|
.add(command.push_constants)?
|
||||||
.add(command.descriptor_sets)
|
.add(command.descriptor_sets)?
|
||||||
.add(command.set_state)
|
.add(command.set_state)?
|
||||||
.add(command.bind_pipeline)
|
.add(command.bind_pipeline)?
|
||||||
.add(command.draw_raw)
|
.add(command.draw_raw)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
use buffer::TypedBuffer;
|
use buffer::TypedBuffer;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::DynamicState;
|
use command_buffer::DynamicState;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
use command_buffer::commands_raw::CmdBindDescriptorSets;
|
||||||
@ -88,13 +89,13 @@ unsafe impl<Cb, V, Ib, P, S, Pc, O, O1, O2, O3, O4, O5, O6> AddCommand<CmdDrawIn
|
|||||||
{
|
{
|
||||||
type Out = O;
|
type Out = O;
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: CmdDrawIndexed<V, Ib, P, S, Pc>) -> O {
|
fn add(self, command: CmdDrawIndexed<V, Ib, P, S, Pc>) -> Result<Self::Out, CommandAddError> {
|
||||||
self.add(command.vertex_buffers)
|
Ok(self.add(command.vertex_buffers)?
|
||||||
.add(command.index_buffer)
|
.add(command.index_buffer)?
|
||||||
.add(command.push_constants)
|
.add(command.push_constants)?
|
||||||
.add(command.descriptor_sets)
|
.add(command.descriptor_sets)?
|
||||||
.add(command.set_state)
|
.add(command.set_state)?
|
||||||
.add(command.bind_pipeline)
|
.add(command.bind_pipeline)?
|
||||||
.add(command.draw_indexed_raw)
|
.add(command.draw_indexed_raw)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ use std::ops::Range;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -124,7 +125,7 @@ unsafe impl<'a, P, Rp, F> AddCommand<&'a CmdBeginRenderPass<Rp, F>> for UnsafeCo
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBeginRenderPass<Rp, F>) -> Self::Out {
|
fn add(self, command: &'a CmdBeginRenderPass<Rp, F>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -151,6 +152,6 @@ unsafe impl<'a, P, Rp, F> AddCommand<&'a CmdBeginRenderPass<Rp, F>> for UnsafeCo
|
|||||||
vk.CmdBeginRenderPass(cmd, &begin, command.contents);
|
vk.CmdBeginRenderPass(cmd, &begin, command.contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ use std::ptr;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -119,7 +120,7 @@ unsafe impl<'a, P, Pl, S> AddCommand<&'a CmdBindDescriptorSets<S, Pl>> for Unsaf
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBindDescriptorSets<S, Pl>) -> Self::Out {
|
fn add(self, command: &'a CmdBindDescriptorSets<S, Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -131,7 +132,7 @@ unsafe impl<'a, P, Pl, S> AddCommand<&'a CmdBindDescriptorSets<S, Pl>> for Unsaf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
use buffer::TypedBuffer;
|
use buffer::TypedBuffer;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -89,13 +90,13 @@ unsafe impl<'a, P, B> AddCommand<&'a CmdBindIndexBuffer<B>> for UnsafeCommandBuf
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBindIndexBuffer<B>) -> Self::Out {
|
fn add(self, command: &'a CmdBindIndexBuffer<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
vk.CmdBindIndexBuffer(cmd, command.raw_buffer, command.offset, command.index_type);
|
vk.CmdBindIndexBuffer(cmd, command.raw_buffer, command.offset, command.index_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -105,7 +106,7 @@ unsafe impl<'a, P, Pl> AddCommand<&'a CmdBindPipeline<Pl>> for UnsafeCommandBuff
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBindPipeline<Pl>) -> Self::Out {
|
fn add(self, command: &'a CmdBindPipeline<Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
if command.raw_pipeline != 0 {
|
if command.raw_pipeline != 0 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
@ -114,7 +115,7 @@ unsafe impl<'a, P, Pl> AddCommand<&'a CmdBindPipeline<Pl>> for UnsafeCommandBuff
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -70,7 +71,7 @@ unsafe impl<'a, P, B> AddCommand<&'a CmdBindVertexBuffers<B>> for UnsafeCommandB
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBindVertexBuffers<B>) -> Self::Out {
|
fn add(self, command: &'a CmdBindVertexBuffers<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -78,6 +79,6 @@ unsafe impl<'a, P, B> AddCommand<&'a CmdBindVertexBuffers<B>> for UnsafeCommandB
|
|||||||
command.raw_buffers.as_ptr(), command.offsets.as_ptr());
|
command.raw_buffers.as_ptr(), command.offsets.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -80,7 +81,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdBlitImage<S, D>> for UnsafeCommandBuf
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdBlitImage<S, D>) -> Self::Out {
|
fn add(self, command: &'a CmdBlitImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
||||||
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
||||||
@ -133,7 +134,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdBlitImage<S, D>> for UnsafeCommandBuf
|
|||||||
1, ®ion as *const _, command.filter);
|
1, ®ion as *const _, command.filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -33,7 +34,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdClearAttachments> for UnsafeCommandBufferBu
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdClearAttachments) -> Self::Out {
|
fn add(self, command: &'a CmdClearAttachments) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -43,6 +44,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdClearAttachments> for UnsafeCommandBufferBu
|
|||||||
command.rects.as_ptr());
|
command.rects.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ use std::fmt;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -120,7 +121,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyBuffer<S, D>> for UnsafeCommandBu
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdCopyBuffer<S, D>) -> Self::Out {
|
fn add(self, command: &'a CmdCopyBuffer<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -134,7 +135,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyBuffer<S, D>> for UnsafeCommandBu
|
|||||||
vk.CmdCopyBuffer(cmd, command.source_raw, command.destination_raw, 1, ®ion);
|
vk.CmdCopyBuffer(cmd, command.source_raw, command.destination_raw, 1, ®ion);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ use std::error;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -149,7 +150,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyBufferToImage<S, D>> for UnsafeCo
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdCopyBufferToImage<S, D>) -> Self::Out {
|
fn add(self, command: &'a CmdCopyBufferToImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
debug_assert!(command.destination_layout == vk::IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL ||
|
debug_assert!(command.destination_layout == vk::IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL ||
|
||||||
command.destination_layout == vk::IMAGE_LAYOUT_GENERAL);
|
command.destination_layout == vk::IMAGE_LAYOUT_GENERAL);
|
||||||
@ -182,7 +183,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyBufferToImage<S, D>> for UnsafeCo
|
|||||||
command.destination_layout, 1, ®ion as *const _);
|
command.destination_layout, 1, ®ion as *const _);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -79,7 +80,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyImage<S, D>> for UnsafeCommandBuf
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdCopyImage<S, D>) -> Self::Out {
|
fn add(self, command: &'a CmdCopyImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
||||||
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
||||||
@ -123,7 +124,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdCopyImage<S, D>> for UnsafeCommandBuf
|
|||||||
1, ®ion as *const _);
|
1, ®ion as *const _);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ use std::error;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -97,7 +98,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdDispatchRaw> for UnsafeCommandBufferBuilder
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdDispatchRaw) -> Self::Out {
|
fn add(self, command: &'a CmdDispatchRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -105,7 +106,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdDispatchRaw> for UnsafeCommandBufferBuilder
|
|||||||
command.dimensions[2]);
|
command.dimensions[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -66,7 +67,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdDrawIndexedRaw> for UnsafeCommandBufferBuil
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdDrawIndexedRaw) -> Self::Out {
|
fn add(self, command: &'a CmdDrawIndexedRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -74,6 +75,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdDrawIndexedRaw> for UnsafeCommandBufferBuil
|
|||||||
command.first_index, command.vertex_offset, command.first_instance);
|
command.first_index, command.vertex_offset, command.first_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -58,7 +59,7 @@ unsafe impl<'a, B, P> AddCommand<&'a CmdDrawIndirectRaw<B>> for UnsafeCommandBuf
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdDrawIndirectRaw<B>) -> Self::Out {
|
fn add(self, command: &'a CmdDrawIndirectRaw<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -66,6 +67,6 @@ unsafe impl<'a, B, P> AddCommand<&'a CmdDrawIndirectRaw<B>> for UnsafeCommandBuf
|
|||||||
command.offset, command.draw_count, command.stride);
|
command.offset, command.draw_count, command.stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -61,7 +62,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdDrawRaw> for UnsafeCommandBufferBuilder<P>
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdDrawRaw) -> Self::Out {
|
fn add(self, command: &'a CmdDrawRaw) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -69,6 +70,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdDrawRaw> for UnsafeCommandBufferBuilder<P>
|
|||||||
command.first_instance);
|
command.first_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -32,13 +33,13 @@ unsafe impl<'a, P> AddCommand<&'a CmdEndRenderPass> for UnsafeCommandBufferBuild
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdEndRenderPass) -> Self::Out {
|
fn add(self, command: &'a CmdEndRenderPass) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
vk.CmdEndRenderPass(cmd);
|
vk.CmdEndRenderPass(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -60,13 +61,13 @@ unsafe impl<'a, P, Cb> AddCommand<&'a CmdExecuteCommands<Cb>> for UnsafeCommandB
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdExecuteCommands<Cb>) -> Self::Out {
|
fn add(self, command: &'a CmdExecuteCommands<Cb>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
vk.CmdExecuteCommands(cmd, command.raw_list.len() as u32, command.raw_list.as_ptr());
|
vk.CmdExecuteCommands(cmd, command.raw_list.len() as u32, command.raw_list.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
use buffer::BufferInner;
|
use buffer::BufferInner;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -87,7 +88,7 @@ unsafe impl<'a, P, B> AddCommand<&'a CmdFillBuffer<B>> for UnsafeCommandBufferBu
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdFillBuffer<B>) -> Self::Out {
|
fn add(self, command: &'a CmdFillBuffer<B>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -95,7 +96,7 @@ unsafe impl<'a, P, B> AddCommand<&'a CmdFillBuffer<B>> for UnsafeCommandBufferBu
|
|||||||
command.size, command.data);
|
command.size, command.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// notice may not be copied, modified, or distributed except
|
// notice may not be copied, modified, or distributed except
|
||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -39,13 +40,13 @@ unsafe impl<'a, P> AddCommand<&'a CmdNextSubpass> for UnsafeCommandBufferBuilder
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdNextSubpass) -> Self::Out {
|
fn add(self, command: &'a CmdNextSubpass) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
vk.CmdNextSubpass(cmd, command.contents);
|
vk.CmdNextSubpass(cmd, command.contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use smallvec::SmallVec;
|
|||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
use buffer::BufferInner;
|
use buffer::BufferInner;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -239,14 +240,14 @@ unsafe impl<'a, P> AddCommand<&'a CmdPipelineBarrier<'a>> for UnsafeCommandBuffe
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdPipelineBarrier<'a>) -> Self::Out {
|
fn add(self, command: &'a CmdPipelineBarrier<'a>) -> Result<Self::Out, CommandAddError> {
|
||||||
// If barrier is empty, don't do anything.
|
// If barrier is empty, don't do anything.
|
||||||
if command.src_stage_mask == 0 || command.dst_stage_mask == 0 {
|
if command.src_stage_mask == 0 || command.dst_stage_mask == 0 {
|
||||||
debug_assert!(command.src_stage_mask == 0 && command.dst_stage_mask == 0);
|
debug_assert!(command.src_stage_mask == 0 && command.dst_stage_mask == 0);
|
||||||
debug_assert!(command.memory_barriers.is_empty());
|
debug_assert!(command.memory_barriers.is_empty());
|
||||||
debug_assert!(command.buffer_barriers.is_empty());
|
debug_assert!(command.buffer_barriers.is_empty());
|
||||||
debug_assert!(command.image_barriers.is_empty());
|
debug_assert!(command.image_barriers.is_empty());
|
||||||
return self;
|
return Ok(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -262,6 +263,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdPipelineBarrier<'a>> for UnsafeCommandBuffe
|
|||||||
command.image_barriers.as_ptr());
|
command.image_barriers.as_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ use std::error;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -70,7 +71,7 @@ unsafe impl<'a, P, Pc, Pl> AddCommand<&'a CmdPushConstants<Pc, Pl>> for UnsafeCo
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdPushConstants<Pc, Pl>) -> Self::Out {
|
fn add(self, command: &'a CmdPushConstants<Pc, Pl>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -92,7 +93,7 @@ unsafe impl<'a, P, Pc, Pl> AddCommand<&'a CmdPushConstants<Pc, Pl>> for UnsafeCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -79,7 +80,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdResolveImage<S, D>> for UnsafeCommand
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdResolveImage<S, D>) -> Self::Out {
|
fn add(self, command: &'a CmdResolveImage<S, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
debug_assert!(command.source_layout == vk::IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL ||
|
||||||
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
command.source_layout == vk::IMAGE_LAYOUT_GENERAL);
|
||||||
@ -123,7 +124,7 @@ unsafe impl<'a, P, S, D> AddCommand<&'a CmdResolveImage<S, D>> for UnsafeCommand
|
|||||||
1, ®ion as *const _);
|
1, ®ion as *const _);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// according to those terms.
|
// according to those terms.
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -44,7 +45,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdSetEvent> for UnsafeCommandBufferBuilder<P>
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdSetEvent) -> Self::Out {
|
fn add(self, command: &'a CmdSetEvent) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -55,6 +56,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdSetEvent> for UnsafeCommandBufferBuilder<P>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::DynamicState;
|
use command_buffer::DynamicState;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
@ -73,7 +74,7 @@ unsafe impl<'a, P> AddCommand<&'a CmdSetState> for UnsafeCommandBufferBuilder<P>
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdSetState) -> Self::Out {
|
fn add(self, command: &'a CmdSetState) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let vk = self.device().pointers();
|
let vk = self.device().pointers();
|
||||||
let cmd = self.internal_object();
|
let cmd = self.internal_object();
|
||||||
@ -93,6 +94,6 @@ unsafe impl<'a, P> AddCommand<&'a CmdSetState> for UnsafeCommandBufferBuilder<P>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use std::ptr;
|
|||||||
|
|
||||||
use buffer::BufferAccess;
|
use buffer::BufferAccess;
|
||||||
use buffer::BufferInner;
|
use buffer::BufferInner;
|
||||||
|
use command_buffer::CommandAddError;
|
||||||
use command_buffer::cb::AddCommand;
|
use command_buffer::cb::AddCommand;
|
||||||
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
use command_buffer::cb::UnsafeCommandBufferBuilder;
|
||||||
use command_buffer::pool::CommandPool;
|
use command_buffer::pool::CommandPool;
|
||||||
@ -109,7 +110,7 @@ unsafe impl<'a, P, B, D> AddCommand<&'a CmdUpdateBuffer<B, D>> for UnsafeCommand
|
|||||||
type Out = UnsafeCommandBufferBuilder<P>;
|
type Out = UnsafeCommandBufferBuilder<P>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(self, command: &'a CmdUpdateBuffer<B, D>) -> Self::Out {
|
fn add(self, command: &'a CmdUpdateBuffer<B, D>) -> Result<Self::Out, CommandAddError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let data = if command.data_ptr.is_null() {
|
let data = if command.data_ptr.is_null() {
|
||||||
&command.data as *const D as *const _
|
&command.data as *const D as *const _
|
||||||
@ -122,7 +123,7 @@ unsafe impl<'a, P, B, D> AddCommand<&'a CmdUpdateBuffer<B, D>> for UnsafeCommand
|
|||||||
vk.CmdUpdateBuffer(cmd, command.buffer_handle, command.offset, command.size, data);
|
vk.CmdUpdateBuffer(cmd, command.buffer_handle, command.offset, command.size, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
Ok(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@
|
|||||||
//! information.
|
//! information.
|
||||||
|
|
||||||
pub use self::auto::AutoCommandBufferBuilder;
|
pub use self::auto::AutoCommandBufferBuilder;
|
||||||
|
pub use self::builder::CommandAddError;
|
||||||
pub use self::builder::CommandBufferBuilder;
|
pub use self::builder::CommandBufferBuilder;
|
||||||
pub use self::builder::CommandBufferBuilderBuffered;
|
|
||||||
pub use self::traits::CommandBuffer;
|
pub use self::traits::CommandBuffer;
|
||||||
pub use self::traits::CommandBufferBuild;
|
pub use self::traits::CommandBufferBuild;
|
||||||
pub use self::traits::CommandBufferExecFuture;
|
pub use self::traits::CommandBufferExecFuture;
|
||||||
|
Loading…
Reference in New Issue
Block a user