Fix pack alignment issue on odd window width
authorJeannot Breton <jbreton@nvidia.com>
Mon, 22 May 2017 20:26:07 +0000 (15:26 -0500)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 26 May 2017 15:43:27 +0000 (11:43 -0400)
The test allocates a buffer of width*height elements and expects the
readPixels to only write to this memory.

This is not correct if the window width is not a multiple of 4

Adding a gl.pixelStorei(GL_PACK_ALIGNMENT, 1) before the readPixels
fixes the issue

Affects:

KHR-GL45.indirect_parameters_tests.MultiDrawArraysIndirectCount

Components: OpenGL

VK-GL-CTS issue: 433

Change-Id: I7f8b92af7b5a27a6770e7cde23e51df30508a3c0

external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp

index dfb39bf..340dbf1 100644 (file)
@@ -274,7 +274,9 @@ bool VertexArrayIndirectDrawingBaseCase::verify()
        std::vector<GLubyte> pixels;
        pixels.resize(width * height);
 
+       gl.pixelStorei(GL_PACK_ALIGNMENT, 1);
        gl.readPixels(0, 0, width, height, GL_RED, GL_UNSIGNED_BYTE, pixels.data());
+       gl.pixelStorei(GL_PACK_ALIGNMENT, 4);
 
        //Verify first quad
        for (int y = 2; y < height - 2; ++y)