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.pa...@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

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to