@plasius/gpu-shader 0.1.1 → 0.1.3
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.
- package/README.md +50 -2
- package/dist/cli.cjs +539 -143
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +539 -143
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +738 -218
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +737 -218
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +329 -86
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +329 -86
- package/dist/node.js.map +1 -1
- package/dist/testing.cjs +436 -115
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +436 -115
- package/dist/testing.js.map +1 -1
- package/package.json +2 -1
package/dist/node.js
CHANGED
|
@@ -5765,63 +5765,217 @@ var cn;
|
|
|
5765
5765
|
var ln = { [cn.ExpensiveBuiltinInLoop]: "expensive-builtin-in-loop", [cn.CostlyArithmeticInLoop]: "costly-arithmetic-in-loop", [cn.LoopInvariantExpression]: "loop-invariant-expression", [cn.AtomicInLoop]: "atomic-in-loop", [cn.BarrierInLoop]: "barrier-in-loop", [cn.AtomicStorageRead]: "atomic-storage-read", [cn.WorkgroupArrayThreadPrivate]: "workgroup-array-thread-private", [cn.WorkgroupStorageOversized]: "workgroup-storage-oversized", [cn.SerialScanEmulation]: "serial-scan-emulation" };
|
|
5766
5766
|
|
|
5767
5767
|
// src/canonical-json.ts
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5768
|
+
var GPU_CONTRACT_SNAPSHOT_LIMITS = Object.freeze({
|
|
5769
|
+
maximumDepth: 64,
|
|
5770
|
+
maximumNodes: 262144,
|
|
5771
|
+
maximumProperties: 131072,
|
|
5772
|
+
maximumElements: 131072,
|
|
5773
|
+
maximumArrayLength: 1e5,
|
|
5774
|
+
maximumStringBytes: 1024 * 1024,
|
|
5775
|
+
maximumAggregateStringBytes: 8 * 1024 * 1024,
|
|
5776
|
+
maximumAggregateBytes: 16 * 1024 * 1024,
|
|
5777
|
+
maximumInputBytes: 16 * 1024 * 1024
|
|
5778
|
+
});
|
|
5779
|
+
var QUALIFICATION_GPU_CONTRACT_SNAPSHOT_LIMITS = Object.freeze({
|
|
5780
|
+
maximumDepth: 96,
|
|
5781
|
+
maximumNodes: 4e6,
|
|
5782
|
+
maximumProperties: 2e6,
|
|
5783
|
+
maximumElements: 2e6,
|
|
5784
|
+
maximumArrayLength: 25e4,
|
|
5785
|
+
maximumStringBytes: 4 * 1024 * 1024,
|
|
5786
|
+
maximumAggregateStringBytes: 128 * 1024 * 1024,
|
|
5787
|
+
maximumAggregateBytes: 256 * 1024 * 1024,
|
|
5788
|
+
maximumInputBytes: 256 * 1024 * 1024
|
|
5789
|
+
});
|
|
5790
|
+
var FAILURE_MESSAGES = Object.freeze({
|
|
5791
|
+
"aggregate-bytes": "GPU contract snapshot exceeds the aggregate byte limit.",
|
|
5792
|
+
"aggregate-string-bytes": "GPU contract snapshot exceeds the aggregate string byte limit.",
|
|
5793
|
+
"array-length": "GPU contract snapshot exceeds the single-array element limit.",
|
|
5794
|
+
cycle: "GPU contract snapshot contains a circular reference.",
|
|
5795
|
+
depth: "GPU contract snapshot exceeds the nesting-depth limit.",
|
|
5796
|
+
elements: "GPU contract snapshot exceeds the total element limit.",
|
|
5797
|
+
inspection: "GPU contract snapshot rejected unsafe object inspection.",
|
|
5798
|
+
nodes: "GPU contract snapshot exceeds the total node limit.",
|
|
5799
|
+
"non-finite": "GPU contract snapshot contains a non-finite number.",
|
|
5800
|
+
properties: "GPU contract snapshot exceeds the total property limit.",
|
|
5801
|
+
shape: "GPU contract snapshot requires plain JSON objects with own enumerable data properties and dense arrays.",
|
|
5802
|
+
"string-bytes": "GPU contract snapshot exceeds the individual string byte limit.",
|
|
5803
|
+
unicode: "GPU contract snapshot contains an invalid Unicode scalar string or unpaired UTF-16 surrogate.",
|
|
5804
|
+
value: "GPU contract snapshot contains undefined or another value that JSON cannot represent."
|
|
5805
|
+
});
|
|
5806
|
+
var GpuContractSnapshotError = class extends TypeError {
|
|
5807
|
+
code;
|
|
5808
|
+
constructor(code) {
|
|
5809
|
+
super(FAILURE_MESSAGES[code]);
|
|
5810
|
+
this.name = "GpuContractSnapshotError";
|
|
5811
|
+
this.code = code;
|
|
5812
|
+
}
|
|
5813
|
+
};
|
|
5814
|
+
var TYPED_ARRAY_PROTOTYPE = Reflect.getPrototypeOf(Uint8Array.prototype);
|
|
5815
|
+
var TYPED_ARRAY_BYTE_LENGTH = Reflect.getOwnPropertyDescriptor(
|
|
5816
|
+
TYPED_ARRAY_PROTOTYPE,
|
|
5817
|
+
"byteLength"
|
|
5818
|
+
)?.get;
|
|
5819
|
+
var TYPED_ARRAY_TAG = Reflect.getOwnPropertyDescriptor(
|
|
5820
|
+
TYPED_ARRAY_PROTOTYPE,
|
|
5821
|
+
Symbol.toStringTag
|
|
5822
|
+
)?.get;
|
|
5823
|
+
var UINT8_ARRAY_SET = Uint8Array.prototype.set;
|
|
5824
|
+
function fail(reason) {
|
|
5825
|
+
throw new GpuContractSnapshotError(reason);
|
|
5826
|
+
}
|
|
5827
|
+
function inspected(operation) {
|
|
5828
|
+
try {
|
|
5829
|
+
return operation();
|
|
5830
|
+
} catch {
|
|
5831
|
+
return fail("inspection");
|
|
5832
|
+
}
|
|
5771
5833
|
}
|
|
5772
|
-
function
|
|
5834
|
+
function assertLimit(value, maximum, reason) {
|
|
5835
|
+
if (!Number.isSafeInteger(value) || value > maximum) fail(reason);
|
|
5836
|
+
}
|
|
5837
|
+
function quotedJsonByteLength(value, maximum) {
|
|
5838
|
+
let raw = 0;
|
|
5839
|
+
let quoted = 2;
|
|
5773
5840
|
for (let index = 0; index < value.length; index += 1) {
|
|
5774
5841
|
const code = value.charCodeAt(index);
|
|
5775
|
-
if (code
|
|
5842
|
+
if (code <= 127) {
|
|
5843
|
+
raw += 1;
|
|
5844
|
+
if (code <= 31) quoted += code === 8 || code === 9 || code === 10 || code === 12 || code === 13 ? 2 : 6;
|
|
5845
|
+
else quoted += code === 34 || code === 92 ? 2 : 1;
|
|
5846
|
+
} else if (code <= 2047) {
|
|
5847
|
+
raw += 2;
|
|
5848
|
+
quoted += 2;
|
|
5849
|
+
} else if (code >= 55296 && code <= 56319) {
|
|
5776
5850
|
const next = value.charCodeAt(index + 1);
|
|
5777
|
-
if (!(next >= 56320 && next <= 57343))
|
|
5851
|
+
if (!(next >= 56320 && next <= 57343)) fail("unicode");
|
|
5852
|
+
raw += 4;
|
|
5853
|
+
quoted += 4;
|
|
5778
5854
|
index += 1;
|
|
5779
|
-
} else if (code >= 56320 && code <= 57343)
|
|
5855
|
+
} else if (code >= 56320 && code <= 57343) fail("unicode");
|
|
5856
|
+
else {
|
|
5857
|
+
raw += 3;
|
|
5858
|
+
quoted += 3;
|
|
5859
|
+
}
|
|
5860
|
+
if (raw > maximum) fail("string-bytes");
|
|
5780
5861
|
}
|
|
5862
|
+
return { raw, quoted };
|
|
5781
5863
|
}
|
|
5782
|
-
function
|
|
5864
|
+
function assertLimits(limits) {
|
|
5865
|
+
for (const value of Object.values(limits)) {
|
|
5866
|
+
if (!Number.isSafeInteger(value) || value < 1) throw new TypeError("GPU contract snapshot limits must be positive safe integers.");
|
|
5867
|
+
}
|
|
5868
|
+
}
|
|
5869
|
+
function snapshotGpuContract(value, limits = GPU_CONTRACT_SNAPSHOT_LIMITS) {
|
|
5870
|
+
assertLimits(limits);
|
|
5783
5871
|
const ancestors = /* @__PURE__ */ new Set();
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5872
|
+
let nodes = 0;
|
|
5873
|
+
let properties = 0;
|
|
5874
|
+
let elements = 0;
|
|
5875
|
+
let aggregateStringBytes = 0;
|
|
5876
|
+
let aggregateBytes = 0;
|
|
5877
|
+
const addAggregate = (bytes) => {
|
|
5878
|
+
aggregateBytes += bytes;
|
|
5879
|
+
assertLimit(aggregateBytes, limits.maximumAggregateBytes, "aggregate-bytes");
|
|
5880
|
+
};
|
|
5881
|
+
const addString = (text2) => {
|
|
5882
|
+
const measured = quotedJsonByteLength(text2, limits.maximumStringBytes);
|
|
5883
|
+
aggregateStringBytes += measured.raw;
|
|
5884
|
+
assertLimit(aggregateStringBytes, limits.maximumAggregateStringBytes, "aggregate-string-bytes");
|
|
5885
|
+
return measured.quoted;
|
|
5886
|
+
};
|
|
5887
|
+
const visit = (current, depth) => {
|
|
5888
|
+
if (depth > limits.maximumDepth) fail("depth");
|
|
5889
|
+
nodes += 1;
|
|
5890
|
+
assertLimit(nodes, limits.maximumNodes, "nodes");
|
|
5891
|
+
if (current === null) {
|
|
5892
|
+
addAggregate(4);
|
|
5893
|
+
return null;
|
|
5894
|
+
}
|
|
5895
|
+
if (typeof current === "string") {
|
|
5896
|
+
addAggregate(addString(current));
|
|
5897
|
+
return current;
|
|
5898
|
+
}
|
|
5899
|
+
if (typeof current === "boolean") {
|
|
5900
|
+
addAggregate(current ? 4 : 5);
|
|
5901
|
+
return current;
|
|
5789
5902
|
}
|
|
5790
5903
|
if (typeof current === "number") {
|
|
5791
|
-
if (!Number.isFinite(current))
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
return
|
|
5795
|
-
}
|
|
5796
|
-
if (typeof current !== "object")
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
}
|
|
5904
|
+
if (!Number.isFinite(current)) fail("non-finite");
|
|
5905
|
+
const normalized = Object.is(current, -0) ? 0 : current;
|
|
5906
|
+
addAggregate(JSON.stringify(normalized).length);
|
|
5907
|
+
return normalized;
|
|
5908
|
+
}
|
|
5909
|
+
if (typeof current !== "object") fail("value");
|
|
5910
|
+
if (ancestors.has(current)) fail("cycle");
|
|
5911
|
+
const isArray = inspected(() => Array.isArray(current));
|
|
5912
|
+
const prototype = inspected(() => Reflect.getPrototypeOf(current));
|
|
5913
|
+
if (isArray ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) fail("shape");
|
|
5802
5914
|
ancestors.add(current);
|
|
5803
5915
|
try {
|
|
5804
|
-
if (
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5916
|
+
if (isArray) {
|
|
5917
|
+
const lengthDescriptor = inspected(() => Reflect.getOwnPropertyDescriptor(current, "length"));
|
|
5918
|
+
if (!lengthDescriptor || !Object.hasOwn(lengthDescriptor, "value") || lengthDescriptor.enumerable || typeof lengthDescriptor.value !== "number" || !Number.isSafeInteger(lengthDescriptor.value) || lengthDescriptor.value < 0) fail("shape");
|
|
5919
|
+
const length = lengthDescriptor.value;
|
|
5920
|
+
assertLimit(length, limits.maximumArrayLength, "array-length");
|
|
5921
|
+
elements += length;
|
|
5922
|
+
assertLimit(elements, limits.maximumElements, "elements");
|
|
5923
|
+
const ownKeys2 = inspected(() => Reflect.ownKeys(current));
|
|
5924
|
+
if (ownKeys2.some((key) => typeof key !== "string")) fail("shape");
|
|
5925
|
+
if (ownKeys2.length !== length + 1) fail("shape");
|
|
5926
|
+
const keySet = new Set(ownKeys2);
|
|
5927
|
+
if (!keySet.delete("length")) fail("shape");
|
|
5928
|
+
const output2 = new Array(length);
|
|
5929
|
+
addAggregate(2 + Math.max(0, length - 1));
|
|
5930
|
+
for (let index = 0; index < length; index += 1) {
|
|
5931
|
+
const key = String(index);
|
|
5932
|
+
if (!keySet.delete(key)) fail("shape");
|
|
5933
|
+
const descriptor = inspected(() => Reflect.getOwnPropertyDescriptor(current, key));
|
|
5934
|
+
if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, "value")) fail("shape");
|
|
5935
|
+
Object.defineProperty(output2, key, {
|
|
5936
|
+
configurable: true,
|
|
5937
|
+
enumerable: true,
|
|
5938
|
+
value: visit(descriptor.value, depth + 1),
|
|
5939
|
+
writable: true
|
|
5940
|
+
});
|
|
5816
5941
|
}
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5942
|
+
if (keySet.size !== 0) fail("shape");
|
|
5943
|
+
return output2;
|
|
5944
|
+
}
|
|
5945
|
+
const ownKeys = inspected(() => Reflect.ownKeys(current));
|
|
5946
|
+
if (ownKeys.some((key) => typeof key !== "string")) fail("shape");
|
|
5947
|
+
properties += ownKeys.length;
|
|
5948
|
+
assertLimit(properties, limits.maximumProperties, "properties");
|
|
5949
|
+
addAggregate(2 + Math.max(0, ownKeys.length - 1) + ownKeys.length);
|
|
5950
|
+
const output = {};
|
|
5951
|
+
for (const key of ownKeys) {
|
|
5952
|
+
addAggregate(addString(key));
|
|
5953
|
+
const descriptor = inspected(() => Reflect.getOwnPropertyDescriptor(current, key));
|
|
5954
|
+
if (!descriptor || !descriptor.enumerable || !Object.hasOwn(descriptor, "value")) fail("shape");
|
|
5955
|
+
Object.defineProperty(output, key, {
|
|
5956
|
+
configurable: true,
|
|
5957
|
+
enumerable: true,
|
|
5958
|
+
value: visit(descriptor.value, depth + 1),
|
|
5959
|
+
writable: true
|
|
5960
|
+
});
|
|
5961
|
+
}
|
|
5962
|
+
return output;
|
|
5820
5963
|
} finally {
|
|
5821
5964
|
ancestors.delete(current);
|
|
5822
5965
|
}
|
|
5823
5966
|
};
|
|
5824
|
-
return visit(value,
|
|
5967
|
+
return visit(value, 0);
|
|
5968
|
+
}
|
|
5969
|
+
function serializeSnapshot(value) {
|
|
5970
|
+
if (value === null) return "null";
|
|
5971
|
+
if (typeof value === "string" || typeof value === "boolean") return JSON.stringify(value);
|
|
5972
|
+
if (typeof value === "number") return JSON.stringify(value);
|
|
5973
|
+
if (Array.isArray(value)) return `[${value.map(serializeSnapshot).join(",")}]`;
|
|
5974
|
+
const input = value;
|
|
5975
|
+
return `{${Object.keys(input).sort().map((key) => `${JSON.stringify(key)}:${serializeSnapshot(input[key])}`).join(",")}}`;
|
|
5976
|
+
}
|
|
5977
|
+
function canonicalizeGpuContract(value) {
|
|
5978
|
+
return serializeSnapshot(snapshotGpuContract(value));
|
|
5825
5979
|
}
|
|
5826
5980
|
|
|
5827
5981
|
// src/contracts.ts
|
|
@@ -5919,39 +6073,41 @@ function modelProjection(manifest) {
|
|
|
5919
6073
|
};
|
|
5920
6074
|
}
|
|
5921
6075
|
async function computeGpuAbiHash(input) {
|
|
5922
|
-
|
|
6076
|
+
const snapshot = snapshotGpuContract(input);
|
|
6077
|
+
if (snapshot.kind === "model") {
|
|
5923
6078
|
return computeSha256(
|
|
5924
6079
|
`plasius.gpu.model-abi/v1
|
|
5925
|
-
${canonicalizeGpuContract(modelProjection(
|
|
6080
|
+
${canonicalizeGpuContract(modelProjection(snapshot.interface))}`
|
|
5926
6081
|
);
|
|
5927
6082
|
}
|
|
5928
|
-
if (
|
|
6083
|
+
if (snapshot.kind === "interface") {
|
|
5929
6084
|
return computeSha256(
|
|
5930
6085
|
`plasius.gpu.interface-abi/v1
|
|
5931
|
-
${canonicalizeGpuContract(interfaceProjection(
|
|
6086
|
+
${canonicalizeGpuContract(interfaceProjection(snapshot.interface))}`
|
|
5932
6087
|
);
|
|
5933
6088
|
}
|
|
5934
6089
|
const pipelines = sorted(
|
|
5935
|
-
|
|
6090
|
+
snapshot.pipelines,
|
|
5936
6091
|
(left, right) => compareString(left.pipelineId, right.pipelineId)
|
|
5937
6092
|
);
|
|
5938
6093
|
const requirements = {
|
|
5939
|
-
semantics: [...
|
|
5940
|
-
features: [...
|
|
5941
|
-
limits: sorted(
|
|
5942
|
-
formats: [...
|
|
6094
|
+
semantics: [...snapshot.requirements.semantics].sort(),
|
|
6095
|
+
features: [...snapshot.requirements.features].sort(),
|
|
6096
|
+
limits: sorted(snapshot.requirements.limits, (left, right) => compareString(left.name, right.name)),
|
|
6097
|
+
formats: [...snapshot.requirements.formats].sort()
|
|
5943
6098
|
};
|
|
5944
6099
|
return computeSha256(
|
|
5945
6100
|
`plasius.gpu.shader-abi/v1
|
|
5946
6101
|
${canonicalizeGpuContract({
|
|
5947
|
-
interface: interfaceProjection(
|
|
6102
|
+
interface: interfaceProjection(snapshot.interface),
|
|
5948
6103
|
pipelines,
|
|
5949
6104
|
requirements
|
|
5950
6105
|
})}`
|
|
5951
6106
|
);
|
|
5952
6107
|
}
|
|
5953
6108
|
async function computeShaderManifestCoreSha256(manifest) {
|
|
5954
|
-
const
|
|
6109
|
+
const snapshot = snapshotGpuContract(manifest);
|
|
6110
|
+
const core = Object.fromEntries(Object.entries(snapshot).filter(
|
|
5955
6111
|
([key]) => key !== "validationEvidence" && key !== "additionalValidationEvidence"
|
|
5956
6112
|
));
|
|
5957
6113
|
return computeSha256(
|
|
@@ -5960,6 +6116,29 @@ ${canonicalizeGpuContract(core)}`
|
|
|
5960
6116
|
);
|
|
5961
6117
|
}
|
|
5962
6118
|
|
|
6119
|
+
// src/asset-version.ts
|
|
6120
|
+
var ASSET_VERSION_PATTERN = /^[0-9A-Za-z][0-9A-Za-z._-]{0,127}$/u;
|
|
6121
|
+
var MUTABLE_VERSION_ALIASES = /* @__PURE__ */ new Set([
|
|
6122
|
+
"latest",
|
|
6123
|
+
"current",
|
|
6124
|
+
"stable",
|
|
6125
|
+
"preview",
|
|
6126
|
+
"default",
|
|
6127
|
+
"production",
|
|
6128
|
+
"canary",
|
|
6129
|
+
"next",
|
|
6130
|
+
"head",
|
|
6131
|
+
"main"
|
|
6132
|
+
]);
|
|
6133
|
+
var X_WILDCARD_SEGMENT_PATTERN = /^(?:[vV])?[xX](?:\.|-|$)|\.[xX](?:\.|-|$)/u;
|
|
6134
|
+
var IMMUTABLE_VERSION_ERROR_MESSAGE = "Immutable asset version must be an exact token up to 128 characters; mutable aliases, ranges, wildcards, and URLs are not allowed.";
|
|
6135
|
+
function assertImmutableAssetVersion(value) {
|
|
6136
|
+
if (typeof value !== "string" || !ASSET_VERSION_PATTERN.test(value) || MUTABLE_VERSION_ALIASES.has(value.toLowerCase()) || X_WILDCARD_SEGMENT_PATTERN.test(value)) {
|
|
6137
|
+
throw new TypeError(IMMUTABLE_VERSION_ERROR_MESSAGE);
|
|
6138
|
+
}
|
|
6139
|
+
return value;
|
|
6140
|
+
}
|
|
6141
|
+
|
|
5963
6142
|
// src/requirements-validation.ts
|
|
5964
6143
|
var ENABLED_FEATURES = Object.freeze({
|
|
5965
6144
|
f16: "shader-f16",
|
|
@@ -6287,6 +6466,14 @@ function validateShaderDerivedRequirements(input) {
|
|
|
6287
6466
|
// src/manifest-validation.ts
|
|
6288
6467
|
var stages = ["vertex", "fragment", "compute"];
|
|
6289
6468
|
var roles = ["material", "lighting", "outline", "shadow", "post-processing"];
|
|
6469
|
+
function detachedJson(value, path2) {
|
|
6470
|
+
try {
|
|
6471
|
+
return snapshotGpuContract(value);
|
|
6472
|
+
} catch (cause) {
|
|
6473
|
+
const detail = cause instanceof GpuContractSnapshotError ? ` ${cause.message}` : "";
|
|
6474
|
+
throw new TypeError(`${path2} must contain bounded detached JSON contract data.${detail}`);
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6290
6477
|
function object(value, path2) {
|
|
6291
6478
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${path2} must be an object.`);
|
|
6292
6479
|
return value;
|
|
@@ -6294,7 +6481,7 @@ function object(value, path2) {
|
|
|
6294
6481
|
function exact(value, keys, path2) {
|
|
6295
6482
|
const allowed = new Set(keys);
|
|
6296
6483
|
for (const key of Object.keys(value)) if (!allowed.has(key)) throw new TypeError(`${path2}.${key} is not part of this contract version.`);
|
|
6297
|
-
for (const key of keys) if (!(key
|
|
6484
|
+
for (const key of keys) if (!Object.hasOwn(value, key)) throw new TypeError(`${path2}.${key} is required.`);
|
|
6298
6485
|
}
|
|
6299
6486
|
function text(value, path2, maximum = 512) {
|
|
6300
6487
|
if (typeof value !== "string" || value.length === 0 || value.length > maximum || [...value].some((character) => character.charCodeAt(0) <= 31)) {
|
|
@@ -6307,6 +6494,13 @@ function token(value, path2) {
|
|
|
6307
6494
|
if (!/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u.test(result) || result.includes("..")) throw new TypeError(`${path2} must be a safe token.`);
|
|
6308
6495
|
return result;
|
|
6309
6496
|
}
|
|
6497
|
+
function immutableVersion(value, path2) {
|
|
6498
|
+
try {
|
|
6499
|
+
return assertImmutableAssetVersion(value);
|
|
6500
|
+
} catch {
|
|
6501
|
+
throw new TypeError(`${path2} must be an immutable asset version: exact token required; mutable aliases, ranges, wildcards, and URLs are not allowed.`);
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6310
6504
|
function enumeration(value, values, path2) {
|
|
6311
6505
|
if (!values.includes(value)) throw new TypeError(`${path2} is invalid.`);
|
|
6312
6506
|
return value;
|
|
@@ -6334,8 +6528,8 @@ function nullableToken(value, path2) {
|
|
|
6334
6528
|
function digest(value, path2) {
|
|
6335
6529
|
try {
|
|
6336
6530
|
return asSha256Hex(text(value, path2, 64));
|
|
6337
|
-
} catch
|
|
6338
|
-
throw new TypeError(`${path2} must be a lowercase SHA-256 digest
|
|
6531
|
+
} catch {
|
|
6532
|
+
throw new TypeError(`${path2} must be a lowercase SHA-256 digest.`);
|
|
6339
6533
|
}
|
|
6340
6534
|
}
|
|
6341
6535
|
function uri(value, path2) {
|
|
@@ -6343,8 +6537,8 @@ function uri(value, path2) {
|
|
|
6343
6537
|
let parsed;
|
|
6344
6538
|
try {
|
|
6345
6539
|
parsed = new URL(result);
|
|
6346
|
-
} catch
|
|
6347
|
-
throw new TypeError(`${path2} must be an absolute immutable asset URI
|
|
6540
|
+
} catch {
|
|
6541
|
+
throw new TypeError(`${path2} must be an absolute immutable asset URI.`);
|
|
6348
6542
|
}
|
|
6349
6543
|
if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.hash) throw new TypeError(`${path2} must be credential-free HTTPS without a fragment.`);
|
|
6350
6544
|
const keys = [...parsed.searchParams.keys()].map((key) => key.toLowerCase());
|
|
@@ -6580,7 +6774,7 @@ function interfaceRef(value, path2) {
|
|
|
6580
6774
|
const input = object(value, path2);
|
|
6581
6775
|
exact(input, ["interfaceId", "interfaceVersion", "manifestUri", "manifestSha256", "interfaceAbiHash", "modelAbiHash"], path2);
|
|
6582
6776
|
token(input.interfaceId, `${path2}.interfaceId`);
|
|
6583
|
-
|
|
6777
|
+
immutableVersion(input.interfaceVersion, `${path2}.interfaceVersion`);
|
|
6584
6778
|
uri(input.manifestUri, `${path2}.manifestUri`);
|
|
6585
6779
|
digest(input.manifestSha256, `${path2}.manifestSha256`);
|
|
6586
6780
|
digest(input.interfaceAbiHash, `${path2}.interfaceAbiHash`);
|
|
@@ -6718,7 +6912,7 @@ function pipeline(value, path2, moduleIds) {
|
|
|
6718
6912
|
return input;
|
|
6719
6913
|
}
|
|
6720
6914
|
function parseSerializableGpuPipelineDescriptors(value, moduleIds, path2 = "pipelines") {
|
|
6721
|
-
const parsed = array(value, path2).map((item, index) => pipeline(item, `${path2}[${index}]`, new Set(moduleIds)));
|
|
6915
|
+
const parsed = array(detachedJson(value, path2), path2).map((item, index) => pipeline(item, `${path2}[${index}]`, new Set(moduleIds)));
|
|
6722
6916
|
unique(parsed, (item) => item.pipelineId, path2);
|
|
6723
6917
|
return freeze(parsed);
|
|
6724
6918
|
}
|
|
@@ -6726,7 +6920,7 @@ function compatibleModel(value, path2) {
|
|
|
6726
6920
|
const input = object(value, path2);
|
|
6727
6921
|
exact(input, ["interfaceId", "interfaceVersion", "manifestSha256", "interfaceAbiHash", "modelAbiHash"], path2);
|
|
6728
6922
|
token(input.interfaceId, `${path2}.interfaceId`);
|
|
6729
|
-
|
|
6923
|
+
immutableVersion(input.interfaceVersion, `${path2}.interfaceVersion`);
|
|
6730
6924
|
digest(input.manifestSha256, `${path2}.manifestSha256`);
|
|
6731
6925
|
digest(input.interfaceAbiHash, `${path2}.interfaceAbiHash`);
|
|
6732
6926
|
digest(input.modelAbiHash, `${path2}.modelAbiHash`);
|
|
@@ -6739,7 +6933,7 @@ function validationEvidenceRef(value, path2) {
|
|
|
6739
6933
|
uri(evidence.uri, `${path2}.uri`);
|
|
6740
6934
|
digest(evidence.sha256, `${path2}.sha256`);
|
|
6741
6935
|
token(evidence.matrixId, `${path2}.matrixId`);
|
|
6742
|
-
|
|
6936
|
+
immutableVersion(evidence.matrixVersion, `${path2}.matrixVersion`);
|
|
6743
6937
|
digest(evidence.matrixSha256, `${path2}.matrixSha256`);
|
|
6744
6938
|
const attestation = object(evidence.attestationRef, `${path2}.attestationRef`);
|
|
6745
6939
|
exact(attestation, ["uri", "sha256"], `${path2}.attestationRef`);
|
|
@@ -6766,11 +6960,11 @@ function reflectedRecordBindingSize(record) {
|
|
|
6766
6960
|
return Math.ceil(unrounded / record.alignment) * record.alignment;
|
|
6767
6961
|
}
|
|
6768
6962
|
function parseGpuInterfaceManifest(value) {
|
|
6769
|
-
const input = object(value, "GpuInterfaceManifest");
|
|
6963
|
+
const input = object(detachedJson(value, "GpuInterfaceManifest"), "GpuInterfaceManifest");
|
|
6770
6964
|
exact(input, ["contractVersion", "interfaceId", "interfaceVersion", "modules", "records", "bindings", "entryPoints", "vertexInputs", "overrides", "modelAbi", "modelAbiHash", "interfaceAbiHash", "generatedBy"], "GpuInterfaceManifest");
|
|
6771
6965
|
if (input.contractVersion !== GPU_INTERFACE_MANIFEST_VERSION) throw new TypeError("Unsupported GPU interface contract version.");
|
|
6772
6966
|
token(input.interfaceId, "GpuInterfaceManifest.interfaceId");
|
|
6773
|
-
|
|
6967
|
+
immutableVersion(input.interfaceVersion, "GpuInterfaceManifest.interfaceVersion");
|
|
6774
6968
|
const moduleValues = array(input.modules, "GpuInterfaceManifest.modules");
|
|
6775
6969
|
if (moduleValues.length === 0) throw new TypeError("GpuInterfaceManifest.modules must not be empty.");
|
|
6776
6970
|
const moduleIds = moduleValues.map((value2, index) => {
|
|
@@ -6952,11 +7146,11 @@ function parseGpuInterfaceManifest(value) {
|
|
|
6952
7146
|
return freeze(input);
|
|
6953
7147
|
}
|
|
6954
7148
|
function parseShaderVersionManifest(value) {
|
|
6955
|
-
const input = object(value, "ShaderVersionManifest");
|
|
7149
|
+
const input = object(detachedJson(value, "ShaderVersionManifest"), "ShaderVersionManifest");
|
|
6956
7150
|
exact(input, ["contractVersion", "shaderId", "version", "modules", "gpuInterface", "pipelines", "renderRoles", "compatibleModelInterfaces", "requirements", "shaderAbiHash", "validationEvidence", "additionalValidationEvidence"], "ShaderVersionManifest");
|
|
6957
7151
|
if (input.contractVersion !== SHADER_VERSION_MANIFEST_VERSION) throw new TypeError("Unsupported shader manifest contract version.");
|
|
6958
7152
|
token(input.shaderId, "ShaderVersionManifest.shaderId");
|
|
6959
|
-
|
|
7153
|
+
immutableVersion(input.version, "ShaderVersionManifest.version");
|
|
6960
7154
|
const moduleValues = array(input.modules, "ShaderVersionManifest.modules");
|
|
6961
7155
|
if (moduleValues.length === 0) throw new TypeError("ShaderVersionManifest.modules must not be empty.");
|
|
6962
7156
|
const moduleIds = moduleValues.map((item, index) => {
|
|
@@ -7069,7 +7263,7 @@ function parseShaderVersionManifest(value) {
|
|
|
7069
7263
|
return freeze(input);
|
|
7070
7264
|
}
|
|
7071
7265
|
function parseShaderVersionManifestCore(value) {
|
|
7072
|
-
const input = object(value, "ShaderVersionManifestCore");
|
|
7266
|
+
const input = object(detachedJson(value, "ShaderVersionManifestCore"), "ShaderVersionManifestCore");
|
|
7073
7267
|
if ("validationEvidence" in input || "additionalValidationEvidence" in input) {
|
|
7074
7268
|
throw new TypeError("ShaderVersionManifestCore must not contain validationEvidence or additionalValidationEvidence.");
|
|
7075
7269
|
}
|
|
@@ -7095,10 +7289,10 @@ function parseShaderVersionManifestCore(value) {
|
|
|
7095
7289
|
return freeze(core);
|
|
7096
7290
|
}
|
|
7097
7291
|
function parseModelGpuCompatibilityDescriptor(value) {
|
|
7098
|
-
const input = object(value, "ModelGpuCompatibilityDescriptor");
|
|
7292
|
+
const input = object(detachedJson(value, "ModelGpuCompatibilityDescriptor"), "ModelGpuCompatibilityDescriptor");
|
|
7099
7293
|
exact(input, ["modelId", "version", "gpuInterface", "modelAbiHash", "providedSemantics", "defaultStyleProfile"], "ModelGpuCompatibilityDescriptor");
|
|
7100
7294
|
token(input.modelId, "ModelGpuCompatibilityDescriptor.modelId");
|
|
7101
|
-
|
|
7295
|
+
immutableVersion(input.version, "ModelGpuCompatibilityDescriptor.version");
|
|
7102
7296
|
const gpuInterface = interfaceRef(input.gpuInterface, "ModelGpuCompatibilityDescriptor.gpuInterface");
|
|
7103
7297
|
const modelAbiHash = digest(input.modelAbiHash, "ModelGpuCompatibilityDescriptor.modelAbiHash");
|
|
7104
7298
|
if (gpuInterface.modelAbiHash !== modelAbiHash) throw new TypeError("ModelGpuCompatibilityDescriptor.gpuInterface.modelAbiHash differs from modelAbiHash.");
|
|
@@ -7107,14 +7301,17 @@ function parseModelGpuCompatibilityDescriptor(value) {
|
|
|
7107
7301
|
const profile = object(input.defaultStyleProfile, "ModelGpuCompatibilityDescriptor.defaultStyleProfile");
|
|
7108
7302
|
exact(profile, ["profileId", "version", "manifestUri", "manifestSha256"], "ModelGpuCompatibilityDescriptor.defaultStyleProfile");
|
|
7109
7303
|
token(profile.profileId, "ModelGpuCompatibilityDescriptor.defaultStyleProfile.profileId");
|
|
7110
|
-
|
|
7304
|
+
immutableVersion(profile.version, "ModelGpuCompatibilityDescriptor.defaultStyleProfile.version");
|
|
7111
7305
|
uri(profile.manifestUri, "ModelGpuCompatibilityDescriptor.defaultStyleProfile.manifestUri");
|
|
7112
7306
|
digest(profile.manifestSha256, "ModelGpuCompatibilityDescriptor.defaultStyleProfile.manifestSha256");
|
|
7113
7307
|
}
|
|
7114
7308
|
return freeze(input);
|
|
7115
7309
|
}
|
|
7116
7310
|
function parseShaderQualificationModelCompatibilityFixture(value) {
|
|
7117
|
-
const input = object(
|
|
7311
|
+
const input = object(
|
|
7312
|
+
detachedJson(value, "ShaderQualificationModelCompatibilityFixture"),
|
|
7313
|
+
"ShaderQualificationModelCompatibilityFixture"
|
|
7314
|
+
);
|
|
7118
7315
|
exact(input, ["contractVersion", "fixtureId", "model"], "ShaderQualificationModelCompatibilityFixture");
|
|
7119
7316
|
if (input.contractVersion !== SHADER_QUALIFICATION_FIXTURE_VERSION) throw new TypeError("Unsupported model compatibility fixture version.");
|
|
7120
7317
|
token(input.fixtureId, "ShaderQualificationModelCompatibilityFixture.fixtureId");
|
|
@@ -7479,7 +7676,7 @@ function validatePipelineInterfaces(input) {
|
|
|
7479
7676
|
// package.json
|
|
7480
7677
|
var package_default = {
|
|
7481
7678
|
name: "@plasius/gpu-shader",
|
|
7482
|
-
version: "0.1.
|
|
7679
|
+
version: "0.1.3",
|
|
7483
7680
|
description: "Reflection-first WebGPU WGSL interfaces, CPU codecs, compatibility validation, style profiles, and qualification tooling",
|
|
7484
7681
|
type: "module",
|
|
7485
7682
|
sideEffects: false,
|
|
@@ -7571,6 +7768,7 @@ var package_default = {
|
|
|
7571
7768
|
access: "public"
|
|
7572
7769
|
},
|
|
7573
7770
|
overrides: {
|
|
7771
|
+
esbuild: "^0.28.1",
|
|
7574
7772
|
minimatch: "^10.2.1"
|
|
7575
7773
|
},
|
|
7576
7774
|
engines: {
|
|
@@ -8931,13 +9129,26 @@ function issue2(code, message, path2) {
|
|
|
8931
9129
|
function object2(value) {
|
|
8932
9130
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
8933
9131
|
}
|
|
9132
|
+
function freezeJson(value) {
|
|
9133
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
9134
|
+
for (const child of Object.values(value)) freezeJson(child);
|
|
9135
|
+
return Object.freeze(value);
|
|
9136
|
+
}
|
|
8934
9137
|
function exactKeys(value, keys) {
|
|
8935
9138
|
const expected = new Set(keys);
|
|
8936
|
-
return Object.keys(value).every((key) => expected.has(key)) && keys.every((key) => key
|
|
9139
|
+
return Object.keys(value).every((key) => expected.has(key)) && keys.every((key) => Object.hasOwn(value, key));
|
|
8937
9140
|
}
|
|
8938
9141
|
function safeToken(value) {
|
|
8939
9142
|
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,159}$/u.test(value) && !value.includes("..");
|
|
8940
9143
|
}
|
|
9144
|
+
function immutableVersion2(value) {
|
|
9145
|
+
try {
|
|
9146
|
+
assertImmutableAssetVersion(value);
|
|
9147
|
+
return true;
|
|
9148
|
+
} catch {
|
|
9149
|
+
return false;
|
|
9150
|
+
}
|
|
9151
|
+
}
|
|
8941
9152
|
function validSha(value) {
|
|
8942
9153
|
try {
|
|
8943
9154
|
asSha256Hex(String(value));
|
|
@@ -8947,8 +9158,20 @@ function validSha(value) {
|
|
|
8947
9158
|
}
|
|
8948
9159
|
}
|
|
8949
9160
|
function validateCompileUnitInventory(value) {
|
|
8950
|
-
|
|
8951
|
-
|
|
9161
|
+
let snapshot;
|
|
9162
|
+
try {
|
|
9163
|
+
snapshot = snapshotGpuContract(value, QUALIFICATION_GPU_CONTRACT_SNAPSHOT_LIMITS);
|
|
9164
|
+
} catch {
|
|
9165
|
+
return {
|
|
9166
|
+
ok: false,
|
|
9167
|
+
diagnostics: [issue2(
|
|
9168
|
+
"invalid-contract",
|
|
9169
|
+
"Compile-unit inventory must contain bounded detached JSON contract data."
|
|
9170
|
+
)]
|
|
9171
|
+
};
|
|
9172
|
+
}
|
|
9173
|
+
const envelope = object2(snapshot);
|
|
9174
|
+
const candidate = envelope && Object.hasOwn(envelope, "inventory") ? object2(snapshot.inventory) : envelope;
|
|
8952
9175
|
const diagnostics = [];
|
|
8953
9176
|
if (!candidate || !exactKeys(candidate, ["contractVersion", "fragments", "compileUnits"])) {
|
|
8954
9177
|
return { ok: false, diagnostics: [issue2("invalid-contract", "Compile-unit inventory has unknown or missing fields.")] };
|
|
@@ -9079,7 +9302,7 @@ function validateCompileUnitInventory(value) {
|
|
|
9079
9302
|
diagnostics.push(issue2("invalid-contract", cause instanceof Error ? cause.message : "Compile-unit pipelines are invalid.", `${path2}.pipelines`));
|
|
9080
9303
|
}
|
|
9081
9304
|
const interfaceRef2 = object2(unit.interfaceRef);
|
|
9082
|
-
if (!interfaceRef2 || !exactKeys(interfaceRef2, ["interfaceId", "interfaceVersion", "manifestUri", "manifestSha256", "interfaceAbiHash", "modelAbiHash"]) || !safeToken(interfaceRef2.interfaceId) || !
|
|
9305
|
+
if (!interfaceRef2 || !exactKeys(interfaceRef2, ["interfaceId", "interfaceVersion", "manifestUri", "manifestSha256", "interfaceAbiHash", "modelAbiHash"]) || !safeToken(interfaceRef2.interfaceId) || !immutableVersion2(interfaceRef2.interfaceVersion) || typeof interfaceRef2.manifestUri !== "string" || !interfaceRef2.manifestUri.startsWith("https://") || !validSha(interfaceRef2.manifestSha256) || !validSha(interfaceRef2.interfaceAbiHash) || !validSha(interfaceRef2.modelAbiHash)) {
|
|
9083
9306
|
diagnostics.push(issue2("invalid-contract", "Compile-unit interfaceRef is invalid.", `${path2}.interfaceRef`));
|
|
9084
9307
|
}
|
|
9085
9308
|
const fixture = object2(unit.qualificationFixture);
|
|
@@ -9090,7 +9313,7 @@ function validateCompileUnitInventory(value) {
|
|
|
9090
9313
|
for (const fragmentId of fragmentIds) {
|
|
9091
9314
|
if (!covered.has(fragmentId)) diagnostics.push(issue2("uncovered-fragment", `WGSL fragment ${fragmentId} has no compile unit.`));
|
|
9092
9315
|
}
|
|
9093
|
-
return diagnostics.length > 0 ? { ok: false, diagnostics } : { ok: true, value: candidate };
|
|
9316
|
+
return diagnostics.length > 0 ? { ok: false, diagnostics } : { ok: true, value: freezeJson(candidate) };
|
|
9094
9317
|
}
|
|
9095
9318
|
|
|
9096
9319
|
// src/testing/qualification-bundle.ts
|
|
@@ -9182,14 +9405,33 @@ function object3(value, path2) {
|
|
|
9182
9405
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${path2} must be an object.`);
|
|
9183
9406
|
return value;
|
|
9184
9407
|
}
|
|
9408
|
+
function detachedJson2(value, label) {
|
|
9409
|
+
try {
|
|
9410
|
+
return snapshotGpuContract(value, QUALIFICATION_GPU_CONTRACT_SNAPSHOT_LIMITS);
|
|
9411
|
+
} catch {
|
|
9412
|
+
throw new TypeError(`${label} must contain bounded detached JSON contract data.`);
|
|
9413
|
+
}
|
|
9414
|
+
}
|
|
9415
|
+
function freezeJson2(value) {
|
|
9416
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
9417
|
+
for (const child of Object.values(value)) freezeJson2(child);
|
|
9418
|
+
return Object.freeze(value);
|
|
9419
|
+
}
|
|
9185
9420
|
function exact2(value, keys, path2) {
|
|
9186
9421
|
const expected = new Set(keys);
|
|
9187
|
-
if (!Object.keys(value).every((key) => expected.has(key)) || !keys.every((key) => key
|
|
9422
|
+
if (!Object.keys(value).every((key) => expected.has(key)) || !keys.every((key) => Object.hasOwn(value, key))) throw new TypeError(`${path2} has unknown or missing fields.`);
|
|
9188
9423
|
}
|
|
9189
9424
|
function token2(value, path2) {
|
|
9190
9425
|
if (typeof value !== "string" || !TOKEN.test(value) || value.includes("..")) throw new TypeError(`${path2} must be a safe token.`);
|
|
9191
9426
|
return value;
|
|
9192
9427
|
}
|
|
9428
|
+
function immutableVersion3(value, path2) {
|
|
9429
|
+
try {
|
|
9430
|
+
return assertImmutableAssetVersion(value);
|
|
9431
|
+
} catch {
|
|
9432
|
+
throw new TypeError(`${path2} must be an immutable asset version: exact token required; mutable aliases, ranges, wildcards, and URLs are not allowed.`);
|
|
9433
|
+
}
|
|
9434
|
+
}
|
|
9193
9435
|
function path(value, label, extensions) {
|
|
9194
9436
|
if (typeof value !== "string" || !SAFE_PATH2.test(value) || !extensions.some((extension) => value.endsWith(extension))) {
|
|
9195
9437
|
throw new TypeError(`${label} must be a safe data-only bundle path (${extensions.join(", ")}).`);
|
|
@@ -9199,8 +9441,8 @@ function path(value, label, extensions) {
|
|
|
9199
9441
|
function sha(value, label) {
|
|
9200
9442
|
try {
|
|
9201
9443
|
return asSha256Hex(String(value));
|
|
9202
|
-
} catch
|
|
9203
|
-
throw new TypeError(`${label} must be a lowercase SHA-256 digest
|
|
9444
|
+
} catch {
|
|
9445
|
+
throw new TypeError(`${label} must be a lowercase SHA-256 digest.`);
|
|
9204
9446
|
}
|
|
9205
9447
|
}
|
|
9206
9448
|
function integer4(value, label, minimum = 0, maximum = 4294967295) {
|
|
@@ -9324,7 +9566,8 @@ function jsonValue(value, label, depth = 0) {
|
|
|
9324
9566
|
}
|
|
9325
9567
|
function validateQualificationFixture(value, unit) {
|
|
9326
9568
|
try {
|
|
9327
|
-
const
|
|
9569
|
+
const compileUnit = unit === void 0 ? void 0 : detachedJson2(unit, "compile unit");
|
|
9570
|
+
const fixture = object3(detachedJson2(value, "fixture"), "fixture");
|
|
9328
9571
|
exact2(fixture, ["contractVersion", "fixtureId", "resources", "bindGroups", "commands", "layoutProbes", "readbacks", "bounds"], "fixture");
|
|
9329
9572
|
if (fixture.contractVersion !== SHADER_QUALIFICATION_FIXTURE_VERSION) throw new TypeError("Unsupported qualification fixture version.");
|
|
9330
9573
|
token2(fixture.fixtureId, "fixture.fixtureId");
|
|
@@ -9454,14 +9697,14 @@ function validateQualificationFixture(value, unit) {
|
|
|
9454
9697
|
unique2(bindingIds, `${label}.entries`);
|
|
9455
9698
|
bindGroups.set(id, { group: groupIndex, entries: parsedEntries });
|
|
9456
9699
|
}
|
|
9457
|
-
const pipelines = new Map(
|
|
9700
|
+
const pipelines = new Map(compileUnit?.pipelines.map((pipeline2) => [pipeline2.pipelineId, pipeline2]) ?? []);
|
|
9458
9701
|
const pipelineIds = new Set(pipelines.keys());
|
|
9459
9702
|
const commandBindGroups = (value2, pipelineId, label) => {
|
|
9460
9703
|
const ids = boundedArray(value2, label, 32).map((item, index) => token2(item, `${label}[${index}]`));
|
|
9461
9704
|
unique2(ids, label);
|
|
9462
9705
|
const pipeline2 = pipelines.get(pipelineId);
|
|
9463
9706
|
if (!pipeline2) {
|
|
9464
|
-
if (
|
|
9707
|
+
if (compileUnit) throw new TypeError(`${label} pipeline is missing.`);
|
|
9465
9708
|
return;
|
|
9466
9709
|
}
|
|
9467
9710
|
const expectedGroups = [...pipeline2.layout.bindGroups].sort((left, right) => left.group - right.group);
|
|
@@ -9486,7 +9729,7 @@ function validateQualificationFixture(value, unit) {
|
|
|
9486
9729
|
executionCommands += 1;
|
|
9487
9730
|
exact2(command, ["kind", "pipelineId", "bindGroupIds", "workgroups"], label);
|
|
9488
9731
|
const id = token2(command.pipelineId, `${label}.pipelineId`);
|
|
9489
|
-
if (
|
|
9732
|
+
if (compileUnit && pipelines.get(id)?.kind !== "compute") throw new TypeError(`${label} references a missing or non-compute pipeline.`);
|
|
9490
9733
|
commandBindGroups(command.bindGroupIds, id, `${label}.bindGroupIds`);
|
|
9491
9734
|
const workgroups = tuple(command.workgroups, `${label}.workgroups`, 3, 1);
|
|
9492
9735
|
if (workgroups[0] * workgroups[1] * workgroups[2] > 1048576) throw new TypeError(`${label}.workgroups exceeds the hard dispatch bound.`);
|
|
@@ -9660,14 +9903,14 @@ function validateQualificationFixture(value, unit) {
|
|
|
9660
9903
|
}
|
|
9661
9904
|
unique2(probeIds, "fixture.layoutProbes probe IDs");
|
|
9662
9905
|
unique2(probeSources, "fixture.layoutProbes model sources");
|
|
9663
|
-
return { ok: true, value: fixture };
|
|
9906
|
+
return { ok: true, value: freezeJson2(fixture) };
|
|
9664
9907
|
} catch (cause) {
|
|
9665
9908
|
return { ok: false, diagnostics: [{ code: "invalid-contract", severity: "error", message: cause instanceof Error ? cause.message : "Invalid qualification fixture." }] };
|
|
9666
9909
|
}
|
|
9667
9910
|
}
|
|
9668
9911
|
function validateQualificationBundleManifest(value) {
|
|
9669
9912
|
try {
|
|
9670
|
-
const bundle = object3(value, "qualification");
|
|
9913
|
+
const bundle = object3(detachedJson2(value, "qualification"), "qualification");
|
|
9671
9914
|
exact2(bundle, ["contractVersion", "inventory", "subject", "shaderManifestCorePath", "gpuInterfaceManifest", "modelCompatibilityFixtures", "modules", "fixtures"], "qualification");
|
|
9672
9915
|
if (bundle.contractVersion !== SHADER_QUALIFICATION_BUNDLE_VERSION) throw new TypeError("Unsupported qualification bundle version.");
|
|
9673
9916
|
const inventory = validateCompileUnitInventory(bundle.inventory);
|
|
@@ -9677,7 +9920,7 @@ function validateQualificationBundleManifest(value) {
|
|
|
9677
9920
|
const candidate = object3(subject.shaderManifestCore, "qualification.subject.shaderManifestCore");
|
|
9678
9921
|
exact2(candidate, ["shaderId", "version", "sha256"], "qualification.subject.shaderManifestCore");
|
|
9679
9922
|
token2(candidate.shaderId, "qualification.subject.shaderManifestCore.shaderId");
|
|
9680
|
-
|
|
9923
|
+
immutableVersion3(candidate.version, "qualification.subject.shaderManifestCore.version");
|
|
9681
9924
|
sha(candidate.sha256, "qualification.subject.shaderManifestCore.sha256");
|
|
9682
9925
|
path(bundle.shaderManifestCorePath, "qualification.shaderManifestCorePath", [".json"]);
|
|
9683
9926
|
const interfaceManifest = object3(bundle.gpuInterfaceManifest, "qualification.gpuInterfaceManifest");
|
|
@@ -9737,7 +9980,7 @@ function validateQualificationBundleManifest(value) {
|
|
|
9737
9980
|
const expectedUnits = [...inventory.value.compileUnits.map((unit) => unit.compileUnitId)].sort();
|
|
9738
9981
|
if (unitIds.join("\n") !== expectedUnits.join("\n")) throw new TypeError("Subject compile-unit IDs differ from inventory.");
|
|
9739
9982
|
orderedUniqueTokens(subject.requiredCellIds, "qualification.subject.requiredCellIds");
|
|
9740
|
-
return { ok: true, value: bundle };
|
|
9983
|
+
return { ok: true, value: freezeJson2(bundle) };
|
|
9741
9984
|
} catch (cause) {
|
|
9742
9985
|
return { ok: false, diagnostics: [{ code: "invalid-contract", severity: "error", message: cause instanceof Error ? cause.message : "Invalid qualification bundle." }] };
|
|
9743
9986
|
}
|