[Piglit] [PATCH] GLSL-1.50 execution: Move declarations before code.

Vinson Lee vlee at freedesktop.org
Mon Jul 29 21:53:21 PDT 2013


Fixes MSVC build.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/spec/glsl-1.50/execution/vs-input-arrays.c | 27 ++++++++++++++----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/tests/spec/glsl-1.50/execution/vs-input-arrays.c b/tests/spec/glsl-1.50/execution/vs-input-arrays.c
index 624ba6e..1472d32 100644
--- a/tests/spec/glsl-1.50/execution/vs-input-arrays.c
+++ b/tests/spec/glsl-1.50/execution/vs-input-arrays.c
@@ -151,6 +151,14 @@ typedef struct vertex_inputs vertex_inputs;
 void
 piglit_init(int argc, char **argv)
 {
+	/* stride */
+	size_t stride = sizeof( vertex_data[0] );
+
+	GLint vertex_index;
+	GLint a_index;
+	GLint b_index;
+	GLint c_index;
+
 	prog = piglit_build_simple_program(vs_text, fs_text);
 
 	glLinkProgram( prog );
@@ -160,14 +168,11 @@ piglit_init(int argc, char **argv)
 	glGenVertexArrays( 1, &vao );
 	glBindVertexArray( vao );
 
-	/* stride */
-	size_t stride = sizeof( vertex_data[0] );
-
 	/* get locations */
-	GLint vertex_index = glGetAttribLocation( prog, "vertex" );
-	GLint a_index = glGetAttribLocation( prog, "a" );
-	GLint b_index = glGetAttribLocation( prog, "b" );
-	GLint c_index = glGetAttribLocation( prog, "c" );
+	vertex_index = glGetAttribLocation( prog, "vertex" );
+	a_index = glGetAttribLocation( prog, "a" );
+	b_index = glGetAttribLocation( prog, "b" );
+	c_index = glGetAttribLocation( prog, "c" );
 
 	/* create buffers */
 	glGenBuffers( 1, &vbo );
@@ -212,14 +217,14 @@ piglit_init(int argc, char **argv)
 enum piglit_result
 piglit_display(void)
 {
-	glClearColor( 0.5, 0.5, 0.5, 1.0 );
-
-	glClear( GL_COLOR_BUFFER_BIT );
-
 	bool pass = true;
 
 	float expected_color[3] = { 0.0, 1.0, 0.0 };
 
+	glClearColor( 0.5, 0.5, 0.5, 1.0 );
+
+	glClear( GL_COLOR_BUFFER_BIT );
+
 	glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
 
 	pass = piglit_probe_pixel_rgb( 0.5, 0.5, expected_color );
-- 
1.8.3.2



More information about the Piglit mailing list