[Mesa-dev] Add support for GLSL IR saturate()
mattst88 at gmail.com
Tue Jun 24 12:10:34 PDT 2014
On Mon, Jun 23, 2014 at 10:27 PM, Abdiel Janulgue
<abdiel.janulgue at linux.intel.com> wrote:
> This patch series add the plumbing to support the GLSL IR instruction saturate().
> Previously, saturate is implemented as min/max instructions. Most GPUs, however,
> can probably perform saturate for free. With these changes, we can allow saturate
> to be optimized as a single instruction.
> In addition, the optimization try_emit_saturate was previously used to optimize
> min/max operations to a saturate operation. It didn't work for code such as
> min(max(a, b), c) where (b == 0.0 and c < 1.0) and related cases.
> With this infrastructure in place, we can optimize those operations easily in the
> do_algebraic pass. This is done in the next patch set.
> Abdiel Janulgue (11):
> glsl: Add ir_unop_saturate
> glsl: Add constant evaluation of ir_unop_saturate
> glsl: Add a pass to lower ir_unop_saturate to clamp(x, 0, 1)
With the fixes mentioned in their respective threads, these are
Reviewed-by: Matt Turner <mattst88 at gmail.com>
> ir_to_mesa, glsl_to_tgsi: lower ir_unop_saturate
> ir_to_mesa, glsl_to_tgsi: Add support for ir_unop_saturate
> ir_to_mesa, glsl_to_tgsi: Remove try_emit_saturate
> i965/fs: Add support for ir_unop_saturate
> i965/vec4: Add support for ir_unop_saturate
> i965/fs: Remove try_emit_saturate
> i965/vec4: Remove try_emit_saturate
> glsl: Implement saturate as ir_binop_saturate
As well as these.
I'll review the ir_to_mesa and glsl_to_tgsi patches now. I'd like it
it someone more familiar with that code (and whose driver uses it)
would also review them.
More information about the mesa-dev