[Piglit] [PATCH] Use piglit_vertex to properly interface with piglit_draw_rect()

Anuj Phogat anuj.phogat at gmail.com
Tue Dec 10 17:50:10 PST 2013


Also, use piglit_link_simple_program(). It ensures that
piglit_vertex gets assigned to the proper attribute slot.

This patch fixes these tests currently failing on mesa.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../arb_sample_shading/execution/builtin-gl-num-samples.cpp  | 12 +++++-------
 .../execution/builtin-gl-sample-position.cpp                 | 12 +++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
index 00de307..1e250ff 100644
--- a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
@@ -35,6 +35,7 @@ const int pattern_width = 128; const int pattern_height = 128;
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 21;
+	config.supports_gl_core_version = 31;
 
 	config.window_width = pattern_width;
 	config.window_height = pattern_height;
@@ -58,10 +59,10 @@ compile_shader(void)
 {
 	static const char *vert =
 		"#version 130\n"
-		"in vec2 pos;\n"
+		"in vec4 piglit_vertex;\n"
 		"void main()\n"
 		"{\n"
-		"  gl_Position = vec4(pos, 0.0, 1.0);\n"
+		"  gl_Position = piglit_vertex;\n"
 		"}\n";
 	static const char *frag =
 		"#version 130\n"
@@ -78,12 +79,9 @@ compile_shader(void)
 	/* Compile program */
 	prog = glCreateProgram();
 	GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
-	glAttachShader(prog, vs);
-	piglit_check_gl_error(GL_NO_ERROR);
 	GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
-	glAttachShader(prog, fs);
-	glBindAttribLocation(prog, 0, "pos");
-	glLinkProgram(prog);
+	piglit_check_gl_error(GL_NO_ERROR);
+	prog = piglit_link_simple_program(vs, fs);
 	if (!piglit_link_check_status(prog)) {
 		piglit_report_result(PIGLIT_FAIL);
 	}
diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp
index 1698f56..0a7bad8 100644
--- a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp
@@ -36,6 +36,7 @@ const int pattern_width = 128; const int pattern_height = 128;
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 21;
+	config.supports_gl_core_version = 31;
 
 	config.window_width = pattern_width;
 	config.window_height = pattern_height;
@@ -59,10 +60,10 @@ compile_shader(void)
 {
 	static const char *vert =
 		"#version 130\n"
-		"in vec2 pos;\n"
+		"in vec4 piglit_vertex;\n"
 		"void main()\n"
 		"{\n"
-		"  gl_Position = vec4(pos, 0.0, 1.0);\n"
+		"  gl_Position = piglit_vertex;\n"
 		"}\n";
 	static const char *frag =
 		"#version 130\n"
@@ -81,12 +82,9 @@ compile_shader(void)
 	/* Compile program */
 	prog = glCreateProgram();
 	GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
-	glAttachShader(prog, vs);
-	piglit_check_gl_error(GL_NO_ERROR);
 	GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
-	glAttachShader(prog, fs);
-	glBindAttribLocation(prog, 0, "pos");
-	glLinkProgram(prog);
+	piglit_check_gl_error(GL_NO_ERROR);
+	prog = piglit_link_simple_program(vs, fs);
 	if (!piglit_link_check_status(prog)) {
 		piglit_report_result(PIGLIT_FAIL);
 	}
-- 
1.8.3.1



More information about the Piglit mailing list