Bug 29661

Summary: MSVC built u_format_test fails on Windows
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: Jose Fonseca <jfonseca>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: ageorgo
Version: git   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Added conversion to float type

Description Vinson Lee 2010-08-18 18:32:54 UTC
mesa: f5703a54e2f765237e01eef6ddbd019ca6a58e81 (master)

Run u_format_test on Windows.

Testing util_format_r32_sscaled_pack_rgba_float ...
FAILED: 00 00 00 80 obtained
        00 00 00 00 expected
FAILED: 00 00 00 80 obtained
        00 00 00 01 expected
FAILED: 00 00 00 80 obtained
        00 00 00 ff expected

Testing util_format_r32g32_sscaled_pack_rgba_float ...
FAILED: 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 obtained
        00 00 00 01 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 obtained
        00 00 00 ff 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 01 expected
FAILED: 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 ff expected

Testing util_format_r32g32b32_sscaled_pack_rgba_float ...
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 01 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 ff 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 01 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 ff 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 01 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 ff expected

Testing util_format_r32g32b32a32_sscaled_pack_rgba_float ...
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 expected
FAILED: 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 obtained
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff expected
Comment 1 Vinson Lee 2010-08-18 22:48:53 UTC
These are the results of u_format_test on a 32-bit Windows XP Professional machine.

32-bit MSVC built u_format_test fails.
32-bit Cygwin GCC built u_format_test passes.
32-bit MinGW built u_format_test passes.
Comment 2 Juraj Svec 2011-12-21 13:20:37 UTC
Created attachment 54656 [details] [review]
Added conversion to float type
Comment 3 Juraj Svec 2011-12-21 13:21:20 UTC
I am not entirely sure what is the reason for this behavior but in MSVC 2010 the following code:

printf("float: %f\n", (float)(-2147483648));
printf("float: %f\n", (float)(-2147483648.0));

outputs

float: 2147483648.000000
float: -2147483648.000000

After I modified the input to CLAMP operation in format_pack functions to have the trailing .0 in case of floats, the problem seems to be solved.
Comment 4 Jose Fonseca 2014-11-08 10:36:35 UTC
Finally fixed with http://cgit.freedesktop.org/mesa/mesa/commit/?id=d268eac3a9c81febc5efcae7fe6854045bfc5144 .  Sorry it took this long.

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.