Commit 0930da41 by Alexis Hetu Committed by Alexis Hétu

Proper usage of pixel pack buffer

The pixel pack buffer was ignored, but should be used whenever it is set when doing a glReadPixels. When this is the case, pixels becomes an offset. From the GLES 3.0 spec, section 4.3.1, subsection "Placement in Pixel Pack Buffer or Client Memory": "If a pixel pack buffer is bound, data is an offset into the pixel pack buffer and the pixels are packed into the buffer relative to this offset; otherwise, data is a pointer to a block of client memory and the pixels are packed into the client memory relative to the pointer" WebGL conformance tests passed. Change-Id: I7539f1ce705cfd2072ed679815676c0b18887272 Reviewed-on: https://swiftshader-review.googlesource.com/3604Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 284bb656
......@@ -3170,7 +3170,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
rect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
unsigned char *source = (unsigned char*)renderTarget->lock(rect.x0, rect.y0, sw::LOCK_READONLY);
unsigned char *dest = (unsigned char*)pixels;
unsigned char *dest = getPixelPackBuffer() ? (unsigned char*)getPixelPackBuffer()->data() + (ptrdiff_t)pixels : (unsigned char*)pixels;
int inputPitch = (int)renderTarget->getPitch();
for(int j = 0; j < rect.y1 - rect.y0; j++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment