Fix warnings on nightly (#1213)

This commit is contained in:
Lucas Kent 2019-07-02 18:25:58 +10:00 committed by GitHub
parent f61193293f
commit fc6ac6fec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
77 changed files with 312 additions and 312 deletions

View File

@ -30,7 +30,7 @@ use std::sync::Arc;
pub struct AmbientLightingSystem {
gfx_queue: Arc<Queue>,
vertex_buffer: Arc<CpuAccessibleBuffer<[Vertex]>>,
pipeline: Arc<GraphicsPipelineAbstract + Send + Sync>,
pipeline: Arc<dyn GraphicsPipelineAbstract + Send + Sync>,
}
impl AmbientLightingSystem {

View File

@ -31,7 +31,7 @@ use std::sync::Arc;
pub struct DirectionalLightingSystem {
gfx_queue: Arc<Queue>,
vertex_buffer: Arc<CpuAccessibleBuffer<[Vertex]>>,
pipeline: Arc<GraphicsPipelineAbstract + Send + Sync>,
pipeline: Arc<dyn GraphicsPipelineAbstract + Send + Sync>,
}
impl DirectionalLightingSystem {

View File

@ -31,7 +31,7 @@ use std::sync::Arc;
pub struct PointLightingSystem {
gfx_queue: Arc<Queue>,
vertex_buffer: Arc<CpuAccessibleBuffer<[Vertex]>>,
pipeline: Arc<GraphicsPipelineAbstract + Send + Sync>,
pipeline: Arc<dyn GraphicsPipelineAbstract + Send + Sync>,
}
impl PointLightingSystem {

View File

@ -37,7 +37,7 @@ pub struct FrameSystem {
// Render pass used for the drawing. See the `new` method for the actual render pass content.
// We need to keep it in `FrameSystem` because we may want to recreate the intermediate buffers
// in of a change in the dimensions.
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
// Intermediate render target that will contain the albedo of each pixel of the scene.
diffuse_buffer: Arc<AttachmentImage>,
@ -198,7 +198,7 @@ impl FrameSystem {
/// This method is necessary in order to initialize the pipelines that will draw the objects
/// of the scene.
#[inline]
pub fn deferred_subpass(&self) -> Subpass<Arc<RenderPassAbstract + Send + Sync>> {
pub fn deferred_subpass(&self) -> Subpass<Arc<dyn RenderPassAbstract + Send + Sync>> {
Subpass::from(self.render_pass.clone(), 0).unwrap()
}
@ -303,9 +303,9 @@ pub struct Frame<'a> {
num_pass: u8,
// Future to wait upon before the main rendering.
before_main_cb_future: Option<Box<GpuFuture>>,
before_main_cb_future: Option<Box<dyn GpuFuture>>,
// Framebuffer that was used when starting the render pass.
framebuffer: Arc<FramebufferAbstract + Send + Sync>,
framebuffer: Arc<dyn FramebufferAbstract + Send + Sync>,
// The command buffer builder that will be built during the lifetime of this object.
command_buffer: Option<AutoCommandBufferBuilder>,
// Matrix that was passed to `frame()`.
@ -385,7 +385,7 @@ pub enum Pass<'f, 's: 'f> {
/// The frame has been fully prepared, and here is the future that will perform the drawing
/// on the image.
Finished(Box<GpuFuture>),
Finished(Box<dyn GpuFuture>),
}
/// Allows the user to draw objects on the scene.

View File

@ -92,7 +92,7 @@ fn main() {
let triangle_draw_system = TriangleDrawSystem::new(queue.clone(), frame_system.deferred_subpass());
let mut recreate_swapchain = false;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
loop {
previous_frame_end.cleanup_finished();

View File

@ -24,7 +24,7 @@ use std::sync::Arc;
pub struct TriangleDrawSystem {
gfx_queue: Arc<Queue>,
vertex_buffer: Arc<CpuAccessibleBuffer<[Vertex]>>,
pipeline: Arc<GraphicsPipelineAbstract + Send + Sync>,
pipeline: Arc<dyn GraphicsPipelineAbstract + Send + Sync>,
}
impl TriangleDrawSystem {

View File

@ -148,7 +148,7 @@ fn main() {
let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state);
let mut recreate_swapchain = false;
let mut previous_frame_end = Box::new(tex_future) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(tex_future) as Box<dyn GpuFuture>;
loop {
previous_frame_end.cleanup_finished();
@ -223,9 +223,9 @@ fn main() {
/// This method is called once during initialization, then again whenever the window is resized
fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions();
let viewport = Viewport {
@ -240,7 +240,7 @@ fn window_size_dependent_setup(
Framebuffer::start(render_pass.clone())
.add(image.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>()
}

View File

@ -200,7 +200,7 @@ void main() {
let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None };
let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state);
let mut recreate_swapchain = false;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
loop {
previous_frame_end.cleanup_finished();
@ -283,9 +283,9 @@ void main() {
/// This method is called once during initialization, then again whenever the window is resized
fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions();
let viewport = Viewport {
@ -300,6 +300,6 @@ fn window_size_dependent_setup(
Framebuffer::start(render_pass.clone())
.add(image.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>()
}

View File

@ -384,7 +384,7 @@ fn main() {
let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None };
let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state);
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
loop {
previous_frame_end.cleanup_finished();
@ -461,9 +461,9 @@ fn main() {
/// This method is called once during initialization, then again whenever the window is resized
fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions();
let viewport = Viewport {
@ -478,6 +478,6 @@ fn window_size_dependent_setup(
Framebuffer::start(render_pass.clone())
.add(image.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>()
}

View File

@ -123,7 +123,7 @@ fn main() {
let (mut pipeline, mut framebuffers) = window_size_dependent_setup(device.clone(), &vs, &fs, &images, render_pass.clone());
let mut recreate_swapchain = false;
let mut previous_frame = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
let rotation_start = Instant::now();
loop {
@ -239,8 +239,8 @@ fn window_size_dependent_setup(
vs: &vs::Shader,
fs: &fs::Shader,
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
) -> (Arc<GraphicsPipelineAbstract + Send + Sync>, Vec<Arc<FramebufferAbstract + Send + Sync>> ) {
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
) -> (Arc<dyn GraphicsPipelineAbstract + Send + Sync>, Vec<Arc<dyn FramebufferAbstract + Send + Sync>> ) {
let dimensions = images[0].dimensions();
let depth_buffer = AttachmentImage::transient(device.clone(), dimensions, Format::D16Unorm).unwrap();
@ -251,7 +251,7 @@ fn window_size_dependent_setup(
.add(image.clone()).unwrap()
.add(depth_buffer.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>();
// In the triangle example we use a dynamic viewport, as its a simple example.

View File

@ -223,7 +223,7 @@ fn main() {
.unwrap());
let mut recreate_swapchain = false;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
let mut dynamic_state = DynamicState { line_width: None, viewports: None, scissors: None };
let mut framebuffers = window_size_dependent_setup(&images, render_pass.clone(), &mut dynamic_state);
@ -303,9 +303,9 @@ fn main() {
/// This method is called once during initialization, then again whenever the window is resized
fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions();
let viewport = Viewport {
@ -320,6 +320,6 @@ fn window_size_dependent_setup(
Framebuffer::start(render_pass.clone())
.add(image.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>()
}

View File

@ -310,7 +310,7 @@ void main() {
//
// Destroying the `GpuFuture` blocks until the GPU is finished executing it. In order to avoid
// that, we store the submission of the previous frame here.
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<GpuFuture>;
let mut previous_frame_end = Box::new(sync::now(device.clone())) as Box<dyn GpuFuture>;
loop {
// It is important to call this function from time to time, otherwise resources will keep
@ -452,9 +452,9 @@ void main() {
/// This method is called once during initialization, then again whenever the window is resized
fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<RenderPassAbstract + Send + Sync>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions();
let viewport = Viewport {
@ -469,6 +469,6 @@ fn window_size_dependent_setup(
Framebuffer::start(render_pass.clone())
.add(image.clone()).unwrap()
.build().unwrap()
) as Arc<FramebufferAbstract + Send + Sync>
) as Arc<dyn FramebufferAbstract + Send + Sync>
}).collect::<Vec<_>>()
}

View File

@ -91,7 +91,7 @@ impl error::Error for CreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CreationError::SurfaceCreationError(ref err) => Some(err),
CreationError::WindowCreationError(ref err) => Some(err),

View File

@ -318,12 +318,12 @@ unsafe impl<T: ?Sized, A> BufferAccess for CpuAccessibleBuffer<T, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}

View File

@ -608,12 +608,12 @@ unsafe impl<T, A> BufferAccess for CpuBufferPoolChunk<T, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}
@ -743,12 +743,12 @@ unsafe impl<T, A> BufferAccess for CpuBufferPoolSubbuffer<T, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}

View File

@ -196,12 +196,12 @@ unsafe impl<T: ?Sized, A> BufferAccess for DeviceLocalBuffer<T, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}

View File

@ -328,12 +328,12 @@ unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBuffer<T, A> {
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}
@ -394,12 +394,12 @@ unsafe impl<T: ?Sized, A> BufferAccess for ImmutableBufferInitialization<T, A> {
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
false
}

View File

@ -227,12 +227,12 @@ unsafe impl<T: ?Sized, B> BufferAccess for BufferSlice<T, B>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.resource.conflicts_buffer(other)
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.resource.conflicts_image(other)
}

View File

@ -398,7 +398,7 @@ impl error::Error for BufferCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
BufferCreationError::AllocError(ref err) => Some(err),
_ => None,

View File

@ -85,7 +85,7 @@ pub unsafe trait BufferAccess: DeviceOwned {
///
/// Note that the function must be transitive. In other words if `conflicts(a, b)` is true and
/// `conflicts(b, c)` is true, then `conflicts(a, c)` must be true as well.
fn conflicts_buffer(&self, other: &BufferAccess) -> bool;
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool;
/// Returns true if an access to `self` potentially overlaps the same memory as an access to
/// `other`.
@ -96,7 +96,7 @@ pub unsafe trait BufferAccess: DeviceOwned {
///
/// Note that the function must be transitive. In other words if `conflicts(a, b)` is true and
/// `conflicts(b, c)` is true, then `conflicts(a, c)` must be true as well.
fn conflicts_image(&self, other: &ImageAccess) -> bool;
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool;
/// Returns a key that uniquely identifies the buffer. Two buffers or images that potentially
/// overlap in memory must return the same key.
@ -163,12 +163,12 @@ unsafe impl<T> BufferAccess for T
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
(**self).conflicts_buffer(other)
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
(**self).conflicts_image(other)
}

View File

@ -316,7 +316,7 @@ impl error::Error for BufferViewCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
BufferViewCreationError::OomError(ref err) => Some(err),
_ => None,

View File

@ -91,7 +91,7 @@ pub struct AutoCommandBufferBuilder<P = StandardCommandPoolBuilder> {
compute_allowed: bool,
// If we're inside a render pass, contains the render pass and the subpass index.
render_pass: Option<(Box<RenderPassAbstract>, u32)>,
render_pass: Option<(Box<dyn RenderPassAbstract>, u32)>,
// True if we are a secondary command buffer.
secondary_cb: bool,
@ -1398,7 +1398,7 @@ unsafe fn set_state<P>(destination: &mut SyncCommandBufferBuilder<P>, dynamic: &
// Shortcut function to bind vertex buffers.
unsafe fn vertex_buffers<P>(destination: &mut SyncCommandBufferBuilder<P>,
state_cacher: &mut StateCacher,
vertex_buffers: Vec<Box<BufferAccess + Send + Sync>>)
vertex_buffers: Vec<Box<dyn BufferAccess + Send + Sync>>)
-> Result<(), SyncCommandBufferBuilderError> {
let binding_range = {
let mut compare = state_cacher.bind_vertex_buffers();
@ -1494,7 +1494,7 @@ unsafe impl<P> CommandBuffer for AutoCommandBuffer<P> {
}
#[inline]
fn lock_submit(&self, future: &GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError> {
fn lock_submit(&self, future: &dyn GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError> {
match self.submit_state {
SubmitState::OneTime { ref already_submitted } => {
let was_already_submitted = already_submitted.swap(true, Ordering::SeqCst);
@ -1549,13 +1549,13 @@ unsafe impl<P> CommandBuffer for AutoCommandBuffer<P> {
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
self.inner.check_buffer_access(buffer, exclusive, queue)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
self.inner
@ -1592,7 +1592,7 @@ macro_rules! err_gen {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
$(
$name::$err(ref err) => Some(err),

View File

@ -473,7 +473,7 @@ impl error::Error for SubmitBindSparseError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SubmitBindSparseError::OomError(ref err) => Some(err),
_ => None,

View File

@ -227,7 +227,7 @@ impl error::Error for SubmitPresentError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SubmitPresentError::OomError(ref err) => Some(err),
_ => None,

View File

@ -268,7 +268,7 @@ impl error::Error for SubmitCommandBufferError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SubmitCommandBufferError::OomError(ref err) => Some(err),
_ => None,

View File

@ -183,7 +183,7 @@ struct Commands<P> {
latest_render_pass_enter: Option<usize>,
// The actual list.
commands: Vec<Box<Command<P> + Send + Sync>>,
commands: Vec<Box<dyn Command<P> + Send + Sync>>,
}
// Trait for single commands within the list of commands.
@ -196,15 +196,15 @@ pub trait Command<P> {
unsafe fn send(&mut self, out: &mut UnsafeCommandBufferBuilder<P>);
// Turns this command into a `FinalCommand`.
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync>;
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync>;
// Gives access to the `num`th buffer used by the command.
fn buffer(&self, _num: usize) -> &BufferAccess {
fn buffer(&self, _num: usize) -> &dyn BufferAccess {
panic!()
}
// Gives access to the `num`th image used by the command.
fn image(&self, _num: usize) -> &ImageAccess {
fn image(&self, _num: usize) -> &dyn ImageAccess {
panic!()
}
@ -247,7 +247,7 @@ struct BuilderKey<P> {
impl<P> BuilderKey<P> {
// Turns this key used by the builder into a key used by the final command buffer.
// Called when the command buffer is being built.
fn into_cb_key(self, final_commands: Arc<Mutex<Vec<Box<FinalCommand + Send + Sync>>>>)
fn into_cb_key(self, final_commands: Arc<Mutex<Vec<Box<dyn FinalCommand + Send + Sync>>>>)
-> CbKey<'static> {
CbKey::Command {
commands: final_commands,
@ -258,7 +258,7 @@ impl<P> BuilderKey<P> {
}
#[inline]
fn conflicts_buffer(&self, commands_lock: &Commands<P>, buf: &BufferAccess) -> bool {
fn conflicts_buffer(&self, commands_lock: &Commands<P>, buf: &dyn BufferAccess) -> bool {
// TODO: put the conflicts_* methods directly on the Command trait to avoid an indirect call?
match self.resource_ty {
KeyTy::Buffer => {
@ -273,7 +273,7 @@ impl<P> BuilderKey<P> {
}
#[inline]
fn conflicts_image(&self, commands_lock: &Commands<P>, img: &ImageAccess) -> bool {
fn conflicts_image(&self, commands_lock: &Commands<P>, img: &dyn ImageAccess) -> bool {
// TODO: put the conflicts_* methods directly on the Command trait to avoid an indirect call?
match self.resource_ty {
KeyTy::Buffer => {
@ -803,7 +803,7 @@ pub struct SyncCommandBuffer<P> {
// List of commands used by the command buffer. Used to hold the various resources that are
// being used. Each element of `resources` has a copy of this `Arc`, but we need to keep one
// here in case `resources` is empty.
commands: Arc<Mutex<Vec<Box<FinalCommand + Send + Sync>>>>,
commands: Arc<Mutex<Vec<Box<dyn FinalCommand + Send + Sync>>>>,
}
// Usage of a resource in a finished command buffer.
@ -832,12 +832,12 @@ pub trait FinalCommand {
fn name(&self) -> &'static str;
// Gives access to the `num`th buffer used by the command.
fn buffer(&self, _num: usize) -> &BufferAccess {
fn buffer(&self, _num: usize) -> &dyn BufferAccess {
panic!()
}
// Gives access to the `num`th image used by the command.
fn image(&self, _num: usize) -> &ImageAccess {
fn image(&self, _num: usize) -> &dyn ImageAccess {
panic!()
}
@ -872,7 +872,7 @@ enum CbKey<'a> {
// The resource is held in the list of commands.
Command {
// Same `Arc` as in the `SyncCommandBufferBuilder`.
commands: Arc<Mutex<Vec<Box<FinalCommand + Send + Sync>>>>,
commands: Arc<Mutex<Vec<Box<dyn FinalCommand + Send + Sync>>>>,
// Index of the command that holds the resource within `commands`.
command_id: usize,
// Type of the resource.
@ -883,11 +883,11 @@ enum CbKey<'a> {
// Temporary key that holds a reference to a buffer. Should never be stored in the list of
// resources of `SyncCommandBuffer`.
BufferRef(&'a BufferAccess),
BufferRef(&'a dyn BufferAccess),
// Temporary key that holds a reference to an image. Should never be stored in the list of
// resources of `SyncCommandBuffer`.
ImageRef(&'a ImageAccess),
ImageRef(&'a dyn ImageAccess),
}
// The `CbKey::Command` variants implements `Send` and `Sync`, but the other two variants don't
@ -902,8 +902,8 @@ unsafe impl<'a> Sync for CbKey<'a> {
impl<'a> CbKey<'a> {
#[inline]
fn conflicts_buffer(&self, commands_lock: Option<&Vec<Box<FinalCommand + Send + Sync>>>,
buf: &BufferAccess)
fn conflicts_buffer(&self, commands_lock: Option<&Vec<Box<dyn FinalCommand + Send + Sync>>>,
buf: &dyn BufferAccess)
-> bool {
match *self {
CbKey::Command {
@ -938,8 +938,8 @@ impl<'a> CbKey<'a> {
}
#[inline]
fn conflicts_image(&self, commands_lock: Option<&Vec<Box<FinalCommand + Send + Sync>>>,
img: &ImageAccess)
fn conflicts_image(&self, commands_lock: Option<&Vec<Box<dyn FinalCommand + Send + Sync>>>,
img: &dyn ImageAccess)
-> bool {
match *self {
CbKey::Command {
@ -1051,7 +1051,7 @@ impl<P> SyncCommandBuffer<P> {
/// Tries to lock the resources used by the command buffer.
///
/// > **Note**: You should call this in the implementation of the `CommandBuffer` trait.
pub fn lock_submit(&self, future: &GpuFuture, queue: &Queue)
pub fn lock_submit(&self, future: &dyn GpuFuture, queue: &Queue)
-> Result<(), CommandBufferExecError> {
let commands_lock = self.commands.lock().unwrap();
@ -1234,7 +1234,7 @@ impl<P> SyncCommandBuffer<P> {
/// > **Note**: Suitable when implementing the `CommandBuffer` trait.
#[inline]
pub fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
// TODO: check the queue family
@ -1254,7 +1254,7 @@ impl<P> SyncCommandBuffer<P> {
/// > **Note**: Suitable when implementing the `CommandBuffer` trait.
#[inline]
pub fn check_image_access(
&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool, queue: &Queue)
&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
// TODO: check the queue family

View File

@ -79,7 +79,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.clear_values.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<F>(F);
impl<F> FinalCommand for Fin<F>
where F: FramebufferAbstract + Send + Sync + 'static
@ -87,7 +87,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdBeginRenderPass"
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
self.0.attached_image_view(num).unwrap().parent()
}
fn image_name(&self, num: usize) -> Cow<'static, str> {
@ -97,7 +97,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.framebuffer))
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
self.framebuffer.attached_image_view(num).unwrap().parent()
}
@ -159,7 +159,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.bind_index_buffer(&self.buffer, self.index_ty);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -167,7 +167,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdBindIndexBuffer"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -179,7 +179,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -227,7 +227,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.bind_pipeline_graphics(&self.pipeline);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<Gp>(Gp);
impl<Gp> FinalCommand for Fin<Gp>
where Gp: Send + Sync + 'static
@ -263,7 +263,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.bind_pipeline_compute(&self.pipeline);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<Cp>(Cp);
impl<Cp> FinalCommand for Fin<Cp>
where Cp: Send + Sync + 'static
@ -337,7 +337,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.regions.take().unwrap());
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<S, D>(S, D);
impl<S, D> FinalCommand for Fin<S, D>
where S: ImageAccess + Send + Sync + 'static,
@ -346,7 +346,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdCopyImage"
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
if num == 0 {
&self.0
} else if num == 1 {
@ -372,7 +372,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.destination.take().unwrap()))
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
if num == 0 {
self.source.as_ref().unwrap()
} else if num == 1 {
@ -469,7 +469,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.filter);
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<S, D>(S, D);
impl<S, D> FinalCommand for Fin<S, D>
where S: ImageAccess + Send + Sync + 'static,
@ -478,7 +478,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdBlitImage"
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
if num == 0 {
&self.0
} else if num == 1 {
@ -504,7 +504,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.destination.take().unwrap()))
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
if num == 0 {
self.source.as_ref().unwrap()
} else if num == 1 {
@ -597,7 +597,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.regions.take().unwrap());
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<I>(I);
impl<I> FinalCommand for Fin<I>
where I: ImageAccess + Send + Sync + 'static
@ -605,7 +605,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdClearColorImage"
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
&self.0
}
@ -619,7 +619,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.image.take().unwrap()))
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
self.image.as_ref().unwrap()
}
@ -684,7 +684,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.regions.take().unwrap());
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<S, D>(S, D);
impl<S, D> FinalCommand for Fin<S, D>
where S: BufferAccess + Send + Sync + 'static,
@ -693,7 +693,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdCopyBuffer"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
match num {
0 => &self.0,
1 => &self.1,
@ -714,7 +714,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.destination.take().unwrap()))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
match num {
0 => self.source.as_ref().unwrap(),
1 => self.destination.as_ref().unwrap(),
@ -800,7 +800,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.regions.take().unwrap());
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<S, D>(S, D);
impl<S, D> FinalCommand for Fin<S, D>
where S: BufferAccess + Send + Sync + 'static,
@ -809,7 +809,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdCopyBufferToImage"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -817,7 +817,7 @@ impl<P> SyncCommandBufferBuilder<P> {
assert_eq!(num, 0);
"source".into()
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
&self.1
}
@ -833,7 +833,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.destination.take().unwrap()))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
self.source.as_ref().unwrap()
}
@ -843,7 +843,7 @@ impl<P> SyncCommandBufferBuilder<P> {
"source".into()
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
self.destination.as_ref().unwrap()
}
@ -924,7 +924,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.regions.take().unwrap());
}
fn into_final_command(mut self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(mut self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<S, D>(S, D);
impl<S, D> FinalCommand for Fin<S, D>
where S: ImageAccess + Send + Sync + 'static,
@ -933,7 +933,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdCopyImageToBuffer"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.1
}
@ -941,7 +941,7 @@ impl<P> SyncCommandBufferBuilder<P> {
assert_eq!(num, 0);
"destination".into()
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
&self.0
}
@ -957,7 +957,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.destination.take().unwrap()))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
self.destination.as_ref().unwrap()
}
@ -967,7 +967,7 @@ impl<P> SyncCommandBufferBuilder<P> {
"destination".into()
}
fn image(&self, num: usize) -> &ImageAccess {
fn image(&self, num: usize) -> &dyn ImageAccess {
assert_eq!(num, 0);
self.source.as_ref().unwrap()
}
@ -1029,7 +1029,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.dispatch(self.dimensions);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdDispatch")
}
}
@ -1058,7 +1058,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.dispatch_indirect(&self.buffer);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -1066,7 +1066,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdDispatchIndirect"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -1078,7 +1078,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -1129,7 +1129,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.first_instance);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdDraw")
}
}
@ -1168,7 +1168,7 @@ impl<P> SyncCommandBufferBuilder<P> {
self.first_instance);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdDrawIndexed")
}
}
@ -1205,7 +1205,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.draw_indirect(&self.buffer, self.draw_count, self.stride);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -1213,7 +1213,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdDrawIndirect"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -1225,7 +1225,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -1280,7 +1280,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.draw_indexed_indirect(&self.buffer, self.draw_count, self.stride);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -1288,7 +1288,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdDrawIndexedIndirect"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -1300,7 +1300,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -1346,7 +1346,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.end_render_pass();
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdEndRenderPass")
}
}
@ -1387,7 +1387,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.fill_buffer(&self.buffer, self.data);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -1395,7 +1395,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdFillBuffer"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -1406,7 +1406,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -1449,7 +1449,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.next_subpass(self.subpass_contents);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdNextSubpass")
}
}
@ -1487,7 +1487,7 @@ impl<P> SyncCommandBufferBuilder<P> {
&self.data);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<Pl>(Pl);
impl<Pl> FinalCommand for Fin<Pl>
where Pl: Send + Sync + 'static
@ -1534,7 +1534,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.reset_event(&self.event, self.stages);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin(Arc<Event>);
impl FinalCommand for Fin {
fn name(&self) -> &'static str {
@ -1564,7 +1564,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_blend_constants(self.constants);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetBlendConstants")
}
}
@ -1590,7 +1590,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_depth_bias(self.constant_factor, self.clamp, self.slope_factor);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetDepthBias")
}
}
@ -1619,7 +1619,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_depth_bounds(self.min, self.max);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetDepthBounds")
}
}
@ -1644,7 +1644,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_event(&self.event, self.stages);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin(Arc<Event>);
impl FinalCommand for Fin {
fn name(&self) -> &'static str {
@ -1674,7 +1674,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_line_width(self.line_width);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetLineWidth")
}
}
@ -1707,7 +1707,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_scissor(self.first_scissor, self.scissors.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetScissor")
}
}
@ -1741,7 +1741,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.set_viewport(self.first_viewport, self.viewports.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
Box::new("vkCmdSetViewport")
}
}
@ -1775,7 +1775,7 @@ impl<P> SyncCommandBufferBuilder<P> {
out.update_buffer(&self.buffer, &self.data);
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin<B>(B);
impl<B> FinalCommand for Fin<B>
where B: BufferAccess + Send + Sync + 'static
@ -1783,7 +1783,7 @@ impl<P> SyncCommandBufferBuilder<P> {
fn name(&self) -> &'static str {
"vkCmdUpdateBuffer"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.0
}
@ -1794,7 +1794,7 @@ impl<P> SyncCommandBufferBuilder<P> {
Box::new(Fin(self.buffer))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
assert_eq!(num, 0);
&self.buffer
}
@ -1824,7 +1824,7 @@ impl<P> SyncCommandBufferBuilder<P> {
pub struct SyncCommandBufferBuilderBindDescriptorSets<'b, P: 'b> {
builder: &'b mut SyncCommandBufferBuilder<P>,
inner: SmallVec<[Box<DescriptorSet + Send + Sync>; 12]>,
inner: SmallVec<[Box<dyn DescriptorSet + Send + Sync>; 12]>,
}
impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
@ -1848,7 +1848,7 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
}
struct Cmd<Pl, I> {
inner: SmallVec<[Box<DescriptorSet + Send + Sync>; 12]>,
inner: SmallVec<[Box<dyn DescriptorSet + Send + Sync>; 12]>,
graphics: bool,
pipeline_layout: Pl,
first_binding: u32,
@ -1871,13 +1871,13 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
self.dynamic_offsets.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
struct Fin(SmallVec<[Box<DescriptorSet + Send + Sync>; 12]>);
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin(SmallVec<[Box<dyn DescriptorSet + Send + Sync>; 12]>);
impl FinalCommand for Fin {
fn name(&self) -> &'static str {
"vkCmdBindDescriptorSets"
}
fn buffer(&self, mut num: usize) -> &BufferAccess {
fn buffer(&self, mut num: usize) -> &dyn BufferAccess {
for set in self.0.iter() {
if let Some(buf) = set.buffer(num) {
return buf.0;
@ -1898,7 +1898,7 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
}
panic!()
}
fn image(&self, mut num: usize) -> &ImageAccess {
fn image(&self, mut num: usize) -> &dyn ImageAccess {
for set in self.0.iter() {
if let Some(img) = set.image(num) {
return img.0.parent();
@ -1923,7 +1923,7 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
Box::new(Fin(self.inner))
}
fn buffer(&self, mut num: usize) -> &BufferAccess {
fn buffer(&self, mut num: usize) -> &dyn BufferAccess {
for set in self.inner.iter() {
if let Some(buf) = set.buffer(num) {
return buf.0;
@ -1944,7 +1944,7 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
panic!()
}
fn image(&self, mut num: usize) -> &ImageAccess {
fn image(&self, mut num: usize) -> &dyn ImageAccess {
for set in self.inner.iter() {
if let Some(img) = set.image(num) {
return img.0.parent();
@ -2054,7 +2054,7 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
pub struct SyncCommandBufferBuilderBindVertexBuffer<'a, P: 'a> {
builder: &'a mut SyncCommandBufferBuilder<P>,
inner: UnsafeCommandBufferBuilderBindVertexBuffer,
buffers: Vec<Box<BufferAccess + Send + Sync>>,
buffers: Vec<Box<dyn BufferAccess + Send + Sync>>,
}
impl<'a, P> SyncCommandBufferBuilderBindVertexBuffer<'a, P> {
@ -2072,7 +2072,7 @@ impl<'a, P> SyncCommandBufferBuilderBindVertexBuffer<'a, P> {
struct Cmd {
first_binding: u32,
inner: Option<UnsafeCommandBufferBuilderBindVertexBuffer>,
buffers: Vec<Box<BufferAccess + Send + Sync>>,
buffers: Vec<Box<dyn BufferAccess + Send + Sync>>,
}
impl<P> Command<P> for Cmd {
@ -2084,13 +2084,13 @@ impl<'a, P> SyncCommandBufferBuilderBindVertexBuffer<'a, P> {
out.bind_vertex_buffers(self.first_binding, self.inner.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
struct Fin(Vec<Box<BufferAccess + Send + Sync>>);
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin(Vec<Box<dyn BufferAccess + Send + Sync>>);
impl FinalCommand for Fin {
fn name(&self) -> &'static str {
"vkCmdBindVertexBuffers"
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
&self.0[num]
}
fn buffer_name(&self, num: usize) -> Cow<'static, str> {
@ -2100,7 +2100,7 @@ impl<'a, P> SyncCommandBufferBuilderBindVertexBuffer<'a, P> {
Box::new(Fin(self.buffers))
}
fn buffer(&self, num: usize) -> &BufferAccess {
fn buffer(&self, num: usize) -> &dyn BufferAccess {
&self.buffers[num]
}
@ -2143,7 +2143,7 @@ impl<'a, P> SyncCommandBufferBuilderBindVertexBuffer<'a, P> {
pub struct SyncCommandBufferBuilderExecuteCommands<'a, P: 'a> {
builder: &'a mut SyncCommandBufferBuilder<P>,
inner: UnsafeCommandBufferBuilderExecuteCommands,
command_buffers: Vec<Box<Any + Send + Sync>>,
command_buffers: Vec<Box<dyn Any + Send + Sync>>,
}
impl<'a, P> SyncCommandBufferBuilderExecuteCommands<'a, P> {
@ -2161,7 +2161,7 @@ impl<'a, P> SyncCommandBufferBuilderExecuteCommands<'a, P> {
pub unsafe fn submit(self) -> Result<(), SyncCommandBufferBuilderError> {
struct Cmd {
inner: Option<UnsafeCommandBufferBuilderExecuteCommands>,
command_buffers: Vec<Box<Any + Send + Sync>>,
command_buffers: Vec<Box<dyn Any + Send + Sync>>,
}
impl<P> Command<P> for Cmd {
@ -2173,8 +2173,8 @@ impl<'a, P> SyncCommandBufferBuilderExecuteCommands<'a, P> {
out.execute_commands(self.inner.take().unwrap());
}
fn into_final_command(self: Box<Self>) -> Box<FinalCommand + Send + Sync> {
struct Fin(Vec<Box<Any + Send + Sync>>);
fn into_final_command(self: Box<Self>) -> Box<dyn FinalCommand + Send + Sync> {
struct Fin(Vec<Box<dyn Any + Send + Sync>>);
impl FinalCommand for Fin {
fn name(&self) -> &'static str {
"vkCmdExecuteCommands"

View File

@ -1029,7 +1029,7 @@ impl<P> UnsafeCommandBufferBuilder<P> {
/// Calls `vkCmdCopyQueryPoolResults` on the builder.
#[inline]
pub unsafe fn copy_query_pool_results(&mut self, queries: UnsafeQueriesRange,
destination: &BufferAccess, stride: usize) {
destination: &dyn BufferAccess, stride: usize) {
let destination = destination.inner();
debug_assert!(destination.offset < destination.buffer.size());
debug_assert!(destination.buffer.usage_transfer_destination());

View File

@ -54,7 +54,7 @@ pub unsafe trait CommandBuffer: DeviceOwned {
/// the given queue, and if so locks it.
///
/// If you call this function, then you should call `unlock` afterwards.
fn lock_submit(&self, future: &GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError>;
fn lock_submit(&self, future: &dyn GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError>;
/// Unlocks the command buffer. Should be called once for each call to `lock_submit`.
///
@ -136,10 +136,10 @@ pub unsafe trait CommandBuffer: DeviceOwned {
})
}
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError>;
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError>;
@ -158,7 +158,7 @@ unsafe impl<T> CommandBuffer for T
}
#[inline]
fn lock_submit(&self, future: &GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError> {
fn lock_submit(&self, future: &dyn GpuFuture, queue: &Queue) -> Result<(), CommandBufferExecError> {
(**self).lock_submit(future, queue)
}
@ -169,13 +169,13 @@ unsafe impl<T> CommandBuffer for T
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_buffer_access(buffer, exclusive, queue)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_image_access(image, layout, exclusive, queue)
@ -281,7 +281,7 @@ unsafe impl<F, Cb> GpuFuture for CommandBufferExecFuture<F, Cb>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
match self.command_buffer
.check_buffer_access(buffer, exclusive, queue) {
@ -294,7 +294,7 @@ unsafe impl<F, Cb> GpuFuture for CommandBufferExecFuture<F, Cb>
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
match self.command_buffer
@ -379,7 +379,7 @@ impl error::Error for CommandBufferExecError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CommandBufferExecError::AccessError { ref error, .. } => Some(error),
_ => None,

View File

@ -165,7 +165,7 @@ impl error::Error for CheckCopyBufferImageError {
}
}
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CheckCopyBufferImageError::WrongPixelType(ref err) => {
Some(err)

View File

@ -89,7 +89,7 @@ impl error::Error for CheckDescriptorSetsValidityError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CheckDescriptorSetsValidityError::IncompatibleDescriptor { ref error, .. } => {
Some(error)

View File

@ -46,7 +46,7 @@ pub fn check_vertex_buffers<P, V>(pipeline: &P, vertex_buffers: V)
/// Information returned if `check_vertex_buffer` succeeds.
pub struct CheckVertexBuffer {
/// The list of vertex buffers.
pub vertex_buffers: Vec<Box<BufferAccess + Send + Sync>>,
pub vertex_buffers: Vec<Box<dyn BufferAccess + Send + Sync>>,
/// Number of vertices available in the intersection of the buffers.
pub vertex_count: u32,
/// Number of instances available in the intersection of the buffers.

View File

@ -13,7 +13,7 @@ use descriptor::descriptor_set::DescriptorSetDesc;
/// A collection of descriptor set objects.
pub unsafe trait DescriptorSetsCollection {
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>>;
fn into_vec(self) -> Vec<Box<dyn DescriptorSet + Send + Sync>>;
/// Returns the number of descriptors in the set. Includes possibly empty descriptors.
///
@ -30,7 +30,7 @@ pub unsafe trait DescriptorSetsCollection {
unsafe impl DescriptorSetsCollection for () {
#[inline]
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>> {
fn into_vec(self) -> Vec<Box<dyn DescriptorSet + Send + Sync>> {
vec![]
}
@ -49,7 +49,7 @@ unsafe impl<T> DescriptorSetsCollection for T
where T: DescriptorSet + Send + Sync + 'static
{
#[inline]
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>> {
fn into_vec(self) -> Vec<Box<dyn DescriptorSet + Send + Sync>> {
vec![Box::new(self) as Box<_>]
}
@ -74,7 +74,7 @@ unsafe impl<T> DescriptorSetsCollection for Vec<T>
where T: DescriptorSet + Send + Sync + 'static
{
#[inline]
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>> {
fn into_vec(self) -> Vec<Box<dyn DescriptorSet + Send + Sync>> {
let mut v = Vec::new();
for o in self {
v.push(Box::new(o) as Box<_>);
@ -99,7 +99,7 @@ macro_rules! impl_collection {
$(, $others: DescriptorSet + DescriptorSetDesc + Send + Sync + 'static)*
{
#[inline]
fn into_vec(self) -> Vec<Box<DescriptorSet + Send + Sync>> {
fn into_vec(self) -> Vec<Box<dyn DescriptorSet + Send + Sync>> {
#![allow(non_snake_case)]
let ($first, $($others,)*) = self;

View File

@ -145,7 +145,7 @@ unsafe impl<L, R> DescriptorSet for FixedSizeDescriptorSet<L, R>
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
self.inner.buffer(index)
}
@ -155,7 +155,7 @@ unsafe impl<L, R> DescriptorSet for FixedSizeDescriptorSet<L, R>
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
self.inner.image(index)
}
}

View File

@ -88,7 +88,7 @@ pub unsafe trait DescriptorSet: DescriptorSetDesc {
/// returns the index of the descriptor that uses this buffer.
///
/// The valid range is between 0 and `num_buffers()`.
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)>;
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)>;
/// Returns the number of images within this descriptor set.
fn num_images(&self) -> usize;
@ -97,7 +97,7 @@ pub unsafe trait DescriptorSet: DescriptorSetDesc {
/// the index of the descriptor that uses this image.
///
/// The valid range is between 0 and `num_images()`.
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)>;
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)>;
}
unsafe impl<T> DescriptorSet for T
@ -115,7 +115,7 @@ unsafe impl<T> DescriptorSet for T
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
(**self).buffer(index)
}
@ -125,7 +125,7 @@ unsafe impl<T> DescriptorSet for T
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
(**self).image(index)
}
}

View File

@ -102,7 +102,7 @@ unsafe impl<L, R, P> DescriptorSet for PersistentDescriptorSet<L, R, P>
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
self.resources.buffer(index)
}
@ -112,7 +112,7 @@ unsafe impl<L, R, P> DescriptorSet for PersistentDescriptorSet<L, R, P>
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
self.resources.image(index)
}
}
@ -821,9 +821,9 @@ fn image_match_desc<I>(image_view: &I, desc: &DescriptorImageDesc)
pub unsafe trait PersistentDescriptorSetResources {
fn num_buffers(&self) -> usize;
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)>;
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)>;
fn num_images(&self) -> usize;
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)>;
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)>;
}
unsafe impl PersistentDescriptorSetResources for () {
@ -833,7 +833,7 @@ unsafe impl PersistentDescriptorSetResources for () {
}
#[inline]
fn buffer(&self, _: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, _: usize) -> Option<(&dyn BufferAccess, u32)> {
None
}
@ -843,7 +843,7 @@ unsafe impl PersistentDescriptorSetResources for () {
}
#[inline]
fn image(&self, _: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, _: usize) -> Option<(&dyn ImageViewAccess, u32)> {
None
}
}
@ -864,7 +864,7 @@ unsafe impl<R, B> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
if let Some(buf) = self.0.buffer(index) {
Some(buf)
} else if index == self.0.num_buffers() {
@ -880,7 +880,7 @@ unsafe impl<R, B> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
self.0.image(index)
}
}
@ -903,7 +903,7 @@ unsafe impl<R, V> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
if let Some(buf) = self.0.buffer(index) {
Some(buf)
} else if index == self.0.num_buffers() {
@ -919,7 +919,7 @@ unsafe impl<R, V> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
self.0.image(index)
}
}
@ -940,7 +940,7 @@ unsafe impl<R, I> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
self.0.buffer(index)
}
@ -950,7 +950,7 @@ unsafe impl<R, I> PersistentDescriptorSetResources for (R, PersistentDescriptorS
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
if let Some(img) = self.0.image(index) {
Some(img)
} else if index == self.0.num_images() {
@ -975,7 +975,7 @@ unsafe impl<R> PersistentDescriptorSetResources for (R, PersistentDescriptorSetS
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&BufferAccess, u32)> {
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
self.0.buffer(index)
}
@ -985,7 +985,7 @@ unsafe impl<R> PersistentDescriptorSetResources for (R, PersistentDescriptorSetS
}
#[inline]
fn image(&self, index: usize) -> Option<(&ImageViewAccess, u32)> {
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
self.0.image(index)
}
}

View File

@ -290,7 +290,7 @@ impl error::Error for PipelineLayoutCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
PipelineLayoutCreationError::OomError(ref err) => Some(err),
PipelineLayoutCreationError::LimitsError(ref err) => Some(err),

View File

@ -255,7 +255,7 @@ impl error::Error for PipelineLayoutNotSupersetError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
PipelineLayoutNotSupersetError::IncompatibleDescriptors { ref error, .. } => {
Some(error)

View File

@ -379,7 +379,7 @@ impl Device {
// TODO: ^
#[inline]
pub fn active_queue_families<'a>(&'a self)
-> Box<ExactSizeIterator<Item = QueueFamily<'a>> + 'a> {
-> Box<dyn ExactSizeIterator<Item = QueueFamily<'a>> + 'a> {
let physical_device = self.physical_device();
Box::new(self.active_queue_families
.iter()

View File

@ -193,7 +193,7 @@ impl error::Error for SupportedExtensionsError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SupportedExtensionsError::LoadingError(ref err) => Some(err),
SupportedExtensionsError::OomError(ref err) => Some(err),

View File

@ -18,7 +18,7 @@ use std::sync::Arc;
pub unsafe trait AttachmentsList {
fn num_attachments(&self) -> usize;
fn as_image_view_access(&self, index: usize) -> Option<&ImageViewAccess>;
fn as_image_view_access(&self, index: usize) -> Option<&dyn ImageViewAccess>;
}
unsafe impl<T> AttachmentsList for T
@ -31,7 +31,7 @@ unsafe impl<T> AttachmentsList for T
}
#[inline]
fn as_image_view_access(&self, index: usize) -> Option<&ImageViewAccess> {
fn as_image_view_access(&self, index: usize) -> Option<&dyn ImageViewAccess> {
(**self).as_image_view_access(index)
}
}
@ -43,19 +43,19 @@ unsafe impl AttachmentsList for () {
}
#[inline]
fn as_image_view_access(&self, _: usize) -> Option<&ImageViewAccess> {
fn as_image_view_access(&self, _: usize) -> Option<&dyn ImageViewAccess> {
None
}
}
unsafe impl AttachmentsList for Vec<Arc<ImageViewAccess + Send + Sync>> {
unsafe impl AttachmentsList for Vec<Arc<dyn ImageViewAccess + Send + Sync>> {
#[inline]
fn num_attachments(&self) -> usize {
self.len()
}
#[inline]
fn as_image_view_access(&self, index: usize) -> Option<&ImageViewAccess> {
fn as_image_view_access(&self, index: usize) -> Option<&dyn ImageViewAccess> {
self.get(index).map(|v| &**v as &_)
}
}
@ -70,7 +70,7 @@ unsafe impl<A, B> AttachmentsList for (A, B)
}
#[inline]
fn as_image_view_access(&self, index: usize) -> Option<&ImageViewAccess> {
fn as_image_view_access(&self, index: usize) -> Option<&dyn ImageViewAccess> {
if index == self.0.num_attachments() {
Some(&self.1)
} else {

View File

@ -115,7 +115,7 @@ unsafe impl RenderPassDesc for EmptySinglePassRenderPassDesc {
unsafe impl RenderPassDescClearValues<Vec<ClearValue>> for EmptySinglePassRenderPassDesc {
#[inline]
fn convert_clear_values(&self, values: Vec<ClearValue>) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, values: Vec<ClearValue>) -> Box<dyn Iterator<Item = ClearValue>> {
assert!(values.is_empty()); // TODO: error instead
Box::new(iter::empty())
}
@ -123,7 +123,7 @@ unsafe impl RenderPassDescClearValues<Vec<ClearValue>> for EmptySinglePassRender
unsafe impl RenderPassDescClearValues<()> for EmptySinglePassRenderPassDesc {
#[inline]
fn convert_clear_values(&self, _: ()) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, _: ()) -> Box<dyn Iterator<Item = ClearValue>> {
Box::new(iter::empty())
}
}

View File

@ -241,7 +241,7 @@ impl<Rp, A> FramebufferBuilder<Rp, A>
/// > **Note**: This is a very rare corner case and you shouldn't have to use this function
/// > in most situations.
#[inline]
pub fn boxed(self) -> FramebufferBuilder<Rp, Box<AttachmentsList>>
pub fn boxed(self) -> FramebufferBuilder<Rp, Box<dyn AttachmentsList>>
where A: 'static
{
FramebufferBuilder {
@ -376,7 +376,7 @@ unsafe impl<Rp, A> FramebufferAbstract for Framebuffer<Rp, A>
}
#[inline]
fn attached_image_view(&self, index: usize) -> Option<&ImageViewAccess> {
fn attached_image_view(&self, index: usize) -> Option<&dyn ImageViewAccess> {
self.resources.as_image_view_access(index)
}
}
@ -419,7 +419,7 @@ unsafe impl<C, Rp, A> RenderPassDescClearValues<C> for Framebuffer<Rp, A>
where Rp: RenderPassDescClearValues<C>
{
#[inline]
fn convert_clear_values(&self, vals: C) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>> {
self.render_pass.convert_clear_values(vals)
}
}
@ -522,7 +522,7 @@ impl error::Error for FramebufferCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FramebufferCreationError::OomError(ref err) => Some(err),
FramebufferCreationError::IncompatibleAttachment(ref err) => Some(err),

View File

@ -119,7 +119,7 @@ macro_rules! ordered_passes_renderpass {
}
unsafe impl RenderPassDescClearValues<Vec<ClearValue>> for CustomRenderPassDesc {
fn convert_clear_values(&self, values: Vec<ClearValue>) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, values: Vec<ClearValue>) -> Box<dyn Iterator<Item = ClearValue>> {
// FIXME: safety checks
Box::new(values.into_iter())
}

View File

@ -446,7 +446,7 @@ unsafe impl<C, D> RenderPassDescClearValues<C> for RenderPass<D>
where D: RenderPassDescClearValues<C>
{
#[inline]
fn convert_clear_values(&self, vals: C) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>> {
self.desc.convert_clear_values(vals)
}
}
@ -525,7 +525,7 @@ impl error::Error for RenderPassCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
RenderPassCreationError::OomError(ref err) => Some(err),
_ => None,

View File

@ -31,7 +31,7 @@ pub unsafe trait FramebufferAbstract: RenderPassAbstract {
/// Returns the attachment of the framebuffer with the given index.
///
/// If the `index` is not between `0` and `num_attachments`, then `None` should be returned.
fn attached_image_view(&self, index: usize) -> Option<&ImageViewAccess>;
fn attached_image_view(&self, index: usize) -> Option<&dyn ImageViewAccess>;
/// Returns the width of the framebuffer in pixels.
#[inline]
@ -67,7 +67,7 @@ unsafe impl<T> FramebufferAbstract for T
}
#[inline]
fn attached_image_view(&self, index: usize) -> Option<&ImageViewAccess> {
fn attached_image_view(&self, index: usize) -> Option<&dyn ImageViewAccess> {
(**self).attached_image_view(index)
}
}
@ -134,7 +134,7 @@ pub unsafe trait RenderPassDescClearValues<C> {
/// that matches the attachment.
///
// TODO: meh for boxing
fn convert_clear_values(&self, C) -> Box<Iterator<Item = ClearValue>>;
fn convert_clear_values(&self, C) -> Box<dyn Iterator<Item = ClearValue>>;
}
unsafe impl<T, C> RenderPassDescClearValues<C> for T
@ -142,7 +142,7 @@ unsafe impl<T, C> RenderPassDescClearValues<C> for T
T::Target: RenderPassDescClearValues<C>
{
#[inline]
fn convert_clear_values(&self, vals: C) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>> {
(**self).convert_clear_values(vals)
}
}

View File

@ -438,12 +438,12 @@ unsafe impl<F, A> ImageAccess for AttachmentImage<F, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
false
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.conflict_key() == other.conflict_key()
}
@ -531,7 +531,7 @@ unsafe impl<F, A> ImageViewAccess for AttachmentImage<F, A>
where F: 'static + Send + Sync
{
#[inline]
fn parent(&self) -> &ImageAccess {
fn parent(&self) -> &dyn ImageAccess {
self
}

View File

@ -293,12 +293,12 @@ unsafe impl<F, A> ImageAccess for ImmutableImage<F, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
false
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
@ -351,7 +351,7 @@ unsafe impl<F: 'static, A> ImageViewAccess for ImmutableImage<F, A>
where F: 'static + Send + Sync
{
#[inline]
fn parent(&self) -> &ImageAccess {
fn parent(&self) -> &dyn ImageAccess {
self
}
@ -410,12 +410,12 @@ unsafe impl<F, A> ImageAccess for ImmutableImageInitialization<F, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
false
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}

View File

@ -198,12 +198,12 @@ unsafe impl<F, A> ImageAccess for StorageImage<F, A>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
false
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.conflict_key() == other.conflict_key() // TODO:
}
@ -268,7 +268,7 @@ unsafe impl<F, A> ImageViewAccess for StorageImage<F, A>
A: MemoryPool
{
#[inline]
fn parent(&self) -> &ImageAccess {
fn parent(&self) -> &dyn ImageAccess {
self
}

View File

@ -111,12 +111,12 @@ unsafe impl<W> ImageAccess for SwapchainImage<W> {
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
false
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.my_image().image.key() == other.conflict_key() // TODO:
}
@ -167,7 +167,7 @@ unsafe impl<P,W> ImageContent<P> for SwapchainImage<W> {
unsafe impl<W> ImageViewAccess for SwapchainImage<W> {
#[inline]
fn parent(&self) -> &ImageAccess {
fn parent(&self) -> &dyn ImageAccess {
self
}

View File

@ -866,7 +866,7 @@ impl error::Error for ImageCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
ImageCreationError::AllocError(ref err) => Some(err),
_ => None,

View File

@ -154,7 +154,7 @@ pub unsafe trait ImageAccess {
///
/// Note that the function must be transitive. In other words if `conflicts(a, b)` is true and
/// `conflicts(b, c)` is true, then `conflicts(a, c)` must be true as well.
fn conflicts_buffer(&self, other: &BufferAccess) -> bool;
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool;
/// Returns true if an access to `self` potentially overlaps the same memory as an
/// access to `other`.
@ -164,7 +164,7 @@ pub unsafe trait ImageAccess {
///
/// Note that the function must be transitive. In other words if `conflicts(a, b)` is true and
/// `conflicts(b, c)` is true, then `conflicts(a, c)` must be true as well.
fn conflicts_image(&self, other: &ImageAccess) -> bool;
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool;
/// Returns a key that uniquely identifies the memory content of the image.
/// Two ranges that potentially overlap in memory must return the same key.
@ -269,12 +269,12 @@ unsafe impl<T> ImageAccess for T
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
(**self).conflicts_buffer(other)
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
(**self).conflicts_image(other)
}
@ -341,12 +341,12 @@ unsafe impl<I> ImageAccess for ImageAccessFromUndefinedLayout<I>
}
#[inline]
fn conflicts_buffer(&self, other: &BufferAccess) -> bool {
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool {
self.image.conflicts_buffer(other)
}
#[inline]
fn conflicts_image(&self, other: &ImageAccess) -> bool {
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool {
self.image.conflicts_image(other)
}
@ -386,7 +386,7 @@ pub unsafe trait ImageContent<P>: ImageAccess {
/// Trait for types that represent the GPU can access an image view.
pub unsafe trait ImageViewAccess {
fn parent(&self) -> &ImageAccess;
fn parent(&self) -> &dyn ImageAccess;
/// Returns the dimensions of the image view.
fn dimensions(&self) -> Dimensions;
@ -438,7 +438,7 @@ unsafe impl<T> ImageViewAccess for T
T::Target: ImageViewAccess
{
#[inline]
fn parent(&self) -> &ImageAccess {
fn parent(&self) -> &dyn ImageAccess {
(**self).parent()
}

View File

@ -61,7 +61,7 @@ use vk;
pub struct DebugCallback {
instance: Arc<Instance>,
debug_report_callback: vk::DebugReportCallbackEXT,
user_callback: Box<Box<Fn(&Message)>>,
user_callback: Box<Box<dyn Fn(&Message)>>,
}
impl DebugCallback {
@ -85,8 +85,8 @@ impl DebugCallback {
description: *const c_char, user_data: *mut c_void)
-> u32 {
unsafe {
let user_callback = user_data as *mut Box<Fn()> as *const _;
let user_callback: &Box<Fn(&Message)> = &*user_callback;
let user_callback = user_data as *mut Box<dyn Fn()> as *const _;
let user_callback: &Box<dyn Fn(&Message)> = &*user_callback;
let layer_prefix = CStr::from_ptr(layer_prefix)
.to_str()

View File

@ -96,7 +96,7 @@ pub struct Instance {
vk: vk::InstancePointers,
extensions: InstanceExtensions,
layers: SmallVec<[CString; 16]>,
function_pointers: OwnedOrRef<FunctionPointers<Box<Loader + Send + Sync>>>,
function_pointers: OwnedOrRef<FunctionPointers<Box<dyn Loader + Send + Sync>>>,
}
// TODO: fix the underlying cause instead
@ -148,7 +148,7 @@ impl Instance {
}
/// Same as `new`, but allows specifying a loader where to load Vulkan from.
pub fn with_loader<'a, L, Ext>(loader: FunctionPointers<Box<Loader + Send + Sync>>,
pub fn with_loader<'a, L, Ext>(loader: FunctionPointers<Box<dyn Loader + Send + Sync>>,
app_infos: Option<&ApplicationInfo>, extensions: Ext, layers: L)
-> Result<Arc<Instance>, InstanceCreationError>
where L: IntoIterator<Item = &'a str>,
@ -167,7 +167,7 @@ impl Instance {
fn new_inner(app_infos: Option<&ApplicationInfo>, extensions: RawInstanceExtensions,
layers: SmallVec<[CString; 16]>,
function_pointers: OwnedOrRef<FunctionPointers<Box<Loader + Send + Sync>>>)
function_pointers: OwnedOrRef<FunctionPointers<Box<dyn Loader + Send + Sync>>>)
-> Result<Arc<Instance>, InstanceCreationError> {
// TODO: For now there are still buggy drivers that will segfault if you don't pass any
// appinfos. Therefore for now we ensure that it can't be `None`.
@ -619,7 +619,7 @@ impl error::Error for InstanceCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
InstanceCreationError::LoadingError(ref err) => Some(err),
InstanceCreationError::OomError(ref err) => Some(err),

View File

@ -180,7 +180,7 @@ impl error::Error for LayersListError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
LayersListError::LoadingError(ref err) => Some(err),
LayersListError::OomError(ref err) => Some(err),

View File

@ -169,7 +169,7 @@ macro_rules! statically_linked_vulkan_loader {
/// `lazy_static!`. The content of the lazy_static is then returned, or an error if we failed to
/// load Vulkan.
pub fn auto_loader()
-> Result<&'static FunctionPointers<Box<Loader + Send + Sync>>, LoadingError>
-> Result<&'static FunctionPointers<Box<dyn Loader + Send + Sync>>, LoadingError>
{
#[cfg(target_os = "ios")]
#[allow(non_snake_case)]
@ -179,7 +179,7 @@ pub fn auto_loader()
}
#[cfg(not(target_os = "ios"))]
fn def_loader_impl() -> Result<Box<Loader + Send + Sync>, LoadingError> {
fn def_loader_impl() -> Result<Box<dyn Loader + Send + Sync>, LoadingError> {
#[cfg(windows)]
fn get_path() -> &'static Path {
Path::new("vulkan-1.dll")
@ -203,7 +203,7 @@ pub fn auto_loader()
}
lazy_static! {
static ref DEFAULT_LOADER: Result<FunctionPointers<Box<Loader + Send + Sync>>, LoadingError> = {
static ref DEFAULT_LOADER: Result<FunctionPointers<Box<dyn Loader + Send + Sync>>, LoadingError> = {
def_loader_impl().map(FunctionPointers::new)
};
}

View File

@ -482,7 +482,7 @@ impl error::Error for DeviceMemoryAllocError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
DeviceMemoryAllocError::OomError(ref err) => Some(err),
_ => None,

View File

@ -316,7 +316,7 @@ impl error::Error for ComputePipelineCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
ComputePipelineCreationError::OomError(ref err) => Some(err),
ComputePipelineCreationError::PipelineLayoutCreationError(ref err) => Some(err),

View File

@ -156,7 +156,7 @@ impl<Vdef, Vs, Vss, Tcs, Tcss, Tes, Tess, Gs, Gss, Fs, Fss, Rp>
/// Builds the graphics pipeline, using an inferred a pipeline layout.
// TODO: replace Box<PipelineLayoutAbstract> with a PipelineUnion struct without template params
pub fn build(self, device: Arc<Device>)
-> Result<GraphicsPipeline<Vdef, Box<PipelineLayoutAbstract + Send + Sync>, Rp>,
-> Result<GraphicsPipeline<Vdef, Box<dyn PipelineLayoutAbstract + Send + Sync>, Rp>,
GraphicsPipelineCreationError> {
self.with_auto_layout(device, &[])
}
@ -166,7 +166,7 @@ impl<Vdef, Vs, Vss, Tcs, Tcss, Tes, Tess, Gs, Gss, Fs, Fss, Rp>
/// Configures the inferred layout for each descriptor `(set, binding)` in `dynamic_buffers` to accept dynamic
/// buffers.
pub fn with_auto_layout(self, device: Arc<Device>, dynamic_buffers: &[(usize, usize)])
-> Result<GraphicsPipeline<Vdef, Box<PipelineLayoutAbstract + Send + Sync>, Rp>,
-> Result<GraphicsPipeline<Vdef, Box<dyn PipelineLayoutAbstract + Send + Sync>, Rp>,
GraphicsPipelineCreationError>
{
let pipeline_layout;

View File

@ -323,7 +323,7 @@ impl error::Error for GraphicsPipelineCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
GraphicsPipelineCreationError::OomError(ref err) => Some(err),
GraphicsPipelineCreationError::IncompatiblePipelineLayout(ref err) => Some(err),

View File

@ -294,7 +294,7 @@ unsafe impl<C, Mv, L, Rp> RenderPassDescClearValues<C> for GraphicsPipeline<Mv,
where Rp: RenderPassDescClearValues<C>
{
#[inline]
fn convert_clear_values(&self, vals: C) -> Box<Iterator<Item = ClearValue>> {
fn convert_clear_values(&self, vals: C) -> Box<dyn Iterator<Item = ClearValue>> {
self.render_pass.convert_clear_values(vals)
}
}
@ -324,7 +324,7 @@ impl Drop for Inner {
/// object.
/// When using this trait `AutoCommandBufferBuilder::draw*` calls will need the buffers to be
/// wrapped in a `vec!()`.
pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract + VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> {
pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAbstract + VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>> {
/// Returns an opaque object that represents the inside of the graphics pipeline.
fn inner(&self) -> GraphicsPipelineSys;
@ -366,7 +366,7 @@ pub unsafe trait GraphicsPipelineAbstract: PipelineLayoutAbstract + RenderPassAb
unsafe impl<Mv, L, Rp> GraphicsPipelineAbstract for GraphicsPipeline<Mv, L, Rp>
where L: PipelineLayoutAbstract,
Rp: RenderPassAbstract,
Mv: VertexSource<Vec<Arc<BufferAccess + Send + Sync>>>
Mv: VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>>
{
#[inline]
fn inner(&self) -> GraphicsPipelineSys {
@ -507,7 +507,7 @@ unsafe impl<Mv, L, Rp, S> VertexSource<S> for GraphicsPipeline<Mv, L, Rp>
where Mv: VertexSource<S>
{
#[inline]
fn decode(&self, s: S) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, s: S) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
self.vertex_definition.decode(s)
}
}

View File

@ -33,14 +33,14 @@ pub struct BufferlessVertices {
unsafe impl VertexSource<BufferlessVertices> for BufferlessDefinition {
fn decode(&self, n: BufferlessVertices)
-> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
-> (Vec<Box<dyn BufferAccess + Sync + Send + 'static>>, usize, usize) {
(Vec::new(), n.vertices, n.instances)
}
}
unsafe impl<T> VertexSource<Vec<T>> for BufferlessDefinition {
fn decode<'l>(&self, _: Vec<T>)
-> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
-> (Vec<Box<dyn BufferAccess + Sync + Send + 'static>>, usize, usize) {
panic!("bufferless drawing should not be supplied with buffers")
}
}

View File

@ -19,7 +19,7 @@ use vk;
/// Trait for types that describe the definition of the vertex input used by a graphics pipeline.
pub unsafe trait VertexDefinition<I>
: VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> {
: VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>> {
/// Iterator that returns the offset, the stride (in bytes) and input rate of each buffer.
type BuffersIter: ExactSizeIterator<Item = (u32, usize, InputRate)>;
/// Iterator that returns the attribute location, buffer id, and infos.
@ -114,7 +114,7 @@ pub unsafe trait VertexSource<L> {
// TODO: return error if problem
// TODO: better than a Vec
// TODO: return a struct instead
fn decode(&self, L) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize);
fn decode(&self, L) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize);
}
unsafe impl<L, T> VertexSource<L> for T
@ -122,7 +122,7 @@ unsafe impl<L, T> VertexSource<L> for T
T::Target: VertexSource<L>
{
#[inline]
fn decode(&self, list: L) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, list: L) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
(**self).decode(list)
}
}

View File

@ -92,7 +92,7 @@ where
}
}
unsafe impl<V> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>>
unsafe impl<V> VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>>
for SingleInstanceBufferDefinition<V>
where
V: Vertex,
@ -100,8 +100,8 @@ where
#[inline]
fn decode(
&self,
mut source: Vec<Arc<BufferAccess + Send + Sync>>,
) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
mut source: Vec<Arc<dyn BufferAccess + Send + Sync>>,
) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
// FIXME: safety
assert_eq!(source.len(), 1);
let len = source[0].size() / mem::size_of::<V>();
@ -115,7 +115,7 @@ where
V: Vertex,
{
#[inline]
fn decode(&self, source: B) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, source: B) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
let len = source.len();
(vec![Box::new(source) as Box<_>], 1, len)
}

View File

@ -93,14 +93,14 @@ unsafe impl<T, U, I> VertexDefinition<I> for OneVertexOneInstanceDefinition<T, U
}
}
unsafe impl<T, U> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>>
unsafe impl<T, U> VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>>
for OneVertexOneInstanceDefinition<T, U>
where T: Vertex,
U: Vertex
{
#[inline]
fn decode(&self, mut source: Vec<Arc<BufferAccess + Send + Sync>>)
-> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, mut source: Vec<Arc<dyn BufferAccess + Send + Sync>>)
-> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
// FIXME: safety
assert_eq!(source.len(), 2);
let len = source[0].size() / mem::size_of::<T>();
@ -118,7 +118,7 @@ unsafe impl<'a, T, U, Bt, Bu> VertexSource<(Bt, Bu)> for OneVertexOneInstanceDef
Bu: TypedBufferAccess<Content = [U]> + Send + Sync + 'static
{
#[inline]
fn decode(&self, source: (Bt, Bu)) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, source: (Bt, Bu)) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
let s1l = source.0.len();
let s2l = source.1.len();
(vec![Box::new(source.0) as Box<_>, Box::new(source.1) as Box<_>], s1l, s2l)

View File

@ -85,12 +85,12 @@ unsafe impl<T, I> VertexDefinition<I> for SingleBufferDefinition<T>
}
}
unsafe impl<V> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> for SingleBufferDefinition<V>
unsafe impl<V> VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>> for SingleBufferDefinition<V>
where V: Vertex
{
#[inline]
fn decode(&self, mut source: Vec<Arc<BufferAccess + Send + Sync>>)
-> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, mut source: Vec<Arc<dyn BufferAccess + Send + Sync>>)
-> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
// FIXME: safety
assert_eq!(source.len(), 1);
let len = source[0].size() / mem::size_of::<V>();
@ -103,7 +103,7 @@ unsafe impl<'a, B, V> VertexSource<B> for SingleBufferDefinition<V>
V: Vertex
{
#[inline]
fn decode(&self, source: B) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, source: B) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
let len = source.len();
(vec![Box::new(source) as Box<_>], len, 1)
}

View File

@ -93,13 +93,13 @@ unsafe impl<T, U, I> VertexDefinition<I> for TwoBuffersDefinition<T, U>
}
}
unsafe impl<T, U> VertexSource<Vec<Arc<BufferAccess + Send + Sync>>> for TwoBuffersDefinition<T, U>
unsafe impl<T, U> VertexSource<Vec<Arc<dyn BufferAccess + Send + Sync>>> for TwoBuffersDefinition<T, U>
where T: Vertex,
U: Vertex
{
#[inline]
fn decode(&self, source: Vec<Arc<BufferAccess + Send + Sync>>)
-> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, source: Vec<Arc<dyn BufferAccess + Send + Sync>>)
-> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
// FIXME: safety
assert_eq!(source.len(), 2);
let vertices = [
@ -120,7 +120,7 @@ unsafe impl<'a, T, U, Bt, Bu> VertexSource<(Bt, Bu)> for TwoBuffersDefinition<T,
Bu: TypedBufferAccess<Content = [U]> + Send + Sync + 'static
{
#[inline]
fn decode(&self, source: (Bt, Bu)) -> (Vec<Box<BufferAccess + Send + Sync>>, usize, usize) {
fn decode(&self, source: (Bt, Bu)) -> (Vec<Box<dyn BufferAccess + Send + Sync>>, usize, usize) {
let vertices = [source.0.len(), source.1.len()]
.iter()
.cloned()

View File

@ -282,7 +282,7 @@ impl error::Error for QueryPoolCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
QueryPoolCreationError::OomError(ref err) => Some(err),
_ => None,

View File

@ -699,7 +699,7 @@ impl error::Error for SamplerCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SamplerCreationError::OomError(ref err) => Some(err),
_ => None,

View File

@ -627,7 +627,7 @@ impl error::Error for SurfaceCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SurfaceCreationError::OomError(ref err) => Some(err),
_ => None,
@ -681,7 +681,7 @@ impl error::Error for CapabilitiesError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
CapabilitiesError::OomError(ref err) => Some(err),
_ => None,

View File

@ -708,7 +708,7 @@ impl error::Error for SwapchainCreationError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
SwapchainCreationError::OomError(ref err) => Some(err),
_ => None,
@ -830,13 +830,13 @@ unsafe impl<W> GpuFuture for SwapchainAcquireFuture<W> {
#[inline]
fn check_buffer_access(
&self, _: &BufferAccess, _: bool, _: &Queue)
&self, _: &dyn BufferAccess, _: bool, _: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
Err(AccessCheckError::Unknown)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, _: bool, _: &Queue)
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, _: bool, _: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let swapchain_image = self.swapchain.raw_image(self.image_id).unwrap();
if swapchain_image.image.internal_object() != image.inner().image.internal_object() {
@ -930,7 +930,7 @@ impl error::Error for AcquireError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
AcquireError::OomError(ref err) => Some(err),
_ => None,
@ -1108,13 +1108,13 @@ unsafe impl<P, W> GpuFuture for PresentFuture<P, W>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
self.previous.check_buffer_access(buffer, exclusive, queue)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let swapchain_image = self.swapchain.raw_image(self.image_id).unwrap();

View File

@ -356,7 +356,7 @@ impl error::Error for FenceWaitError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FenceWaitError::OomError(ref err) => Some(err),
_ => None,

View File

@ -389,7 +389,7 @@ unsafe impl<F> GpuFuture for FenceSignalFuture<F>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let state = self.state.lock().unwrap();
if let Some(previous) = state.get_prev() {
@ -400,7 +400,7 @@ unsafe impl<F> GpuFuture for FenceSignalFuture<F>
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let state = self.state.lock().unwrap();
@ -491,13 +491,13 @@ unsafe impl<F> GpuFuture for Arc<FenceSignalFuture<F>>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_buffer_access(buffer, exclusive, queue)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_image_access(image, layout, exclusive, queue)

View File

@ -193,7 +193,7 @@ unsafe impl<A, B> GpuFuture for JoinFuture<A, B>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let first = self.first.check_buffer_access(buffer, exclusive, queue);
let second = self.second.check_buffer_access(buffer, exclusive, queue);
@ -217,7 +217,7 @@ unsafe impl<A, B> GpuFuture for JoinFuture<A, B>
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
let first = self.first

View File

@ -115,7 +115,7 @@ pub unsafe trait GpuFuture: DeviceOwned {
///
/// > **Note**: Returning `Ok` means "access granted", while returning `Err` means
/// > "don't know". Therefore returning `Err` is never unsafe.
fn check_buffer_access(&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
fn check_buffer_access(&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError>;
/// Checks whether submitting something after this future grants access (exclusive or shared,
@ -132,7 +132,7 @@ pub unsafe trait GpuFuture: DeviceOwned {
///
/// > **Note**: Keep in mind that changing the layout of an image also requires exclusive
/// > access.
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError>;
@ -292,13 +292,13 @@ unsafe impl<F: ?Sized> GpuFuture for Box<F>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_buffer_access(buffer, exclusive, queue)
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
(**self).check_image_access(image, layout, exclusive, queue)
@ -443,7 +443,7 @@ impl error::Error for FlushError {
}
#[inline]
fn cause(&self) -> Option<&error::Error> {
fn cause(&self) -> Option<&dyn error::Error> {
match *self {
FlushError::AccessError(ref err) => Some(err),
FlushError::OomError(ref err) => Some(err),

View File

@ -64,13 +64,13 @@ unsafe impl GpuFuture for NowFuture {
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, _: bool, _: &Queue)
&self, buffer: &dyn BufferAccess, _: bool, _: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
Err(AccessCheckError::Unknown)
}
#[inline]
fn check_image_access(&self, _: &ImageAccess, _: ImageLayout, _: bool, _: &Queue)
fn check_image_access(&self, _: &dyn ImageAccess, _: ImageLayout, _: bool, _: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
Err(AccessCheckError::Unknown)
}

View File

@ -143,7 +143,7 @@ unsafe impl<F> GpuFuture for SemaphoreSignalFuture<F>
#[inline]
fn check_buffer_access(
&self, buffer: &BufferAccess, exclusive: bool, queue: &Queue)
&self, buffer: &dyn BufferAccess, exclusive: bool, queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
self.previous
.check_buffer_access(buffer, exclusive, queue)
@ -151,7 +151,7 @@ unsafe impl<F> GpuFuture for SemaphoreSignalFuture<F>
}
#[inline]
fn check_image_access(&self, image: &ImageAccess, layout: ImageLayout, exclusive: bool,
fn check_image_access(&self, image: &dyn ImageAccess, layout: ImageLayout, exclusive: bool,
queue: &Queue)
-> Result<Option<(PipelineStages, AccessFlagBits)>, AccessCheckError> {
self.previous