@@ -2,11 +2,13 @@ use super::Builder;
22use crate :: builder_spirv:: { BuilderCursor , SpirvValue } ;
33use crate :: codegen_cx:: CodegenCx ;
44use crate :: spirv_type:: SpirvType ;
5+ use num_traits:: FromPrimitive ;
56use rspirv:: dr;
67use rspirv:: grammar:: { reflect, LogicalOperand , OperandKind , OperandQuantifier } ;
78use 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 ,
1012} ;
1113use rustc_ast:: ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
1214use rustc_codegen_ssa:: mir:: place:: PlaceRef ;
@@ -1347,10 +1349,15 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
13471349 Ok ( x) => inst. operands . push ( dr:: Operand :: Scope ( x) ) ,
13481350 Err ( ( ) ) => self . err ( format ! ( "unknown Scope {word}" ) ) ,
13491351 } ,
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+ }
13541361 ( OperandKind :: KernelEnqueueFlags , Some ( word) ) => match word. parse ( ) {
13551362 Ok ( x) => inst. operands . push ( dr:: Operand :: KernelEnqueueFlags ( x) ) ,
13561363 Err ( ( ) ) => self . err ( format ! ( "unknown KernelEnqueueFlags {word}" ) ) ,
0 commit comments