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_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);
seen.add(x["value"])
values.append(x["enumerant"])
- return (kind, values)
+ return (kind, values, operands["category"])
def collect_opcodes(spirv):
seen = set()
values.append(name[2:])
seen.add(opcode)
- return ("Op", values)
+ return ("Op", values, None)
def parse_args():
p = argparse.ArgumentParser()
""" + COPYRIGHT + """\
#include "spirv_info.h"
-% for kind,values in info:
+% for kind,values,category in info:
+% if category == "BitEnum":
+const char *
+spirv_${kind.lower()}_to_string(Spv${kind}Mask v)
+{
+ switch (v) {
+ % for name in values:
+ %if name != "None":
+ case Spv${kind}${name}Mask: return "Spv${kind}${name}";
+ % else:
+ case Spv${kind}MaskNone: return "Spv${kind}${name}";
+ % endif
+ % endfor
+ }
+
+ return "unknown";
+}
+% else:
const char *
spirv_${kind.lower()}_to_string(Spv${kind} v)
{
return "unknown";
}
+% endif
% endfor
""")
collect_data(spirv_info, "ImageFormat"),
collect_data(spirv_info, "MemoryModel"),
collect_data(spirv_info, "StorageClass"),
+ collect_data(spirv_info, "ImageOperands"),
collect_opcodes(spirv_info),
]