Bug 43355

Summary: state_tracker/st_mesa_to_tgsi.c:296:translate_texture_target: Assertion `0' failed.
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED WORKSFORME QA Contact:
Severity: critical    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2011-11-29 16:24:31 UTC
mesa: ccd4d4367f2b4e5aebfc59b832599812a4a1c7d8 (master)

Run piglit test draw-pixel-with-texture on softpipe, llvmpipe, r300g, or r600g. The test triggers an assert.

$ ./bin/draw-pixel-with-texture -auto
state_tracker/st_mesa_to_tgsi.c:296:translate_texture_target: Assertion `0' failed.
Trace/breakpoint trap (core dumped)

(gdb) bt
#0  0x00421769 in _debug_assert_fail (expr=0x586db3 "0", file=0x586d04 "state_tracker/st_mesa_to_tgsi.c", line=296, function=0x5873ae "translate_texture_target") at util/u_debug.c:278
#1  0x003c2768 in translate_texture_target (textarget=0, shadow=0 '\000') at state_tracker/st_mesa_to_tgsi.c:296
#2  0x002ca552 in compile_tgsi_instruction (t=0x9ab0a38, inst=0x9a60198) at state_tracker/st_glsl_to_tgsi.cpp:4256
#3  0x002cbf08 in st_translate_program (ctx=0x9977bc8, procType=0, ureg=0x9aac668, program=0x9a5fce8, proginfo=0x9a9c300, numInputs=1, inputMapping=0xbfa33e34, 
    inputSemanticName=0xbfa33f7c "\005\036;", inputSemanticIndex=0xbfa33f5c "", interpMode=0xbfa33db4, numOutputs=1, outputMapping=0xbfa33eb4, outputSemanticName=0xbfa33f3c "\001\327:", 
    outputSemanticIndex=0xbfa33f1c "", passthrough_edgeflags=0 '\000') at state_tracker/st_glsl_to_tgsi.cpp:4748
#4  0x00286c54 in st_translate_fragment_program (st=0x99d1ff8, stfp=0x9a9c300, key=0xbfa34000) at state_tracker/st_program.c:653
#5  0x00286e53 in st_get_fp_variant (st=0x99d1ff8, stfp=0x9a6b770, key=0xbfa34000) at state_tracker/st_program.c:728
#6  0x003bb9dd in get_color_fp_variant (st=0x99d1ff8) at state_tracker/st_cb_drawpixels.c:1008
#7  0x003bbc10 in st_DrawPixels (ctx=0x9977bc8, x=0, y=0, width=100, height=100, format=6408, type=5126, unpack=0x99866b4, pixels=0xae19f008) at state_tracker/st_cb_drawpixels.c:1089
#8  0x00350d21 in _mesa_DrawPixels (width=100, height=100, format=6408, type=5126, pixels=0xae19f008) at main/drawpix.c:113
#9  0x0806bcb4 in piglit_display () at piglit/tests/general/draw-pixel-with-texture.c:62
#10 0x0806bd3f in display () at piglit/tests/util/piglit-framework.c:56
#11 0x00b09820 in fghRedrawWindow (window=0x9880838, enumerator=0xbfa34298) at freeglut_main.c:210
#12 fghcbDisplayWindow (window=0x9880838, enumerator=0xbfa34298) at freeglut_main.c:227
#13 0x00b0d660 in fgEnumWindows (enumCallback=0xb09790 <fghcbDisplayWindow>, enumerator=0xbfa34298) at freeglut_structure.c:394
#14 0x00b09cdb in fghDisplayAll () at freeglut_main.c:249
#15 glutMainLoopEvent () at freeglut_main.c:1450
#16 0x00b0a605 in glutMainLoop () at freeglut_main.c:1498
#17 0x0806c441 in main (argc=1, argv=0xbfa34524) at piglit/tests/util/piglit-framework.c:294


src/mesa/state_tracker/st_mesa_to_tgsi.c
   271  unsigned
   272  translate_texture_target( GLuint textarget,
   273                            GLboolean shadow )
   274  {
   275     if (shadow) {
   276        switch( textarget ) {
   277        case TEXTURE_1D_INDEX:   return TGSI_TEXTURE_SHADOW1D;
   278        case TEXTURE_2D_INDEX:   return TGSI_TEXTURE_SHADOW2D;
   279        case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_SHADOWRECT;
   280        case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW1D_ARRAY;
   281        case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW2D_ARRAY;
   282        default: break;
   283        }
   284     }
   285  
   286     switch( textarget ) {
   287     case TEXTURE_1D_INDEX:   return TGSI_TEXTURE_1D;
   288     case TEXTURE_2D_INDEX:   return TGSI_TEXTURE_2D;
   289     case TEXTURE_3D_INDEX:   return TGSI_TEXTURE_3D;
   290     case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE;
   291     case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT;
   292     case TEXTURE_1D_ARRAY_INDEX:   return TGSI_TEXTURE_1D_ARRAY;
   293     case TEXTURE_2D_ARRAY_INDEX:   return TGSI_TEXTURE_2D_ARRAY;
   294     case TEXTURE_EXTERNAL_INDEX:   return TGSI_TEXTURE_2D;
   295     default:
   296        debug_assert( 0 );
   297        return TGSI_TEXTURE_1D;
   298     }
   299  }
Comment 1 Andreas Boll 2012-11-16 10:56:48 UTC
No assertion for me on r600g, llvmpipe and softpipe.
Although the test fails on all three drivers.

Tested with 
mesa master 6346214f055126d421a20c40056e3abe8ce1f9f3
and
mesa-9.0 branch 2332bc26d435e465a6f6571ab267db2a33ce05d2

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.