Bug 39251

Summary: Second Life viewers from release 2.7.4.235167 to the last 3.4.0.264911 crash on start.
Product: Mesa Reporter: Piero Finizio <andabata12>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: kenneth, shawn.starr
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: The problematic shader

Description Piero Finizio 2011-07-15 03:38:07 UTC
The crash comes with this declaration:
ir_dereference_variable @ 0x1409dbb8 specifies undeclared variable `texcoord' @ 0x141e7258.

OS: Fedora release 15 (Lovelock), Kernel: 2.6.38.8-35.fc15.i686 (i686), Desktop: KDE 4.6.3, Display Server: X Server 1.10.3, Display Driver: radeon 6.14.99, OpenGL: 2.1 Mesa 7.12-devel (git-d4be170) Gallium 0.4, Compiler: GCC 4.6.0 + llvm 2.8, File-System: ext4, Screen Resolution: 1280x800
Comment 1 Piero Finizio 2011-07-15 05:42:11 UTC
At the moment Second Life viewer 2.7.4.235167 is the last version (Released July 12, 2011).

strace output:

write(2, "2011-07-15T12:26:28Z INFO: loadS"..., 1232011-07-15T12:26:28Z INFO: loadShaderFile: Loading file: shaders/class2/lighting/lightFullbrightWaterF.glsl (Want class 2)
) = 123
write(2, "\33[0m", 4)                   = 4
write(3, "2011-07-15T12:26:28Z INFO: loadS"..., 123) = 123
gettimeofday({1310732788, 805000}, NULL) = 0
fstat64(27, {st_mode=S_IFREG|0644, st_size=421, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76e0000
read(27, "/** \n * @file lightFullbrightWat"..., 4096) = 421
read(27, "", 4096)                      = 0
close(27)                               = 0
munmap(0xb76e0000, 4096)                = 0
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76e0000
write(1, "ir_dereference_variable @ 0x1531"..., 91ir_dereference_variable @ 0x153183d8 specifies undeclared variable `texcoord' @ 0x15348a38
) = 91
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(19904, 19904, SIGABRT)           = 0
--- {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=19904, si_uid=0, si_value={int=4006612112, ptr=0xeed00c90}} (Aborted) ---
prctl(PR_SET_DUMPABLE, 1)               = 0
gettid()                                = 19904
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7300000
clone(child_stack=0xb7301f2c, flags=CLONE_FS|CLONE_FILES|CLONE_UNTRACED) = 19951
waitpid(19951, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], __WALL) = 19951
time(NULL)                              = 1310732788
write(2, "\33[1m", 4)                   = 4
Comment 2 Piero Finizio 2011-07-21 01:03:11 UTC
I have added version 2.7.5.235722 to the summary.
Anyway Lindens Labs in release notes talk about "Render Issues Related to Basic Shaders & Lighting and Shadows" and "in some cases, though not all, the impact is to older hardware": logically without basic shaders settings both  viewers work on rv530 GPUs...
Comment 3 Piero Finizio 2011-07-27 00:48:02 UTC
And viewer version 2.8.0.236429 crashes too with: OpenGL 2.1 Mesa 7.12-devel (git-b189d16) Gallium 0.4 and Compiler GCC 4.6.0 + llvm 2.8.
Comment 4 Piero Finizio 2011-07-27 02:08:30 UTC
Also  for the last release of viewer, 2.8.0.236429, Lindens Labs affirm in "Known Issues":
 "Render Issues Related to Basic Shaders & Lighting and Shadows
 There are a number of issues relating to having Basic Shaders and/or Lighting and Shadows turned On. In some cases, though not all, the impact is to older hardware."
So I think that this is not a problem pertaining  to Gallium3D and close the "bug".
Comment 5 Piero Finizio 2011-12-29 06:42:05 UTC
I reopen this bug because the "texcoord" problem persists in all the viewers from release 2.7.2.233432 (this excepted, 06-22-2011) to 3.2.4.246439, with all the official Mesa releases and compilations from git, contrariwise the blob drivers from hardware vendor,  for others gpu's than X1xx series, work.
The real problem is that Linden Lab after a certain period  (some months) doesn't permit the login to "old" viewers so with release 2.7.2.233432 I am in the condition of "the last of Mohicans", here : with newer viewers and RV530 I will log on the grid only without basic shaders...
Comment 6 Piero Finizio 2012-04-03 02:39:41 UTC
After the very recent  commits Of Kennet Graunke on git repository about "ir_derences_variables" i was expectant to resolve this problem  but I obtain again, with last  Sl viewer 3.3.0.251182:

