[Piglit] [PATCH] Edit multi-draw-elements-base-vertex.c: change indice offset from int to GLvoid*

Jacob Penner jkpenner91 at gmail.com
Tue Aug 13 11:56:22 PDT 2013


Passing an offset of type int typedcast to GLvoid* to
glMultiDrawElementsBaseVertex would result in function
receiving incorrect data.
---
 .../multi-draw-elements-base-vertex.c                        | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_draw_elements_base_vertex/multi-draw-elements-base-vertex.c b/tests/spec/arb_draw_elements_base_vertex/multi-draw-elements-base-vertex.c
index 1d51b53..8fdd666 100644
--- a/tests/spec/arb_draw_elements_base_vertex/multi-draw-elements-base-vertex.c
+++ b/tests/spec/arb_draw_elements_base_vertex/multi-draw-elements-base-vertex.c
@@ -105,8 +105,8 @@ static GLuint indices[] = {
 };
 static GLsizei indices_size = sizeof(indices);
 
-static int indices_offset[] = {
-	0, 6 * sizeof(GLuint)
+static const GLvoid * const indices_offset[] = {
+	(GLvoid*) 0, (GLvoid*)(6 * sizeof(GLuint))
 };
 static GLsizei indices_count[] = {
 	6, 6
@@ -124,8 +124,6 @@ piglit_init(int argc, char **argv)
 		piglit_require_extension("GL_ARB_draw_elements_base_vertex");
 	}
 
-	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-
 	/* Create program */
 	program = piglit_build_simple_program(vs_source, fs_source);
 	glUseProgram(program);
@@ -153,6 +151,9 @@ piglit_init(int argc, char **argv)
 	glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
 	glEnableVertexAttribArray(vertex_index);
 	glVertexAttribPointer(vertex_index, 2, GL_FLOAT, GL_FALSE, 0, 0);
+
+	if(!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
 }
 
 enum piglit_result
@@ -178,6 +179,9 @@ piglit_display(void)
 	pass = piglit_probe_pixel_rgb(100,  75, blue) && pass;
 	pass = piglit_probe_pixel_rgb(100,  25, green) && pass;
 
+	if(!piglit_check_gl_error(GL_NO_ERROR))
+		pass = false;
+
 	piglit_present_results();
 
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-- 
1.8.3.1



More information about the Piglit mailing list