pub struct MaterialDescriptor<'a> {
pub label: Option<&'a str>,
pub shader_source: &'a str,
pub vertex_entry: Option<&'a str>,
pub fragment_entry: Option<&'a str>,
pub vertex_layouts: Vec<VertexBufferLayout<'static>>,
pub entries: Vec<BindingEntry>,
pub cull_mode: Option<Face>,
pub depth: Option<DepthStencilState>,
pub targets: Vec<ColorTargetState>,
pub polygon_mode: PolygonMode,
pub own_group: Option<u32>,
pub extra_layouts: Vec<OwnedGroupLayout>,
}Expand description
Describes a render pipeline + its own bind group, the source type
GPUMaterial is built from via build_material. Start from
MaterialDescriptor::default() and override only the fields that
differ from a plain opaque material with no depth testing.
Fields§
§label: Option<&'a str>Debug label, threaded through to the shader module, pipeline, and bind group layout.
shader_source: &'a strWGSL source for both the vertex and fragment stage.
vertex_entry: Option<&'a str>Vertex stage entry point. Defaults to "vs_main".
fragment_entry: Option<&'a str>Fragment stage entry point. Defaults to "fs_main".
vertex_layouts: Vec<VertexBufferLayout<'static>>Vertex buffer layouts, in the order buffers will be bound at draw
time (e.g. Vertex::layout()).
entries: Vec<BindingEntry>This material’s own bind group entries. See
BindingKind for what a
material-appropriate entry looks like — build_material panics if
any entry here is COMPUTE-visible.
cull_mode: Option<Face>Face culling mode. Defaults to Some(Face::Back).
depth: Option<DepthStencilState>Depth/stencil state. None disables depth testing.
targets: Vec<ColorTargetState>Color target states — one per fragment shader output. See
DEFAULT_TARGET for a ready-made single-target default.
polygon_mode: PolygonModeRasterizer polygon mode. Defaults to Fill.
own_group: Option<u32>Which @group(N) the layout built from entries occupies in the pipeline, or
None if this material has no entries of its own (e.g. it only uses extra_layouts).
extra_layouts: Vec<OwnedGroupLayout>Additional bind group layouts, each tagged with the @group(N) it occupies.
Every index from 0 up to the highest one used (including own_group, if set) must
be covered exactly once, or build_material panics — this makes group assignment
explicit instead of inferred from field order.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for MaterialDescriptor<'a>
impl<'a> !UnwindSafe for MaterialDescriptor<'a>
impl<'a> Freeze for MaterialDescriptor<'a>
impl<'a> Send for MaterialDescriptor<'a>
impl<'a> Sync for MaterialDescriptor<'a>
impl<'a> Unpin for MaterialDescriptor<'a>
impl<'a> UnsafeUnpin for MaterialDescriptor<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().