2012-04-03T08:45:10Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightWaterF.glsl (Want class 1)
ir_dereference_variable @ 0xe929a08 specifies undeclared variable `texcoord' @ 0xe92a438

This happens after the attempt from Second Life viewer  to load  the subsequent shader lightShinyWaterNonIndexedF.glsl (attachment)


If i remove this file I logically obtain

012-04-03T09:09:38Z WARNING: loadShaderFile: GLSL Shader file not found: lighting/lightShinyWaterNonIndexedF.glsl

but the viewer boots and permits high graphic settings but without necessary shaders for water sea reflections and sky consistence


Does a workaround exist  to finally boot the SL viewer ( the last version 3.x is mesh capable too) out of box  with Mesa?
Comment 7 Piero Finizio 2012-04-03 02:40:53 UTC
Created attachment 59411 [details]
The problematic shader
Comment 8 Shawn Starr 2012-07-22 02:17:56 UTC
I confirm this also still:

2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightAlphaMaskF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightWaterF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightWaterAlphaMaskF.glsl (Want class 1)
2012-07-22T02:13:10Z INFO: llrender/llshadermgr.cpp(568) : loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightWaterF.glsl (Want class 1)
ir_dereference_variable @ 0xc519d68 specifies undeclared variable `texcoord' @ 0xc3b9a38
Comment 9 Piero Finizio 2012-09-25 07:51:00 UTC
The backtrace of this ancient phenomenon:

