From: Gert Wollny Date: Wed, 12 Jun 2019 14:04:33 +0000 (+0200) Subject: vl: replace DIV-ADD with MAD using inverse size X-Git-Tag: upstream/19.3.0~4956 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=187c308b96d0501552ec0287ec117273b51228f0;p=platform%2Fupstream%2Fmesa.git vl: replace DIV-ADD with MAD using inverse size Optimize the shader a bit by emitting MAD with the inverse size values instead of DIV+ADD. Signed-off-by: Gert Wollny Reviewed-by: Marek Olšák --- diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index f3f8cbe..077e213 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -201,10 +201,11 @@ create_frag_shader(struct vl_bicubic_filter *filter, unsigned video_width, ureg_FLR(shader, ureg_writemask(t_array[22], TGSI_WRITEMASK_XY), ureg_src(t_array[22])); - ureg_DIV(shader, ureg_writemask(t_array[22], TGSI_WRITEMASK_XY), - ureg_src(t_array[22]), ureg_imm2f(shader, video_width, video_height)); - ureg_ADD(shader, ureg_writemask(t_array[22], TGSI_WRITEMASK_XY), - ureg_src(t_array[22]), half_pixel); + + ureg_MAD(shader, ureg_writemask(t_array[22], TGSI_WRITEMASK_XY), + ureg_src(t_array[22]), + ureg_imm2f(shader, 1.0f / video_width, 1.0f / video_height), + half_pixel); /* * t_array[0..*] = vtex + offset[0..*]