Luminance/Intensity when converted to RGBA should be replicated to fill
the RGB channels.

Fixes:5038d839b8e4 ("mesa: use _mesa_format_convert to implement glReadPixels.")
Cc: Iago Toral Quiroga <ito...@igalia.com>
Cc: Jason Ekstrand <jason.ekstr...@intel.com>
---
 src/mesa/main/readpix.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 6ce340ddf9..2d6c7521ef 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -474,14 +474,14 @@ read_rgba_pixels( struct gl_context *ctx,
    if (rb->_BaseFormat == GL_LUMINANCE || rb->_BaseFormat == GL_INTENSITY) {
       needs_rebase = true;
       rebase_swizzle[0] = MESA_FORMAT_SWIZZLE_X;
-      rebase_swizzle[1] = MESA_FORMAT_SWIZZLE_ZERO;
-      rebase_swizzle[2] = MESA_FORMAT_SWIZZLE_ZERO;
+      rebase_swizzle[1] = MESA_FORMAT_SWIZZLE_X;
+      rebase_swizzle[2] = MESA_FORMAT_SWIZZLE_X;
       rebase_swizzle[3] = MESA_FORMAT_SWIZZLE_ONE;
    } else if (rb->_BaseFormat == GL_LUMINANCE_ALPHA) {
       needs_rebase = true;
       rebase_swizzle[0] = MESA_FORMAT_SWIZZLE_X;
-      rebase_swizzle[1] = MESA_FORMAT_SWIZZLE_ZERO;
-      rebase_swizzle[2] = MESA_FORMAT_SWIZZLE_ZERO;
+      rebase_swizzle[1] = MESA_FORMAT_SWIZZLE_X;
+      rebase_swizzle[2] = MESA_FORMAT_SWIZZLE_X;
       rebase_swizzle[3] = MESA_FORMAT_SWIZZLE_W;
    } else if (_mesa_get_format_base_format(rb_format) != rb->_BaseFormat) {
       needs_rebase =
-- 
2.13.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to