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
// 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);