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

Failed to work on Intel HD since pixels v0.5 #224

Closed
bytefall opened this issue Nov 13, 2021 · 3 comments
Closed

Failed to work on Intel HD since pixels v0.5 #224

bytefall opened this issue Nov 13, 2021 · 3 comments
Labels
driver bug Update your drivers to fix this issue upstream bug Bug appears to originate in an upstream dependency

Comments

@bytefall
Copy link

Hi.

I have issues with pixels on Intel HD 3000 (yeah, I know it's an old hardware).

$ glxinfo | grep Device
    Device: Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2) (0x126)
$ glxinfo | grep 'version'
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 3.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.0.3
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 21.0.3
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

OS is Ubuntu 20.04 LTS.

Last working version for me was pixels = "0.5".

When I execute The game of life example with latest pixels from Github, it shows the window for a second and then crashes:

$ cargo run --package conway
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/conway`
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
Segmentation fault (core dumped)

Peek 2021-11-13 12-08

GIF recording is a bit misleading - it shows Conway window first and then breaks with the Segmentation fault.

With gdb:

Starting program: /home/src/pixels/target/debug/conway 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffefb2a700 (LWP 523243)]
[New Thread 0x7fffe7329700 (LWP 523244)]
[New Thread 0x7fffef329700 (LWP 523245)]
[New Thread 0x7fffeeb28700 (LWP 523246)]
[New Thread 0x7fffee327700 (LWP 523247)]
[New Thread 0x7fffedb26700 (LWP 523248)]
[New Thread 0x7fffed325700 (LWP 523249)]
[New Thread 0x7fffecb24700 (LWP 523250)]
[New Thread 0x7fffe7fff700 (LWP 523251)]
[New Thread 0x7fffe6b28700 (LWP 523252)]
[New Thread 0x7fffe6327700 (LWP 523253)]
[New Thread 0x7fffe5b26700 (LWP 523254)]
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
[New Thread 0x7fffe5325700 (LWP 523255)]

Thread 14 "conway" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe5325700 (LWP 523255)]
0x00007ffff6966b40 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so
(gdb) where
#0  0x00007ffff6966b40 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so
#1  0x00007ffff6969f0d in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so
#2  0x00007ffff695cdff in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so
#3  0x00007ffff695cc4b in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so
#4  0x00007ffff7f5d609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5  0x00007ffff7d35293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

RUST_LOG=trace log is 76 kb so I put here the ending:

[2021-11-13T10:22:52Z TRACE wgpu_core::device::queue] Stitching command buffer (0, 2, Vulkan) before submission
[2021-11-13T10:22:52Z TRACE wgpu_core::track] 	texture -> PendingTransition { id: Valid((0, 1, Vulkan)), selector: TextureSelector { levels: 0..1, layers: 0..1 }, usage: COPY_DST..RESOURCE }
[2021-11-13T10:22:52Z TRACE wgpu_core::track] 	texture -> PendingTransition { id: Valid((1, 2, Vulkan)), selector: TextureSelector { levels: 0..1, layers: 0..1 }, usage: COPY_SRC | COPY_DST | RESOURCE | COLOR_TARGET | DEPTH_STENCIL_READ | DEPTH_STENCIL_WRITE | STORAGE_READ | STORAGE_WRITE | INCLUSIVE | EXCLUSIVE | ORDERED | UNINITIALIZED..COLOR_TARGET }
[2021-11-13T10:22:52Z TRACE wgpu_core::track] 	texture -> PendingTransition { id: Valid((1, 2, Vulkan)), selector: TextureSelector { levels: 0..1, layers: 0..1 }, usage: COLOR_TARGET..(empty) }
[2021-11-13T10:22:52Z TRACE wgpu_core::device::queue] Device after submission 2: TrackerSet {
        buffers: {
            (
                0,
                1,
            ): Unit {
                first: Some(
                    COPY_DST,
                ),
                last: VERTEX,
            },
            (
                1,
                1,
            ): Unit {
                first: Some(
                    COPY_DST,
                ),
                last: UNIFORM,
            },
        },
        textures: {
            (
                1,
                2,
            ): TextureState {
                mips: [
                    RangedStates {
                        ranges: [
                            (
                                0..1,
                                Unit {
                                    first: Some(
                                        COPY_SRC | COPY_DST | RESOURCE | COLOR_TARGET | DEPTH_STENCIL_READ | DEPTH_STENCIL_WRITE | STORAGE_READ | STORAGE_WRITE | INCLUSIVE | EXCLUSIVE | ORDERED | UNINITIALIZED,
                                    ),
                                    last: (empty),
                                },
                            ),
                        ],
                    },
                ],
                full: false,
            },
            (
                0,
                1,
            ): TextureState {
                mips: [
                    RangedStates {
                        ranges: [
                            (
                                0..1,
                                Unit {
                                    first: Some(
                                        COPY_SRC | COPY_DST | RESOURCE | COLOR_TARGET | DEPTH_STENCIL_READ | DEPTH_STENCIL_WRITE | STORAGE_READ | STORAGE_WRITE | INCLUSIVE | EXCLUSIVE | ORDERED | UNINITIALIZED,
                                    ),
                                    last: RESOURCE,
                                },
                            ),
                        ],
                    },
                ],
                full: true,
            },
        },
        views: {
            (
                0,
                1,
            ): PhantomData,
            (
                2,
                1,
            ): PhantomData,
            (
                1,
                1,
            ): PhantomData,
        },
        bind_groups: {
            (
                0,
                1,
            ): PhantomData,
        },
        samplers: {
            (
                0,
                1,
            ): PhantomData,
        },
        compute_pipes: {},
        render_pipes: {},
        bundles: {},
        query_sets: {},
    }
[2021-11-13T10:22:52Z TRACE wgpu_core::device::life] Active submission 1 is done
[2021-11-13T10:22:52Z TRACE wgpu_core::device::life] Active submission 2 is done

Speaking of WGPU, the cube and hello-triangle examples work just fine with the latest WGPU, while e.g. texture-arrays and a few others fails with:

$ ./texture-arrays
Using Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2) (Gl)
thread 'main' panicked at 'Adapter does not support required features for this example: TEXTURE_BINDING_ARRAY | SPIRV_SHADER_PASSTHROUGH', wgpu/examples/texture-arrays/../framework.rs:147:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Is this the pixels issue or it's on the WGPU side? Appreciated for any workaround suggestions.

@parasyte parasyte added driver bug Update your drivers to fix this issue upstream bug Bug appears to originate in an upstream dependency labels Nov 13, 2021
@parasyte
Copy link
Owner

parasyte commented Nov 13, 2021

There are two issues here. First I'll address why you see a segfault:

libvulkan_lvp.so is the LLVMpipe driver, which is known to have some bugs. Updating to a more recent Mesa package might help.

Lavapipe is a Vulkan implementation built on LLVMpipe. The second issue here is that you should probably not be using Lavapipe/LLVMpipe. This is a software-rasterization stack! It runs all graphics operations on your CPU, not the GPU. The HD Graphics 3000 is not an awesome GPU by any means, but it is probably still better at rasterizing than the CPU.

You may need to install a Vulkan driver for the GPU if you want to use it. The file is named libvulkan_intel.so. The OpenGL drivers will not be used unless you request it with wgpu::Backends::all() and select the appropriate adapter.

RUST_LOG can show you which adapter is selected:

$ RUST_LOG='wgpu_core::instance=info' cargo run --package minimal-winit
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target\debug\minimal-winit.exe`
[2021-11-13T23:03:37Z INFO  wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "NVIDIA GeForce RTX 3090", vendor: 4318, device: 8708, device_type: DiscreteGpu, backend: Vulkan }

