The test should be correct, this looks more like an actual xfb bug since the test deliberately declares multiple variables in different streams as SV_Position and our shader compilers don't seem to handle that. This is perfectly legal in D3D12.
But it doesn't seem legal in VK.
Again, the problem is that we have multiple SV_Position variables that our compilers map to a single one. The correct fix here is to only map the one for the rasterized stream to gl_Position and keep the other ones separate, same for all other potential system values.
This seems fixed now with the following patch:
diff --git i/tests/d3d12_pso.c w/tests/d3d12_pso.c
index e8bcd612..19678043 100644
--- i/tests/d3d12_pso.c
+++ w/tests/d3d12_pso.c
@@ -4717,7 +4717,7 @@ void test_shader_io_mismatch(void)
/* TODO Fix DXBC/DXIL translation bugs that currently lead to
* mesa asserts with these tests */
-#if 0
+#if 1
for (i = 0; i < ARRAY_SIZE(so_tests); i++)
{
vkd3d_test_set_context("Test %u", i);
Actually, I spoke too soon and it still asserts on NAVI21
$ VKD3D_TEST_FILTER=test_shader_io_mismatch ./build/tests/d3d12
d3d12:748: Driver name: radv, driver info: Mesa 26.3.0-devel (git-7dd952f52a).
d3d12: ======== test_shader_io_mismatch begin ========
Validation Error: [ VUID-StandaloneSpirv-OpEntryPoint-09659 ] | MessageID = 0x9ddb94d7
vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
OpEntryPoint contains duplicate output variables with Position builtin
%SV_Position_1 = OpVariable %_ptr_Output_v4float Output
Command to reproduce:
spirv-val <input.spv> --relax-block-layout --uniform-buffer-standard-layout --scalar-block-layout --allow-localsizeid --allow-offset-texture-operand --allow-vulkan-32-bit-bitwise --target-env vulkan1.3
The Vulkan spec states: For a given OpEntryPoint, any BuiltIn decoration must not be used more than once by the Output interface (https://docs.vulkan.org/spec/latest/appendices/spirvenv.html#VUID-StandaloneSpirv-OpEntryPoint-09659)
d3d12: ../src/compiler/nir/nir_gather_xfb_info.c:105: add_var_xfb_outputs: Assertion `xfb->buffer_to_stream[buffer] == var->data.stream' failed.
Aborted (core dumped) VKD3D_TEST_FILTER=test_shader_io_mismatch ./build/tests/d3d12
Yes, this would need to be addressed in dxil-spirv, but is not exactly trivial and nobody actually uses multi-stream xfb in the wild.
The Vulkan spec says:
I think it's a test bug.