Runtime docs: a view reports its base's usage, what it may be used with
Texture::descriptor's doc comment and the README's swizzle paragraph (Known gaps of textures) state that a view's descriptor reports its base texture's usage, which is what the view may be used with, so a draw into a swizzled view and a kernel's write through it run, where Metal's usage answers only ShaderRead and PixelFormatView of a base of those, ShaderWrite and RenderTarget, for a view made with a swizzle other than the identity and for every view of such a view. Measured on the M3 Max, macOS 27.0.1, job m3-max-76856 (swizzled_view_stores.m): a base of 0x17; a view made without a swizzle and one made with the identity passed answer 0x17; a (Blue, Green, Red, Alpha) view 0x11; views of that view made without a swizzle, with the identity, with (Blue, Green, Red, Alpha) and with (Green, Blue, Red, Alpha) all 0x11; a (Blue, Green, Red, Alpha) view of the plain view 0x11; the same with MTL_DEBUG_LAYER=1. The consumer answers a guest's read of a view's usage from its own descriptor, so the runtime's answer is its own contract; nothing in the runtime changes. Docs only; refusal_surface.py --check and signatures.py --check pass.
This commit is contained in:
1 parent
2456c27074
commit
2bd05d0067
2 files changed
+10
-2
No files matched your search
@@ -2121,7 +2121,12 @@ made, with no lock, and never rewritten for layouts.
|
||||
such a texture, is `Gap::SwizzledReadWrite`, found when the pipeline state or a binding
|
||||
changes: its read would answer the texel unswizzled, where Metal reads it through the swizzle. A texture's
|
||||
own descriptor takes a swizzle only without shader-write and render-target usage
|
||||
(`Refusal::TextureSwizzleWithWrites`), so this reaches views alone.
|
||||
(`Refusal::TextureSwizzleWithWrites`), so this reaches views alone. A view's descriptor reports
|
||||
its base texture's usage, which is what the view may be used with, so a draw into such a view
|
||||
and a kernel's write through it run, where Metal reports only `ShaderRead` and
|
||||
`PixelFormatView` of a base of those, `ShaderWrite` and `RenderTarget`, for a view made with a
|
||||
swizzle other than the identity and for every view of such a view (M3 Max, macOS 27.0.1,
|
||||
`metal2vulkan-conformance/probes/swizzled_view_stores.m`).
|
||||
- A kernel, a vertex function or a fragment function samples a 2D texture slot through a bicubic
|
||||
constexpr sampler, at normalized or at pixel coordinates, by the arm its slot's pushed word
|
||||
selects, which the runtime writes from the bound texture's format and swizzle
|
||||
|
||||
@@ -4724,7 +4724,10 @@ impl Texture {
|
||||
TextureObject::gpu_resource_id(self)
|
||||
}
|
||||
|
||||
/// `textureType`, `pixelFormat`, `width` and the rest, as made.
|
||||
/// `textureType`, `pixelFormat`, `width` and the rest, as made. A view's `usage` is its base
|
||||
/// texture's, which is what the view may be used with, where Metal's `usage` answers only
|
||||
/// `ShaderRead` and `PixelFormatView` of a base of those, `ShaderWrite` and `RenderTarget`,
|
||||
/// for a view made with a swizzle other than the identity and for every view of such a view.
|
||||
pub fn descriptor(&self) -> &TextureDescriptor {
|
||||
TextureObject::descriptor(self)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user