summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-07-18 10:49:07 -0700
committerIan Romanick <[email protected]>2016-08-30 16:28:03 -0700
commitabc81f788343e1780c21ec748153e7bb003cd7e0 (patch)
treec96962dcc6e205d59612cf5952dbd09277eaa628 /src
parent53c54a6c733952027b75541b6c7c4efeec319bd8 (diff)
glsl: Eliminate constant_template5
constant_template_common can now handle the case where the result type is different from the input type by using type_signature_iter. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/ir_expression_operation.py23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py
index ac78d1aa7fe..5979136435e 100644
--- a/src/compiler/glsl/ir_expression_operation.py
+++ b/src/compiler/glsl/ir_expression_operation.py
@@ -96,7 +96,7 @@ real_types = (float_type, double_type)
constant_template_common = mako.template.Template("""\
case ${op.get_enum_name()}:
for (unsigned c = 0; c < op[0]->type->components(); c++) {
- switch (this->type->base_type) {
+ switch (op[0]->type->base_type) {
% for dst_type, src_types in op.signatures():
case ${src_types[0].glsl_type}:
data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)};
@@ -117,23 +117,6 @@ constant_template2 = mako.template.Template("""\
data.${op.dest_type.union_field}[c] = ${op.get_c_expression(op.source_types)};
break;""")
-# This template is for operations with an output type that doesn't match the
-# input types.
-constant_template5 = mako.template.Template("""\
- case ${op.get_enum_name()}:
- for (unsigned c = 0; c < components; c++) {
- switch (op[0]->type->base_type) {
- % for dst_type, src_types in op.signatures():
- case ${src_types[0].glsl_type}:
- data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)};
- break;
- % endfor
- default:
- assert(0);
- }
- }
- break;""")
-
# This template is for binary operations that can operate on some combination
# of scalar and vector operands.
constant_template_vector_scalar = mako.template.Template("""\
@@ -398,8 +381,6 @@ class operation(object):
return constant_template_horizontal_single_implementation.render(op=self)
elif self.dest_type is not None and len(self.source_types) == 1:
return constant_template2.render(op=self)
- elif self.dest_type is not None:
- return constant_template5.render(op=self)
elif self.num_operands == 2:
if self.name == "mul":
return constant_template_mul.render(op=self)
@@ -411,8 +392,6 @@ class operation(object):
return constant_template_horizontal_single_implementation.render(op=self)
elif horizontal_operation in self.flags:
return constant_template_horizontal.render(op=self)
- elif self.dest_type is not None:
- return constant_template5.render(op=self)
elif self.num_operands == 3:
if self.name == "vector_insert":
return constant_template_vector_insert.render(op=self)