History log of /external/mesa3d/src/glsl/ir_optimization.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a75f2681d26aecad185895c1c2f13dd542281ff9 11-Jul-2012 Eric Anholt <eric@anholt.net> glsl: Add a lowering pass to turn complicated UBO references to vector loads.

v2: Reduce the impenetrable code in emit_ubo_loads() by 23 lines by keeping
the ir_variable as the variable part of the offset from handle_rvalue(),
and track the constant offsets from that with a plain old integer value,
avoiding a bunch of temporary variables in the array and struct handling.
Also, fix file description doxygen.
v3: Fix a row vs col typo, and fix spelling in a comment.

Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir_optimization.h
e88f9b9546119db83e19b1bdd2bc9db45058cebd 15-May-2012 José Fonseca <jfonseca@vmware.com> glsl: Fix lower_discard_flow prototype mismatch.

Should fix MSVC link failure.
/external/mesa3d/src/glsl/ir_optimization.h
3de1395fa5a563c13774ac1c38722c16cecc521d 04-May-2012 Eric Anholt <eric@anholt.net> glsl: Implement the GLSL 1.30+ discard control flow rule in GLSL IR.

Previously, I tried implementing this in the i965 driver, but did so
in a way that violated the intent of the spec, and broke Tropics.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir_optimization.h
60177d5e2aec07ed6386a6935b118a356d58c4ec 03-Oct-2010 Eric Anholt <eric@anholt.net> glsl: Add an array splitting pass.

I've had this code laying around almost done for a long time. The
idea is like opt_structure_splitting, that we've got a bunch of
transforms at the GLSL IR level that only understand scalars and
vectors, which just skip complicated dereferences. While driver
backends may manage some optimization after they split matrices up
themselves, it would be better to bring all of our optimization to
bear on the problem.

While I wasn't expecting changes quite yet, a few programs end up
winning: a gstreamer convolution shader, and the Humus dynamic
branching demo:
Total instructions: 269430 -> 269342
3/2148 programs affected (0.1%)
1498 -> 1410 instructions in affected programs (5.9% reduction)
/external/mesa3d/src/glsl/ir_optimization.h
6d4b35c03619148cde89bc5eedaac3288001edd3 03-Jan-2012 Vincent Lejeune <vljn@ovi.com> glsl: Add a lowering pass to remove reads of shader output variables.

This is similar to Gallium's existing glsl_to_tgsi::remove_output_read
lowering pass, but done entirely inside the GLSL compiler.

Signed-off-by: Vincent Lejeune <vljn@ovi.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glsl/ir_optimization.h
1d5d67f8adac9f94715de9804adb536d9a7ec5ee 21-Oct-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Add uniform_locations_assigned parameter to do_dead_code opt pass

Setting this flag prevents declarations of uniforms from being removed
from the IR. Since the IR is directly used by several API functions
that query uniforms in shaders, uniform declarations cannot be removed
after the locations have been set. However, it should still be safe
to reorder the declarations (this is not tested).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
Cc: Vinson Lee <vlee@vmware.com>
Cc: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
/external/mesa3d/src/glsl/ir_optimization.h
c06e32596735074536b0e613cbddb1c5fd7b367a 12-Aug-2011 Paul Berry <stereotype441@gmail.com> glsl: Implement a lowering pass for gl_ClipDistance.

In i965 GEN6+ (and I suspect most other hardware), gl_ClipDistance
needs to be laid out as a pair of vec4's (the first containing clip
distances 0-3, and the second containing clip distances 4-7).
However, it is declared in GLSL as an array of 8 floats.

This lowering pass acts at the GLSL level, modifying the declaration
of gl_ClipDistance so that it is an array of vec4's rather than an
array of floats, and renaming it to gl_ClipDistanceMESA. In addition,
it modifies all accesses to the array so that they access the
appropiate component of one of the vec4's.

Since some hardware may not internally represent gl_ClipDistance as a
pair of vec4's, this lowering pass is optional. To enable it, set the
LowerClipDistance flag in gl_shader_compiler_options to true.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir_optimization.h
478034f34a59969103237eb78bc82f9e70fe81c2 28-Aug-2011 Bryan Cain <bryancain3@gmail.com> glsl: Use a separate div_to_mul_rcp lowering flag for integers.

