Created attachment 139506 [details]
I've tried to make a vertex shader which uses this vertex format, but it does not work on RADV.
It is almost as if the format becomes SNORM for RGB, but UNORM for A.
To replay the pipeline creation:
git clone git://github.com/Themaister/Fossilize
git submodule update --init
./cli/fossilize-replay /tmp/pipelines.json --filter-graphics 0
The ISA generated in VK_AMD_shader_info is:
.cli/fossilize-disasm /tmp/pipelines.json --target amd --graphics-pipeline 0 --stage vert
s_load_dwordx4 s[8:11], s[2:3], 0x0 ; C00A0201 00000000
s_load_dwordx4 s[0:3], s[2:3], 0x10 ; C00A0001 00000010
v_add_u32_e32 v0, vcc, s4, v0 ; 32000004
v_mov_b32_e32 v6, 1.0 ; 7E0C02F2
v_mov_b32_e32 v7, 0 ; 7E0E0280
s_waitcnt lgkmcnt(0) ; BF8C007F
buffer_load_format_xy v[4:5], v0, s[8:11], 0 idxen ; E0042000 80020400
buffer_load_format_xyzw v[0:3], v0, s[0:3], 0 idxen ; E00C2000 80000000
s_waitcnt vmcnt(1) ; BF8C0F71
exp pos0 v4, v5, v7, v6 done ; C40008CF 06070504
s_waitcnt vmcnt(0) ; BF8C0F70
exp param0 v0, v1, v2, v3 ; C400020F 03020100
s_endpgm ; BF810000
Created attachment 139507 [details]
The color for each component should be 1.0 for one corner, and interpolate towards 0.0 in the other corners, but A is ~0.8 where it should be 0.0, and ~0.6 where it should be 1.0. This seems very similar to SNORM being treated as UNORM.
If you're using RenderDoc to inspect the vertex buffer input, you need the very latest as there was a bug with A2BGR10_SNORM.
The vertex buffer input is (1.0, -1.0, -1.0, -1.0), (-1.0, 1.0, -1.0, -1.0) and so on, for each component, frag shader does vColor * 0.5 + 0.5, so expected output should land in [0, 1] range for each component.
Created attachment 139509 [details]
renderdoc screenshot of non-reproduction
Not sure I can reproduce. If I go to the corner A is a proper 1.0 here (and 0.0 in the other corners).
radeonsi has workarounds for all signed r10g10b10a2 formats for everything before Vega (except Stoney Ridge), with the code explicitly saying the A2 is read as unsigned by the hw.
At a quick glance I don't see any such workarounds for radv, but I have zero idea about that driver.
Yes, I should clarify that this is RX470, so Polaris.
That would explain, I tested on vega.
FWIW, this also affects UNIFORM_TEXEL_BUFFER.
Yes, We'll likely "fix" that by not claiming support for R10G10B10A2 SNORM/SINT formats anymore since support is not required, and a fixup is not possible without significantly impacting perofrmance for apps that don't use it.
VK_FORMAT_A2B10G10R10_SNORM_PACK32 and VK_FORMAT_A2B10G10R10_SINT_PACK32 are not required formats according to the vulkan spec, so we can reasonably disable those.
This bug should be fixed by
That would match AMDVLK, it exposes A2BGR10_SNORM for vertex, but not UNIFORM_TEXEL_BUFFER.
The patches seem to have fixed the issue for me :)
The fixes are in master now.