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;
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);
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;
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..*]
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);