Using multiply and reciprocal for integer division involves potentially
lossy floating point conversions. This is okay for older GPUs that
represent integers as floating point, but undesirable for GPUs with
native integer division instructions.

TGSI, for example, has UDIV/IDIV instructions for integer division,
so it makes sense to handle this directly. Likewise for i965.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Bryan Cain <bryancain3@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir_optimization.h
90cc372400e1f5869baabd841823bbf9296d7b01 19-Jul-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Factor out code that generates block of index comparisons

Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir_optimization.h
5fb79fc69f56cf2d8d44e4c6c2d8b862bc631139 05-Jul-2011 Paul Berry <stereotype441@gmail.com> glsl: Remove unused function prototypes.

No functional change. Remove prototypes for do_mod_to_fract() and
do_sub_to_add_neg(), which haven't existed since November 2010.
/external/mesa3d/src/glsl/ir_optimization.h
e31266ed3e3667c043bc5ad1abd65cfdb0fa7fdb 25-Jan-2011 Eric Anholt <eric@anholt.net> glsl: Add a new opt_copy_propagation variant that does it channel-wise.

This patch cleans up many of the extra copies in GLSL IR introduced by
i965's scalarizing passes. It doesn't result in a statistically
significant performance difference on nexuiz high settings (n=3) or my
demo (n=10), due to brw_fs.cpp's register coalescing covering most of
those extra moves anyway. However, it does make the debug of wine's
GLSL shaders much more tractable, and reduces instruction count of
glsl-fs-convolution-2 from 376 to 288.
/external/mesa3d/src/glsl/ir_optimization.h
9ac6a9b2fa45debac63f2e2b20d78c4776d06e37 27-Dec-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Support if-flattening beyond a given maximum nesting depth.

This adds a new optional max_depth parameter (defaulting to 0) to
lower_if_to_cond_assign, and makes the pass only flatten if-statements
nested deeper than that.

By default, all if-statements will be flattened, just like before.

This patch also renames do_if_to_cond_assign to lower_if_to_cond_assign,
to match the new naming conventions.
/external/mesa3d/src/glsl/ir_optimization.h
c4285be9a5bd1adaa89050989374b95a9a601cdc 25-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2
/external/mesa3d/src/glsl/ir_optimization.h
940df10100d740ef27fa39026fd51c3199ed3d62 25-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add a lowering pass to move discards out of if-statements.

This should allow lower_if_to_cond_assign to work in the presence of
discards, fixing bug #31690 and likely #31983.

NOTE: This is a candidate for the 7.9 branch.
/external/mesa3d/src/glsl/ir_optimization.h
9a1d063c6d679c2155f5eb80f1cb94368d36bf2c 25-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add an optimization pass to simplify discards.

NOTE: This is a candidate for the 7.9 branch.
/external/mesa3d/src/glsl/ir_optimization.h
63684a9ae7a66f68df1f2c68cd9358e5622122a3 19-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Combine many instruction lowering passes into one.

This should save on the overhead of tree-walking and provide a
convenient place to add more instruction lowering in the future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ir_optimization.h
11d6f1c69871d0b7edc28f639256460839fccd2d 16-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add ir_quadop_vector expression

The vector operator collects 2, 3, or 4 scalar components into a
vector. Doing this has several advantages. First, it will make
ud-chain tracking for components of vectors much easier. Second, a
later optimization pass could collect scalars into vectors to allow
generation of SWZ instructions (or similar as operands to other
instructions on R200 and i915). It also enables an easy way to
generate IR for SWZ instructions in the ARB_vertex_program assembler.
/external/mesa3d/src/glsl/ir_optimization.h
aae338104fa6022b8b1d6b22c7ad1115b252b9b6 01-Oct-2010 Eric Anholt <eric@anholt.net> glsl: Add a lowering pass for texture projection.
/external/mesa3d/src/glsl/ir_optimization.h
a6ecd1c3724a78b76ab9e81ea39632f1279021f8 16-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add flags to enable variable index lowering
/external/mesa3d/src/glsl/ir_optimization.h
a47539c7a155475de00fa812842721d239abb3f4 08-Sep-2010 Luca Barbieri <luca@luca-barbieri.com> glsl: add pass to lower variable array indexing to conditional assignments

Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

