Re: [Mesa-dev] [PATCH] glsl: Rewrite and fix min/max to saturate optimization.

2015-02-25 Thread Abdiel Janulgue
On 02/24/2015 09:22 PM, Matt Turner wrote: There were some bugs, and the code was really difficult to follow. We would optimize min(max(x, b), 1.0) into max(sat(x), b) but not pay attention to the order of min/max and also do max(min(x, b), 1.0) into max(sat(x), b) Corrects four sha

Re: [Mesa-dev] [PATCH] glsl: Rewrite and fix min/max to saturate optimization.

2015-02-24 Thread Matt Turner
On Tue, Feb 24, 2015 at 11:47 AM, Ian Romanick wrote: > On 02/24/2015 11:22 AM, Matt Turner wrote: >> There were some bugs, and the code was really difficult to follow. We >> would optimize >> >>min(max(x, b), 1.0) into max(sat(x), b) >> >> but not pay attention to the order of min/max and als

Re: [Mesa-dev] [PATCH] glsl: Rewrite and fix min/max to saturate optimization.

2015-02-24 Thread Matt Turner
On Tue, Feb 24, 2015 at 11:22 AM, Matt Turner wrote: > There were some bugs, and the code was really difficult to follow. We > would optimize > >min(max(x, b), 1.0) into max(sat(x), b) > > but not pay attention to the order of min/max and also do > >max(min(x, b), 1.0) into max(sat(x), b)

[Mesa-dev] [PATCH] glsl: Rewrite and fix min/max to saturate optimization.

2015-02-24 Thread Matt Turner
There were some bugs, and the code was really difficult to follow. We would optimize min(max(x, b), 1.0) into max(sat(x), b) but not pay attention to the order of min/max and also do max(min(x, b), 1.0) into max(sat(x), b) Corrects four shaders from Champions of Regnum that do min(max