Bug 33555

Summary: [softpipe] tgsi/tgsi_sse2.c:1527:emit_tex: Assertion `0' failed.
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: Brian Paul <brianp>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: low    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: add missing switch cases

Description Vinson Lee 2011-01-26 14:00:19 UTC
mesa: 3fe0185ba506b830b86f0e39d2e366400ecffae6 (master)

Run piglit array-texture test.

$ ./bin/array-texture -auto
tgsi/tgsi_sse2.c:1527:emit_tex: Assertion `0' failed.

(gdb) bt
#0  0xb765e1b9 in _debug_assert_fail (expr=0xb7777e35 "0", file=0xb7777d4b "tgsi/tgsi_sse2.c", line=1527, 
    function=0xb7777e6b "emit_tex") at util/u_debug.c:276
#1  0xb7653640 in emit_tex (func=0x9a5cf78, inst=0xbfd1ae3c, lodbias=0 '\0', projected=0 '\0') at tgsi/tgsi_sse2.c:1527
#2  0xb765680a in emit_instruction (func=0x9a5cf78, inst=0xbfd1ae3c) at tgsi/tgsi_sse2.c:2371
#3  0xb7658d42 in tgsi_emit_sse2 (tokens=0x98a9868, func=0x9a5cf78, immediates=0x9a5cf94, do_swizzles=0 '\0')
    at tgsi/tgsi_sse2.c:3013
#4  0xb74031c2 in softpipe_create_fs_sse (softpipe=0x96b9ea8, templ=0x994096c) at sp_fs_sse.c:216
#5  0xb73f93c8 in softpipe_create_fs_state (pipe=0x96b9ea8, templ=0x994096c) at sp_state_shader.c:58
#6  0xb761d405 in aaline_create_fs_state (pipe=0x96b9ea8, fs=0x994096c) at draw/draw_pipe_aaline.c:840
#7  0xb761f5a0 in aapoint_create_fs_state (pipe=0x96b9ea8, fs=0x994096c) at draw/draw_pipe_aapoint.c:831
#8  0xb7622e28 in pstip_create_fs_state (pipe=0x96b9ea8, fs=0x994096c) at draw/draw_pipe_pstipple.c:667
#9  0xb74d943c in st_translate_fragment_program (st=0x97b1548, stfp=0x993c6d0, key=0xbfd1b2a4)
    at state_tracker/st_program.c:625
#10 0xb74d9537 in st_get_fp_variant (st=0x97b1548, stfp=0x993c6d0, key=0xbfd1b2a4) at state_tracker/st_program.c:656
#11 0xb75d0f27 in update_fp (st=0x97b1548) at state_tracker/st_atom_shader.c:86
#12 0xb75ccfed in st_validate_state (st=0x97b1548) at state_tracker/st_atom.c:176
#13 0xb74d311e in st_draw_vbo (ctx=0x9770b98, arrays=0x97b3f28, prims=0x97b287c, nr_prims=1, ib=0x0, 
    index_bounds_valid=1 '\001', min_index=0, max_index=3) at state_tracker/st_draw.c:660
#14 0xb75c0087 in vbo_exec_vtx_flush (exec=0x97b2708, unmap=1 '\001') at vbo/vbo_exec_draw.c:382
#15 0xb75bbceb in vbo_exec_FlushVertices_internal (ctx=0x9770b98, unmap=1 '\001') at vbo/vbo_exec_api.c:912
#16 0xb75bbdf9 in vbo_exec_FlushVertices (ctx=0x9770b98, flags=1) at vbo/vbo_exec_api.c:946
#17 0xb749babd in _mesa_ReadPixels (x=50, y=50, width=1, height=1, format=6407, type=5126, pixels=0xbfd1b8f4)
    at main/readpix.c:172
#18 0x0804ca31 in piglit_probe_pixel_rgb ()
#19 0x0804bf5f in test_2d_array_texture ()
#20 0x0804c288 in piglit_display ()
#21 0x0804e4af in display ()
#22 0xb72e35bb in ?? () from /usr/lib/libglut.so.3
#23 0xb72e6ea3 in fgEnumWindows () from /usr/lib/libglut.so.3
#24 0xb72e3f80 in glutMainLoopEvent () from /usr/lib/libglut.so.3
#25 0xb72e43dd in glutMainLoop () from /usr/lib/libglut.so.3
#26 0x0804e683 in main ()
gdb) frame 1
#1  0xb7653640 in emit_tex (func=0x9a5cf78, inst=0xbfd1ae3c, lodbias=0 '\0', projected=0 '\0') at tgsi/tgsi_sse2.c:1527
1527	      assert(0);
(gdb) l
1522	   case TGSI_TEXTURE_3D:
1523	   case TGSI_TEXTURE_CUBE:
1524	      count = 3;
1525	      break;
1526	   default:
1527	      assert(0);
1528	      return;
1529	   }
1530	
1531	   if (lodbias) {
(gdb) print inst->Texture
$1 = {Texture = 10, Padding = 0}


src/gallium/auxiliary/tgsi/tgsi_sse2.c
  1499  static void
  1500  emit_tex( struct x86_function *func,
  1501            const struct tgsi_full_instruction *inst,
  1502            boolean lodbias,
  1503            boolean projected)
  1504  {
  1505     const uint unit = inst->Src[1].Register.Index;
  1506     struct x86_reg args[2];
  1507     unsigned count;
  1508     unsigned i;
  1509  
  1510     assert(inst->Instruction.Texture);
  1511     switch (inst->Texture.Texture) {
  1512     case TGSI_TEXTURE_1D:
  1513        count = 1;
  1514        break;
  1515     case TGSI_TEXTURE_2D:
  1516     case TGSI_TEXTURE_RECT:
  1517        count = 2;
  1518        break;
  1519     case TGSI_TEXTURE_SHADOW1D:
  1520     case TGSI_TEXTURE_SHADOW2D:
  1521     case TGSI_TEXTURE_SHADOWRECT:
  1522     case TGSI_TEXTURE_3D:
  1523     case TGSI_TEXTURE_CUBE:
  1524        count = 3;
  1525        break;
  1526     default:
  1527        assert(0);
  1528        return;
  1529     }


I've only reproduced the crash on Ubuntu 9.04. The crash does not occur on Ubuntu 9.10 or Ubuntu 10.10, as array-texture is skipped. GL_EXT_texture_array seems to only get enabled on Ubuntu 9.04.
Comment 1 Brian Paul 2011-01-26 14:42:33 UTC
Created attachment 42562 [details] [review]
add missing switch cases

Can you try this patch, Vinson?
Comment 2 Vinson Lee 2011-01-26 15:02:28 UTC
The test passes on Ubuntu 9.04 with attached patch 42562.
Comment 3 Brian Paul 2011-01-26 15:23:12 UTC
Patch committed.  8697dbdfbcb6c5cf256658ed6cb2277040b586d2
Comment 4 Vinson Lee 2011-02-09 15:26:44 UTC
mesa: 3b8bb7b449dae6c16df0fa45e6567ec3d6b05dcc (master)

Verified 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.