[Piglit] [PATCH] Check the max point size the driver supported and adjust it accordingly.

Jian Zhao jian.j.zhao at intel.com
Sun Feb 19 17:55:21 PST 2012


Signed-off-by: Jian Zhao <jian.j.zhao at intel.com>
---
 tests/fbo/fbo-gl_pointcoord.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/fbo/fbo-gl_pointcoord.c b/tests/fbo/fbo-gl_pointcoord.c
index 8db6ad4..0bfd283 100644
--- a/tests/fbo/fbo-gl_pointcoord.c
+++ b/tests/fbo/fbo-gl_pointcoord.c
@@ -47,6 +47,7 @@ static const char fs_text[] =
 	;
 static GLuint prog;
 static GLuint fb, rb;
+static GLuint testPoint_x, testPoint_y;
 
 static const float green[] = { 0.0, 1.0, 0.0, 1.0 };
 static const float black[] = { 0.0, 0.0, 0.0, 1.0 };
@@ -64,8 +65,8 @@ piglit_display(void)
 
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
 	pass = piglit_probe_pixel_rgb(0, 0, black) && pass;
-	pass = piglit_probe_pixel_rgb(18, 18, green) && pass;
-	pass = piglit_probe_pixel_rgb(18, 81, black) && pass;
+	pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_x, green) && pass;
+	pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_y - 1, black) && pass;
 
 	/* Draw the point out if want to have a look. */
 	if (!piglit_automatic){
@@ -84,13 +85,19 @@ void
 piglit_init(int argc, char **argv)
 {
 	GLuint vs, fs;
-	int PointSize = 64;
+	int PointSize;
+	int point_size_limits[2];
 
 	piglit_require_extension("GL_ARB_point_sprite");
 	piglit_require_extension("GL_ARB_framebuffer_object");
 
+	glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_size_limits);
+
+	PointSize = point_size_limits[1] >= 64 ? 64 : point_size_limits[1];
 	glEnable(GL_POINT_SPRITE_ARB);
 	glPointSize(PointSize);
+	testPoint_x = ( 100 - PointSize ) / 2;
+	testPoint_y = 100 - testPoint_x ;
 
 	piglit_require_vertex_shader();
 	piglit_require_fragment_shader();
-- 
1.7.0.1



More information about the Piglit mailing list