[Piglit] [PATCH 1/2] arb_post_depth_coverage: Don't try sample rates we don't support

Lyude lyude at redhat.com
Mon May 22 18:55:09 UTC 2017


Some intel hardware supports up to 16 samples, but nvidia only goes up
to 8. So stop these tests from failing on nvidia hardware by only
testing up to the max sample rate we can support.

Signed-off-by: Lyude <lyude at redhat.com>
---
 tests/spec/arb_post_depth_coverage/multisampling.c  | 4 +++-
 tests/spec/arb_post_depth_coverage/sample-shading.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_post_depth_coverage/multisampling.c b/tests/spec/arb_post_depth_coverage/multisampling.c
index 0c867da..f90208d 100644
--- a/tests/spec/arb_post_depth_coverage/multisampling.c
+++ b/tests/spec/arb_post_depth_coverage/multisampling.c
@@ -236,12 +236,14 @@ enum piglit_result
 piglit_display(void)
 {
 	int samples[4] = { 2, 4, 8, 16 };
+	int max_samples;
 	bool pass = true;
 	int i, j, k;
 
 	glViewport(0, 0, piglit_width, piglit_height);
+	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
 
-	for (j = 0; j < 4; j++) {
+	for (j = 0; j < 4 && samples[j] <= max_samples; j++) {
 		sample_mask = (GLint*) calloc (piglit_width * piglit_height,
 			sizeof(GLint));
 		glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(GLint) * piglit_width *
diff --git a/tests/spec/arb_post_depth_coverage/sample-shading.c b/tests/spec/arb_post_depth_coverage/sample-shading.c
index 891e7bc..f865a7a 100644
--- a/tests/spec/arb_post_depth_coverage/sample-shading.c
+++ b/tests/spec/arb_post_depth_coverage/sample-shading.c
@@ -242,12 +242,14 @@ enum piglit_result
 piglit_display(void)
 {
 	int samples[4] = { 2, 4, 8, 16 };
+	int max_samples;
 	bool pass = true;
 	int i, j, k;
 
 	glViewport(0, 0, piglit_width, piglit_height);
+	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
 
-	for (j = 0; j < 4; j++) {
+	for (j = 0; j < 4 && samples[j] <= max_samples; j++) {
 		sample_mask = (GLint*) calloc (piglit_width * piglit_height,
 			sizeof(GLint));
 		glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(GLint) * piglit_width *
-- 
2.9.4



More information about the Piglit mailing list