@forgeax/engine-rhi 0.1.20 → 0.1.23

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/dist/index.mjs CHANGED
@@ -51,6 +51,81 @@ function validateDrawArgs(worldCount, owner) {
51
51
  return ok(void 0);
52
52
  }
53
53
 
54
+ // src/capability/texture-format.ts
55
+ var R32FLOAT_MIP_SAMPLED_STORAGE_PROFILE = "r32float-mip-sampled-storage";
56
+ var R32FLOAT_PROBE_STAGES = [
57
+ "texture-create",
58
+ "mip-view",
59
+ "sampled-storage-bind-group",
60
+ "pipeline-bind",
61
+ "finish",
62
+ "submit",
63
+ "completion",
64
+ "readback"
65
+ ];
66
+ function createUnavailableR32FloatReceipt(options) {
67
+ const failureIndex = R32FLOAT_PROBE_STAGES.indexOf(options.failedStage);
68
+ const evidence = options.evidence ?? "real";
69
+ return {
70
+ profile: R32FLOAT_MIP_SAMPLED_STORAGE_PROFILE,
71
+ verdict: "unavailable",
72
+ evidence,
73
+ deviceGeneration: options.deviceGeneration,
74
+ stages: R32FLOAT_PROBE_STAGES.map((stage, index) => ({
75
+ stage,
76
+ verdict: index < failureIndex ? "admitted" : "unavailable",
77
+ evidence,
78
+ ...stage === options.failedStage ? { detail: options.detail } : {}
79
+ })),
80
+ sampleType: "unfilterable-float",
81
+ usages: ["texture-binding", "storage-binding", "copy-src"],
82
+ probeExecutions: 1
83
+ };
84
+ }
85
+ function validateR32FloatReceipt(receipt) {
86
+ const missing = R32FLOAT_PROBE_STAGES.find(
87
+ (stage) => !receipt.stages.some((entry) => entry.stage === stage)
88
+ );
89
+ if (missing !== void 0) {
90
+ return unavailable(receipt, missing, `required stage ${missing} is missing`);
91
+ }
92
+ if (receipt.profile !== R32FLOAT_MIP_SAMPLED_STORAGE_PROFILE) {
93
+ return unavailable(receipt, "texture-create", "profile is not the closed r32float profile");
94
+ }
95
+ if (receipt.sampleType !== "unfilterable-float") {
96
+ return unavailable(
97
+ receipt,
98
+ "sampled-storage-bind-group",
99
+ "sample type must be unfilterable-float"
100
+ );
101
+ }
102
+ if (receipt.usages.length !== 3 || receipt.usages[0] !== "texture-binding" || receipt.usages[1] !== "storage-binding" || receipt.usages[2] !== "copy-src") {
103
+ return unavailable(
104
+ receipt,
105
+ "sampled-storage-bind-group",
106
+ "sampled, storage, and readback usages are required"
107
+ );
108
+ }
109
+ if (receipt.verdict === "admitted" && receipt.readback === void 0) {
110
+ return unavailable(receipt, "readback", "admitted profiles require real readback evidence");
111
+ }
112
+ return ok(receipt);
113
+ }
114
+ function unavailable(receipt, stage, detail) {
115
+ return err(
116
+ new RhiError({
117
+ code: "rhi-texture-format-capability-unavailable",
118
+ expected: `r32float profile stage ${stage} to be complete`,
119
+ hint: "retain fallback-only rendering and retry the owner-owned device probe",
120
+ detail: {
121
+ stage,
122
+ deviceGeneration: receipt.deviceGeneration,
123
+ reason: detail
124
+ }
125
+ })
126
+ );
127
+ }
128
+
54
129
  // src/index.ts
55
130
  function cubeArrayDepthDescriptor(faceSize = 512, layers = 4, usage = GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING) {
56
131
  return {
@@ -82,6 +157,6 @@ function cubeArrayDepthFaceView(layerIndex, faceIndex) {
82
157
  };
83
158
  }
84
159
 
85
- export { RhiError, comparisonSamplerDescriptor, cubeArrayDepthDescriptor, cubeArrayDepthFaceView, validateDrawArgs };
160
+ export { R32FLOAT_MIP_SAMPLED_STORAGE_PROFILE, R32FLOAT_PROBE_STAGES, RhiError, comparisonSamplerDescriptor, createUnavailableR32FloatReceipt, cubeArrayDepthDescriptor, cubeArrayDepthFaceView, validateDrawArgs, validateR32FloatReceipt };
86
161
  //# sourceMappingURL=index.mjs.map
87
162
  //# sourceMappingURL=index.mjs.map