Gracefully fail startup when only CPU Vulkan adapters are available#3743
Gracefully fail startup when only CPU Vulkan adapters are available#3743ShivangSingh68 wants to merge 3 commits intoGraphiteEditor:masterfrom
Conversation
|
Gracefully shutting down when we know that a adapter is not supported is generally a good idea, but this is to harsh. There are adapters reported as CPU that support all features we need (for example my development VM). An acceptable approach would be checking if the adapter supports all features we need. |
|
@timon-schelling yes I agree on your thought and made the respective changes to the file, can you please review? |
|
@ShivangSingh68 for your reference, you will need to mark the PR as Ready for Review if you want it to be not ignored by us on the review team. |
|
the error on the check displays: Significant performance regression detected: run_cached_iai::run_cached_group::run_cached with_setup_1 increased by 388,346 instructions (-6.13%) The code part I added shouldn't have such a huge impact on CPU instructions, can you please take a look at the code edited by yourself and help me figure the solution as I am unable to find one. Waiting for your guidance Thanks |
Fixes #3560
This PR fixes a startup crash that occurs on systems without a Vulkan-capable GPU.
Previously, Graphite would select a CPU-based Vulkan adapter (such as llvmpipe) and continue initialization. This would later trigger a wgpu validation error, followed by a panic and segmentation fault, making it difficult for users to understand that their system does not meet the graphics requirements.
Summary of changes
Detect and reject CPU-based Vulkan adapters during context initialization.
Fail early when no supported GPU adapter is available, instead of continuing into an invalid wgpu state.
Preserve existing adapter-selection logic while adding a clear support check to prevent crashes.
Impact
Prevents crashes and undefined behavior on unsupported systems.
Makes Graphite’s GPU requirements clearer to users.
Improves robustness and error handling during graphics initialization.
Testing
Confirmed normal startup on systems with a supported GPU.
Confirmed graceful failure (no panic or segmentation fault) when only CPU Vulkan adapters are present.
Verified with cargo check and cargo clippy --all-targets --all-features.