Skip to content

Commit

Permalink
Replace PipelineMemoryAccess with PipelineStageAccess (vulkano-rs…
Browse files Browse the repository at this point in the history
…#2212)

* Replace `PipelineMemoryAccess` with `PipelineStageAccess`

* Rename `is_2` to something better

* Missed rename
  • Loading branch information
Rua authored and hakolao committed Feb 20, 2024
1 parent 39278e2 commit c8683bc
Show file tree
Hide file tree
Showing 12 changed files with 782 additions and 1,401 deletions.
166 changes: 82 additions & 84 deletions vulkano/src/command_buffer/auto/builder.rs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions vulkano/src/command_buffer/auto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ use crate::{
buffer::Subbuffer,
device::{Device, DeviceOwned},
image::{ImageAccess, ImageLayout, ImageSubresourceRange},
sync::PipelineMemoryAccess,
sync::PipelineStageAccessFlags,
DeviceSize, VulkanObject,
};
use parking_lot::{Mutex, MutexGuard};
Expand Down Expand Up @@ -274,12 +274,12 @@ pub(super) enum Resource {
Buffer {
buffer: Subbuffer<[u8]>,
range: Range<DeviceSize>,
memory: PipelineMemoryAccess,
memory_access: PipelineStageAccessFlags,
},
Image {
image: Arc<dyn ImageAccess>,
subresource_range: ImageSubresourceRange,
memory: PipelineMemoryAccess,
memory_access: PipelineStageAccessFlags,
start_layout: ImageLayout,
end_layout: ImageLayout,
},
Expand Down
26 changes: 5 additions & 21 deletions vulkano/src/command_buffer/commands/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
device::{DeviceOwned, QueueFlags},
format::{ClearColorValue, ClearDepthStencilValue, Format, FormatFeatures},
image::{ImageAccess, ImageAspects, ImageLayout, ImageSubresourceRange, ImageUsage},
sync::{AccessFlags, PipelineMemoryAccess, PipelineStages},
sync::PipelineStageAccessFlags,
DeviceSize, RequirementNotMet, RequiresOneOf, SafeDeref, Version, VulkanObject,
};
use smallvec::{smallvec, SmallVec};
Expand Down Expand Up @@ -201,11 +201,7 @@ where
Resource::Image {
image: image.clone(),
subresource_range,
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Clear_TransferWrite,
start_layout: image_layout,
end_layout: image_layout,
},
Expand Down Expand Up @@ -407,11 +403,7 @@ where
Resource::Image {
image: image.clone(),
subresource_range,
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Clear_TransferWrite,
start_layout: image_layout,
end_layout: image_layout,
},
Expand Down Expand Up @@ -521,11 +513,7 @@ where
Resource::Buffer {
buffer: dst_buffer.as_bytes().clone(),
range: 0..dst_buffer.size(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Clear_TransferWrite,
},
)]
.into_iter()
Expand Down Expand Up @@ -659,11 +647,7 @@ where
Resource::Buffer {
buffer: dst_buffer.as_bytes().clone(),
range: 0..size_of_val(data.deref()) as DeviceSize,
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Clear_TransferWrite,
},
)]
.into_iter()
Expand Down
74 changes: 13 additions & 61 deletions vulkano/src/command_buffer/commands/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
ImageUsage, SampleCount, SampleCounts,
},
sampler::Filter,
sync::{AccessFlags, PipelineMemoryAccess, PipelineStages},
sync::PipelineStageAccessFlags,
DeviceSize, RequirementNotMet, RequiresOneOf, Version, VulkanObject,
};
use smallvec::{smallvec, SmallVec};
Expand Down Expand Up @@ -210,23 +210,15 @@ where
Resource::Buffer {
buffer: src_buffer.clone(),
range: src_offset..src_offset + size,
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Copy_TransferRead,
},
),
(
ResourceInCommand::Destination.into(),
Resource::Buffer {
buffer: dst_buffer.clone(),
range: dst_offset..dst_offset + size,
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Copy_TransferWrite,
},
),
]
Expand Down Expand Up @@ -974,11 +966,7 @@ where
Resource::Image {
image: src_image.clone(),
subresource_range: src_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Copy_TransferRead,
start_layout: src_image_layout,
end_layout: src_image_layout,
},
Expand All @@ -988,11 +976,7 @@ where
Resource::Image {
image: dst_image.clone(),
subresource_range: dst_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Copy_TransferWrite,
start_layout: dst_image_layout,
end_layout: dst_image_layout,
},
Expand Down Expand Up @@ -1485,23 +1469,15 @@ where
buffer: src_buffer.clone(),
range: buffer_offset
..buffer_offset + region.buffer_copy_size(dst_image.format()),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Copy_TransferRead,
},
),
(
ResourceInCommand::Destination.into(),
Resource::Image {
image: dst_image.clone(),
subresource_range: image_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Copy_TransferWrite,
start_layout: dst_image_layout,
end_layout: dst_image_layout,
},
Expand Down Expand Up @@ -1982,11 +1958,7 @@ where
Resource::Image {
image: src_image.clone(),
subresource_range: image_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Copy_TransferRead,
start_layout: src_image_layout,
end_layout: src_image_layout,
},
Expand All @@ -1997,11 +1969,7 @@ where
buffer: dst_buffer.clone(),
range: buffer_offset
..buffer_offset + region.buffer_copy_size(src_image.format()),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Copy_TransferWrite,
},
),
]
Expand Down Expand Up @@ -2578,11 +2546,7 @@ where
Resource::Image {
image: src_image.clone(),
subresource_range: src_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Blit_TransferRead,
start_layout: src_image_layout,
end_layout: src_image_layout,
},
Expand All @@ -2592,11 +2556,7 @@ where
Resource::Image {
image: dst_image.clone(),
subresource_range: dst_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Blit_TransferWrite,
start_layout: dst_image_layout,
end_layout: dst_image_layout,
},
Expand Down Expand Up @@ -2920,11 +2880,7 @@ where
Resource::Image {
image: src_image.clone(),
subresource_range: src_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_READ,
exclusive: false,
},
memory_access: PipelineStageAccessFlags::Resolve_TransferRead,
start_layout: src_image_layout,
end_layout: src_image_layout,
},
Expand All @@ -2934,11 +2890,7 @@ where
Resource::Image {
image: dst_image.clone(),
subresource_range: dst_subresource.clone().into(),
memory: PipelineMemoryAccess {
stages: PipelineStages::ALL_TRANSFER,
access: AccessFlags::TRANSFER_WRITE,
exclusive: true,
},
memory_access: PipelineStageAccessFlags::Resolve_TransferWrite,
start_layout: dst_image_layout,
end_layout: dst_image_layout,
},
Expand Down
Loading

0 comments on commit c8683bc

Please sign in to comment.