Bug 104395 - [CTS] GTF-GL46.gtf32.GL3Tests.packed_pixels.packed_pixels tests fail on 32bit Mesa
Summary: [CTS] GTF-GL46.gtf32.GL3Tests.packed_pixels.packed_pixels tests fail on 32bit...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Blocks: 102590
  Show dependency treegraph
Reported: 2017-12-27 15:15 UTC by Mark Janes
Modified: 2019-08-27 23:59 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Description Mark Janes 2017-12-27 15:15:44 UTC
The following tests fail on 32 bit Mesa:


Sample output:
ERROR/packed_pixels: ERROR:packed_pixels:Compare: non-integer comparison: 4, 0, 72, 0.007874: 0.566929 == 0.500000: not equal. 

Additionally, the following test fails intermittently, and has been disabled in Intel's CI:

Sample output:
INFO/packed_depth_stencil_init: INFO:packed_depth_stencil_init:Target: 00009101
ERROR:packed_depth_stencil_init:glGetTexLevelParameterfv: Parameter is not 0
Comment 1 Kenneth Graunke 2019-08-23 09:01:06 UTC
This basically boils down to:

   _mesa_lroundevenf(0.571428597f * 0xffffffffu)

returning wildly different results on 64-bit and 32-bit.

64-bit: result = 0x92492500
32-bit: result = 0x80000000

This happens even if I use the lrintf path directly instead of the SSE intrinsics.


How to arrive at this conclusion:

1. Simplify the test to do less work:
   a. Comment out all "formats" other than GL_RED
   b. Comment out all "types" other than GL_SHORT and GL_UNSIGNED_INT
3. Break in get_tex_rgba_uncompressed
   We should be doing a R16_SNORM -> R32_UNORM conversion here

4. Note the conversion to RGBA32_FLOAT for transfer ops
5. Observe that texgetimage.c:546 _mesa_format_convert has the same float source data in both 32-bit and 64-bit builds, but produces different R32_UNORM result data.
Comment 2 Kenneth Graunke 2019-08-23 09:06:27 UTC
Oh right, because that's larger than a signed long (32-bit).

llrintf() works of course.  So perhaps _mesa_float_to_unorm needs to be using llrintf() if dst_bits == 32?
Comment 3 Kenneth Graunke 2019-08-23 21:13:23 UTC
Fixed by this:
Comment 4 Kenneth Graunke 2019-08-27 23:59:00 UTC

commit e18cd5452aa4434fb22105eb939843381771b91c
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Aug 23 11:10:30 2019 -0700

    mesa: Fix _mesa_float_to_unorm() on 32-bit systems.

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.