From 20be2867096b984823e4b18939fc855b377c5c95 Mon Sep 17 00:00:00 2001 From: Christian König Date: Mon, 27 Feb 2012 12:53:49 +0100 Subject: vl: adjust matrix and median filter to removal of PIPE_SHADER_CAP_OUTPUT_READ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- src/gallium/auxiliary/vl/vl_matrix_filter.c | 10 +++++++--- src/gallium/auxiliary/vl/vl_median_filter.c | 11 +++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 43fb441f7b9..b195793b550 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 6a03f95855b..14f3411c1b2 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); -- cgit v1.2.3