From: Christian König Date: Mon, 27 Feb 2012 11:53:49 +0000 (+0100) Subject: vl: adjust matrix and median filter to removal of PIPE_SHADER_CAP_OUTPUT_READ X-Git-Tag: 062012170305~1346 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20be2867096b984823e4b18939fc855b377c5c95;p=profile%2Fivi%2Fmesa.git vl: adjust matrix and median filter to removal of PIPE_SHADER_CAP_OUTPUT_READ Signed-off-by: Christian König --- diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 43fb441..b195793 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -82,6 +82,7 @@ create_frag_shader(struct vl_matrix_filter *filter, unsigned num_offsets, struct ureg_src i_vtex; struct ureg_src sampler; struct ureg_dst *t_array = MALLOC(sizeof(struct ureg_dst) * num_offsets); + struct ureg_dst t_sum; struct ureg_dst o_fragment; bool first; int i; @@ -126,16 +127,19 @@ create_frag_shader(struct vl_matrix_filter *filter, unsigned num_offsets, for (i = 0, first = true; i < num_offsets; ++i) { if (matrix_values[i] != 0.0f) { if (first) { - ureg_MUL(shader, o_fragment, ureg_src(t_array[i]), + t_sum = t_array[i]; + ureg_MUL(shader, t_sum, ureg_src(t_array[i]), ureg_imm1f(shader, matrix_values[i])); first = false; } else - ureg_MAD(shader, o_fragment, ureg_src(t_array[i]), - ureg_imm1f(shader, matrix_values[i]), ureg_src(o_fragment)); + ureg_MAD(shader, t_sum, ureg_src(t_array[i]), + ureg_imm1f(shader, matrix_values[i]), ureg_src(t_sum)); } } if (first) ureg_MOV(shader, o_fragment, ureg_imm1f(shader, 0.0f)); + else + ureg_MOV(shader, o_fragment, ureg_src(t_sum)); ureg_END(shader); diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 6a03f95..14f3411 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -82,6 +82,7 @@ create_frag_shader(struct vl_median_filter *filter, struct ureg_src i_vtex; struct ureg_src sampler; struct ureg_dst *t_array = MALLOC(sizeof(struct ureg_dst) * num_offsets); + struct ureg_dst o_fragment; const unsigned median = num_offsets >> 1; int i, j; @@ -107,12 +108,9 @@ create_frag_shader(struct vl_median_filter *filter, i_vtex = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX, TGSI_INTERPOLATE_LINEAR); sampler = ureg_DECL_sampler(shader, 0); - for (i = 0; i < num_offsets; ++i) { - if (i == median) - t_array[i] = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0); - else - t_array[i] = ureg_DECL_temporary(shader); - } + for (i = 0; i < num_offsets; ++i) + t_array[i] = ureg_DECL_temporary(shader); + o_fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0); /* * t_array[0..*] = vtex + offset[0..*] @@ -148,6 +146,7 @@ create_frag_shader(struct vl_median_filter *filter, else ureg_MIN(shader, t_array[j - 1], ureg_src(t_array[j]), ureg_src(t_array[j - 1])); } + ureg_MOV(shader, o_fragment, ureg_src(t_array[median])); ureg_END(shader);