[Piglit] [PATCH] textureGather: Avoid variable length arrays.

jfonseca at vmware.com jfonseca at vmware.com
Mon Apr 28 07:12:36 PDT 2014


From: José Fonseca <jfonseca at vmware.com>

Not supported by MSVC.
---
 tests/texturing/shaders/textureGather.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/texturing/shaders/textureGather.c b/tests/texturing/shaders/textureGather.c
index cb7fef0..bd48790 100644
--- a/tests/texturing/shaders/textureGather.c
+++ b/tests/texturing/shaders/textureGather.c
@@ -201,7 +201,9 @@ static void
 upload_verts(void)
 {
 	if (stage == VS) {
-		float v[4 * texture_width * texture_height], *pv = v;
+		size_t size = 4 * texture_width * texture_height * sizeof(float);
+		float *v = (float *)malloc(size);
+		float *pv = v;
 		int i, j;
 		for (j = 0; j < texture_height; j++)
 			for (i = 0; i < texture_width; i++) {
@@ -210,7 +212,8 @@ upload_verts(void)
 				*pv++ = 0;
 				*pv++ = 1;
 			}
-		glBufferData(GL_ARRAY_BUFFER, sizeof(v), v, GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, size, v, GL_STATIC_DRAW);
+		free(v);
 	}
 	else {
 		static const float verts[] = {
-- 
1.9.1



More information about the Piglit mailing list