[Piglit] [PATCH] ext_render_snorm-render: change verify_contents to use base_format size

Tapani Pälli tapani.palli at intel.com
Wed Aug 29 07:33:36 UTC 2018


OpenGL ES 3.1 specification lists valid combinations for format, type
and internalformat for transfer of pixel rectangles. This change follows
the table 8.4 in spec so that we use exact same number of components
for format as is expected from corresponding internalformat.

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 tests/spec/ext_render_snorm/render.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/spec/ext_render_snorm/render.c b/tests/spec/ext_render_snorm/render.c
index 3df16991e..ec1856806 100644
--- a/tests/spec/ext_render_snorm/render.c
+++ b/tests/spec/ext_render_snorm/render.c
@@ -203,15 +203,15 @@ verify_contents(const struct fmt_test *test)
 {
 	bool result = true;
 	unsigned amount = piglit_width * piglit_height;
-	void *pix = malloc(amount * 4);
-	glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, GL_BYTE, pix);
+	void *pix = malloc(amount * test->bpp);
+	glReadPixels(0, 0, piglit_width, piglit_height, test->base_format, GL_BYTE, pix);
 
-	char value[4] = { 0, 0, 0, SCHAR_MAX };
+	char *value = malloc(test->bpp);
 	value_for_format(test, value);
 
 	char *p = pix;
-	for (unsigned i = 0; i < amount; i++, p += 4) {
-		if (memcmp(p, value, sizeof(value)) == 0)
+	for (unsigned i = 0; i < amount; i++, p += test->bpp) {
+		if (memcmp(p, value, test->bpp * sizeof(char)) == 0)
 			continue;
 
                 fprintf(stderr, "value:\n%d % d %d %d\nexpect:\n%d %d %d %d",
-- 
2.13.6



More information about the Piglit mailing list