File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
crates/rustc_codegen_spirv/src/codegen_cx Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -680,25 +680,28 @@ impl<'tcx> CodegenCx<'tcx> {
680
680
) ,
681
681
_ => false ,
682
682
} ;
683
- if let Some ( attachment_index) = attrs. input_attachment_index . map ( |attr| attr. value ) {
684
- if is_subpass_input {
685
- self . emit_global ( ) . capability ( Capability :: InputAttachment ) ;
683
+ if let Some ( attachment_index) = attrs. input_attachment_index {
684
+ if is_subpass_input && self . builder . has_capability ( Capability :: InputAttachment ) {
686
685
self . emit_global ( ) . decorate (
687
686
var,
688
687
Decoration :: InputAttachmentIndex ,
689
- std:: iter:: once ( Operand :: LiteralInt32 ( attachment_index) ) ,
688
+ std:: iter:: once ( Operand :: LiteralInt32 ( attachment_index. value ) ) ,
690
689
)
690
+ } else if is_subpass_input {
691
+ self . tcx
692
+ . sess
693
+ . span_err ( hir_param. ty_span , "Missing capability InputAttachment" )
691
694
} else {
692
695
self . tcx . sess . span_err (
693
- attrs . input_attachment_index . unwrap ( ) . span ,
694
- "#[spirv(attachment_index )] is only valid on Image types with dim = SubpassData"
696
+ attachment_index . span ,
697
+ "#[spirv(input_attachment_index )] is only valid on Image types with dim = SubpassData"
695
698
) ;
696
699
}
697
700
decoration_supersedes_location = true ;
698
701
} else if is_subpass_input {
699
702
self . tcx . sess . span_err (
700
703
hir_param. ty_span ,
701
- "Image types with dim = SubpassData require #[spirv(attachment_index )] decoration" ,
704
+ "Image types with dim = SubpassData require #[spirv(input_attachment_index )] decoration" ,
702
705
)
703
706
}
704
707
Original file line number Diff line number Diff line change 1
1
// build-pass
2
+ // compile-flags: -C target-feature=+InputAttachment
2
3
3
4
use spirv_std:: { arch, Image } ;
4
5
You can’t perform that action at this time.
0 commit comments