A fetch of a padded 10-bit attachment reads the tile value of its codes
Metal's fetch of R10Unorm_X6, RG10Unorm_X12, their sRGB twins and RGB10A2Unorm_sRGB (probes/padded_fetch.m, the M3 Max under macOS 27.0.1) reads each loaded code's value rounded to half, for a float4 input as for a half4 one (4088 of 4096 R10Unorm_X6 codes differ from the f32 quotient and all equal its half; RGBA8Unorm, the control, reads the f32 quotient into a float4). The missing lanes read (0, 0, 1). After a clear the tile holds the clear's half unclamped (-0.25 and 1.25 read back), and after an earlier draw the output's half rounded toward zero, unclamped: the stored codes keep neither, which the runtime already announces for a read of such a color (extended-range-blends-stored-codes). That read is extended_range::tile_value, which both the storage form and the input attachment form already use; the refusals (NotImplemented FramebufferFetch) in fetch::select_read and color::select go. tile_value's f32 product decode rounds to the quotient's half at every one of the 1024 codes (checked offline). (cherry picked from commit c355ad88cfc746342472c32c1cd7885fbc5ed02e) (cherry picked from commit 1e5600630d4b02b2590f309e44ea6d4281b56fdc) (cherry picked from commit eaf7ee8e14f2008ec904fbd97dab763e69214520)
This commit is contained in:
1 parent
12c71f372d
commit
813989fc31
3 files changed
+8
-14
No files matched your search
@@ -198,7 +198,10 @@ pub fn decode(
|
||||
/// `BGRA10_XR_sRGB`'s are clamped to 1022 and decoded ([`decode`]), `BGR10_XR_sRGB`'s and the
|
||||
/// two-plane twin's decoded and then clamped to the linear values of codes 0 and 1022,
|
||||
/// `[-384 / 510, 638 / 510]`; a padded form's every code is decoded as it is (code 1023 is one);
|
||||
/// each lane is the device's narrowing of that value to `half`. Alpha is [`decode`]'s.
|
||||
/// each lane is the device's narrowing of that value to `half`. Alpha is [`decode`]'s. A padded
|
||||
/// form's fetch reads so on Metal: each loaded code's value rounded to `half`, a `float` input's
|
||||
/// too, an sRGB twin's colour through Metal's table (every code of each padded form on the M3 Max
|
||||
/// under macOS 27.0.1, `probes/padded_fetch.m` of the conformance crate).
|
||||
pub fn tile_value(fb: &mut FunctionBuilder<'_>, form: ExtendedRange, raw: Value) -> BResult<Value> {
|
||||
let c = codes(fb, form, raw)?;
|
||||
if form.padded() {
|
||||
|
||||
@@ -224,12 +224,6 @@ pub(super) fn select_param(cx: &mut SelectCx<'_>, b: &ParamBinding) -> Result<Co
|
||||
index: color,
|
||||
}));
|
||||
}
|
||||
// What a fetch reads of a padded 10-bit attachment's tile is not measured (a blend's
|
||||
// destination is: `fetch`'s storage form, `input_blend`).
|
||||
if e.form.padded() {
|
||||
let refused = Unsupported::not_implemented(Feature::FramebufferFetch);
|
||||
return Err(refused.at_attachment(Attachment::Color(color)).into());
|
||||
}
|
||||
cx.families.arith.converts(e.form);
|
||||
cx.families
|
||||
.stage_io
|
||||
|
||||
@@ -1997,14 +1997,11 @@ pub(super) fn select_read(cx: &mut SelectCx<'_>, c: ColorInput) -> Result<(), Er
|
||||
let refused = Unsupported::not_implemented(Feature::Format);
|
||||
return Err(refused.at_attachment(Attachment::Color(c.color)).into());
|
||||
}
|
||||
// What a fetch reads of a padded 10-bit attachment's tile is not measured (its blend's
|
||||
// destination is, [`blended`]).
|
||||
if sc.view.extended.is_some_and(ExtendedRange::padded) {
|
||||
let refused = Unsupported::not_implemented(Feature::FramebufferFetch);
|
||||
return Err(refused.at_attachment(Attachment::Color(c.color)).into());
|
||||
}
|
||||
class_of(c.form, sc.view.read_class(), c.color, false)?;
|
||||
// An extended-range texel converts by the device's arithmetic.
|
||||
// An extended-range or padded 10-bit texel converts by the device's arithmetic, its read the
|
||||
// tile value of its codes ([`value`]). After a clear or an earlier draw of the pass Metal's
|
||||
// tile holds their `half`, which the codes do not keep: the runtime announces
|
||||
// `extended-range-blends-stored-codes` there.
|
||||
if let Some(e) = sc.view.extended {
|
||||
cx.families.arith.converts(e);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user