@vitreajs/vitrea 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -226,6 +226,15 @@ function occlusionLiftForPolicy(policy, profile = DEFAULT_MATERIAL_PROFILE) {
|
|
|
226
226
|
const levels = profile.increasedOcclusionLiftByPolicy;
|
|
227
227
|
return policy.ambientTint === "reduced" ? levels?.increaseContrast ?? profile.increasedOcclusionLift : levels?.reduceTransparency ?? profile.increasedOcclusionLift;
|
|
228
228
|
}
|
|
229
|
+
function bodyChromaRetentionUnderPolicy(retention, policy) {
|
|
230
|
+
switch (policy.occlusion) {
|
|
231
|
+
case "nominal":
|
|
232
|
+
return retention;
|
|
233
|
+
case "increased":
|
|
234
|
+
case "opaque":
|
|
235
|
+
return 0;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
229
238
|
var DEFAULT_MATERIAL_PROFILE = {
|
|
230
239
|
optics: {
|
|
231
240
|
// σ = 8 for the regular variant, which keeps this package's blur and
|
|
@@ -918,6 +927,17 @@ var DEFAULT_MATERIAL_PROFILE = {
|
|
|
918
927
|
*/
|
|
919
928
|
collapseTransmission: 0.017,
|
|
920
929
|
collapseTransmission2x: 0.07,
|
|
930
|
+
/*
|
|
931
|
+
* **SHIPS AT 0** (W31 G3; claims §5.164). The identity, and a post-seal leaf's
|
|
932
|
+
* default IS its identity, forever: `MATERIAL_IDENTITY_TABLE` is append-only
|
|
933
|
+
* and the fingerprint drops this leaf while it holds this value, so a default
|
|
934
|
+
* that moved off 0 would move every shipped document's digest at once.
|
|
935
|
+
*
|
|
936
|
+
* The macOS 27 documents carry their fitted values as patches; the two frozen
|
|
937
|
+
* macOS 26.5 documents carry none, which is what makes their recorded digests
|
|
938
|
+
* reproduce under the rule (claims §5.161 §7b).
|
|
939
|
+
*/
|
|
940
|
+
bodyChromaRetention: 0,
|
|
921
941
|
/*
|
|
922
942
|
* FITTED 0.038 (W23 G1; claims §5.100 §3, W23 Decision Log 2 (b)) — and it is
|
|
923
943
|
* NOT the dark material's rim, which is the one thing the charter thought it
|
|
@@ -1120,6 +1140,90 @@ var DEFAULT_MATERIAL_PROFILE = {
|
|
|
1120
1140
|
glowGain: 0.6,
|
|
1121
1141
|
sweepGain: 0.85
|
|
1122
1142
|
};
|
|
1143
|
+
var MATERIAL_DIGEST_RULE_VERSION = 2;
|
|
1144
|
+
var MATERIAL_IDENTITY_TABLE = [
|
|
1145
|
+
{
|
|
1146
|
+
wave: "W30",
|
|
1147
|
+
/*
|
|
1148
|
+
* A TWO-LEAF gate, and the second leaf is in it rather than gated by it.
|
|
1149
|
+
* `sigmaThinOffsetPx` is not gated by the slope — at slope 0 a non-zero
|
|
1150
|
+
* offset moves σ at every span — and it is not inert on its own at a
|
|
1151
|
+
* non-zero slope either, where it is a real floor on the line. What the
|
|
1152
|
+
* committed case proves is the pair TOGETHER, and the grouping that would
|
|
1153
|
+
* put the offset under the slope's gate merges a macOS 26.5 light material
|
|
1154
|
+
* carrying `sigmaThinOffsetPx` 5 — five CSS px of extra blur on every outer
|
|
1155
|
+
* shadow, on both tiers — into the frozen digest itself (claims §5.161 §11,
|
|
1156
|
+
* finding B4 (b)).
|
|
1157
|
+
*/
|
|
1158
|
+
gate: { "outerShadow.sigmaSlopePerSpan": 0, "outerShadow.sigmaThinOffsetPx": 0 },
|
|
1159
|
+
gated: ["outerShadow.sigmaSpanRefPx"],
|
|
1160
|
+
law: "\u03C3(span) = sigmaPx + max(sigmaThinOffsetPx, sigmaSlopePerSpan\xB7(span \u2212 sigmaSpanRefPx))",
|
|
1161
|
+
inertLawCase: 'packages/renderer-webgpu/test/w31-gate-groups.test.ts \u2014 "gate-group 1 \u2014 {sigmaSlopePerSpan 0, sigmaThinOffsetPx 0} gates sigmaSpanRefPx"; with the shipped-value half in w30-inert-laws.test.ts',
|
|
1162
|
+
whyGated: "The pivot is multiplied by the slope, so at slope 0 no value of it can reach \u03C3. The offset is NOT gated by the slope and is in the gate for that reason.",
|
|
1163
|
+
claims: "c9a \xA75.156 \xA72, \xA75.158, \xA75.161 \xA77b"
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
wave: "W30",
|
|
1167
|
+
gate: { sizeHeavySecondShare: 0 },
|
|
1168
|
+
gated: ["sizeHeavySecondSigma", "sizeHeavySecondSigma2x"],
|
|
1169
|
+
law: "deep = heavy + sizeHeavySecondShare\xB7(heavy2 \u2212 heavy), heavy2 at sizeHeavySecondSigma{,2x}",
|
|
1170
|
+
inertLawCase: 'packages/renderer-webgpu/test/w31-gate-groups.test.ts \u2014 "gate-group 2 \u2014 {sizeHeavySecondShare 0} gates the two second-heavy widths"; with the shipped-value half in w30-inert-laws.test.ts',
|
|
1171
|
+
whyGated: "At share 0 the second heavy texture is not allocated, no pass is encoded and the optics pass never samples one, so the widths are unread whatever they hold.",
|
|
1172
|
+
claims: "c9a \xA75.156 \xA73, \xA75.158, \xA75.161 \xA77b"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
wave: "W30",
|
|
1176
|
+
gate: { sizeScatterScaleGain: 0 },
|
|
1177
|
+
gated: ["sizeScatterScaleRef"],
|
|
1178
|
+
law: "kScatter += sizeScatterScaleGain\xB7(stat \u2212 sizeScatterScaleRef)",
|
|
1179
|
+
inertLawCase: 'packages/renderer-webgpu/test/w31-gate-groups.test.ts \u2014 "gate-group 3 \u2014 {sizeScatterScaleGain 0} gates sizeScatterScaleRef"; with the shipped-value half in w30-inert-laws.test.ts',
|
|
1180
|
+
whyGated: "The reference is only ever read as a difference the gain multiplies, so at gain 0 no value of it can reach the mix. The macOS 27 LIGHT document exercises this entry: it declines the scatter with the gain at 0 and ships the reference at 0.03.",
|
|
1181
|
+
claims: "c9a \xA75.156 \xA73, \xA75.158, \xA75.161 \xA77b"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
wave: "W31",
|
|
1185
|
+
/*
|
|
1186
|
+
* A plain value drop, and injective for free. The retention multiplies the
|
|
1187
|
+
* mix's second term, so at 0 the composite is bit-identical to the one W30
|
|
1188
|
+
* left — which is what the goldens and the composite-identity case below
|
|
1189
|
+
* assert, and what lets this leaf land without an exemption.
|
|
1190
|
+
*/
|
|
1191
|
+
gate: { bodyChromaRetention: 0 },
|
|
1192
|
+
gated: [],
|
|
1193
|
+
law: "colour = gamutAtLuma(mix(colour, backdrop\xB7(Y/Y_backdrop), bodyChromaRetention), Y)",
|
|
1194
|
+
inertLawCase: `packages/renderer-webgpu/test/w31-body-chroma.test.ts \u2014 "the composite is bit-identical at retention 0", "linear luma is held at every retention" and "is the shader's expression, term for term"; the drawn half in packages/renderer-webgpu/e2e/gpu/w31-body-chroma.spec.ts \u2014 "is bit-identical at the shipped identity, named explicitly" and "ON draws differently from OFF"; the CSS tier's half in packages/platform-web/test/w30-css-declaration-identity.test.ts, which compares every declaration against bytes recorded before any leaf existed`,
|
|
1195
|
+
whyGated: "Not gated \u2014 a plain value drop. At retention 0 the mix's second term is multiplied by zero and `colour` leaves the composite exactly as mix(backdrop, adapted, presentAlpha) produced it.",
|
|
1196
|
+
claims: "c9a \xA75.161 \xA75, \xA75.164",
|
|
1197
|
+
declaredFirstAs: {
|
|
1198
|
+
law: "colour = renormaliseToLinearLuma(mix(colour, chromaticityOf(backdrop) at colour's luma, bodyChromaRetention))",
|
|
1199
|
+
inertLawCase: "TO BE COMMITTED BY W31 G3 \u2014 the leaf does not exist yet. G0 names the shape and its identity (W31 X2); the case that proves the composite is bit-identical at 0, and the `test:gpu` case that the on state draws differently from off, land with the leaf."
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
];
|
|
1203
|
+
function materialLeafAt(resolved, path) {
|
|
1204
|
+
return path.split(".").reduce((node, key) => node !== null && typeof node === "object" ? node[key] : void 0, resolved);
|
|
1205
|
+
}
|
|
1206
|
+
function materialDigestDroppedLeaves(resolved) {
|
|
1207
|
+
const dropped = [];
|
|
1208
|
+
for (const entry of MATERIAL_IDENTITY_TABLE) {
|
|
1209
|
+
const held = Object.entries(entry.gate).every(([path, identity]) => {
|
|
1210
|
+
const value = materialLeafAt(resolved, path);
|
|
1211
|
+
return value !== void 0 && value === identity;
|
|
1212
|
+
});
|
|
1213
|
+
if (held)
|
|
1214
|
+
dropped.push(...Object.keys(entry.gate), ...entry.gated);
|
|
1215
|
+
}
|
|
1216
|
+
return dropped.sort();
|
|
1217
|
+
}
|
|
1218
|
+
function materialDigestInput(resolved) {
|
|
1219
|
+
const dropped = materialDigestDroppedLeaves(resolved);
|
|
1220
|
+
const strip = (value, prefix = "") => {
|
|
1221
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
1222
|
+
return value;
|
|
1223
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [prefix === "" ? key : `${prefix}.${key}`, key, child]).filter(([path]) => !dropped.includes(path)).map(([path, key, child]) => [key, strip(child, path)]));
|
|
1224
|
+
};
|
|
1225
|
+
return strip(resolved);
|
|
1226
|
+
}
|
|
1123
1227
|
var REFRACTION_SCALE = DEFAULT_MATERIAL_PROFILE.refractionScale;
|
|
1124
1228
|
var MATERIAL_OPTICS = DEFAULT_MATERIAL_PROFILE.optics;
|
|
1125
1229
|
var ADAPTIVE_TINT_DARK = DEFAULT_MATERIAL_PROFILE.adaptiveTintDark;
|
|
@@ -1284,6 +1388,7 @@ function withMaterialOverrides(base, patch) {
|
|
|
1284
1388
|
backdropToneSizeBias: patch.backdropToneSizeBias ?? base.backdropToneSizeBias,
|
|
1285
1389
|
collapseTransmission: patch.collapseTransmission ?? base.collapseTransmission,
|
|
1286
1390
|
collapseTransmission2x: patch.collapseTransmission2x ?? patch.collapseTransmission ?? base.collapseTransmission2x,
|
|
1391
|
+
bodyChromaRetention: patch.bodyChromaRetention ?? base.bodyChromaRetention,
|
|
1287
1392
|
rimCollapsed: patch.rimCollapsed ?? base.rimCollapsed,
|
|
1288
1393
|
rimCollapsedTinted: patch.rimCollapsedTinted ?? base.rimCollapsedTinted,
|
|
1289
1394
|
rimTintChroma: patch.rimTintChroma ?? base.rimTintChroma,
|
|
@@ -3522,9 +3627,26 @@ const TAU = 6.283185307179586;
|
|
|
3522
3627
|
|
|
3523
3628
|
/// Shortest angular distance, so the band wraps continuously past the seam
|
|
3524
3629
|
/// instead of stalling there for one revolution.
|
|
3630
|
+
///
|
|
3631
|
+
/// THE RESULT IS FLOORED AT ZERO, AND THE FLOOR IS THE IDENTITY (W31 G2; claims
|
|
3632
|
+
/// 5.163). A distance is non-negative, and this expression is only non-negative
|
|
3633
|
+
/// while 'raw' stays inside one revolution: past 'TAU' the second branch goes
|
|
3634
|
+
/// negative and 'min' takes it. The single caller squares the quotient through
|
|
3635
|
+
/// 'pow(x, 2.0)', whose base WGSL leaves UNDEFINED below zero \u2014 the same shape
|
|
3636
|
+
/// of defect as 5.159b's 'tanh', one function along. Both arguments are angles
|
|
3637
|
+
/// only while the sweep phase is inside [0, 1], and the phase is read off a CSS
|
|
3638
|
+
/// custom property that nothing clamps (platform-web's 'readHostChannels'
|
|
3639
|
+
/// clamps 'materialization' and not 'sweep'), so '--vitrea-sweep: 3' puts the
|
|
3640
|
+
/// centre at 3 TAU and this function at -12.6 radians. 'max(., 0)' returns the
|
|
3641
|
+
/// same bits at every input the unfloored form was defined at, so no pixel any
|
|
3642
|
+
/// material or any bed reaches moves; what it removes is the undefined one.
|
|
3643
|
+
/// Where the phase IS out of range the band is now centred on the pixel rather
|
|
3644
|
+
/// than NaN, which is a defensible reading of nothing in particular \u2014 wrapping
|
|
3645
|
+
/// the phase where it is read is the fix that would make it mean something, and
|
|
3646
|
+
/// it is outside this gate's contract.
|
|
3525
3647
|
fn angle_delta(a : f32, b : f32) -> f32 {
|
|
3526
3648
|
let raw = abs(a - b);
|
|
3527
|
-
return min(raw, TAU - raw);
|
|
3649
|
+
return max(min(raw, TAU - raw), 0.0);
|
|
3528
3650
|
}
|
|
3529
3651
|
|
|
3530
3652
|
@fragment
|
|
@@ -3799,6 +3921,14 @@ var WGSL_OPTICS_PASS = `struct OpticsUniforms {
|
|
|
3799
3921
|
/// switch living in another facet's spare lane is a layout nobody could read
|
|
3800
3922
|
/// back. (z) and (w) free.
|
|
3801
3923
|
scatterHeavy2 : vec4f,
|
|
3924
|
+
/// W31's body chroma retention (claims 5.161 section 5, 5.164): how much of
|
|
3925
|
+
/// the blurred backdrop's CHROMATICITY the body restores, at the luma the
|
|
3926
|
+
/// tone solve produced (x). A vec4 of its own on W30's rule \u2014 132 is the next
|
|
3927
|
+
/// vec4 boundary and an operator packed into the block above would read two
|
|
3928
|
+
/// of its neighbour's lanes. (y), (z) and (w) free. At the shipped 0 the mix
|
|
3929
|
+
/// below is multiplied by zero and the composite is bit-identical to the one
|
|
3930
|
+
/// W30 left, which is why the 34 goldens do not move.
|
|
3931
|
+
bodyChroma : vec4f,
|
|
3802
3932
|
};
|
|
3803
3933
|
|
|
3804
3934
|
@group(0) @binding(0) var<uniform> ou : OpticsUniforms;
|
|
@@ -4172,6 +4302,54 @@ fn dom_material_output(encodedComposite : vec3f, encodedBackdrop : vec3f, alpha
|
|
|
4172
4302
|
return vec4f(clamp(c - b * (1.0 - a), vec3f(0.0), vec3f(a)), a);
|
|
4173
4303
|
}
|
|
4174
4304
|
|
|
4305
|
+
/// W31 \u2014 the body's chroma retention, at a held linear luma (claims 5.161
|
|
4306
|
+
/// section 5, fitted in 5.164).
|
|
4307
|
+
///
|
|
4308
|
+
/// The body is a neutral plate over the blurred backdrop, so what a
|
|
4309
|
+
/// photograph's hues survive the composite at is '1 - sizedAlpha'. This
|
|
4310
|
+
/// restores the colour's CHROMATICITY toward the blurred backdrop's, carried to
|
|
4311
|
+
/// the colour's OWN linear luma, by the material's retention.
|
|
4312
|
+
///
|
|
4313
|
+
/// **Luma is held by construction rather than by correction.** Both endpoints
|
|
4314
|
+
/// of the mix have linear luma exactly 'Y' \u2014 'colour' by definition and
|
|
4315
|
+
/// 'target' because it is the backdrop scaled to 'Y' \u2014 and linear luma is a
|
|
4316
|
+
/// linear functional, so the mix has luma 'Y' in exact arithmetic. The
|
|
4317
|
+
/// renormalisation afterwards is an f32 rounding guard and nothing else.
|
|
4318
|
+
///
|
|
4319
|
+
/// Gamut by scaling chroma toward the neutral AT that luma, never by clipping
|
|
4320
|
+
/// per channel: a per-channel clamp moves the level, which is the one thing
|
|
4321
|
+
/// this operator may not do.
|
|
4322
|
+
///
|
|
4323
|
+
/// The retention is the identity outside 'Y' in (1e-6, 1], which is a
|
|
4324
|
+
/// finiteness guard rather than a restriction: 'backdrop' and 'adapted' are both
|
|
4325
|
+
/// in [0, 1] and 'presentAlpha' is in [0, 1], so their mix is too. Writing it as
|
|
4326
|
+
/// a branch on the retention as well makes the identity at 0 EXACT \u2014 no
|
|
4327
|
+
/// division, no rounding, the composite left as it arrived.
|
|
4328
|
+
fn gamut_at_luma(c : vec3f, Y : f32) -> vec3f {
|
|
4329
|
+
var t = 1.0;
|
|
4330
|
+
for (var i = 0u; i < 3u; i = i + 1u) {
|
|
4331
|
+
let d = c[i] - Y;
|
|
4332
|
+
if (d > 1e-7) { t = min(t, (1.0 - Y) / d); }
|
|
4333
|
+
else if (d < -1e-7) { t = min(t, -Y / d); }
|
|
4334
|
+
}
|
|
4335
|
+
return mix(vec3f(Y), c, clamp(t, 0.0, 1.0));
|
|
4336
|
+
}
|
|
4337
|
+
|
|
4338
|
+
fn body_chroma_retention(colour : vec3f, backdrop : vec3f, retention : f32) -> vec3f {
|
|
4339
|
+
if (retention <= 0.0) { return colour; }
|
|
4340
|
+
let W = vec3f(0.2126, 0.7152, 0.0722);
|
|
4341
|
+
let Y = dot(colour, W);
|
|
4342
|
+
if (!(Y > 1e-6 && Y <= 1.0)) { return colour; }
|
|
4343
|
+
let Yb = dot(backdrop, W);
|
|
4344
|
+
if (Yb <= 1e-6) { return colour; }
|
|
4345
|
+
// 'toward' and not 'target': WGSL reserves the latter.
|
|
4346
|
+
let toward = backdrop * (Y / Yb);
|
|
4347
|
+
var restored = mix(colour, toward, clamp(retention, 0.0, 1.0));
|
|
4348
|
+
let Yr = dot(restored, W);
|
|
4349
|
+
if (Yr > 1e-6) { restored = restored * (Y / Yr); }
|
|
4350
|
+
return gamut_at_luma(restored, Y);
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4175
4353
|
@fragment
|
|
4176
4354
|
fn fs_optics(in : FullscreenOut) -> @location(0) vec4f {
|
|
4177
4355
|
// Nominally the field is one texel per device pixel, so the read is an exact
|
|
@@ -4753,6 +4931,56 @@ fn fs_optics(in : FullscreenOut) -> @location(0) vec4f {
|
|
|
4753
4931
|
*/
|
|
4754
4932
|
let presentAlpha = adaptedAlpha * mat;
|
|
4755
4933
|
var colour = mix(backdrop, adapted, presentAlpha);
|
|
4934
|
+
/*
|
|
4935
|
+
* W31's chroma retention, HERE and not later (claims 5.161 section 5).
|
|
4936
|
+
*
|
|
4937
|
+
* Immediately after the composite, because the composite is where the
|
|
4938
|
+
* chroma is lost \u2014 the plate is neutral and the backdrop's chromaticity
|
|
4939
|
+
* survives it scaled by '1 - presentAlpha'. Before the tint composition
|
|
4940
|
+
* below, so an author's tint still displaces the result per the composition
|
|
4941
|
+
* contract; the tint's shade law reads the untinted material's LUMINANCE,
|
|
4942
|
+
* which this preserves exactly, so 'shade', 'layer' and 'rimTintColour' are
|
|
4943
|
+
* bit-identical whatever the retention holds.
|
|
4944
|
+
*
|
|
4945
|
+
* Before the DOM branch as well, so the secant that solves an unsampled DOM
|
|
4946
|
+
* group's layer alpha solves it from the material the page will actually
|
|
4947
|
+
* show. That branch is NOT luma-transparent \u2014 'dom_material_alpha' clamps per
|
|
4948
|
+
* channel inside a luma computation \u2014 so an unsampled DOM GROUP'S layer alpha
|
|
4949
|
+
* may move with the retention where a sampled composite does not (claims
|
|
4950
|
+
* 5.161 section 11, the second reading carried forward).
|
|
4951
|
+
*
|
|
4952
|
+
* That sentence said "the 'dom' tier", which is a different thing and is the
|
|
4953
|
+
* thing a reader will think of first (W31 G3c review closure; claims 5.164
|
|
4954
|
+
* section 13, finding N7). The 'dom' tier is the CSS tier, the one the
|
|
4955
|
+
* calibration matrix keys under that name, and it does not run this shader at
|
|
4956
|
+
* all; what is meant here is THIS shader's unsampled-material path, where a
|
|
4957
|
+
* group with no sampled backdrop writes a layer for the browser to composite.
|
|
4958
|
+
*
|
|
4959
|
+
* And on that path what the operator restores TOWARD is not the page's
|
|
4960
|
+
* backdrop, because nothing sampled it. 'dom_material_backdrop()' fabricates
|
|
4961
|
+
* one, and it has two modes. Mode 1, which a group with no declared
|
|
4962
|
+
* 'backdropTone' takes, returns 'vec3f(ou.heavyTap.z)' \u2014 a neutral at the
|
|
4963
|
+
* declared reference luminance \u2014 so the mix target is
|
|
4964
|
+
* 'backdrop * (Y / Yb)' = 'vec3f(Y)', the neutral at the colour's own luma.
|
|
4965
|
+
* That reads as a desaturation and is the IDENTITY in effect: on that path
|
|
4966
|
+
* 'adapted' is 'solvedNeutral' and the fabricated backdrop is a grey, so the
|
|
4967
|
+
* composite has no chromaticity for the target to differ from. Measured at
|
|
4968
|
+
* three retentions up to 1: zero bytes moved
|
|
4969
|
+
* ('e2e/gpu/w31-unsampled-dom-chroma.spec.ts').
|
|
4970
|
+
*
|
|
4971
|
+
* Mode 2 hands the DECLARED tone colour, which can be chromatic, and there
|
|
4972
|
+
* the operator runs \u2014 the body takes the hue the page STATED is behind it
|
|
4973
|
+
* rather than the hue that is. That is the residual, recorded in claims 5.164
|
|
4974
|
+
* section 10, and it is a statement about the target rather than about the
|
|
4975
|
+
* amount: the same spec reads the interior's chroma from 0.066 to 0.334 and
|
|
4976
|
+
* finds the gamut clamp binding at the shipped retention already.
|
|
4977
|
+
*
|
|
4978
|
+
* On the unsampled LAYER path ('flags.x <= 0.5' and not 'domMaterial')
|
|
4979
|
+
* 'colour' is overwritten with 'adapted' a few lines below: there is no
|
|
4980
|
+
* backdrop in hand and no chromaticity to restore toward, and the retention is
|
|
4981
|
+
* silently the identity. That is a declared residual, not an oversight.
|
|
4982
|
+
*/
|
|
4983
|
+
colour = body_chroma_retention(colour, backdrop, ou.bodyChroma.x);
|
|
4756
4984
|
/*
|
|
4757
4985
|
* How much of this pixel the SURFACE owns, as the canvas will composite it.
|
|
4758
4986
|
*
|
|
@@ -5126,7 +5354,13 @@ var WGSL_PRELUDE = `// vitrea:wgsl-marker
|
|
|
5126
5354
|
|
|
5127
5355
|
fn srgb_to_linear(c : vec3f) -> vec3f {
|
|
5128
5356
|
let lo = c / 12.92;
|
|
5129
|
-
|
|
5357
|
+
// The floor is the identity at every component the select below KEEPS: it
|
|
5358
|
+
// keeps hi only where c > 0.04045, and there the base is already above 0.0905.
|
|
5359
|
+
// Below zero the base is a pow WGSL leaves undefined, and a clamp in the
|
|
5360
|
+
// source is preferred to a proof of the select's discard (W31 G2 review
|
|
5361
|
+
// closure, claims \xA75.163 \xA78, finding N8). Same shape as linear_to_srgb's own
|
|
5362
|
+
// max, one line down.
|
|
5363
|
+
let hi = pow(max((c + vec3f(0.055)) / 1.055, vec3f(0.0)), vec3f(2.4));
|
|
5130
5364
|
return select(hi, lo, c <= vec3f(0.04045));
|
|
5131
5365
|
}
|
|
5132
5366
|
|
|
@@ -5507,7 +5741,7 @@ function createPassRunner(context) {
|
|
|
5507
5741
|
};
|
|
5508
5742
|
},
|
|
5509
5743
|
opticsPass(encoder, args) {
|
|
5510
|
-
const slot = uniformSlot(`optics:${args.resourceId}`,
|
|
5744
|
+
const slot = uniformSlot(`optics:${args.resourceId}`, 136);
|
|
5511
5745
|
const d = slot.data;
|
|
5512
5746
|
d[0] = args.viewportDevice[0];
|
|
5513
5747
|
d[1] = args.viewportDevice[1];
|
|
@@ -5638,6 +5872,10 @@ function createPassRunner(context) {
|
|
|
5638
5872
|
d[129] = args.heavySecondEnabled ? 1 : 0;
|
|
5639
5873
|
d[130] = 0;
|
|
5640
5874
|
d[131] = 0;
|
|
5875
|
+
d[132] = args.bodyChromaRetention;
|
|
5876
|
+
d[133] = 0;
|
|
5877
|
+
d[134] = 0;
|
|
5878
|
+
d[135] = 0;
|
|
5641
5879
|
slot.write();
|
|
5642
5880
|
const chain = args.backdrop?.chain ?? placeholderView;
|
|
5643
5881
|
const body = args.backdrop?.body ?? placeholderView;
|
|
@@ -7186,6 +7424,18 @@ function createWebGPURenderer(options = {}) {
|
|
|
7186
7424
|
backdropScaleStatistic: adapt?.observed === true ? adapt.edgeDensity : material.sizeScatterScaleRef,
|
|
7187
7425
|
sizeHeavySecondShare: material.sizeHeavySecondShare,
|
|
7188
7426
|
heavySecondEnabled: pyramid?.heavy2 !== void 0,
|
|
7427
|
+
// W31's body chroma retention (claims §5.164): a material constant, per
|
|
7428
|
+
// group, with no source-side half — the chromaticity it restores toward
|
|
7429
|
+
// is the blurred backdrop the optics pass already sampled per pixel.
|
|
7430
|
+
//
|
|
7431
|
+
// Under the accessibility fold it stands down (W31 Decision Log 3 (d);
|
|
7432
|
+
// claims §5.164 §8 (b) and §13): an occlusion lift covers more of the
|
|
7433
|
+
// backdrop, so restoring the nominal fraction of its chromaticity gives
|
|
7434
|
+
// back what the preference asked to have covered — measured at `R` 3.05
|
|
7435
|
+
// and 3.17 against a reference of 1. `bodyChromaRetentionUnderPolicy` is
|
|
7436
|
+
// exactly `material.bodyChromaRetention` where no preference is set,
|
|
7437
|
+
// which is why every standard row is bit-identical across this fold.
|
|
7438
|
+
bodyChromaRetention: bodyChromaRetentionUnderPolicy(material.bodyChromaRetention, policy),
|
|
7189
7439
|
...pyramid === void 0 && input.unsampledMaterial !== void 0 ? { domMaterial: {
|
|
7190
7440
|
...input.unsampledMaterial,
|
|
7191
7441
|
mode: input.backdropTone === void 0 ? 1 : 2
|
|
@@ -7621,6 +7871,6 @@ function createWebGPURenderer(options = {}) {
|
|
|
7621
7871
|
};
|
|
7622
7872
|
}
|
|
7623
7873
|
|
|
7624
|
-
export { ADAPTIVE_LUMINANCE_HIGH, ADAPTIVE_LUMINANCE_LOW, ADAPTIVE_TINT_DARK, ADAPTIVE_TINT_LIGHT, ANALYSIS_DISPATCH, ANALYSIS_GRID, ANALYSIS_PASS_ID, ANALYSIS_STATS_FLOATS, ANALYSIS_TARGET_EXTENT, ANALYSIS_WORKGROUP, BACKDROP_ALPHA_MODES, BACKDROP_COLOR_SPACES, BACKDROP_KINDS, BACKDROP_PASS_ID, BACKDROP_TONE_HIGH, BACKDROP_TONE_LOW, BACKDROP_TONE_MAX, BACKDROP_TONE_SIZE_BIAS, CANVAS_FORMAT, CHAIN_SIGMA_AT_LEVEL_1, CROSS_CHECK_SHAPE_FLOATS, CROSS_CHECK_WORKGROUP, DEFAULT_MATERIAL_PROFILE, FAMILY_C_CROSS_CHECK, FIELD_PASS_ID, GOVERNOR_LADDER, HIGHLIGHT_PASS_ID, IDENTITY_FIT, IDLE_CHANNELS, INCREASED_OCCLUSION_LIFT, INSTANCE_BYTES, INSTANCE_FLOATS, LENS_AMOUNT_MAX, LENS_AMOUNT_PER_SPAN, LENS_EXTENT_GAIN, LENS_HEIGHT_MAX, LENS_HEIGHT_PER_SPAN, LENS_OVALIZATION, LENS_PROFILE_EXPONENT, LENS_REFRACTION_GAIN, LENS_SIZE_GAIN_MAX, LENS_THICKNESS_REFERENCE, LUMINANCE_WEIGHTS, MATERIAL_OPTICS, MATERIAL_VARIANTS, MAX_CHAIN_LEVELS, MIN_LEVEL_EXTENT, NOMINAL_GOVERNOR, NOMINAL_MATERIAL_POLICY, OPTICS_PASS_ID, OUTER_SHADOW, OUTER_SHADOW_THICK_SPANS, OUTER_SHADOW_THIN_L, OUTER_SHADOW_UNMEASURED_BACKDROP_LUMINANCE, OUTPUT_TEXTURE_FORMAT, PASS_LABEL, REFRACTION_LADDER, REFRACTION_SCALE, RENDERER_ERROR_CODES, RENDERER_PASS_IDS, RendererError, SIZE_OCCLUSION_GAIN, SIZE_SCATTER_FLOOR, SIZE_SCATTER_FLOOR_2X, SIZE_SCATTER_GAIN_FAR_2X, SIZE_SCATTER_GAIN_MAX, SIZE_SCATTER_GAIN_MAX_2X, SIZE_SCATTER_RAMP_REACH_1X_PX, SIZE_SCATTER_RAMP_REACH_2X_PX, SIZE_SCATTER_RAMP_START_FAR_1X, SIZE_SCATTER_RAMP_START_FAR_2X, SIZE_SCATTER_RAMP_START_THICK_1X, SIZE_SCATTER_RAMP_START_THICK_2X, SIZE_SCATTER_RAMP_START_THIN_1X, SIZE_SCATTER_RAMP_START_THIN_2X, SIZE_SCATTER_SPAN_MAX, SIZE_SCATTER_SPAN_MAX_2X, SIZE_SHADOW_GAIN_MAX, SIZE_SPAN_MAX, SIZE_SPAN_MIN, SRGB_ENCODING_EXPONENT, SUPPORTED_APP_TEXTURE_FORMATS, WGSL_ANALYSIS_PASS, WGSL_CROSS_CHECK_PASS, WGSL_DOWNSAMPLE_PASS, WGSL_FIELD_KERNELS, WGSL_FIELD_PASS, WGSL_FIELD_SAMPLE, WGSL_HIGHLIGHT_PASS, WGSL_IMPORT_PASS, WGSL_INSTANCE_STRUCT, WGSL_OPTICS_PASS, WGSL_PRELUDE, WGSL_RSUPN_GRAD, WGSL_RSUP_GRAD, WGSL_SMOOTH_UNION, WORKING_TEXTURE_FORMAT, ZERO_STATS, accessibilityRefractionCap, adaptationStrength, adaptedTintAlpha, adaptedTintColour, adaptiveTint, allShaderSource, alphaNormalisationMode, analysisModule, backdropFit, backdropToneAdaptation, backdropToneResponse, backdropToneSizeBiasUnderPolicy, backdropToneSolveWeight, backdropToneUnderPolicy, bodyBlurPlan, chainModule, clipFieldRectToCanvas, collapsedRimUnderPolicy, coverFit, createAdaptationState, createAppTextureProvider, createCopyProvider, createDeviceHost, createGovernor, createGpuContext, createGradientProvider, createPassRunner, createPipelineCache, createPyramidStore, createRebuildLedger, createStorageSlot, createTexturePool, createTimingCollector, createUniformSlot, createVideoProvider, createWebGPURenderer, crossCheckKernelModule, displayP3ToSrgbLinear, effectiveRefraction, encodeOutput, encodeOutputBytes, fieldModule, fieldPassSource, groupFieldRect, heavySecondTapSigmaAtScale, heavyTapSigmaAtScale, highlightModule, importColorMatrix, importModule, importPassSource, isUsablePlacement, lensAmountBasePx, lensDepthPx, lensDirection, lensDisplacementPx, lensExtentPx, lensHeightBasePx, lensMagnitudePx, lensOvalizationAt, lensSizeGain, lensSizeGainFromThickness, linearGradientStops, linearToSrgb, linearToSrgbChannel, occlusionAlphaUnderPolicy, occlusionLiftForPolicy, opticsModule, opticsUnderPolicy, outerShadowAlpha, outerShadowFalloff, outerShadowLiftRise, outerShadowOcclusionAt, outerShadowReachPx, outerShadowSigmaPx, outerShadowThickOcclusion, outerShadowThinOcclusion, outerShadowUnderPolicy, packInstances, pipelineKey, placementFit, planPyramid, poolKey, readbackDue, refractionRank, relativeLuminance, rendererError, resolveSurfaces, rimAlongSideFactor, rimAlongSideField, samePlacement, scatterDeepThickness, scatterFloorAtScale, scatterGainAt, scatterGainAtScale, scatterGainFarAtScale, scatterHeavyShareThickAtScale, scatterRampAreaMean, scatterRampReachDevicePx, scatterRampStart, scatterSharpShare, scatterSpanMaxAtScale, scatterThickness, shadowDepthPx, sizeOcclusionAlpha, sizeOcclusionAlphaAt, sizeOuterShadowOcclusion, sizeOuterShadowOcclusionAt, sizeScatterSigma, sizeScatterSigmaAt, sizeShadowDepth, sizeShadowDepthAt, sizeThickness, sizeThicknessUnderPolicy, sizeToneLevelFar, snapRectToDevicePixels, srgbToLinear, srgbToLinearChannel, statsFromBuffer, supportsTimestamps, texelsPerCssPx, tintShade, tintShadeLayer, tintToneAdaptation, tintedMaterialColour, validateAppTexture, withMaterialOverrides };
|
|
7625
|
-
//# sourceMappingURL=dist-
|
|
7626
|
-
//# sourceMappingURL=dist-
|
|
7874
|
+
export { ADAPTIVE_LUMINANCE_HIGH, ADAPTIVE_LUMINANCE_LOW, ADAPTIVE_TINT_DARK, ADAPTIVE_TINT_LIGHT, ANALYSIS_DISPATCH, ANALYSIS_GRID, ANALYSIS_PASS_ID, ANALYSIS_STATS_FLOATS, ANALYSIS_TARGET_EXTENT, ANALYSIS_WORKGROUP, BACKDROP_ALPHA_MODES, BACKDROP_COLOR_SPACES, BACKDROP_KINDS, BACKDROP_PASS_ID, BACKDROP_TONE_HIGH, BACKDROP_TONE_LOW, BACKDROP_TONE_MAX, BACKDROP_TONE_SIZE_BIAS, CANVAS_FORMAT, CHAIN_SIGMA_AT_LEVEL_1, CROSS_CHECK_SHAPE_FLOATS, CROSS_CHECK_WORKGROUP, DEFAULT_MATERIAL_PROFILE, FAMILY_C_CROSS_CHECK, FIELD_PASS_ID, GOVERNOR_LADDER, HIGHLIGHT_PASS_ID, IDENTITY_FIT, IDLE_CHANNELS, INCREASED_OCCLUSION_LIFT, INSTANCE_BYTES, INSTANCE_FLOATS, LENS_AMOUNT_MAX, LENS_AMOUNT_PER_SPAN, LENS_EXTENT_GAIN, LENS_HEIGHT_MAX, LENS_HEIGHT_PER_SPAN, LENS_OVALIZATION, LENS_PROFILE_EXPONENT, LENS_REFRACTION_GAIN, LENS_SIZE_GAIN_MAX, LENS_THICKNESS_REFERENCE, LUMINANCE_WEIGHTS, MATERIAL_DIGEST_RULE_VERSION, MATERIAL_IDENTITY_TABLE, MATERIAL_OPTICS, MATERIAL_VARIANTS, MAX_CHAIN_LEVELS, MIN_LEVEL_EXTENT, NOMINAL_GOVERNOR, NOMINAL_MATERIAL_POLICY, OPTICS_PASS_ID, OUTER_SHADOW, OUTER_SHADOW_THICK_SPANS, OUTER_SHADOW_THIN_L, OUTER_SHADOW_UNMEASURED_BACKDROP_LUMINANCE, OUTPUT_TEXTURE_FORMAT, PASS_LABEL, REFRACTION_LADDER, REFRACTION_SCALE, RENDERER_ERROR_CODES, RENDERER_PASS_IDS, RendererError, SIZE_OCCLUSION_GAIN, SIZE_SCATTER_FLOOR, SIZE_SCATTER_FLOOR_2X, SIZE_SCATTER_GAIN_FAR_2X, SIZE_SCATTER_GAIN_MAX, SIZE_SCATTER_GAIN_MAX_2X, SIZE_SCATTER_RAMP_REACH_1X_PX, SIZE_SCATTER_RAMP_REACH_2X_PX, SIZE_SCATTER_RAMP_START_FAR_1X, SIZE_SCATTER_RAMP_START_FAR_2X, SIZE_SCATTER_RAMP_START_THICK_1X, SIZE_SCATTER_RAMP_START_THICK_2X, SIZE_SCATTER_RAMP_START_THIN_1X, SIZE_SCATTER_RAMP_START_THIN_2X, SIZE_SCATTER_SPAN_MAX, SIZE_SCATTER_SPAN_MAX_2X, SIZE_SHADOW_GAIN_MAX, SIZE_SPAN_MAX, SIZE_SPAN_MIN, SRGB_ENCODING_EXPONENT, SUPPORTED_APP_TEXTURE_FORMATS, WGSL_ANALYSIS_PASS, WGSL_CROSS_CHECK_PASS, WGSL_DOWNSAMPLE_PASS, WGSL_FIELD_KERNELS, WGSL_FIELD_PASS, WGSL_FIELD_SAMPLE, WGSL_HIGHLIGHT_PASS, WGSL_IMPORT_PASS, WGSL_INSTANCE_STRUCT, WGSL_OPTICS_PASS, WGSL_PRELUDE, WGSL_RSUPN_GRAD, WGSL_RSUP_GRAD, WGSL_SMOOTH_UNION, WORKING_TEXTURE_FORMAT, ZERO_STATS, accessibilityRefractionCap, adaptationStrength, adaptedTintAlpha, adaptedTintColour, adaptiveTint, allShaderSource, alphaNormalisationMode, analysisModule, backdropFit, backdropToneAdaptation, backdropToneResponse, backdropToneSizeBiasUnderPolicy, backdropToneSolveWeight, backdropToneUnderPolicy, bodyBlurPlan, chainModule, clipFieldRectToCanvas, collapsedRimUnderPolicy, coverFit, createAdaptationState, createAppTextureProvider, createCopyProvider, createDeviceHost, createGovernor, createGpuContext, createGradientProvider, createPassRunner, createPipelineCache, createPyramidStore, createRebuildLedger, createStorageSlot, createTexturePool, createTimingCollector, createUniformSlot, createVideoProvider, createWebGPURenderer, crossCheckKernelModule, displayP3ToSrgbLinear, effectiveRefraction, encodeOutput, encodeOutputBytes, fieldModule, fieldPassSource, groupFieldRect, heavySecondTapSigmaAtScale, heavyTapSigmaAtScale, highlightModule, importColorMatrix, importModule, importPassSource, isUsablePlacement, lensAmountBasePx, lensDepthPx, lensDirection, lensDisplacementPx, lensExtentPx, lensHeightBasePx, lensMagnitudePx, lensOvalizationAt, lensSizeGain, lensSizeGainFromThickness, linearGradientStops, linearToSrgb, linearToSrgbChannel, materialDigestDroppedLeaves, materialDigestInput, materialLeafAt, occlusionAlphaUnderPolicy, occlusionLiftForPolicy, opticsModule, opticsUnderPolicy, outerShadowAlpha, outerShadowFalloff, outerShadowLiftRise, outerShadowOcclusionAt, outerShadowReachPx, outerShadowSigmaPx, outerShadowThickOcclusion, outerShadowThinOcclusion, outerShadowUnderPolicy, packInstances, pipelineKey, placementFit, planPyramid, poolKey, readbackDue, refractionRank, relativeLuminance, rendererError, resolveSurfaces, rimAlongSideFactor, rimAlongSideField, samePlacement, scatterDeepThickness, scatterFloorAtScale, scatterGainAt, scatterGainAtScale, scatterGainFarAtScale, scatterHeavyShareThickAtScale, scatterRampAreaMean, scatterRampReachDevicePx, scatterRampStart, scatterSharpShare, scatterSpanMaxAtScale, scatterThickness, shadowDepthPx, sizeOcclusionAlpha, sizeOcclusionAlphaAt, sizeOuterShadowOcclusion, sizeOuterShadowOcclusionAt, sizeScatterSigma, sizeScatterSigmaAt, sizeShadowDepth, sizeShadowDepthAt, sizeThickness, sizeThicknessUnderPolicy, sizeToneLevelFar, snapRectToDevicePixels, srgbToLinear, srgbToLinearChannel, statsFromBuffer, supportsTimestamps, texelsPerCssPx, tintShade, tintShadeLayer, tintToneAdaptation, tintedMaterialColour, validateAppTexture, withMaterialOverrides };
|
|
7875
|
+
//# sourceMappingURL=dist-N437MSRG.js.map
|
|
7876
|
+
//# sourceMappingURL=dist-N437MSRG.js.map
|