[Mesa-dev] [PATCH] r300/compiler: Avoid generating MOV instructions for invalid IMM swizzles v2

son_of_the_osiris at interia.pl son_of_the_osiris at interia.pl
Fri Nov 2 05:06:37 PDT 2012


>If an instruction reads from a constant register that contains
>immediates using an invalid swizzle, we can avoid generating MOV
>instructions to fix up the swizzle by loading the immediates into a
>different constant register that can be read using a valid swizzle.
>
>This only affects r300 and r400 cards.
>
>For example:
>
>CONST[1] = {    -3.5000     3.5000     2.5000     1.5000 }
>
>MAD temp[4].xy, const[0].xy__, const[1].xz__, input[0].xy__;
>
>========== Before this change would be lowered to: =========
>
>CONST[1] = {    -3.5000     3.5000     2.5000     1.5000 }
>
>MOV temp[0].x, const[1].x___;
>MOV temp[0].y, const[1]._z__;
>MAD temp[4].xy, const[0].xy__, temp[0].xy__, input[0].xy__;
>
>========== After this change is lowered to:  ===============
>
>CONST[1] = {    -3.5000     3.5000     2.5000     1.5000 }
>CONST[2] = {     0.0000    -3.5000     2.5000     0.0000 }
>
>MAD temp[4].xy, const[0].xy__, const[2].yz__, input[0].xy__;
>
>============================================================
>
>This change reduces one of the Lightsmark shaders from 133 to 91
>instructions.
>
>v2:
>  - Fix crash caused by swizzles with only inline constants.
>---
>
> This patch should fix the crash.  Does it work for you?
>
> .../r300/compiler/radeon_dataflow_swizzles.c       |  353 +++++++++++++++++++-
> 1 files changed, 349 insertions(+), 4 deletions(-)

Yes the crash is fixed.



More information about the mesa-dev mailing list