Several patches in the glsl2-lower-variable-indexing were squashed
into this commit. These patches fix bugs in Luca's original
implementation, and the individual patches can be seen in that branch.
This was done to aid bisecting in the future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ir_optimization.h
8f2214f4892acb994d13531d555196bd8f242dad 13-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add pass to remove redundant jumps
/external/mesa3d/src/glsl/ir_optimization.h
3361cbac2a883818efeb2b3e27405eeefce60f63 07-Sep-2010 Luca Barbieri <luca@luca-barbieri.com> glsl: add continue/break/return unification/elimination pass (v2)

Changes in v2:
- Base class renamed to ir_control_flow_visitor
- Tried to comply with coding style

This is a new pass that supersedes ir_if_return and "lowers" jumps
to if/else structures.

Currently it causes no regressions on softpipe and nv40, but I'm not sure
whether the piglit glsl tests are thorough enough, so consider this
experimental.

It can be asked to:
1. Pull jumps out of ifs where possible
2. Remove all "continue"s, replacing them with an "execute flag"
3. Replace all "break" with a single conditional one at the end of the loop
4. Replace all "return"s with a single return at the end of the function,
for the main function and/or other functions

This gives several great benefits:
1. All functions can be inlined after this pass
2. nv40 and other pre-DX10 chips without "continue" can be supported
3. nv30 and other pre-DX10 chips with no control flow at all are better supported

Note that for full effect we should also teach the unroller to unroll
loops with a fixed maximum number of iterations but with the canonical
conditional "break" that this pass will insert if asked to.

Continues are lowered by adding a per-loop "execute flag", initialized to
TRUE, that when cleared inhibits all execution until the end of the loop.

Breaks are lowered to continues, plus setting a "break flag" that is checked
at the end of the loop, and trigger the unique "break".

Returns are lowered to breaks/continues, plus adding a "return flag" that
causes loops to break again out of their enclosing loops until all the
loops are exited: then the "execute flag" logic will ignore everything
until the end of the function.

Note that "continue" and "return" can also be implemented by adding
a dummy loop and using break.
However, this is bad for hardware with limited nesting depth, and
prevents further optimization, and thus is not currently performed.
/external/mesa3d/src/glsl/ir_optimization.h
547131ac8750acabd030972fc768705c13d19ef7 10-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add lowering pass to remove noise opcodes
/external/mesa3d/src/glsl/ir_optimization.h
e591c4625cae63660c5000fbab366e40fe154ab0 05-Sep-2010 Luca Barbieri <luca@luca-barbieri.com> glsl: add several EmitNo* options, and MaxUnrollIterations

This increases the chance that GLSL programs will actually work.

Note that continues and returns are not yet lowered, so linking
will just fail if not supported.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ir_optimization.h
8f8cdbfba43550d0b8985fb087961864e4cd92b6 13-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to strip out noop swizzles.

With the glsl2-965 branch, the optimization of glsl-algebraic-rcp-rcp
regressed due to noop swizzles hiding information from ir_algebraic.
This cleans up those noop swizzles for us.
/external/mesa3d/src/glsl/ir_optimization.h
2f4fe151681a6f6afe1d452eece6cf4144f44e49 10-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Move the common optimization passes to a helper function.

These are passes that we expect all codegen to be happy with. The
other lowering passes for Mesa IR are moved to the Mesa IR generator.
/external/mesa3d/src/glsl/ir_optimization.h
5854d4583c6e8885185e12a0636f77489a62e24c 10-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))

All the current HW backends transform subtract to adding the negation,
so I haven't bothered peepholing it back out in Mesa IR. This allows
some subtract of subtract to get removed in ir_algebraic.
/external/mesa3d/src/glsl/ir_optimization.h
8bebbeb7c5b26ec9166a4644a2c051238d18509b 10-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Add constant propagation.

Whereas constant folding evaluates constant expressions at rvalue
nodes, constant propagation tracks constant components of vectors
across execution to replace (possibly swizzled) variable dereferences
with constant values, triggering possible constant folding or reduced
variable liveness.
/external/mesa3d/src/glsl/ir_optimization.h
bc4034b243975089c06c4415d4e26edaaaec7a46 06-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to convert exp and log to exp2 and log2.

Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG
opcode that doesn't do what we want. This also lets the multiplication
coefficients in there get constant-folded, possibly.

