Repository navigation
D3D12: split barriers, ignoreFailedPipelines and samplerLodBias - #345
Merged
Merged
Conversation
A split barrier's resource is not used between its two halves, and its second half
orders the work before the first against the work after it ("Split Barriers",
D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY / END_ONLY; Enhanced Barriers, "Split barriers",
D3D12_BARRIER_SYNC_SPLIT). Both halves were ordering points, and the first ended a
render pass whose draws had used UAVs, so work recorded between the halves waited for
the work before them, which is what a split barrier lets it not do. The first half
(BEGIN_ONLY, or SyncAfter SPLIT) now only does the barrier's bookkeeping; the second
orders as a whole barrier does.
d3d12_split_barrier has a pixel shader write a flag, a split transition of its buffer
around a draw that does not use it, and a later vertex shader read the flag, with legacy
and enhanced barriers. It passes before and after; with the second half also skipped it
fails (32 of 32 pixels see the flag unwritten), so it shows the second half still
orders. With MULLION_TRACE_PASS=heavy the draw between the halves now shares the first
draw's render pass instead of opening one after it.
…ke as one whose work is dropped A pipeline whose shader the converter refuses, or which Metal cannot compile, fails its creation, which many titles do not expect: they stop or crash. With d3d12.ignoreFailedPipelines (off by default, CODE.md 2.5) the creation succeeds with a pipeline whose draws are dropped before they reach a pass and whose dispatches are dropped, and the log names it. A failure to allocate still fails, as a cached blob of another build does before the pipeline is made. d3d12_ignore_failed_pipelines makes a graphics and a compute pipeline of shaders with a double-precision operation, which the converter refuses: without this both creations fail with E_INVALIDARG; with it they succeed, their draw and dispatch write nothing, and an ordinary draw and dispatch around them write what they should (--validate, three runs).
…s to every sampler's There was no way to bias the level of detail samplers pick beyond each sampler's own MipLODBias. DXVK has d3d11.samplerLodBias for it, which players use to sharpen what a title's upscaler or a low render resolution blurs. d3d11.samplerLodBias, for Direct3D 10 and 11, and d3d12.samplerLodBias, for Direct3D 12, are added to the bias each sampler is made with, held within -16 and 15.99 (D3D11_MIP_LOD_BIAS_MIN and _MAX, D3D12_MIP_LOD_BIAS_MIN and _MAX). The bias is the sampler metadata's, which shaders add to the LOD of every sample (D3D11.3 7.18.11, "biasedLOD = output.LOD + MipLODBias"), so it reaches Direct3D 12's static samplers too, which are the device's samplers of their descriptions. A Direct3D 11 sampler's GetDesc stays the application's. Without the options nothing changes. mullion.conf documents both. d3d11_sampler_lod_bias and d3d12_sampler_lod_bias sample a texture whose mip m holds m at LOD 5 through samplers of a bias of 0 and 0.5 (in a heap and static, for Direct3D 12), with no option, a bias of 1.5 and one of -2. Without the change the runs with a bias read mips 5 and 5.5 and fail; with it every run passes as every family under validation, three times each.
This was referenced Nov 22, 2026
# Conflicts: # tests/d3d12/meson.build
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.
Three D3D12 changes: split barriers, plus two options as DXVK and VKD3D-Proton have them. Split out of #341, with the same commits.
What changes
d3d12_split_barrierpasses before and after. With the second half also skipped, it fails on 32 of 32 pixels, so it shows the ordering is kept.MULLION_TRACE_PASS=heavy, the draw between the halves now shares the first draw's pass instead of following it.d3d12_ignore_failed_pipelines: both creations were refused (E_INVALIDARG) before.d3d11_sampler_lod_bias,d3d12_sampler_lod_bias: before the change, the biased runs read mips 5 and 5.5 instead of the expected ones.tests/d3d12/meson.build's one-line test list is also extended by #343. Whichever of the two is merged second conflicts on that line only, and keeping both sets of entries resolves it. I'll rebase whichever is left.Evidence
Mac mini, Apple M6, macOS 27.3. MetalSharp Wine 8.0 (arm64 with FEX), copied with
--clone. ARM64EC build with-Denable_nvngx=true -Denable_nvapi=true -Denable_tests=true.tests/run.py --family nativewithd3d12_split_barrier d3d12_ignore_failed_pipelines d3d11_sampler d3d12_sampler d3d12_barrier: 24 passed, 0 failed.main, and these tests passed on every default family with--validate --repeat 2.Not run