Bug 31648 - [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
Summary: [GLSL] array-struct-array gets assertion: `(size >= 1) && (size <= 4)' failed.
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 7.10
Hardware: All Linux (All)
: medium critical
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
: 52996 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-15 17:46 UTC by Gordon Jin
Modified: 2012-10-18 21:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
new piglit case (3.92 KB, patch)
2010-11-15 17:47 UTC, Gordon Jin
Details | Splinter Review
updated piglit case (3.92 KB, patch)
2010-11-15 18:21 UTC, Gordon Jin
Details | Splinter Review

Description Gordon Jin 2010-11-15 17:46:51 UTC
Below shader gets assertion
program/ir_to_mesa.cpp:325: int swizzle_for_size(int): Assertion `(size >= 1) && (size <= 4)' failed.


struct s {
	vec4 v[1];
	float f;
};
s a[1];

void main()
{
	a[0].v[0] = vec4(0.0, 0.0, 0.0, 0.0);
	a[0].f = 1.0;
	gl_FragColor = vec4(0.0, a[0].f, 0.0 ,1.0);
}



Tested on Piketon (i965) with mesa master.

New piglit case attached.

Note both v and a needs to be array to trigger this issue.
Comment 1 Gordon Jin 2010-11-15 17:47:29 UTC
Created attachment 40295 [details] [review]
new piglit case
Comment 2 Gordon Jin 2010-11-15 18:21:01 UTC
Created attachment 40297 [details] [review]
updated piglit case
Comment 3 Vinson Lee 2010-11-24 16:55:35 UTC
I've committed the test case in attachment id=40297 to piglit.
Comment 4 Vinson Lee 2010-12-03 17:03:37 UTC
mesa: 6c33e820d5fe740ac4735d8bab864177dd1b2f14 (master)

(gdb) bt
#0  0x00eb7422 in __kernel_vsyscall ()
#1  0x002fe651 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x00301a82 in *__GI_abort () at abort.c:92
#3  0x002f7718 in *__GI___assert_fail (assertion=0xcce1d3 "(size >= 1) && (size <= 4)", file=0xcce1bc "program/ir_to_mesa.cpp", line=335, 
    function=0xccf5a1 "int swizzle_for_size(int)") at assert.c:81
#4  0x00aef71f in swizzle_for_size (size=0) at program/ir_to_mesa.cpp:335
#5  0x00af4931 in ir_to_mesa_visitor::visit (this=0xbfff20a0, ir=0x9d86150) at program/ir_to_mesa.cpp:1572
#6  0x00b1f67d in ir_dereference_record::accept (this=0x9d86150, v=0xbfff20a0) at ir.h:1439
#7  0x00af45dc in ir_to_mesa_visitor::visit (this=0xbfff20a0, ir=0x9d86300) at program/ir_to_mesa.cpp:1520
#8  0x00b1f63b in ir_dereference_array::accept (this=0x9d86300, v=0xbfff20a0) at ir.h:1405
#9  0x00af4a16 in get_assignment_lhs (ir=0x9d86300, v=0xbfff20a0) at program/ir_to_mesa.cpp:1597
#10 0x00af4c2c in ir_to_mesa_visitor::visit (this=0xbfff20a0, ir=0x9d864b0) at program/ir_to_mesa.cpp:1698
#11 0x00b1f307 in ir_assignment::accept (this=0x9d864b0, v=0xbfff20a0) at ir.h:642
#12 0x00af10c8 in ir_to_mesa_visitor::visit (this=0xbfff20a0, ir=0x9d85d18) at program/ir_to_mesa.cpp:915
#13 0x00b1f291 in ir_function::accept (this=0x9d85d18, v=0xbfff20a0) at ir.h:475
#14 0x00b2b7e1 in visit_exec_list (list=0x9cd0f88, visitor=0xbfff20a0) at ir.cpp:1400
#15 0x00af82b6 in get_mesa_program (ctx=0x9c5b648, shader_program=0x9d75558, shader=0x9cc6b38) at program/ir_to_mesa.cpp:2667
#16 0x00af8e17 in _mesa_ir_link_shader (ctx=0x9c5b648, prog=0x9d75558) at program/ir_to_mesa.cpp:2895
#17 0x00af9444 in _mesa_glsl_link_shader (ctx=0x9c5b648, prog=0x9d75558) at program/ir_to_mesa.cpp:3049
#18 0x00a9ba33 in link_program (ctx=0x9c5b648, program=2) at main/shaderapi.c:882
#19 0x00a9cca9 in _mesa_LinkProgramARB (programObj=2) at main/shaderapi.c:1445
#20 0x0804b5ae in piglit_init (argc=1, argv=0xbfff2344) at piglit/tests/shaders/glsl-link-struct-array.c:73
#21 0x0804d723 in main (argc=1, argv=0xbfff2344) at piglit/tests/util/piglit-framework.c:116
(gdb) frame 4
#4  0x00aef71f in swizzle_for_size (size=0) at program/ir_to_mesa.cpp:335
335	   assert((size >= 1) && (size <= 4));
Comment 5 Ian Romanick 2010-12-13 15:53:47 UTC
commit 2d577ee730c30caacf711babde6542766aa0b655
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Dec 13 15:42:46 2010 -0800

    ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    
    This is the same as what the array dereference handler does.
    
    Fixes piglit test glsl-link-struct-array (bugzilla #31648).
    
    NOTE: This is a candidate for the 7.9 and 7.10 branches.
Comment 6 Ian Romanick 2011-01-03 16:52:21 UTC
commit 3501fd85942dc905de53710e3a57f16641e4e70d
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Dec 13 15:42:46 2010 -0800

    ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors
    
    This is the same as what the array dereference handler does.
    
    Fixes piglit test glsl-link-struct-array (bugzilla #31648).
    
    NOTE: This is a candidate for the 7.9 and 7.10 branches.
    (cherry picked from commit 2d577ee730c30caacf711babde6542766aa0b655)
Comment 7 Gordon Jin 2011-01-04 19:33:44 UTC
verified on 7.10 branch
Comment 8 Ian Romanick 2012-10-18 21:58:05 UTC
*** Bug 52996 has been marked as a duplicate of this bug. ***


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.