Bug 43568 - [glsl 1.30] program aborted when links if compare textureLod and textureGrad many times
Summary: [glsl 1.30] program aborted when links if compare textureLod and textureGrad ...
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: Ian Romanick
QA Contact:
Keywords: NEEDINFO
Depends on:
Reported: 2011-12-07 01:28 UTC by zhao jian
Modified: 2012-02-02 19:28 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

piglit test case to reproduce it (5.80 KB, text/plain)
2011-12-07 01:28 UTC, zhao jian

Description zhao jian 2011-12-07 01:28:00 UTC
Created attachment 54172 [details]
piglit test case to reproduce it

System Environment:
Arch:           i386
Platform:       SandyBridge 
Libdrm: Libdrm: (master)2.4.27-4-g36cff1cbb89477c839588a7e40fec2a8db7df396
Mesa:           (master)887c349d543d5b6d681845eb441be88acb8e0063
Kernel:    (drm-intel-next)9a10f401a401ca69c6537641c8fc0d6b57b5aee8

Bug detailed description:
When compared textureLod and textureGrad for many times it will abort. I attached a piglit case can reproduce it. And as in the fragment shader, if I make iteration step dPdx and dPdy larger, it will pass without segment fault. But it seems also pass if set the iteration step to 1.  

(gdb) r
Starting program: /GFX/build/testsuite/Piglit/piglit/bin/glsl-tex-grad -auto
[Thread debugging using libthread_db enabled]
glsl-tex-grad: program/ir_to_mesa.cpp:2365: prog_src_register mesa_src_reg_from_ir_src_reg(src_reg): Assertion `reg.index < (1 << 12)' failed.

Program received signal SIGABRT, Aborted.
0xb7fff424 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-11.fc15.i686 freeglut-2.6.0-6.fc15.i686 glibc-2.14-4.i686 libXdamage-1.1.3-2.fc15.i686 libXdmcp-1.1.0-2.fc15.i686 libXfixes-5.0-1.fc15.i686 libXxf86vm-1.1.1-2.fc15.i686 libgcc-4.6.0-10.fc15.i686 libstdc++-4.6.0-10.fc15.i686
(gdb) bt

#0  0xb7fff424 in __kernel_vsyscall ()
#1  0x4716d26f in raise () from /lib/libc.so.6
#2  0x4716eba5 in abort () from /lib/libc.so.6
#3  0x47165cc5 in __assert_fail_base () from /lib/libc.so.6
#4  0x47165d77 in __assert_fail () from /lib/libc.so.6
#5  0xb7b3e527 in mesa_src_reg_from_ir_src_reg (reg=<optimized out>) at program/ir_to_mesa.cpp:2365
#6  mesa_src_reg_from_ir_src_reg (reg=<optimized out>) at program/ir_to_mesa.cpp:3460
#7  get_mesa_program (shader=0x842f2e0, shader_program=0x82c06c0, ctx=0x80c7618) at program/ir_to_mesa.cpp:3108
#8  _mesa_ir_link_shader (ctx=0x80c7618, prog=0x82c06c0) at program/ir_to_mesa.cpp:3303
#9  0xb79b5872 in brw_link_shader (ctx=0x80c7618, prog=0x82c06c0) at brw_shader.cpp:86
#10 0xb7b3e99a in _mesa_glsl_link_shader (ctx=0x80c7618, prog=0x82c06c0) at program/ir_to_mesa.cpp:3439
#11 0xb7a3ed66 in link_program (ctx=0x80c7618, program=<optimized out>) at main/shaderapi.c:760
#12 0x0806c4b4 in piglit_init (argc=1, argv=0xbffff374)
    at /GFX/build/testsuite/Piglit/piglit/tests/shaders/glsl-tex-grad.c:58
#13 0x0806d1c1 in main (argc=1, argv=0xbffff374)
    at /GFX/build/testsuite/Piglit/piglit/tests/util/piglit-framework.c:288
Comment 1 Ian Romanick 2012-01-12 11:41:30 UTC
This may be fixed by the following commit, can you please retest?

commit 1c177452005a0366db01629d875da553f7949ddd
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri Jan 6 16:26:49 2012 -0800

    i965: Don't use _mesa_ir_link_shader to do our dirty work
    Instead, do the uniform setting and input / output mapping directly in
    brw_link_shader.  Hurray for not generating Mesa IR!  However, once
    the i965 driver stops calling _mesa_ir_link_shader, UsesClipDistance
    and UsesKill are no longer set.
    Ideally gen6_upload_vs_push_constants should use the
    gl_shader_program, but I don't see a way to propagate the information
    there.  The other alternative, since this is the only usage, is to
    move gl_vertex_program::UsesClipDistance to brw_vertex_program.
    The compile (and precompile) stages use UsesKill to determine the
    cache key for the shader.  This is then used to determine whether or
    not to compile the shader.  Calculating this data during compilation
    is too late.
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Acked-by: Kenneth Graunke <kenneth@whitecape.org>
    Acked-by: Eric Anholt <eric@anholt.net>
Comment 2 zhao jian 2012-02-02 19:28:33 UTC
verified with the newest code in mesa.

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.