ir_dereference_variable @ 0x1116b278 specifies undeclared variable `texcoord' @ 0x1116e1f8

Program received signal SIGABRT, Aborted.
0xb7fff424 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.25-3.fc17.i686 alsa-plugins-pulseaudio-1.0.25-3.fc17.i686 atk-2.4.0-1.fc17.i686 dbus-glib-0.98-2.fc17.i686 dbus-libs-1.4.10-4.fc17.i686 flac-1.2.1-9.fc17.i686 fontconfig-2.8.0-8.fc17.i686 freetype-freeworld-2.4.8-3.fc17.i686 gamin-0.1.10-12.fc17.i686 gdk-pixbuf2-2.26.1-1.fc17.i686 glibc-2.15-56.fc17.i686 gsm-1.0.13-6.fc17.i686 gtk2-2.24.11-1.fc17.i686 gvfs-1.12.3-1.fc17.i686 json-c-0.9-4.fc17.i686 libICE-1.0.8-1.fc17.i686 libSM-1.2.1-1.fc17.i686 libX11-1.5.0-2.fc17.i686 libXau-1.0.6-3.fc17.i686 libXcomposite-0.4.3-3.fc17.i686 libXcursor-1.1.13-1.fc17.i686 libXdamage-1.1.3-3.fc17.i686 libXext-1.3.1-1.fc17.i686 libXfixes-5.0-2.fc17.i686 libXi-1.6.1-1.fc17.i686 libXinerama-1.1.2-1.fc17.i686 libXrandr-1.3.1-3.fc17.i686 libXrender-0.9.7-1.fc17.i686 libXtst-1.2.0-3.fc17.i686 libXxf86vm-1.1.2-1.fc17.i686 libasyncns-0.8-3.fc17.i686 libbluray-0.2.3-1.fc17.i686 libffi-3.0.10-2.fc17.i686 libgcc-4.7.0-5.fc17.i686 libogg-1.3.0-1.fc17.i686 libselinux-2.1.10-3.fc17.i686 libsndfile-1.0.25-2.fc17.i686 libstdc++-4.7.0-5.fc17.i686 libtxc_dxtn-1.0.0-2.fc17.i686 libvorbis-1.3.3-1.fc17.i686 libxcb-1.8.1-1.fc17.i686 libxml2-2.7.8-7.fc17.i686 mesa-libGLU-8.0.3-1.fc17.i686 nss-mdns-0.10-10.fc17.i686 nss-softokn-freebl-3.13.5-1.fc17.i686 oxygen-gtk2-1.3.0-1.fc17.i686 pango-1.30.0-1.fc17.i686 pulseaudio-libs-1.1-9.fc17.i686 tcp_wrappers-libs-7.6-69.fc17.i686 zlib-1.2.5-7.fc17.i686
(gdb) bt
#0  0xb7fff424 in __kernel_vsyscall ()
#1  0x4f0cd93f in raise () from /lib/libc.so.6
#2  0x4f0cf293 in abort () from /lib/libc.so.6
#3  0xb248e2d2 in visit (ir=0x1116b278, this=<optimized out>)
    at ../../src/glsl/ir_validate.cpp:96
#4  ir_validate::visit (this=0xbfff9414, ir=0x1116b278) at ../../src/glsl/ir_validate.cpp:84
#5  0xb2488837 in ir_dereference_variable::accept (this=0x1116b278, v=0xbfff9414)
    at ../../src/glsl/ir_hv_accept.cpp:259
#6  0xb24882ec in visit_list_elements (v=v@entry=0xbfff9414, l=l@entry=0x1114c530, 
    statement_list=statement_list@entry=false) at ../../src/glsl/ir_hv_accept.cpp:56
#7  0xb2488a7b in ir_call::accept (this=0x1114c518, v=0xbfff9414)
    at ../../src/glsl/ir_hv_accept.cpp:344
#8  0xb24882ec in visit_list_elements (v=v@entry=0xbfff9414, l=l@entry=0x110f5a7c, 
    statement_list=statement_list@entry=true) at ../../src/glsl/ir_hv_accept.cpp:56
#9  0xb24884e3 in ir_function_signature::accept (this=0x110f5a58, v=0xbfff9414)
    at ../../src/glsl/ir_hv_accept.cpp:136
#10 0xb24882ec in visit_list_elements (v=v@entry=0xbfff9414, l=l@entry=0x1114c5ac, 
    statement_list=statement_list@entry=false) at ../../src/glsl/ir_hv_accept.cpp:56
#11 0xb2488577 in ir_function::accept (this=0x1114c598, v=0xbfff9414)
    at ../../src/glsl/ir_hv_accept.cpp:148
#12 0xb24882ec in visit_list_elements (v=0xbfff9414, l=0x1115f5d8, statement_list=true)
    at ../../src/glsl/ir_hv_accept.cpp:56
#13 0xb248823b in ir_hierarchical_visitor::run (this=0xbfff9414, instructions=0x1115f5d8)
    at ../../src/glsl/ir_hierarchical_visitor.cpp:291
#14 0xb248e4c5 in validate_ir_tree (instructions=0x1115f5d8)
    at ../../src/glsl/ir_validate.cpp:662
---Type <return> to continue, or q <return> to quit---
#15 0xb244fe48 in _mesa_glsl_compile_shader (ctx=ctx@entry=0xa946000, 
    shader=shader@entry=0x1114b148) at ../../src/mesa/program/ir_to_mesa.cpp:3084
#16 0xb23f88b6 in compile_shader (ctx=0xa946000, shaderObj=<optimized out>)
    at ../../src/mesa/main/shaderapi.c:722
#17 0x08dac3a7 in LLShaderMgr::loadShaderFile(std::string const&, int&, unsigned int, int)
    ()
#18 0x08a07c7a in LLViewerShaderMgr::loadBasicShaders() ()
#19 0x08a0ee11 in LLViewerShaderMgr::setShaders() ()
#20 0x0880b7e7 in idle_startup() ()
#21 0x08182a15 in LLAppViewer::idle() ()
#22 0x081848ec in LLAppViewer::mainLoop() ()
#23 0x08bd6836 in main ()
-------------
Comment 10 Piero Finizio 2012-10-16 10:26:10 UTC
As usual...


ir_dereference_variable @ 0xe391588 specifies undeclared variable `texcoord' @ 0xe38f738

