Skip to content

D3D12: split barriers, ignoreFailedPipelines and samplerLodBias - #345

Merged
dttdrv merged 4 commits into
dttdrv:mainfrom
aaf2tbz:split/d3d12-options
Nov 26, 2026
Merged

dttdrv merged 4 commits into
dttdrv:mainfrom
aaf2tbz:split/d3d12-options

Conversation

@aaf2tbz

@aaf2tbz aaf2tbz commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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: the first half of a split barrier orders nothing.
    • Both halves were ordering points, so work recorded between them waited for the work before them, which is what a split barrier exists to avoid. The second half still orders.
    • d3d12_split_barrier passes before and after. With the second half also skipped, it fails on 32 of 32 pixels, so it shows the ordering is kept.
    • With MULLION_TRACE_PASS=heavy, the draw between the halves now shares the first draw's pass instead of following it.
  • d3d12.ignoreFailedPipelines, off by default (CODE.md 2.5): a pipeline the converter or Metal cannot make is given to the application as one whose draws and dispatches are dropped, instead of failing creation. Running out of memory still fails. d3d12_ignore_failed_pipelines: both creations were refused (E_INVALIDARG) before.
  • d3d11.samplerLodBias and d3d12.samplerLodBias, as DXVK's options of the name: added to every sampler's own bias, within −16 to 15.99. 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.

Not run

  • x86_64 was not built.

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.
# Conflicts:
#	tests/d3d12/meson.build
@dttdrv
dttdrv merged commit 23e8773 into dttdrv:main Nov 26, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants