Skip to main content

bevy_material/
labels.rs

1use bevy_ecs::define_label;
2use bevy_ecs::intern::Interned;
3pub use bevy_material_macros::ShaderLabel;
4
5define_label!(
6    #[diagnostic::on_unimplemented(
7        note = "consider annotating `{Self}` with `#[derive(ShaderLabel)]`"
8    )]
9    /// Labels used to uniquely identify types of material shaders
10    ShaderLabel,
11    SHADER_LABEL_INTERNER
12);
13
14/// A shorthand for `Interned<dyn RenderSubGraph>`.
15pub type InternedShaderLabel = Interned<dyn ShaderLabel>;
16
17pub use bevy_material_macros::DrawFunctionLabel;
18
19define_label!(
20    #[diagnostic::on_unimplemented(
21        note = "consider annotating `{Self}` with `#[derive(DrawFunctionLabel)]`"
22    )]
23    /// Labels used to uniquely identify types of material shaders
24    DrawFunctionLabel,
25    DRAW_FUNCTION_LABEL_INTERNER
26);
27
28pub type InternedDrawFunctionLabel = Interned<dyn DrawFunctionLabel>;
29
30// TODO: make this generic?
31/// An identifier for a [`Draw`](https://docs.rs/bevy/latest/bevy/render/render_phase/trait.Draw.html)
32/// function stored in [`DrawFunctions`](https://docs.rs/bevy/latest/bevy/render/render_phase/struct.DrawFunctions.html).
33#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
34pub struct DrawFunctionId(pub u32);