Program received signal SIGABRT, Aborted.
0xb7fff424 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.26-1.fc17.i686 atk-2.4.0-1.fc17.i686 dbus-glib-0.98-2.fc17.i686 dbus-libs-1.4.10-5.fc17.i686 fontconfig-2.8.0-8.fc17.i686 freetype-freeworld-2.4.8-3.fc17.i686 gdk-pixbuf2-2.26.1-1.fc17.i686 glibc-2.15-57.fc17.i686 gtk2-2.24.11-1.fc17.i686 json-c-0.9-4.fc17.i686 libICE-1.0.8-1.fc17.i686 libSM-1.2.1-1.fc17.i686 libX11-1.5.0-2.fc17.i686 libXau-1.0.6-3.fc17.i686 libXcomposite-0.4.3-3.fc17.i686 libXcursor-1.1.13-1.fc17.i686 libXdamage-1.1.3-3.fc17.i686 libXext-1.3.1-1.fc17.i686 libXfixes-5.0-2.fc17.i686 libXi-1.6.1-1.fc17.i686 libXinerama-1.1.2-1.fc17.i686 libXrandr-1.3.1-3.fc17.i686 libXrender-0.9.7-1.fc17.i686 libXtst-1.2.0-3.fc17.i686 libXxf86vm-1.1.2-1.fc17.i686 libasyncns-0.8-3.fc17.i686 libffi-3.0.10-2.fc17.i686 libgcc-4.7.2-2.fc17.i686 libselinux-2.1.10-3.fc17.i686 libstdc++-4.7.2-2.fc17.i686 libtxc_dxtn-1.0.0-2.fc17.i686 libuuid-2.21.2-2.fc17.i686 libxcb-1.8.1-1.fc17.i686 mesa-libGLU-8.0.3-1.fc17.i686 nss-softokn-freebl-3.13.5-1.fc17.i686 pango-1.30.0-1.fc17.i686 pulseaudio-libs-1.1-9.fc17.i686 tcp_wrappers-libs-7.6-69.fc17.i686 zlib-1.2.5-7.fc17.i686
(gdb) bt
#0  0xb7fff424 in __kernel_vsyscall ()
#1  0x4418693f in raise () from /lib/libc.so.6
#2  0x44188293 in abort () from /lib/libc.so.6
#3  0xb29a9ce2 in ir_validate::visit(ir_dereference_variable*) ()
   from /usr/local/lib/dri//r300_dri.so
#4  0xb29a4367 in ir_dereference_variable::accept(ir_hierarchical_visitor*) ()
   from /usr/local/lib/dri//r300_dri.so
#5  0xb29a3e6c in visit_list_elements(ir_hierarchical_visitor*, exec_list*, bool)
    () from /usr/local/lib/dri//r300_dri.so
#6  0xb29a4596 in ir_call::accept(ir_hierarchical_visitor*) ()
   from /usr/local/lib/dri//r300_dri.so
#7  0xb29a3e6c in visit_list_elements(ir_hierarchical_visitor*, exec_list*, bool)
    () from /usr/local/lib/dri//r300_dri.so
#8  0xb29a4023 in ir_function_signature::accept(ir_hierarchical_visitor*) ()
   from /usr/local/lib/dri//r300_dri.so
#9  0xb29a3e6c in visit_list_elements(ir_hierarchical_visitor*, exec_list*, bool)
    () from /usr/local/lib/dri//r300_dri.so
#10 0xb29a40a7 in ir_function::accept(ir_hierarchical_visitor*) ()
   from /usr/local/lib/dri//r300_dri.so
#11 0xb29a3e6c in visit_list_elements(ir_hierarchical_visitor*, exec_list*, bool)
    () from /usr/local/lib/dri//r300_dri.so
#12 0xb29a3dcb in ir_hierarchical_visitor::run(exec_list*) ()
   from /usr/local/lib/dri//r300_dri.so
---Type <return> to continue, or q <return> to quit---
#13 0xb29a9ed2 in validate_ir_tree(exec_list*) ()
   from /usr/local/lib/dri//r300_dri.so
#14 0xb296bb38 in _mesa_glsl_compile_shader ()
   from /usr/local/lib/dri//r300_dri.so
