diff options
-rw-r--r-- | src/gallium/auxiliary/vl/vl_idct.c | 20 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_zscan.c | 18 |
2 files changed, 31 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 75e76c09f63..645d06a0925 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -32,6 +32,7 @@ #include <util/u_draw.h> #include <util/u_sampler.h> +#include <util/u_memory.h> #include <tgsi/tgsi_ureg.h> @@ -219,7 +220,9 @@ create_mismatch_frag_shader(struct vl_idct *idct) } for (i = 0; i < 8; ++i) { - struct ureg_src s_addr[2] = { ureg_src(m[i][0]), ureg_src(m[i][1]) }; + struct ureg_src s_addr[2]; + s_addr[0] = ureg_src(m[i][0]); + s_addr[1] = ureg_src(m[i][1]); fetch_four(shader, m[i], s_addr, ureg_DECL_sampler(shader, 0), false); } @@ -323,7 +326,7 @@ create_stage1_frag_shader(struct vl_idct *idct) struct ureg_src l_addr[2], r_addr[2]; struct ureg_dst l[4][2], r[2]; - struct ureg_dst fragment[idct->nr_of_render_targets]; + struct ureg_dst *fragment; int i, j; @@ -331,6 +334,8 @@ create_stage1_frag_shader(struct vl_idct *idct) if (!shader) return NULL; + fragment = MALLOC(idct->nr_of_render_targets * sizeof(struct ureg_dst)); + l_addr[0] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_L_ADDR0, TGSI_INTERPOLATE_LINEAR); l_addr[1] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_L_ADDR1, TGSI_INTERPOLATE_LINEAR); @@ -353,14 +358,19 @@ create_stage1_frag_shader(struct vl_idct *idct) } for (i = 0; i < 4; ++i) { - struct ureg_src s_addr[2] = { ureg_src(l[i][0]), ureg_src(l[i][1]) }; + struct ureg_src s_addr[2]; + s_addr[0] = ureg_src(l[i][0]); + s_addr[1] = ureg_src(l[i][1]); fetch_four(shader, l[i], s_addr, ureg_DECL_sampler(shader, 0), false); } for (i = 0; i < idct->nr_of_render_targets; ++i) { + struct ureg_src s_addr[2]; + increment_addr(shader, r, r_addr, true, true, i - (signed)idct->nr_of_render_targets / 2, BLOCK_HEIGHT); - struct ureg_src s_addr[2] = { ureg_src(r[0]), ureg_src(r[1]) }; + s_addr[0] = ureg_src(r[0]); + s_addr[1] = ureg_src(r[1]); fetch_four(shader, r, s_addr, ureg_DECL_sampler(shader, 1), false); for (j = 0; j < 4; ++j) { @@ -377,6 +387,8 @@ create_stage1_frag_shader(struct vl_idct *idct) ureg_END(shader); + FREE(fragment); + return ureg_create_shader_and_destroy(shader, idct->pipe); } diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index a26d8398f92..fde27f396c5 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -33,6 +33,7 @@ #include <util/u_draw.h> #include <util/u_sampler.h> #include <util/u_inlines.h> +#include <util/u_memory.h> #include <tgsi/tgsi_ureg.h> @@ -96,7 +97,8 @@ create_vert_shader(struct vl_zscan *zscan) struct ureg_src vrect, vpos, block_num; struct ureg_dst tmp; - struct ureg_dst o_vpos, o_vtex[zscan->num_channels]; + struct ureg_dst o_vpos; + struct ureg_dst *o_vtex; signed i; @@ -104,6 +106,8 @@ create_vert_shader(struct vl_zscan *zscan) if (!shader) return NULL; + o_vtex = MALLOC(zscan->num_channels * sizeof(struct ureg_dst)); + scale = ureg_imm2f(shader, (float)BLOCK_WIDTH / zscan->buffer_width, (float)BLOCK_HEIGHT / zscan->buffer_height); @@ -156,6 +160,8 @@ create_vert_shader(struct vl_zscan *zscan) ureg_release_temporary(shader, tmp); ureg_END(shader); + FREE(o_vtex); + return ureg_create_shader_and_destroy(shader, zscan->pipe); } @@ -163,11 +169,11 @@ static void * create_frag_shader(struct vl_zscan *zscan) { struct ureg_program *shader; - struct ureg_src vtex[zscan->num_channels]; + struct ureg_src *vtex; struct ureg_src samp_src, samp_scan, samp_quant; - struct ureg_dst tmp[zscan->num_channels]; + struct ureg_dst *tmp; struct ureg_dst quant, fragment; unsigned i; @@ -176,6 +182,9 @@ create_frag_shader(struct vl_zscan *zscan) if (!shader) return NULL; + vtex = MALLOC(zscan->num_channels * sizeof(struct ureg_src)); + tmp = MALLOC(zscan->num_channels * sizeof(struct ureg_dst)); + for (i = 0; i < zscan->num_channels; ++i) vtex[i] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX + i, TGSI_INTERPOLATE_LINEAR); @@ -212,6 +221,9 @@ create_frag_shader(struct vl_zscan *zscan) ureg_release_temporary(shader, tmp[i]); ureg_END(shader); + FREE(vtex); + FREE(tmp); + return ureg_create_shader_and_destroy(shader, zscan->pipe); } |