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: a Sprite's own Material (Bevy's SpriteMaterial), its values per frame in live play, and scripted keys in the parity host (shader/sprite_material, 130/130)

shinyobjectz1b6fbfc39053
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index b9e435c8..089ca9f1 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -129,3 +129,4 @@ shader/shader_material_2d
shader/fallback_image
shader/storage_buffer
shader/array_texture
+shader/sprite_material
diff --git a/bench/bevy-parity/input/sprite_material.json b/bench/bevy-parity/input/sprite_material.json
new file mode 100644
index 00000000..48b7367f
--- /dev/null
+++ b/bench/bevy-parity/input/sprite_material.json
@@ -0,0 +1 @@
+{"30": ["Space"], "31": [], "100": ["Space"], "101": []}
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index cdba63f0..b1366d35 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -128,3 +128,4 @@ shader/shader_material_2d - 10
shader/fallback_image - 10
shader/storage_buffer - 30,60
shader/array_texture - 30,100
+shader/sprite_material - 29,40,70,95,110,130 bench/bevy-parity/input/sprite_material.json
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index 9aadebcd..2a443679 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 **129**, passing **129**, excluded **16** (docs/bevy-parity/excluded.tsv), left **293**.
+Examples: **438**, ported **130**, passing **130**, excluded **16** (docs/bevy-parity/excluded.tsv), left **292**.
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.
@@ -26,8 +26,6 @@ doesn't pay.
| 3d/orthographic | 10 | 0.999503 | 0 | 5 / 2 | 446 / 515 | 10 / 9 | 6 / 3 | 46.082 / 2.443 = 2.443 + 0 | yes | |
| 3d/parenting | 30 | 0.999969 | 0 | 1 / 1 | 443 / 512 | 6 / 8 | 2 / 2 | 18.568 / 1.828 = 1.828 + 0 | yes | |
| 3d/parenting | 60 | 0.999968 | 0 | 1 / 1 | 443 / 512 | 6 / 8 | 2 / 2 | 3.63 / 1.367 = 1.367 + 0 | yes | |
-| 2d/mesh2d | 10 | 1.000000 | 0 | 0 / 0 | 441 / 510 | 6 / 8 | 1 / 1 | 44.778 / 1.995 = 1.995 + 0 | yes | |
-| 2d/sprite | 10 | 1.000000 | 0 | 0 / 0 | 441 / 510 | 5 / 7 | 1 / 1 | 44.167 / 1.99 = 1.99 + 0 | yes | |
| transforms/3d_rotation | 30 | 1.000000 | 0 | 1 / 1 | 442 / 511 | 6 / 8 | 2 / 2 | 18.572 / 1.838 = 1.838 + 0 | yes | |
| transforms/3d_rotation | 60 | 1.000000 | 0 | 1 / 1 | 442 / 511 | 6 / 8 | 2 / 2 | 3.205 / 1.283 = 1.283 + 0 | yes | |
| 2d/sprite_flipping | 10 | 1.000000 | 0 | 0 / 0 | 441 / 510 | 5 / 7 | 1 / 1 | 42.969 / 1.847 = 1.847 + 0 | yes | |
@@ -39,8 +37,6 @@ doesn't pay.
| transforms/scale | 300 | 1.000000 | 0 | 1 / 1 | 442 / 511 | 6 / 8 | 2 / 2 | 2.741 / 1.413 = 1.413 + 0 | yes | |
| transforms/scale | 60 | 1.000000 | 0 | 1 / 1 | 442 / 511 | 6 / 8 | 2 / 2 | 10.831 / 1.365 = 1.365 + 0 | yes | |
| 3d/texture | 10 | 0.999547 | 1 | 3 / 3 | 443 / 513 | 6 / 8 | 4 / 4 | 46.232 / 2.094 = 2.094 + 0 | yes | |
-| 2d/sprite_sheet | 30 | 1.000000 | 0 | 0 / 0 | 441 / 510 | 5 / 7 | 1 / 1 | 16.546 / 1.413 = 1.413 + 0 | yes | |
-| 2d/sprite_sheet | 60 | 1.000000 | 0 | 0 / 0 | 441 / 510 | 5 / 7 | 1 / 1 | 2.266 / 1.187 = 1.187 + 0 | yes | |
| 3d/pbr | 30 | 0.997686 | 8 | 56 / 56 | 499 / 566 | 6 / 8 | 57 / 57 | 20.635 / 1.946 = 1.946 + 0 | yes | |
| 3d/pbr | 60 | 0.997686 | 8 | 56 / 56 | 499 / 566 | 6 / 8 | 57 / 57 | 3.279 / 1.644 = 1.644 + 0 | yes | |
| 3d/animated_material | 30 | 0.999892 | 0 | 9 / 9 | 449 / 518 | 6 / 8 | 10 / 19 | 20.127 / 1.81 = 1.81 + 0 | yes | |
@@ -180,21 +176,31 @@ doesn't pay.
| 2d/sprite_scale | 10 | 0.992281 | 11 | 0 / 0 | 486 / 532 | 5 / 7 | 1 / 1 | 45.502 / 2.239 = 2.239 + 0 | yes | |
| 2d/sprite_scale | 60 | 0.992281 | 11 | 0 / 0 | 486 / 532 | 5 / 7 | 1 / 1 | 2.28 / 1.553 = 1.553 + 0 | yes | |
| 2d/sprite_slice | 10 | 0.997293 | 11 | 0 / 0 | 464 / 521 | 5 / 7 | 1 / 1 | 43.511 / 1.426 = 1.426 + 0 | yes | |
-| shader/storage_buffer | 30 | 0.999999 | 0 | 0 / 0 | 538 / 965 | 6 / 8 | 1 / 92 | 18.685 / 1.802 = 1.802 + 0 | yes | |
-| shader/storage_buffer | 60 | 0.999999 | 0 | 0 / 0 | 538 / 965 | 6 / 8 | 1 / 92 | 3.633 / 1.706 = 1.706 + 0 | yes | |
-| shader/extended_material | 30 | 1.000000 | 0 | 0 / 0 | 448 / 511 | 6 / 8 | 1 / 2 | 19.433 / 1.988 = 1.988 + 0 | yes | |
-| shader/extended_material | 60 | 1.000000 | 0 | 0 / 0 | 448 / 511 | 6 / 8 | 1 / 2 | 3.433 / 1.606 = 1.606 + 0 | yes | |
-| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 511 | 6 / 8 | 1 / 2 | 23.168 / 2.181 = 2.181 + 0 | yes | |
-| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 511 | 6 / 8 | 1 / 2 | 5.32 / 1.498 = 1.498 + 0 | yes | |
-| ui/ui_material | 10 | 0.999993 | 0 | 0 / 0 | 446 / 510 | 5 / 7 | 1 / 1 | 50.695 / 3.017 = 3.017 + 0 | yes | |
-| shader/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 511 | 6 / 8 | 1 / 2 | 20.285 / 2.107 = 2.107 + 0 | yes | |
-| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 512 | 7 / 8 | 1 / 3 | 49.424 / 1.777 = 1.777 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 513 | 7 / 9 | 2 / 3 | 48.937 / 3.225 = 3.225 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 513 | 7 / 9 | 2 / 3 | 3.417 / 1.736 = 1.736 + 0 | yes | |
-| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 511 | 6 / 8 | 1 / 1 | 47.105 / 1.75 = 1.75 + 0 | yes | |
-| shader/fallback_image | 10 | 1.000000 | 0 | 0 / 0 | 447 / 511 | 6 / 8 | 1 / 2 | 46.188 / 2.415 = 2.415 + 0 | yes | |
-| shader/array_texture | 100 | 1.000000 | 0 | 0 / 0 | 458 / 534 | 6 / 8 | 1 / 12 | 3.238 / 1.589 = 1.589 + 0 | yes | |
-| shader/array_texture | 30 | 1.000000 | 0 | 0 / 0 | 458 / 534 | 6 / 8 | 1 / 12 | 19.592 / 1.952 = 1.952 + 0 | yes | |
+| shader/extended_material | 30 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 19.33 / 2.034 = 2.034 + 0 | yes | |
+| shader/extended_material | 60 | 1.000000 | 0 | 0 / 0 | 448 / 519 | 6 / 8 | 1 / 2 | 3.452 / 1.877 = 1.877 + 0 | yes | |
+| 2d/mesh2d | 10 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 6 / 8 | 1 / 1 | 45.401 / 2.518 = 2.518 + 0 | yes | |
+| 2d/sprite | 10 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 5 / 7 | 1 / 1 | 45.738 / 2.552 = 2.552 + 0 | yes | |
+| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 18.832 / 1.498 = 1.498 + 0 | yes | |
+| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 3.398 / 1.718 = 1.718 + 0 | yes | |
+| 2d/sprite_sheet | 30 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 5 / 7 | 1 / 1 | 17.822 / 1.703 = 1.703 + 0 | yes | |
+| 2d/sprite_sheet | 60 | 1.000000 | 0 | 0 / 0 | 441 / 518 | 5 / 7 | 1 / 1 | 2.696 / 1.576 = 1.576 + 0 | yes | |
+| ui/ui_material | 10 | 0.999993 | 0 | 0 / 0 | 446 / 518 | 5 / 7 | 1 / 1 | 46.74 / 2.14 = 2.14 + 0 | yes | |
+| shader/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 18.783 / 1.808 = 1.808 + 0 | yes | |
+| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 520 | 7 / 8 | 1 / 3 | 47.158 / 1.673 = 1.673 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 49.575 / 2.93 = 2.93 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 521 | 7 / 9 | 2 / 3 | 3.42 / 1.81 = 1.81 + 0 | yes | |
+| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 1 | 44.328 / 2.569 = 2.569 + 0 | yes | |
+| shader/fallback_image | 10 | 1.000000 | 0 | 0 / 0 | 447 / 519 | 6 / 8 | 1 / 2 | 46.39 / 2.292 = 2.292 + 0 | yes | |
+| shader/storage_buffer | 30 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 18.943 / 1.755 = 1.755 + 0 | yes | |
+| shader/storage_buffer | 60 | 0.999999 | 0 | 0 / 0 | 538 / 973 | 6 / 8 | 1 / 92 | 3.51 / 1.665 = 1.665 + 0 | yes | |
+| shader/array_texture | 100 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 3.291 / 1.574 = 1.574 + 0 | yes | |
+| shader/array_texture | 30 | 1.000000 | 0 | 0 / 0 | 458 / 542 | 6 / 8 | 1 / 12 | 19.391 / 1.975 = 1.975 + 0 | yes | |
+| shader/sprite_material | 110 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.45 / 1.676 = 1.676 + 0 | yes | |
+| shader/sprite_material | 130 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.375 / 1.573 = 1.573 + 0 | yes | |
+| shader/sprite_material | 29 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 18.236 / 2.007 = 2.007 + 0 | yes | |
+| shader/sprite_material | 40 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 3.11 / 1.629 = 1.629 + 0 | yes | |
+| shader/sprite_material | 70 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.606 / 1.505 = 1.505 + 0 | yes | |
+| shader/sprite_material | 95 | 0.999832 | 7 | 0 / 0 | 455 / 520 | 5 / 7 | 1 / 1 | 2.456 / 1.656 = 1.656 + 0 | yes | |
## Excluded
diff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonl
index a77c2e77..085ed50c 100644
--- a/docs/bevy-parity/results.jsonl
+++ b/docs/bevy-parity/results.jsonl
@@ -13,8 +13,6 @@
{"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":46.082,"materials":6,"mesh_entities":5,"meshes":10,"other_material":0,"visible":5},"raea":{"frame":17,"entities":515,"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.443,"step_ms":null,"cost_ms":2.443},"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.568,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":37,"entities":512,"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.828,"step_ms":null,"cost_ms":1.828},"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.63,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":67,"entities":512,"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.367,"step_ms":null,"cost_ms":1.367},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"2d/mesh2d","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":44.778,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":510,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.995,"step_ms":null,"cost_ms":1.995},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"2d/sprite","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":44.167,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":510,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.99,"step_ms":null,"cost_ms":1.99},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"transforms/3d_rotation","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":18.572,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":37,"entities":511,"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.838,"step_ms":null,"cost_ms":1.838},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"transforms/3d_rotation","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":3.205,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":511,"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.283,"step_ms":null,"cost_ms":1.283},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"2d/sprite_flipping","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":42.969,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":510,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.847,"step_ms":null,"cost_ms":1.847},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
@@ -26,8 +24,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.741,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":307,"entities":511,"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.413,"step_ms":null,"cost_ms":1.413},"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":10.831,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":511,"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.365,"step_ms":null,"cost_ms":1.365},"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":46.232,"materials":4,"mesh_entities":3,"meshes":6,"other_material":0,"visible":3},"raea":{"frame":17,"entities":513,"mesh_entities":3,"visible":3,"meshes":8,"materials":4,"batch_keys":3,"other_material":0,"extents":["4.0000 0.0000 1.0000"],"frame_ms":2.094,"step_ms":null,"cost_ms":2.094},"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":16.546,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":510,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.413,"step_ms":null,"cost_ms":1.413},"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.266,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":510,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.187,"step_ms":null,"cost_ms":1.187},"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.635,"materials":57,"mesh_entities":56,"meshes":6,"other_material":0,"visible":56},"raea":{"frame":37,"entities":566,"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.946,"step_ms":null,"cost_ms":1.946},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/pbr","frame":60,"ssim":0.997686,"tile":8,"bevy":{"batch_keys":56,"entities":499,"extents":["0.4475 0.4500 0.4500"],"frame":60,"frame_ms":3.279,"materials":57,"mesh_entities":56,"meshes":6,"other_material":0,"visible":56},"raea":{"frame":67,"entities":566,"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.644,"step_ms":null,"cost_ms":1.644},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"3d/animated_material","frame":30,"ssim":0.999892,"tile":0,"bevy":{"batch_keys":9,"entities":449,"extents":["0.2500 0.2500 0.2500"],"frame":30,"frame_ms":20.127,"materials":10,"mesh_entities":9,"meshes":6,"other_material":0,"visible":9},"raea":{"frame":37,"entities":518,"mesh_entities":9,"visible":9,"meshes":8,"materials":19,"batch_keys":9,"other_material":0,"extents":["0.2500 0.2500 0.2500"],"frame_ms":1.81,"step_ms":null,"cost_ms":1.81},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
@@ -167,18 +163,28 @@
{"example":"2d/sprite_scale","frame":10,"ssim":0.992281,"tile":11,"bevy":{"batch_keys":0,"entities":486,"extents":[],"frame":10,"frame_ms":45.502,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":532,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.239,"step_ms":null,"cost_ms":2.239},"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.28,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":532,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.553,"step_ms":null,"cost_ms":1.553},"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":43.511,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":521,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.426,"step_ms":null,"cost_ms":1.426},"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.685,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":37,"entities":965,"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.802,"step_ms":null,"cost_ms":1.802},"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.633,"materials":1,"mesh_entities":91,"meshes":6,"other_material":91,"visible":91},"raea":{"frame":67,"entities":965,"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.706,"step_ms":null,"cost_ms":1.706},"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":19.433,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":511,"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.988,"step_ms":null,"cost_ms":1.988},"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.433,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":511,"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.606,"step_ms":null,"cost_ms":1.606},"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":23.168,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":511,"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.181,"step_ms":null,"cost_ms":2.181},"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":5.32,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":511,"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.498,"step_ms":null,"cost_ms":1.498},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
-{"example":"ui/ui_material","frame":10,"ssim":0.999993,"tile":0,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":10,"frame_ms":50.695,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":510,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":3.017,"step_ms":null,"cost_ms":3.017},"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":20.285,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":38,"entities":511,"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.107,"step_ms":null,"cost_ms":2.107},"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":49.424,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":17,"entities":512,"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.777,"step_ms":null,"cost_ms":1.777},"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":48.937,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":19,"entities":513,"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.225,"step_ms":null,"cost_ms":3.225},"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.417,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":68,"entities":513,"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.736,"step_ms":null,"cost_ms":1.736},"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":47.105,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":511,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.75,"step_ms":null,"cost_ms":1.75},"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":46.188,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":17,"entities":511,"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.415,"step_ms":null,"cost_ms":2.415},"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.238,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":109,"entities":534,"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.589,"step_ms":null,"cost_ms":1.589},"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":19.592,"materials":1,"mesh_entities":11,"meshes":6,"other_material":11,"visible":11},"raea":{"frame":39,"entities":534,"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.952,"step_ms":null,"cost_ms":1.952},"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":19.33,"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":2.034,"step_ms":null,"cost_ms":2.034},"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.452,"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.877,"step_ms":null,"cost_ms":1.877},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/mesh2d","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":45.401,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":518,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.518,"step_ms":null,"cost_ms":2.518},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":45.738,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":518,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.552,"step_ms":null,"cost_ms":2.552},"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.832,"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.498,"step_ms":null,"cost_ms":1.498},"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.398,"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.718,"step_ms":null,"cost_ms":1.718},"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.822,"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.703,"step_ms":null,"cost_ms":1.703},"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.696,"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.576,"step_ms":null,"cost_ms":1.576},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/ui_material","frame":10,"ssim":0.999993,"tile":0,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":10,"frame_ms":46.74,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":518,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.14,"step_ms":null,"cost_ms":2.14},"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.783,"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.808,"step_ms":null,"cost_ms":1.808},"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":47.158,"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.673,"step_ms":null,"cost_ms":1.673},"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":49.575,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":18,"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.93,"step_ms":null,"cost_ms":2.93},"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.42,"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.81,"step_ms":null,"cost_ms":1.81},"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":44.328,"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.569,"step_ms":null,"cost_ms":2.569},"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":46.39,"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.292,"step_ms":null,"cost_ms":2.292},"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.943,"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.755,"step_ms":null,"cost_ms":1.755},"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.51,"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.665,"step_ms":null,"cost_ms":1.665},"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.291,"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.574,"step_ms":null,"cost_ms":1.574},"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":19.391,"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.975,"step_ms":null,"cost_ms":1.975},"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.45,"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.676,"step_ms":null,"cost_ms":1.676},"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.375,"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.573,"step_ms":null,"cost_ms":1.573},"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":18.236,"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":2.007,"step_ms":null,"cost_ms":2.007},"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.11,"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.629,"step_ms":null,"cost_ms":1.629},"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.606,"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.505,"step_ms":null,"cost_ms":1.505},"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.456,"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.656,"step_ms":null,"cost_ms":1.656},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
diff --git a/engine/render/src/engine/spawn.rs b/engine/render/src/engine/spawn.rs
index 352d739d..bc2ac100 100644
--- a/engine/render/src/engine/spawn.rs
+++ b/engine/render/src/engine/spawn.rs
@@ -318,7 +318,7 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
let pic = scene3d::panel_picture(&src, inserted, dir).map_err(|e| format!("sprite {}: {e}", t.id))?;
let (pw, ph) = pic.dimensions();
let image = world.resource_mut::<Assets<Image>>().add(sprite2d::sprite_image(pw, ph, pic.into_raw()));
- sprite2d::spawn_sprite(world, e, t, image, UVec2::new(pw, ph));
+ sprite2d::spawn_sprite(world, e, t, image, UVec2::new(pw, ph))?;
}
"shape2d" => {
// its ColorMaterial's texture, found and decoded as a sprite's picture
diff --git a/runtime/look/src/parts.rs b/runtime/look/src/parts.rs
index e8637643..d1c305d7 100644
--- a/runtime/look/src/parts.rs
+++ b/runtime/look/src/parts.rs
@@ -44,15 +44,16 @@ pub fn keyed_vec(p: &mut Program, row: &mut BTreeMap<String, V>, id: &str, its:
/// A <Material>'s uniforms and storage buffers over the frames (docs/control.feature FC2a), sent as keyed
/// `own:uniforms` component rows from each frame they change, which raea-sys-shader's own_live.rs packs into the
-/// part's Material; none when they never change (the spec the part is made with holds them). `spec` finds an item's
-/// Material spec: a mesh's material's `shader`, a 2D shape's own. Called after the part's row is pushed.
+/// part's Material; none when they never change over a render's frames (the spec the part is made with holds them),
+/// but one for a single frame (live play's, whose next frame may change them). `spec` finds an item's Material spec: a
+/// mesh's material's `shader`, a 2D part's own. Called after the part's row is pushed.
pub fn own_uniforms(p: &mut Program, id: &str, its: &[Item], spec: impl Fn(&Item) -> Option<&Value>) {
let each: Vec<(usize, Value)> = its.iter().enumerate().filter_map(|(f, it)| {
let s = spec(it).filter(|s| s.get("own").is_some())?;
let v = serde_json::json!({ "uniforms": s.get("uniforms").cloned().unwrap_or(Value::Null), "buffers": s.get("buffers").cloned().unwrap_or(Value::Null) });
Some((f, serde_json::json!({ "type": "own:uniforms", "value": v })))
}).collect();
- if each.iter().all(|(_, v)| Some(v) == each.first().map(|x| &x.1)) {
+ if its.len() > 1 && each.iter().all(|(_, v)| Some(v) == each.first().map(|x| &x.1)) {
return;
}
// the part's spec carries its track's hash: parts share a Material (as Bevy's share one handle) only when their
diff --git a/runtime/scene/src/live.rs b/runtime/scene/src/live.rs
index 3d1d13d2..10cda7e3 100644
--- a/runtime/scene/src/live.rs
+++ b/runtime/scene/src/live.rs
@@ -185,10 +185,12 @@ impl LiveScene {
}
}
}
+ // a target of a kind that keeps its render id (a sprite, a 2D shape) is that row's
+ let kept: std::collections::HashSet<String> = others.iter().filter_map(|(_, r)| match r.get("id") { Some(V::S(i)) => Some(i.clone()), _ => None }).collect();
for (kind, mut row) in others {
let Some(V::S(mut id)) = row.get("id").cloned() else { continue };
if let Some(V::S(t)) = row.get("target").cloned() {
- let Some(to) = (if t.starts_with("ent") || t.starts_with("text") || t == "cam" { Some(t.clone()) } else { live_id.get(&t).cloned() }) else { continue };
+ let Some(to) = (if t.starts_with("ent") || t.starts_with("text") || t == "cam" || kept.contains(&t) { Some(t.clone()) } else { live_id.get(&t).cloned() }) else { continue };
id = id.replacen(&t, &to, 1);
row.insert("id".into(), V::S(id.clone()));
row.insert("target".into(), V::S(to));
diff --git a/runtime/scene2d/src/lib.rs b/runtime/scene2d/src/lib.rs
index dbff77c3..fa57355e 100644
--- a/runtime/scene2d/src/lib.rs
+++ b/runtime/scene2d/src/lib.rs
@@ -48,13 +48,12 @@ pub fn sprites(tracks: &[Track], p: &mut Program) {
}
}
sheet(p, &mut row, &id, &its);
- // the picture's sampler (Bevy's load_with_settings), as JSON for raea-sys-sampler
- if let Some(s) = first.get("sampler") {
- row.insert("texture_sampler".into(), V::S(s.to_string()));
- }
- // Bevy's SpriteImageMode as given (systems/sprite reads it)
- if let Some(m) = first.get("image_mode") {
- row.insert("image_mode".into(), V::S(m.to_string()));
+ // as JSON: the picture's sampler (Bevy's load_with_settings, raea-sys-sampler's), Bevy's SpriteImageMode as given
+ // and its <Material> (Bevy's SpriteMaterial, systems/sprite)
+ for (prop, col) in [("sampler", "texture_sampler"), ("image_mode", "image_mode"), ("shader", "shader")] {
+ if let Some(s) = first.get(prop) {
+ row.insert(col.into(), V::S(s.to_string()));
+ }
}
for (prop, col) in [("flipX", "flip_x"), ("flipY", "flip_y"), ("tileX", "tile_x"), ("tileY", "tile_y")] {
if first.get(prop) == Some(&Value::Bool(true)) {
@@ -64,6 +63,7 @@ pub fn sprites(tracks: &[Track], p: &mut Program) {
place2d(p, &mut row, &id, &its, "#ffffff");
visible(p, &mut row, &id, track);
p.spawns.push(("sprite".into(), vec![row]));
+ own_uniforms(p, &id, &its, |it| it.props.get("shader"));
}
}
diff --git a/sdk/raea/bench/bevy-parity/shader/sprite_material.tsx b/sdk/raea/bench/bevy-parity/shader/sprite_material.tsx
new file mode 100644
index 00000000..6f09911e
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/shader/sprite_material.tsx
@@ -0,0 +1,53 @@
+// Bevy v0.20.0 examples/shader/sprite_material.rs in raea's TSX (docs/control.feature FC0a, FC2a): Bevy's bird
+// (branding/bevy_bird_dark.png) as a Sprite in the middle with the example's SpriteMaterial<DissolveMaterial>, its
+// assets/shaders/sprite_material.wesl as written (simplex noise against `amount`, a burn edge 0.05 wide in
+// LinearRgba(1, 0.66, 0)), and "Space to dissolve" in Bevy's default font at the top left. Space (the input script,
+// bench/bevy-parity/input/sprite_material.json) starts it dissolving, and again appearing: dissolve_on_input and
+// update_dissolve as the example runs them, `amount` the progress added up by each update's delta, in f32. A Camera2d
+// on Bevy's default clear colour, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile, useGameState, useInput } from "raea";
+import { Canvas3D, Sprite } from "raea/3d";
+import { Material } from "@raea/render/bevy3d"; // raea/pbr once scene-loop lands (its pbr.ts commit)
+
+const FONT = `@font-face { font-family: "Fira Mono"; src: url("${staticFile("fonts/FiraMono-Medium.ttf")}"); }`;
+const DT = Math.fround(1 / 60); // Time::delta_secs of a 1/60 s update, an f32
+
+type State = { kind: "Visible" | "Dissolving" | "Appearing" | "Hidden"; progress: number; amount: number; space: boolean };
+const START: State = { kind: "Visible", progress: 0, amount: 0, space: false };
+
+/** One update: dissolve_on_input on Space's press, then update_dissolve (chained, so it sees the new state). */
+function step(s: State, input: { keys: string[] }): State {
+ const space = input.keys.includes("Space");
+ let { kind, progress, amount } = s;
+ if (space && !s.space) {
+ if (kind === "Visible") [kind, progress] = ["Dissolving", 0];
+ else if (kind === "Hidden") [kind, progress] = ["Appearing", 0];
+ else [kind, progress] = [kind === "Dissolving" ? "Appearing" : "Dissolving", Math.fround(1 - progress)];
+ }
+ if (kind === "Dissolving" || kind === "Appearing") {
+ progress = Math.fround(progress + DT);
+ const done = progress >= 1;
+ if (done) progress = 1;
+ amount = kind === "Dissolving" ? progress : Math.fround(1 - progress);
+ if (done) kind = kind === "Dissolving" ? "Hidden" : "Visible";
+ }
+ return { kind, progress, amount, space };
+}
+
+function Shot() {
+ // Bevy's picture of frame f is drawn after update f, which read frame f's keys: the fold (updates before f) and f's own
+ const s = step(useGameState(START, step), useInput());
+ return (
+ <AbsoluteFill>
+ <style>{FONT}</style>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Sprite src={staticFile("branding/bevy_bird_dark.png")} x={640} y={360}>
+ <Material fragment={staticFile("shaders/sprite_material.wesl")} uniforms={{ material: { burn_edge_color: [1, 0.66, 0, 1], amount: s.amount, burn_edge: 0.05 } }} />
+ </Sprite>
+ </Canvas3D>
+ <div style={{ position: "absolute", top: 0, left: 0, fontFamily: "Fira Mono", fontSize: 20, lineHeight: 1.2, color: "#fff", whiteSpace: "pre" }}>Space to dissolve</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={131} fps={60} width={1280} height={720} />);
diff --git a/sdk/render/src/3d/sprite.tsx b/sdk/render/src/3d/sprite.tsx
index af5069d7..047a390c 100644
--- a/sdk/render/src/3d/sprite.tsx
+++ b/sdk/render/src/3d/sprite.tsx
@@ -1,5 +1,5 @@
// 2D over the 3D: sprites and flat shapes, drawn over the Canvas3D's 3D by a 2D camera of its own (raea-sys-sprite).
-import { useId } from "react";
+import { Children, isValidElement, useId, type ReactNode } from "react";
import { node3d } from "./core";
import type { Quat } from "../bevy3d/core";
import { samplerSpec, type SamplerSpec } from "./materials";
@@ -53,6 +53,9 @@ export interface SpriteProps extends Place2dProps {
/** the picture's sampler (Bevy's load_with_settings: { filter, mipmap, wrap, anisotropy }), Bevy's default (linear)
* otherwise; { filter: "nearest" } is pixel art as Bevy's ImagePlugin::default_nearest() draws it */
sampler?: SamplerSpec;
+ /** your own <Material> as its child: Bevy's SpriteMaterial, extending the sprite's own material (the shader reads the
+ * sprite's picture, tint and alpha with bevy_sprite_render::sprite_mesh::functions), its uniforms per frame */
+ children?: ReactNode;
}
type SliceScaleMode = "Stretch" | { Tile: { stretch_value: number } };
@@ -84,6 +87,7 @@ function checkImageMode(m: unknown): void {
* @bevy bevy_sprite::sprite::Sprite
* @bevy bevy_sprite_render::sprite_mesh::sprite_mesh_material::SpriteMeshMaterial
* @bevy bevy_sprite_render::mesh2d::material::MeshMaterial2d<bevy_sprite_render::sprite_mesh::sprite_mesh_material::SpriteMeshMaterial>
+ * @bevy bevy_sprite_render::sprite_mesh::sprite_extended_material::SpriteMaterial
* @bevy bevy_image::texture_atlas::TextureAtlasLayout */
export function Sprite(props: SpriteProps) {
if (typeof props.src !== "string" || props.src === "") throw new TypeError("Sprite: src must be a picture (staticFile(\"x.png\"))");
@@ -103,7 +107,14 @@ export function Sprite(props: SpriteProps) {
const handled = Object.keys(props).some((k) => /^on[A-Z]/.test(k));
if (handled && (props.width === undefined || props.height === undefined)) throw new TypeError("Sprite: give width and height to pick it (an on* handler needs its size, which the picture alone doesn't give here)");
usePointer2d(props.name ?? id, flatOf(props, props.width ?? 0, props.height ?? 0, false), props as unknown as Record<string, unknown>);
- return node3d("Sprite", props as unknown as Record<string, unknown>);
+ // a <Material> child's spec (the element's type makes it: bevy3d/material.tsx), as a Shape2D's `shader`
+ let shader: unknown;
+ for (const c of Children.toArray(props.children)) {
+ const of = isValidElement(c) ? (c.type as { shaderOf?: (p: unknown) => unknown }).shaderOf : undefined;
+ if (!of || shader) throw new TypeError("Sprite: its one child is a <Material> (Bevy's SpriteMaterial)");
+ shader = of((c as { props: unknown }).props);
+ }
+ return node3d("Sprite", { ...props, children: undefined, ...(shader ? { shader } : {}) } as unknown as Record<string, unknown>);
}
export interface Shape2DProps extends Place2dProps {
diff --git a/sdk/render/src/bevy3d/material.tsx b/sdk/render/src/bevy3d/material.tsx
index 727da0f3..7d717ed2 100644
--- a/sdk/render/src/bevy3d/material.tsx
+++ b/sdk/render/src/bevy3d/material.tsx
@@ -53,3 +53,5 @@ export function Material(p: MaterialProps) {
export function materialShader(p: MaterialProps): Record<string, unknown> {
return surfaceShader("Material", ownSpec(p));
}
+// what a 2D part reads a <Material> child by (3d/sprite.tsx: a Sprite's SpriteMaterial), without importing this file
+(Material as unknown as { shaderOf: typeof materialShader }).shaderOf = materialShader;
diff --git a/systems/parity/src/input.rs b/systems/parity/src/input.rs
index f1e4cc8d..0d87de9a 100644
--- a/systems/parity/src/input.rs
+++ b/systems/parity/src/input.rs
@@ -3,7 +3,9 @@
//! the update numbered FRAME (the probe's count) until the next. "Pointer:X:Y" puts the mouse pointer at X, Y in the
//! window's logical px, ":down" while its primary button is held; the pointer is bevy_picking's, written as the
//! PointerInput messages a mouse sends (a Move when it moves, a Press and a Release on the button's edges), on the
-//! picture the cameras draw into (the offscreen image while pictures are taken, else the primary window).
+//! picture the cameras draw into (the offscreen image while pictures are taken, else the primary window). Any other
+//! entry is a KeyCode's name ("Space", "KeyA", "ArrowLeft"): held in ButtonInput<KeyCode> while its entry lasts, as
+//! Bevy's keyboard_input_system holds a pressed key (`keys`).
use std::collections::BTreeMap;
@@ -16,6 +18,7 @@ use bevy::window::PrimaryWindow;
pub(crate) struct Script {
at: BTreeMap<u64, Vec<String>>,
pointer: Option<(Vec2, bool)>,
+ held: Vec<KeyCode>,
}
/// The script at RAEA_PARITY_INPUT, if set; a script that can't be read ends the run, as the port's would.
@@ -23,7 +26,7 @@ pub(crate) fn load() -> Option<Script> {
let p = std::env::var("RAEA_PARITY_INPUT").ok()?;
let text = std::fs::read_to_string(&p).unwrap_or_else(|e| panic!("RAEA_PARITY_INPUT {p}: {e}"));
let at: BTreeMap<u64, Vec<String>> = serde_json::from_str(&text).unwrap_or_else(|e| panic!("RAEA_PARITY_INPUT {p}: {{\"FRAME\": [keys]}}: {e}"));
- Some(Script { at, pointer: None })
+ Some(Script { at, pointer: None, held: Vec::new() })
}
/// "Pointer:X:Y[:down]" among an entry's keys
@@ -63,3 +66,31 @@ pub(crate) fn scripted(
}
s.pointer = Some(now);
}
+
+/// This update's keys into ButtonInput<KeyCode>, after Bevy's input systems (and the probe's no_input, which resets it
+/// every update): a key just pressed on the update its entry starts, held while it lasts (pressed, not just pressed),
+/// just released on the update after, so `input_just_pressed` and `pressed` read it as a keyboard's.
+pub(crate) fn keys(mut s: ResMut<Script>, probe: Res<super::Probe>, input: Option<ResMut<ButtonInput<KeyCode>>>) {
+ let Some(mut input) = input else { return };
+ let names = s.at.range(..=probe.frame).next_back().map(|(_, k)| k.clone()).unwrap_or_default();
+ let now: Vec<KeyCode> = names.iter().filter(|k| !k.starts_with("Pointer:")).map(|k| key_code(k)).collect();
+ for k in &now {
+ input.press(*k);
+ if s.held.contains(k) {
+ input.clear_just_pressed(*k);
+ }
+ }
+ for k in s.held.iter().filter(|k| !now.contains(k)) {
+ // pressed first, so a release no_input's reset left nothing to release still reads as one
+ input.press(*k);
+ input.release(*k);
+ input.clear_just_pressed(*k);
+ }
+ s.held = now;
+}
+
+/// A KeyCode by its variant's name, as Bevy reflects it ("Space", "KeyA").
+fn key_code(name: &str) -> KeyCode {
+ use bevy::reflect::{enums::{DynamicEnum, DynamicVariant}, FromReflect};
+ KeyCode::from_reflect(&DynamicEnum::new(name, DynamicVariant::Unit)).unwrap_or_else(|| panic!("RAEA_PARITY_INPUT: {name} isn't a KeyCode's name"))
+}
diff --git a/systems/parity/src/lib.rs b/systems/parity/src/lib.rs
index 4c780506..0e0d9c9d 100644
--- a/systems/parity/src/lib.rs
+++ b/systems/parity/src/lib.rs
@@ -77,6 +77,7 @@ pub fn install(app: &mut App) {
if let Some(script) = input::load() {
app.insert_resource(script);
app.add_systems(First, input::scripted);
+ app.add_systems(PreUpdate, input::keys.after(bevy::input::InputSystems).after(no_input));
}
app.insert_resource(Probe { out: out.into(), frames, png, exit, types, frame: 0, since: Instant::now(), ticks: 0 });
app.add_systems(Last, (probe, dump).chain());
diff --git a/systems/shader/src/own.rs b/systems/shader/src/own.rs
index 1397e4e7..a51661c2 100644
--- a/systems/shader/src/own.rs
+++ b/systems/shader/src/own.rs
@@ -3,8 +3,9 @@
//! the author's file compiled as written but for the numbers of its `@group(MATERIAL_BIND_GROUP)` bindings, which go to
//! this one Rust type's fixed slots in the order the source declares them (ui_bind.rs, as raea's UiMaterial does):
//! uniforms of any type up to 256 bytes at 0 to 7, packed in their declared types (layout.rs), textures at 8, 10, 12,
-//! 14 and their samplers at 9, 11, 13, 15. A Rust Material's bind group is its type's, so raea's one type takes every
-//! author's layout this way. Its alpha mode, depth bias and faces are the material's, as Bevy's methods give them.
+//! 14 and their samplers at 9, 11, 13, 15, each past ui_bind's OWN_BASE (a sprite's own bindings are below it). A
+//! Rust Material's bind group is its type's, so raea's one type takes every author's layout this way. Its alpha mode,
+//! depth bias and faces are the material's, as Bevy's methods give them.
//!
//! A file's `import super::NAME` reads NAME.wesl beside it: the file is registered as embedded://raea_sys_shader/
//! d{folder}/m{hash}.wesl and each module it imports from its folder as embedded://raea_sys_shader/d{folder}/NAME.wesl,
@@ -20,7 +21,7 @@ use bevy::prelude::*;
use bevy::render::render_resource::{AsBindGroup, Face, RenderPipelineDescriptor, SpecializedMeshPipelineError};
use bevy::render::storage::ShaderBuffer;
use bevy::shader::{Shader, ShaderRef};
-use bevy::sprite_render::{AlphaMode2d, Material2d, Material2dKey, Material2dPipeline, Material2dPlugin};
+use bevy::sprite_render::{AlphaMode2d, Material2d, Material2dKey, Material2dPipeline, Material2dPlugin, MaterialExtension2d, SpriteMaterialPlugin};
use serde_json::Value;
use crate::own_live::{storage, Packing};
@@ -43,58 +44,59 @@ const GROUPS_2D: &[&str] = &["constants::MATERIAL_BIND_GROUP", "#{MATERIAL_BIND_
#[derive(Asset, AsBindGroup, TypePath, Clone, Debug)]
#[bind_group_data(OwnKey)]
pub struct OwnMaterial {
- #[uniform(0)]
+ #[uniform(30)]
u0: [Vec4; 16],
- #[uniform(1)]
+ #[uniform(31)]
u1: [Vec4; 16],
- #[uniform(2)]
+ #[uniform(32)]
u2: [Vec4; 16],
- #[uniform(3)]
+ #[uniform(33)]
u3: [Vec4; 16],
- #[uniform(4)]
+ #[uniform(34)]
u4: [Vec4; 16],
- #[uniform(5)]
+ #[uniform(35)]
u5: [Vec4; 16],
- #[uniform(6)]
+ #[uniform(36)]
u6: [Vec4; 16],
- #[uniform(7)]
+ #[uniform(37)]
u7: [Vec4; 16],
- #[texture(8)]
- #[sampler(9)]
+ #[texture(38)]
+ #[sampler(39)]
t0: Option<Handle<Image>>,
- #[texture(10)]
- #[sampler(11)]
+ #[texture(40)]
+ #[sampler(41)]
t1: Option<Handle<Image>>,
- #[texture(12)]
- #[sampler(13)]
+ #[texture(42)]
+ #[sampler(43)]
t2: Option<Handle<Image>>,
- #[texture(14)]
- #[sampler(15)]
+ #[texture(44)]
+ #[sampler(45)]
t3: Option<Handle<Image>>,
// one texture of each other dimension (ui_bind.rs DIMS), the 1d's and 2d_array's samplers the 5th and 6th
- #[texture(16, dimension = "1d")]
- #[sampler(17)]
+ #[texture(46, dimension = "1d")]
+ #[sampler(47)]
d1: Option<Handle<Image>>,
- #[texture(18, dimension = "2d_array")]
- #[sampler(19)]
+ #[texture(48, dimension = "2d_array")]
+ #[sampler(49)]
d2a: Option<Handle<Image>>,
- #[texture(20, dimension = "cube")]
+ #[texture(50, dimension = "cube")]
cube: Option<Handle<Image>>,
- #[texture(21, dimension = "cube_array")]
+ #[texture(51, dimension = "cube_array")]
cube_array: Option<Handle<Image>>,
- #[texture(22, dimension = "3d")]
+ #[texture(52, dimension = "3d")]
d3: Option<Handle<Image>>,
// its read-only storage buffers (ui_bind.rs STORAGE); one it doesn't bind holds 16 zero bytes
- #[storage(23, read_only)]
+ #[storage(53, read_only)]
b0: Handle<ShaderBuffer>,
- #[storage(24, read_only)]
+ #[storage(54, read_only)]
b1: Handle<ShaderBuffer>,
/// what its uniforms and buffers are packed from, for a frame's new values (own_live.rs)
pub(crate) packing: Arc<Packing>,
shader: u128,
/// the vertex shader's uuid, 0 for Bevy's mesh vertex shader
vertex: u128,
- alpha: AlphaMode,
+ /// None when the spec gives none: Opaque as a Material's, a sprite's own as a SpriteMaterial's
+ alpha: Option<AlphaMode>,
depth_bias: f32,
/// the faces it culls (the pipeline's primitive.cull_mode); None keeps the pipeline's (3D culls Back, 2D none)
cull: Option<Option<Face>>,
@@ -111,8 +113,10 @@ impl OwnMaterial {
}
}
-/// What picks a pipeline: the material's shaders and the faces it culls.
-#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
+/// What picks a pipeline: the material's shaders and the faces it culls (opaque to reflection, as SpriteMaterial's
+/// extension reflects its material's key).
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Reflect)]
+#[reflect(opaque)]
pub struct OwnKey {
shader: u128,
vertex: u128,
@@ -140,7 +144,7 @@ impl Material for OwnMaterial {
ShaderRef::Handle(PLACEHOLDER)
}
fn alpha_mode(&self) -> AlphaMode {
- self.alpha
+ self.alpha.unwrap_or(AlphaMode::Opaque)
}
fn depth_bias(&self) -> f32 {
self.depth_bias
@@ -153,11 +157,7 @@ impl Material2d for OwnMaterial {
ShaderRef::Handle(PLACEHOLDER_2D)
}
fn alpha_mode(&self) -> AlphaMode2d {
- match self.alpha {
- AlphaMode::Opaque => AlphaMode2d::Opaque,
- AlphaMode::Mask(c) => AlphaMode2d::Mask(c),
- _ => AlphaMode2d::Blend,
- }
+ alpha2d(self.alpha.unwrap_or(AlphaMode::Opaque))
}
fn depth_bias(&self) -> f32 {
self.depth_bias
@@ -165,6 +165,29 @@ impl Material2d for OwnMaterial {
specialize!(Material2dPipeline, Material2dKey, PLACEHOLDER_2D);
}
+/// A sprite's SpriteMaterial<M> (Bevy's shader/sprite_material): the same material extending the sprite's own, its
+/// fragment where Material2d's is, the sprite's alpha mode unless the spec gives one.
+impl MaterialExtension2d for OwnMaterial {
+ fn fragment_shader() -> Option<ShaderRef> {
+ Some(ShaderRef::Handle(PLACEHOLDER_2D))
+ }
+ fn alpha_mode(&self) -> Option<AlphaMode2d> {
+ self.alpha.map(alpha2d)
+ }
+ fn depth_bias(&self) -> Option<f32> {
+ Some(self.depth_bias)
+ }
+ specialize!(Material2dPipeline, Material2dKey, PLACEHOLDER_2D);
+}
+
+fn alpha2d(a: AlphaMode) -> AlphaMode2d {
+ match a {
+ AlphaMode::Opaque => AlphaMode2d::Opaque,
+ AlphaMode::Mask(c) => AlphaMode2d::Mask(c),
+ _ => AlphaMode2d::Blend,
+ }
+}
+
/// A pipeline given the material's own shaders: its fragment where it is `placeholder`, its vertex shader (if any) in
/// that same pipeline (the main pass's: the prepass and shadow pipelines keep Bevy's), and the faces it culls.
fn swap(descriptor: &mut RenderPipelineDescriptor, placeholder: &Handle<Shader>, k: OwnKey) -> Result<(), SpecializedMeshPipelineError> {
@@ -183,7 +206,7 @@ fn swap(descriptor: &mut RenderPipelineDescriptor, placeholder: &Handle<Shader>,
pub fn install(app: &mut App) {
let _ = app.world_mut().resource_mut::<Assets<Shader>>().insert(&PLACEHOLDER, Shader::from_wesl(STUB, "embedded://raea_sys_shader/own_placeholder.wesl"));
let _ = app.world_mut().resource_mut::<Assets<Shader>>().insert(&PLACEHOLDER_2D, Shader::from_wesl(STUB_2D, "embedded://raea_sys_shader/own_placeholder_2d.wesl"));
- app.add_plugins((MaterialPlugin::<OwnMaterial>::default(), Material2dPlugin::<OwnMaterial>::default()));
+ app.add_plugins((MaterialPlugin::<OwnMaterial>::default(), Material2dPlugin::<OwnMaterial>::default(), SpriteMaterialPlugin::<OwnMaterial>::default()));
}
/// The material a `<Material>` spec asks for: {fragment, vertex?, uniforms, textures, defs, own: {alpha_mode,
@@ -259,9 +282,9 @@ pub fn build(world: &mut World, v: &Value, image: &mut impl FnMut(&mut World, &V
/// Bevy's AlphaMode as the SDK writes it: "Opaque", "Blend", {"Mask": cutoff}, "Premultiplied", "AlphaToCoverage",
/// "Add" or "Multiply".
-fn alpha_mode(v: Option<&Value>) -> Result<AlphaMode, String> {
- Ok(match v {
- None => AlphaMode::Opaque,
+fn alpha_mode(v: Option<&Value>) -> Result<Option<AlphaMode>, String> {
+ Ok(Some(match v {
+ None => return Ok(None),
Some(Value::String(s)) => match s.as_str() {
"Opaque" => AlphaMode::Opaque,
"Blend" => AlphaMode::Blend,
@@ -275,7 +298,7 @@ fn alpha_mode(v: Option<&Value>) -> Result<AlphaMode, String> {
Some(c) => AlphaMode::Mask(c as f32),
None => return Err(format!("a Material's alpha_mode is a name or {{\"Mask\": cutoff}}, got {v}")),
},
- })
+ }))
}
/// A picture file decoded now as an Image (sRGB, the default sampler, as asset_server.load reads a colour texture), so
@@ -359,11 +382,7 @@ pub fn shared(world: &mut World, v: &Value, image: &mut impl FnMut(&mut World, &
pub fn put(world: &mut World, e: Entity, h: Handle<OwnMaterial>) -> Result<(), String> {
let Some(std) = world.get::<MeshMaterial3d<StandardMaterial>>(e).map(|m| m.0.clone()) else { return Ok(()) };
world.entity_mut(e).remove::<MeshMaterial3d<StandardMaterial>>().insert((MeshMaterial3d(h), Shaded { std }, OwnSurface));
- // the frame's values a row gave before it was on
- match world.entity_mut(e).take::<crate::own_live::Pending>() {
- Some(p) => crate::own_live::patch(world, e, &p.0),
- None => Ok(()),
- }
+ crate::own_live::settle(world, e)
}
#[cfg(test)]
@@ -372,8 +391,8 @@ mod tests {
fn a_files_own_folder_imports_are_found() {
let src = "import bevy_pbr::forward_io::VertexOutput;\nimport super::custom_material_import::COLOR_MULTIPLIER;\nimport super::{a::X, b_2::Y};\nfn f() { super::not_an_import(); }\n";
assert_eq!(super::siblings(src), vec!["custom_material_import".to_string(), "a".into(), "b_2".into()]);
- assert!(super::alpha_mode(Some(&serde_json::json!("Blend"))).unwrap() == bevy::prelude::AlphaMode::Blend);
- assert!(super::alpha_mode(Some(&serde_json::json!({"Mask": 0.5}))).unwrap() == bevy::prelude::AlphaMode::Mask(0.5));
+ assert!(super::alpha_mode(Some(&serde_json::json!("Blend"))).unwrap() == Some(bevy::prelude::AlphaMode::Blend));
+ assert!(super::alpha_mode(Some(&serde_json::json!({"Mask": 0.5}))).unwrap() == Some(bevy::prelude::AlphaMode::Mask(0.5)));
assert!(super::alpha_mode(Some(&serde_json::json!("Clear"))).is_err());
}
}
diff --git a/systems/shader/src/own_live.rs b/systems/shader/src/own_live.rs
index 0fa4faea..7b3bf55e 100644
--- a/systems/shader/src/own_live.rs
+++ b/systems/shader/src/own_live.rs
@@ -7,7 +7,7 @@
use bevy::prelude::*;
use bevy::render::storage::ShaderBuffer;
use bevy::shader::ShaderDefVal;
-use bevy::sprite_render::MeshMaterial2d;
+use bevy::sprite_render::{MeshMaterial2d, SpriteMaterial};
use serde_json::Value;
use crate::layout;
@@ -55,10 +55,19 @@ pub fn storage(name: &str, ty: &str, v: &Value) -> Result<ShaderBuffer, String>
#[derive(Component)]
pub struct Pending(pub Value);
-/// An `own:uniforms` component row: the frame's {uniforms, buffers} packed into the part's own Material (3D or 2D)
-/// and its storage buffers.
+/// The frame's values a row gave before the part's Material was on, now that it is.
+pub fn settle(world: &mut World, e: Entity) -> Result<(), String> {
+ match world.entity_mut(e).take::<Pending>() {
+ Some(p) => patch(world, e, &p.0),
+ None => Ok(()),
+ }
+}
+
+/// An `own:uniforms` component row: the frame's {uniforms, buffers} packed into the part's own Material (3D, 2D or a
+/// sprite's) and its storage buffers.
pub fn patch(world: &mut World, e: Entity, v: &Value) -> Result<(), String> {
- let h = world.get::<MeshMaterial3d<OwnMaterial>>(e).map(|m| m.0.clone()).or_else(|| world.get::<MeshMaterial2d<OwnMaterial>>(e).map(|m| m.0.clone()));
+ let h = world.get::<MeshMaterial3d<OwnMaterial>>(e).map(|m| m.0.clone());
+ let h = h.or_else(|| world.get::<MeshMaterial2d<OwnMaterial>>(e).map(|m| m.0.clone())).or_else(|| world.get::<SpriteMaterial<OwnMaterial>>(e).map(|m| m.0.clone()));
// a row applied before the part's Material is put on (shade_rows runs after the rows): kept for `put`
let Some(h) = h else {
world.entity_mut(e).insert(Pending(v.clone()));
diff --git a/systems/shader/src/ui_bind.rs b/systems/shader/src/ui_bind.rs
index c582fe67..f39e4212 100644
--- a/systems/shader/src/ui_bind.rs
+++ b/systems/shader/src/ui_bind.rs
@@ -13,6 +13,9 @@ pub const DIMS: [(&str, &str, usize); 5] = [("texture_1d<", "1d", 16), ("texture
pub const SAMPLERS_WITH_DIMS: usize = 6;
/// A Material's read-only storage buffers (`dims`), at 23 and 24.
pub const STORAGE: [usize; 2] = [23, 24];
+/// Where a Material's slots (`dims`) start: past a sprite's own bindings (0 to 2, 10 when bindless), whose group a
+/// SpriteMaterial's share (shader/sprite_material). A UiMaterial's start at 0.
+pub const OWN_BASE: usize = 30;
/// A UiMaterial source with its bindings renumbered: its uniforms (name, WGSL type) and its textures' names, each in
/// its slot's order, and how many samplers it binds.
@@ -101,7 +104,7 @@ pub fn rebind_in(src: &str, groups: &[&str], what: &str, dims: bool) -> Result<R
return Err(format!("{what}'s binding {name} is a var<uniform>, a texture_2d<f32> or a sampler, got {ty} (the rest are FC2a's to come)"));
};
out += &rest[..i];
- out += &format!("@binding({slot})");
+ out += &format!("@binding({})", slot + if dims { OWN_BASE } else { 0 });
rest = &rest[close + 1..];
}
out += rest;
@@ -159,7 +162,7 @@ mod tests {
let r = rebind_in(&src, &["3"], "a Material", true).unwrap();
assert_eq!(r.textures, vec!["t_2d".to_string()]);
assert_eq!(r.others.iter().map(|o| o.1).collect::<Vec<_>>(), vec!["1d", "2d_array", "cube", "cube_array", "3d"]);
- for want in ["@binding(16) var t_1d", "@binding(9) var s_1d", "@binding(8) var t_2d", "@binding(11) var s_2d", "@binding(18) var t_2d_array", "@binding(20) var t_cube:", "@binding(21) var t_cube_array", "@binding(22) var t_3d", "@binding(19) var s_3d"] {
+ for want in ["@binding(46) var t_1d", "@binding(39) var s_1d", "@binding(38) var t_2d", "@binding(41) var s_2d", "@binding(48) var t_2d_array", "@binding(50) var t_cube:", "@binding(51) var t_cube_array", "@binding(52) var t_3d", "@binding(49) var s_3d"] {
assert!(r.src.contains(want), "{want} in {}", r.src);
}
// a UiMaterial takes none of them, and a Material one of each
diff --git a/systems/sprite/src/lib.rs b/systems/sprite/src/lib.rs
index 258cd023..956f3775 100644
--- a/systems/sprite/src/lib.rs
+++ b/systems/sprite/src/lib.rs
@@ -88,7 +88,7 @@ pub fn shape_image(w: u32, h: u32, rgba: Vec<u8>, v: &BTreeMap<String, V>) -> Re
}
/// A sprite's entity from its row and its picture (`size` in px).
-pub fn spawn_sprite(world: &mut World, e: Entity, t: &Tup, image: Handle<Image>, size: UVec2) {
+pub fn spawn_sprite(world: &mut World, e: Entity, t: &Tup, image: Handle<Image>, size: UVec2) -> Result<(), String> {
let v = &t.vals;
let (cols, rows) = (num(v, "sheet_cols", 1.0).max(1.0) as u32, num(v, "sheet_rows", 1.0).max(1.0) as u32);
let (cw, ch) = ((size.x / cols).max(1), (size.y / rows).max(1));
@@ -122,6 +122,23 @@ pub fn spawn_sprite(world: &mut World, e: Entity, t: &Tup, image: Handle<Image>,
..default()
};
world.entity_mut(e).insert((sprite, place_of(v), Visibility::default(), Part2d));
+ // a <Material> on it: Bevy's SpriteMaterial, extending the sprite's own (shader/sprite_material)
+ match own_material(world, t, "sprite")? {
+ Some(m) => {
+ world.entity_mut(e).insert(bevy::sprite_render::SpriteMaterial(m));
+ raea_sys_shader::own_live::settle(world, e)
+ }
+ None => Ok(()),
+ }
+}
+
+/// The row's `shader` (a <Material>, docs/control.feature FC2a) as its own 2D Material (raea-sys-shader's
+/// OwnMaterial), its textures decoded now, as the part's own picture is.
+fn own_material(world: &mut World, t: &Tup, what: &str) -> Result<Option<Handle<raea_sys_shader::own::OwnMaterial>>, String> {
+ let Some(V::S(s)) = t.vals.get("shader") else { return Ok(None) };
+ let spec: serde_json::Value = serde_json::from_str(s).map_err(|err| format!("{what} {}: shader: {err}", t.id))?;
+ let mut picture = |w: &mut World, p: &serde_json::Value| p.as_str().ok_or_else(|| format!("a texture is a picture's path, got {p}")).and_then(|p| raea_sys_shader::own::picture(w, p));
+ raea_sys_shader::own::shared(world, &spec, &mut picture, true).map(Some).map_err(|err| format!("{what} {}: {err}", t.id))
}
/// A ColorMaterial's uv_transform from the row's JSON Affine2 ({ scale: [x, y], angle, translation: [x, y] }, glam's
@@ -163,13 +180,9 @@ pub fn spawn_shape(world: &mut World, e: Entity, t: &Tup, texture: Option<Handle
};
let uv_transform = uv_of(v);
world.entity_mut(e).insert((Mesh2d(mesh), place_of(v), Visibility::default(), Part2d));
- if let Some(V::S(s)) = v.get("shader") {
- let spec: serde_json::Value = serde_json::from_str(s).map_err(|err| format!("shape2d {}: shader: {err}", t.id))?;
- // its textures decoded now, as the shape's own picture is
- let mut picture = |w: &mut World, p: &serde_json::Value| p.as_str().ok_or_else(|| format!("a texture is a picture's path, got {p}")).and_then(|p| raea_sys_shader::own::picture(w, p));
- let m = raea_sys_shader::own::shared(world, &spec, &mut picture, true).map_err(|err| format!("shape2d {}: {err}", t.id))?;
+ if let Some(m) = own_material(world, t, "shape2d")? {
world.entity_mut(e).insert(MeshMaterial2d(m));
- return Ok(());
+ return raea_sys_shader::own_live::settle(world, e);
}
let mat = world.resource_mut::<Assets<ColorMaterial>>().add(ColorMaterial { color: color_of(v), alpha_mode, texture, uv_transform, ..default() });
world.entity_mut(e).insert(MeshMaterial2d(mat));