Remove BufferUses::STORAGE_WRITE_ONLY (#6691)

This commit is contained in:
Teodor Tanasoaia authored and GitHub committed 2024-12-11 02:15:11 -05:00
1 parent a1fc2ba76d
commit dc5bd9dbac
6 files changed
+10 -29

No files matched your search

+1 -1
View File
@@ -82,7 +82,7 @@ pub fn map_buffer_usage(usage: wgt::BufferUsages) -> hal::BufferUses {
usage.contains(wgt::BufferUsages::UNIFORM),
);
u.set(
hal::BufferUses::STORAGE_READ_WRITE,
hal::BufferUses::STORAGE_READ_ONLY | hal::BufferUses::STORAGE_READ_WRITE,
usage.contains(wgt::BufferUsages::STORAGE),
);
u.set(
+1 -10
View File
@@ -521,16 +521,7 @@ impl Device {
self.require_downlevel_flags(wgt::DownlevelFlags::INDIRECT_EXECUTION)?;
// We are going to be reading from it, internally;
// when validating the content of the buffer
if !usage.intersects(
hal::BufferUses::STORAGE_READ_ONLY | hal::BufferUses::STORAGE_READ_WRITE,
) {
if usage.contains(hal::BufferUses::STORAGE_WRITE_ONLY) {
usage |= hal::BufferUses::STORAGE_READ_WRITE;
usage &= !hal::BufferUses::STORAGE_WRITE_ONLY;
} else {
usage |= hal::BufferUses::STORAGE_READ_ONLY;
}
}
usage |= hal::BufferUses::STORAGE_READ_ONLY | hal::BufferUses::STORAGE_READ_WRITE;
}
if desc.mapped_at_creation {
+1 -1
View File
@@ -132,7 +132,7 @@ pub fn map_buffer_usage_to_state(usage: crate::BufferUses) -> Direct3D12::D3D12_
if usage.intersects(Bu::VERTEX | Bu::UNIFORM) {
state |= Direct3D12::D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER;
}
if usage.intersects(Bu::STORAGE_READ_WRITE | Bu::STORAGE_WRITE_ONLY) {
if usage.intersects(Bu::STORAGE_READ_WRITE) {
state |= Direct3D12::D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
} else if usage.intersects(Bu::STORAGE_READ_ONLY) {
state |= Direct3D12::D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE
+1 -3
View File
@@ -1225,9 +1225,7 @@ impl super::Queue {
flags |= glow::BUFFER_UPDATE_BARRIER_BIT;
}
if usage.intersects(
crate::BufferUses::STORAGE_READ_ONLY
| crate::BufferUses::STORAGE_WRITE_ONLY
| crate::BufferUses::STORAGE_READ_WRITE,
crate::BufferUses::STORAGE_READ_ONLY | crate::BufferUses::STORAGE_READ_WRITE,
) {
flags |= glow::SHADER_STORAGE_BARRIER_BIT;
}
-2
View File
@@ -1675,8 +1675,6 @@ bitflags::bitflags! {
const UNIFORM = 1 << 6;
/// A read-only storage buffer used in a bind group.
const STORAGE_READ_ONLY = 1 << 7;
/// A write-only storage buffer used in a bind group.
const STORAGE_WRITE_ONLY = 1 << 8;
/// A read-write buffer used in a bind group.
const STORAGE_READ_WRITE = 1 << 8;
/// The indirect or count buffer in a indirect draw or dispatch.
+6 -12
View File
@@ -517,11 +517,9 @@ pub fn map_buffer_usage(usage: crate::BufferUses) -> vk::BufferUsageFlags {
if usage.contains(crate::BufferUses::UNIFORM) {
flags |= vk::BufferUsageFlags::UNIFORM_BUFFER;
}
if usage.intersects(
crate::BufferUses::STORAGE_READ_ONLY
| crate::BufferUses::STORAGE_WRITE_ONLY
| crate::BufferUses::STORAGE_READ_WRITE,
) {
if usage
.intersects(crate::BufferUses::STORAGE_READ_ONLY | crate::BufferUses::STORAGE_READ_WRITE)
{
flags |= vk::BufferUsageFlags::STORAGE_BUFFER;
}
if usage.contains(crate::BufferUses::INDEX) {
@@ -575,17 +573,13 @@ pub fn map_buffer_usage_to_barrier(
stages |= shader_stages;
access |= vk::AccessFlags::UNIFORM_READ;
}
if usage
.intersects(crate::BufferUses::STORAGE_READ_ONLY | crate::BufferUses::STORAGE_READ_WRITE)
{
if usage.intersects(crate::BufferUses::STORAGE_READ_ONLY) {
stages |= shader_stages;
access |= vk::AccessFlags::SHADER_READ;
}
if usage
.intersects(crate::BufferUses::STORAGE_WRITE_ONLY | crate::BufferUses::STORAGE_READ_WRITE)
{
if usage.intersects(crate::BufferUses::STORAGE_READ_WRITE) {
stages |= shader_stages;
access |= vk::AccessFlags::SHADER_WRITE;
access |= vk::AccessFlags::SHADER_READ | vk::AccessFlags::SHADER_WRITE;
}
if usage.contains(crate::BufferUses::INDEX) {
stages |= vk::PipelineStageFlags::VERTEX_INPUT;