[Mesa-dev] [PATCH 03/11] spirv/info: Add spirv_op_to_string

Jason Ekstrand jason at jlekstrand.net
Sun Dec 17 05:46:13 UTC 2017


---
 src/compiler/spirv/spirv_info.h    |  1 +
 src/compiler/spirv/spirv_info_c.py | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/src/compiler/spirv/spirv_info.h b/src/compiler/spirv/spirv_info.h
index 81d43ec..121ffd2 100644
--- a/src/compiler/spirv/spirv_info.h
+++ b/src/compiler/spirv/spirv_info.h
@@ -28,5 +28,6 @@
 
 const char *spirv_capability_to_string(SpvCapability cap);
 const char *spirv_decoration_to_string(SpvDecoration dec);
+const char *spirv_op_to_string(SpvOp op);
 
 #endif /* SPIRV_INFO_H */
diff --git a/src/compiler/spirv/spirv_info_c.py b/src/compiler/spirv/spirv_info_c.py
index 4a6a815..ff7942b 100644
--- a/src/compiler/spirv/spirv_info_c.py
+++ b/src/compiler/spirv/spirv_info_c.py
@@ -45,6 +45,15 @@ def collect_data(spirv, kind):
 
     return (kind, values)
 
+def collect_opcodes(spirv):
+    values = []
+    for x in spirv["instructions"]:
+        name = x["opname"]
+        assert name.startswith("Op")
+        values.append(name[2:])
+
+    return ("Op", values)
+
 def parse_args():
     p = argparse.ArgumentParser()
     p.add_argument("json")
@@ -81,6 +90,7 @@ if __name__ == "__main__":
     info = [
         collect_data(spirv_info, "Capability"),
         collect_data(spirv_info, "Decoration"),
+        collect_opcodes(spirv_info),
     ]
 
     with open(pargs.out, 'w') as f:
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list