Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test wgpu::example/msaa-line fails with panic on hardware: Intel(R) HD Graphics 4600 (HSW GT2) with driver: Mesa 21.2.6 with backend: Vulkan #3422

Closed
hsandt opened this issue Jan 25, 2023 · 8 comments
Labels
api: vulkan Issues with Vulkan external: driver-bug A driver is causing the bug, though we may still want to work around it

Comments

@hsandt
Copy link

hsandt commented Jan 25, 2023

Description
The unit test wgpu::example/msaa-line failed on my machine (specs at the bottom).

Repro steps
On a machine with similar specs, run all unit tests:
$ cargo nextest run --no-fail-fast

Expected vs observed behavior

Expected: all tests pass

Actual:

1 failed test (excerpt just below, full log more below)

1 failed test:
FAIL [ 3.726s] wgpu::example/msaa-line msaa_line
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.70s
...
--- STDERR: wgpu::example/msaa-line msaa_line ---
MESA-INTEL: warning: Haswell Vulkan support is incomplete
thread 'msaa_line' panicked at 'Image data mismatch! Outlier count 77230 over limit 65536. Max difference 255', wgpu/examples/msaa-line/../../tests/common/image.rs:134:13
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'msaa_line' panicked at 'UNEXPECTED TEST FAILURE DUE TO PANIC', wgpu/examples/msaa-line/../../tests/common/mod.rs:307:9
...
Summary [ 6.416s] 56 tests run: 55 passed, 1 failed, 0 skipped
FAIL [ 3.726s] wgpu::example/msaa-line msaa_line

Extra materials

Full test log:
nextest result on Intel(R) HD Graphics 4600 (HSW GT2) - Mesa 21.2.6 - Vulkan.txt

I also tried:
$ cargo run --bin wgpu-info -- cargo nextest run --no-fail-fast

in order to also test my discrete GPU, but it failed on linking, so I don't have test results for this one, unfortunately (that may be worth another ticket, but I must first ensure I setup everything correctly for this more complex test).

If you know a way to enforce using a specific GPU for the tests, I can also do that to verify that my discrete card (Nvidia GTX 860M) doesn't have the issue.

Platform
Linux Ubuntu 20.04 with Unity desktop
wgpu 0.14.2

Graphical hardware/driver info (AdapterInfo output from bevy engine):

AdapterInfo { name: "Intel(R) HD Graphics 4600 (HSW GT2)", vendor: 32902, device: 1046, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 21.2.6", backend: Vulkan }

I got an integrated Intel(R) HD Graphics 4600 (HSW GT2) + a discrete Nvidia GTX 860M on my laptop, but the latter doesn't seem to be recognized by this particular program.

@nical nical added the type: bug Something isn't working label Feb 2, 2023
@cwfitzgerald
Copy link
Member

Can you upload the resulting image? It will be saved in wgpu/examples/msaa-line/screenshot-failure.png or something similar

@hsandt
Copy link
Author

hsandt commented Feb 15, 2023

Sure:

wgpu/examples/msaa-line/screenshot.png

screenshot

wgpu/examples/msaa-line/screenshot-actual.png

screenshot-actual

Click on the picture above to open it in a new tab on white background, because of transparency you may not see much on dark theme. You should see something like this in the top-left area:

image

wgpu/examples/msaa-line/screenshot-difference.png

screenshot-difference

This is great info, it shows that this really is the same issue (or as least there is a common factor) as I got on Bevy: bevyengine/bevy#7232
as you can see the black and white image shrinked to the top-left part of the window in both case.

@cwfitzgerald
Copy link
Member

Oh boy. I'm not sure we're going to be able to fix this in a meaningful way. Jason Ekstrand (one of the lead devs of intel/vulkan on linux) has said before that supporting vulkan on haswell was a mistake as it just can't be made compliant - and as such that driver will have a ton of bugs. What GLES version do you get from running glxinfo? We might consider disabling the vulkan backend on Haswell/Broadwell so it forces users onto the GLES drivers.

@hsandt
Copy link
Author

hsandt commented Feb 16, 2023

I'm not familiar with this info dump but I think the important numbers are:
GLX version: 1.4
OpenGL ES 3.1

I put more detailed info below just in case:
$ glxinfo

name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
...
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
...
GLX version: 1.4
...
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel Open Source Technology Center (0x8086)
Device: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2) (0x416)
Version: 21.2.6
Accelerated: yes
Video memory: 1536MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.50
...
OpenGL version string: 3.0 Mesa 21.2.6
OpenGL shading language version string: 1.30
...
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
...

Yes that's fine, I'll be happy to fall back to OpenGL, whether automatically or by adding an environment variable.

@hsandt
Copy link
Author

hsandt commented Feb 16, 2023

So I've tested environment variable WGPU_BACKEND=gl but for some reason it does not work with cargo nextest run --no-fail-fast. Do you know how to pass an env var, or alternatively a direct option to set a rendering backend, to nextest?

However, setting WGPU_BACKEND=gl when running a Bevy game directly did work and fixed my issue. So at least I'll be able to keep working on my project without the rendering bug.

@cwfitzgerald
Copy link
Member

That should work, what error are you getting?

@hsandt
Copy link
Author

hsandt commented Feb 17, 2023

Oh, in fact the backend does change and msaa_line passes this time.
However, I got another error with skybox:

FAIL [ 2.259s] wgpu::example/skybox skybox

--- STDOUT: wgpu::example/skybox skybox ---

running 1 test
0 outliers over max difference 1
test skybox ... FAILED

failures:

failures:
skybox

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 3 filtered out; finished in 2.25s

--- STDERR: wgpu::example/skybox skybox ---
thread 'skybox' panicked at 'UNEXPECTED TEST PASS: BACKEND', wgpu/examples/skybox/../../tests/common/mod.rs:305:9
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

I searched for existing issues and found this one: #1727
which is also about skybox and UNEXPECTED TEST PASS: BACKEND

However, the latter has been resolved. I tried RUST_BACKTRACE=1 and full too but the stack is approximately the same as in the ticket.

Worth opening another issue, or would you rather have me try prime-run and properly run on my discrete Nvidia GPU first?

By the way, I tried the second test command, cargo run --bin wgpu-info -- cargo nextest run --no-fail-fast again, and this time, it didn't fail on linking, it ran just like the first test command and failed "normally" on msaa_line.

I guess deleting the target folder in the meantime helped.

@teoxoy teoxoy added external: driver-bug A driver is causing the bug, though we may still want to work around it api: vulkan Issues with Vulkan and removed type: bug Something isn't working labels Feb 24, 2023
@teoxoy
Copy link
Member

teoxoy commented Nov 17, 2023

Haswell iGPUs are not yet Vulkan conformant:

https://gitlab.freedesktop.org/mesa/mesa/-/blob/bafc27583cf7c2d136fa05764e5e2145fedbc9cc/src/intel/vulkan_hasvk/anv_device.c#L1004-1024

You should report this issue to the mesa repo.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vulkan Issues with Vulkan external: driver-bug A driver is causing the bug, though we may still want to work around it
Projects
None yet
Development

No branches or pull requests

4 participants