Bug 11909

Summary: GL_PACK_SWAP_BYTES dosen't work, when reading back from stencil buffer in GL_INT format
Product: Mesa Reporter: Shuang He <shuang.he>
Component: Mesa coreAssignee: mesa-dev
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: medium CC: dri-devel
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: test case

Description Shuang He 2007-08-08 23:32:56 UTC
use glPixelStorei to set GL_PACK_SWAP_BYTES to GL_FALSE
draw a group of values into stencil buffer, 
then, use glPixelStorei to set GL_PACK_SWAP_BYTES to GL_TRUE
read back values from buffer, the byte order is not as expected.

The following patch should fix this:

--- src/mesa/main/image.c       2007-08-05 20:06:34.000000000 +0800
+++ src/mesa/main/b.c   2007-08-09 13:23:01.000000000 +0800
@@ -3794,7 +3794,7 @@
          GLint *dst = (GLint *) dest;
          GLuint i;
          for (i=0;i<n;i++) {
-            *dst++ = (GLint) source[i];
+            dst[i] = (GLint) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap4( (GLuint *) dst, n );
Comment 1 Shuang He 2007-08-08 23:35:14 UTC
Created attachment 11054 [details]
test case
Comment 2 Brian Paul 2007-08-09 00:49:22 UTC
fixed in git.
Comment 3 Shuang He 2007-08-13 21:57:58 UTC
verified on 945gm and g965
Comment 4 Adam Jackson 2009-08-24 12:27:40 UTC
Mass version move, cvs -> git

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.