glsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitor
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 8 May 2013 17:48:55 +0000 (10:48 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 13 May 2013 19:05:19 +0000 (12:05 -0700)
commit065da16508731f6b6a98865f392509be4f9ce07f
treeada5c58c50ffa545874dc63a7b6c27c679c5d5b8
parent3acb21517b3a23cf1044531e96d9741bd1c122c3
glsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitor

Right now the lower_clip_distance_visitor lowers variable indexing into
gl_ClipDistance into variable indexing into both the array
gl_ClipDistanceMESA and the vectors of that array.  For example,

    gl_ClipDistance[i] = f;

becomes

    gl_ClipDistanceMESA[i >> 2][i & 3] = f;

However, variable indexing into vectors using ir_dereference_array is
being removed.  Instead, ir_expression with ir_triop_vector_insert will
be used.  The above code will become

    gl_ClipDistanceMESA[i >> 2] =
        vector_insert(gl_ClipDistanceMESA[i >> 2], i & 3, f);

In order to do this, an ir_rvalue_visitor will need to be used.  This
commit is really just a refactor to get ready for that.

v4: Split the least amount of refactor from the rest of the code
changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/lower_clip_distance.cpp