spirv: vtn_fail with a nice message on unsupported rounding modes
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 23 Sep 2020 20:54:34 +0000 (15:54 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 25 Sep 2020 01:43:28 +0000 (01:43 +0000)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6845>

src/compiler/spirv/spirv_info.h
src/compiler/spirv/spirv_info_c.py
src/compiler/spirv/vtn_alu.c

index 8b8b687..c9bfcda 100644 (file)
@@ -38,5 +38,6 @@ const char *spirv_imageoperands_to_string(SpvImageOperandsMask op);
 const char *spirv_memorymodel_to_string(SpvMemoryModel cap);
 const char *spirv_op_to_string(SpvOp op);
 const char *spirv_storageclass_to_string(SpvStorageClass sc);
+const char *spirv_fproundingmode_to_string(SpvFPRoundingMode sc);
 
 #endif /* SPIRV_INFO_H */
index 29baec1..f1a1e27 100644 (file)
@@ -124,6 +124,7 @@ if __name__ == "__main__":
         collect_data(spirv_info, "MemoryModel"),
         collect_data(spirv_info, "StorageClass"),
         collect_data(spirv_info, "ImageOperands"),
+        collect_data(spirv_info, "FPRoundingMode"),
         collect_opcodes(spirv_info),
     ]
 
index b403a25..6d64dd7 100644 (file)
@@ -388,7 +388,8 @@ handle_rounding_mode(struct vtn_builder *b, struct vtn_value *val, int member,
       *out_rounding_mode = nir_rounding_mode_rtz;
       break;
    default:
-      unreachable("Not supported rounding mode");
+      vtn_fail("Unsupported rounding mode: %s",
+               spirv_fproundingmode_to_string(dec->operands[0]));
       break;
    }
 }