summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_expression_operation.py
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-07-14 17:42:59 -0700
committerIan Romanick <[email protected]>2016-08-30 16:28:03 -0700
commitddb4b53de3ae0638f58fdbcd6cdf8f398a566103 (patch)
tree5780afaacc4f8821b1bbdd695edc73ab684eff6a /src/compiler/glsl/ir_expression_operation.py
parentee3cdac7857a5c0f30108e1b1963d042f2a5e8e6 (diff)
glsl: Eliminate one of the templates for simpler operations
The difference between these two templates were mostly an artefact of the development of the original patch series and to minimize the differences between the original code and the generated code. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_expression_operation.py')
-rw-r--r--src/compiler/glsl/ir_expression_operation.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py
index 4d799003c95..15ad7775d5c 100644
--- a/src/compiler/glsl/ir_expression_operation.py
+++ b/src/compiler/glsl/ir_expression_operation.py
@@ -107,25 +107,9 @@ constant_template0 = mako.template.Template("""\
% endfor
break;""")
-# This template is for unary operations that can have operands of a several
-# different types. ir_unop_bit_not is an example.
-constant_template1 = mako.template.Template("""\
- case ${op.get_enum_name()}:
- switch (op[0]->type->base_type) {
- % for dst_type, src_types in op.signatures():
- case ${src_types[0].glsl_type}:
- for (unsigned c = 0; c < op[0]->type->components(); c++)
- data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)};
- break;
- % endfor
- default:
- assert(0);
- }
- break;""")
-
-# This template is for unary operations that can have operands of a several
-# different types, and each type has a different C expression. ir_unop_neg is
-# an example.
+# This template is for operations that can have operands of a several
+# different types, and each type may or may not has a different C expression.
+# ir_unop_bit_not and ir_unop_neg are examples.
constant_template3 = mako.template.Template("""\
case ${op.get_enum_name()}:
for (unsigned c = 0; c < op[0]->type->components(); c++) {
@@ -435,8 +419,6 @@ class operation(object):
return constant_template5.render(op=self)
elif len(self.source_types) == 1:
return constant_template0.render(op=self)
- elif len(self.c_expression) == 1 and 'default' in self.c_expression:
- return constant_template1.render(op=self)
else:
return constant_template3.render(op=self)
elif self.num_operands == 2: