Skip to content

Rendering issues on Linux #42

@r-gr

Description

@r-gr

I'm getting some rendering issues with the code in this repo. I lack the vocabulary to describe it properly so I've attached some screenshots and a video recording (see below).

I've done a lot of debugging but haven't been able to find a cause (unless it's a driver bug, which seems unlikely but not impossible). As a beginner with Vulkan, I don't know where else to go with my investigations. I'm hoping someone here with more experience will recognise the issue.

Everything shown below is running on the main branch of this repo, with no changes aside from to CMakeLists.txt to allow compilation on my system.


System info

  • OS: Arch Linux (kernel version: 6.17.9)
  • Package/driver versions:
    • mesa 1:26.0.3-1
    • vulkan-radeon 1:26.0.3-1
    • volk 1.4.304
    • GLM 1.0.3
    • VMA 3.3.0
    • SDL 3.4.2
    • Slang 2026.5.1
    • cmake 4.3.0
    • gcc 15.2.1
    • clang 22.1.1
  • Selected device: AMD Radeon RX 6800 XT (RADV NAVI21)
  • Vulkan Instance Version: 1.4.341 (from vulkaninfo)

The issue

Image Image
screenrecording-2026-03-30_21-08-47.mp4
  • The issue appears to be deterministic -- every run of the programs shows the same pattern of glitchy fragments with the wrong colour.
  • The pattern of glitchy fragments changes with zoom, rotation and window size.
  • The glitchy fragments are generally stable frame-to-frame, but by rotating the models and resizing the window I can find ones that flicker (appear/disappear rapidly).
  • The incorrect colour appears to come from elsewhere in the image -- the colour is either black (from the background), or blue/green/brown (from the Suzanne models).
  • The issue is present when running as a native Wayland window or under X11 compatibility (Xwayland).
  • Compiling with GCC and clang gives the same result.

Investigations

  • Vulkan validation layers reported no issues, including when GPU Assisted Validation was enabled.
  • Tried various RADV_DEBUG environment variable flags (nodcc, nodisplaydcc, nofastclears, nohiz, llvm) but none had any effect on the issue.
  • Enabled back-face culling (set .cullMode = VK_CULL_MODE_BACK_BIT, .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE on rasterizationState). No effect.
  • Captured frames in RenderDoc and inspected the pixels with the wrong colour in the Texture Viewer, which showed that:
    1. the correct colour for the fragments were computed by the fragment shader (shown as 'Shader Out' in RenderDoc);
    2. if there was more than one fragment per pixel, the correct fragment passed the depth test;
    3. the wrong colour was written to the final pixel, and it appears to come from a fragment that fails the depth test (although when back-face culling is enabled, there's only one fragment per pixel and the wrong colour appears to come from nowhere).

Example 1 -- pixels in the white part of the Suzanne model's eye are incorrectly coloured black:

Image

Example 2 -- blue fragments appear on top of the brown Suzanne model. The fragment shader's output colour is correct (brown) but the colour written to the texture is blue. (Although the blue fragment fails the depth test, there shouldn't be any blue fragments at that position because there's zero overlap with the blue Suzanne model on the left. Interestingly, the blue model on the left has some incorrect brown pixels on it, like the colours from each model have swapped places.)

Image

Example 3 -- same as example 2 but with back-face culling enabled, showing that the fragment shader outputs the correct colour for the single fragment at that pixel, but the final colour written to the texture is wrong and appears from nowhere:

Image

This bizarre behaviour seems to point towards a driver bug or a hardware issue, but with the major caveat that no other applications or games on my system have any issues, including complex games running under dxvk/Proton. I've also considered issues like the depth texture or swapchain images having the wrong sizes, but everything looks correct in the code.

I'll try to get this code running on Windows on the same machine to confirm if the behaviour is the same. Edit: runs on Windows on the same hardware without issues (Vulkan 1.4.315, compiled with Visual Studio).

I'm happy to provide more details on request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions