blob: e8d416b930847544138d52cc20f065a495993f9e [file] [log] [blame] [view]
# Chromium Experimental Input Attachments
The `chromium_experimental_input_attachments` extension adds support for input attachment global variables to WGSL.
This is similar to Vulkan's `subpassInput` variable.
## Status
Input attachments support in Tint is highly experimental and only meant to be used in internal transforms at this stage.
This extension is only relevant to SPIRV backend atm.
Specification work in the WebGPU group hasn't started.
## Pseudo-specification
This extension adds:
- A new `input_attachment<T>` type in the `handle` address space, where `T` is `u32`, `i32` or `f32`. It's only allowed on module-scoped variable declarations.
- This will be mapped to `OpTypeImage` with Dim=`SubpassData` in SPIRV.
- A new `input_attachment_index(n)` attribute where `n` is a `u32` or `i32` with a positive value. Unlike `binding` which specifies the binding point in a BindGroup, this attribute specifies the index of the input attachment in the render pass descriptor. This is required for `input_attachment<T>` type.
- This is equivalent to `InputAttachmentIndex` decoration in SPIRV.
- A new `inputAttachmentLoad` builtin function with signature:
`inputAttachmentLoad(input_attachment<T>) -> vec4<T>`
- This will emit `OpImageRead` function call in SPIRV.
- All of the above are only available in fragment state.
## Example usage
```
@group(0) @binding(0) @input_attachment_index(0)
var input_tex : input_attachment<f32>;
@fragment fn main() -> @location(0) vec4f {
return inputAttachmentLoad(input_tex);
}
```