Fixes:
glsl-fs-log
/external/mesa3d/src/glsl/ir_optimization.h
7f7eaf0285d011f7cc7e1a63133184a50b24ecaa 05-Aug-2010 Eric Anholt <eric@anholt.net> ir_structure_splitting: New pass to chop structures into their components.

This doesn't do anything if your structure goes through an uninlined
function call or if whole-structure assignment occurs. As such, the
impact is limited, at least until we do some global copy propagation
to reduce whole-structure assignment.
/external/mesa3d/src/glsl/ir_optimization.h
2e853ca23c8670246dd4efcee0706f68097652f7 05-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass for removing unused functions.

For a shader involving many small functions, this avoids running
optimization across all of them after they've been inlined
post-linking.

Reduces the runtime of linking and running a fragment shader from Yo
Frankie from 1.6 seconds to 0.9 seconds (-44.9%, +/- 3.3%).
/external/mesa3d/src/glsl/ir_optimization.h
784695442c415cf0be882434a25671ecfb635d34 31-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add new tree grafting optimization pass.
/external/mesa3d/src/glsl/ir_optimization.h
66d4c65ee2c311ea0c71c39a28456d0c11798d6b 27-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Make the dead code handler make its own talloc context.

This way, we don't need to pass in a parse state, and the context
doesn't grow with the number of passes through optimization.
/external/mesa3d/src/glsl/ir_optimization.h
832aad989e3d319a8aaac046aa49df25da134d82 27-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add optimization pass for algebraic simplifications.

This cleans up the assembly output of almost all the non-logic tests
glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically,
flattening to a temporary and squaring it).
/external/mesa3d/src/glsl/ir_optimization.h
29ce44ad2b8d37ea54923f1d1856b44ef26903e5 19-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass for converting if statements to conditional assignment.

This will be used on 915 and similar hardware of that generation.
/external/mesa3d/src/glsl/ir_optimization.h
6d8a0a0aadaafbab02dffcf7f89eb0210dd37b2e 12-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add a new pass at the IR level to break down matrix ops to vector ops.

This will be used by the Mesa IR and likely most HW backends, as it
allows other optimizations to occur that might not otherwise.

Fixes glsl-vs-mat-sub-1, glsl-vs-mat-div-1.
/external/mesa3d/src/glsl/ir_optimization.h
d674ebcee0d2731e50d6530502cefcebc39dcdb6 07-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to simplify if statements returning from both sides.

This allows function inlining making the following tests work even
without function calls implemented:
glsl-fs-functions-2
glsl-fs-functions-3
glsl-vs-functions
glsl-vs-functions-2
glsl-vs-functions-3
glsl-vs-vec4-indexing-5

(Note that those tests were designed to trigger actual function calls,
and this defeats them. However, those testcases ended up catching the
bug in the previous commit.)
/external/mesa3d/src/glsl/ir_optimization.h
a36334be02cb0a2b834667116bfeb680bf365857 07-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add pass for supporting variable vector indexing in rvalues.

The Mesa IR needs this to support vector indexing correctly, and
hardware backends such as 915 would want this behavior as well.

Fixes glsl-vs-vec4-indexing-2.
/external/mesa3d/src/glsl/ir_optimization.h
9a0e421983edc31371440c08687fa2bb2207924d 02-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to break ir_binop_div to _mul and _rcp.

This results in constant folding of a constant divisor.
/external/mesa3d/src/glsl/ir_optimization.h
8a1f186cc55979bb9df0a88b48da8d81460c3e7c 01-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add a pass to convert mod(a, b) to b * fract(a/b).

This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod.
/external/mesa3d/src/glsl/ir_optimization.h
bda27424cf04c0d2ec2b49c56f562d5b2d2f0bff 25-Jun-2010 Eric Anholt <eric@anholt.net> glsl2: Use the parser state as the talloc context for dead code elimination.

This cuts runtime by around 20% from talloc_parent() lookups.
/external/mesa3d/src/glsl/ir_optimization.h
29285882676388aacff123e8bdf025904abf8ea9 25-Jun-2010 Eric Anholt <eric@anholt.net> glsl2: Move the compiler to the subdirectory it will live in in Mesa.
/external/mesa3d/src/glsl/ir_optimization.h