FrontFacing input is broken on Intel/Vulkan
Before submitting your bug report:
TODO: check the latest Mesa from git
System information
System: Host: Theseus Kernel: 5.15.10 x86_64 bits: 64 compiler: gcc v: 10.3.0 Desktop: KDE Plasma 5.23.4 wm: kwin_x11
dm: SDDM Distro: NixOS 22.05 (Quokka)
CPU: Info: Quad Core model: 11th Gen Intel Core i7-1185G7 bits: 64 type: MT MCP arch: Tiger Lake rev: 1 cache:
L2: 12 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 47923
Speed: 1991 MHz min/max: 400/4800 MHz Core speeds (MHz): 1: 1991 2: 2022 3: 2396 4: 3818 5: 2618 6: 3058 7: 2184
8: 2831
Graphics: Message: No device data found.
Display: x11 server: X.org 1.20.13 compositor: kwin_x11 driver: loaded: N/A resolution: <missing: xdpyinfo>
Message: Unable to show advanced data. Required tool glxinfo missing.
Describe the issue
Using FrontFacing
input in a fragment shader produces garbage results on Intel/Vulkan/Linux
The fragment shader in WGSL is the following:
[[stage(fragment)]]
fn fs_main([[builtin(front_facing)]] is_front: bool) -> [[location(0)]] vec4<f32> {
let ratio = max(select(1.0, -1.0, is_front), select(-1.0, 1.0, is_front));
return vec4<f32>(1.0) * ratio;
}
Assuming is_front
can be true or false, the ratio
should always be 1.
Hence, the triangle should be white. But on my system it's black:
This happens deterministically. Repro steps:
# install Mesa, Rust, and Git
git clone https://github.com/kvark/wgpu -b bug-intel-front-facing
cd wgpu
cargo run --example hello-triangle
Here is the (release) executable - hello-triangle.zip. It's built on NixOS so you'll unlikely be able to run it right off the bat (without ELF patching for the interpreter and rpaths).
Here is the fragment shader SPV - Fragment.spv
Regression
Not that I'm aware of.
Log files as attachment
Output of dmesg
- dmesg.txt