#15 0xb29148e6 in compile_shader () from /usr/local/lib/dri//r300_dri.so
#16 0x096a4198 in LLShaderMgr::loadShaderFile(std::string const&, int&, unsigned int, int) ()
#17 0x091caff2 in LLViewerShaderMgr::loadBasicShaders() ()
#18 0x091e23cd in LLViewerShaderMgr::setShaders() ()
#19 0x09459309 in LLPipeline::init() ()
#20 0x082928a5 in LLAppViewer::initWindow() ()
#21 0x082b0906 in LLAppViewer::init() ()
#22 0x09470f89 in LLAppViewerLinux::init() ()
#23 0x0947142b in main ()
Comment 11 Kenneth Graunke 2013-05-01 01:55:57 UTC
I just committed a patch to Mesa master which fixed very similar looking crashes:

commit 6c5cf8baa10f0bfdf1e61d944f24fdd7947b2a82
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue Apr 30 00:58:09 2013 -0700

    glsl: Ignore redundant prototypes after a function's been defined.

Could you build the latest Mesa master and give it a try?  Thanks!
Comment 12 Piero Finizio 2013-05-02 11:36:56 UTC
It works!
...
2013-05-02T10:02:27Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightShinyWaterNonIndexedF.glsl (Want class 1)
2013-05-02T10:02:27Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightShinyWaterNonIndexedF.glsl (Want class 1)
2013-05-02T10:02:27Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightF.glsl (Want class 1)
2013-05-02T10:02:27Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightAlphaMaskF.glsl (Want class 1)
2013-05-02T10:02:27Z INFO: loadShaderFile: Loading file: shaders/class1/lighting/lightFullbrightF.glsl (Want class 1)
...

Kernel: 3.9.0-0.rc8.git0.1.fc19.i686 (i686) Display, X Server 1.13.3, Compiler: GCC 4.7.2 20121109 + LLVM 3.2svn.
OpenGL renderer string: Gallium 0.4 on ATI RV530
OpenGL version string: 2.1 Mesa 9.2.0 (git-dd62e7b)

Second Life viewer 3.5.1 (274821)


This is a great commit, it means that *now* official Second Life viewer works out of box with open source graphics driver on Linux distributions.
Thank you very much.
Comment 13 Kenneth Graunke 2013-05-02 18:35:03 UTC
Excellent!  Thanks.

Fixed on master by:
commit 6c5cf8baa10f0bfdf1e61d944f24fdd7947b2a82
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue Apr 30 00:58:09 2013 -0700

    glsl: Ignore redundant prototypes after a function's been defined.
    
    Consider the following shader:
    
        vec4 f(vec4 v) { return v; }
        vec4 f(vec4 v);
    
    The prototype exactly matches the signature of the earlier definition,
    so there's absolutely no point in it.  However, it doesn't appear to
    be illegal.  The GLSL 4.30 specification offers two relevant quotes:
    
    "If a function name is declared twice with the same parameter types,
     then the return types and all qualifiers must also match, and it is the
     same function being declared."
    
    "User-defined functions can have multiple declarations, but only one
     definition."
    
    In this case the same function was declared twice, and there's only one
    definition, which fits both pieces of text.  There doesn't appear to be
    any text saying late prototypes are illegal, so presumably it's valid.
    
    Unfortunately, it currently triggers an assertion failure:
    ir_dereference_variable @ <p1> specifies undeclared variable `v' @ <p2>
    
    When we process the second line, we look for an existing exact match so
    we can enforce the one-definition rule.  We then leave sig set to that
    existing function, and hit sig->replace_parameters(&hir_parameters),
    unfortunately nuking our existing definition's parameters (which have
    actual dereferences) with the prototype's bogus unused parameters.
    
    Simply bailing out and ignoring such late prototypes is the safest
    thing to do.
    
    Fixes Piglit's late-proto.vert as well as 3DMark/Ice Storm for Android.
    
    NOTE: This is a candidate for stable branches.
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Tested-by: Tapani Pälli <tapani.palli@intel.com>
    Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Reviewed-by: Ian Romanick <idr@freedesktop.org>

Closing as fixed.

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.