Take account of alignment for data to skip
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Fri, 23 Feb 2018 16:40:34 +0000 (16:40 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 14 Mar 2018 08:01:54 +0000 (04:01 -0400)
When making the gradient for packed pixels tests, in some cases it is
required to generate data that will be skip by the operations, like when
using GL_UNPACK_SKIP_IMAGES.

But also the images need to be aligned with the proper
GL_UNPACK_ALIGNMENT, so the data to skip need to account for this
alignment too.

Besides this main fix, a minor fix included is to not increase the
buffer size to account for the skipped images, as the depth already
considered them.

Components: OpenGL

VK-GL-CTS issue: 1017

Affects:
KHR-GLES3.packed_pixels.*
KHR-GL3*.packed_pixels.*
KHR-GL4*.packed_pixels.*

Change-Id: I2fc0626ad2c5bb900db1c67dd1b06bf8a7f25ef9

external/openglcts/modules/common/glcPackedPixelsTests.cpp

index 5f19bc2..c2b95cb 100644 (file)
@@ -1238,13 +1238,11 @@ void RectangleTest::makeGradient(Type (*unpack)(float))
 
        // element size * elements in row * number of rows * number of 2d images
        std::size_t bufferSize = elementSize * elementsInRow * rowCount * depth;
-       // need space for the skipped images as well
-       bufferSize *= depth;
 
        m_gradient.resize(bufferSize);
        Type* data = reinterpret_cast<Type*>(&m_gradient[0]);
 
-       std::size_t dataToSkip   = m_unpackProperties.skipImages * rowCount * elementsInRowNoAlign;
+       std::size_t dataToSkip   = m_unpackProperties.skipImages * rowCount * elementsInRow;
        std::size_t index                = dataToSkip;
        const Type  defaultValue = unpack(0.5f);
        std::fill(data, data + dataToSkip, defaultValue);