summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-04-10 10:04:05 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-04-16 11:11:10 -0700
commit0ccfe741b106efea2f2c5d526d50f4bce61d701e (patch)
treee46ef0913046d8f61ae95550fb58d8f93775695b /src/compiler/spirv
parent583a4d9a2719714ccd384931fb181aa2532ee316 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_info.h6
-rw-r--r--src/compiler/spirv/spirv_info_c.py12
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),
]