Skip to content

OpenGL shader cache is not prefixed with GPU model, causing it to be invalidated when switching GPUs on a project #81150

@Calinou

Description

Godot version

4.2.dev d2f76e8

System information

Godot v4.2.dev (d2f76e8) - Fedora Linux 38 (KDE Plasma) - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 Laptop GPU () - 13th Gen Intel(R) Core(TM) i9-13900H (20 Threads)

Issue description

Note

This is now fixed in Vulkan thanks to #80296, but a separate fix is needed for OpenGL (Compatibility rendering method).

OpenGL does not support --gpu-index, so you must use system overrides to control which GPU Godot runs on (or use llvmpipe) to test this issue.

Vulkan pipeline cache is not prefixed with the GPU model name (or perhaps GPU index), causing it to be invalidated when switching GPUs on a project. This unnecessarily increases loading times when you switch GPUs back and forth, which is something you may have to do frequently when benchmarking.
(Remember that pipeline cache isn't compatible across GPU models, so it has to be made unique for each GPU.)

WARNING: Invalid pipelines cache header.
     at: _load_pipeline_cache (drivers/vulkan/rendering_device_vulkan.cpp:9187)

For reference, here's the system information with the integrated GPU used in Godot (this is --gpu-index 0 on my end, but Godot picks the dedicated GPU first if not told explicitly):

Godot v4.2.dev (d2f76e8) - Fedora Linux 38 (KDE Plasma) - X11 - Vulkan (Forward+) - integrated Intel(R) Graphics (RPL-P) () - 13th Gen Intel(R) Core(TM) i9-13900H (20 Threads)

Steps to reproduce

You need a system with access to 2 different GPUs. A laptop with hybrid graphics makes this easy, but you can also use a desktop with a dedicated GPU and integrated graphics explicitly enabled in the UEFI.

  • Open the editor on a project, or run a project with --gpu-index 0 for the first time. Notice the "invalid Vulkan pipeline cache" warning message.
  • Do the same a second time. Notice there is no warning message.
  • Do the same, but with --gpu-index 1. Notice the warning message again.
  • Do the same a second time. Notice there is no warning message.
  • Use --gpu-index 0 again, and notice the warning message appearing. This is the unexpected part.

Minimal reproduction project

Any project can be used to reproduce this issue, but I've used https://github.com/Calinou/godot-reflection to test this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions