fix: GameProfilingSystem crashes on Vulkan (FastTextRenderer null command buffer)#3261
Merged
Merged
Conversation
…mand buffer) The F7 GPU profiler hard-crashes with a native 0xC0000005 on Vulkan inside FastTextRenderer.End (issue stride3d#1020). GameProfilingSystem.Draw rendered through RenderContext.GetShared(Services).GetThreadContext(); on Vulkan that thread-local command list is Close()d after the compositor's parallel scene rendering and never re-begun, so its native VkCommandBuffer is null and recording draw commands into it segfaults. It only worked on Direct3D11 because D3D11 records serially and its thread contexts alias the main command list (InternalMainCommandList, unset on Vulkan). Render through Game.GraphicsContext (the main per-frame command list, reset+begun each frame in GameBase.BeginDraw), matching DebugTextSystem. Behaviour-preserving on D3D11. Repro: https://github.com/sasvdw/stride-1020-vulkan-profiler-repro Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
xen2
reviewed
Jul 8, 2026
Ethereal77
reviewed
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Details
Fixes a native crash (
0xC0000005) on the Vulkan backend: enabling the on-screen game profiler (GameProfilingSystem, toggled with F7) crashes within a couple of frames insideFastTextRenderer.End.Root cause
GameProfilingSystem.DrawrenderedFastTextRendererthroughRenderContext.GetShared(Services).GetThreadContext(). On Vulkan that returns a thread-local pipeline-worker command list, which isClose()d during the compositor's parallel scene rendering (RenderSystem.Draw) and never re-begun afterwards — so its nativeVkCommandBufferis null, and recording draw commands into it inFastTextRenderer.Enddereferences a null handle → access violation.It only worked on Direct3D11 because D3D11 records serially (
IsDeferred == false) and its thread contexts alias the single main command list viaGraphicsDevice.InternalMainCommandList— which Vulkan intentionally does not set, because it does genuine parallel command-buffer recording. So the profiler was the oneGameSystem.Draw-level caller reaching into a pipeline-internal context that isn't valid outside the render pipeline.Fix
Render through
Game.GraphicsContext— the main, per-frame command list thatGameBase.BeginDrawresets and begins every frame — exactly asDebugTextSystem(the otherFastTextRendererconsumer) already does. Behaviour-preserving on Direct3D11 (that was already the main command list); fixes the crash on Vulkan. Single method changed; noFastTextRendererchange needed.Validation
Built the engine at a single consistent version and A/B-tested a minimal real game: without the change it crashes 3/3, with it runs cleanly and the profiler overlay renders. Minimal self-contained reproduction (clone +
dotnet runon a Vulkan GPU): https://github.com/sasvdw/stride-1020-vulkan-profiler-reproNote / follow-up
This is the targeted caller fix. The deeper issue —
GetThreadContext()silently handing aGameSystem.Drawan invalid (closed) command list on Vulkan, so any future out-of-pipeline drawing system is a latent crash — is a framework concern (DebugTextSystemeven carries a// TODO GRAPHICS REFACTOR where to get command list from?). I've kept this PR minimal and low-risk and will raise that separately as a proposal.Related Issue
Closes #1020. Related: #630 (
[Vulkan] WriteDiscard support— sameFastTextRenderer-on-Vulkan area).Types of changes
Checklist