Repository navigation
Render: skip the viewport pipeline prebuild on a one-sample (OpenGL) backend - #39
Merged
Merged
Conversation
The background prebuild exists to compile the single-sample viewport pipelines early. On OpenGL the startup viewports are already one-sample (startup_samples == 1), so the prebuilt set is the viewport's own: the compiling thread holds the shared GL context longer than wgpu-hal's 1 s lock timeout (gles/wgl.rs) and the main thread panics with "Could not lock adapter context. This is most-likely a deadlock." about a second after startup (Intel HD 4600, shipped 0.5.1, GL 4.3). Vulkan/DX12 keep four samples and keep prebuilding; the existing RUSTUDIO_NO_PIPELINE_PREBUILD still forces the prebuild off.
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.
Summary
Renderer::with_capsstarts a background thread that prebuilds thesingle-sample viewport pipelines whenever
one_sample_likely(weak GPU /automatic quality / low detail). On the OpenGL backend the startup viewports
are already one-sample (
startup_samples(&caps) == 1), so the "prebuilt" setis the viewport's own pipelines — and compiling them on a second thread holds
the shared GL context past wgpu-hal's one-second lock timeout
(
gles/wgl.rs,CONTEXT_LOCK_TIMEOUT_SECS = 1). The main thread then panics:about 1.1 s after "rustudio 0.5.1 ready" — i.e. during the background build.
Change
One condition: only prebuild when the startup viewports are not already
one-sample.
sampled_msaa() == false→ 1): no thread; the viewport pipelines arebuilt on the main thread as the scene needs them, exactly what
RUSTUDIO_NO_PIPELINE_PREBUILD=1already does today.prebuilt in the background.
RUSTUDIO_NO_PIPELINE_PREBUILDstill forces the prebuild off.Verification on the affected machine
Intel HD Graphics 4600, GL 4.3 (20.19.15.5126), Windows 10, released
0.5.1 binary (
rustudio-windows-x64.zip), default backend (automatic quality,weak-GPU mode on):
--demo --screenshotexits 2 without writing a picture. App log:RUSTUDIO_NO_PIPELINE_PREBUILD=1, which takesthe same branch as the new condition): 3/3
--demo --screenshotruns finishclean (~640 KB PNG each), and
--demo(real GUI) stays up with no panic.Tests
crates/rustudio-render/tests/opengl.rsrunsgpu_check::build_and_draw, whichcalls
Renderer::with_capson a real GL device — on a GL-only machine thattest panics before this change and passes after. The CI adapters are
Vulkan/DX12, where this code path is intentionally unchanged, so the test suite
does not exercise it in CI.
I could not compile this tree on the affected machine (8 GB, the full workspace
build runs out of memory, unrelated to this change); the branch is the
v0.5.1tag plus that one condition, verified through the shipped binary with the
env-var equivalent.