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.

Fold three new copies in own.rs: one specialize for Material and Material2d (a macro), the shader handle inline, and no is_own

shinyobjectzffc9962cd046
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index 2fe17074..6ebf85a7 100644
--- a/docs/bevy-parity.md
+++ b/docs/bevy-parity.md
@@ -41,8 +41,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 | |
-| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 17.824 / 1.251 = 1.251 + 0 | yes | |
-| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 3.284 / 1.103 = 1.103 + 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 | |
@@ -185,11 +183,13 @@ 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/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 17.866 / 1.768 = 1.768 + 0 | yes | |
-| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 511 | 7 / 8 | 1 / 3 | 44.758 / 1.73 = 1.73 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 512 | 7 / 9 | 2 / 3 | 47.272 / 2.684 = 2.684 + 0 | yes | |
-| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 512 | 7 / 9 | 2 / 3 | 3.29 / 1.514 = 1.514 + 0 | yes | |
-| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 1 | 42.82 / 2.442 = 2.442 + 0 | yes | |
+| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 23.2 / 1.629 = 1.629 + 0 | yes | |
+| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 3.338 / 1.465 = 1.465 + 0 | yes | |
+| shader/shader_material | 30 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 2 | 18.093 / 1.611 = 1.611 + 0 | yes | |
+| shader/shader_defs | 10 | 0.999999 | 0 | 0 / 0 | 448 / 511 | 7 / 8 | 1 / 3 | 45.978 / 2.503 = 2.503 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 10 | 0.998864 | 2 | 1 / 1 | 449 / 512 | 7 / 9 | 2 / 3 | 48.436 / 2.407 = 2.407 + 0 | yes | |
+| shader/shader_material_screenspace_texture | 60 | 0.998929 | 2 | 1 / 1 | 449 / 512 | 7 / 9 | 2 / 3 | 3.231 / 1.598 = 1.598 + 0 | yes | |
+| shader/shader_material_2d | 10 | 1.000000 | 0 | 0 / 0 | 447 / 510 | 6 / 8 | 1 / 1 | 45.128 / 1.489 = 1.489 + 0 | yes | |
## Excluded
diff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonl
index e89f385a..f13cd4e2 100644
--- a/docs/bevy-parity/results.jsonl
+++ b/docs/bevy-parity/results.jsonl
@@ -28,8 +28,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":"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":17.824,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":510,"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.251,"step_ms":null,"cost_ms":1.251},"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.284,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":510,"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.103,"step_ms":null,"cost_ms":1.103},"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":""}
@@ -172,8 +170,10 @@
{"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/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":17.866,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":38,"entities":510,"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.768,"step_ms":null,"cost_ms":1.768},"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.758,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":17,"entities":511,"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.73,"step_ms":null,"cost_ms":1.73},"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.272,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":18,"entities":512,"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.684,"step_ms":null,"cost_ms":2.684},"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.29,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":69,"entities":512,"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.514,"step_ms":null,"cost_ms":1.514},"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":42.82,"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":2.442,"step_ms":null,"cost_ms":2.442},"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.2,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":510,"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.629,"step_ms":null,"cost_ms":1.629},"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.338,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":510,"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.465,"step_ms":null,"cost_ms":1.465},"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.093,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":38,"entities":510,"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.611,"step_ms":null,"cost_ms":1.611},"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":45.978,"materials":1,"mesh_entities":2,"meshes":7,"other_material":2,"visible":2},"raea":{"frame":17,"entities":511,"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.503,"step_ms":null,"cost_ms":2.503},"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.436,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":18,"entities":512,"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.407,"step_ms":null,"cost_ms":2.407},"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.231,"materials":2,"mesh_entities":2,"meshes":7,"other_material":1,"visible":2},"raea":{"frame":68,"entities":512,"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.598,"step_ms":null,"cost_ms":1.598},"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":45.128,"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.489,"step_ms":null,"cost_ms":1.489},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
diff --git a/systems/shader/src/lib.rs b/systems/shader/src/lib.rs
index c7d2bb53..6e249b0b 100644
--- a/systems/shader/src/lib.rs
+++ b/systems/shader/src/lib.rs
@@ -302,7 +302,8 @@ pub fn build(world: &mut World, v: &Value, mut image: impl FnMut(&mut World, &Va
/// A mesh row's shader put on its part: a <Material>'s own (own.rs) or a ShaderExtension over its standard material.
pub fn put(world: &mut World, e: Entity, v: &Value, mut image: impl FnMut(&mut World, &Value) -> Result<Handle<Image>, String>, made: &mut HashMap<(AssetId<StandardMaterial>, u128), Handle<ShadedMaterial>>) -> Result<(), String> {
- if own::is_own(v) {
+ // a <Material>'s spec has its `own` (own.rs)
+ if v.get("own").is_some() {
let m = own::build(world, v, &mut image, false)?;
own::put(world, e, m);
return Ok(());
diff --git a/systems/shader/src/own.rs b/systems/shader/src/own.rs
index d1124a29..9cff7927 100644
--- a/systems/shader/src/own.rs
+++ b/systems/shader/src/own.rs
@@ -91,8 +91,14 @@ impl From<&OwnMaterial> for OwnKey {
}
}
-fn uuid(id: u128) -> Handle<Shader> {
- Handle::Uuid(bevy::asset::uuid::Uuid::from_u128(id), core::marker::PhantomData)
+/// Material's and Material2d's specialize, one body for both (each trait takes its own pipeline and key types): the
+/// material's shaders put where that trait's placeholder is (`swap`).
+macro_rules! specialize {
+ ($pipeline:ty, $key:ident, $placeholder:expr) => {
+ fn specialize(_: &$pipeline, descriptor: &mut RenderPipelineDescriptor, _: &MeshVertexBufferLayoutRef, key: $key<Self>) -> Result<(), SpecializedMeshPipelineError> {
+ swap(descriptor, &$placeholder, key.bind_group_data)
+ }
+ };
}
impl Material for OwnMaterial {
@@ -105,9 +111,7 @@ impl Material for OwnMaterial {
fn depth_bias(&self) -> f32 {
self.depth_bias
}
- fn specialize(_: &MaterialPipeline, descriptor: &mut RenderPipelineDescriptor, _: &MeshVertexBufferLayoutRef, key: MaterialPipelineKey<Self>) -> Result<(), SpecializedMeshPipelineError> {
- swap(descriptor, &PLACEHOLDER, key.bind_group_data)
- }
+ specialize!(MaterialPipeline, MaterialPipelineKey, PLACEHOLDER);
}
impl Material2d for OwnMaterial {
@@ -124,18 +128,17 @@ impl Material2d for OwnMaterial {
fn depth_bias(&self) -> f32 {
self.depth_bias
}
- fn specialize(_: &Material2dPipeline, descriptor: &mut RenderPipelineDescriptor, _: &MeshVertexBufferLayoutRef, key: Material2dKey<Self>) -> Result<(), SpecializedMeshPipelineError> {
- swap(descriptor, &PLACEHOLDER_2D, key.bind_group_data)
- }
+ specialize!(Material2dPipeline, Material2dKey, PLACEHOLDER_2D);
}
/// 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> {
let Some(f) = descriptor.fragment.as_mut().filter(|f| f.shader.id() == placeholder.id()) else { return Ok(()) };
- f.shader = uuid(k.shader);
+ let shader = |id: u128| Handle::Uuid(bevy::asset::uuid::Uuid::from_u128(id), core::marker::PhantomData);
+ f.shader = shader(k.shader);
if k.vertex != 0 {
- descriptor.vertex.shader = uuid(k.vertex);
+ descriptor.vertex.shader = shader(k.vertex);
}
if let Some(c) = k.cull {
descriptor.primitive.cull_mode = c;
@@ -149,11 +152,6 @@ pub fn install(app: &mut App) {
app.add_plugins((MaterialPlugin::<OwnMaterial>::default(), Material2dPlugin::<OwnMaterial>::default()));
}
-/// Whether a mesh's shader spec is a `<Material>`'s (its `own`), not a ShaderExtension's.
-pub fn is_own(spec: &Value) -> bool {
- spec.get("own").is_some()
-}
-
/// The material a `<Material>` spec asks for: {fragment, vertex?, uniforms, textures, defs, own: {alpha_mode,
/// depth_bias, cull_mode}}, its shaders registered as written (bindings renumbered, imports beside them); a 2D one's
/// (`two_d`, a Material2d's) binds group 2.