Record dedicated program output fence

This commit is contained in:
Meta Vens 2026-05-28 00:09:39 +01:00
commit cc39882296
6 changed files with 34 additions and 29 deletions

View file

@ -29,8 +29,8 @@ dotnet run --project .\src\Mimir.App\Mimir.App.csproj
```
Fensalir creates a shareable D3D12 texture with that name, publishes a named
producer fence, and copies the finished backbuffer into the texture during the
present pass. `Mimir.EveRelay` opens that named texture, reads the completed
program-output fence, and copies the finished backbuffer into the texture during
the present pass. `Mimir.EveRelay` opens that named texture, reads the completed
program frame, feeds a low-latency H.264 encoder, and sends complete Annex-B
access units to EveCanvas over the existing `/stream` WebSocket. EveCanvas
treats JPEG frames as the old VoidBot dashboard fallback only; Mimir dashboard

View file

@ -163,13 +163,14 @@ a named invariant that the native runtime cannot protect yet.
`Mimir Audio Stem`, which reads one named stem and submits it to OBS as an
audio source, and `Mimir Program Texture`, which opens Fensalir's named D3D12
program-output texture and feeds OBS through a GPU-to-GPU D3D12-to-D3D11
bridge texture. Fensalir also publishes a named D3D12 producer fence, and the
OBS source opens it before copying so the consumer is not reading blindly.
This avoids CPU readback and removes Spout2 as a required program-video
dependency, while preserving the explicit boundary cost that libobs is D3D11
on Windows. Fensalir and the OBS source can optionally agree on a bounded
publication ring using `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects the
latest completed slot from the producer fence value. A later consumer
bridge texture. Fensalir also publishes a named D3D12 program-output fence,
and the OBS source opens it before copying so the consumer is not reading
blindly or depending on Fensalir's private frame fence. This avoids CPU
readback and removes Spout2 as a required program-video dependency, while
preserving the explicit boundary cost that libobs is D3D11 on Windows.
Fensalir and the OBS source can optionally agree on a bounded publication
ring using `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects the latest
completed slot from the program-output fence value. A later consumer
acknowledgement fence is still required to make producer/consumer overwrite
races structurally impossible.
`scripts/build-obs-stem-plugin.ps1` stages the upstream OBS plugin template

View file

@ -38,11 +38,12 @@ texture, creates an OBS-readable legacy shared D3D11 texture, opens that same
bridge texture from D3D12, and performs a GPU-to-GPU copy during OBS render
before drawing the source. This avoids CPU readback and does not require
Spout2. It is not pure zero-copy yet; the remaining copy is the
D3D12-to-libobs-D3D11 boundary. Fensalir also publishes a named D3D12 fence;
the OBS source opens it and observes the producer completion value before
copying. This prevents blind read-before-producer-completion behavior. A later
consumer acknowledgement fence is still required to make overwrite races
structurally impossible when producer and consumer cadence diverge.
D3D12-to-libobs-D3D11 boundary. Fensalir also publishes a named D3D12
program-output fence; the OBS source opens it and observes publication
completion before copying. This prevents blind read-before-producer-completion
behavior without coupling OBS to Fensalir's private frame fence. A later consumer
acknowledgement fence is still required to make overwrite races structurally
impossible when producer and consumer cadence diverge.
For OBS-only stress testing, Fensalir and the OBS source can agree on a bounded
texture ring:
@ -54,8 +55,8 @@ Texture ring slots: 3
With a ring count above one, Fensalir publishes textures named
`Global\MimirFensalirProgramTexture.0`, `.1`, and so on. The OBS source uses the
producer fence value to copy the latest completed slot. Leave the ring count at
`1` for EVE until the EVE relay speaks the same ring contract.
program-output fence value to copy the latest completed slot. Leave the ring
count at `1` for EVE until the EVE relay speaks the same ring contract.
For a visible interop witness while the real Mimir scene is sparse, launch
Mimir with:

View file

@ -325,11 +325,12 @@ and submits it through libobs audio, while `Mimir Program Texture` opens
Fensalir's named shared D3D12 program-output texture and draws it through an
OBS-readable shared D3D11 bridge texture. The video path is GPU-to-GPU and does
not require Spout2 or CPU readback; the remaining copy is the explicit D3D12 to
libobs-D3D11 boundary. Fensalir publishes `Global\MimirFensalirProgramFence`,
and the OBS source opens that producer fence before copying. This prevents
blind read-before-producer-completion. An optional texture ring is available
libobs-D3D11 boundary. Fensalir publishes `Global\MimirFensalirProgramFence` as
a program-output publication fence, and the OBS source opens that fence before
copying. This prevents blind read-before-producer-completion without coupling
OBS to Fensalir's private frame fence. An optional texture ring is available
when Fensalir and OBS agree on `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects
the latest completed slot from the producer fence value. A later consumer
the latest completed slot from the program-output fence value. A later consumer
acknowledgement fence is still needed to make overwrite races structurally
impossible. `scripts/build-obs-stem-plugin.ps1` stages the upstream
OBS plugin-template SDK under `artifacts/obs-sdk/` and builds the plugin DLL

