Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,882
    • Issues 2,882
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 903
    • Merge requests 903
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Issues
  • #885

Closed
Open
Created Sep 18, 2019 by Bugzilla Migration User@bugzilla-migration

OSMesaGetDepthBuffer flipped vertically

Submitted by pop..@..isk.fr

Assigned to mes..@..op.org

Link to original bug (#108853)

Description

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[jwidth + i]; depth[jwidth + i] = depth[(height - 1 - j)*width + i]; depth[(height - 1 - j)*width + i] = tmp; } #endif // GALLIUM return depth; }

Version: 18.2

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking