Bug 59442

Summary: glReadPixels doesn't smash alpha to 1.0 with RGB float formats
Product: Mesa Reporter: Carl Worth <cworth>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Carl Worth 2013-01-15 22:14:11 UTC
I recently fixed the fbo-blending-formats test in piglit to correctly
test that the alpha channel results when reading from a format with no
storage for an alpha channel is correctly set to 1.0.

See this patch (and two following patches) for my suggested fix to the
test:

http://lists.freedesktop.org/archives/piglit/2013-January/004604.html

With my test changes in place, the fbo-blending-formats (and perhaps
other, related tests) fail due to the alpha channel not being set to
1.0 when reading from an floating-point RGB-only format.

For example

	Results for spec/ARB_texture_float/fbo-blending-formats/GL_RGB32F_ARB

	Using test set: GL_ARB_texture_float
	Probe at (32,0)
	  Expected: 0.480000 0.800000 0.680000 1.000000
	  Observed: 0.479980 0.799805 0.679688 0.499756
	  when testing FBO result, blending with CONSTANT_COLOR.

In this test result, it's clear that a value of alpha==0.5 was read
from a buffer with format GL_RGB32F, and the correct value should be
alpha==1.0.

-Carl
Comment 1 Carl Worth 2013-01-29 00:53:43 UTC
I've now fixed all cases where the above-mentioned patches introduced
new failures (on Sandybridge at least).

The following commits in the mesa repository are all relevant for the
bug fixes:

commit b961ba44ed01d4aa590609fc91ab1250ac7d9559
Author: Carl Worth <cworth@cworth.org>
Date:   Mon Jan 21 12:18:02 2013 -0800

    i965: Examine _BaseFormat when deciding to perform xRGB_alpha fixups

commit 570ed2be7d776211e1ca2a7a4c44ee6a1d141714
Author: Carl Worth <cworth@cworth.org>
Date:   Mon Jan 21 12:16:27 2013 -0800

    ReadPixels: Force ALPHA to 1 while rebasing RGBA values for GL_RGB format

commit 33599433c75c0ab433615d08ed7e4002146ba462
Author: Carl Worth <cworth@cworth.org>
Date:   Tue Jan 22 13:25:37 2013 -0800

    i965: Use swizzles to force alpha to 1.0 for RED, RG, or RGB textures.

commit 8059c2ea9011110df3632e28a4311de9373b9b4e
Author: Carl Worth <cworth@cworth.org>
Date:   Tue Jan 22 13:29:01 2013 -0800

    i965: Use swizzles to force R, G, and B to 0.0 for ALPHA textures.

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.