aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl/vl_zscan.c
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2011-07-13 21:57:50 -0700
committerVinson Lee <[email protected]>2011-07-13 21:57:50 -0700
commit3cf22a0c6e215535266e7a7fac5ddd2404d4345d (patch)
treeb9387e898e8a0c78ad58aea1c44e9b79c296a707 /src/gallium/auxiliary/vl/vl_zscan.c
parent02c8ee202f5a159659a027deae4721ff05cd1530 (diff)
g3dvl: Remove non-constant expression array initializers.
The array initializer must be a constant expression in MSVC.
Diffstat (limited to 'src/gallium/auxiliary/vl/vl_zscan.c')
-rw-r--r--src/gallium/auxiliary/vl/vl_zscan.c18
1 files changed, 15 insertions, 3 deletions
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);
}