Mesa (master): spirv: Add more to_string helpers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 16 18:33:12 UTC 2019


Module: Mesa
Branch: master
Commit: 0ccfe741b106efea2f2c5d526d50f4bce61d701e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ccfe741b106efea2f2c5d526d50f4bce61d701e

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Wed Apr 10 10:04:05 2019 -0700

spirv: Add more to_string helpers

Also, use a set to identify repeated values.  The previous arrangement
worked when the repetitions were one after another, but in some of the
new cases they are not.

Reviewed-by: Karol Herbst <kherbst at redhat.com>

---

 src/compiler/spirv/spirv_info.h    |  6 ++++++
 src/compiler/spirv/spirv_info_c.py | 12 +++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/compiler/spirv/spirv_info.h b/src/compiler/spirv/spirv_info.h
index a03c2ef8eb0..e4eac9e690f 100644
--- a/src/compiler/spirv/spirv_info.h
+++ b/src/compiler/spirv/spirv_info.h
@@ -26,9 +26,15 @@
 
 #include "spirv.h"
 
+const char *spirv_addressingmodel_to_string(SpvAddressingModel model);
+const char *spirv_builtin_to_string(SpvBuiltIn builtin);
 const char *spirv_capability_to_string(SpvCapability cap);
 const char *spirv_decoration_to_string(SpvDecoration dec);
+const char *spirv_dim_to_string(SpvDim dim);
 const char *spirv_executionmode_to_string(SpvExecutionMode mode);
+const char *spirv_executionmodel_to_string(SpvExecutionModel model);
+const char *spirv_imageformat_to_string(SpvImageFormat format);
 const char *spirv_op_to_string(SpvOp op);
+const char *spirv_storageclass_to_string(SpvStorageClass sc);
 
 #endif /* SPIRV_INFO_H */
diff --git a/src/compiler/spirv/spirv_info_c.py b/src/compiler/spirv/spirv_info_c.py
index 6880d3e329d..22fd675720c 100644
--- a/src/compiler/spirv/spirv_info_c.py
+++ b/src/compiler/spirv/spirv_info_c.py
@@ -36,11 +36,11 @@ def collect_data(spirv, kind):
 
     # There are some duplicate values in some of the tables (thanks guys!), so
     # filter them out.
-    last_value = -1
+    seen = set()
     values = []
     for x in operands["enumerants"]:
-        if x["value"] != last_value:
-            last_value = x["value"]
+        if x["value"] not in seen:
+            seen.add(x["value"])
             values.append(x["enumerant"])
 
     return (kind, values)
@@ -88,9 +88,15 @@ if __name__ == "__main__":
     spirv_info = json.JSONDecoder().decode(open(pargs.json, "r").read())
 
     info = [
+        collect_data(spirv_info, "AddressingModel"),
+        collect_data(spirv_info, "BuiltIn"),
         collect_data(spirv_info, "Capability"),
         collect_data(spirv_info, "Decoration"),
+        collect_data(spirv_info, "Dim"),
         collect_data(spirv_info, "ExecutionMode"),
+        collect_data(spirv_info, "ExecutionModel"),
+        collect_data(spirv_info, "ImageFormat"),
+        collect_data(spirv_info, "StorageClass"),
         collect_opcodes(spirv_info),
     ]
 




More information about the mesa-commit mailing list