OSDN Git Service

Unpack row length fix
authorAlexis Hetu <sugoi@google.com>
Thu, 15 Oct 2015 21:05:30 +0000 (17:05 -0400)
committerAlexis Hétu <sugoi@google.com>
Thu, 15 Oct 2015 21:32:51 +0000 (21:32 +0000)
The unpack row length was supposed to replace the width, not the
pitch, of the input image, which explains why related tests were
failing.

Change-Id: I7bd46e057bae4113b31d072fd6748d9dd6043feb
Reviewed-on: https://swiftshader-review.googlesource.com/4080
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/OpenGL/common/Image.cpp

index a0f7ac6..b77f6a7 100644 (file)
@@ -762,7 +762,7 @@ namespace egl
 
        void Image::loadImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const UnpackInfo& unpackInfo, const void *input)
        {
-               GLsizei inputPitch  = (unpackInfo.rowLength == 0) ? ComputePitch(width, format, type, unpackInfo.alignment) : unpackInfo.rowLength;
+               GLsizei inputPitch = ComputePitch((unpackInfo.rowLength == 0) ? width : unpackInfo.rowLength, format, type, unpackInfo.alignment);
                GLsizei inputHeight = (unpackInfo.imageHeight == 0) ? height : unpackInfo.imageHeight;
                input = ((char*)input) + (unpackInfo.skipImages * inputHeight + unpackInfo.skipRows) * inputPitch + unpackInfo.skipPixels;