Bug 27590

Summary: glReadPixels of GL_DEPTH_COMPONENT fails on FBOs.
Product: Mesa Reporter: Nick Bowler <nbowler>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: kai.kasurinen
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Simple program which demonstrates the issue.
Simple program which demonstrates the issue.

Description Nick Bowler 2010-04-11 16:56:21 UTC
Created attachment 34897 [details]
Simple program which demonstrates the issue.

Attempting to read the depth buffer of an FBO on the intel driver with
glReadPixels(..., GL_DEPTH_COMPONENT, ...) causes the following message to be
spewed to the console:

  Mesa 7.8.1 implementation error: Invalid depth renderbuffer data type
  Please report at bugzilla.freedesktop.org

As requested by the error message, I am reporting this.  The problem is
reproducible with mesa 7.7.1, 7.8.1 and git master.  The attached program
demonstrates the issue, and works with the software rasterizer.

I'm using a GM45 with xf86-video-intel-2.11.0.
Comment 1 Eric Anholt 2010-04-12 13:18:49 UTC
Thanks for attaching sample code!   I'd like to integrate this into piglit so we don't regress it again, but in the interests of not hearing from a lawyer in the future, would you agree to relicense it to the MIT license? (reproduced below)

/*
 * Copyright © 2010 Nick Bowler
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
\ */
Comment 2 Nick Bowler 2010-04-12 13:35:22 UTC
Yes, feel free to do that.
Comment 3 Nick Bowler 2010-04-12 18:46:39 UTC
Created attachment 34945 [details]
Simple program which demonstrates the issue.

Updated the test program a bit:

  * List MIT as an explicit license option.
  * Allow renderbuffer width/height to be easily configured at compile time.

The reason for the second change is because the test program happens to *also* demonstrate an r600 regression (bug 27609).
Comment 4 Nick Bowler 2010-04-16 17:46:04 UTC
So it turns out that this is actually a regression... bisection results follow.

45e76d2665b38ba3787548310efc59e969124c01 is the first bad commit
commit 45e76d2665b38ba3787548310efc59e969124c01
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Oct 8 20:27:27 2009 -0600

    mesa: remove a bunch of gl_renderbuffer fields
    
    _ActualFormat is replaced by Format (MESA_FORMAT_x).
    ColorEncoding, ComponentType, RedBits, GreenBits, BlueBits, etc. are
    all replaced by MESA_FORMAT_x queries.

:040000 040000 df38e5b55c0cb218a1475133c703da04eaa43c65 33c8efcbfef3891b0094af0463880815846c785f M	src

git bisect start
# good: [faa6d8af59c69b0c0239f64363b170619e2a9827] docs: set 7.3 release date
git bisect good faa6d8af59c69b0c0239f64363b170619e2a9827
# bad: [862d014ba91f0b959465a48005e94f530f0374a5] llvmpipe: fix color masking
git bisect bad 862d014ba91f0b959465a48005e94f530f0374a5
# good: [545e574cd9a2a659cd9a93879dff8884bd247558] Merge remote branch 'origin/master' into radeon-rewrite
git bisect good 545e574cd9a2a659cd9a93879dff8884bd247558
# skip: [e45579e50ba3b9736465f68377b3f5d0afb7c1da] vmw/wgl: Update for pipebuffer changes.
git bisect skip e45579e50ba3b9736465f68377b3f5d0afb7c1da
# skip: [beb8e8f2f2de0c1221090554159129665a79a292] vmware/core: Put GMR pool size in a define.
git bisect skip beb8e8f2f2de0c1221090554159129665a79a292
# skip: [74b55970dc25d6b2a65f385fd298f141176cd4d3] Merge branch 'fix_r300_swtcl' into push_master
git bisect skip 74b55970dc25d6b2a65f385fd298f141176cd4d3
# skip: [63c00c53a3019b801c5eee8a12f7862422f79f10] radeon: update miptree code a little
git bisect skip 63c00c53a3019b801c5eee8a12f7862422f79f10
# skip: [3f9ec9aa96406356b1224c6926e263cb626b5c67] gallium/trace: remove unneeded path prefixes on #includes
git bisect skip 3f9ec9aa96406356b1224c6926e263cb626b5c67
# bad: [57ed791305ded187c455b07e6c6a5b916f37a293] trace: Implement separate vertex sampler state.
git bisect bad 57ed791305ded187c455b07e6c6a5b916f37a293
# good: [19420f02d4540654731840e345bdcd367389ed40] s3v: Fix driver build for ARB_sync.
git bisect good 19420f02d4540654731840e345bdcd367389ed40
# good: [d9099f8602eb6d15e9fc2e0b0987e7a58fb98b68] mesa: rename VERBOSE_IMMEDIATE->VERBOSE_MATERIAL to reflect what it does
git bisect good d9099f8602eb6d15e9fc2e0b0987e7a58fb98b68
# bad: [c379fbbe244bf6778c5bd66c1f2118f83b08f90d] tgsi/ureg: Add negate and swizzle for predicates.
git bisect bad c379fbbe244bf6778c5bd66c1f2118f83b08f90d
# good: [9519603f7405a1043ea39bf1dfaf4c88529ce2d1] mesa: simplify teximage code with get_current_tex_object()
git bisect good 9519603f7405a1043ea39bf1dfaf4c88529ce2d1
# skip: [086f9fc0e2aef27f54eda87c733685500555bf20] swrast: fix RGB, RGBA texturing code
git bisect skip 086f9fc0e2aef27f54eda87c733685500555bf20
# bad: [d255aaf54f9a4398247698408bd45698b1cefe58] mesa: remove hard-coded block sizes
git bisect bad d255aaf54f9a4398247698408bd45698b1cefe58
# good: [1f7c914ad0beea8a29c1a171c7cd1a12f2efe0fa] mesa: replace gl_texture_format with gl_format
git bisect good 1f7c914ad0beea8a29c1a171c7cd1a12f2efe0fa
# good: [edfd2f7c4f942ed0c1aa1238ab0684ee7dd889a2] mesa: accept more pnames in _mesa_get_format_bits()
git bisect good edfd2f7c4f942ed0c1aa1238ab0684ee7dd889a2
# bad: [4bd70b5cff13039a4b0e0c554156fec06e3c3906] i965: change parameter type to gl_format
git bisect bad 4bd70b5cff13039a4b0e0c554156fec06e3c3906
# bad: [9bf2aa33298db5af9128ad8f625321be47ab65c3] dri/common: fix broken _dri_texformat_* initializations
git bisect bad 9bf2aa33298db5af9128ad8f625321be47ab65c3
# good: [74d61d03b54d72217d463c248468cdcd09320efc] mesa: added MESA_FORMAT_XRGB8888
git bisect good 74d61d03b54d72217d463c248468cdcd09320efc
# bad: [45e76d2665b38ba3787548310efc59e969124c01] mesa: remove a bunch of gl_renderbuffer fields
git bisect bad 45e76d2665b38ba3787548310efc59e969124c01
Comment 5 Nick Bowler 2010-08-26 08:04:27 UTC
commit e71a9042cb5e046072d2ea8fbd22a01de625bf8a
Author: Nick Bowler <nbowler@draconx.ca>
Date:   Thu Aug 26 07:26:21 2010 -0700

    mesa: Identify packed depth/stencil buffers using the Format field.

And this one because I apparently still need practice with git-send-email...

commit 7b07674667e8e34c936c417ab6f1c2e33093205b
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Aug 26 08:59:43 2010 -0600

    mesa: fix mixed-up function call name

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.