And there might be one more catch to be aware of: There are a bunch of open tickets on the wgpu repo for Intel/Vulkan, including segfaults in that driver. https://github.com/gfx-rs/wgpu/issues?q=is%3Aissue+is%3Aopen+intel+vulkan

@bytefall
Copy link
Author

bytefall commented Nov 14, 2021

Thank you for the references. Now I have a better understanding what's going on.

While I have libvulkan_intel.so already installed, Intel HD 3000 (on Sandy Bridge) doesn't have hardware support for Vulkan.

So I'll stick to the OpenGL (thanks again for the wgpu::Backends::all() tip). This is what works for me:

let mut pixels = PixelsBuilder::new(SCREEN_WIDTH, SCREEN_HEIGHT, surface_texture)
    .device_descriptor(wgpu::DeviceDescriptor {
        label: None,
        features: wgpu::Features::empty(),
        limits: wgpu::Limits {
            max_dynamic_storage_buffers_per_pipeline_layout: 0,
            max_storage_buffers_per_shader_stage: 0,
            max_storage_textures_per_shader_stage: 0,
            max_storage_buffer_binding_size: 0,
            ..wgpu::Limits::default()
        }
    })
    .wgpu_backend(wgpu::Backends::all())
    .build()?;
$ RUST_LOG='wgpu_core::instance=info' cargo run --package conway

[2021-11-14T12:18:02Z INFO  wgpu_core::instance] Adapter GL AdapterInfo { name: "Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2)", vendor: 32902, device: 0, device_type: IntegratedGpu, backend: Gl }
[2021-11-14T12:18:02Z WARN  wgpu_core::instance] Missing downlevel flags: COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | VERTEX_STORAGE | FRAGMENT_STORAGE
    The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
[2021-11-14T12:18:02Z INFO  wgpu_core::instance] DownlevelCapabilities {
        flags: DEVICE_LOCAL_IMAGE_COPIES | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLENDING,
        limits: DownlevelLimits,
        shader_model: Sm5,
    }

@parasyte
Copy link
Owner

Awesome! Glad you were able to find a workaround. I haven't tried the OpenGL backend, I just know it's a work in progress. pixels doesn't require demanding resources, so it should work fine. I would be interested in your experience after you've had a chance to use it for some time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
driver bug Update your drivers to fix this issue upstream bug Bug appears to originate in an upstream dependency
Projects
None yet
Development

No branches or pull requests

2 participants