mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
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@redhat.com>
This commit is contained in:
parent
583a4d9a27
commit
0ccfe741b1
2 changed files with 15 additions and 3 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue