Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

FC2a: storage buffers in any WGSL type; shader/gpu_component_array_buffer passes pixel-exact

shinyobjectz498d7765cde6
diff --git a/Cargo.lock b/Cargo.lock
index 8ecdb664..53fa3656 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13773,6 +13773,7 @@ dependencies = [
"accesskit 0.24.1",
"argh",
"bevy",
+ "bytemuck",
"chacha20 0.10.2",
"raea-sys-parity",
"rand 0.10.3",
diff --git a/bench/bevy-parity/Cargo.toml b/bench/bevy-parity/Cargo.toml
index 770e2540..02981ac1 100644
--- a/bench/bevy-parity/Cargo.toml
+++ b/bench/bevy-parity/Cargo.toml
@@ -17,10 +17,11 @@ argh = "0.1.12"
accesskit = "0.24"
rand = "0.10.0"
chacha20 = { version = "0.10.0", default-features = false, features = ["rng"] }
+bytemuck = { version = "1", features = ["derive"] }
# used by the ported examples, which build.rs copies in through include! where cargo-shear doesn't look
[package.metadata.cargo-shear]
-ignored = ["argh", "accesskit", "rand", "chacha20"]
+ignored = ["argh", "accesskit", "rand", "chacha20", "bytemuck"]
# Bevy's examples ask cfg(feature = "default_font") of the crate they're built in: in Bevy's repo that's bevy's own
# feature, on by default; here the host's, so it has one, on (ui/text/text builds only its default-font branch)
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index 68cb72fd..64c1d663 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -131,6 +131,7 @@ shader/fallback_image
shader/storage_buffer
shader/automatic_instancing
shader/compute_shader_game_of_life
+shader/gpu_component_array_buffer
shader/array_texture
shader/sprite_material
shader/shader_prepass
diff --git a/bench/bevy-parity/lib/rand.test.ts b/bench/bevy-parity/lib/rand.test.ts
index 736aee58..42ed8298 100644
--- a/bench/bevy-parity/lib/rand.test.ts
+++ b/bench/bevy-parity/lib/rand.test.ts
@@ -19,3 +19,25 @@ test("random_dir3 is bevy_math's random::<Dir3>() (align.rs's seed)", () => {
const r = ChaCha8Rng.seed_from_u64(19878367467712n);
expect([r.random_dir3().map(bits), r.random_dir3().map(bits)]).toEqual([["be848688", "3e9c2559", "3f6aa088"], ["bf2dc30a", "beef6b4a", "bf10f4e8"]]);
});
+
+test("next_u64, random_bool and random_index are the crates' own (gpu_component_array_buffer's seed)", () => {
+ const r = ChaCha8Rng.seed_from_u64(12345n);
+ const w = Array.from({ length: 63 }, () => r.next_u32());
+ expect(w.slice(0, 3)).toEqual([2874758099, 316557125, 2012221028]);
+ // the third straddles the refill: the buffer's last word low, the new buffer's first high
+ expect(Array.from({ length: 3 }, () => r.next_u64())).toEqual([1152078820691892869n, 8808416481836467466n, 2442021293179131675n]);
+ const g = ChaCha8Rng.seed_from_u64(12345n);
+ const cubes = Array.from({ length: 5 }, () => {
+ const f = [g.random_range(-1, 1), g.random_range(-1, 1), g.random_range(0, 1), g.random_range(0, 1), g.random_range(0, 1)].map(bits);
+ return [...f, g.random_bool(0.5)];
+ });
+ expect(cubes).toEqual([
+ ["3ead6548", "bf5a4374", "3eefe01c", "3d2de5e0", "3ed1a320", true],
+ ["beaa93b0", "be2e64e0", "3db52ed0", "3f292d96", "3e33d148", false],
+ ["bf6edcc4", "be82f000", "3f0466f8", "3ec41798", "3ec3e9f0", false],
+ ["bf706d30", "bdcfb8a0", "3f1dc71e", "3e8a4e68", "3d81d6d0", true],
+ ["3e4034e0", "3e8730c0", "3f08da06", "3e61b088", "3f4ac6ee", true],
+ ]);
+ expect(Array.from({ length: 6 }, () => g.random_index(7))).toEqual([4, 4, 4, 4, 2, 1]);
+ expect(Array.from({ length: 6 }, () => g.random_index(3))).toEqual([1, 1, 0, 0, 0, 1]);
+});
diff --git a/bench/bevy-parity/lib/rand.ts b/bench/bevy-parity/lib/rand.ts
index b9558f2e..8e04f66e 100644
--- a/bench/bevy-parity/lib/rand.ts
+++ b/bench/bevy-parity/lib/rand.ts
@@ -49,13 +49,49 @@ export class ChaCha8Rng {
if (this.state[12] === 0) this.state[13] = (this.state[13]! + 1) >>> 0;
return out;
}
+ private refill() {
+ this.buf = [...this.block(), ...this.block(), ...this.block(), ...this.block()];
+ }
next_u32(): number {
if (this.at >= 64) {
- this.buf = [...this.block(), ...this.block(), ...this.block(), ...this.block()];
+ this.refill();
this.at = 0;
}
return this.buf[this.at++]!;
}
+ /** rand_core's next_u64_from_u32: two words, the low first; at the buffer's last word, the refill's first is the high */
+ next_u64(): bigint {
+ const at = this.at;
+ let lo: number, hi: number;
+ if (at < 63) {
+ [lo, hi] = [this.buf[at]!, this.buf[at + 1]!];
+ this.at = at + 2;
+ } else {
+ lo = this.buf[63] ?? 0;
+ this.refill();
+ [hi, this.at] = [this.buf[0]!, 1];
+ if (at >= 64) [lo, hi, this.at] = [hi, this.buf[1]!, 2];
+ }
+ return (BigInt(hi) << 32n) | BigInt(lo);
+ }
+ /** rand's random_bool(p): Bernoulli, a u64 under p * 2^64 (p = 1 draws nothing) */
+ random_bool(p: number): boolean {
+ if (p >= 1) return true;
+ return this.next_u64() < BigInt(p * 2 ** 64);
+ }
+ /** rand's random_range(..len) for a usize under 2^32 (IndexedRandom::choose's draw): a u32 times len, its high word,
+ * one more draw when the low word lands in the biased zone (Lemire's, as rand 0.10 samples a single value) */
+ random_index(len: number): number {
+ const range = BigInt(len);
+ const m = BigInt(this.next_u32()) * range;
+ let result = m >> 32n;
+ const lo = m & 0xffffffffn;
+ if (lo > ((1n << 32n) - range)) {
+ const hi2 = (BigInt(this.next_u32()) * range) >> 32n;
+ if (lo + hi2 > 0xffffffffn) result += 1n;
+ }
+ return Number(result);
+ }
/** rand's random_range(low..high) for f32 */
random_range(low: number, high: number): number {
const f = Math.fround;
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index 7af03dff..a81b1037 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -136,3 +136,4 @@ shader/extended_material_bindless - 30,60
shader/automatic_instancing - 30,60
shader/pipeline_constants - 10
shader/compute_shader_game_of_life - 10,11,30,60
+shader/gpu_component_array_buffer - 60,180,240,400
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index c1cbbde3..b80aa22f 100644
--- a/docs/bevy-parity.md
+++ b/docs/bevy-parity.md
@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)
don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and
frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run.
-Examples: **438**, ported **137**, passing **137**, excluded **17** (docs/bevy-parity/excluded.tsv), left **284**.
+Examples: **438**, ported **138**, passing **138**, excluded **17** (docs/bevy-parity/excluded.tsv), left **283**.
raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example
doesn't pay.
@@ -23,8 +23,6 @@ doesn't pay.
| stress_tests/many_foxes | 60 | 0.990304 | 3 | 2 / 2 | 30464 / 31519 | 7 / 9 | 3 / 3 | 5.691 / 5.451 = 5.451 + 0 | yes | |
| animation/animated_mesh | 30 | 0.996636 | 1 | 2 / 2 | 472 / 550 | 7 / 9 | 3 / 3 | 20.88 / 2.714 = 2.714 + 0 | yes | |
| animation/animated_mesh | 60 | 0.996594 | 1 | 2 / 2 | 472 / 550 | 7 / 9 | 3 / 3 | 4.16 / 2.415 = 2.415 + 0 | yes | |
-| shader/extended_material | 30 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 18.758 / 1.523 = 1.523 + 0 | yes | |
-| shader/extended_material | 60 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 3.705 / 1.421 = 1.421 + 0 | yes | |
| 3d/orthographic | 10 | 0.999503 | 0 | 5 / 2 | 446 / 523 | 10 / 9 | 6 / 3 | 47.444 / 2.278 = 2.278 + 0 | yes | |
| 3d/parenting | 30 | 0.999969 | 0 | 1 / 1 | 443 / 520 | 6 / 8 | 2 / 2 | 18.725 / 1.957 = 1.957 + 0 | yes | |
| 3d/parenting | 60 | 0.999968 | 0 | 1 / 1 | 443 / 520 | 6 / 8 | 2 / 2 | 3.403 / 1.574 = 1.574 + 0 | yes | |
@@ -41,8 +39,6 @@ doesn't pay.
| transforms/scale | 300 | 1.000000 | 0 | 1 / 1 | 442 / 519 | 6 / 8 | 2 / 2 | 2.757 / 1.439 = 1.439 + 0 | yes | |
| transforms/scale | 60 | 1.000000 | 0 | 1 / 1 | 442 / 519 | 6 / 8 | 2 / 2 | 11.177 / 1.378 = 1.378 + 0 | yes | |
| 3d/texture | 10 | 0.999547 | 1 | 3 / 3 | 443 / 521 | 6 / 8 | 4 / 4 | 48.313 / 1.681 = 1.681 + 0 | yes | |
-| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 18.009 / 1.61 = 1.61 + 0 | yes | |
-| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 3.432 / 1.564 = 1.564 + 0 | yes | |
| 2d/sprite_sheet | 30 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 5 / 7 | 1 / 1 | 17.501 / 1.461 = 1.461 + 0 | yes | |
| 2d/sprite_sheet | 60 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 5 / 7 | 1 / 1 | 2.372 / 1.719 = 1.719 + 0 | yes | |
| 3d/pbr | 30 | 0.997686 | 8 | 56 / 56 | 499 / 574 | 6 / 8 | 57 / 57 | 20.746 / 1.524 = 1.524 + 0 | yes | |
@@ -185,37 +181,45 @@ doesn't pay.
| 2d/sprite_scale | 10 | 0.992281 | 11 | 0 / 0 | 486 / 540 | 5 / 7 | 1 / 1 | 43.168 / 2.023 = 2.023 + 0 | yes | |
| 2d/sprite_scale | 60 | 0.992281 | 11 | 0 / 0 | 486 / 540 | 5 / 7 | 1 / 1 | 2.432 / 1.304 = 1.304 + 0 | yes | |
| 2d/sprite_slice | 10 | 0.997293 | 11 | 0 / 0 | 464 / 529 | 5 / 7 | 1 / 1 | 46.175 / 2.243 = 2.243 + 0 | yes | |
-| shader/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 18.335 / 1.636 = 1.636 + 0 | yes | |
-| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 520 | 7 / 8 | 1 / 3 | 44.123 / 2.228 = 2.228 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 47.912 / 3.211 = 3.211 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 3.369 / 1.781 = 1.781 + 0 | yes | |
-| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 1 | 43.886 / 2.116 = 2.116 + 0 | yes | |
-| shader/fallback_image | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 45.369 / 2.391 = 2.391 + 0 | yes | |
-| shader/storage_buffer | 30 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 18.59 / 1.729 = 1.729 + 0 | yes | |
-| shader/storage_buffer | 60 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 3.415 / 1.544 = 1.544 + 0 | yes | |
-| shader/array_texture | 100 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 3.1 / 1.565 = 1.565 + 0 | yes | |
-| shader/array_texture | 30 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 18.854 / 1.756 = 1.756 + 0 | yes | |
-| shader/sprite_material | 110 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.073 / 1.499 = 1.499 + 0 | yes | |
-| shader/sprite_material | 130 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.314 / 1.521 = 1.521 + 0 | yes | |
-| shader/sprite_material | 29 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 19.345 / 1.98 = 1.98 + 0 | yes | |
-| shader/sprite_material | 40 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 3.245 / 1.381 = 1.381 + 0 | yes | |
-| shader/sprite_material | 70 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.775 / 1.417 = 1.417 + 0 | yes | |
-| shader/sprite_material | 95 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.352 / 1.247 = 1.247 + 0 | yes | |
-| shader/shader_prepass | 10 | 0.995071 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 55.783 / 3.764 = 3.764 + 0 | yes | |
-| shader/shader_prepass | 30 | 0.995869 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 5.693 / 2.718 = 2.718 + 0 | yes | |
-| shader/shader_prepass | 50 | 0.994765 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 4.837 / 2.944 = 2.944 + 0 | yes | |
-| shader/shader_prepass | 70 | 0.997658 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 4.797 / 2.724 = 2.724 + 0 | yes | |
-| shader/shader_material_bindless | 10 | 1.000000 | 0 | 0 / 0 | 448 / 520 | 7 / 9 | 1 / 3 | 44.178 / 2.885 = 2.885 + 0 | yes | |
-| shader/shader_material_2d_bindless | 10 | 1.000000 | 0 | 0 / 0 | 450 / 522 | 6 / 11 | 1 / 1 | 45.348 / 1.696 = 1.696 + 0 | yes | |
-| shader/extended_material_bindless | 30 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 19.49 / 1.975 = 1.975 + 0 | yes | |
-| shader/extended_material_bindless | 60 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 3.349 / 1.63 = 1.63 + 0 | yes | |
-| shader/automatic_instancing | 30 | 0.999933 | 0 | 0 / 0 | 65982 / 131590 | 6 / 8 | 1 / 65537 | 27.191 / 7.295 = 7.295 + 0 | yes | |
-| shader/automatic_instancing | 60 | 0.999947 | 0 | 0 / 0 | 65982 / 131590 | 6 / 8 | 1 / 65537 | 8.442 / 7.098 = 7.098 + 0 | yes | |
-| shader/pipeline_constants | 10 | 0.999666 | 2 | 0 / 0 | 452 / 521 | 6 / 10 | 1 / 1 | 54.194 / 1.842 = 1.842 + 0 | yes | |
-| shader/compute_shader_game_of_life | 10 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 46.507 / 3.177 = 2.504 + 0.673 | yes | |
-| shader/compute_shader_game_of_life | 11 | 1.000000 | 0 | 0 / 0 | 445 / 519 | 5 / 7 | 1 / 1 | 2.841 / 3.69 = 3.09 + 0.600 | yes | |
-| shader/compute_shader_game_of_life | 30 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 2.461 / 2.164 = 1.906 + 0.258 | yes | |
-| shader/compute_shader_game_of_life | 60 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 2.438 / 1.77 = 1.57 + 0.200 | yes | |
+| shader/extended_material | 30 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 15.821 / 1.394 = 1.394 + 0 | yes | |
+| shader/extended_material | 60 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 2.971 / 0.996 = 0.996 + 0 | yes | |
+| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 16.379 / 1.141 = 1.141 + 0 | yes | |
+| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 3.12 / 1.022 = 1.022 + 0 | yes | |
+| shader/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 16.156 / 1.152 = 1.152 + 0 | yes | |
+| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 520 | 7 / 8 | 1 / 3 | 41.059 / 1.44 = 1.44 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 43.165 / 2.284 = 2.284 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 3.05 / 1.429 = 1.429 + 0 | yes | |
+| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 1 | 43.369 / 2.323 = 2.323 + 0 | yes | |
+| shader/fallback_image | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 42.916 / 1.829 = 1.829 + 0 | yes | |
+| shader/storage_buffer | 30 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 16.985 / 1.345 = 1.345 + 0 | yes | |
+| shader/storage_buffer | 60 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 3.127 / 1.422 = 1.422 + 0 | yes | |
+| shader/array_texture | 100 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 2.941 / 1.387 = 1.387 + 0 | yes | |
+| shader/array_texture | 30 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 17.455 / 1.807 = 1.807 + 0 | yes | |
+| shader/sprite_material | 110 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 1.955 / 1.118 = 1.118 + 0 | yes | |
+| shader/sprite_material | 130 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.054 / 0.932 = 0.932 + 0 | yes | |
+| shader/sprite_material | 29 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 16.511 / 1.329 = 1.329 + 0 | yes | |
+| shader/sprite_material | 40 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.734 / 1.091 = 1.091 + 0 | yes | |
+| shader/sprite_material | 70 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.452 / 1.108 = 1.108 + 0 | yes | |
+| shader/sprite_material | 95 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.003 / 1.162 = 1.162 + 0 | yes | |
+| shader/shader_prepass | 10 | 0.995071 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 48.075 / 3.033 = 3.033 + 0 | yes | |
+| shader/shader_prepass | 30 | 0.995869 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 4.934 / 2.933 = 2.933 + 0 | yes | |
+| shader/shader_prepass | 50 | 0.994765 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 4.545 / 2.598 = 2.598 + 0 | yes | |
+| shader/shader_prepass | 70 | 0.997658 | 7 | 2 / 2 | 465 / 533 | 10 / 11 | 3 / 6 | 4.264 / 2.531 = 2.531 + 0 | yes | |
+| shader/shader_material_bindless | 10 | 1.000000 | 0 | 0 / 0 | 448 / 520 | 7 / 9 | 1 / 3 | 36.073 / 1.509 = 1.509 + 0 | yes | |
+| shader/shader_material_2d_bindless | 10 | 1.000000 | 0 | 0 / 0 | 450 / 522 | 6 / 11 | 1 / 1 | 38.957 / 1.843 = 1.843 + 0 | yes | |
+| shader/extended_material_bindless | 30 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 14.968 / 1.337 = 1.337 + 0 | yes | |
+| shader/extended_material_bindless | 60 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 2.792 / 0.881 = 0.881 + 0 | yes | |
+| shader/automatic_instancing | 30 | 0.999933 | 0 | 0 / 0 | 65982 / 131590 | 6 / 8 | 1 / 65537 | 23.804 / 6.48 = 6.48 + 0 | yes | |
+| shader/automatic_instancing | 60 | 0.999947 | 0 | 0 / 0 | 65982 / 131590 | 6 / 8 | 1 / 65537 | 7.74 / 6.437 = 6.437 + 0 | yes | |
+| shader/pipeline_constants | 10 | 0.999666 | 2 | 0 / 0 | 452 / 521 | 6 / 10 | 1 / 1 | 46.526 / 1.953 = 1.953 + 0 | yes | |
+| shader/compute_shader_game_of_life | 10 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 40.207 / 2.138 = 1.747 + 0.391 | yes | |
+| shader/compute_shader_game_of_life | 11 | 1.000000 | 0 | 0 / 0 | 445 / 519 | 5 / 7 | 1 / 1 | 2.539 / 2.778 = 2.303 + 0.475 | yes | |
+| shader/compute_shader_game_of_life | 30 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 2.254 / 1.369 = 1.172 + 0.197 | yes | |
+| shader/compute_shader_game_of_life | 60 | 1.000000 | 0 | 0 / 0 | 443 / 519 | 5 / 7 | 1 / 1 | 2.207 / 1.32 = 1.161 + 0.159 | yes | |
+| shader/gpu_component_array_buffer | 180 | 1.000000 | 0 | 0 / 0 | 455 / 546 | 6 / 8 | 1 / 9 | 2.498 / 0.886 = 0.886 + 0 | yes | |
+| shader/gpu_component_array_buffer | 240 | 1.000000 | 0 | 0 / 0 | 457 / 556 | 6 / 8 | 1 / 11 | 2.405 / 0.823 = 0.823 + 0 | yes | |
+| shader/gpu_component_array_buffer | 400 | 1.000000 | 0 | 0 / 0 | 464 / 550 | 6 / 8 | 1 / 17 | 2.208 / 1.023 = 1.023 + 0 | yes | |
+| shader/gpu_component_array_buffer | 60 | 1.000000 | 0 | 0 / 0 | 450 / 528 | 6 / 8 | 1 / 4 | 9.644 / 1.18 = 1.18 + 0 | yes | |
## Excluded
diff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonl
index 420b7439..a3f82819 100644
--- a/docs/bevy-parity/results.jsonl
+++ b/docs/bevy-parity/results.jsonl
@@ -10,8 +10,6 @@
{"example":"stress_tests/many_foxes","frame":60,"ssim":0.990304,"tile":3,"bevy":{"batch_keys":2,"entities":30464,"extents":["23.6615 34.9370 84.2011","23.6615 34.9370 84.2012","2500.0000 0.0000 2500.0000","78.2183 34.9370 91.5996","80.4108 34.9370 91.8799","84.3248 34.9370 92.3804","86.0376 34.9370 92.5995","86.0377 34.9371 92.5995"],"frame":60,"frame_ms":5.691,"materials":3,"mesh_entities":1001,"meshes":7,"other_material":0,"visible":1001},"raea":{"frame":70,"entities":31519,"mesh_entities":1001,"visible":1001,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["21.9974 34.9370 83.6309","23.6613 34.9370 84.2011","23.6613 34.9371 84.2011","78.2186 34.9370 91.5996","80.4110 34.9370 91.8800","84.3247 34.9370 92.3804","86.0374 34.9370 92.5994","86.0374 34.9371 92.5994"],"frame_ms":5.451,"step_ms":null,"cost_ms":5.451},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"animation/animated_mesh","frame":30,"ssim":0.996636,"tile":1,"bevy":{"batch_keys":2,"entities":472,"extents":["15.4187 42.8200 84.0474","250000.0000 0.0000 250000.0000"],"frame":30,"frame_ms":20.88,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":41,"entities":550,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["15.4187 42.8200 84.0474","250000.0000 0.0000 250000.0000"],"frame_ms":2.714,"step_ms":null,"cost_ms":2.714},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"animation/animated_mesh","frame":60,"ssim":0.996594,"tile":1,"bevy":{"batch_keys":2,"entities":472,"extents":["19.9546 34.9370 82.9540","250000.0000 0.0000 250000.0000"],"frame":60,"frame_ms":4.16,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":71,"entities":550,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["19.9546 34.9370 82.9540","250000.0000 0.0000 250000.0000"],"frame_ms":2.415,"step_ms":null,"cost_ms":2.415},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/extended_material","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":30,"frame_ms":18.758,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":1.523,"step_ms":null,"cost_ms":1.523},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/extended_material","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":60,"frame_ms":3.705,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":1.421,"step_ms":null,"cost_ms":1.421},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/orthographic","frame":10,"ssim":0.999503,"tile":0,"bevy":{"batch_keys":5,"entities":446,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":47.444,"materials":6,"mesh_entities":5,"meshes":10,"other_material":0,"visible":5},"raea":{"frame":17,"entities":523,"mesh_entities":5,"visible":5,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":2.278,"step_ms":null,"cost_ms":2.278},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/parenting","frame":30,"ssim":0.999969,"tile":0,"bevy":{"batch_keys":1,"entities":443,"extents":["1.0000 1.0000 1.0000"],"frame":30,"frame_ms":18.725,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":37,"entities":520,"mesh_entities":2,"visible":2,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["1.0000 1.0000 1.0000"],"frame_ms":1.957,"step_ms":null,"cost_ms":1.957},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/parenting","frame":60,"ssim":0.999968,"tile":0,"bevy":{"batch_keys":1,"entities":443,"extents":["1.0000 1.0000 1.0000"],"frame":60,"frame_ms":3.403,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":67,"entities":520,"mesh_entities":2,"visible":2,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["1.0000 1.0000 1.0000"],"frame_ms":1.574,"step_ms":null,"cost_ms":1.574},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
@@ -28,8 +26,6 @@
{"example":"transforms/scale","frame":300,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":300,"frame_ms":2.757,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":307,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.439,"step_ms":null,"cost_ms":1.439},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"transforms/scale","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":11.177,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.378,"step_ms":null,"cost_ms":1.378},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/texture","frame":10,"ssim":0.999547,"tile":1,"bevy":{"batch_keys":3,"entities":443,"extents":["4.0000 1.0000 0.0000"],"frame":10,"frame_ms":48.313,"materials":4,"mesh_entities":3,"meshes":6,"other_material":0,"visible":3},"raea":{"frame":17,"entities":521,"mesh_entities":3,"visible":3,"meshes":8,"materials":4,"batch_keys":3,"other_material":0,"extents":["4.0000 0.0000 1.0000"],"frame_ms":1.681,"step_ms":null,"cost_ms":1.681},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/animate_shader","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":18.009,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.61,"step_ms":null,"cost_ms":1.61},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/animate_shader","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":3.432,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.564,"step_ms":null,"cost_ms":1.564},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"2d/sprite_sheet","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":30,"frame_ms":17.501,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":518,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.461,"step_ms":null,"cost_ms":1.461},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"2d/sprite_sheet","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":60,"frame_ms":2.372,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":518,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.719,"step_ms":null,"cost_ms":1.719},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/pbr","frame":30,"ssim":0.997686,"tile":8,"bevy":{"batch_keys":56,"entities":499,"extents":["0.4475 0.4500 0.4500"],"frame":30,"frame_ms":20.746,"materials":57,"mesh_entities":56,"meshes":6,"other_material":0,"visible":56},"raea":{"frame":37,"entities":574,"mesh_entities":56,"visible":56,"meshes":8,"materials":57,"batch_keys":56,"other_material":0,"extents":["0.4475 0.4500 0.4500"],"frame_ms":1.524,"step_ms":null,"cost_ms":1.524},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
@@ -172,34 +168,42 @@
{"example":"2d/sprite_scale","frame":10,"ssim":0.992281,"tile":11,"bevy":{"batch_keys":0,"entities":486,"extents":[],"frame":10,"frame_ms":43.168,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":540,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.023,"step_ms":null,"cost_ms":2.023},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"2d/sprite_scale","frame":60,"ssim":0.992281,"tile":11,"bevy":{"batch_keys":0,"entities":486,"extents":[],"frame":60,"frame_ms":2.432,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":540,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.304,"step_ms":null,"cost_ms":1.304},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"2d/sprite_slice","frame":10,"ssim":0.997293,"tile":11,"bevy":{"batch_keys":0,"entities":464,"extents":[],"frame":10,"frame_ms":46.175,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":529,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.243,"step_ms":null,"cost_ms":2.243},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":18.335,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":38,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.636,"step_ms":null,"cost_ms":1.636},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_defs","frame":10,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":44.123,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":17,"entities":520,"mesh_entities":2,"visible":2,"meshes":8,"materials":3,"batch_keys":0,"other_material":2,"extents":["0.5000 0.5000 0.5000"],"frame_ms":2.228,"step_ms":null,"cost_ms":2.228},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material_screenspace_texture","frame":10,"ssim":0.998864,"tile":2,"bevy":{"batch_keys":1,"entities":449,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":47.912,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":19,"entities":521,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":1,"other_material":1,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":3.211,"step_ms":null,"cost_ms":3.211},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material_screenspace_texture","frame":60,"ssim":0.998929,"tile":2,"bevy":{"batch_keys":1,"entities":449,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":60,"frame_ms":3.369,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":68,"entities":521,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":1,"other_material":1,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":1.781,"step_ms":null,"cost_ms":1.781},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material_2d","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":[],"frame":10,"frame_ms":43.886,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":519,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.116,"step_ms":null,"cost_ms":2.116},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/fallback_image","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":45.369,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":17,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":2.391,"step_ms":null,"cost_ms":2.391},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/storage_buffer","frame":30,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":538,"extents":["0.1500 0.1500 0.1500"],"frame":30,"frame_ms":18.59,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":37,"entities":973,"mesh_entities":91,"visible":91,"meshes":8,"materials":92,"batch_keys":0,"other_material":91,"extents":["0.1500 0.1500 0.1500"],"frame_ms":1.729,"step_ms":null,"cost_ms":1.729},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/storage_buffer","frame":60,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":538,"extents":["0.1500 0.1500 0.1500"],"frame":60,"frame_ms":3.415,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":67,"entities":973,"mesh_entities":91,"visible":91,"meshes":8,"materials":92,"batch_keys":0,"other_material":91,"extents":["0.1500 0.1500 0.1500"],"frame_ms":1.544,"step_ms":null,"cost_ms":1.544},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/array_texture","frame":100,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":458,"extents":["0.5000 0.5000 0.5000"],"frame":100,"frame_ms":3.1,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":109,"entities":542,"mesh_entities":11,"visible":11,"meshes":8,"materials":12,"batch_keys":0,"other_material":11,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.565,"step_ms":null,"cost_ms":1.565},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/array_texture","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":458,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":18.854,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":39,"entities":542,"mesh_entities":11,"visible":11,"meshes":8,"materials":12,"batch_keys":0,"other_material":11,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.756,"step_ms":null,"cost_ms":1.756},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":110,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":110,"frame_ms":2.073,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":117,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.499,"step_ms":null,"cost_ms":1.499},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":130,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":130,"frame_ms":2.314,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":137,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.521,"step_ms":null,"cost_ms":1.521},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":29,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":29,"frame_ms":19.345,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":36,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.98,"step_ms":null,"cost_ms":1.98},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":40,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":40,"frame_ms":3.245,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":47,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.381,"step_ms":null,"cost_ms":1.381},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":70,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":70,"frame_ms":2.775,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":77,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.417,"step_ms":null,"cost_ms":1.417},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/sprite_material","frame":95,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":95,"frame_ms":2.352,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":102,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.247,"step_ms":null,"cost_ms":1.247},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_prepass","frame":10,"ssim":0.995071,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":55.783,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":18,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":3.764,"step_ms":null,"cost_ms":3.764},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_prepass","frame":30,"ssim":0.995869,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":30,"frame_ms":5.693,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":38,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.718,"step_ms":null,"cost_ms":2.718},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_prepass","frame":50,"ssim":0.994765,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":50,"frame_ms":4.837,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":58,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.944,"step_ms":null,"cost_ms":2.944},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_prepass","frame":70,"ssim":0.997658,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":70,"frame_ms":4.797,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":78,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.724,"step_ms":null,"cost_ms":2.724},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material_bindless","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":44.178,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":18,"entities":520,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":0,"other_material":2,"extents":["0.5000 0.5000 0.5000"],"frame_ms":2.885,"step_ms":null,"cost_ms":2.885},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/shader_material_2d_bindless","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":450,"extents":[],"frame":10,"frame_ms":45.348,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":522,"mesh_entities":0,"visible":0,"meshes":11,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.696,"step_ms":null,"cost_ms":1.696},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/extended_material_bindless","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["1.0000 1.0000 1.0000"],"frame":30,"frame_ms":19.49,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":39,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["1.0000 1.0000 1.0000"],"frame_ms":1.975,"step_ms":null,"cost_ms":1.975},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/extended_material_bindless","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["1.0000 1.0000 1.0000"],"frame":60,"frame_ms":3.349,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":69,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["1.0000 1.0000 1.0000"],"frame_ms":1.63,"step_ms":null,"cost_ms":1.63},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/automatic_instancing","frame":30,"ssim":0.999933,"tile":0,"bevy":{"batch_keys":0,"entities":65982,"extents":["0.0050 0.0050 0.0050"],"frame":30,"frame_ms":27.191,"materials":1,"mesh_entities":65536,"meshes":6,"other_material":53218,"visible":53218},"raea":{"frame":38,"entities":131590,"mesh_entities":65536,"visible":53218,"meshes":8,"materials":65537,"batch_keys":0,"other_material":53218,"extents":["0.0050 0.0050 0.0050"],"frame_ms":7.295,"step_ms":null,"cost_ms":7.295},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/automatic_instancing","frame":60,"ssim":0.999947,"tile":0,"bevy":{"batch_keys":0,"entities":65982,"extents":["0.0050 0.0050 0.0050"],"frame":60,"frame_ms":8.442,"materials":1,"mesh_entities":65536,"meshes":6,"other_material":53200,"visible":53200},"raea":{"frame":68,"entities":131590,"mesh_entities":65536,"visible":53200,"meshes":8,"materials":65537,"batch_keys":0,"other_material":53200,"extents":["0.0050 0.0050 0.0050"],"frame_ms":7.098,"step_ms":null,"cost_ms":7.098},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/pipeline_constants","frame":10,"ssim":0.999666,"tile":2,"bevy":{"batch_keys":0,"entities":452,"extents":[],"frame":10,"frame_ms":54.194,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":521,"mesh_entities":0,"visible":0,"meshes":10,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.842,"step_ms":null,"cost_ms":1.842},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/compute_shader_game_of_life","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":10,"frame_ms":46.507,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.504,"step_ms":0.673,"cost_ms":3.177},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/compute_shader_game_of_life","frame":11,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":11,"frame_ms":2.841,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":18,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":3.09,"step_ms":0.600,"cost_ms":3.69},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/compute_shader_game_of_life","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":30,"frame_ms":2.461,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.906,"step_ms":0.258,"cost_ms":2.164},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"shader/compute_shader_game_of_life","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":60,"frame_ms":2.438,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.57,"step_ms":0.200,"cost_ms":1.77},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":30,"frame_ms":15.821,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":1.394,"step_ms":null,"cost_ms":1.394},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":60,"frame_ms":2.971,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":0.996,"step_ms":null,"cost_ms":0.996},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/animate_shader","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":16.379,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.141,"step_ms":null,"cost_ms":1.141},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/animate_shader","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":3.12,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.022,"step_ms":null,"cost_ms":1.022},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":16.156,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":38,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.152,"step_ms":null,"cost_ms":1.152},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_defs","frame":10,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":41.059,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":17,"entities":520,"mesh_entities":2,"visible":2,"meshes":8,"materials":3,"batch_keys":0,"other_material":2,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.44,"step_ms":null,"cost_ms":1.44},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material_screenspace_texture","frame":10,"ssim":0.998864,"tile":2,"bevy":{"batch_keys":1,"entities":449,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":43.165,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":19,"entities":521,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":1,"other_material":1,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":2.284,"step_ms":null,"cost_ms":2.284},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material_screenspace_texture","frame":60,"ssim":0.998929,"tile":2,"bevy":{"batch_keys":1,"entities":449,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":60,"frame_ms":3.05,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":69,"entities":521,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":1,"other_material":1,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":1.429,"step_ms":null,"cost_ms":1.429},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material_2d","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":[],"frame":10,"frame_ms":43.369,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":519,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.323,"step_ms":null,"cost_ms":2.323},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/fallback_image","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":42.916,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":17,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.829,"step_ms":null,"cost_ms":1.829},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/storage_buffer","frame":30,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":538,"extents":["0.1500 0.1500 0.1500"],"frame":30,"frame_ms":16.985,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":37,"entities":973,"mesh_entities":91,"visible":91,"meshes":8,"materials":92,"batch_keys":0,"other_material":91,"extents":["0.1500 0.1500 0.1500"],"frame_ms":1.345,"step_ms":null,"cost_ms":1.345},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/storage_buffer","frame":60,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":0,"entities":538,"extents":["0.1500 0.1500 0.1500"],"frame":60,"frame_ms":3.127,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":67,"entities":973,"mesh_entities":91,"visible":91,"meshes":8,"materials":92,"batch_keys":0,"other_material":91,"extents":["0.1500 0.1500 0.1500"],"frame_ms":1.422,"step_ms":null,"cost_ms":1.422},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/array_texture","frame":100,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":458,"extents":["0.5000 0.5000 0.5000"],"frame":100,"frame_ms":2.941,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":109,"entities":542,"mesh_entities":11,"visible":11,"meshes":8,"materials":12,"batch_keys":0,"other_material":11,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.387,"step_ms":null,"cost_ms":1.387},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/array_texture","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":458,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":17.455,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":39,"entities":542,"mesh_entities":11,"visible":11,"meshes":8,"materials":12,"batch_keys":0,"other_material":11,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.807,"step_ms":null,"cost_ms":1.807},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":110,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":110,"frame_ms":1.955,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":117,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.118,"step_ms":null,"cost_ms":1.118},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":130,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":130,"frame_ms":2.054,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":137,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.932,"step_ms":null,"cost_ms":0.932},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":29,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":29,"frame_ms":16.511,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":36,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.329,"step_ms":null,"cost_ms":1.329},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":40,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":40,"frame_ms":2.734,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":47,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.091,"step_ms":null,"cost_ms":1.091},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":70,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":70,"frame_ms":2.452,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":77,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.108,"step_ms":null,"cost_ms":1.108},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/sprite_material","frame":95,"ssim":0.999832,"tile":7,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":95,"frame_ms":2.003,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":102,"entities":520,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.162,"step_ms":null,"cost_ms":1.162},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_prepass","frame":10,"ssim":0.995071,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":48.075,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":18,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":3.033,"step_ms":null,"cost_ms":3.033},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_prepass","frame":30,"ssim":0.995869,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":30,"frame_ms":4.934,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":38,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.933,"step_ms":null,"cost_ms":2.933},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_prepass","frame":50,"ssim":0.994765,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":50,"frame_ms":4.545,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":58,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.598,"step_ms":null,"cost_ms":2.598},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_prepass","frame":70,"ssim":0.997658,"tile":7,"bevy":{"batch_keys":2,"entities":465,"extents":["0.5000 0.5000 0.5000","10.0000 10.0000 0.0000","2.5000 0.0000 2.5000"],"frame":70,"frame_ms":4.264,"materials":3,"mesh_entities":5,"meshes":10,"other_material":3,"visible":5},"raea":{"frame":78,"entities":533,"mesh_entities":5,"visible":5,"meshes":11,"materials":6,"batch_keys":2,"other_material":3,"extents":["0.5000 0.5000 0.5000","10.0000 0.0000 10.0000","2.5000 0.0000 2.5000"],"frame_ms":2.531,"step_ms":null,"cost_ms":2.531},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material_bindless","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.5000 0.5000 0.5000"],"frame":10,"frame_ms":36.073,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":18,"entities":520,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":0,"other_material":2,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.509,"step_ms":null,"cost_ms":1.509},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/shader_material_2d_bindless","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":450,"extents":[],"frame":10,"frame_ms":38.957,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":522,"mesh_entities":0,"visible":0,"meshes":11,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.843,"step_ms":null,"cost_ms":1.843},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material_bindless","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["1.0000 1.0000 1.0000"],"frame":30,"frame_ms":14.968,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":39,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["1.0000 1.0000 1.0000"],"frame_ms":1.337,"step_ms":null,"cost_ms":1.337},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material_bindless","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["1.0000 1.0000 1.0000"],"frame":60,"frame_ms":2.792,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":69,"entities":519,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["1.0000 1.0000 1.0000"],"frame_ms":0.881,"step_ms":null,"cost_ms":0.881},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/automatic_instancing","frame":30,"ssim":0.999933,"tile":0,"bevy":{"batch_keys":0,"entities":65982,"extents":["0.0050 0.0050 0.0050"],"frame":30,"frame_ms":23.804,"materials":1,"mesh_entities":65536,"meshes":6,"other_material":53218,"visible":53218},"raea":{"frame":38,"entities":131590,"mesh_entities":65536,"visible":53218,"meshes":8,"materials":65537,"batch_keys":0,"other_material":53218,"extents":["0.0050 0.0050 0.0050"],"frame_ms":6.48,"step_ms":null,"cost_ms":6.48},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/automatic_instancing","frame":60,"ssim":0.999947,"tile":0,"bevy":{"batch_keys":0,"entities":65982,"extents":["0.0050 0.0050 0.0050"],"frame":60,"frame_ms":7.74,"materials":1,"mesh_entities":65536,"meshes":6,"other_material":53200,"visible":53200},"raea":{"frame":68,"entities":131590,"mesh_entities":65536,"visible":53200,"meshes":8,"materials":65537,"batch_keys":0,"other_material":53200,"extents":["0.0050 0.0050 0.0050"],"frame_ms":6.437,"step_ms":null,"cost_ms":6.437},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/pipeline_constants","frame":10,"ssim":0.999666,"tile":2,"bevy":{"batch_keys":0,"entities":452,"extents":[],"frame":10,"frame_ms":46.526,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":521,"mesh_entities":0,"visible":0,"meshes":10,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.953,"step_ms":null,"cost_ms":1.953},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/compute_shader_game_of_life","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":10,"frame_ms":40.207,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.747,"step_ms":0.391,"cost_ms":2.138},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/compute_shader_game_of_life","frame":11,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":11,"frame_ms":2.539,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":18,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.303,"step_ms":0.475,"cost_ms":2.778},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/compute_shader_game_of_life","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":30,"frame_ms":2.254,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.172,"step_ms":0.197,"cost_ms":1.369},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/compute_shader_game_of_life","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":60,"frame_ms":2.207,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":519,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.161,"step_ms":0.159,"cost_ms":1.32},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/gpu_component_array_buffer","frame":180,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":455,"extents":["0.5000 0.5000 0.5000"],"frame":180,"frame_ms":2.498,"materials":1,"mesh_entities":7,"meshes":6,"other_material":7,"visible":7},"raea":{"frame":188,"entities":546,"mesh_entities":8,"visible":7,"meshes":8,"materials":9,"batch_keys":0,"other_material":7,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.886,"step_ms":null,"cost_ms":0.886},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/gpu_component_array_buffer","frame":240,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":457,"extents":["0.5000 0.5000 0.5000"],"frame":240,"frame_ms":2.405,"materials":1,"mesh_entities":9,"meshes":6,"other_material":9,"visible":9},"raea":{"frame":248,"entities":556,"mesh_entities":10,"visible":9,"meshes":8,"materials":11,"batch_keys":0,"other_material":9,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.823,"step_ms":null,"cost_ms":0.823},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/gpu_component_array_buffer","frame":400,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":464,"extents":["0.5000 0.5000 0.5000"],"frame":400,"frame_ms":2.208,"materials":1,"mesh_entities":16,"meshes":6,"other_material":16,"visible":16},"raea":{"frame":408,"entities":550,"mesh_entities":16,"visible":16,"meshes":8,"materials":17,"batch_keys":0,"other_material":16,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.023,"step_ms":null,"cost_ms":1.023},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/gpu_component_array_buffer","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":450,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":9.644,"materials":1,"mesh_entities":2,"meshes":6,"other_material":2,"visible":2},"raea":{"frame":68,"entities":528,"mesh_entities":3,"visible":2,"meshes":8,"materials":4,"batch_keys":0,"other_material":2,"extents":["0.5000 0.5000 0.5000"],"frame_ms":1.18,"step_ms":null,"cost_ms":1.18},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
diff --git a/sdk/raea/bench/bevy-parity/shader/gpu_component_array_buffer.tsx b/sdk/raea/bench/bevy-parity/shader/gpu_component_array_buffer.tsx
new file mode 100644
index 00000000..8059003a
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/shader/gpu_component_array_buffer.tsx
@@ -0,0 +1,78 @@
+// Bevy v0.20.0 examples/shader/gpu_component_array_buffer.rs in raea's TSX (docs/control.feature FC0a, FC2a): unit
+// cubes at a tenth of their size, each with the example's own Material, assets/shaders/gpu_component_array_buffer.wesl
+// as written: its colour read from a storage buffer of every cube's CustomMaterialData ({ color, pad }, in the struct
+// CustomMaterialDataArray's data_array) by the cube's MeshTag, times its texture (branding/icon.png or
+// bevy_bird_dark.png). The example's update systems, run as Bevy's clock steps them (16 666 667 ns an update, the first
+// update's delta 0): add_cube every 300 ms (on_timer) puts a cube at (x, 0.5, z) with x and z in [-1, 1), a colour in
+// [0, 1)^3 and a coin flip for its texture, all from its ChaCha8Rng (seed 12345, lib/rand.ts); remove_cube every second
+// despawns one of the cubes there before the update, chosen from them in the World's order (spawned in order, a
+// despawn moving the last into its place, a cube spawned on that update joining after), after add_cube's draws on an
+// update both run. The camera at (-2, 1.25, 2.5) looking at the origin, in Bevy's default 1280 x 720 window.
+import { Composition, registerRoot, staticFile, useCurrentFrame } from "raea";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { BevyComponent } from "raea/3d";
+import { Material } from "@raea/render/bevy3d"; // raea/pbr once scene-loop lands (its pbr.ts commit)
+import { ChaCha8Rng } from "../../../../../bench/bevy-parity/lib/rand";
+
+const SHADER = staticFile("shaders/gpu_component_array_buffer.wesl");
+const LIGHT = staticFile("branding/icon.png");
+const DARK = staticFile("branding/bevy_bird_dark.png");
+const DT_NS = 16_666_667;
+
+// `n`: the cube's spawn number, its own as an entity is (its name, which keeps a part one row across frames: a row's
+// texture is its first frame's), its MeshTag and its place in the buffer
+// (where Bevy's GpuComponentArray tags each by its own index)
+type Cube = { n: number; x: number; z: number; color: [number, number, number]; light: boolean };
+
+/** on_timer(period): the updates whose clock crosses a whole period (Timer in Repeating mode, ticked by each delta) */
+const fires = (f: number, periodMs: number) => f > 0 && Math.floor((f * DT_NS) / (periodMs * 1e6)) > Math.floor(((f - 1) * DT_NS) / (periodMs * 1e6));
+
+// the World's cubes after each update, worked out once in order (each frame is the fold of the updates up to it)
+const worlds: Cube[][] = [];
+const rng = ChaCha8Rng.seed_from_u64(12345);
+let spawned = 0;
+function cubesAt(f: number): Cube[] {
+ while (worlds.length <= f) {
+ const k = worlds.length;
+ const cubes = (worlds[k - 1] ?? []).slice();
+ let born: Cube | null = null;
+ if (fires(k, 300)) {
+ const x = rng.random_range(-1, 1);
+ const z = rng.random_range(-1, 1);
+ const color: [number, number, number] = [rng.random_range(0, 1), rng.random_range(0, 1), rng.random_range(0, 1)];
+ born = { n: spawned++, x, z, color, light: rng.random_bool(0.5) };
+ }
+ if (fires(k, 1000) && cubes.length > 0) {
+ // despawned once the update's commands apply, swapping the last of the cubes already there into its place: a
+ // cube spawned this update is in another archetype until PostUpdate adds its render components, so it comes after
+ const i = rng.random_index(cubes.length);
+ const last = cubes.pop()!;
+ if (i < cubes.length) cubes[i] = last;
+ }
+ if (born) cubes.push(born);
+ worlds.push(cubes);
+ }
+ return worlds[f]!;
+}
+
+function Shot() {
+ const cubes = cubesAt(useCurrentFrame());
+ const data_array = Array.from({ length: Math.max(0, ...cubes.map((c) => c.n + 1)) }, () => ({ color: [0, 0, 0], pad: 0 }));
+ for (const c of cubes) data_array[c.n] = { color: c.color, pad: 0 };
+ return (
+ <>
+ {cubes.map((c) => (
+ <Mesh3d key={c.n} name={`cube${c.n}`} transform={{ translation: [c.x, 0.5, c.z], rotation: [0, 0, 0, 1], scale: [0.1, 0.1, 0.1] }}>
+ <Cuboid half_size={[0.5, 0.5, 0.5]} />
+ <Material fragment={SHADER} buffers={{ material_data: { data_array } }} textures={{ color_texture: c.light ? LIGHT : DARK }} />
+ <BevyComponent type="bevy_mesh::components::MeshTag" value={{ value: c.n }} />
+ </Mesh3d>
+ ))}
+ <Camera3d transform={Transform.fromXyz(-2, 1.25, 2.5).lookingAt([0, 0, 0])} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={401} fps={60} width={1280} height={720} />);
diff --git a/sdk/render/src/3d/materials.tsx b/sdk/render/src/3d/materials.tsx
index 473a41ec..f3d8d609 100644
--- a/sdk/render/src/3d/materials.tsx
+++ b/sdk/render/src/3d/materials.tsx
@@ -124,12 +124,14 @@ export interface SurfaceShaderSpec {
/** shader defs: each NAME a WESL condition for `@if(NAME)` (a number is true), and a whole number also
* `constants::NAME`; each set of defs compiles its own pipeline */
defs?: ShaderDefs;
- /** a <Material>'s own (docs/control.feature FC2a): its vertex shader file and what its Material methods give, and its
- * read-only storage buffers; set by <Material>, not on a ShaderExtension */
+ /** a <Material>'s own (FC2a): what its Material methods give, and its storage buffers; set by <Material> only */
own?: OwnMaterialFields;
- buffers?: Record<string, (number | number[])[]>;
+ buffers?: Record<string, StorageValue>;
}
+/** A storage buffer's value in its WGSL type's layout: a number, a list or { field: value }. @bevy bevy_render::storage::ShaderBuffer */
+export type StorageValue = number | StorageValue[] | { [field: string]: StorageValue };
+
/** What a <Material>'s Material methods give: vertex_shader, alpha_mode, depth_bias and the faces its specialize culls. */
export type OwnMaterialFields = { vertex?: string; alpha_mode?: unknown; depth_bias?: number; cull_mode?: "Front" | "Back" | null };
export type ShaderDefs = Record<string, boolean | number>;
diff --git a/sdk/render/src/bevy3d/material.tsx b/sdk/render/src/bevy3d/material.tsx
index 4182d582..2bce520a 100644
--- a/sdk/render/src/bevy3d/material.tsx
+++ b/sdk/render/src/bevy3d/material.tsx
@@ -1,6 +1,7 @@
// Your own Material (docs/control.feature FC2a): Bevy's Material, its shaders the author's files compiled as written.
import { ExtendedMaterial, ShaderExtension, StandardMaterial, type AlphaMode } from "./materials";
import { surfaceShader, type SurfaceShaderSpec } from "../3d";
+import type { StorageValue } from "../3d/materials";
/** Your own Material (docs/control.feature FC2a): Bevy's `impl Material`, not an extension of StandardMaterial. Its
* fragment_shader() (and vertex_shader(), when `vertex` names one) is the file compiled as written: its imports (a
@@ -18,9 +19,11 @@ export interface MaterialProps {
/** a vertex shader file, as Material::vertex_shader names one (Bevy's mesh vertex shader when not given) */
vertex?: string;
uniforms?: Record<string, number | number[] | string | Record<string, number | number[] | string>>;
- /** its read-only storage buffers (`var<storage, read> NAME: array<T(, N)>`, up to 2): each a list of its elements, a
- * number or [x, y(, z(, w))] each, as Bevy's ShaderBuffer::from(Vec<[f32; 4]>) holds them */
- buffers?: Record<string, (number | number[])[]>;
+ /** its read-only storage buffers (`var<storage, read> NAME: TYPE`, up to 2), each in TYPE's storage layout: an
+ * array<T(, N)> a list of its elements, a number or [x, y(, z(, w))] each, as Bevy's ShaderBuffer::from(Vec<[f32; 4]>)
+ * holds them; a struct of the source's { field: value } (gpu_component_array_buffer's { data_array: [...] }); a
+ * matrix its columns */
+ buffers?: Record<string, StorageValue>;
textures?: SurfaceShaderSpec["textures"];
defs?: SurfaceShaderSpec["defs"];
alpha_mode?: AlphaMode;
@@ -33,10 +36,13 @@ export interface MaterialProps {
const ALPHA = ["Opaque", "Blend", "Premultiplied", "Add", "Multiply", "AlphaToCoverage"];
+/** A storage buffer's value: numbers, lists of them and { field: value } structs, as StorageValue. */
+const storageValue = (x: unknown): boolean => Number.isFinite(x) || (Array.isArray(x) && x.every(storageValue)) || (typeof x === "object" && x !== null && !Array.isArray(x) && Object.values(x).every(storageValue));
+
/** A Material's props checked, as the shader spec it is drawn by (in a Mesh3d an OwnMaterial, in a Mesh2d its
* Material2d). */
function ownSpec({ fragment, vertex, uniforms, buffers, textures, defs, alpha_mode, depth_bias, cull_mode, constants }: MaterialProps): SurfaceShaderSpec {
- for (const [k, b] of Object.entries(buffers ?? {})) if (!Array.isArray(b) || !b.every((x) => Number.isFinite(x) || (Array.isArray(x) && x.length >= 2 && x.length <= 4 && x.every(Number.isFinite)))) throw new TypeError(`Material: buffer ${k} is a list of numbers or [x, y(, z(, w))], got ${JSON.stringify(b)}`);
+ for (const [k, b] of Object.entries(buffers ?? {})) if (typeof b !== "object" || b === null || !storageValue(b)) throw new TypeError(`Material: buffer ${k} is its elements' list or a struct's { field: value }, of numbers and lists, got ${JSON.stringify(b)}`);
if (typeof fragment !== "string" || !fragment) throw new TypeError(`Material: fragment is the shader file, staticFile("shaders/x.wesl"), got ${JSON.stringify(fragment)}`);
if (vertex !== undefined && (typeof vertex !== "string" || !vertex)) throw new TypeError(`Material: vertex is a shader file, got ${JSON.stringify(vertex)}`);
const mask = typeof alpha_mode === "object" && alpha_mode !== null && Number.isFinite((alpha_mode as { Mask?: number }).Mask);
diff --git a/systems/shader/src/layout.rs b/systems/shader/src/layout.rs
index c3e39083..298e7e2a 100644
--- a/systems/shader/src/layout.rs
+++ b/systems/shader/src/layout.rs
@@ -46,8 +46,15 @@ pub fn struct_fields(src: &str, ty: &str, defs: &[ShaderDefVal]) -> Result<Vec<(
if cond.is_some_and(|d| !set(d)) {
continue;
}
- let Some((n, t)) = field.trim_end_matches(',').split_once(':') else { return Err(format!("struct {ty}: {line:?} isn't NAME: TYPE")) };
- out.push((n.trim().to_string(), t.trim().to_string()));
+ // fields on one line too (`struct S { a: f32, b: vec2<f32> }`): split at the commas outside a type's <>
+ let mut depth = 0i32;
+ for part in field.split(|c: char| {
+ depth += (c == '<') as i32 - (c == '>') as i32;
+ c == ',' && depth == 0
+ }).map(str::trim).filter(|p| !p.is_empty()) {
+ let Some((n, t)) = part.split_once(':') else { return Err(format!("struct {ty}: {line:?} isn't NAME: TYPE")) };
+ out.push((n.trim().to_string(), t.trim().to_string()));
+ }
}
Ok(out)
}
diff --git a/systems/shader/src/lib.rs b/systems/shader/src/lib.rs
index 9ce4d094..cf6a9260 100644
--- a/systems/shader/src/lib.rs
+++ b/systems/shader/src/lib.rs
@@ -28,6 +28,7 @@ use raea_sys_material::shader_material::{defs, ident, uniform, Uniform, SLOTS, T
mod ext_bind;
mod layout;
+mod storage_layout;
/// Uniforms packed in their declared types' WGSL layout (a compute's as written: raea-sys-compute written.rs).
pub use layout::slots as uniform_slots;
pub mod own;
diff --git a/systems/shader/src/own.rs b/systems/shader/src/own.rs
index c2a52860..699c6902 100644
--- a/systems/shader/src/own.rs
+++ b/systems/shader/src/own.rs
@@ -271,7 +271,7 @@ pub fn build(world: &mut World, v: &Value, image: &mut impl FnMut(&mut World, &V
let mut b = Vec::new();
for (name, ty) in &storages {
let v = buffers.get(name).ok_or_else(|| format!("{path}'s storage buffer {name} has no value"))?;
- b.push(world.resource_mut::<Assets<ShaderBuffer>>().add(storage(name, ty, v).map_err(|e| format!("{path}: {e}"))?));
+ b.push(world.resource_mut::<Assets<ShaderBuffer>>().add(storage(&src, &ins.defs, name, ty, v).map_err(|e| format!("{path}: {e}"))?));
}
while b.len() < 2 {
b.push(world.resource_mut::<Assets<ShaderBuffer>>().add(ShaderBuffer::from(vec![0u32; 4])));
diff --git a/systems/shader/src/own_live.rs b/systems/shader/src/own_live.rs
index b78481ba..f91dce3e 100644
--- a/systems/shader/src/own_live.rs
+++ b/systems/shader/src/own_live.rs
@@ -23,32 +23,11 @@ pub struct Packing {
pub defs: Vec<ShaderDefVal>,
}
-/// A storage buffer's contents for its WGSL type, `array<T, N>` or `array<T>` with T an f32, u32 or i32 or a vec2-4
-/// of one: each element a number or [x, y(, z(, w))], in WGSL's storage layout (a vec3 takes 16 bytes, as a vec4).
-/// An empty one is 16 zero bytes (a binding can't be empty).
-pub fn storage(name: &str, ty: &str, v: &Value) -> Result<ShaderBuffer, String> {
- let inner = ty.strip_prefix("array<").and_then(|t| t.strip_suffix('>')).ok_or_else(|| format!("storage buffer {name}: its type is array<T> or array<T, N>, got {ty} (the rest are FC2a's to come)"))?;
- let el = match inner.rfind(',') {
- Some(i) if inner[i + 1..].trim().parse::<u64>().is_ok() => inner[..i].trim(),
- _ => inner.trim(),
- };
- let (k, n) = layout::kind(el).ok_or_else(|| format!("storage buffer {name}: its element {el} isn't f32, u32, i32 or a vec2/3/4 of one"))?;
- let stride = if n == 1 { 1 } else if n == 2 { 2 } else { 4 };
- let items = v.as_array().ok_or_else(|| format!("storage buffer {name} is a list of its elements, got {v}"))?;
- let mut words = vec![0u32; (items.len() * stride).max(4)];
- for (i, it) in items.iter().enumerate() {
- let comps: Vec<f64> = match it {
- Value::Array(a) => a.iter().filter_map(Value::as_f64).collect(),
- x => x.as_f64().into_iter().collect(),
- };
- if comps.len() != n {
- return Err(format!("storage buffer {name}: element {i} is {n} numbers ({el}), got {it}"));
- }
- for (c, x) in comps.iter().enumerate() {
- words[i * stride + c] = layout::word(k, *x as f32);
- }
- }
- Ok(ShaderBuffer::from(words))
+/// A storage buffer's contents for its WGSL type as `src` declares it, in WGSL's storage layout (storage_layout.rs):
+/// `array<T, N>` or `array<T>` of numbers or [x, y(, z(, w))], a matrix, or a struct of the source's from {field: value}
+/// (a vec3 takes 16 bytes, as a vec4). An empty one is 16 zero bytes (a binding can't be empty).
+pub fn storage(src: &str, defs: &[ShaderDefVal], name: &str, ty: &str, v: &Value) -> Result<ShaderBuffer, String> {
+ Ok(ShaderBuffer::from(crate::storage_layout::words(src, defs, name, ty, v)?))
}
/// The frame's values for a part whose Material isn't on yet, applied when it is (own.rs put).
@@ -88,7 +67,7 @@ pub fn patch(world: &mut World, e: Entity, v: &Value) -> Result<(), String> {
let given = v.get("buffers").and_then(Value::as_object).cloned().unwrap_or_default();
for ((name, ty), b) in p.storages.iter().zip(bufs) {
let Some(x) = given.get(name) else { continue };
- let sb = storage(name, ty, x)?;
+ let sb = storage(&p.src, &p.defs, name, ty, x)?;
if let Some(mut cur) = world.resource_mut::<Assets<ShaderBuffer>>().get_mut(&b) {
*cur = sb;
}
@@ -105,13 +84,13 @@ mod tests {
_ => vec![],
};
let v = serde_json::json!([[1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0]]);
- let w = words(super::storage("colors", "array<vec4<f32>, 5>", &v).unwrap());
+ let w = words(super::storage("", &[], "colors", "array<vec4<f32>, 5>", &v).unwrap());
assert_eq!(w[..8].iter().map(|x| f32::from_bits(*x)).collect::<Vec<_>>(), vec![1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]);
// a vec3 takes 16 bytes; a u32 rounds
- let w = words(super::storage("p", "array<vec3<f32>>", &serde_json::json!([[1, 2, 3], [4, 5, 6]])).unwrap());
+ let w = words(super::storage("", &[], "p", "array<vec3<f32>>", &serde_json::json!([[1, 2, 3], [4, 5, 6]])).unwrap());
assert_eq!(f32::from_bits(w[4]), 4.0);
- assert_eq!(words(super::storage("n", "array<u32>", &serde_json::json!([2.6, 7])).unwrap())[..2], [3, 7]);
- assert!(super::storage("p", "array<vec3<f32>>", &serde_json::json!([[1, 2]])).unwrap_err().contains("element 0"));
- assert!(super::storage("m", "array<mat4x4<f32>>", &serde_json::json!([])).is_err());
+ assert_eq!(words(super::storage("", &[], "n", "array<u32>", &serde_json::json!([2.6, 7])).unwrap())[..2], [3, 7]);
+ assert!(super::storage("", &[], "p", "array<vec3<f32>>", &serde_json::json!([[1, 2]])).unwrap_err().contains("element 0"));
+ assert!(super::storage("", &[], "m", "array<bool>", &serde_json::json!([])).is_err());
}
}
diff --git a/systems/shader/src/storage_layout.rs b/systems/shader/src/storage_layout.rs
new file mode 100644
index 00000000..ddd5e420
--- /dev/null
+++ b/systems/shader/src/storage_layout.rs
@@ -0,0 +1,150 @@
+//! A storage buffer's contents in WGSL's storage layout (docs/control.feature FC2a): any host-shareable type its
+//! source declares (f32, u32, i32 and their vec2-4, matCxR<f32>, array<T, N>, array<T>, and the source's own structs,
+//! a field under @if(DEF) as layout.rs's struct_fields reads it) from the value given: a number, [components],
+//! [elements] or {field: value}. Bevy's examples write such buffers with encase, as gpu_component_array_buffer's
+//! `var<storage> material_data: CustomMaterialDataArray` holds `data_array: array<CustomMaterialData>`.
+
+use bevy::shader::ShaderDefVal;
+use serde_json::Value;
+
+use crate::layout::{kind, struct_fields, undeclared, word};
+
+/// The source whose structs a type may name, and the defs its fields' @if read.
+struct Cx<'a> {
+ src: &'a str,
+ defs: &'a [ShaderDefVal],
+}
+
+/// `matCxR<f32>` (or `matCxRf`): its columns and rows.
+fn mat(ty: &str) -> Option<(usize, usize)> {
+ let t = ty.replace(' ', "");
+ let r = t.strip_prefix("mat")?;
+ let (dims, scalar) = r.split_at(3.min(r.len()));
+ if !(scalar == "<f32>" || scalar == "f") {
+ return None;
+ }
+ let (c, rows) = dims.split_once('x')?;
+ Some((c.parse().ok().filter(|n| (2..=4).contains(n))?, rows.parse().ok().filter(|n| (2..=4).contains(n))?))
+}
+
+/// `array<T, N>` or `array<T>`: T, and N when it has one.
+fn array(ty: &str) -> Option<(&str, Option<usize>)> {
+ let inner = ty.trim().strip_prefix("array<")?.strip_suffix('>')?;
+ Some(match inner.rfind(',') {
+ Some(i) if inner[i + 1..].trim().parse::<usize>().is_ok() => (inner[..i].trim(), inner[i + 1..].trim().parse().ok()),
+ _ => (inner.trim(), None),
+ })
+}
+
+/// A type's alignment and size in bytes; a runtime array's size is that of the elements `v` gives.
+fn align_size(cx: &Cx, ty: &str, v: Option<&Value>) -> Result<(usize, usize), String> {
+ if let Some((_, n)) = kind(ty) {
+ return Ok(match n {
+ 1 => (4, 4),
+ 2 => (8, 8),
+ 3 => (16, 12),
+ _ => (16, 16),
+ });
+ }
+ if let Some((c, r)) = mat(ty) {
+ let a = if r == 2 { 8 } else { 16 };
+ return Ok((a, c * a));
+ }
+ if let Some((el, n)) = array(ty) {
+ let (a, s) = align_size(cx, el, None)?;
+ let count = n.unwrap_or_else(|| v.and_then(Value::as_array).map_or(0, Vec::len));
+ return Ok((a, count * s.div_ceil(a) * a));
+ }
+ let (mut end, mut align) = (0usize, 4usize);
+ for (name, fty) in struct_fields(cx.src, ty, cx.defs)? {
+ let (a, s) = align_size(cx, &fty, v.and_then(|v| v.get(&name)))?;
+ end = end.div_ceil(a) * a + s;
+ align = align.max(a);
+ }
+ Ok((align, end.div_ceil(align) * align))
+}
+
+/// `v` written as `ty` into `out` at byte `at`.
+fn put(cx: &Cx, ty: &str, v: &Value, what: &str, out: &mut [u8], at: usize) -> Result<(), String> {
+ if let Some((k, n)) = kind(ty) {
+ let comps: Vec<f64> = match v {
+ Value::Array(a) => a.iter().filter_map(Value::as_f64).collect(),
+ x => x.as_f64().into_iter().collect(),
+ };
+ if comps.len() != n || v.as_array().is_some_and(|a| a.len() != n) {
+ return Err(format!("{what} is {n} numbers ({ty}), got {v}"));
+ }
+ for (c, x) in comps.iter().enumerate() {
+ out[at + 4 * c..at + 4 * c + 4].copy_from_slice(&word(k, *x as f32).to_le_bytes());
+ }
+ return Ok(());
+ }
+ if let Some((c, r)) = mat(ty) {
+ // its columns, [[...], ...], or its c x r numbers column by column
+ let cols: Vec<Value> = match v.as_array() {
+ Some(a) if a.len() == c => a.clone(),
+ Some(a) if a.len() == c * r => a.chunks(r).map(|ch| Value::Array(ch.to_vec())).collect(),
+ _ => return Err(format!("{what} is a {ty}: {c} columns of {r} numbers, got {v}")),
+ };
+ let stride = if r == 2 { 8 } else { 16 };
+ for (i, col) in cols.iter().enumerate() {
+ put(cx, &format!("vec{r}<f32>"), col, &format!("{what}'s column {i}"), out, at + i * stride)?;
+ }
+ return Ok(());
+ }
+ if let Some((el, n)) = array(ty) {
+ let items = v.as_array().ok_or_else(|| format!("{what} is a list of its elements ({ty}), got {v}"))?;
+ if let Some(n) = n.filter(|n| items.len() > *n) {
+ return Err(format!("{what} holds {n} elements ({ty}), got {}", items.len()));
+ }
+ let (a, s) = align_size(cx, el, None)?;
+ for (i, it) in items.iter().enumerate() {
+ put(cx, el, it, &format!("{what}'s element {i}"), out, at + i * s.div_ceil(a) * a)?;
+ }
+ return Ok(());
+ }
+ let fields = struct_fields(cx.src, ty, cx.defs).map_err(|e| format!("{what}: {e}"))?;
+ let o = v.as_object().ok_or_else(|| format!("{what} is a {ty}, {{field: value}}, got {v}"))?;
+ if let Some(k) = undeclared(o, &fields) {
+ return Err(format!("{what}: {ty} has no field {k}"));
+ }
+ let mut off = 0usize;
+ for (name, fty) in &fields {
+ let fv = o.get(name).ok_or_else(|| format!("{what}: its field {name} has no value"))?;
+ let (a, s) = align_size(cx, fty, Some(fv))?;
+ off = off.div_ceil(a) * a;
+ put(cx, fty, fv, &format!("{what}.{name}"), out, at + off)?;
+ off += s;
+ }
+ Ok(())
+}
+
+/// The buffer `name` of WGSL type `ty` (declared in `src`) holding `v`, as 32-bit words; at least 16 bytes, as a
+/// binding can't be empty.
+pub fn words(src: &str, defs: &[ShaderDefVal], name: &str, ty: &str, v: &Value) -> Result<Vec<u32>, String> {
+ let cx = Cx { src, defs };
+ let (_, size) = align_size(&cx, ty, Some(v)).map_err(|e| format!("storage buffer {name}: {e}"))?;
+ let mut out = vec![0u8; size.max(16).div_ceil(4) * 4];
+ put(&cx, ty, v, &format!("storage buffer {name}"), &mut out, 0)?;
+ Ok(out.chunks(4).map(|w| u32::from_le_bytes([w[0], w[1], w[2], w[3]])).collect())
+}
+
+#[cfg(test)]
+mod tests {
+ use serde_json::json;
+
+ #[test]
+ fn structs_arrays_and_matrices_are_laid_out_as_wgsl_stores_them() {
+ let src = "struct D {\n color: vec3<f32>,\n pad: u32,\n}\nstruct A {\n data_array: array<D>,\n}\nstruct S { a: f32, b: vec2<f32>, c: vec3<f32> }\n";
+ let w = super::words(src, &[], "m", "A", &json!({"data_array": [{"color": [0.5, 1, 2], "pad": 7}, {"color": [3, 4, 5], "pad": 0}]})).unwrap();
+ assert_eq!(w.len(), 8);
+ assert_eq!((f32::from_bits(w[0]), f32::from_bits(w[2]), w[3], f32::from_bits(w[4])), (0.5, 2.0, 7, 3.0));
+ // a at 0, b at 8 (vec2 aligned to 8), c at 16; the struct 32 bytes (aligned to 16)
+ let s = super::words(src, &[], "s", "array<S, 2>", &json!([{"a": 1, "b": [2, 3], "c": [4, 5, 6]}])).unwrap();
+ assert_eq!((s.len(), f32::from_bits(s[2]), f32::from_bits(s[4]), f32::from_bits(s[6])), (16, 2.0, 4.0, 6.0));
+ let m = super::words(src, &[], "t", "mat3x3<f32>", &json!([1, 2, 3, 4, 5, 6, 7, 8, 9])).unwrap();
+ assert_eq!((m.len(), f32::from_bits(m[4]), f32::from_bits(m[10])), (12, 4.0, 9.0));
+ assert!(super::words(src, &[], "m", "A", &json!({"data_array": [{"color": [1, 2]}]})).unwrap_err().contains("color"));
+ assert!(super::words(src, &[], "m", "A", &json!({"data": []})).unwrap_err().contains("no field data"));
+ }
+}