@@ -2,11 +2,13 @@ use super::Builder;
2
2
use crate :: builder_spirv:: { BuilderCursor , SpirvValue } ;
3
3
use crate :: codegen_cx:: CodegenCx ;
4
4
use crate :: spirv_type:: SpirvType ;
5
+ use num_traits:: FromPrimitive ;
5
6
use rspirv:: dr;
6
7
use rspirv:: grammar:: { reflect, LogicalOperand , OperandKind , OperandQuantifier } ;
7
8
use rspirv:: spirv:: {
8
- FPFastMathMode , FragmentShadingRate , FunctionControl , ImageOperands , KernelProfilingInfo ,
9
- LoopControl , MemoryAccess , MemorySemantics , Op , RayFlags , SelectionControl , StorageClass , Word ,
9
+ FPFastMathMode , FragmentShadingRate , FunctionControl , GroupOperation , ImageOperands ,
10
+ KernelProfilingInfo , LoopControl , MemoryAccess , MemorySemantics , Op , RayFlags ,
11
+ SelectionControl , StorageClass , Word ,
10
12
} ;
11
13
use rustc_ast:: ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
12
14
use rustc_codegen_ssa:: mir:: place:: PlaceRef ;
@@ -1347,10 +1349,15 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
1347
1349
Ok ( x) => inst. operands . push ( dr:: Operand :: Scope ( x) ) ,
1348
1350
Err ( ( ) ) => self . err ( format ! ( "unknown Scope {word}" ) ) ,
1349
1351
} ,
1350
- ( OperandKind :: GroupOperation , Some ( word) ) => match word. parse ( ) {
1351
- Ok ( x) => inst. operands . push ( dr:: Operand :: GroupOperation ( x) ) ,
1352
- Err ( ( ) ) => self . err ( format ! ( "unknown GroupOperation {word}" ) ) ,
1353
- } ,
1352
+ ( OperandKind :: GroupOperation , Some ( word) ) => {
1353
+ match word. parse :: < u32 > ( ) . ok ( ) . and_then ( GroupOperation :: from_u32) {
1354
+ Some ( id) => inst. operands . push ( dr:: Operand :: GroupOperation ( id) ) ,
1355
+ None => match word. parse ( ) {
1356
+ Ok ( x) => inst. operands . push ( dr:: Operand :: GroupOperation ( x) ) ,
1357
+ Err ( ( ) ) => self . err ( format ! ( "unknown GroupOperation {word}" ) ) ,
1358
+ } ,
1359
+ }
1360
+ }
1354
1361
( OperandKind :: KernelEnqueueFlags , Some ( word) ) => match word. parse ( ) {
1355
1362
Ok ( x) => inst. operands . push ( dr:: Operand :: KernelEnqueueFlags ( x) ) ,
1356
1363
Err ( ( ) ) => self . err ( format ! ( "unknown KernelEnqueueFlags {word}" ) ) ,
0 commit comments