@@ -505,8 +505,10 @@ fn trans_scalar<'tcx>(
505
505
Primitive :: Int ( width, signedness) => {
506
506
SpirvType :: Integer ( width. size ( ) . bits ( ) as u32 , signedness) . def ( span, cx)
507
507
}
508
+ Primitive :: F16 => SpirvType :: Float ( 16 ) . def ( span, cx) ,
508
509
Primitive :: F32 => SpirvType :: Float ( 32 ) . def ( span, cx) ,
509
510
Primitive :: F64 => SpirvType :: Float ( 64 ) . def ( span, cx) ,
511
+ Primitive :: F128 => SpirvType :: Float ( 128 ) . def ( span, cx) ,
510
512
Primitive :: Pointer ( _) => {
511
513
let pointee_ty = dig_scalar_pointee ( cx, ty, offset) ;
512
514
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating
@@ -580,7 +582,7 @@ fn dig_scalar_pointee<'tcx>(
580
582
let new_pointee = dig_scalar_pointee ( cx, field, offset - field_offset) ;
581
583
match pointee {
582
584
Some ( old_pointee) if old_pointee != new_pointee => {
583
- cx. tcx . sess . fatal ( format ! (
585
+ cx. tcx . sess . psess . dcx . fatal ( format ! (
584
586
"dig_scalar_pointee: unsupported Pointer with different \
585
587
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
586
588
) ) ;
@@ -728,7 +730,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
728
730
if i == 0 {
729
731
field_names. push ( cx. sym . discriminant ) ;
730
732
} else {
731
- cx. tcx . sess . fatal ( "Variants::Multiple has multiple fields" )
733
+ cx. tcx . sess . psess . dcx . fatal ( "Variants::Multiple has multiple fields" )
732
734
}
733
735
} ;
734
736
}
@@ -784,7 +786,7 @@ impl fmt::Display for TyLayoutNameKey<'_> {
784
786
write ! ( f, "::{}" , def. variants( ) [ index] . name) ?;
785
787
}
786
788
}
787
- if let ( TyKind :: Coroutine ( _, _, _ ) , Some ( index) ) = ( self . ty . kind ( ) , self . variant ) {
789
+ if let ( TyKind :: Coroutine ( _, _, ) , Some ( index) ) = ( self . ty . kind ( ) , self . variant ) {
788
790
write ! ( f, "::{}" , CoroutineArgs :: variant_name( index) ) ?;
789
791
}
790
792
Ok ( ( ) )
@@ -805,6 +807,7 @@ fn trans_intrinsic_type<'tcx>(
805
807
return Err ( cx
806
808
. tcx
807
809
. sess
810
+ . psess . dcx
808
811
. err ( "#[spirv(generic_image)] type must have size 4" ) ) ;
809
812
}
810
813
@@ -848,7 +851,7 @@ fn trans_intrinsic_type<'tcx>(
848
851
_ => {
849
852
return Err ( cx
850
853
. tcx
851
- . sess
854
+ . sess . psess . dcx
852
855
. span_err ( span, "Invalid sampled type to `Image`." ) ) ;
853
856
}
854
857
} ;
@@ -871,7 +874,7 @@ fn trans_intrinsic_type<'tcx>(
871
874
Some ( v) => Ok ( v) ,
872
875
None => Err ( cx
873
876
. tcx
874
- . sess
877
+ . sess . psess . dcx
875
878
. err ( format ! ( "Invalid value for Image const generic: {value}" ) ) ) ,
876
879
}
877
880
}
@@ -897,7 +900,7 @@ fn trans_intrinsic_type<'tcx>(
897
900
IntrinsicType :: Sampler => {
898
901
// see SpirvType::sizeof
899
902
if ty. size != Size :: from_bytes ( 4 ) {
900
- return Err ( cx. tcx . sess . err ( "#[spirv(sampler)] type must have size 4" ) ) ;
903
+ return Err ( cx. tcx . sess . psess . dcx . err ( "#[spirv(sampler)] type must have size 4" ) ) ;
901
904
}
902
905
Ok ( SpirvType :: Sampler . def ( span, cx) )
903
906
}
@@ -910,7 +913,7 @@ fn trans_intrinsic_type<'tcx>(
910
913
if ty. size != Size :: from_bytes ( 4 ) {
911
914
return Err ( cx
912
915
. tcx
913
- . sess
916
+ . sess . psess . dcx
914
917
. err ( "#[spirv(sampled_image)] type must have size 4" ) ) ;
915
918
}
916
919
@@ -923,15 +926,15 @@ fn trans_intrinsic_type<'tcx>(
923
926
} else {
924
927
Err ( cx
925
928
. tcx
926
- . sess
929
+ . sess . psess . dcx
927
930
. err ( "#[spirv(sampled_image)] type must have a generic image type" ) )
928
931
}
929
932
}
930
933
IntrinsicType :: RuntimeArray => {
931
934
if ty. size != Size :: from_bytes ( 4 ) {
932
935
return Err ( cx
933
936
. tcx
934
- . sess
937
+ . sess . psess . dcx
935
938
. err ( "#[spirv(runtime_array)] type must have size 4" ) ) ;
936
939
}
937
940
@@ -943,7 +946,7 @@ fn trans_intrinsic_type<'tcx>(
943
946
} else {
944
947
Err ( cx
945
948
. tcx
946
- . sess
949
+ . sess . psess . dcx
947
950
. err ( "#[spirv(runtime_array)] type must have a generic element type" ) )
948
951
}
949
952
}
@@ -958,12 +961,12 @@ fn trans_intrinsic_type<'tcx>(
958
961
if field_types. len ( ) < 2 {
959
962
return Err ( cx
960
963
. tcx
961
- . sess
964
+ . sess . psess . dcx
962
965
. span_err ( span, "#[spirv(matrix)] type must have at least two fields" ) ) ;
963
966
}
964
967
let elem_type = field_types[ 0 ] ;
965
968
if !field_types. iter ( ) . all ( |& ty| ty == elem_type) {
966
- return Err ( cx. tcx . sess . span_err (
969
+ return Err ( cx. tcx . sess . psess . dcx . span_err (
967
970
span,
968
971
"#[spirv(matrix)] type fields must all be the same type" ,
969
972
) ) ;
@@ -973,10 +976,8 @@ fn trans_intrinsic_type<'tcx>(
973
976
ty => {
974
977
return Err ( cx
975
978
. tcx
976
- . sess
977
- . struct_span_err ( span, "#[spirv(matrix)] type fields must all be vectors" )
978
- . note ( format ! ( "field type is {}" , ty. debug( elem_type, cx) ) )
979
- . emit ( ) ) ;
979
+ . sess . psess . dcx
980
+ . span_err ( span, format ! ( "#[spirv(matrix)] type fields must all be vectors, found {}" , ty. debug( elem_type, cx) ) ) ) ;
980
981
}
981
982
}
982
983
0 commit comments