[Piglit] [PATCH 4/4] gl-3.2: fix sample count in layered rendering tests

Brian Paul brianp at vmware.com
Fri Oct 13 16:07:51 UTC 2017


Use GL_MAX_COLOR_TEXTURE_SAMPLES as sample count for
glTextureStorage3DMultisample().  Allows these tests to pass on llvmpipe.
---
 .../gl-3.2/layered-rendering/framebuffer-layered-attachments.c     | 7 +++++--
 tests/spec/gl-3.2/layered-rendering/gl-layer-render-storage.c      | 5 ++++-
 tests/spec/gl-3.2/layered-rendering/gl-layer-render.c              | 5 ++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tests/spec/gl-3.2/layered-rendering/framebuffer-layered-attachments.c b/tests/spec/gl-3.2/layered-rendering/framebuffer-layered-attachments.c
index ea466e8..66d1674 100644
--- a/tests/spec/gl-3.2/layered-rendering/framebuffer-layered-attachments.c
+++ b/tests/spec/gl-3.2/layered-rendering/framebuffer-layered-attachments.c
@@ -67,6 +67,8 @@ GLuint
 create_bind_texture(GLenum textureType) {
 	int i;
 	GLuint texture;
+	GLint samples;
+
 	glGenTextures(1, &texture);
 	glBindTexture(textureType, texture);
 
@@ -97,8 +99,9 @@ create_bind_texture(GLenum textureType) {
 		}
 		break;
 	case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-		glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 4,
-					GL_RGB, 10, 10, 2, GL_FALSE);
+		glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &samples);
+		glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+					samples, GL_RGB, 10, 10, 2, GL_FALSE);
 		break;
 	}
 
diff --git a/tests/spec/gl-3.2/layered-rendering/gl-layer-render-storage.c b/tests/spec/gl-3.2/layered-rendering/gl-layer-render-storage.c
index 6a3125b..9c979e0 100644
--- a/tests/spec/gl-3.2/layered-rendering/gl-layer-render-storage.c
+++ b/tests/spec/gl-3.2/layered-rendering/gl-layer-render-storage.c
@@ -92,6 +92,8 @@ static GLuint color_uniform;
 GLuint
 create_bind_texture(GLenum textureType) {
 	GLuint texture;
+	GLint samples;
+
 	glGenTextures(1, &texture);
 	glBindTexture(textureType, texture);
 
@@ -117,7 +119,8 @@ create_bind_texture(GLenum textureType) {
 		glTexStorage2D(textureType, 1, GL_RGB8, 6, 6);
 		break;
 	case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-		glTexStorage3DMultisample(textureType, 4, GL_RGB8,
+		glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &samples);
+		glTexStorage3DMultisample(textureType, samples, GL_RGB8,
 					6, 6, 6, GL_FALSE);
 		break;
 	}
diff --git a/tests/spec/gl-3.2/layered-rendering/gl-layer-render.c b/tests/spec/gl-3.2/layered-rendering/gl-layer-render.c
index b6422dd..ae8e58f 100644
--- a/tests/spec/gl-3.2/layered-rendering/gl-layer-render.c
+++ b/tests/spec/gl-3.2/layered-rendering/gl-layer-render.c
@@ -93,6 +93,8 @@ GLuint
 create_bind_texture(GLenum textureType) {
 	int i;
 	GLuint texture;
+	GLint samples;
+
 	glGenTextures(1, &texture);
 	glBindTexture(textureType, texture);
 
@@ -123,7 +125,8 @@ create_bind_texture(GLenum textureType) {
 		}
 		break;
 	case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-		glTexImage3DMultisample(textureType, 4, GL_RGB,
+		glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &samples);
+		glTexImage3DMultisample(textureType, samples, GL_RGB,
 					6, 6, 6, GL_FALSE);
 		break;
 	}
-- 
1.9.1



More information about the Piglit mailing list