SNORM GL formats don't roundtrip on upload/download
System information
System:
Host: xor Kernel: 6.4.12-1-default arch: x86_64 bits: 64 compiler: gcc
v: 13.2.1 Desktop: GNOME tk: GTK v: 3.24.38 wm: xmonad dm: SDDM
Distro: openSUSE Tumbleweed 20230901
CPU:
Info: 16-core model: AMD Ryzen Threadripper 1950X bits: 64 type: MT MCP MCM
arch: Zen rev: 1 cache: L1: 1.5 MiB L2: 8 MiB L3: 32 MiB
Speed (MHz): avg: 2410 high: 3755 min/max: 2200/3400 boost: enabled cores:
1: 2800 2: 2200 3: 2200 4: 2200 5: 2200 6: 2189 7: 2200 8: 2200 9: 3400
10: 2021 11: 2200 12: 3755 13: 2200 14: 2200 15: 2200 16: 2043 17: 2188
18: 2200 19: 3400 20: 2200 21: 2190 22: 2200 23: 2343 24: 2200 25: 2200
26: 2200 27: 2200 28: 3400 29: 2200 30: 3400 31: 2200 32: 2200
bogomips: 217254
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: NVIDIA GA106 [Geforce RTX 3050] vendor: Micro-Star MSI
driver: nvidia v: 535.86.05 arch: Ampere pcie: speed: 2.5 GT/s lanes: 8
ports: active: none empty: DP-4, DP-5, DP-6, HDMI-A-2 bus-ID: 09:00.0
chip-ID: 10de:2507
Device-2: AMD Navi 21 [Radeon RX 6950 XT] vendor: Micro-Star MSI
driver: amdgpu v: kernel arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports:
active: DP-3 empty: DP-1,DP-2,HDMI-A-1 bus-ID: 44:00.0 chip-ID: 1002:73a5
Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.2.0 driver: X:
loaded: amdgpu,nvidia unloaded: fbdev,modesetting,radeon,vesa
alternate: nouveau,nv dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 3440x1440 s-dpi: 96
Monitor-1: DP-3 mapped: DisplayPort-2 model: Samsung Odyssey G8
res: 3440x1440 dpi: 108 diag: 883mm (34.8")
API: OpenGL v: 4.6 Mesa 23.1.6 renderer: AMD Radeon RX 6950 XT (navi21
LLVM 16.0.6 DRM 3.52 6.4.12-1-default) direct-render: Yes
Describe the issue
I was testing the use of signed normalized formats (GL_RGBA16_SNORM etc.) when I noticed that adding them to my software broke the test framework. Specifically, the tests designed to ensure that upload/download correctly round-trips, appear to clip all negative values to 00
when using snorm formats. Which formats trigger this bug seem to depend on the driver. See the below examples.
On amdgpu, it seems to affect only rgb16_snorm, the other snorm formats all appear to be fully functional. On llvmpipe, even a basic r8_snorm test does not pass. Due to the nature of the test, I cannot tell whether it is the upload, or the download, that causes the problems. Edit: I re-tested it and it appears all SNORM formats are affected on mesa. (The previous paragraph was the result of mistakenly using the nvidia GL driver for one test)
Log files as attachment
testing texture roundtrip for format r8s
... 1D
=== FAILED: memcmp(src, dst, bytes) == 0 at ../src/tests/gpu_tests.h:201
at position 0: 0xc4 != 0x00
16 bytes of 'src' at offset 0:
c4 2e 76 4d 2c d8 37 d6 10 62 82 2c 63 ef 2c f4
16 bytes of 'dst' at offset 0:
00 2e 76 4d 2c 00 37 00 10 62 00 2c 63 00 2c 00