-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Validation of inter-stage variable counts does not match the spec #5577
Description
https://gpuweb.github.io/gpuweb/#abstract-opdef-validating-inter-stage-interfaces
I noticed a few inconsistencies with the spec when reading through the interface validation code in wgpu-core.
-
User-defined variables all count as 4 components towards the limit (not what
ty.dim.num_components()returns).Each user-defined output of descriptor.vertex consumes 4 scalar components.
For each user-defined input of descriptor.fragment there must be a user-defined output of descriptor.vertex that location, type, and interpolation of the input.
-
If the topology is "point-list" the component limit for vertex outputs needs to be reduced by 1.
If descriptor.primitive.topology is "point-list":
Decrement maxVertexShaderOutputComponents by 1.
-
For fragment inputs, the
front_facing,sample_index, andsample_maskbuiltins all count as 1 component towards the limit. -
There is now a
maxInterStageShaderVariables(also mentioned in Further spec compliance #2170):The location of each user-defined output of descriptor.vertex must be < device.limits.maxInterStageShaderVariables.
I also had a couple questions on things aren't necessarily issues but weren't obvious to me when reading the code:
- At the point where validation is done: are all
wgpu/wgpu-core/src/validation.rs
Line 1255 in 53dd49f
Varying::Local { ref iv, .. } => iv.ty.dim.num_components(), Varying::Localvariables "user-defined"? (in terms of how the spec uses "user-defined") - (Now tracked by Validation of inter-stage variable types does not match the spec #9143): Matching types between stages is checked via
frag_input_ty.is_subtype_of(vert_output_ty)(here). E.g. for a particular location this would allowvec4<f32>on the vertex side andf32on the fragment side. Whether this is allowed isn't clear to me when looking at the line in the spec:For each user-defined input of descriptor.fragment there must be a user-defined output of descriptor.vertex that location, type, and interpolation of the input.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status