mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 06:45:23 +00:00
Fix erroneous used range for buffers in descriptor sets (#2303)
* Fix erroneous used range for buffers in descriptor sets * Fix mistake resulting from an error in the spec that was just fixed
This commit is contained in:
parent
49a8f6607c
commit
c8ad5a4512
@ -680,6 +680,9 @@ impl AutoSyncState {
|
|||||||
ref range,
|
ref range,
|
||||||
memory_access,
|
memory_access,
|
||||||
} => {
|
} => {
|
||||||
|
debug_assert!(range.start <= range.end);
|
||||||
|
debug_assert!(range.end <= buffer.size());
|
||||||
|
|
||||||
if let Some(previous_use_ref) = self.find_buffer_conflict(
|
if let Some(previous_use_ref) = self.find_buffer_conflict(
|
||||||
self.command_index,
|
self.command_index,
|
||||||
buffer,
|
buffer,
|
||||||
@ -704,6 +707,16 @@ impl AutoSyncState {
|
|||||||
start_layout,
|
start_layout,
|
||||||
end_layout,
|
end_layout,
|
||||||
} => {
|
} => {
|
||||||
|
debug_assert!(image.format().aspects().contains(subresource_range.aspects));
|
||||||
|
debug_assert!(
|
||||||
|
subresource_range.mip_levels.start <= subresource_range.mip_levels.end
|
||||||
|
);
|
||||||
|
debug_assert!(subresource_range.mip_levels.end <= image.mip_levels());
|
||||||
|
debug_assert!(
|
||||||
|
subresource_range.array_layers.start <= subresource_range.array_layers.end
|
||||||
|
);
|
||||||
|
debug_assert!(subresource_range.array_layers.end <= image.array_layers());
|
||||||
|
|
||||||
debug_assert!(memory_access.contains_write() || start_layout == end_layout);
|
debug_assert!(memory_access.contains_write() || start_layout == end_layout);
|
||||||
debug_assert!(end_layout != ImageLayout::Undefined);
|
debug_assert!(end_layout != ImageLayout::Undefined);
|
||||||
debug_assert!(end_layout != ImageLayout::Preinitialized);
|
debug_assert!(end_layout != ImageLayout::Preinitialized);
|
||||||
@ -1267,7 +1280,7 @@ struct UnsolvableResourceConflict {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State of a resource during the building of the command buffer.
|
// State of a resource during the building of the command buffer.
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
struct BufferState {
|
struct BufferState {
|
||||||
// Lists every use of the resource.
|
// Lists every use of the resource.
|
||||||
resource_uses: Vec<ResourceUseRef>,
|
resource_uses: Vec<ResourceUseRef>,
|
||||||
@ -1281,7 +1294,7 @@ struct BufferState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// State of a resource during the building of the command buffer.
|
// State of a resource during the building of the command buffer.
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
struct ImageState {
|
struct ImageState {
|
||||||
// Lists every use of the resource.
|
// Lists every use of the resource.
|
||||||
resource_uses: Vec<ResourceUseRef>,
|
resource_uses: Vec<ResourceUseRef>,
|
||||||
|
@ -281,7 +281,7 @@ impl From<ResourceInCommand> for ResourceUseRef2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Type of resource whose state is to be tracked.
|
/// Type of resource whose state is to be tracked.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub(super) enum Resource {
|
pub(super) enum Resource {
|
||||||
Buffer {
|
Buffer {
|
||||||
buffer: Subbuffer<[u8]>,
|
buffer: Subbuffer<[u8]>,
|
||||||
|
@ -2503,14 +2503,14 @@ where
|
|||||||
let (use_ref, memory_access) = use_iter(index as u32);
|
let (use_ref, memory_access) = use_iter(index as u32);
|
||||||
|
|
||||||
let mut range = range.clone();
|
let mut range = range.clone();
|
||||||
range.start += buffer.offset() + dynamic_offset;
|
range.start += dynamic_offset;
|
||||||
range.end += buffer.offset() + dynamic_offset;
|
range.end += dynamic_offset;
|
||||||
|
|
||||||
used_resources.push((
|
used_resources.push((
|
||||||
use_ref,
|
use_ref,
|
||||||
Resource::Buffer {
|
Resource::Buffer {
|
||||||
buffer: buffer.clone(),
|
buffer: buffer.clone(),
|
||||||
range: range.clone(),
|
range,
|
||||||
memory_access,
|
memory_access,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
@ -2523,10 +2523,6 @@ where
|
|||||||
|
|
||||||
let (use_ref, memory_access) = use_iter(index as u32);
|
let (use_ref, memory_access) = use_iter(index as u32);
|
||||||
|
|
||||||
let mut range = range.clone();
|
|
||||||
range.start += buffer.offset();
|
|
||||||
range.end += buffer.offset();
|
|
||||||
|
|
||||||
used_resources.push((
|
used_resources.push((
|
||||||
use_ref,
|
use_ref,
|
||||||
Resource::Buffer {
|
Resource::Buffer {
|
||||||
@ -2545,15 +2541,11 @@ where
|
|||||||
let buffer = buffer_view.buffer();
|
let buffer = buffer_view.buffer();
|
||||||
let (use_ref, memory_access) = use_iter(index as u32);
|
let (use_ref, memory_access) = use_iter(index as u32);
|
||||||
|
|
||||||
let mut range = buffer_view.range();
|
|
||||||
range.start += buffer.offset();
|
|
||||||
range.end += buffer.offset();
|
|
||||||
|
|
||||||
used_resources.push((
|
used_resources.push((
|
||||||
use_ref,
|
use_ref,
|
||||||
Resource::Buffer {
|
Resource::Buffer {
|
||||||
buffer: buffer.clone(),
|
buffer: buffer.clone(),
|
||||||
range: range.clone(),
|
range: buffer_view.range().clone(),
|
||||||
memory_access,
|
memory_access,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
@ -601,8 +601,7 @@ vulkan_bitflags! {
|
|||||||
pub(crate) fn expand(mut self) -> Self {
|
pub(crate) fn expand(mut self) -> Self {
|
||||||
if self.intersects(AccessFlags::SHADER_READ) {
|
if self.intersects(AccessFlags::SHADER_READ) {
|
||||||
self -= AccessFlags::SHADER_READ;
|
self -= AccessFlags::SHADER_READ;
|
||||||
self |= AccessFlags::UNIFORM_READ
|
self |= AccessFlags::SHADER_SAMPLED_READ
|
||||||
| AccessFlags::SHADER_SAMPLED_READ
|
|
||||||
| AccessFlags::SHADER_STORAGE_READ
|
| AccessFlags::SHADER_STORAGE_READ
|
||||||
| AccessFlags::SHADER_BINDING_TABLE_READ;
|
| AccessFlags::SHADER_BINDING_TABLE_READ;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user