Bug 111664

Summary: [Bisected] Segmentation fault on FS shader compilation (mat4x3 * mat4x3)
Product: Mesa Reporter: andrii simiklit <andrey.simiklit.1989>
Component: Drivers/DRI/i965Assignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED MOVED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: not set    
Priority: not set Keywords: bisected, regression
Version: git   
Hardware: Other   
OS: All   
i915 platform: i915 features:

Description andrii simiklit 2019-09-11 14:36:26 UTC
This issue is reproducible on latest master.

FS which causes a crash:
#version 430
out vec4 color;
void main()
    mat4x3 a;
    a = mat4x3(1.0);
    mat4x3 b;
    b = mat4x3(3.0);
    b *= a;
    color = b[0].xyzz;

Just save it as 'test.frag' in piglit folder and execute:
"./bin/glslparsertest test.frag pass 4.30"

You will see an error like:
"ir_swizzle @ 0x5637f74315f0 specifies a channel not present in the value.
 Aborted (core dumped)"

I guess that root cause is because mesa allows such multiplications.
I don't know the reason why mesa allows such multiplication but it should be wrong because of glsl spec is saying "5.9 Expressions":

"The operator is multiply (*), where both operands are matrices or one operand is a vector and the
 other a matrix. A right vector operand is treated as a column vector and a left vector operand as a
 row vector. In all these cases, it is required that the number of columns of the left operand is equal
 to the number of rows of the right operand"

On shader-playground this shader just fails with an error:
'assign' :  cannot convert from ' temp 4X3 matrix of float' to ' temp 4X3 matrix of float'

Note: radv passes this test without errors and crash that also strange)

I am almost done a mesa fix and the piglit test for that.
Comment 1 andrii simiklit 2019-09-11 14:43:56 UTC
Bisected to: 
 ad55b1a7701ad51234af3b9fc30f4c54d2546b86 is the first bad commit
 commit ad55b1a7701ad51234af3b9fc30f4c54d2546b86
 Author: Timothy Arceri <timothy.arceri@collabora.com>
 Date: Wed Jan 18 10:28:22 2017 +1100

 i965: remove GLSL IR optimisation loop
Comment 2 andrii simiklit 2019-09-11 15:19:55 UTC
The suggested solution:

Test is in progress. Will be tomorrow.
Comment 3 andrii simiklit 2019-09-12 12:10:20 UTC
Test for that is here:
Comment 4 GitLab Migration User 2019-09-25 20:35:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1835.

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.