[Mesa-dev] [PATCH 10/22] i965/meta: Unscalarize some calculations

Ian Romanick idr at freedesktop.org
Thu Feb 18 01:58:03 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

After the previous changes, it just looked weird.  Everyone that saw it
would wonder whether there was some magic reason it had to be that way.
At the end of the day, it should produce identical code.

   text	   data	    bss	    dec	    hex	filename
5126424	 209888	  28120	5364432	 51dad0	before-64/lib64/i965_dri.so
5126296	 209888	  28120	5364304	 51da50	after-64/lib64/i965_dri.so

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index ba41cb1..0c1d92e 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -150,14 +150,12 @@ static const char *fs_tmpl =
    "\n"
    "void get_unorm_target_coords()\n"
    "{\n"
-   "   txl_coords.x = int(tex_coords.x * draw_rect.x + dst_off.x);\n"
-   "   txl_coords.y = int(tex_coords.y * draw_rect.y + dst_off.y);\n"
+   "   txl_coords = ivec2(tex_coords * draw_rect + dst_off);\n"
    "}\n"
    "\n"
    "void translate_dst_to_src()\n"
    "{\n"
-   "   txl_coords.x = int(float(txl_coords.x) * src_scale.x + src_off.x);\n"
-   "   txl_coords.y = int(float(txl_coords.y) * src_scale.y + src_off.y);\n"
+   "   txl_coords = ivec2(vec2(txl_coords) * src_scale + src_off);\n"
    "}\n"
    "\n"
    "void translate_y_to_w_tiling()\n"
-- 
2.5.0



More information about the mesa-dev mailing list