[core] Rename Varying::Local to UserDefined. Doc fixes. (#9987)

This commit is contained in:
Jim Blandy authored and GitHub committed 2026-08-03 04:56:58 -04:00
1 parent 6150c8239f
commit de856fc605
1 file changed
+25 -8
+25 -8
View File
@@ -151,9 +151,26 @@ impl fmt::Display for InterfaceVar {
}
}
/// An [inter-stage input or output value][io].
///
/// A value of this type describes one value to be passed to or returned from
/// some entry point.
///
/// [io]: https://www.w3.org/TR/WGSL/#stage-inputs-outputs
#[derive(Debug, Eq, PartialEq)]
enum Varying {
Local { location: u32, iv: InterfaceVar },
/// A [user-defined input or output][uio].
///
/// In WGSL, this is a value with a `@location` attribute.
///
/// [uio]: https://www.w3.org/TR/WGSL/#user-defined-inputs-outputs
UserDefined { location: u32, iv: InterfaceVar },
/// A [built-in input or output][bio].
///
/// In WGSL, this is a value with a `@builtin` attribute.
///
/// [bio]: https://www.w3.org/TR/WGSL/#builtin-inputs-outputs
BuiltIn(BuiltIn),
}
@@ -1163,7 +1180,7 @@ impl Interface {
sampling,
per_primitive,
blend_src: _,
}) => Varying::Local {
}) => Varying::UserDefined {
location,
iv: InterfaceVar {
ty: numeric_ty,
@@ -1595,7 +1612,7 @@ impl Interface {
// check inputs compatibility
for input in entry_point.inputs.iter() {
match *input {
Varying::Local { location, ref iv } => {
Varying::UserDefined { location, ref iv } => {
let result = inputs
.varyings
.get(&location)
@@ -1713,7 +1730,7 @@ impl Interface {
for output in entry_point.outputs.iter() {
match *output {
Varying::Local { ref iv, location } => {
Varying::UserDefined { ref iv, location } => {
if location > max_vertex_shader_output_location {
return Err(StageError::VertexOutputLocationTooLarge {
location,
@@ -1766,7 +1783,7 @@ impl Interface {
self.limits.max_inter_stage_shader_variables;
let deductions = entry_point.inputs.iter().filter_map(|output| match output {
Varying::Local { .. } => None,
Varying::UserDefined { .. } => None,
Varying::BuiltIn(builtin) => {
MaxFragmentShaderInputDeduction::from_inter_stage_builtin(builtin.to_naga())
.or_else(|| {
@@ -1793,7 +1810,7 @@ impl Interface {
for output in entry_point.inputs.iter() {
match *output {
Varying::Local { ref iv, location } => {
Varying::UserDefined { ref iv, location } => {
if location >= self.limits.max_inter_stage_shader_variables {
return Err(StageError::FragmentInputLocationTooLarge {
location,
@@ -1817,7 +1834,7 @@ impl Interface {
}
for output in &entry_point.outputs {
let &Varying::Local { location, ref iv } = output else {
let &Varying::UserDefined { location, ref iv } = output else {
continue;
};
if location >= self.limits.max_color_attachments {
@@ -1916,7 +1933,7 @@ impl Interface {
.outputs
.iter()
.filter_map(|output| match *output {
Varying::Local { location, ref iv } => Some((location, iv.clone())),
Varying::UserDefined { location, ref iv } => Some((location, iv.clone())),
Varying::BuiltIn(_) => None,
})
.collect();