Fix shader draw parameter pack alignment issue
authorJeannot Breton <jbreton@nvidia.com>
Wed, 7 Jun 2017 22:09:00 +0000 (17:09 -0500)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 9 Jun 2017 15:51:54 +0000 (11:51 -0400)
The test allocates a buffer of width*height*3 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.shader_draw_parameters_tests.ShaderDrawArraysParameters

Components: OpenGL

VK-GL-CTS issue: 477

Change-Id: I2bef139f5b1e39fe52b2f00e5a529ce503a5d567

external/openglcts/modules/gl/gl4cShaderDrawParametersTests.cpp

index 99e6087..8f1c228 100644 (file)
@@ -287,7 +287,9 @@ bool ShaderDrawParametersTestBase::verify()
        std::vector<GLubyte> pixels;
        pixels.resize(width * height * 3);
 
+       gl.pixelStorei(GL_PACK_ALIGNMENT, 1);
        gl.readPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels.data());
+       gl.pixelStorei(GL_PACK_ALIGNMENT, 4);
 
        std::vector<ResultPoint>::iterator it;
        for (it = m_resultPoints.begin(); it != m_resultPoints.end(); ++it)