OSDN Git Service

Fix format/type conversion for readPixels.
authorNicolas Capens <capn@google.com>
Thu, 31 Dec 2015 16:30:40 +0000 (11:30 -0500)
committerNicolas Capens <capn@google.com>
Mon, 4 Jan 2016 18:32:42 +0000 (18:32 +0000)
Change-Id: I5d9d8247fc847e987cbe7d62f7e8641ac4225f50
Reviewed-on: https://swiftshader-review.googlesource.com/4448
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/OpenGL/common/Image.cpp
src/OpenGL/common/Image.hpp
src/OpenGL/libGLESv2/Context.cpp

index 85ebe9a..2b4d97e 100644 (file)
@@ -1058,8 +1058,7 @@ namespace egl
                return (rawPitch + alignment - 1) & ~(alignment - 1);
        }
 
-
-       GLsizei ComputeCompressedPitch(GLsizei width, GLenum format)
+       inline GLsizei ComputeCompressedPitch(GLsizei width, GLenum format)
        {
                return ComputeCompressedSize(width, 1, format);
        }
index a82dc1c..1b4d349 100644 (file)
@@ -26,9 +26,9 @@
 namespace egl\r
 {\r
 \r
+sw::Format ConvertFormatType(GLenum format, GLenum type);\r
 sw::Format SelectInternalFormat(GLenum format, GLenum type);\r
 GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);\r
-GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);\r
 GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);\r
 \r
 static inline sw::Resource *getParentResource(egl::Texture *texture)\r
index af3bae3..a364b81 100644 (file)
@@ -3303,7 +3303,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
        sw::Rect dstRect = { 0, 0, width, height };\r
        rect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());\r
 \r
-       sw::Surface externalSurface(width, height, 1, egl::SelectInternalFormat(format, type), pixels, outputPitch, outputPitch * outputHeight);\r
+       sw::Surface externalSurface(width, height, 1, egl::ConvertFormatType(format, type), pixels, outputPitch, outputPitch * outputHeight);\r
        sw::SliceRect sliceRect(rect);\r
        sw::SliceRect dstSliceRect(dstRect);\r
        device->blit(renderTarget, sliceRect, &externalSurface, dstSliceRect, false);\r