summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_minmax.cpp
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2015-02-05 11:58:05 +0200
committerIlia Mirkin <[email protected]>2015-02-19 00:28:34 -0500
commit8609b5371641b303fac0a928376b344dbd7096fa (patch)
tree381ccac818de3d7b7a5a3e71c8de6a42ea56784b /src/glsl/opt_minmax.cpp
parent41e9adfd83a35d3c147768b80b6b4c0b10c3a379 (diff)
glsl: Add support doubles in optimization passes
Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/opt_minmax.cpp')
-rw-r--r--src/glsl/opt_minmax.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp
index 32fb2d7ea2a..23d0b109d8b 100644
--- a/src/glsl/opt_minmax.cpp
+++ b/src/glsl/opt_minmax.cpp
@@ -133,6 +133,14 @@ compare_components(ir_constant *a, ir_constant *b)
else
foundequal = true;
break;
+ case GLSL_TYPE_DOUBLE:
+ if (a->value.d[c0] < b->value.d[c1])
+ foundless = true;
+ else if (a->value.d[c0] > b->value.d[c1])
+ foundgreater = true;
+ else
+ foundequal = true;
+ break;
default:
unreachable("not reached");
}
@@ -178,6 +186,11 @@ combine_constant(bool ismin, ir_constant *a, ir_constant *b)
(!ismin && b->value.f[i] > c->value.f[i]))
c->value.f[i] = b->value.f[i];
break;
+ case GLSL_TYPE_DOUBLE:
+ if ((ismin && b->value.d[i] < c->value.d[i]) ||
+ (!ismin && b->value.d[i] > c->value.d[i]))
+ c->value.d[i] = b->value.d[i];
+ break;
default:
assert(!"not reached");
}