View file

@ -198,3 +198,4 @@
{"ts": "2026-05-27T23:34:13+01:00", "type": "verification", "status": "ok", "note": "Live OBS program texture proof succeeded. With Mimir/Fensalir publishing Global\\\\MimirFensalirProgramTexture at 1264x681 and MIMIR_OBS_PROOF_VISUAL=1, OBS 32.1.2 loaded mimir_obs_stem_source.dll, the Mimir Program Texture source opened the shared texture, and the user visually confirmed the Fensalir debug/proof scene in OBS. The working bridge uses a legacy shared D3D11 texture because libobs accepts that handle path; D3D12 opens the same bridge texture and copies GPU-to-GPU from the Fensalir D3D12 program texture. This removes Spout2 and CPU readback from the program-video proof path while retaining the explicit D3D12-to-D3D11 boundary copy."}
{"ts": "2026-05-27T23:55:25+01:00", "type": "verification", "status": "ok", "note": "OBS program texture bridge now opens Fensalir's named D3D12 producer fence Global\\\\MimirFensalirProgramFence and the shared program texture Global\\\\MimirFensalirProgramTexture; live OBS 32.1.2 log showed producer fence value 1061 and texture 1264x681 while the proof visual appeared in OBS."}
{"ts": "2026-05-28T00:03:43+01:00", "type": "verification", "status": "ok", "note": "Optional OBS program texture ring proof passed: with FENSALIR_PROGRAM_OUTPUT_RING_COUNT=3, Fensalir published Global\\\\MimirFensalirProgramTexture.0/.1/.2 plus Global\\\\MimirFensalirProgramFence, and OBS 32.1.2 opened Mimir Program Texture at 1264x681 ring=3 with producer fence value 1149."}
{"ts": "2026-05-28T00:08:37+01:00", "type": "verification", "status": "ok", "note": "Fensalir program output now uses a dedicated shared publication fence instead of the private frame fence. Ring proof reran with FENSALIR_PROGRAM_OUTPUT_RING_COUNT=3; OBS opened Global\\\\MimirFensalirProgramFence at value 1252 and Global\\\\MimirFensalirProgramTexture ring=3 at 1264x681."}

View file

@ -201,15 +201,16 @@ accepted_design:
from that map and submits it as libobs audio, and `Mimir Program Texture`,
which opens Fensalir's named shared D3D12 program-output texture and draws
it through an OBS-readable shared D3D11 bridge texture. Fensalir also
publishes `Global\MimirFensalirProgramFence`; the OBS source opens that
producer fence and observes completion before copying. The video path is
GPU-to-GPU and does not require Spout2 or CPU readback; the remaining copy
is the explicit D3D12 to libobs-D3D11 boundary. Fensalir and the OBS source
can optionally agree on `FENSALIR_PROGRAM_OUTPUT_RING_COUNT>1`; Fensalir
publishes `Global\MimirFensalirProgramTexture.0`, `.1`, and so on, and OBS
chooses the latest completed slot from the producer fence value. A later
consumer acknowledgement fence is still required to make producer/consumer
overwrite races structurally impossible.
publishes `Global\MimirFensalirProgramFence` as a program-output
publication fence; the OBS source opens that fence and observes completion
before copying. The video path is GPU-to-GPU and does not require Spout2 or
CPU readback; the remaining copy is the explicit D3D12 to libobs-D3D11
boundary. Fensalir and the OBS source can optionally agree on
`FENSALIR_PROGRAM_OUTPUT_RING_COUNT>1`; Fensalir publishes
`Global\MimirFensalirProgramTexture.0`, `.1`, and so on, and OBS chooses the
latest completed slot from the program-output fence value. A later consumer
acknowledgement fence is still required to make producer/consumer overwrite
races structurally impossible.
`scripts/build-obs-stem-plugin.ps1` stages the upstream OBS plugin template
SDK under `artifacts/obs-sdk/` and builds the plugin DLL locally.
The synthetic