fix: avoid empty emplace() in GCC 14 libstdc++ #1325
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1325
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1325/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@gavvahar on GitHub · 2026-10-09 19:37 UTC · original
gavvahar:fix/indirect-descriptor-default-ctor→main· +66 −6 · 5 files · 6 commits · closed without mergingFixes a pre-existing compile failure in
tests/ResourceMaterializationTests.cppseen in recent CI runs onmain(e.g. run 37964051144) and other branches, on GCC 14.Root cause
DescriptorSource::IndirectDescriptoris default-constructible (ValuehasValue() = default;, and every other member is a scalar with an initializer,std::optional, orstd::vector). Butstd::optional<T>::emplace()with no args is SFINAE-constrained onis_constructible_v<T>, and GCC 14's libstdc++ computes that trait incorrectly asfalsefor this type — a known libstdc++ bug fixed in v15. CI builds with Clang against GCC 14's libstdc++ headers, which is why this doesn't reproduce with a newer libstdc++.Not caught locally because
resource_materialization_testsisEXCLUDE_FROM_ALL, so it's skipped by the default build target.Fix
Construct the
IndirectDescriptordirectly (goes through the language's type system, not the buggy trait), then pass it to the one-argemplace(Args...), which only needs move-constructibility.Verified: builds clean and
resource_materialization_testspasses locally (Clang + libstdc++ 15.3). Test-only change, no production code touched.The pipeline cache (VkPipelineCache serialized to _PipelineCache/{title_id}.bin) survives crashes only if the graphics subsystem has an emergency_shutdown callback to flush it to disk before process exit. Currently, the graphics lifecycle registers only a shutdown callback (runs on clean exit) but no emergency_shutdown (runs on assertion/EXIT() crashes). This causes crash scenarios to lose all compiled pipelines: if a game crashes during initial load (reported in issue #1300), the cache is never persisted, and the next launch has no warm cache, forcing full recompilation and perpetuating the stutter the user experienced before the crash. Add EmergencyShutdown() to Libs::Graphics following the exact pattern of Libs::Controller and Libs::LibKernel::FileSystem. The function: - Checks g_renderer != nullptr - Uses TryLock to avoid deadlock if called from a thread already holding the render context mutex (safe no-op if lock fails) - Calls Save() to persist the pipeline cache to disk Fixes #1300@coderabbitai[bot] on GitHub · 2026-10-09 19:42 UTC · original · edited 2026-10-09 20:24 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
08a0052c-969d-41b1-8d18-a90f56247aaf📥 Commits
Reviewing files that changed from the base of the PR and between
7c428ec706and8164fe13ec.📒 Files selected for processing (2)
src/libs/agc.cpptests/ResourceMaterializationTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
📝 Walkthrough
Walkthrough
The change adds mutex ownership tracking and a public ownership query. Graphics adds an emergency-shutdown function and registers it in the lifecycle. The function saves the pipeline cache only when the renderer exists, the current thread does not already own its mutex, and
TryLock()succeeds. The indirect descriptor test now builds and moves a local descriptor with source indices{0, 1}.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Feature
Merge Risk: 🟡 Moderate · up to
8164fMutex ownership can be reported incorrectly during condition-variable waits, and the tracking fields can be accessed concurrently. Correct the wait bookkeeping before merging.
Pre-merge checks |
4 |
1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -144,0 +149,4 @@// it needs no synchronization; m_owner is atomic because other threads read it.void Acquired() {m_depth++;m_owner.store(Thread::GetThreadIdUnique(), std::memory_order_relaxed);@coderabbitai[bot] on GitHub · 2026-10-09 19:42 UTC · original
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Update ownership tracking when a condition-variable wait releases the mutex.
CondVar::Wait()andCondVar::WaitFor()release the underlying mutex without updatingm_depthorm_owner. While a thread waits,IsHeldByCurrentThread()can report that it still owns the mutex. Another thread can then acquire the mutex and accessm_depthconcurrently. Update the tracking state on both sides of every underlying release and reacquisition, including the polling callback path.@coderabbitai[bot] on GitHub · 2026-10-09 19:42 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
509535a5-e73d-4211-ac9b-85db6d68d268📥 Commits
Reviewing files that changed from the base of the PR and between
59183dbfa8and7c428ec706.📒 Files selected for processing (5)
src/common/threads.cppsrc/common/threads.hsrc/libs/agc.cppsrc/libs/agc.htests/ResourceMaterializationTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Pull request closed