anv: vkd3d-proton mesh test failure
Running the vkd3d-proton test_mesh_shader_create_pipeline tests we assert in the packing code :
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737353570176) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140737353570176) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140737353570176, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff7842476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff78287f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff782871b in __assert_fail_base (fmt=0x7ffff79dd150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x7ffff680c4f5 "v <= max", file=0x7ffff680c4d7 "../src/util/bitpack_helpers.h", line=61, function=<optimized out>)
at ./assert/assert.c:92
#6 0x00007ffff7839e96 in __GI___assert_fail (assertion=0x7ffff680c4f5 "v <= max", file=0x7ffff680c4d7 "../src/util/bitpack_helpers.h",
line=61, function=0x7ffff680cb10 <__PRETTY_FUNCTION__.23> "util_bitpack_uint") at ./assert/assert.c:101
#7 0x00007ffff5c9ae4c in util_bitpack_uint (end=9, start=0, v=4294967295) at ../src/util/bitpack_helpers.h:61
#8 GFX125_3DSTATE_MESH_SHADER_pack (values=0x7fffffffa430, dst=0x555555862e50, data=0x5555558625e8) at src/intel/genxml/gen125_pack.h:7900
#9 emit_mesh_state (pipeline=0x5555558625a0) at ../src/intel/vulkan/genX_pipeline.c:1766
#10 0x00007ffff5ca0052 in gfx125_graphics_pipeline_emit (pipeline=0x5555558625a0, state=0x7fffffffbf40)
at ../src/intel/vulkan/genX_pipeline.c:1855
#11 0x00007ffff4f6d343 in anv_graphics_pipeline_create (device=0x555555b62980, cache=0x0, pCreateInfo=0x7fffffffca30, pAllocator=0x0,
pPipeline=0x7fffffffc8c0) at ../src/intel/vulkan/anv_pipeline.c:2403
#12 0x00007ffff4f6d429 in anv_CreateGraphicsPipelines (_device=0x555555b62980, pipelineCache=0x0, count=1, pCreateInfos=0x7fffffffca30,
pAllocator=0x0, pPipelines=0x7fffffffc8c0) at ../src/intel/vulkan/anv_pipeline.c:2425
The issue is :
anv_batch_emit(&pipeline->base.batch, GENX(3DSTATE_MESH_SHADER), mesh) {
mesh.KernelStartPointer = mesh_bin->kernel.offset;
mesh.SIMDSize = mesh_dispatch.simd_size / 16;
mesh.MessageSIMD = mesh.SIMDSize;
mesh.NumberofThreadsinGPGPUThreadGroup = mesh_dispatch.threads;
mesh.ExecutionMask = mesh_dispatch.right_mask;
mesh.LocalXMaximum = mesh_dispatch.group_size - 1;
mesh.EmitLocalIDX = true;
mesh.MaximumPrimitiveCount = mesh_prog_data->map.max_primitives - 1; <---- mesh_prog_data->map.max_primitives == 0