diff --git a/crates/metal2vulkan-air/src/intrinsics/mod.rs b/crates/metal2vulkan-air/src/intrinsics/mod.rs index 0ba1416e7..9b48eebb9 100644 --- a/crates/metal2vulkan-air/src/intrinsics/mod.rs +++ b/crates/metal2vulkan-air/src/intrinsics/mod.rs @@ -84,8 +84,8 @@ pub use stage::{GlobalBuiltin, GlobalVar, WorkItem}; pub use stage::{Interpolate, InterpolateAt}; pub use sync::{BarrierName, MemFlags, Sync}; #[cfg(test)] -pub use texture::{Access, Form}; -pub use texture::{Component, LodMode, Query, SamplerOp, TexOp, TexRole, Texture}; +pub use texture::Form; +pub use texture::{Access, Component, LodMode, Query, SamplerOp, TexOp, TexRole, Texture}; pub use ty::NumTy; pub use ty::{Elem, Sign}; pub use vector_data::{HalfRounding, VectorData, VectorDataOp}; diff --git a/crates/metal2vulkan/src/pipeline/compile/unbound.rs b/crates/metal2vulkan/src/pipeline/compile/unbound.rs index b76f19a5d..cefc4c1c3 100644 --- a/crates/metal2vulkan/src/pipeline/compile/unbound.rs +++ b/crates/metal2vulkan/src/pipeline/compile/unbound.rs @@ -20,11 +20,11 @@ //! (its records are only reached through an argument buffer), ray tracing, and a call the //! entry cannot see into (a visible function's, an unknown intrinsic). //! -//! Of the texture operations through such a texture, those that reach it through its storage -//! image are storage accesses: a write, an atomic, and a read of an `access::write` or -//! `access::read_write` texture (the access the operation carries). An intersection and a call -//! the entry cannot see into are storage accesses too; an indirect command buffer's operations -//! and the other ray tracing operations touch no texture. +//! Of the texture operations through such a texture, those that may reach it through its storage +//! image are storage accesses: a write, an atomic, and a read or block read the operation does +//! not declare `access::sample` or `access::read` (one that declares no access counts). An +//! intersection and a call the entry cannot see into are storage accesses too; an indirect +//! command buffer's operations and the other ray tracing operations touch no texture. use crate::air; use crate::air::intrinsics::{ @@ -132,9 +132,9 @@ pub(super) fn unbound(e: &air::Entry, memory: &MemoryPlan) -> Unbound { | TexOp::BlockRead => (true, false), }; out.add(handle && reads, handle && writes); - let storage = - matches!(t.access, Some(Access::Write | Access::ReadWrite)); - out.storage_textures |= handle && (writes || (reads && storage)); + let storage_read = matches!(t.op, TexOp::Read | TexOp::BlockRead) + && !matches!(t.access, Some(Access::Sample | Access::Read)); + out.storage_textures |= handle && (writes || storage_read); } AirIntrinsic::IndirectCommand(_) | AirIntrinsic::AccelerationStructure(_) => out.add(true, true), diff --git a/crates/metal2vulkan/src/pipeline/interface.rs b/crates/metal2vulkan/src/pipeline/interface.rs index 4bde47640..18605a912 100644 --- a/crates/metal2vulkan/src/pipeline/interface.rs +++ b/crates/metal2vulkan/src/pipeline/interface.rs @@ -442,8 +442,9 @@ pub struct StageInterface { /// The function may reach a texture through its storage image through something other than /// its bound slots, as [`reads_unbound_resources`](Self::reads_unbound_resources) states for /// reads (an argument buffer's texture, a resource ID): a texture write or atomic, or a read - /// of a texture the operation declares `access::write` or `access::read_write`. An - /// intersection and a call the entry cannot see into count too. `false` is proven. + /// the operation does not declare `access::sample` or `access::read` (`access::write`, + /// `access::read_write`, or none declared). An intersection and a call the entry cannot see + /// into count too. `false` is proven. #[cfg_attr(feature = "serde", serde(default))] pub unbound_storage_textures: bool, /// The samplers a pipeline state of the function numbers for it, of the entry its function diff --git a/docs/API.md b/docs/API.md index 32c39a033..115f48685 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1746,8 +1746,8 @@ for dependency in &pipeline.dependencies { encoder needs to place a barrier only on a hazard. - `interface.unbound_storage_textures` says, provably, whether a pipeline's functions may reach a texture through its storage image through anything but their bound slots: a texture write or - atomic, or a read of a texture the operation declares `access::write` or `access::read_write`, - through a texture they load from memory or make from an integer (an argument buffer's texture, + atomic, or a read the operation does not declare `access::sample` or `access::read`, through a + texture they load from memory or make from an integer (an argument buffer's texture, a resource ID), or an intersection or a call the function cannot see into. A runtime that gives some textures no storage image needs it to find such an access to one.