Re: [Mesa-dev] [PATCH 6/9] glsl: implement mid3 built-in function

2013-12-11 Thread Roland Scheidegger
Wouldn't something like max(min(x, max(y,z)), min(y, z)) work as well, saving one instruction? Roland Am 11.12.2013 08:52, schrieb Mario Rugiero: > Why not computing the max3(min(x,y),min(x,z),min(y,z))? > > For the six possible cases: > x < y < z --> max(x, x, y) -> y ==> works > x < z < y -->

Re: [Mesa-dev] [PATCH 6/9] glsl: implement mid3 built-in function

2013-12-10 Thread Mario Rugiero
Why not computing the max3(min(x,y),min(x,z),min(y,z))? For the six possible cases: x < y < z --> max(x, x, y) -> y ==> works x < z < y --> max(x, z, z) -> z ==> works y < x < z --> max(y, x, y) -> x ==> works y < z < x --> max(y, z, y) -> z ==> works z < x < y --> max(x, z, z) -> x ==> works z <

Re: [Mesa-dev] [PATCH 6/9] glsl: implement mid3 built-in function

2013-12-10 Thread Kenneth Graunke
On 12/10/2013 02:43 PM, =?UTF-8?q?Maxence=20Le=20Dor=C3=A9?= wrote: > --- > src/glsl/builtin_functions.cpp | 44 > ++ > 1 file changed, 44 insertions(+) > > diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp > index 1f21a37..b9be

[Mesa-dev] [PATCH 6/9] glsl: implement mid3 built-in function

2013-12-10 Thread =?UTF-8?q?Maxence=20Le=20Dor=C3=A9?=
--- src/glsl/builtin_functions.cpp | 44 ++ 1 file changed, 44 insertions(+) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 1f21a37..b9beffd 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp