Bug 31883 - [glsl 1.20] two same arrays compared with a wrong result
Summary: [glsl 1.20] two same arrays compared with a wrong result
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Eric Anholt
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-24 00:14 UTC by zhao jian
Modified: 2010-12-02 17:20 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
test case for arrays compare (522 bytes, text/plain)
2010-11-24 00:14 UTC, zhao jian
Details
test case for arrays compare (459 bytes, text/plain)
2010-11-24 00:40 UTC, zhao jian
Details

Description zhao jian 2010-11-24 00:14:30 UTC
Created attachment 40532 [details]
test case for arrays compare

In glsl 1.20 spec, it says "The equality operators equal (==), and not equal (!=) operate on all types. For vectors, matrices, structures, and arrays, all components, fields, or elements of one operand must equal the corresponding components, fields, or elements in the other operand for the operands to be considered equal. To get a vector of component-wise equality results for vectors, use the built-in functions equal and notEqual." 

But I find our drivers failed to compare two arrays correctly, I tested with two vector arrays and two float arrays. I attached a piglit test case to reproduce it. 

I tested with: 
Libdrm:         (master)2.4.22-16-g51b895041c65f7ec9ecda48e79279dde29258b07
Mesa:           (master)3688301c59d5661d7a5f1473576f2ad1ed575a14
Xserver:        (server-1.9-branch) xorg-server-1.9.2.901-4-g201273a2b97754d1f9fd672660dcc9c05af29621
Xf86_video_intel:  (master)2.13.901-4-g33c08882c0d551afb28baef643279901dcc65fa9
Cairo:          (master)abff335348c4f3b1c694cf44bf089d2a437937b4
Kernel: (drm-intel-fixes)da79de97d254145dcb7c08c978b1093eac15ec9c

Reproduce steps: 
1. xinit& 
2. ./shader_runner glsl-array-compare.shader_test -auto
Comment 1 zhao jian 2010-11-24 00:31:25 UTC
The output when run the test case is as following: 
Probe at (0,0)
  Expected: 1.000000 0.500000 0.500000 0.500000
  Observed: 0.501961 0.501961 0.501961 0.501961
PIGLIT: {'result': 'fail' }
Comment 2 zhao jian 2010-11-24 00:40:18 UTC
Created attachment 40534 [details]
test case for arrays compare
Comment 3 zhao jian 2010-11-24 00:41:32 UTC
with the new test case the output is: 
Probe at (0,0)
  Expected: 0.000000 1.000000 0.000000 1.000000
  Observed: 1.000000 0.000000 0.000000 1.000000
PIGLIT: {'result': 'fail' }
Comment 4 Vinson Lee 2010-11-24 16:13:36 UTC
I've commit the test case from attachment id=40543 to piglit.
Comment 5 Gordon Jin 2010-11-30 17:19:04 UTC
this is said as fixed:

Author: Eric Anholt <eric@anholt.net>
Date:   Tue Nov 30 11:23:28 2010 -0800

glsl: Fix structure and array comparisions.

We were trying to emit a single ir_expression to compare the whole
thing.  The backends (ir_to_mesa.cpp and brw_fs.cpp so far) expected
ir_binop_any_nequal or ir_binop_all_equal to apply to at most a vector
(with matrices broken down by the lowering pass).  Break them down to
a bunch of ORed or ANDed any_nequals/all_equals.

Fixes:
glsl-array-compare
glsl-array-compare-02
glsl-fs-struct-equal
glsl-fs-struct-notequal
Bug #31909
Comment 6 zhao jian 2010-12-02 17:20:13 UTC
(In reply to comment #5)
> this is said as fixed:
> Author: Eric Anholt <eric@anholt.net>
> Date:   Tue Nov 30 11:23:28 2010 -0800
> glsl: Fix structure and array comparisions.
> We were trying to emit a single ir_expression to compare the whole
> thing.  The backends (ir_to_mesa.cpp and brw_fs.cpp so far) expected
> ir_binop_any_nequal or ir_binop_all_equal to apply to at most a vector
> (with matrices broken down by the lowering pass).  Break them down to
> a bunch of ORed or ANDed any_nequals/all_equals.
> Fixes:
> glsl-array-compare
> glsl-array-compare-02
> glsl-fs-struct-equal
> glsl-fs-struct-notequal
> Bug #31909

Yes. It pass now with newest commit in mesa master branch. verified. 
Mesa:		(master)2bb788ccc674669bc03ad09e4396f079044112e8


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.