[PR #680] [MERGED] (libretro/Vulkan) Fix glslang shader-related crashes #78

Open
opened 2026-01-29 19:06:19 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/680
Author: @jdgleaver
Created: 8/1/2020
Status: Merged
Merged: 8/1/2020
Merged by: @stenzek

Base: masterHead: libretro-vulkan-fix


📝 Commits (1)

  • 363804c (libretro/Vulkan) Fix glslang shader-related crashes

📊 Changes

7 files changed (+28 additions, -1 deletions)

View changed files

📝 dep/glslang/OGLCompilersDLL/InitializeDll.cpp (+1 -0)
📝 dep/glslang/glslang/Include/InitializeGlobals.h (+1 -0)
📝 dep/glslang/glslang/MachineIndependent/PoolAlloc.cpp (+9 -0)
📝 dep/glslang/glslang/MachineIndependent/ShaderLang.cpp (+1 -0)
📝 src/common/vulkan/shader_compiler.cpp (+13 -1)
📝 src/common/vulkan/shader_compiler.h (+2 -0)
📝 src/duckstation-libretro/libretro_vulkan_host_display.cpp (+1 -0)

📄 Description

As reported in #672, the libretro core crashes when loading more than one item of content within a single session when running under Linux with an Intel integrated GPU.

There were actually 2 issues here:

  1. glslang::FinalizeProcess() is attached via std::atexit(). This does not work as intended when running duckstation as a dynamic shared object library... (it only gets called when RetroArch quits, not when the core is unloaded)

  2. With Linux + Intel iGPU, I was getting hit by the same 'mysterious' corruption issue that affected RetroArch itself some time ago, and which was fixed in this commit: 4437cd1eac

This PR ensures that glslang::FinalizeProcess() is called when unloading the core (and not on RetroArch exit), and backports the changes in 4437cd1eac. This fixes all crashing issues on my systems.

This closes #672

@stenzek I am by no means an expert in this particular area, so please review this carefully before merging! :)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/680 **Author:** [@jdgleaver](https://github.com/jdgleaver) **Created:** 8/1/2020 **Status:** ✅ Merged **Merged:** 8/1/2020 **Merged by:** [@stenzek](https://github.com/stenzek) **Base:** `master` ← **Head:** `libretro-vulkan-fix` --- ### 📝 Commits (1) - [`363804c`](https://github.com/stenzek/duckstation/commit/363804c48ba7ff023473a5d86aefb587aee70cfa) (libretro/Vulkan) Fix glslang shader-related crashes ### 📊 Changes **7 files changed** (+28 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `dep/glslang/OGLCompilersDLL/InitializeDll.cpp` (+1 -0) 📝 `dep/glslang/glslang/Include/InitializeGlobals.h` (+1 -0) 📝 `dep/glslang/glslang/MachineIndependent/PoolAlloc.cpp` (+9 -0) 📝 `dep/glslang/glslang/MachineIndependent/ShaderLang.cpp` (+1 -0) 📝 `src/common/vulkan/shader_compiler.cpp` (+13 -1) 📝 `src/common/vulkan/shader_compiler.h` (+2 -0) 📝 `src/duckstation-libretro/libretro_vulkan_host_display.cpp` (+1 -0) </details> ### 📄 Description As reported in #672, the libretro core crashes when loading more than one item of content within a single session when running under Linux with an Intel integrated GPU. There were actually 2 issues here: 1) `glslang::FinalizeProcess()` is attached via `std::atexit()`. This does not work as intended when running duckstation as a dynamic shared object library... (it only gets called when RetroArch quits, not when the core is unloaded) 2) With Linux + Intel iGPU, I was getting hit by the same 'mysterious' corruption issue that affected RetroArch itself some time ago, and which was fixed in this commit: https://github.com/libretro/RetroArch/commit/4437cd1eac144f1a3b5acda54c128213e59ec0e1 This PR ensures that `glslang::FinalizeProcess()` is called when unloading the core (and not on RetroArch exit), and backports the changes in https://github.com/libretro/RetroArch/commit/4437cd1eac144f1a3b5acda54c128213e59ec0e1. This fixes all crashing issues on my systems. This closes #672 @stenzek I am by no means an expert in this particular area, so please review this carefully before merging! :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:06:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#78