translator: the storage-texture fact names the texture access type the air crate now exports

What: metal2vulkan-air exported intrinsics::Access only under cfg(test), so the unbound analysis
of 0a810a7ab5 did not compile (E0432). The air crate now exports Access (Form stays test-only),
the type of Texture's public access field. The analysis counts a read or block read through a
loaded texture as a storage access unless the operation declares access::sample or access::read,
so a read that declares no access (an emitter before AIR 2.0) counts, as the fact's 'false is
proven' needs. The interface and API.md docs say so.

Verified: cargo fmt; signatures.py --check gives no diff. The check job compiles it.
This commit is contained in:
Anees Iqbal committed 2026-11-19 05:09:37 -08:00
1 parent 4231c5ba25
commit 71d767c904
4 files changed
+15 -14

No files matched your search

@@ -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};
@@ -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),
@@ -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
+2 -2
View File
@@ -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.