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: LimitsA 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
impl Interface
Sourcefn populate(
list: &mut Vec<Varying>,
binding: Option<&Binding>,
ty: Handle<Type>,
arena: &UniqueArena<Type>,
)
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
tyis a struct type, visit its members to find individual bindings, and add them tolist. -
Otherwise,
bindingmust beSome(b)wherebdescribes a binding’s builtin or location, andtygives its type. Add this binding tolist.
Sourcepub fn new(module: &Module, info: &ModuleInfo, limits: Limits) -> Self
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.
fn immediate_usage( &self, stage: ShaderStage, entry_point_name: &str, ) -> ImmediateUsage
Sourcepub fn finalize_entry_point_name(
&self,
stage: ShaderStage,
entry_point_name: Option<&str>,
) -> Result<String, StageError>
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.
Sourcepub 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>
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§
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
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
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 more