Novum / vkQuake

Vulkan Quake port based on QuakeSpasm
GNU General Public License v2.0
1.84k stars 224 forks source link

quakespasm: isl.c:1516: isl_surf_get_image_offset_el: Assertion `level < surf->levels' failed. #7

Closed iamgreaser closed 8 years ago

iamgreaser commented 8 years ago

This happens when I try to start a game or run a demo.

Running very recent Mesa git i965 drivers on Skylake on Linux (git-126bd15 according to glxinfo). These drivers are compiled with --enable-debug.

Vulkan does work in general.

Using the registered version of the files as available on Steam.

Attempting to build a proper debug build results in an error during compilation so I may have to update my headers at some stage.

Relevant backtrace:

(gdb) bt
#0  0x00007ffff6554207 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff655568a in __GI_abort () at abort.c:89
#2  0x00007ffff654d1ed in __assert_fail_base (fmt=0x7ffff6689390 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fffe02e73c6 "level < surf->levels", 
    file=file@entry=0x7fffe02e7240 "isl.c", line=line@entry=1516, function=function@entry=0x7fffe02e7b50 <__PRETTY_FUNCTION__.3574> "isl_surf_get_image_offset_el") at assert.c:92
#3  0x00007ffff654d2a2 in __GI___assert_fail (assertion=assertion@entry=0x7fffe02e73c6 "level < surf->levels", file=file@entry=0x7fffe02e7240 "isl.c", line=line@entry=1516, 
    function=function@entry=0x7fffe02e7b50 <__PRETTY_FUNCTION__.3574> "isl_surf_get_image_offset_el") at assert.c:101
#4  0x00007fffe016533d in isl_surf_get_image_offset_el (surf=surf@entry=0x20cbba0, level=7, logical_array_layer=<optimized out>, logical_z_offset_px=logical_z_offset_px@entry=0, 
    x_offset_el=x_offset_el@entry=0x7fffffffa468, y_offset_el=y_offset_el@entry=0x7fffffffa46c) at isl.c:1516
#5  0x00007fffdea20724 in meta_copy_buffer_to_image (cmd_buffer=0x1edac00, buffer=0x1df85c0, image=0x20cbb50, regionCount=<optimized out>, pRegions=<optimized out>, forward=true) at anv_meta_copy.c:189
#6  0x000000000041849c in TexMgr_LoadImage32 (glt=glt@entry=0x7fffe112cca0, data=<optimized out>) at gl_texmgr.c:1095
#7  0x0000000000418656 in TexMgr_LoadImage8 (glt=glt@entry=0x7fffe112cca0, data=<optimized out>, 
    data@entry=0x7fffe1a51d78 "\022\022\022q\022\023\002\022q\002\002$\002q\022qq\021q$\002q\002\023\022\002\002q\002\002\023\022qq\002\022q\023$\022\022\022q$\002$\002\022\022\022q$\022\022\"$\022qq\022\022\022\023\021\002\002qq\002\002%q\002qq\002\023##\002\002\022\022\002$q$\002\022\002\023#\023\023#qs\025\023#\022\002$\022#\023\022#\023#$#\002\002\022##\002$\002\022\002\002\002\022q\021q5\002\002\022\065\023\026\026$\023\023\024\026\003\023\025\025\025\002\024\026\022\025$\024\024\025\025\025\024\002\002\002\003\025$5\022#\024\024\002\024r\025\025\026\025\025'\002\022\004\022\025\026\025\025\025$\023\024\022\021\021\002\024#\025#\022\023"...) at gl_texmgr.c:1196
#8  0x000000000041939b in TexMgr_LoadImage (owner=<optimized out>, name=name@entry=0x7fffffffae80 "maps/start.bsp:dem4_1", width=64, height=128, format=format@entry=SRC_INDEXED, 
    data=data@entry=0x7fffe1a51d78 "\022\022\022q\022\023\002\022q\002\002$\002q\022qq\021q$\002q\002\023\022\002\002q\002\002\023\022qq\002\022q\023$\022\022\022q$\002$\002\022\022\022q$\022\022\"$\022qq\022\022\022\023\021\002\002qq\002\002%q\002qq\002\023##\002\002\022\022\002$q$\002\022\002\023#\023\023#qs\025\023#\022\002$\022#\023\022#\023#$#\002\002\022##\002$\002\022\002\002\002\022q\021q5\002\002\022\065\023\026\026$\023\023\024\026\003\023\025\025\025\002\024\026\022\025$\024\024\025\025\025\024\002\002\002\003\025$5\022#\024\024\002\024r\025\025\026\025\025'\002\022\004\022\025\026\025\025\025$\023\024\022\021\021\002\024#\025#\022\023"..., source_file=0x1799b00 <mod_known> "maps/start.bsp", source_offset=924352, flags=1) at gl_texmgr.c:1268
#9  0x000000000041e82c in Mod_LoadTextures (l=l@entry=0x7ffff0ac9f54) at gl_model.c:558
#10 0x0000000000421274 in Mod_LoadBrushModel (mod=mod@entry=0x1799b00 <mod_known>, buffer=buffer@entry=0x7ffff0ac9f40) at gl_model.c:2008
#11 0x0000000000422a83 in Mod_LoadModel (mod=0x1799b00 <mod_known>, crash=false) at gl_model.c:336
#12 0x00000000004524cb in SV_SpawnServer (server=server@entry=0x7fffffffe430 "start") at sv_main.c:1364
#13 0x00000000004458ab in Host_Map_f () at host_cmd.c:791
#14 0x000000000043fafc in Cbuf_Execute () at cmd.c:193
#15 0x0000000000444e4d in _Host_Frame (time=0.00100000005) at host.c:699
#16 0x0000000000445101 in Host_Frame (time=<optimized out>) at host.c:780
#17 0x0000000000404ba0 in main (argc=<optimized out>, argv=<optimized out>) at main_sdl.c:156
SaschaWillems commented 8 years ago

This may be caused by a wrong number of buffer copies for the image staging part.

Try to change this line in gl_texmgr.c:

vkCmdCopyBufferToImage(command_buffer, staging_buffer, glt->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, num_regions, regions);

to this:

vkCmdCopyBufferToImage(command_buffer, staging_buffer, glt->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, num_mips, regions);

And see if this works.

The current code for image staging causes validation errors for images with more than one mip level, which may cause the crash in the Intel driver. At least that's what the "isl_surf_get_image_offset_el" in your call stack may hint at.

I'll try to push a PR later today after work to fix this.

iamgreaser commented 8 years ago

All working now. Thanks!