Some webgl test failed on mesa llvmpipe driver if cpu support f16c
I can reproduce it on a linux desktop (it's more or less a kind of debian testing):
- Build mesa llvmpipe driver:
meson build -Dvulkan-drivers='' -Dgallium-drivers='swrast' \
-Ddri-drivers='' -Degl=enabled -Dplatforms='x11' \
-Dprefix=$HOME/mesa-master &&
ninja -C build -j32 install
- Open webgl test with Google Chrome browser from a terminal window:
export MESA=$HOME/mesa-master/lib/x86_64-linux-gnu
export LD_LIBRARY_PATH=$MESA:$LD_LIBRARY_PATH
export LIBGL_DRIVER_PATH=$MESA/dri
google-chrome --use-gl=egl --disable-features=vulkan --ignore-gpu-blocklist "https://registry.khronos.org/webgl/sdk/tests/deqp/functional/gles3/shaderoperator/unary_operator_01.html?webglVersion=2&quiet=0&quick=1"
I will get 8 failed tests.
But if I patch mesa with this to disable f16c, then those failed tests will pass:
diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c
index 5a9baddfb87..8911941c661 100644
--- a/src/util/u_cpu_detect.c
+++ b/src/util/u_cpu_detect.c
@@ -831,6 +831,7 @@ _util_cpu_detect_once(void)
((regs2[2] >> 27) & 1) && // OSXSAVE
((xgetbv() & 6) == 6); // XMM & YMM
util_cpu_caps.has_f16c = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx;
+ util_cpu_caps.has_f16c = 0;
util_cpu_caps.has_fma = ((regs2[2] >> 12) & 1) && util_cpu_caps.has_avx;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
#if DETECT_ARCH_X86_64
Edited by Lepton Wu