[Mesa-dev] [Bug 108853] OSMesaGetDepthBuffer flipped vertically

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Nov 24 16:16:16 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=108853

            Bug ID: 108853
           Summary: OSMesaGetDepthBuffer flipped vertically
           Product: Mesa
           Version: 18.2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Drivers/OSMesa
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: popinet at basilisk.fr
        QA Contact: mesa-dev at lists.freedesktop.org

When installing OSMesa using

./configure --prefix=$install_dir                 \
    --enable-opengl --disable-gles1 --disable-gles2   \
    --disable-va --disable-xvmc --disable-vdpau       \
    --enable-shared-glapi                             \
    --disable-texture-float                           \
    --with-gallium-drivers=swrast                 \
    --disable-dri --with-dri-drivers=                 \
    --disable-egl --with-platforms= --disable-gbm \
    --enable-glx    --with-platforms=x11              \
    --disable-osmesa --enable-gallium-osmesa

i.e. using the gallium osmesa implementation, the depth buffer returned by
OSMesaGetDepthBuffer is flipped vertically relative to the OSMesa framebuffer.

Using the non-gallium osmesa implementation returns a depth buffer correctly
aligned with the framebuffer.

The gallium-returned depth buffer can be fixed using something like:

fbdepth_t * framebuffer_depth (framebuffer * p)
{
  unsigned int * depth;
  GLint width, height, bytesPerValue;
  OSMesaGetDepthBuffer (p->ctx, &width, &height, &bytesPerValue,
                        (void **)&depth);
  assert (p->width == width && p->height == height && bytesPerValue == 4);
  assert (sizeof(fbdepth_t) == bytesPerValue);
#if GALLIUM
  // fix for bug in gallium/libosmesa
  // the depth buffer is flipped vertically
  for (GLint j = 0; j < height/2; j++)
    for (GLint i = 0; i < width; i++) {
      unsigned int tmp = depth[j*width + i];
      depth[j*width + i] = depth[(height - 1 - j)*width + i];
      depth[(height - 1 - j)*width + i] = tmp;
    }
#endif // GALLIUM
  return depth;
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181124/04ffe1e2/attachment.html>


More information about the mesa-dev mailing list