Commit graph

6 commits

Author SHA1 Message Date
Eric Anholt
c00bc13564 glsl: Fix the lowering of variable array indexing to not lose write_masks.
Fixes glsl-complex-subscript on 965.
2011-01-11 14:50:19 -08:00
Eric Anholt
668cdbe129 glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.
It's trying to get an int smeared across all channels, not trying to
get a 1:1 mapping of a subset of a vector's channels.  This usually
ended up not mattering with ir_to_mesa, since it just smears floats
into every chan of a vec4.

Fixes:
glsl1-temp array with swizzled variable indexing
2010-09-27 15:52:56 -07:00
Vinson Lee
a822ae3f1a glsl: Fix 'control reaches end of non-void function' warning.
Fixes this GCC warning.

lower_variable_index_to_cond_assign.cpp:
In member function
'bool variable_index_to_cond_assign_visitor::needs_lowering(ir_dereference_array*) const':

lower_variable_index_to_cond_assign.cpp:261:
warning: control reaches end of non-void function
2010-09-18 00:14:20 -07:00
Ian Romanick
a6ecd1c372 glsl2: Add flags to enable variable index lowering 2010-09-17 11:00:24 +02:00
Ian Romanick
6e4fe39da2 glsl2: Refactor testing for whether a deref is of a matrix or array 2010-09-17 11:00:24 +02:00
Luca Barbieri
a47539c7a1 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>
2010-09-17 10:58:58 +02:00