Mesa (master): glsl: Generate strings that are the enum names without the ir_*op_ prefix

Ian Romanick idr at kemper.freedesktop.org
Thu Nov 10 22:31:05 UTC 2016


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Thu Sep 15 11:26:28 2016 -0700

glsl: Generate strings that are the enum names without the ir_*op_ prefix

For many expressions, this is different from the printable name.  The
printable name for ir_binop_add is "+", but we want "add".  This is
needed for ir_builder_print_visitor.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/compiler/glsl/ir.h                       | 1 +
 src/compiler/glsl/ir_expression_operation.py | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 433ba19..24f510e 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -1471,6 +1471,7 @@ public:
 #include "ir_expression_operation.h"
 
 extern const char *const ir_expression_operation_strings[ir_last_opcode + 1];
+extern const char *const ir_expression_operation_enum_strings[ir_last_opcode + 1];
 
 class ir_expression : public ir_rvalue {
 public:
diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py
index 9aa08d3..58a585b 100644
--- a/src/compiler/glsl/ir_expression_operation.py
+++ b/src/compiler/glsl/ir_expression_operation.py
@@ -707,6 +707,12 @@ const char *const ir_expression_operation_strings[] = {
 % for item in values:
    "${item.printable_name}",
 % endfor
+};
+
+const char *const ir_expression_operation_enum_strings[] = {
+% for item in values:
+   "${item.name}",
+% endfor
 };""")
 
    constant_template = mako.template.Template("""\




More information about the mesa-commit mailing list