@woosh/meep-engine 2.111.10 → 2.111.12
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/package.json +1 -1
- package/src/engine/graphics/render/frame_graph/IRenderContext.d.ts +10 -9
- package/src/engine/graphics/render/frame_graph/IRenderContext.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/IRenderContext.js +10 -10
- package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts +11 -3
- package/src/engine/graphics/render/frame_graph/RenderGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.js +35 -3
- package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.d.ts +6 -17
- package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.js +13 -13
- package/src/engine/graphics/render/frame_graph/RenderPass.d.ts +10 -1
- package/src/engine/graphics/render/frame_graph/RenderPass.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/RenderPass.js +13 -1
- package/src/engine/graphics/render/frame_graph/RenderPassNode.d.ts +2 -2
- package/src/engine/graphics/render/frame_graph/RenderPassNode.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/RenderPassNode.js +2 -2
- package/src/engine/graphics/render/frame_graph/ResourceEntry.d.ts +18 -10
- package/src/engine/graphics/render/frame_graph/ResourceEntry.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/ResourceEntry.js +20 -10
- package/src/engine/graphics/render/frame_graph/ResourceNode.d.ts +7 -3
- package/src/engine/graphics/render/frame_graph/ResourceNode.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/ResourceNode.js +4 -1
- package/src/engine/graphics/render/frame_graph/backend/void/VoidRenderContext.d.ts +11 -0
- package/src/engine/graphics/render/frame_graph/backend/void/VoidRenderContext.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/backend/void/VoidRenderContext.js +16 -0
- package/src/engine/graphics/render/frame_graph/resource/RenderResourceManager.d.ts +16 -0
- package/src/engine/graphics/render/frame_graph/resource/RenderResourceManager.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/resource/RenderResourceManager.js +78 -0
- package/src/engine/graphics/render/frame_graph/resource/RenderTarget.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/resource/ResourceDescriptor.d.ts +24 -0
- package/src/engine/graphics/render/frame_graph/resource/ResourceDescriptor.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/resource/ResourceDescriptor.js +37 -0
- package/src/engine/graphics/render/frame_graph/{TextureDescriptor.d.ts → resource/TextureDescriptor.d.ts} +3 -3
- package/src/engine/graphics/render/frame_graph/resource/TextureDescriptor.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/{TextureDescriptor.js → resource/TextureDescriptor.js} +18 -4
- package/src/engine/graphics/render/frame_graph/resource/TextureInitialState.d.ts.map +1 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js +1 -1
- package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +1 -1
- package/src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js +3 -3
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.d.ts +3 -1
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +24 -1
- package/src/engine/graphics/render/frame_graph/RenderTarget.d.ts.map +0 -1
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.d.ts +0 -16
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.d.ts.map +0 -1
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +0 -57
- package/src/engine/graphics/render/frame_graph/TextureDescriptor.d.ts.map +0 -1
- package/src/engine/graphics/render/frame_graph/TextureInitialState.d.ts.map +0 -1
- /package/src/engine/graphics/render/frame_graph/{RenderTarget.d.ts → resource/RenderTarget.d.ts} +0 -0
- /package/src/engine/graphics/render/frame_graph/{RenderTarget.js → resource/RenderTarget.js} +0 -0
- /package/src/engine/graphics/render/frame_graph/{TextureInitialState.d.ts → resource/TextureInitialState.d.ts} +0 -0
- /package/src/engine/graphics/render/frame_graph/{TextureInitialState.js → resource/TextureInitialState.js} +0 -0
package/package.json
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
* Abstracts rendering context, such as "WebGLRenderer" in THREE.js or WebGL/WebGPU
|
|
3
3
|
*/
|
|
4
4
|
export class IRenderContext {
|
|
5
|
-
resource_manager:
|
|
5
|
+
resource_manager: RenderResourceManager;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {
|
|
9
|
-
* @returns {
|
|
7
|
+
* @template T
|
|
8
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
9
|
+
* @returns {T}
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
createResource<T>(descriptor: ResourceDescriptor<T>): T;
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
14
|
+
* @template T
|
|
15
|
+
* @param {T} resource
|
|
16
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
destroyResource<T_1>(resource: T_1, descriptor: ResourceDescriptor<T_1>): void;
|
|
18
19
|
destroy(): void;
|
|
19
20
|
}
|
|
20
|
-
import {
|
|
21
|
+
import { RenderResourceManager } from "./resource/RenderResourceManager.js";
|
|
21
22
|
//# sourceMappingURL=IRenderContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRenderContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/IRenderContext.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAEI,
|
|
1
|
+
{"version":3,"file":"IRenderContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/IRenderContext.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAEI,wCAA+C;IAM/C;;;;OAIG;IACH,wDAEC;IAED;;;;;OAKG;IACH,+EAEC;IAED,gBAEC;CACJ;sCAnCqC,qCAAqC"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { RenderResourceManager } from "./resource/RenderResourceManager.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Abstracts rendering context, such as "WebGLRenderer" in THREE.js or WebGL/WebGPU
|
|
7
7
|
*/
|
|
8
8
|
export class IRenderContext {
|
|
9
9
|
|
|
10
|
-
resource_manager = new
|
|
10
|
+
resource_manager = new RenderResourceManager();
|
|
11
11
|
|
|
12
12
|
constructor() {
|
|
13
13
|
this.resource_manager.attach(this);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param {
|
|
20
|
-
* @returns {
|
|
17
|
+
* @template T
|
|
18
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
19
|
+
* @returns {T}
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
createResource(descriptor) {
|
|
23
22
|
throw new Error('Not Implemented')
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
*
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {T} resource
|
|
29
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
destroyResource(resource, descriptor) {
|
|
32
32
|
throw new Error('Not Implemented')
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ export class RenderGraph {
|
|
|
38
38
|
* @param {number} id
|
|
39
39
|
* @returns {ResourceNode}
|
|
40
40
|
*/
|
|
41
|
-
getResourceNode(id: number): ResourceNode
|
|
41
|
+
getResourceNode(id: number): ResourceNode<any>;
|
|
42
42
|
/**
|
|
43
43
|
* @template T
|
|
44
44
|
* @param {number} id resource ID
|
|
@@ -75,11 +75,11 @@ export class RenderGraph {
|
|
|
75
75
|
/**
|
|
76
76
|
* @template T
|
|
77
77
|
* @param {string} name
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {ResourceDescriptor<T>} description
|
|
79
79
|
* @param {T} resource
|
|
80
80
|
* @returns {number}
|
|
81
81
|
*/
|
|
82
|
-
import_resource<T_2>(name: string, description:
|
|
82
|
+
import_resource<T_2>(name: string, description: ResourceDescriptor<T_2>, resource: T_2): number;
|
|
83
83
|
/**
|
|
84
84
|
* @returns {boolean}
|
|
85
85
|
* @param id
|
|
@@ -91,6 +91,14 @@ export class RenderGraph {
|
|
|
91
91
|
* @returns {T} resources/handles returned by {@link RenderPass#setup}
|
|
92
92
|
*/
|
|
93
93
|
add<T_3>(pass: RenderPass): T_3;
|
|
94
|
+
/**
|
|
95
|
+
* Perform validation, useful for debugging
|
|
96
|
+
* Typically done before compilation
|
|
97
|
+
* @param {function(problem:string):*} problem_consumer
|
|
98
|
+
* @param {*} [problem_consumer_context] thisArg for `problem_consumer`
|
|
99
|
+
* @returns {boolean}
|
|
100
|
+
*/
|
|
101
|
+
validate(problem_consumer: any, problem_consumer_context?: any): boolean;
|
|
94
102
|
compile(): void;
|
|
95
103
|
/**
|
|
96
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACI;;;;OAIG;IACH,iBAAc;IAEd;;;;OAIG;IACH,qBAAkB;IAElB;;;;OAIG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;OAIG;IACH,qBAHW,MAAM,
|
|
1
|
+
{"version":3,"file":"RenderGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraph.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACI;;;;OAIG;IACH,iBAAc;IAEd;;;;OAIG;IACH,qBAAkB;IAElB;;;;OAIG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAyB;IAEzB;;;;OAIG;IACH,qBAHW,MAAM,sBAahB;IAED;;;;OAIG;IACH,oBAHW,MAAM,qBAgBhB;IAED;;;;OAIG;IACH,qBAHW,MAAM,KAKhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,2BAOhB;IAED;;;;;OAKG;IACH,6BAUC;IAED;;;;;;OAMG;IACH,4BAcC;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;;OAMG;IACH,2BALW,MAAM,wDAGJ,MAAM,CAUlB;IAED;;;OAGG;IACH,4BAHa,OAAO,CAQnB;IAED;;;;OAIG;IACH,gCA0BC;IAED;;;;;;OAMG;IACH,iEAFa,OAAO,CAOnB;IAED,gBA0FC;IAED;;;OAGG;IACH,uCAqCC;IAED;;;OAGG;IACH,eAFY,MAAM,CAiEjB;CACJ;8BAnb6B,oBAAoB;6BACrB,mBAAmB"}
|
|
@@ -47,7 +47,13 @@ export class RenderGraph {
|
|
|
47
47
|
getResourceEntry(id) {
|
|
48
48
|
const node = this.getResourceNode(id);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const registry = this.__resource_registry;
|
|
51
|
+
|
|
52
|
+
const entry = registry[node.resource_id];
|
|
53
|
+
|
|
54
|
+
assert.defined(entry, 'entry');
|
|
55
|
+
|
|
56
|
+
return entry;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
/**
|
|
@@ -157,7 +163,7 @@ export class RenderGraph {
|
|
|
157
163
|
/**
|
|
158
164
|
* @template T
|
|
159
165
|
* @param {string} name
|
|
160
|
-
* @param {
|
|
166
|
+
* @param {ResourceDescriptor<T>} description
|
|
161
167
|
* @param {T} resource
|
|
162
168
|
* @returns {number}
|
|
163
169
|
*/
|
|
@@ -204,6 +210,10 @@ export class RenderGraph {
|
|
|
204
210
|
|
|
205
211
|
const result = pass.setup(builder, pass.inputs);
|
|
206
212
|
|
|
213
|
+
assert.defined(result, 'result');
|
|
214
|
+
assert.notNull(result, 'result');
|
|
215
|
+
assert.isObject(result, 'result');
|
|
216
|
+
|
|
207
217
|
this.__passes.push(pass);
|
|
208
218
|
|
|
209
219
|
node.data = result;
|
|
@@ -211,6 +221,20 @@ export class RenderGraph {
|
|
|
211
221
|
return result;
|
|
212
222
|
}
|
|
213
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Perform validation, useful for debugging
|
|
226
|
+
* Typically done before compilation
|
|
227
|
+
* @param {function(problem:string):*} problem_consumer
|
|
228
|
+
* @param {*} [problem_consumer_context] thisArg for `problem_consumer`
|
|
229
|
+
* @returns {boolean}
|
|
230
|
+
*/
|
|
231
|
+
validate(problem_consumer, problem_consumer_context) {
|
|
232
|
+
|
|
233
|
+
// TODO implement
|
|
234
|
+
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
214
238
|
compile() {
|
|
215
239
|
const pass_nodes = this.__pass_nodes;
|
|
216
240
|
|
|
@@ -308,8 +332,13 @@ export class RenderGraph {
|
|
|
308
332
|
* @param {IRenderContext} context
|
|
309
333
|
*/
|
|
310
334
|
execute(context) {
|
|
335
|
+
assert.defined(context, 'context');
|
|
336
|
+
assert.notNull(context, 'context');
|
|
337
|
+
assert.isObject(context, 'context');
|
|
338
|
+
|
|
311
339
|
const pass_nodes = this.__pass_nodes;
|
|
312
340
|
const pass_node_count = pass_nodes.length;
|
|
341
|
+
|
|
313
342
|
for (let i = 0; i < pass_node_count; i++) {
|
|
314
343
|
const node = pass_nodes[i];
|
|
315
344
|
|
|
@@ -317,7 +346,10 @@ export class RenderGraph {
|
|
|
317
346
|
continue;
|
|
318
347
|
}
|
|
319
348
|
|
|
320
|
-
|
|
349
|
+
const node_created_resources = node.resource_creates;
|
|
350
|
+
|
|
351
|
+
for (const id of node_created_resources) {
|
|
352
|
+
|
|
321
353
|
// allocate resource
|
|
322
354
|
this.getResourceEntry(id).create(context.resource_manager);
|
|
323
355
|
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
export class RenderGraphBuilder {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @type {RenderGraph}
|
|
5
|
-
* @private
|
|
6
|
-
*/
|
|
7
|
-
private __graph;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @type {RenderPassNode}
|
|
11
|
-
* @private
|
|
12
|
-
*/
|
|
13
|
-
private __node;
|
|
14
2
|
/**
|
|
15
3
|
*
|
|
16
4
|
* @param {RenderGraph} graph
|
|
@@ -18,23 +6,24 @@ export class RenderGraphBuilder {
|
|
|
18
6
|
*/
|
|
19
7
|
init(graph: RenderGraph, node: RenderPassNode): void;
|
|
20
8
|
/**
|
|
21
|
-
*
|
|
9
|
+
* Create a new resource
|
|
22
10
|
* @param {string} name
|
|
23
|
-
* @param {
|
|
11
|
+
* @param {ResourceDescriptor} descriptor
|
|
24
12
|
* @returns {number} resource ID
|
|
25
13
|
*/
|
|
26
|
-
create(name: string, descriptor:
|
|
14
|
+
create(name: string, descriptor: ResourceDescriptor): number;
|
|
27
15
|
/**
|
|
28
|
-
*
|
|
16
|
+
* Read an existing resource
|
|
29
17
|
* @param {number} resource
|
|
30
18
|
* @returns {number}
|
|
31
19
|
*/
|
|
32
20
|
read(resource: number): number;
|
|
33
21
|
/**
|
|
34
|
-
*
|
|
22
|
+
* Write a resource
|
|
35
23
|
* @param {number} resource
|
|
36
24
|
* @returns {number}
|
|
37
25
|
*/
|
|
38
26
|
write(resource: number): number;
|
|
27
|
+
#private;
|
|
39
28
|
}
|
|
40
29
|
//# sourceMappingURL=RenderGraphBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderGraphBuilder.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraphBuilder.js"],"names":[],"mappings":"AAEA;
|
|
1
|
+
{"version":3,"file":"RenderGraphBuilder.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderGraphBuilder.js"],"names":[],"mappings":"AAEA;IAcI;;;;OAIG;IACH,qDAGC;IAED;;;;;OAKG;IACH,aAJW,MAAM,mCAEJ,MAAM,CASlB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,MAAM,CAoBlB;;CACJ"}
|
|
@@ -6,13 +6,13 @@ export class RenderGraphBuilder {
|
|
|
6
6
|
* @type {RenderGraph}
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
#graph = null;
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @type {RenderPassNode}
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
#node = null;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
@@ -20,44 +20,44 @@ export class RenderGraphBuilder {
|
|
|
20
20
|
* @param {RenderPassNode} node
|
|
21
21
|
*/
|
|
22
22
|
init(graph, node) {
|
|
23
|
-
this
|
|
24
|
-
this
|
|
23
|
+
this.#graph = graph;
|
|
24
|
+
this.#node = node;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Create a new resource
|
|
29
29
|
* @param {string} name
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {ResourceDescriptor} descriptor
|
|
31
31
|
* @returns {number} resource ID
|
|
32
32
|
*/
|
|
33
33
|
create(name, descriptor) {
|
|
34
|
-
const node = this.
|
|
34
|
+
const node = this.#graph.create_resource(name, descriptor);
|
|
35
35
|
|
|
36
36
|
// remember resource
|
|
37
|
-
this.
|
|
37
|
+
this.#node.resource_creates.push(node);
|
|
38
38
|
|
|
39
39
|
return node;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Read an existing resource
|
|
44
44
|
* @param {number} resource
|
|
45
45
|
* @returns {number}
|
|
46
46
|
*/
|
|
47
47
|
read(resource) {
|
|
48
48
|
assert.isNonNegativeInteger(resource, 'resource');
|
|
49
49
|
|
|
50
|
-
return this.
|
|
50
|
+
return this.#node.read(resource);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Write a resource
|
|
55
55
|
* @param {number} resource
|
|
56
56
|
* @returns {number}
|
|
57
57
|
*/
|
|
58
58
|
write(resource) {
|
|
59
|
-
const graph = this
|
|
60
|
-
const node = this
|
|
59
|
+
const graph = this.#graph;
|
|
60
|
+
const node = this.#node;
|
|
61
61
|
|
|
62
62
|
if (graph.getResourceEntry(resource).isImported()) {
|
|
63
63
|
// comes from outside the graph, and we write to it. That's a side effect
|
|
@@ -22,14 +22,23 @@ export class RenderPass<DATA> {
|
|
|
22
22
|
*
|
|
23
23
|
* @param {RenderGraphBuilder} builder
|
|
24
24
|
* @param {Object<number>} inputs
|
|
25
|
-
* @returns {Object<number>}
|
|
25
|
+
* @returns {Object<number>} resources/handles that are used by the pass, includes both inputs and outputs
|
|
26
26
|
*/
|
|
27
27
|
setup(builder: RenderGraphBuilder, inputs: any): any;
|
|
28
28
|
/**
|
|
29
29
|
* @param {DATA} data
|
|
30
30
|
* @param {RenderPassResources} resources
|
|
31
31
|
* @param {IRenderContext} render_context
|
|
32
|
+
* @returns {void}
|
|
32
33
|
*/
|
|
33
34
|
execute(data: DATA, resources: RenderPassResources, render_context: IRenderContext): void;
|
|
35
|
+
/**
|
|
36
|
+
* Validate render pass internal structure
|
|
37
|
+
* This is an optional method, mainly useful for debugging purposes
|
|
38
|
+
* Default behaviour is to report pass as "valid" (true)
|
|
39
|
+
* @param {function(problem:string)} problem_consumer when returning false, reasons are supplied here
|
|
40
|
+
* @return {boolean} true for valid, false for invalid
|
|
41
|
+
*/
|
|
42
|
+
validate(problem_consumer: any): boolean;
|
|
34
43
|
}
|
|
35
44
|
//# sourceMappingURL=RenderPass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderPass.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPass.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAqBI,yBAEC;IArBD;;;OAGG;IACH,MAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,OAFU,MAAM,kBAAgB,CAEV;IAGtB;;;OAGG;IACH,YAAY;IAOZ;;;;;OAKG;IACH,qDAEC;IAED
|
|
1
|
+
{"version":3,"file":"RenderPass.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPass.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAqBI,yBAEC;IArBD;;;OAGG;IACH,MAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,OAFU,MAAM,kBAAgB,CAEV;IAGtB;;;OAGG;IACH,YAAY;IAOZ;;;;;OAKG;IACH,qDAEC;IAED;;;;;OAKG;IACH,cALW,IAAI,mEAGF,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,iCAFY,OAAO,CAIlB;CACJ"}
|
|
@@ -33,7 +33,7 @@ export class RenderPass {
|
|
|
33
33
|
*
|
|
34
34
|
* @param {RenderGraphBuilder} builder
|
|
35
35
|
* @param {Object<number>} inputs
|
|
36
|
-
* @returns {Object<number>}
|
|
36
|
+
* @returns {Object<number>} resources/handles that are used by the pass, includes both inputs and outputs
|
|
37
37
|
*/
|
|
38
38
|
setup(builder, inputs) {
|
|
39
39
|
throw new Error('Not Implemented');
|
|
@@ -43,8 +43,20 @@ export class RenderPass {
|
|
|
43
43
|
* @param {DATA} data
|
|
44
44
|
* @param {RenderPassResources} resources
|
|
45
45
|
* @param {IRenderContext} render_context
|
|
46
|
+
* @returns {void}
|
|
46
47
|
*/
|
|
47
48
|
execute(data, resources, render_context) {
|
|
48
49
|
throw new Error('Not Implemented');
|
|
49
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Validate render pass internal structure
|
|
54
|
+
* This is an optional method, mainly useful for debugging purposes
|
|
55
|
+
* Default behaviour is to report pass as "valid" (true)
|
|
56
|
+
* @param {function(problem:string)} problem_consumer when returning false, reasons are supplied here
|
|
57
|
+
* @return {boolean} true for valid, false for invalid
|
|
58
|
+
*/
|
|
59
|
+
validate(problem_consumer) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
50
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderPassNode.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPassNode.js"],"names":[],"mappings":"AAGA;IACI;;;OAGG;IACH,MAFU,aAAW,IAAI,CAEb;IAGZ;;;OAGG;IACH,kBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"RenderPassNode.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderPassNode.js"],"names":[],"mappings":"AAGA;IACI;;;OAGG;IACH,MAFU,aAAW,IAAI,CAEb;IAGZ;;;OAGG;IACH,kBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,UAAU;IAEV;;;OAGG;IACH,kBAFU,MAAM,EAAE,CAEI;IACtB;;;OAGG;IACH,gBAFU,MAAM,EAAE,CAEE;IACpB;;;OAGG;IACH,iBAFU,MAAM,EAAE,CAEG;IAErB;;;;OAIG;IACH,YAHW,MAAM,GACL,OAAO,CAMlB;IAED;;;;OAIG;IACH,UAHW,MAAM,GACL,OAAO,CAMlB;IAED;;;;OAIG;IACH,WAHW,MAAM,GACL,OAAO,CAMlB;IAED,0BAOC;IAED;;;OAGG;IACH,eAFW,MAAM,UAUhB;IAED;;;OAGG;IACH,eAFY,OAAO,CAIlB;CACJ;0BArGyB,gBAAgB"}
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* @template T
|
|
3
3
|
*/
|
|
4
4
|
export class ResourceEntry<T> {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
5
9
|
resource_id: number;
|
|
6
10
|
/**
|
|
7
11
|
*
|
|
8
|
-
* @type {
|
|
12
|
+
* @type {ResourceDescriptor<T>|null}
|
|
13
|
+
*/
|
|
14
|
+
resource_descriptor: ResourceDescriptor<T> | null;
|
|
15
|
+
/**
|
|
16
|
+
* Every time resource is modified - version increases
|
|
17
|
+
* @type {number}
|
|
9
18
|
*/
|
|
10
|
-
resource_descriptor: TextureDescriptor | null;
|
|
11
19
|
resource_version: number;
|
|
12
20
|
/**
|
|
13
21
|
* Actual resource handle
|
|
@@ -15,12 +23,13 @@ export class ResourceEntry<T> {
|
|
|
15
23
|
*/
|
|
16
24
|
resource: T | null;
|
|
17
25
|
/**
|
|
18
|
-
* Imported or transient resource
|
|
26
|
+
* Imported or transient resource.
|
|
27
|
+
* Transient resource only exists in the graph, it will be reclaimed once the execution is done
|
|
19
28
|
* @type {boolean}
|
|
20
29
|
*/
|
|
21
30
|
imported: boolean;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
32
|
+
* Node that created this resource
|
|
24
33
|
* @type {RenderPassNode|null}
|
|
25
34
|
*/
|
|
26
35
|
producer: RenderPassNode | null;
|
|
@@ -31,17 +40,16 @@ export class ResourceEntry<T> {
|
|
|
31
40
|
last: RenderPassNode | null;
|
|
32
41
|
/**
|
|
33
42
|
* Creates actual resource
|
|
34
|
-
* @param {
|
|
43
|
+
* @param {RenderResourceManager} resources
|
|
35
44
|
*/
|
|
36
|
-
create(resources:
|
|
45
|
+
create(resources: RenderResourceManager): void;
|
|
37
46
|
/**
|
|
38
47
|
* De-allocated memory for the resource
|
|
39
|
-
* @param {
|
|
48
|
+
* @param {RenderResourceManager} resources
|
|
40
49
|
*/
|
|
41
|
-
destroy(resources:
|
|
50
|
+
destroy(resources: RenderResourceManager): void;
|
|
42
51
|
isImported(): boolean;
|
|
43
52
|
isTransient(): boolean;
|
|
44
|
-
toString():
|
|
53
|
+
toString(): any;
|
|
45
54
|
}
|
|
46
|
-
import { TextureDescriptor } from "./TextureDescriptor.js";
|
|
47
55
|
//# sourceMappingURL=ResourceEntry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceEntry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/ResourceEntry.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResourceEntry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/ResourceEntry.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACI;;;OAGG;IACH,aAFU,MAAM,CAEW;IAE3B;;;OAGG;IACH,qBAFU,wBAAsB,IAAI,CAET;IAE3B;;;OAGG;IACH,kBAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,UAFU,CAAC,GAAC,IAAI,CAEA;IAEhB;;;;OAIG;IACH,UAFU,OAAO,CAEA;IAEjB;;;OAGG;IACH,UAFU,iBAAe,IAAI,CAEb;IAEhB;;;OAGG;IACH,MAFU,iBAAe,IAAI,CAEjB;IAEZ;;;OAGG;IACH,+CAIC;IAED;;;OAGG;IACH,gDAIC;IAED,sBAEC;IAED,uBAEC;IAED,gBAQC;CACJ"}
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
let id_counter = 0;
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @template T
|
|
6
7
|
*/
|
|
7
8
|
export class ResourceEntry {
|
|
8
|
-
resource_id = 0;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* @type {
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
resource_id = id_counter++;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @type {ResourceDescriptor<T>|null}
|
|
12
18
|
*/
|
|
13
19
|
resource_descriptor = null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Every time resource is modified - version increases
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
14
25
|
resource_version = 0;
|
|
15
26
|
|
|
16
27
|
/**
|
|
@@ -20,13 +31,14 @@ export class ResourceEntry {
|
|
|
20
31
|
resource = null;
|
|
21
32
|
|
|
22
33
|
/**
|
|
23
|
-
* Imported or transient resource
|
|
34
|
+
* Imported or transient resource.
|
|
35
|
+
* Transient resource only exists in the graph, it will be reclaimed once the execution is done
|
|
24
36
|
* @type {boolean}
|
|
25
37
|
*/
|
|
26
38
|
imported = false;
|
|
27
39
|
|
|
28
40
|
/**
|
|
29
|
-
*
|
|
41
|
+
* Node that created this resource
|
|
30
42
|
* @type {RenderPassNode|null}
|
|
31
43
|
*/
|
|
32
44
|
producer = null;
|
|
@@ -39,7 +51,7 @@ export class ResourceEntry {
|
|
|
39
51
|
|
|
40
52
|
/**
|
|
41
53
|
* Creates actual resource
|
|
42
|
-
* @param {
|
|
54
|
+
* @param {RenderResourceManager} resources
|
|
43
55
|
*/
|
|
44
56
|
create(resources) {
|
|
45
57
|
assert.ok(this.isTransient(), 'Only transient resources can be allocated');
|
|
@@ -49,7 +61,7 @@ export class ResourceEntry {
|
|
|
49
61
|
|
|
50
62
|
/**
|
|
51
63
|
* De-allocated memory for the resource
|
|
52
|
-
* @param {
|
|
64
|
+
* @param {RenderResourceManager} resources
|
|
53
65
|
*/
|
|
54
66
|
destroy(resources) {
|
|
55
67
|
assert.ok(this.isTransient(), 'Only transient resources can be destroyed, that is resources that are created by the graph itself');
|
|
@@ -68,9 +80,7 @@ export class ResourceEntry {
|
|
|
68
80
|
toString() {
|
|
69
81
|
if (this.resource_descriptor !== null) {
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
return "texture";
|
|
73
|
-
}
|
|
83
|
+
return this.resource_descriptor.type;
|
|
74
84
|
|
|
75
85
|
}
|
|
76
86
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @template T
|
|
3
|
+
*/
|
|
4
|
+
export class ResourceNode<T> extends GraphNode {
|
|
5
|
+
constructor();
|
|
2
6
|
resource_id: number;
|
|
3
7
|
/**
|
|
4
8
|
*
|
|
5
|
-
* @type {
|
|
9
|
+
* @type {ResourceDescriptor<T>|null}
|
|
6
10
|
*/
|
|
7
|
-
descriptor:
|
|
11
|
+
descriptor: ResourceDescriptor<T> | null;
|
|
8
12
|
/**
|
|
9
13
|
*
|
|
10
14
|
* @type {RenderPassNode|null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceNode.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/ResourceNode.js"],"names":[],"mappings":"AAEA;IACI,oBAAgB;IAEhB;;;OAGG;IACH,YAFU,
|
|
1
|
+
{"version":3,"file":"ResourceNode.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/ResourceNode.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;;IACI,oBAAgB;IAEhB;;;OAGG;IACH,YAFU,wBAAsB,IAAI,CAElB;IAElB;;;OAGG;IACH,UAFU,iBAAe,IAAI,CAEb;IAGpB;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;0BAnByB,gBAAgB"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { GraphNode } from "./GraphNode.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @template T
|
|
5
|
+
*/
|
|
3
6
|
export class ResourceNode extends GraphNode {
|
|
4
7
|
resource_id = 0;
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
*
|
|
8
|
-
* @type {
|
|
11
|
+
* @type {ResourceDescriptor<T>|null}
|
|
9
12
|
*/
|
|
10
13
|
descriptor = null;
|
|
11
14
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doesn't actually do anything, but works as a valid rendering context
|
|
3
|
+
* Mainly used for testing
|
|
4
|
+
*/
|
|
5
|
+
export class VoidRenderContext extends IRenderContext {
|
|
6
|
+
static INSTANCE: VoidRenderContext;
|
|
7
|
+
createResource(descriptor: any): any;
|
|
8
|
+
destroyResource(resource: any, descriptor: any): void;
|
|
9
|
+
}
|
|
10
|
+
import { IRenderContext } from "../../IRenderContext.js";
|
|
11
|
+
//# sourceMappingURL=VoidRenderContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoidRenderContext.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/frame_graph/backend/void/VoidRenderContext.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAQI,mCAA0C;IAP1C,qCAEC;IAED,sDACC;CAGJ;+BAf8B,yBAAyB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IRenderContext } from "../../IRenderContext.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Doesn't actually do anything, but works as a valid rendering context
|
|
5
|
+
* Mainly used for testing
|
|
6
|
+
*/
|
|
7
|
+
export class VoidRenderContext extends IRenderContext {
|
|
8
|
+
createResource(descriptor) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
destroyResource(resource, descriptor) {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static INSTANCE = new VoidRenderContext();
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class RenderResourceManager {
|
|
2
|
+
attach(ctx: any): void;
|
|
3
|
+
/**
|
|
4
|
+
* @template T
|
|
5
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
6
|
+
* @returns {T}
|
|
7
|
+
*/
|
|
8
|
+
get<T>(descriptor: ResourceDescriptor<T>): T;
|
|
9
|
+
/**
|
|
10
|
+
* @template T
|
|
11
|
+
* @param {T} resource
|
|
12
|
+
*/
|
|
13
|
+
release<T_1>(resource: T_1): void;
|
|
14
|
+
#private;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RenderResourceManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderResourceManager.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/resource/RenderResourceManager.js"],"names":[],"mappings":"AAGA;IAqBI,uBAEC;IAUD;;;;OAIG;IACH,6CAiBC;IAED;;;OAGG;IACH,kCAYC;;CACJ"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ImmutableObjectPool } from "../../../../../core/model/object/ImmutableObjectPool.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class RenderResourceManager {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {IRenderContext|null}
|
|
10
|
+
*/
|
|
11
|
+
#ctx = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {Map<*, ResourceDescriptor>}
|
|
16
|
+
*/
|
|
17
|
+
#resource_descriptors = new Map();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {ImmutableObjectPool<ResourceDescriptor, *>}
|
|
22
|
+
*/
|
|
23
|
+
#cache = new ImmutableObjectPool();
|
|
24
|
+
|
|
25
|
+
attach(ctx) {
|
|
26
|
+
this.#ctx = ctx;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
this.#cache.onRemoved.add((descriptor, resource) => {
|
|
31
|
+
|
|
32
|
+
this.#ctx.destroyResource(resource, descriptor);
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @template T
|
|
39
|
+
* @param {ResourceDescriptor<T>} descriptor
|
|
40
|
+
* @returns {T}
|
|
41
|
+
*/
|
|
42
|
+
get(descriptor) {
|
|
43
|
+
let resource = this.#cache.get(descriptor);
|
|
44
|
+
|
|
45
|
+
if (resource === undefined) {
|
|
46
|
+
// nothing in cache, create a new one
|
|
47
|
+
resource = this.#ctx.createResource(descriptor);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const existing_descriptor = this.#resource_descriptors.get(resource);
|
|
51
|
+
|
|
52
|
+
if (existing_descriptor !== undefined) {
|
|
53
|
+
throw new Error(`Resource is already associated with a live descriptor`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.#resource_descriptors.set(resource, descriptor);
|
|
57
|
+
|
|
58
|
+
return resource;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @template T
|
|
63
|
+
* @param {T} resource
|
|
64
|
+
*/
|
|
65
|
+
release(resource) {
|
|
66
|
+
|
|
67
|
+
const descriptor = this.#resource_descriptors.get(resource);
|
|
68
|
+
|
|
69
|
+
if (descriptor === undefined) {
|
|
70
|
+
throw new Error(`Resource is not managed`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.#resource_descriptors.delete(resource);
|
|
74
|
+
|
|
75
|
+
this.#cache.add(descriptor, resource);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderTarget.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/resource/RenderTarget.js"],"names":[],"mappings":"AAAA;IACI;;;OAGG;IACH,YAFU,oBAAkB,IAAI,CAEf;IAEjB,eAAW;CACd"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base abstract class for any managed resource such as a texture of a buffer
|
|
3
|
+
*/
|
|
4
|
+
export class ResourceDescriptor {
|
|
5
|
+
/**
|
|
6
|
+
* Resource type, useful for debugging and UI
|
|
7
|
+
* Not guaranteed to be unique
|
|
8
|
+
* @return {string}
|
|
9
|
+
*/
|
|
10
|
+
get type(): string;
|
|
11
|
+
/**
|
|
12
|
+
* For fast type checks
|
|
13
|
+
* @return {boolean}
|
|
14
|
+
*/
|
|
15
|
+
get isResourceDescriptor(): boolean;
|
|
16
|
+
hash(): number;
|
|
17
|
+
/**
|
|
18
|
+
* @template T {ResourceDescriptor}
|
|
19
|
+
* @param {T} other
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
equals<T>(other: T): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ResourceDescriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceDescriptor.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/resource/ResourceDescriptor.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAEI;;;;OAIG;IACH,mBAEC;IAED;;;OAGG;IACH,oCAEC;IAGD,eAEC;IAED;;;;OAIG;IACH,qBAFa,OAAO,CAInB;CAEJ"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base abstract class for any managed resource such as a texture of a buffer
|
|
3
|
+
*/
|
|
4
|
+
export class ResourceDescriptor {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Resource type, useful for debugging and UI
|
|
8
|
+
* Not guaranteed to be unique
|
|
9
|
+
* @return {string}
|
|
10
|
+
*/
|
|
11
|
+
get type() {
|
|
12
|
+
return 'resource'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* For fast type checks
|
|
17
|
+
* @return {boolean}
|
|
18
|
+
*/
|
|
19
|
+
get isResourceDescriptor() {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
hash() {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @template T {ResourceDescriptor}
|
|
30
|
+
* @param {T} other
|
|
31
|
+
* @returns {boolean}
|
|
32
|
+
*/
|
|
33
|
+
equals(other) {
|
|
34
|
+
return this.type === other.type;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class TextureDescriptor {
|
|
1
|
+
export class TextureDescriptor extends ResourceDescriptor {
|
|
2
2
|
static from({ height, width, format, channel_count, initial_state }: {
|
|
3
3
|
height?: number;
|
|
4
4
|
width?: number;
|
|
@@ -31,7 +31,6 @@ export class TextureDescriptor {
|
|
|
31
31
|
* @type {number}
|
|
32
32
|
*/
|
|
33
33
|
initial_state: number;
|
|
34
|
-
hash(): number;
|
|
35
34
|
/**
|
|
36
35
|
*
|
|
37
36
|
* @param {TextureDescriptor} other
|
|
@@ -39,5 +38,6 @@ export class TextureDescriptor {
|
|
|
39
38
|
*/
|
|
40
39
|
equals(other: TextureDescriptor): boolean;
|
|
41
40
|
}
|
|
42
|
-
import {
|
|
41
|
+
import { ResourceDescriptor } from "./ResourceDescriptor.js";
|
|
42
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
43
43
|
//# sourceMappingURL=TextureDescriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextureDescriptor.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/resource/TextureDescriptor.js"],"names":[],"mappings":"AAMA;IAoEI;;;;;;0BAiBC;IAnFD;;;OAGG;IACH,QAFU,MAAM,CAEL;IACX;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,cAAc,CAEM;IAE9B;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,eAFU,MAAM,CAE0B;IAe1C;;;;OAIG;IACH,cAHW,iBAAiB,GACf,OAAO,CAkBnB;CAqBJ;mCAzFkC,yBAAyB;+BAH7B,mDAAmD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BinaryDataType } from "
|
|
2
|
-
import { computeHashIntegerArray } from "
|
|
3
|
-
import { computeStringHash } from "
|
|
1
|
+
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
2
|
+
import { computeHashIntegerArray } from "../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
3
|
+
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
|
|
4
|
+
import { ResourceDescriptor } from "./ResourceDescriptor.js";
|
|
4
5
|
import { TextureInitialState } from "./TextureInitialState.js";
|
|
5
6
|
|
|
6
|
-
export class TextureDescriptor {
|
|
7
|
+
export class TextureDescriptor extends ResourceDescriptor {
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
@@ -34,6 +35,10 @@ export class TextureDescriptor {
|
|
|
34
35
|
*/
|
|
35
36
|
initial_state = TextureInitialState.Clear;
|
|
36
37
|
|
|
38
|
+
get type() {
|
|
39
|
+
return 'texture';
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
hash() {
|
|
38
43
|
return computeHashIntegerArray(
|
|
39
44
|
this.width,
|
|
@@ -49,6 +54,15 @@ export class TextureDescriptor {
|
|
|
49
54
|
* @returns {boolean}
|
|
50
55
|
*/
|
|
51
56
|
equals(other) {
|
|
57
|
+
if (this === other) {
|
|
58
|
+
// shortcut
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!super.equals(other)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
return this.width === other.width
|
|
53
67
|
&& this.height === other.height
|
|
54
68
|
&& this.format === other.format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextureInitialState.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/resource/TextureInitialState.js"],"names":[],"mappings":"kCAEU,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GBufferDrawPass.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js"],"names":[],"mappings":"AAGA;
|
|
1
|
+
{"version":3,"file":"GBufferDrawPass.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js"],"names":[],"mappings":"AAGA;IAQU,yBAEkC;IAPxC;;;;MAqBC;IAED,8DAEC;CACJ;2BAhC0B,qBAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderPass } from "../../RenderPass.js";
|
|
2
|
-
import { TextureDescriptor } from "../../TextureDescriptor.js";
|
|
2
|
+
import { TextureDescriptor } from "../../resource/TextureDescriptor.js";
|
|
3
3
|
|
|
4
4
|
export class GBufferDrawPass extends RenderPass {
|
|
5
5
|
name = "Draw G-buffer";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderGraph } from "../../RenderGraph.js";
|
|
2
|
-
import { TextureDescriptor } from "../../TextureDescriptor.js";
|
|
2
|
+
import { TextureDescriptor } from "../../resource/TextureDescriptor.js";
|
|
3
3
|
import { WebGLRenderContext } from "../../webgl/WebGLRenderContext.js";
|
|
4
4
|
import { GBufferDrawPass } from "./GBufferDrawPass.js";
|
|
5
5
|
import { LightingPass } from "./LightingPass.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorDepthPass.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js"],"names":[],"mappings":"AAKA;
|
|
1
|
+
{"version":3,"file":"ColorDepthPass.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js"],"names":[],"mappings":"AAKA;IAGwB,yBAC0C;IAH9D,oBAAoC;IAEpC;;;MAuBC;IAED,8DAGC;CACJ;2BAnC0B,qBAAqB;oBAD5B,wCAAwC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RenderPass } from "../../RenderPass.js";
|
|
2
|
-
import { TextureDescriptor } from "../../TextureDescriptor.js";
|
|
3
|
-
import Vector2 from "../../../../../../core/geom/Vector2.js";
|
|
4
1
|
import { BinaryDataType } from "../../../../../../core/binary/type/BinaryDataType.js";
|
|
2
|
+
import Vector2 from "../../../../../../core/geom/Vector2.js";
|
|
3
|
+
import { RenderPass } from "../../RenderPass.js";
|
|
4
|
+
import { TextureDescriptor } from "../../resource/TextureDescriptor.js";
|
|
5
5
|
|
|
6
6
|
export class ColorDepthPass extends RenderPass {
|
|
7
7
|
resolution = new Vector2(1024, 724);
|
|
@@ -4,6 +4,8 @@ export class WebGLRenderContext extends IRenderContext {
|
|
|
4
4
|
* @param {WebGL2RenderingContext} ctx
|
|
5
5
|
*/
|
|
6
6
|
constructor(ctx: WebGL2RenderingContext);
|
|
7
|
+
createResource(descriptor: any): RenderTarget;
|
|
8
|
+
destroyResource(resource: any, descriptor: any): boolean;
|
|
7
9
|
/**
|
|
8
10
|
*
|
|
9
11
|
* @param {TextureDescriptor} descriptor
|
|
@@ -13,5 +15,5 @@ export class WebGLRenderContext extends IRenderContext {
|
|
|
13
15
|
#private;
|
|
14
16
|
}
|
|
15
17
|
import { IRenderContext } from "../IRenderContext.js";
|
|
16
|
-
import { RenderTarget } from "../RenderTarget.js";
|
|
18
|
+
import { RenderTarget } from "../resource/RenderTarget.js";
|
|
17
19
|
//# sourceMappingURL=WebGLRenderContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGLRenderContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js"],"names":[],"mappings":"AAGA;IAOI;;;OAGG;IACH,iBAFW,sBAAsB,EAMhC;IAED;;;OAGG;IACH,gEASC;IAED,0CAEC;;CACJ;+
|
|
1
|
+
{"version":3,"file":"WebGLRenderContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js"],"names":[],"mappings":"AAGA;IAOI;;;OAGG;IACH,iBAFW,sBAAsB,EAMhC;IAED,8CAQC;IAED,yDAWC;IAED;;;OAGG;IACH,gEASC;IAED,0CAEC;;CACJ;+BA7D8B,sBAAsB;6BACxB,6BAA6B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRenderContext } from "../IRenderContext.js";
|
|
2
|
-
import { RenderTarget } from "../RenderTarget.js";
|
|
2
|
+
import { RenderTarget } from "../resource/RenderTarget.js";
|
|
3
3
|
|
|
4
4
|
export class WebGLRenderContext extends IRenderContext {
|
|
5
5
|
/**
|
|
@@ -18,6 +18,29 @@ export class WebGLRenderContext extends IRenderContext {
|
|
|
18
18
|
this.#gl = ctx;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
createResource(descriptor) {
|
|
22
|
+
const resource_type = descriptor.type;
|
|
23
|
+
|
|
24
|
+
if(resource_type === "texture"){
|
|
25
|
+
return this.createRenderTarget(descriptor);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
throw new Error(`Unsupported resource type ${resource_type}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
destroyResource(resource, descriptor) {
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const resource_type = descriptor.type;
|
|
35
|
+
|
|
36
|
+
if(resource_type === "texture"){
|
|
37
|
+
return this.destroyRenderTarget(resource);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new Error(`Unsupported resource type ${resource_type}`);
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
/**
|
|
22
45
|
*
|
|
23
46
|
* @param {TextureDescriptor} descriptor
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenderTarget.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderTarget.js"],"names":[],"mappings":"AAAA;IACI;;;OAGG;IACH,YAFU,oBAAkB,IAAI,CAEf;IAEjB,eAAW;CACd"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export class RenderTextureManager {
|
|
2
|
-
attach(ctx: any): void;
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {TextureDescriptor} descriptor
|
|
6
|
-
* @returns {RenderTarget}
|
|
7
|
-
*/
|
|
8
|
-
get(descriptor: TextureDescriptor): RenderTarget;
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @param {RenderTarget} handle
|
|
12
|
-
*/
|
|
13
|
-
release(handle: RenderTarget): void;
|
|
14
|
-
#private;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=RenderTextureManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenderTextureManager.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/RenderTextureManager.js"],"names":[],"mappings":"AAGA;IAeI,uBAEC;IAUD;;;;OAIG;IACH,iDAUC;IAED;;;OAGG;IACH,oCAIC;;CACJ"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ImmutableObjectPool } from "../../../../core/model/object/ImmutableObjectPool.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class RenderTextureManager {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @type {IRenderContext|null}
|
|
10
|
-
*/
|
|
11
|
-
#ctx = null;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @type {ImmutableObjectPool<TextureDescriptor, RenderTarget>}
|
|
16
|
-
*/
|
|
17
|
-
#cache = new ImmutableObjectPool();
|
|
18
|
-
|
|
19
|
-
attach(ctx) {
|
|
20
|
-
this.#ctx = ctx;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
constructor() {
|
|
24
|
-
this.#cache.onRemoved.add((descriptor, texture) => {
|
|
25
|
-
|
|
26
|
-
this.#ctx.destroyRenderTarget(texture);
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @param {TextureDescriptor} descriptor
|
|
34
|
-
* @returns {RenderTarget}
|
|
35
|
-
*/
|
|
36
|
-
get(descriptor) {
|
|
37
|
-
const existing = this.#cache.get(descriptor);
|
|
38
|
-
|
|
39
|
-
if (existing !== undefined) {
|
|
40
|
-
return existing;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// nothing in cache, create a new one
|
|
44
|
-
return this.#ctx.createRenderTarget(descriptor);
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {RenderTarget} handle
|
|
51
|
-
*/
|
|
52
|
-
release(handle) {
|
|
53
|
-
|
|
54
|
-
this.#cache.add(handle.descriptor, handle);
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextureDescriptor.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/TextureDescriptor.js"],"names":[],"mappings":"AAKA;IAuDI;;;;;;0BAiBC;IAtED;;;OAGG;IACH,QAFU,MAAM,CAEL;IACX;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,cAAc,CAEM;IAE9B;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,eAFU,MAAM,CAE0B;IAE1C,eAOC;IAED;;;;OAIG;IACH,cAHW,iBAAiB,GACf,OAAO,CASnB;CAqBJ;+BA9E8B,gDAAgD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextureInitialState.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/render/frame_graph/TextureInitialState.js"],"names":[],"mappings":"kCAEU,MAAM"}
|
/package/src/engine/graphics/render/frame_graph/{RenderTarget.d.ts → resource/RenderTarget.d.ts}
RENAMED
|
File without changes
|
/package/src/engine/graphics/render/frame_graph/{RenderTarget.js → resource/RenderTarget.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|