@@ -102,16 +102,6 @@ impl fmt::Display for NumericDimension {
102102 }
103103}
104104
105- impl NumericDimension {
106- fn num_components ( & self ) -> u32 {
107- match * self {
108- Self :: Scalar => 1 ,
109- Self :: Vector ( size) => size as u32 ,
110- Self :: Matrix ( w, h) => w as u32 * h as u32 ,
111- }
112- }
113- }
114-
115105#[ derive( Clone , Copy , Debug ) ]
116106pub struct NumericType {
117107 dim : NumericDimension ,
@@ -302,8 +292,6 @@ pub enum StageError {
302292 per_dimension_limit : & ' static str ,
303293 total_limit : & ' static str ,
304294 } ,
305- #[ error( "Shader uses {used} inter-stage components above the limit of {limit}" ) ]
306- TooManyVaryings { used : u32 , limit : u32 } ,
307295 #[ error( "Unable to find entry point '{0}'" ) ]
308296 MissingEntryPoint ( String ) ,
309297 #[ error( "Shader global {0:?} is not available in the pipeline layout" ) ]
@@ -426,7 +414,6 @@ impl WebGpuError for StageError {
426414 error,
427415 } => error,
428416 Self :: InvalidWorkgroupSize { .. }
429- | Self :: TooManyVaryings { .. }
430417 | Self :: MissingEntryPoint ( ..)
431418 | Self :: NoEntryPointFound
432419 | Self :: MultipleEntryPointsFound
@@ -1424,7 +1411,6 @@ impl Interface {
14241411 }
14251412 }
14261413
1427- let mut inter_stage_components = 0 ;
14281414 let mut this_stage_primitive_index = false ;
14291415 let mut has_draw_id = false ;
14301416
@@ -1437,38 +1423,36 @@ impl Interface {
14371423 . get ( & location)
14381424 . ok_or ( InputError :: Missing )
14391425 . and_then ( |provided| {
1440- let ( compatible, num_components, per_primitive_correct) =
1441- match shader_stage. to_naga ( ) {
1442- // For vertex attributes, there are defaults filled out
1443- // by the driver if data is not provided.
1444- naga:: ShaderStage :: Vertex => {
1445- let is_compatible =
1446- iv. ty . scalar . kind == provided. ty . scalar . kind ;
1447- // vertex inputs don't count towards inter-stage
1448- ( is_compatible, 0 , !iv. per_primitive )
1426+ let ( compatible, per_primitive_correct) = match shader_stage. to_naga ( ) {
1427+ // For vertex attributes, there are defaults filled out
1428+ // by the driver if data is not provided.
1429+ naga:: ShaderStage :: Vertex => {
1430+ let is_compatible =
1431+ iv. ty . scalar . kind == provided. ty . scalar . kind ;
1432+ // vertex inputs don't count towards inter-stage
1433+ ( is_compatible, !iv. per_primitive )
1434+ }
1435+ naga:: ShaderStage :: Fragment => {
1436+ if iv. interpolation != provided. interpolation {
1437+ return Err ( InputError :: InterpolationMismatch (
1438+ provided. interpolation ,
1439+ ) ) ;
14491440 }
1450- naga:: ShaderStage :: Fragment => {
1451- if iv. interpolation != provided. interpolation {
1452- return Err ( InputError :: InterpolationMismatch (
1453- provided. interpolation ,
1454- ) ) ;
1455- }
1456- if iv. sampling != provided. sampling {
1457- return Err ( InputError :: SamplingMismatch (
1458- provided. sampling ,
1459- ) ) ;
1460- }
1461- (
1462- iv. ty . is_subtype_of ( & provided. ty ) ,
1463- iv. ty . dim . num_components ( ) ,
1464- iv. per_primitive == provided. per_primitive ,
1465- )
1441+ if iv. sampling != provided. sampling {
1442+ return Err ( InputError :: SamplingMismatch (
1443+ provided. sampling ,
1444+ ) ) ;
14661445 }
1467- // These can't have varying inputs
1468- naga:: ShaderStage :: Compute
1469- | naga:: ShaderStage :: Task
1470- | naga:: ShaderStage :: Mesh => ( false , 0 , false ) ,
1471- } ;
1446+ (
1447+ iv. ty . is_subtype_of ( & provided. ty ) ,
1448+ iv. per_primitive == provided. per_primitive ,
1449+ )
1450+ }
1451+ // These can't have varying inputs
1452+ naga:: ShaderStage :: Compute
1453+ | naga:: ShaderStage :: Task
1454+ | naga:: ShaderStage :: Mesh => ( false , false ) ,
1455+ } ;
14721456 if !compatible {
14731457 return Err ( InputError :: WrongType ( provided. ty ) ) ;
14741458 } else if !per_primitive_correct {
@@ -1477,19 +1461,15 @@ impl Interface {
14771461 shader : iv. per_primitive ,
14781462 } ) ;
14791463 }
1480- Ok ( num_components)
1464+ Ok ( ( ) )
1465+ } ) ;
1466+
1467+ if let Err ( error) = result {
1468+ return Err ( StageError :: Input {
1469+ location,
1470+ var : iv. clone ( ) ,
1471+ error,
14811472 } ) ;
1482- match result {
1483- Ok ( num_components) => {
1484- inter_stage_components += num_components;
1485- }
1486- Err ( error) => {
1487- return Err ( StageError :: Input {
1488- location,
1489- var : iv. clone ( ) ,
1490- error,
1491- } )
1492- }
14931473 }
14941474 }
14951475 Varying :: BuiltIn ( naga:: BuiltIn :: PrimitiveIndex ) => {
@@ -1544,7 +1524,6 @@ impl Interface {
15441524 } ) ;
15451525 }
15461526 num_user_defined_outputs += 1 ;
1547- inter_stage_components += iv. ty . dim . num_components ( )
15481527 }
15491528 Varying :: BuiltIn ( _) => { }
15501529 } ;
@@ -1625,7 +1604,6 @@ impl Interface {
16251604 } ) ;
16261605 }
16271606 num_user_defined_inputs += 1 ;
1628- inter_stage_components += iv. ty . dim . num_components ( )
16291607 }
16301608 Varying :: BuiltIn ( _) => { }
16311609 } ;
@@ -1655,13 +1633,6 @@ impl Interface {
16551633 _ => ( ) ,
16561634 }
16571635
1658- if inter_stage_components > self . limits . max_inter_stage_shader_components {
1659- return Err ( StageError :: TooManyVaryings {
1660- used : inter_stage_components,
1661- limit : self . limits . max_inter_stage_shader_components ,
1662- } ) ;
1663- }
1664-
16651636 if let Some ( ref mesh_info) = entry_point. mesh_info {
16661637 if mesh_info. max_vertices > self . limits . max_mesh_output_vertices {
16671638 return Err ( StageError :: TooManyMeshVertices {
0 commit comments