Interface

Struct Interface 

Source
pub struct Interface {
    limits: Limits,
    resources: Arena<Resource>,
    entry_points: FastHashMap<EntryPointKey, EntryPoint>,
}
Expand description

A summary of the shader interfaces of the entry points in a [naga::Module].

Fields§

§limits: Limits

A clone of the limits of the Device this module was created from.

Interface::check_stage consults this for workgroup size checks.

§resources: Arena<Resource>

All the resources the module cites as global variables.

This lists all the module’s bound resources: global variables with @group and @binding attributes.

Fields of EntryPoint like resources and sampling_pairs refer to elements in this arena by [naga::Handle].

§entry_points: FastHashMap<EntryPointKey, EntryPoint>

The shader interface of each [naga::EntryPoint] in the module.

This table is keyed by (stage, name) pairs: [naga::Module]s are allowed to contain multiple entry points with the same name, as long as they are for different shader stages.

Implementations§

Source§

impl Interface

Source

fn populate( list: &mut Vec<Varying>, binding: Option<&Binding>, ty: Handle<Type>, arena: &UniqueArena<Type>, )

Build some entry point’s list of inputs or outputs.

Given ty and binding that describe an entry point’s argument or return value, figure out which builtins or locations are involved and add them to list, which is either EntryPoint::inputs or EntryPoint::outputs.

  • If ty is a struct type, visit its members to find individual bindings, and add them to list.

  • Otherwise, binding must be Some(b) where b describes a binding’s builtin or location, and ty gives its type. Add this binding to list.

Source

pub fn new(module: &Module, info: &ModuleInfo, limits: Limits) -> Self

Construct an Interface value describing module.

The info argument must be the results from validating module, and limits must be the limits for the device that we will use to create this shader module.

Source

fn immediate_usage( &self, stage: ShaderStage, entry_point_name: &str, ) -> ImmediateUsage

Source

pub fn finalize_entry_point_name( &self, stage: ShaderStage, entry_point_name: Option<&str>, ) -> Result<String, StageError>

Select an entry point name, given an optional name and a shader stage.

See ShaderModule::finalize_entry_point_name for details.

Source

pub fn check_stage( &self, layouts: &mut BindingLayoutSource, minimum_binding_sizes: &mut FastHashMap<ResourceBinding, BufferSize>, entry_point_name: &str, shader_stage: ShaderStageForValidation, inputs: StageIo, primitive_topology: Option<PrimitiveTopology>, ) -> Result<StageIo, StageError>

Analyze and validate an entry point for use as a given shader stage.

Validate the entry point named entry_point_name for use in shader_stage:

  • Apply the WebGPU specification’s validating inter-stage interfaces algorithm.

  • Enforce workgroup size limits.

  • Check bind group layouts, and fill in derived bind group layouts.

  • Compute the minimum binding sizes, given the shader’s resource interface.

  • Check the compatibility between textures and samplers.

Given inputs, describing this stage’s inputs, return a StageIo describing its outputs.

Trait Implementations§

Source§

impl Debug for Interface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> 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
§

impl<T> Downcast<T> for T

§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> Upcast<T> for T

§

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

§

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

§

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

§

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

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,