Skip to main content

ShaderProgram

Struct ShaderProgram 

Source
pub struct ShaderProgram { /* private fields */ }

Implementations§

Source§

impl ShaderProgram

Source

pub const NAME: &'static str = "WebGPUShader"

Static name member (is_shader_v)

Source

pub fn new( context: &Context, vertex_source: &str, fragment_source: &str, attrs: &[AttributeInfo], texts: &[TextureInfo], name: &str, ) -> Self

ShaderProgram(context, vertexSource, fragmentSource, attrs, texts, name)

Source

pub fn from_sources( context: &Context, vertex_source: &str, fragment_source: &str, ) -> Self

ShaderProgram(Context&, vertexSource, fragmentSource) (minimal constructor; name “ContextShader”).

Source

pub fn get_render_pipeline( &self, vertex_layouts: &[VertexLayout], color_mode: &ColorMode, depth_mode: &DepthMode, stencil_mode: &StencilMode, draw_mode_type: DrawModeType, reuse_hash: Option<u64>, ) -> Option<RenderPipeline>

getRenderPipeline(renderable, vertexLayouts, ..., reuseHash). The renderable is unused in C++ and not passed.

Source

pub fn get_binding_infos(&self) -> &[BindingInfo]

Source

pub fn get_binding_infos_for_group(&self, group: u32) -> &[BindingInfo]

Source

pub fn get_bind_group_layout(&self, group: u32) -> Option<&BindGroupLayout>

Source

pub fn get_bind_group_layouts(&self) -> &[BindGroupLayout]

Source

pub fn get_bind_group_order(&self) -> &[u32]

Source

pub fn get_shader_name(&self) -> &str

Source

pub fn has_shader_modules(&self) -> bool

Whether both WGSL modules compiled.

Source

pub fn init_attribute(&mut self, info: &AttributeInfo)

Source

pub fn init_instance_attribute(&mut self, info: &AttributeInfo)

Source

pub fn init_texture(&mut self, info: &TextureInfo)

Trait Implementations§

Source§

impl Shader for ShaderProgram

Source§

fn type_name(&self) -> &'static str

Get the type name of this shader
Source§

fn as_any(&self) -> &dyn Any

Source§

impl ShaderProgramBase for ShaderProgram

Source§

fn get_id(&self) -> SimpleIdentity

getID(): the shaderProgramID assigned at construction.
Source§

fn get_sampler_location(&self, id: usize) -> Option<usize>

Gets the sampler location for a texture id
Source§

fn get_vertex_attributes(&self) -> &VertexAttributeArray

Get the available vertex attributes and their default values
Source§

fn get_instance_attributes(&self) -> &VertexAttributeArray

Get the available instance attributes and their default values

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>