@aethervtt/shard-ui 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/render.d.ts +3 -2
- package/dist/render.js +14 -8
- package/dist/shaders.js +1 -1
- package/package.json +12 -12
package/dist/render.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Entity, type World } from '@aethervtt/shard-core';
|
|
2
2
|
import { GpuBuffer, type GpuContext } from '@aethervtt/shard-gpu';
|
|
3
|
-
import { type NodeDescriptor } from '@aethervtt/shard-render';
|
|
3
|
+
import { DataStore, type NodeDescriptor } from '@aethervtt/shard-render';
|
|
4
4
|
import type { App } from '@aethervtt/shard-runtime';
|
|
5
5
|
import type { FontPage } from '@aethervtt/shard-text';
|
|
6
6
|
import { type Texture } from '@aethervtt/shard-texture';
|
|
@@ -28,7 +28,8 @@ export declare class UiRenderStore {
|
|
|
28
28
|
count: number;
|
|
29
29
|
draws: UiDraw[];
|
|
30
30
|
drawCount: number;
|
|
31
|
-
|
|
31
|
+
/** Storage on the full tier, a data texture on baseline (0064). */
|
|
32
|
+
readonly buffer: DataStore;
|
|
32
33
|
/** Root visual versions the records were built from. */
|
|
33
34
|
private built;
|
|
34
35
|
overlay: boolean;
|
package/dist/render.js
CHANGED
|
@@ -5,8 +5,11 @@ import {
|
|
|
5
5
|
} from "@aethervtt/shard-core";
|
|
6
6
|
import { GpuBuffer } from "@aethervtt/shard-gpu";
|
|
7
7
|
import {
|
|
8
|
+
addRenderFeatures,
|
|
8
9
|
cameraOf,
|
|
10
|
+
DataStore,
|
|
9
11
|
DebugOverlays,
|
|
12
|
+
dataEntry,
|
|
10
13
|
defineOverlay,
|
|
11
14
|
Gpu,
|
|
12
15
|
GpuAssetsResource,
|
|
@@ -37,6 +40,7 @@ class UiRenderStore {
|
|
|
37
40
|
count = 0;
|
|
38
41
|
draws = [];
|
|
39
42
|
drawCount = 0;
|
|
43
|
+
/** Storage on the full tier, a data texture on baseline (0064). */
|
|
40
44
|
buffer;
|
|
41
45
|
/** Root visual versions the records were built from. */
|
|
42
46
|
built = /* @__PURE__ */ new Map();
|
|
@@ -46,11 +50,7 @@ class UiRenderStore {
|
|
|
46
50
|
uploadedBytes = 0;
|
|
47
51
|
totalUploads = 0;
|
|
48
52
|
constructor(gpu) {
|
|
49
|
-
this.buffer = new
|
|
50
|
-
label: "ui/quads",
|
|
51
|
-
usage: GPUBufferUsage.STORAGE,
|
|
52
|
-
size: QUAD_FLOATS * 4 * 64
|
|
53
|
-
});
|
|
53
|
+
this.buffer = new DataStore(gpu, { label: "ui/quads", size: QUAD_FLOATS * 4 * 64 });
|
|
54
54
|
}
|
|
55
55
|
/** Whether any root changed since the records were built. */
|
|
56
56
|
stale(roots, overlay) {
|
|
@@ -509,7 +509,7 @@ function caches(ctx) {
|
|
|
509
509
|
label: "ui/view",
|
|
510
510
|
entries: [
|
|
511
511
|
{ binding: 0, visibility: V, buffer: { type: "uniform" } },
|
|
512
|
-
|
|
512
|
+
dataEntry(gpu, 1, V | F)
|
|
513
513
|
]
|
|
514
514
|
}),
|
|
515
515
|
texture: gpu.layouts.bindGroupLayout({
|
|
@@ -618,11 +618,11 @@ function drawUi(ctx) {
|
|
|
618
618
|
group(
|
|
619
619
|
ctx,
|
|
620
620
|
`${ctx.view.name}/ui-view`,
|
|
621
|
-
`${idOf(u.buffer)}/${idOf(store.buffer.buffer
|
|
621
|
+
`${idOf(u.buffer)}/${idOf(store.buffer)}:${store.buffer.version}`,
|
|
622
622
|
c.layouts.view,
|
|
623
623
|
() => [
|
|
624
624
|
{ binding: 0, resource: { buffer: u.buffer } },
|
|
625
|
-
{ binding: 1, resource:
|
|
625
|
+
{ binding: 1, resource: store.buffer.resource() }
|
|
626
626
|
]
|
|
627
627
|
)
|
|
628
628
|
);
|
|
@@ -691,6 +691,12 @@ function installUiRenderer(app) {
|
|
|
691
691
|
const shaders = world.resource(Shaders);
|
|
692
692
|
for (const [path, source] of Object.entries(UI_SHADERS))
|
|
693
693
|
shaders.register(path, source, `engine:${path}`);
|
|
694
|
+
addRenderFeatures(world, {
|
|
695
|
+
name: "ui",
|
|
696
|
+
description: "UI and HUD quads.",
|
|
697
|
+
nodes: ["ui"],
|
|
698
|
+
baseline: { strategy: "Quad records in a data texture" }
|
|
699
|
+
});
|
|
694
700
|
graph.addNode("ui", uiNode(world));
|
|
695
701
|
app.addSystems(Last, prepareUi.inSet(RenderSet.Prepare));
|
|
696
702
|
world.initResource(RenderDescribers).set("ui", (w) => describeUiRender(w));
|
package/dist/shaders.js
CHANGED
|
@@ -29,7 +29,7 @@ struct Quad {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@group(0) @binding(0) var<uniform> ui_view: UiView;
|
|
32
|
-
@group(0) @binding(1) var<storage, read> quads: array<Quad>;
|
|
32
|
+
@data @group(0) @binding(1) var<storage, read> quads: array<Quad>;
|
|
33
33
|
@group(1) @binding(0) var ui_texture: texture_2d<f32>;
|
|
34
34
|
@group(1) @binding(1) var ui_sampler: sampler;
|
|
35
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aethervtt/shard-ui",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@aethervtt/shard-assets": "0.0
|
|
20
|
-
"@aethervtt/shard-core": "0.0
|
|
21
|
-
"@aethervtt/shard-gpu": "0.0
|
|
22
|
-
"@aethervtt/shard-input": "0.0
|
|
23
|
-
"@aethervtt/shard-render": "0.0
|
|
24
|
-
"@aethervtt/shard-runtime": "0.0
|
|
25
|
-
"@aethervtt/shard-sprite": "0.0
|
|
26
|
-
"@aethervtt/shard-text": "0.0
|
|
27
|
-
"@aethervtt/shard-texture": "0.0
|
|
28
|
-
"@aethervtt/shard-transform": "0.0
|
|
19
|
+
"@aethervtt/shard-assets": "0.1.0",
|
|
20
|
+
"@aethervtt/shard-core": "0.1.0",
|
|
21
|
+
"@aethervtt/shard-gpu": "0.1.0",
|
|
22
|
+
"@aethervtt/shard-input": "0.1.0",
|
|
23
|
+
"@aethervtt/shard-render": "0.1.0",
|
|
24
|
+
"@aethervtt/shard-runtime": "0.1.0",
|
|
25
|
+
"@aethervtt/shard-sprite": "0.1.0",
|
|
26
|
+
"@aethervtt/shard-text": "0.1.0",
|
|
27
|
+
"@aethervtt/shard-texture": "0.1.0",
|
|
28
|
+
"@aethervtt/shard-transform": "0.1.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"provenance": true
|
|
38
38
|
},
|
|
39
39
|
"shard": {
|
|
40
|
-
"buildSha": "
|
|
40
|
+
"buildSha": "8e14c9896f82a3554b156f1ffdd68f2cc3e7d78a"
|
|
41
41
|
}
|
|
42
42
|
}
|