vl: adjust matrix and median filter to removal of PIPE_SHADER_CAP_OUTPUT_READ
authorChristian König <deathsimple@vodafone.de>
Mon, 27 Feb 2012 11:53:49 +0000 (12:53 +0100)
committerChristian König <deathsimple@vodafone.de>
Mon, 27 Feb 2012 11:53:49 +0000 (12:53 +0100)
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/auxiliary/vl/vl_matrix_filter.c
src/gallium/auxiliary/vl/vl_median_filter.c

index 43fb441f7b955498e212e88cdc1501687d9a5b69..b195793b5506982ac21adaad67cf42107b41d7e1 100644 (file)
@@ -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);
 
index 6a03f95855b6b5f44c44fb4de20f1fd80bdef4fa..14f3411c1b2e66dd69464774b11af2b3804f8ce9 100644 (file)
@@ -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);