glcpp: Allow vertical tab and form feed characters in GLSL
[mesa.git] / src / compiler / glsl / ir_expression_operation.py
index d5a06f864eb429b284fb80e8c37698018b621efb..58a585b741d23269d2fdc55a477e82c8be8c8bc9 100644 (file)
@@ -103,7 +103,7 @@ constant_template_common = mako.template.Template("""\
             break;
     % endfor
          default:
-            assert(0);
+            unreachable("invalid type");
          }
       }
       break;""")
@@ -134,7 +134,7 @@ constant_template_vector_scalar = mako.template.Template("""\
             break;
     % endfor
          default:
-            assert(0);
+            unreachable("invalid type");
          }
       }
       break;""")
@@ -157,7 +157,7 @@ constant_template_mul = mako.template.Template("""\
                break;
     % endfor
             default:
-               assert(0);
+               unreachable("invalid type");
             }
          }
       } else {
@@ -215,7 +215,7 @@ constant_template_horizontal = mako.template.Template("""\
          break;
     % endfor
       default:
-         assert(0);
+         unreachable("invalid type");
       }
       break;""")
 
@@ -232,7 +232,7 @@ constant_template_vector_extract = mako.template.Template("""\
          break;
     % endfor
       default:
-         assert(0);
+         unreachable("invalid type");
       }
       break;
    }""")
@@ -251,8 +251,7 @@ constant_template_vector_insert = mako.template.Template("""\
          break;
     % endfor
       default:
-         assert(!"Should not get here.");
-         break;
+         unreachable("invalid type");
       }
       break;
    }""")
@@ -268,7 +267,7 @@ constant_template_vector = mako.template.Template("""\
             break;
     % endfor
          default:
-            assert(0);
+            unreachable("invalid type");
          }
       }
       break;""")
@@ -292,7 +291,7 @@ constant_template_lrp = mako.template.Template("""\
             break;
     % endfor
          default:
-            assert(0);
+            unreachable("invalid type");
          }
       }
       break;
@@ -311,7 +310,7 @@ constant_template_csel = mako.template.Template("""\
             break;
     % endfor
          default:
-            assert(0);
+            unreachable("invalid type");
          }
       }
       break;""")
@@ -358,7 +357,7 @@ class operation(object):
 
 
    def get_enum_name(self):
-      return "ir_{}op_{}".format(("un", "bin", "tri", "quad")[self.num_operands-1], self.name)
+      return "ir_{0}op_{1}".format(("un", "bin", "tri", "quad")[self.num_operands-1], self.name)
 
 
    def get_template(self):
@@ -395,10 +394,10 @@ class operation(object):
 
 
    def get_c_expression(self, types, indices=("c", "c", "c")):
-      src0 = "op[0]->value.{}[{}]".format(types[0].union_field, indices[0])
-      src1 = "op[1]->value.{}[{}]".format(types[1].union_field, indices[1]) if len(types) >= 2 else "ERROR"
-      src2 = "op[2]->value.{}[{}]".format(types[2].union_field, indices[2]) if len(types) >= 3 else "ERROR"
-      src3 = "op[3]->value.{}[c]".format(types[3].union_field) if len(types) >= 4 else "ERROR"
+      src0 = "op[0]->value.{0}[{1}]".format(types[0].union_field, indices[0])
+      src1 = "op[1]->value.{0}[{1}]".format(types[1].union_field, indices[1]) if len(types) >= 2 else "ERROR"
+      src2 = "op[2]->value.{0}[{1}]".format(types[2].union_field, indices[2]) if len(types) >= 3 else "ERROR"
+      src3 = "op[3]->value.{0}[c]".format(types[3].union_field) if len(types) >= 4 else "ERROR"
 
       expr = self.c_expression[types[0].union_field] if types[0].union_field in self.c_expression else self.c_expression['default']
 
@@ -708,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("""\