@forgeax/engine-render-graph 0.1.28 → 0.1.30
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 +9 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/index.mjs +16 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/render-graph-builder.unit.test.ts +65 -0
- package/src/builder.ts +18 -1
- package/src/types.ts +7 -0
package/README.md
CHANGED
|
@@ -85,14 +85,22 @@ Resource and pass labels are unique diagnostics. Handles are opaque and builder-
|
|
|
85
85
|
| `storage-read` | `storage-read` |
|
|
86
86
|
| `storage-write` | `storage-write` |
|
|
87
87
|
| `storage-read-write` | `storage-read-write` |
|
|
88
|
-
| `indirect-read` | `storage-read-write` |
|
|
88
|
+
| `indirect-read` | `sampled-storage-read-write` |
|
|
89
89
|
| `vertex-read` | `color-attachment` |
|
|
90
90
|
| `index-read` | `depth-stencil-read` |
|
|
91
91
|
| `copy-src` / `copy-dst` | `depth-stencil-write` |
|
|
92
92
|
| | `copy-src` / `copy-dst` |
|
|
93
|
+
| | `sampled-storage-write` |
|
|
93
94
|
|
|
94
95
|
A raster attachment with `loadOp: 'load'` is a read/write access. A clear attachment is the first write. The compiler checks overlapping texture mip/layer/aspect ranges rather than treating unrelated subresources as one hazard.
|
|
95
96
|
|
|
97
|
+
`sampled-storage-write` declares a compute chain that fully writes a subresource
|
|
98
|
+
before sampling it in a later dispatch of the same pass. It derives both texture
|
|
99
|
+
and storage bindings without consuming incoming contents. Use
|
|
100
|
+
`sampled-storage-read-write` when incoming contents are read. Each dispatch must
|
|
101
|
+
still use valid, disjoint read/write subresources; the graph does not synchronize
|
|
102
|
+
threads inside one dispatch.
|
|
103
|
+
|
|
96
104
|
### Pass declaration
|
|
97
105
|
|
|
98
106
|
| Method | Encoder ownership |
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAW,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAW,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrE,OAAO,KAAK,EACV,mBAAmB,EAGnB,gBAAgB,EAChB,aAAa,EAEb,WAAW,EAEX,qBAAqB,EAGrB,YAAY,EAEZ,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAW,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAW,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrE,OAAO,KAAK,EACV,mBAAmB,EAGnB,gBAAgB,EAChB,aAAa,EAEb,WAAW,EAEX,qBAAqB,EAGrB,YAAY,EAEZ,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AA0MpB,qBAAa,kBAAkB,CAAC,QAAQ,SAAS,gBAAgB;IAC/D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+C;IACzE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkD;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IAC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Q,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAI9F,OAAO,CACL,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAqI1D,OAAO,CAAC,OAAO;IAsBf,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,OAAO;IAsHf,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,eAAe;IAsBvB,OAAO,CAAC,oBAAoB;IAoE5B,OAAO,CAAC,mBAAmB;IA6B3B,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,mBAAmB;IA6E3B,OAAO,CAAC,QAAQ;IA6GhB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,kBAAkB;CAQ3B"}
|
package/dist/index.mjs
CHANGED
|
@@ -543,6 +543,7 @@ function textureUsage(access) {
|
|
|
543
543
|
case "storage-read-write":
|
|
544
544
|
return TEXTURE_USAGE.storageBinding;
|
|
545
545
|
case "sampled-storage-read-write":
|
|
546
|
+
case "sampled-storage-write":
|
|
546
547
|
return TEXTURE_USAGE.storageBinding | TEXTURE_USAGE.textureBinding;
|
|
547
548
|
case "color-attachment":
|
|
548
549
|
case "depth-stencil-read":
|
|
@@ -560,6 +561,7 @@ function accessMode(access) {
|
|
|
560
561
|
case "sampled-storage-read-write":
|
|
561
562
|
return { read: true, write: true };
|
|
562
563
|
case "storage-write":
|
|
564
|
+
case "sampled-storage-write":
|
|
563
565
|
case "color-attachment":
|
|
564
566
|
case "depth-stencil-write":
|
|
565
567
|
case "copy-dst":
|
|
@@ -1019,7 +1021,7 @@ var RenderGraphBuilder = class {
|
|
|
1019
1021
|
if ((access.usage === "storage-read" || access.usage === "storage-write" || access.usage === "storage-read-write") && handleData(access.resource)?.kind === "buffer" && !caps.storageBuffer) {
|
|
1020
1022
|
return this.capabilityError(pass.name, "storage-buffer", access);
|
|
1021
1023
|
}
|
|
1022
|
-
if ((access.usage === "storage-read" || access.usage === "storage-write" || access.usage === "storage-read-write") && handleData(access.resource)?.kind === "texture-view" && !caps.storageTexture) {
|
|
1024
|
+
if ((access.usage === "storage-read" || access.usage === "storage-write" || access.usage === "storage-read-write" || access.usage === "sampled-storage-read-write" || access.usage === "sampled-storage-write") && handleData(access.resource)?.kind === "texture-view" && !caps.storageTexture) {
|
|
1023
1025
|
return this.capabilityError(pass.name, "storage-texture", access);
|
|
1024
1026
|
}
|
|
1025
1027
|
if (access.usage === "indirect-read" && !caps.indirectDrawing) {
|
|
@@ -1070,6 +1072,19 @@ var RenderGraphBuilder = class {
|
|
|
1070
1072
|
);
|
|
1071
1073
|
}
|
|
1072
1074
|
}
|
|
1075
|
+
if (pass.pass.kind !== "compute") {
|
|
1076
|
+
const invalid = accesses.find((access) => access.usage === "sampled-storage-write");
|
|
1077
|
+
if (invalid !== void 0) {
|
|
1078
|
+
return err(
|
|
1079
|
+
new RenderGraphError({
|
|
1080
|
+
code: "access-conflict",
|
|
1081
|
+
expected: `pass '${pass.name}' uses ordered compute dispatches for sampled-storage-write`,
|
|
1082
|
+
hint: "move the write-then-sample chain into a compute pass",
|
|
1083
|
+
detail: { passName: pass.name, usage: invalid.usage }
|
|
1084
|
+
})
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1073
1088
|
if (pass.pass.kind === "copy") {
|
|
1074
1089
|
const invalid = accesses.find(
|
|
1075
1090
|
(access) => access.usage !== "copy-src" && access.usage !== "copy-dst"
|