diff --git a/.github/actions/layer-dependencies/action.yml b/.github/actions/layer-dependencies/action.yml
new file mode 100644
index 00000000..4508976b
--- /dev/null
+++ b/.github/actions/layer-dependencies/action.yml
@@ -0,0 +1,84 @@
+name: Layer build dependencies
+description: >-
+ The pinned vcpkg registry and its OpenXR loader, and the archives the layer's CMake downloads
+ (Vulkan headers, DXC), cached between runs. GitHub's release downloads sometimes answer 5xx for
+ a while, so a cache hit downloads nothing, and every download that is still needed is retried.
+
+runs:
+ using: composite
+ steps:
+ - name: Checkout pinned vcpkg registry
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ repository: microsoft/vcpkg
+ ref: aae277acf4e7de287ddb5e208b5316614de6aad7
+ path: .vcpkg
+ persist-credentials: false
+
+ # After the registry's checkout, which would clear these.
+ - name: Cache vcpkg tool and OpenXR loader
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+ with:
+ path: |
+ .vcpkg/vcpkg.exe
+ .vcpkg/installed
+ key: openxr-loader-v1-${{ runner.os }}-aae277acf4e7de287ddb5e208b5316614de6aad7
+
+ - name: Cache layer downloads
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
+ with:
+ path: .downloads
+ key: layer-downloads-v1-${{ runner.os }}-${{ hashFiles('layer/CMakeLists.txt') }}
+ restore-keys: |
+ layer-downloads-v1-${{ runner.os }}-
+
+ - name: Install OpenXR loader
+ shell: pwsh
+ run: |
+ $vcpkgRoot = Join-Path $env:GITHUB_WORKSPACE ".vcpkg"
+ # Each download is tried a few times before failing.
+ function Invoke-WithRetry([string]$What, [int]$Attempts, [scriptblock]$Step) {
+ for ($attempt = 1; $attempt -le $Attempts; $attempt++) {
+ & $Step | Out-Host
+ if ($LASTEXITCODE -eq 0) { return $true }
+ if ($attempt -lt $Attempts) {
+ $delay = 20 * $attempt
+ Write-Host "$What failed (attempt $attempt of $Attempts); retrying in $delay s."
+ Start-Sleep -Seconds $delay
+ }
+ }
+ return $false
+ }
+
+ $vcpkgExe = Join-Path $vcpkgRoot "vcpkg.exe"
+ if (Test-Path $vcpkgExe) {
+ Write-Host "Using the cached vcpkg tool."
+ } else {
+ $bootstrapped = Invoke-WithRetry "Bootstrapping the pinned vcpkg registry" 3 {
+ & "$vcpkgRoot\bootstrap-vcpkg.bat" -disableMetrics
+ }
+ if (-not $bootstrapped) {
+ # The runner image ships a vcpkg tool: use it with the pinned
+ # registry rather than fail on the tool's download.
+ $preinstalled = if ($env:VCPKG_INSTALLATION_ROOT) { Join-Path $env:VCPKG_INSTALLATION_ROOT "vcpkg.exe" }
+ if (-not $preinstalled -or -not (Test-Path $preinstalled)) {
+ throw "Failed to bootstrap the pinned vcpkg registry, and the runner has no vcpkg tool to fall back on."
+ }
+ Write-Host "Using the runner's vcpkg tool ($preinstalled) with the pinned registry."
+ Copy-Item -LiteralPath $preinstalled -Destination $vcpkgExe -Force
+ }
+ }
+
+ "VCPKG_ROOT=$vcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+ $env:VCPKG_ROOT = $vcpkgRoot
+ # Already installed (a cache hit), this only checks the package.
+ $installed = Invoke-WithRetry "Installing the pinned OpenXR loader dependency" 5 {
+ & $vcpkgExe install openxr-loader:x64-windows
+ }
+ if (-not $installed) {
+ throw "Failed to install the pinned OpenXR loader dependency."
+ }
+
+ # layer/CMakeLists.txt keeps its pinned archives here (and retries their downloads).
+ "DEPTHXR_DOWNLOAD_CACHE=$(Join-Path $env:GITHUB_WORKSPACE '.downloads')" |
+ Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 88dceb00..4bd02a7a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,9 +9,12 @@ on:
permissions:
contents: read
+# The layer's tests split across two runners that run at once: those that create no graphics device (beside
+# the app's checks) and those that do, which run one at a time on WARP. "App tests and build", the check the
+# master ruleset requires, passes only when both do.
jobs:
app:
- name: App tests and build
+ name: App and layer CPU tests
runs-on: windows-2022
steps:
@@ -20,14 +23,6 @@ jobs:
with:
persist-credentials: false
- - name: Checkout pinned vcpkg registry
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- repository: microsoft/vcpkg
- ref: aae277acf4e7de287ddb5e208b5316614de6aad7
- path: .vcpkg
- persist-credentials: false
-
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
@@ -40,21 +35,8 @@ jobs:
with:
toolchain: 1.94.1
- - name: Install OpenXR loader
- shell: pwsh
- run: |
- $vcpkgRoot = Join-Path $env:GITHUB_WORKSPACE ".vcpkg"
- & "$vcpkgRoot\bootstrap-vcpkg.bat" -disableMetrics
- if ($LASTEXITCODE -ne 0) {
- throw "Failed to bootstrap the pinned vcpkg registry."
- }
-
- "VCPKG_ROOT=$vcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- $env:VCPKG_ROOT = $vcpkgRoot
- & "$vcpkgRoot\vcpkg.exe" install openxr-loader:x64-windows
- if ($LASTEXITCODE -ne 0) {
- throw "Failed to install the pinned OpenXR loader dependency."
- }
+ - name: Layer build dependencies
+ uses: ./.github/actions/layer-dependencies
- name: Install dependencies
working-directory: app
@@ -68,12 +50,55 @@ jobs:
working-directory: app
run: npm run build
- - name: Build and test OpenXR layer
+ - name: Build OpenXR layer and run its CPU tests
shell: pwsh
run: |
- ./scripts/Build-Layer.ps1
+ ./scripts/Build-Layer.ps1 -Tests Cpu
./scripts/Stage-ReleasePayload.ps1
- name: Check Tauri app
working-directory: app/src-tauri
run: cargo check --locked
+
+ layer-graphics:
+ name: Layer graphics tests
+ runs-on: windows-2022
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+
+ - name: Layer build dependencies
+ uses: ./.github/actions/layer-dependencies
+
+ - name: Build OpenXR layer and run its graphics tests
+ shell: pwsh
+ run: ./scripts/Build-Layer.ps1 -Tests Graphics
+
+ # The bridge layer tests keep each case's layer log under %TEMP%; a
+ # failing timing check needs it to be told apart from a slow runner.
+ - name: Upload layer test logs
+ if: failure()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: layer-graphics-test-logs
+ path: ~/AppData/Local/Temp/vectorxr-*/logs/
+ if-no-files-found: ignore
+ retention-days: 14
+
+ required:
+ name: App tests and build
+ needs: [app, layer-graphics]
+ if: always()
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Both halves passed
+ env:
+ APP: ${{ needs.app.result }}
+ GRAPHICS: ${{ needs.layer-graphics.result }}
+ run: |
+ echo "App and layer CPU tests: $APP; layer graphics tests: $GRAPHICS"
+ test "$APP" = success && test "$GRAPHICS" = success
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fdd0e4ae..e4c7925b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -29,14 +29,6 @@ jobs:
fetch-depth: 0
persist-credentials: false
- - name: Checkout pinned vcpkg registry
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- repository: microsoft/vcpkg
- ref: aae277acf4e7de287ddb5e208b5316614de6aad7
- path: .vcpkg
- persist-credentials: false
-
- name: Verify tagged commit belongs to master
if: github.event_name == 'push'
shell: pwsh
@@ -71,21 +63,8 @@ jobs:
working-directory: app
run: npm test
- - name: Install OpenXR loader
- shell: pwsh
- run: |
- $vcpkgRoot = Join-Path $env:GITHUB_WORKSPACE ".vcpkg"
- & "$vcpkgRoot\bootstrap-vcpkg.bat" -disableMetrics
- if ($LASTEXITCODE -ne 0) {
- throw "Failed to bootstrap the pinned vcpkg registry."
- }
-
- "VCPKG_ROOT=$vcpkgRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- $env:VCPKG_ROOT = $vcpkgRoot
- & "$vcpkgRoot\vcpkg.exe" install openxr-loader:x64-windows
- if ($LASTEXITCODE -ne 0) {
- throw "Failed to install the pinned OpenXR loader dependency."
- }
+ - name: Layer build dependencies
+ uses: ./.github/actions/layer-dependencies
- name: Build and stage OpenXR layer
shell: pwsh
diff --git a/app/package-lock.json b/app/package-lock.json
index 9051f546..7c7428d0 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "vectorxr-app",
- "version": "0.20.0",
+ "version": "0.20.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vectorxr-app",
- "version": "0.20.0",
+ "version": "0.20.1",
"license": "MPL-2.0",
"dependencies": {
"@tauri-apps/api": "~2.10.0",
diff --git a/app/package.json b/app/package.json
index 388570a8..9687006e 100644
--- a/app/package.json
+++ b/app/package.json
@@ -1,7 +1,7 @@
{
"name": "vectorxr-app",
"private": true,
- "version": "0.20.0",
+ "version": "0.20.1",
"license": "MPL-2.0",
"type": "module",
"scripts": {
diff --git a/app/src-tauri/Cargo.lock b/app/src-tauri/Cargo.lock
index ebcdbb32..1d054bdb 100644
--- a/app/src-tauri/Cargo.lock
+++ b/app/src-tauri/Cargo.lock
@@ -4030,7 +4030,7 @@ dependencies = [
[[package]]
name = "vectorxr-app"
-version = "0.20.0"
+version = "0.20.1"
dependencies = [
"serde",
"serde_json",
diff --git a/app/src-tauri/Cargo.toml b/app/src-tauri/Cargo.toml
index df4f4f60..d586aaf7 100644
--- a/app/src-tauri/Cargo.toml
+++ b/app/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "vectorxr-app"
-version = "0.20.0"
+version = "0.20.1"
description = "VectorXR configuration app"
authors = ["mdiener"]
edition = "2021"
diff --git a/app/src-tauri/src/main.rs b/app/src-tauri/src/main.rs
index 2b35c731..219951e3 100644
--- a/app/src-tauri/src/main.rs
+++ b/app/src-tauri/src/main.rs
@@ -916,6 +916,10 @@ fn default_framegen_diagnostic_view() -> String {
"off".into()
}
+fn is_true(value: &bool) -> bool {
+ *value
+}
+
fn is_false(value: &bool) -> bool {
!*value
}
@@ -945,6 +949,12 @@ struct FrameGenSettings {
// Head prediction past the runtime's limit.
#[serde(default, skip_serializing_if = "is_false")]
extend_head_prediction: bool,
+ // Edge fill: margins past the game's field of view (written only when on).
+ #[serde(default, skip_serializing_if = "is_false")]
+ edge_fill: bool,
+ // Use the game's depth (written only when off; absent means on).
+ #[serde(default = "default_true", skip_serializing_if = "is_true")]
+ use_game_depth: bool,
}
fn default_framegen_interpolate_flow() -> String { "auto".to_owned() }
@@ -960,6 +970,8 @@ impl Default for FrameGenSettings {
artifact_suppression: default_framegen_artifact_suppression(),
motion_limit_percent: default_framegen_motion_limit_percent(),
extend_head_prediction: false,
+ edge_fill: false,
+ use_game_depth: true,
}
}
}
@@ -3418,6 +3430,8 @@ mod tests {
assert_eq!(defaults.defaults.artifact_suppression, 50);
assert_eq!(defaults.defaults.motion_limit_percent, 10);
assert!(!defaults.defaults.extend_head_prediction);
+ assert!(!defaults.defaults.edge_fill);
+ assert!(defaults.defaults.use_game_depth);
assert!(defaults.profiles.is_empty());
// Older layers reject unknown keys (current ones ignore them with a
@@ -3435,12 +3449,17 @@ mod tests {
"settings": {
"synthesisMode": "interpolate", "flowQuality": "performance", "motionEstimation": "shader", "interpolateFlow": "shader",
"frameMultiplier": "3x", "artifactSuppression": 0, "motionLimitPercent": 25,
- "extendHeadPrediction": true
+ "extendHeadPrediction": true,
+ "edgeFill": true,
+ "useGameDepth": false
}
}]
});
let config: super::FrameGenModuleConfig = serde_json::from_value(input.clone()).unwrap();
assert!(config.profiles[0].settings.extend_head_prediction);
+ assert!(config.profiles[0].settings.edge_fill);
+ assert!(!config.profiles[0].settings.use_game_depth);
+ assert!(config.defaults.use_game_depth);
assert_eq!(serde_json::to_value(config).unwrap(), input);
// Settings saved without a frame multiplier load as Dynamic and save it.
diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.json
index 7606e7df..990be15d 100644
--- a/app/src-tauri/tauri.conf.json
+++ b/app/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "VectorXR",
- "version": "0.20.0",
+ "version": "0.20.1",
"identifier": "local.vectorxr.app",
"build": {
"beforeDevCommand": "npm run dev",
diff --git a/app/src/App.vue b/app/src/App.vue
index a761da7b..f015c18b 100644
--- a/app/src/App.vue
+++ b/app/src/App.vue
@@ -43,6 +43,11 @@ const turboInUse = computed(
store.state.config.modules.turbo.enabled ||
store.state.config.modules.turbo.profiles.some((profile) => profile.enabled),
)
+const frameGenInUse = computed(
+ () =>
+ store.state.config.modules.framegen.enabled ||
+ store.state.config.modules.framegen.profiles.some((profile) => profile.enabled),
+)
const quadviewsInUse = computed(
() =>
store.state.config.modules.quadviews.enabled ||
@@ -596,6 +601,7 @@ async function confirmResetConfig() {
:machine-writes-unlocked="openXrMachineWritesUnlocked"
:turbo-in-use="turboInUse"
:quadviews-in-use="quadviewsInUse"
+ :frame-gen-in-use="frameGenInUse"
@refresh="refreshOpenXrLayers(true)"
@machine-writes-unlocked="openXrMachineWritesUnlocked = $event"
@snapshot-updated="openXrLayerSnapshot = $event; refreshOpenXrLayers(true)"
@@ -634,6 +640,7 @@ async function confirmResetConfig() {
:config="store.state.config"
:applications="store.state.config.applications"
@add-pivot-profile="store.addPivotProfile"
+ @duplicate-pivot-profile="store.duplicatePivotProfile"
@remove-pivot-profile="store.removePivotProfile"
@move-pivot-profile="store.movePivotProfile"
@sync-pivot-profile-name="store.syncPivotProfileName"
diff --git a/app/src/components/FrameGenSettingsFields.vue b/app/src/components/FrameGenSettingsFields.vue
index 96c58d0b..2ab87cef 100644
--- a/app/src/components/FrameGenSettingsFields.vue
+++ b/app/src/components/FrameGenSettingsFields.vue
@@ -132,19 +132,30 @@ const advancedAtDefaults = computed(() =>
props.settings.flowQuality === advancedDefaults.flowQuality &&
props.settings.artifactSuppression === advancedDefaults.artifactSuppression &&
props.settings.motionLimitPercent === advancedDefaults.motionLimitPercent &&
- !props.settings.extendHeadPrediction)
+ !props.settings.extendHeadPrediction &&
+ props.settings.useGameDepth !== false)
const advancedSummary = computed(() =>
t(props.settings.extendHeadPrediction ? 'framegen.settings.advanced.summaryHeadPrediction' : 'framegen.settings.advanced.summary', {
flow: flowQuality.value.summary,
suppression: props.settings.artifactSuppression,
motionLimit: props.settings.motionLimitPercent,
- }))
+ }) + (props.settings.useGameDepth === false ? ' · ' + t('framegen.settings.gameDepth.summaryOff') : ''))
+
+// Stored only when off, like the layer reads it: absent means on.
+const useGameDepth = computed({
+ get: () => props.settings.useGameDepth !== false,
+ set: (on: boolean) => {
+ if (on) delete props.settings.useGameDepth
+ else props.settings.useGameDepth = false
+ },
+})
function resetAdvanced() {
props.settings.flowQuality = advancedDefaults.flowQuality
props.settings.artifactSuppression = advancedDefaults.artifactSuppression
props.settings.motionLimitPercent = advancedDefaults.motionLimitPercent
delete props.settings.extendHeadPrediction
+ delete props.settings.useGameDepth
}
@@ -289,6 +300,23 @@ function resetAdvanced() {
+
+
+
diff --git a/app/src/components/tabs/OpenXrLayersTab.vue b/app/src/components/tabs/OpenXrLayersTab.vue
index f5c213d5..1fe2417e 100644
--- a/app/src/components/tabs/OpenXrLayersTab.vue
+++ b/app/src/components/tabs/OpenXrLayersTab.vue
@@ -24,6 +24,7 @@ const props = defineProps<{
machineWritesUnlocked: boolean
turboInUse: boolean
quadviewsInUse: boolean
+ frameGenInUse: boolean
}>()
const emit = defineEmits<{
@@ -86,6 +87,20 @@ const toolkitQuadSlices = computed(() => {
}).map((slice) => sliceLabel(slice))
})
+// OpenXR Toolkit below VectorXR can't take Frame Generation's extra frames, so
+// the layer keeps Frame Generation off in that order (unless the Toolkit is
+// bypassed for the game, which the app can't see).
+const toolkitFrameGenSlices = computed(() => {
+ if (!props.frameGenInUse) {
+ return []
+ }
+ return (props.snapshot?.slices ?? []).filter((slice) => {
+ const vector = slice.layers.find((layer) => layer.isVectorXr && layer.enabled)
+ const toolkit = slice.layers.find((layer) => layer.enabled && layer.layerName.toLowerCase().includes('mbucchia_toolkit'))
+ return vector && toolkit && toolkit.order > vector.order
+ }).map((slice) => sliceLabel(slice))
+})
+
// The backend names each slice in English; show the name for its id when the
// catalog has one.
function sliceLabel(slice: OpenXrLayerRegistrySlice): string {
@@ -486,6 +501,15 @@ function signatureGuidance(layer: OpenXrLayerEntry): string {
{{ t('layers.warnings.toolkitQuad', { slices: formatList(toolkitQuadSlices) }) }}
+
+ {{ t('layers.warnings.frameGenOffLabel') }}
+ {{ t('layers.warnings.toolkitFrameGen', { slices: formatList(toolkitFrameGenSlices) }) }}
+
+
diff --git a/app/src/components/tabs/PivotXrTab.vue b/app/src/components/tabs/PivotXrTab.vue
index 05a8d43c..618dc3c2 100644
--- a/app/src/components/tabs/PivotXrTab.vue
+++ b/app/src/components/tabs/PivotXrTab.vue
@@ -25,14 +25,32 @@ const props = defineProps<{
applications: RegisteredApplication[]
}>()
-defineEmits<{
+const emit = defineEmits<{
addPivotProfile: []
+ duplicatePivotProfile: [index: number]
removePivotProfile: [index: number]
movePivotProfile: [index: number, direction: -1 | 1]
syncPivotProfileName: [index: number]
}>()
const compatibilityInfoOpen = ref(false)
+
+// After a duplicate, bring the copy into view and pulse it briefly so it's
+// clear where it landed. 'nearest' leaves the page alone when it's visible.
+const flashProfileId = ref(null)
+let flashTimer: ReturnType | undefined
+
+async function duplicateProfile(index: number) {
+ emit('duplicatePivotProfile', index)
+ const copy = props.config.modules.pivotxr.profiles[index + 1]
+ if (!copy) return
+ await nextTick()
+ const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
+ document.querySelector(`[data-profile-id="${CSS.escape(copy.id)}"]`)?.scrollIntoView({ behavior: reduceMotion ? 'auto' : 'smooth', block: 'nearest' }) // i18n-ignore
+ flashProfileId.value = copy.id
+ clearTimeout(flashTimer)
+ flashTimer = setTimeout(() => { flashProfileId.value = null }, 1200)
+}
const centeringInfoOpen = ref(false)
// Bindings are edited on a dedicated sub-page (not a dialog) so the editors
@@ -472,6 +490,9 @@ const profileOverviewWarningIndexes = computed(() => profileWarningState.value.o
profileWarningState.value.o
:warning-title="t('pivot.tab.bindingWarning')"
:warnings="profileWarnings.get(index)"
reorderable
+ duplicable
:profile-count="config.modules.pivotxr.profiles.length"
+ @duplicate="duplicateProfile(index)"
@remove="$emit('removePivotProfile', index)"
@move="$emit('movePivotProfile', index, $event)"
@sync-name="$emit('syncPivotProfileName', index)"
@@ -613,9 +636,38 @@ const profileOverviewWarningIndexes = computed(() => profileWarningState.value.o
transition: transform 0.3s ease;
}
+/* A new card (Add or Duplicate) fades and slides in; the cards below it slide
+ down via the move class above. */
+.pivot-profile-enter-active {
+ transition: opacity 0.25s ease, transform 0.25s ease;
+}
+.pivot-profile-enter-from {
+ opacity: 0;
+ transform: translateY(-0.5rem);
+}
+
+/* Keeps a scrolled-to card clear of the sticky Custom Profiles header. */
+.pivot-profile-card {
+ scroll-margin-top: 6rem;
+ scroll-margin-bottom: 1rem;
+}
+
+/* Brief accent ring on a fresh duplicate; it fades back out on its own. */
+.pivot-profile-flash {
+ animation: pivot-profile-flash 1.2s ease-out;
+}
+@keyframes pivot-profile-flash {
+ 0%, 35% { outline: 2px solid var(--app-accent); outline-offset: 2px; }
+ 100% { outline: 2px solid transparent; outline-offset: 2px; }
+}
+
@media (prefers-reduced-motion: reduce) {
- .pivot-profile-move {
+ .pivot-profile-move,
+ .pivot-profile-enter-active {
transition: none;
}
+ .pivot-profile-flash {
+ animation: none;
+ }
}
diff --git a/app/src/i18n/locales/de/app.json b/app/src/i18n/locales/de/app.json
index 54d3d870..d9f297a4 100644
--- a/app/src/i18n/locales/de/app.json
+++ b/app/src/i18n/locales/de/app.json
@@ -144,6 +144,7 @@
"priority": "Prioritätsreihenfolge – wenn sich Profile bei einer Anwendung überschneiden, gehört jede gemeinsame Belegung dem höheren Profil.",
"moveUp": "Profil nach oben verschieben (höhere Priorität)",
"moveDown": "Profil nach unten verschieben (niedrigere Priorität)",
+ "duplicateTitle": "Dieses Profil mit seinen Einstellungen und Belegungen als neues Profil darunter kopieren.",
"enabledTitle": "Dieses Profil wendet eigene {module}-Einstellungen auf die zugewiesenen Anwendungen an.",
"disabledTitle": "Dieses Profil wird zur Laufzeit ignoriert.",
"on": "Profil ein",
diff --git a/app/src/i18n/locales/de/framegen.json b/app/src/i18n/locales/de/framegen.json
index c73d5e91..97c013ae 100644
--- a/app/src/i18n/locales/de/framegen.json
+++ b/app/src/i18n/locales/de/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Wert der Bewegungsgrenze in Prozent der Ansichtsbreite",
"description": "Wie weit ein generiertes Bild das Bild höchstens verschieben darf, als Anteil der Ansichtsbreite. Bei schnellerer Bewegung wird das echte Bild angezeigt."
},
+ "gameDepth": {
+ "heading": "Spieltiefe verwenden",
+ "description": "Nutzt die Tiefe, die das Spiel liefert, damit nahe Objekte stabil bleiben. Schalte die Option aus, wenn ein Spiel mit Frame Generation ruckelt, hängt oder Tiefenartefakte zeigt; Frame Generation arbeitet dann ohne Tiefe.",
+ "restart": "Wirkt nach einem Neustart des Spiels",
+ "summaryOff": "Ohne Spieltiefe"
+ },
"headPrediction": {
"heading": "Kopfvorhersage erweitern",
"description": "Frame Generation lässt das Spiel bis zu ~150 ms im Voraus rendern, und manche Laufzeiten, etwa die von Pimax, sagen Ihren Kopf nur ~20 ms davon voraus. Diese Option führt die Drehung Ihres Kopfes über den Rest fort, für weniger Schwarz an dem Rand, zu dem Sie sich drehen. Schalten Sie sie vor dem Start des Spiels ein."
diff --git a/app/src/i18n/locales/de/layers.json b/app/src/i18n/locales/de/layers.json
index d0528e93..8a37602e 100644
--- a/app/src/i18n/locales/de/layers.json
+++ b/app/src/i18n/locales/de/layers.json
@@ -21,7 +21,9 @@
"turboLabel": "Turbo-Konflikt:",
"toolkitTurbo": "OpenXR Toolkit ist aktiviert, während VectorXR Turbo verwendet wird. Zwei Layer zur Bildtaktung behindern sich gegenseitig – wenn der Turbo-Modus von OXRTK eingeschaltet ist, deaktivieren Sie ihn dort oder in VectorXR, niemals beide.",
"quadviewsOffLabel": "Quadviews aus:",
- "toolkitQuad": "OpenXR Toolkit steht über VectorXR ({slices}). Es unterstützt keine Quad Views, daher lässt VectorXR Quadviews für jedes Spiel ausgeschaltet, in dem OpenXR Toolkit läuft. Deaktivieren Sie OpenXR Toolkit oder schalten Sie es für diese Spiele aus, um Quadviews zu verwenden."
+ "toolkitQuad": "OpenXR Toolkit steht über VectorXR ({slices}). Es unterstützt keine Quad Views, daher lässt VectorXR Quadviews für jedes Spiel ausgeschaltet, in dem OpenXR Toolkit läuft. Deaktivieren Sie OpenXR Toolkit oder schalten Sie es für diese Spiele aus, um Quadviews zu verwenden.",
+ "frameGenOffLabel": "Frame Generation aus:",
+ "toolkitFrameGen": "OpenXR Toolkit liegt unter VectorXR ({slices}). Dort kann es die zusätzlichen Bilder von Frame Generation nicht verarbeiten, daher lässt VectorXR Frame Generation in jedem Spiel aus, in dem OpenXR Toolkit läuft. Verschiebe OpenXR Toolkit über VectorXR oder schalte es für diese Spiele aus, um Frame Generation zu nutzen."
},
"status": {
"unlocked": "Computerweite Schreibvorgänge für OpenXR-Layer sind für diese App-Sitzung entsperrt.",
diff --git a/app/src/i18n/locales/de/pivot.json b/app/src/i18n/locales/de/pivot.json
index 3a54e7c1..df4d6195 100644
--- a/app/src/i18n/locales/de/pivot.json
+++ b/app/src/i18n/locales/de/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Noch keine eigenen Profile. Fügen Sie ein Profil hinzu, um die Pivot-Drehung an eine bestimmte Anwendung zu binden.",
"profileNumber": "Profil {number}",
"nudgeSetDefaultName": "Nudge-Satz",
- "nudgeSetCopyName": "{name} Kopie"
+ "nudgeSetCopyName": "{name} Kopie",
+ "profileCopyName": "{name} Kopie"
},
"warnings": {
"noActivationTitle": "Keine Aktivierung für Motion Assist",
diff --git a/app/src/i18n/locales/en/app.json b/app/src/i18n/locales/en/app.json
index a313ae27..f2aa1b5b 100644
--- a/app/src/i18n/locales/en/app.json
+++ b/app/src/i18n/locales/en/app.json
@@ -144,6 +144,7 @@
"priority": "Priority order — when profiles overlap on an application, the higher profile owns any binding they share.",
"moveUp": "Move profile up (higher priority)",
"moveDown": "Move profile down (lower priority)",
+ "duplicateTitle": "Copy this profile, with its settings and bindings, into a new profile below it.",
"enabledTitle": "This profile applies custom {module} settings to its assigned applications.",
"disabledTitle": "This profile is ignored at runtime.",
"on": "Profile On",
diff --git a/app/src/i18n/locales/en/framegen.json b/app/src/i18n/locales/en/framegen.json
index a3ee720e..8073905f 100644
--- a/app/src/i18n/locales/en/framegen.json
+++ b/app/src/i18n/locales/en/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Motion limit value in percent of view width",
"description": "The farthest a generated frame may move the image, as a share of view width. Faster motion shows the real image."
},
+ "gameDepth": {
+ "heading": "Use game depth",
+ "description": "Uses the depth the game provides to keep near objects steady. Turn off if a game stutters, hangs or shows depth artifacts with Frame Generation; Frame Generation then works without depth.",
+ "restart": "Takes effect when the game restarts",
+ "summaryOff": "Without game depth"
+ },
"headPrediction": {
"heading": "Extend head prediction",
"description": "Frame Generation has the game render up to ~150 ms ahead, and some runtimes, such as Pimax's, predict your head only ~20 ms of that. This carries your head's turn over the rest, for less black at the edge you turn toward. Turn it on before starting the game."
diff --git a/app/src/i18n/locales/en/layers.json b/app/src/i18n/locales/en/layers.json
index 2d108056..139c3507 100644
--- a/app/src/i18n/locales/en/layers.json
+++ b/app/src/i18n/locales/en/layers.json
@@ -21,7 +21,9 @@
"turboLabel": "Turbo conflict:",
"toolkitTurbo": "OpenXR Toolkit is enabled while VectorXR Turbo is in use. Two frame-pacing layers fight each other — if OXRTK's Turbo Mode is on, disable it there or in VectorXR, never both.",
"quadviewsOffLabel": "Quadviews off:",
- "toolkitQuad": "OpenXR Toolkit is above VectorXR ({slices}). It does not support quad views, so VectorXR keeps Quadviews off for every game OpenXR Toolkit runs in. Disable OpenXR Toolkit, or turn it off for those games, to use Quadviews."
+ "toolkitQuad": "OpenXR Toolkit is above VectorXR ({slices}). It does not support quad views, so VectorXR keeps Quadviews off for every game OpenXR Toolkit runs in. Disable OpenXR Toolkit, or turn it off for those games, to use Quadviews.",
+ "frameGenOffLabel": "Frame Generation off:",
+ "toolkitFrameGen": "OpenXR Toolkit is below VectorXR ({slices}). It can't handle Frame Generation's extra frames there, so VectorXR keeps Frame Generation off in every game OpenXR Toolkit runs in. Move OpenXR Toolkit above VectorXR, or turn it off for those games, to use Frame Generation."
},
"status": {
"unlocked": "Machine-wide OpenXR layer writes are unlocked for this app session.",
diff --git a/app/src/i18n/locales/en/pivot.json b/app/src/i18n/locales/en/pivot.json
index 17bd8511..d2f4c1c5 100644
--- a/app/src/i18n/locales/en/pivot.json
+++ b/app/src/i18n/locales/en/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "No custom profiles yet. Add a profile to bind Pivot rotation to a specific application.",
"profileNumber": "Profile {number}",
"nudgeSetDefaultName": "Nudge Set",
- "nudgeSetCopyName": "{name} Copy"
+ "nudgeSetCopyName": "{name} Copy",
+ "profileCopyName": "{name} Copy"
},
"warnings": {
"noActivationTitle": "No Motion Assist activation",
diff --git a/app/src/i18n/locales/es-ES/app.json b/app/src/i18n/locales/es-ES/app.json
index 5ffbb1c6..c11519a9 100644
--- a/app/src/i18n/locales/es-ES/app.json
+++ b/app/src/i18n/locales/es-ES/app.json
@@ -144,6 +144,7 @@
"priority": "Orden de prioridad: cuando los perfiles coinciden en una aplicación, el perfil superior se queda con las asignaciones que compartan.",
"moveUp": "Subir perfil (mayor prioridad)",
"moveDown": "Bajar perfil (menor prioridad)",
+ "duplicateTitle": "Copia este perfil, con sus ajustes y asignaciones, en un perfil nuevo debajo.",
"enabledTitle": "Este perfil aplica una configuración personalizada de {module} a sus aplicaciones asignadas.",
"disabledTitle": "Este perfil se ignora en tiempo de ejecución.",
"on": "Perfil activado",
diff --git a/app/src/i18n/locales/es-ES/framegen.json b/app/src/i18n/locales/es-ES/framegen.json
index ad739d69..dd62a68d 100644
--- a/app/src/i18n/locales/es-ES/framegen.json
+++ b/app/src/i18n/locales/es-ES/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Valor del límite de movimiento en porcentaje del ancho de la vista",
"description": "Lo máximo que un fotograma generado puede desplazar la imagen, como proporción del ancho de la vista. Un movimiento más rápido muestra la imagen real."
},
+ "gameDepth": {
+ "heading": "Usar la profundidad del juego",
+ "description": "Usa la profundidad que proporciona el juego para mantener estables los objetos cercanos. Desactívalo si un juego da tirones, se bloquea o muestra artefactos de profundidad con Frame Generation; Frame Generation funcionará entonces sin profundidad.",
+ "restart": "Se aplica al reiniciar el juego",
+ "summaryOff": "Sin profundidad del juego"
+ },
"headPrediction": {
"heading": "Ampliar la predicción de cabeza",
"description": "Frame Generation hace que el juego renderice hasta ~150 ms por adelantado, y algunos entornos de ejecución, como el de Pimax, solo predicen tu cabeza unos ~20 ms de ese tiempo. Esto prolonga el giro de tu cabeza durante el resto, para que haya menos negro en el borde hacia el que giras. Actívalo antes de iniciar el juego."
diff --git a/app/src/i18n/locales/es-ES/layers.json b/app/src/i18n/locales/es-ES/layers.json
index fafb3a7b..1a7644a0 100644
--- a/app/src/i18n/locales/es-ES/layers.json
+++ b/app/src/i18n/locales/es-ES/layers.json
@@ -21,7 +21,9 @@
"turboLabel": "Conflicto de Turbo:",
"toolkitTurbo": "OpenXR Toolkit está activado mientras se usa Turbo de VectorXR. Dos capas de ritmo de fotogramas compiten entre sí: si el modo Turbo de OXRTK está activado, desactívalo allí o en VectorXR, nunca en ambos.",
"quadviewsOffLabel": "Quadviews desactivado:",
- "toolkitQuad": "OpenXR Toolkit está por encima de VectorXR ({slices}). No admite cuatro vistas, así que VectorXR mantiene Quadviews desactivado en todos los juegos en los que se ejecuta OpenXR Toolkit. Desactiva OpenXR Toolkit, o desactívalo para esos juegos, para usar Quadviews."
+ "toolkitQuad": "OpenXR Toolkit está por encima de VectorXR ({slices}). No admite cuatro vistas, así que VectorXR mantiene Quadviews desactivado en todos los juegos en los que se ejecuta OpenXR Toolkit. Desactiva OpenXR Toolkit, o desactívalo para esos juegos, para usar Quadviews.",
+ "frameGenOffLabel": "Frame Generation desactivado:",
+ "toolkitFrameGen": "OpenXR Toolkit está debajo de VectorXR ({slices}). Ahí no puede gestionar los fotogramas adicionales de Frame Generation, así que VectorXR mantiene Frame Generation desactivado en todos los juegos en los que se ejecuta OpenXR Toolkit. Mueve OpenXR Toolkit por encima de VectorXR, o desactívalo para esos juegos, para usar Frame Generation."
},
"status": {
"unlocked": "La escritura de capas OpenXR para todo el equipo está desbloqueada durante esta sesión de la aplicación.",
diff --git a/app/src/i18n/locales/es-ES/pivot.json b/app/src/i18n/locales/es-ES/pivot.json
index e459260e..073ba013 100644
--- a/app/src/i18n/locales/es-ES/pivot.json
+++ b/app/src/i18n/locales/es-ES/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Todavía no hay perfiles personalizados. Agrega un perfil para vincular la rotación de Pivot a una aplicación concreta.",
"profileNumber": "Perfil {number}",
"nudgeSetDefaultName": "Conjunto de ajustes finos",
- "nudgeSetCopyName": "Copia de {name}"
+ "nudgeSetCopyName": "Copia de {name}",
+ "profileCopyName": "Copia de {name}"
},
"warnings": {
"noActivationTitle": "Sin activación de la asistencia de movimiento",
diff --git a/app/src/i18n/locales/fr/app.json b/app/src/i18n/locales/fr/app.json
index 714d7359..c93b8965 100644
--- a/app/src/i18n/locales/fr/app.json
+++ b/app/src/i18n/locales/fr/app.json
@@ -144,6 +144,7 @@
"priority": "Ordre de priorité — lorsque des profils se chevauchent sur une application, le profil le plus haut détient toute affectation qu'ils partagent.",
"moveUp": "Monter le profil (priorité plus élevée)",
"moveDown": "Descendre le profil (priorité plus basse)",
+ "duplicateTitle": "Copier ce profil, avec ses réglages et ses assignations, dans un nouveau profil en dessous.",
"enabledTitle": "Ce profil applique des paramètres {module} personnalisés aux applications qui lui sont attribuées.",
"disabledTitle": "Ce profil est ignoré à l'exécution.",
"on": "Profil activé",
diff --git a/app/src/i18n/locales/fr/framegen.json b/app/src/i18n/locales/fr/framegen.json
index 36a1002e..af3b626f 100644
--- a/app/src/i18n/locales/fr/framegen.json
+++ b/app/src/i18n/locales/fr/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Valeur de la limite de mouvement en pourcentage de la largeur de vue",
"description": "Le déplacement maximal qu'une image générée peut appliquer à l'image, en proportion de la largeur de vue. Un mouvement plus rapide affiche l'image réelle."
},
+ "gameDepth": {
+ "heading": "Utiliser la profondeur du jeu",
+ "description": "Utilise la profondeur fournie par le jeu pour garder les objets proches stables. Désactivez-la si un jeu saccade, se bloque ou présente des artefacts de profondeur avec Frame Generation ; Frame Generation fonctionne alors sans profondeur.",
+ "restart": "S’applique au redémarrage du jeu",
+ "summaryOff": "Sans profondeur du jeu"
+ },
"headPrediction": {
"heading": "Étendre la prédiction de la tête",
"description": "Frame Generation fait rendre le jeu jusqu'à ~150 ms à l'avance, et certains runtimes, comme celui de Pimax, ne prédisent votre tête que sur ~20 ms de cette durée. Cette option prolonge la rotation de votre tête sur le reste, pour moins de noir sur le bord vers lequel vous tournez. Activez-la avant de démarrer le jeu."
diff --git a/app/src/i18n/locales/fr/layers.json b/app/src/i18n/locales/fr/layers.json
index 44bb0443..33a1cf8f 100644
--- a/app/src/i18n/locales/fr/layers.json
+++ b/app/src/i18n/locales/fr/layers.json
@@ -21,7 +21,9 @@
"turboLabel": "Conflit Turbo :",
"toolkitTurbo": "OpenXR Toolkit est activé alors que Turbo de VectorXR est utilisé. Deux couches de cadencement des images se contrarient — si le mode Turbo d'OXRTK est activé, désactivez-le là-bas ou dans VectorXR, jamais les deux.",
"quadviewsOffLabel": "Quadviews désactivé :",
- "toolkitQuad": "OpenXR Toolkit se trouve au-dessus de VectorXR ({slices}). Il ne prend pas en charge les quad views ; VectorXR garde donc Quadviews désactivé pour chaque jeu dans lequel OpenXR Toolkit s'exécute. Désactivez OpenXR Toolkit, ou désactivez-le pour ces jeux, pour utiliser Quadviews."
+ "toolkitQuad": "OpenXR Toolkit se trouve au-dessus de VectorXR ({slices}). Il ne prend pas en charge les quad views ; VectorXR garde donc Quadviews désactivé pour chaque jeu dans lequel OpenXR Toolkit s'exécute. Désactivez OpenXR Toolkit, ou désactivez-le pour ces jeux, pour utiliser Quadviews.",
+ "frameGenOffLabel": "Frame Generation désactivé :",
+ "toolkitFrameGen": "OpenXR Toolkit est sous VectorXR ({slices}). À cet endroit, il ne peut pas gérer les images supplémentaires de Frame Generation : VectorXR laisse donc Frame Generation désactivé dans tous les jeux où OpenXR Toolkit s’exécute. Placez OpenXR Toolkit au-dessus de VectorXR, ou désactivez-le pour ces jeux, pour utiliser Frame Generation."
},
"status": {
"unlocked": "Les écritures de couches OpenXR à l'échelle de la machine sont déverrouillées pour cette session de l'application.",
diff --git a/app/src/i18n/locales/fr/pivot.json b/app/src/i18n/locales/fr/pivot.json
index 0c265b71..5e79ab09 100644
--- a/app/src/i18n/locales/fr/pivot.json
+++ b/app/src/i18n/locales/fr/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Aucun profil personnalisé pour l'instant. Ajoutez un profil pour lier la rotation Pivot à une application précise.",
"profileNumber": "Profil {number}",
"nudgeSetDefaultName": "Jeu d'ajustements",
- "nudgeSetCopyName": "Copie de {name}"
+ "nudgeSetCopyName": "Copie de {name}",
+ "profileCopyName": "Copie de {name}"
},
"warnings": {
"noActivationTitle": "Aucune activation de l'Assistance au mouvement",
diff --git a/app/src/i18n/locales/ja/app.json b/app/src/i18n/locales/ja/app.json
index b3c86892..4c3187e2 100644
--- a/app/src/i18n/locales/ja/app.json
+++ b/app/src/i18n/locales/ja/app.json
@@ -140,6 +140,7 @@
"priority": "優先順位 — 複数のプロファイルが同じアプリケーションで重なる場合、共有するバインドは上位のプロファイルが所有します。",
"moveUp": "プロファイルを上へ移動 (優先度を上げる)",
"moveDown": "プロファイルを下へ移動 (優先度を下げる)",
+ "duplicateTitle": "このプロファイルを設定と割り当てごと、すぐ下の新しいプロファイルにコピーします。",
"enabledTitle": "このプロファイルは、割り当てられたアプリケーションにカスタムの {module} 設定を適用します。",
"disabledTitle": "このプロファイルは実行時に無視されます。",
"on": "プロファイル オン",
diff --git a/app/src/i18n/locales/ja/framegen.json b/app/src/i18n/locales/ja/framegen.json
index c41e4210..5f9b3a74 100644
--- a/app/src/i18n/locales/ja/framegen.json
+++ b/app/src/i18n/locales/ja/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "ビュー幅に対する割合 (%) で表した動きの上限の値",
"description": "生成フレームが画像を移動できる最大量で、ビュー幅に対する割合で表します。これより速い動きでは実際の画像が表示されます。"
},
+ "gameDepth": {
+ "heading": "ゲームの深度を使用",
+ "description": "ゲームが提供する深度を使って、近くの物体を安定させます。Frame Generation 使用中にゲームがカクつく、停止する、または深度のアーティファクトが出る場合はオフにしてください。Frame Generation は深度なしで動作します。",
+ "restart": "ゲームの再起動後に反映されます",
+ "summaryOff": "ゲーム深度なし"
+ },
"headPrediction": {
"heading": "頭の予測を延長",
"description": "Frame Generation はゲームに最大約 150 ms 先までレンダリングさせますが、Pimax などの一部のランタイムはそのうち約 20 ms 分しか頭の動きを予測しません。この設定は残りの時間にも頭の回転を引き継ぎ、向いた側の端に出る黒い部分を減らします。ゲームを開始する前にオンにしてください。"
diff --git a/app/src/i18n/locales/ja/layers.json b/app/src/i18n/locales/ja/layers.json
index 2a8e4e4c..1e29ef8e 100644
--- a/app/src/i18n/locales/ja/layers.json
+++ b/app/src/i18n/locales/ja/layers.json
@@ -20,7 +20,9 @@
"turboLabel": "Turbo の競合:",
"toolkitTurbo": "VectorXR Turbo の使用中に OpenXR Toolkit が有効になっています。2 つのフレーム ペーシング レイヤーは互いに干渉します。OXRTK の Turbo Mode がオンの場合は、OXRTK 側か VectorXR 側のどちらかで無効にしてください。両方で使用しないでください。",
"quadviewsOffLabel": "Quadviews オフ:",
- "toolkitQuad": "OpenXR Toolkit が VectorXR より上にあります ({slices})。OpenXR Toolkit はクアッド ビューに対応していないため、VectorXR は OpenXR Toolkit が動作するすべてのゲームで Quadviews をオフにします。Quadviews を使用するには、OpenXR Toolkit を無効にするか、それらのゲームでオフにしてください。"
+ "toolkitQuad": "OpenXR Toolkit が VectorXR より上にあります ({slices})。OpenXR Toolkit はクアッド ビューに対応していないため、VectorXR は OpenXR Toolkit が動作するすべてのゲームで Quadviews をオフにします。Quadviews を使用するには、OpenXR Toolkit を無効にするか、それらのゲームでオフにしてください。",
+ "frameGenOffLabel": "Frame Generation オフ:",
+ "toolkitFrameGen": "OpenXR Toolkit が VectorXR の下にあります({slices})。この位置では Frame Generation の追加フレームを処理できないため、OpenXR Toolkit が動作するすべてのゲームで VectorXR は Frame Generation をオフにします。Frame Generation を使うには、OpenXR Toolkit を VectorXR の上に移動するか、それらのゲームで無効にしてください。"
},
"status": {
"unlocked": "このアプリのセッションでは、コンピューター全体の OpenXR レイヤーへの書き込みがロック解除されています。",
diff --git a/app/src/i18n/locales/ja/pivot.json b/app/src/i18n/locales/ja/pivot.json
index 6322a73e..16a5bb0e 100644
--- a/app/src/i18n/locales/ja/pivot.json
+++ b/app/src/i18n/locales/ja/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "カスタム プロファイルはまだありません。Pivot の回転を特定のアプリケーションにバインドするには、プロファイルを追加してください。",
"profileNumber": "プロファイル {number}",
"nudgeSetDefaultName": "微調整セット",
- "nudgeSetCopyName": "{name} のコピー"
+ "nudgeSetCopyName": "{name} のコピー",
+ "profileCopyName": "{name} のコピー"
},
"warnings": {
"noActivationTitle": "モーション アシストの有効化がありません",
diff --git a/app/src/i18n/locales/ko/app.json b/app/src/i18n/locales/ko/app.json
index 7e2bcd74..686c9995 100644
--- a/app/src/i18n/locales/ko/app.json
+++ b/app/src/i18n/locales/ko/app.json
@@ -140,6 +140,7 @@
"priority": "우선순위: 여러 프로필이 같은 애플리케이션에 겹치면 위에 있는 프로필이 공유하는 바인딩을 소유합니다.",
"moveUp": "프로필을 위로 이동(높은 우선순위)",
"moveDown": "프로필을 아래로 이동(낮은 우선순위)",
+ "duplicateTitle": "이 프로필을 설정과 바인딩 그대로 바로 아래의 새 프로필로 복사합니다.",
"enabledTitle": "이 프로필은 할당된 애플리케이션에 사용자 지정 {module} 설정을 적용합니다.",
"disabledTitle": "이 프로필은 런타임에 무시됩니다.",
"on": "프로필 켜짐",
diff --git a/app/src/i18n/locales/ko/framegen.json b/app/src/i18n/locales/ko/framegen.json
index 9c209114..6874308f 100644
--- a/app/src/i18n/locales/ko/framegen.json
+++ b/app/src/i18n/locales/ko/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "뷰 너비 대비 백분율로 나타낸 모션 한도 값",
"description": "생성된 프레임이 이미지를 이동할 수 있는 최대 거리이며, 뷰 너비에 대한 비율입니다. 이보다 빠른 움직임에서는 실제 이미지가 표시됩니다."
},
+ "gameDepth": {
+ "heading": "게임 깊이 사용",
+ "description": "게임이 제공하는 깊이를 사용해 가까운 물체를 안정적으로 유지합니다. Frame Generation 사용 중 게임이 끊기거나 멈추거나 깊이 아티팩트가 보이면 끄세요. 그러면 Frame Generation이 깊이 없이 동작합니다.",
+ "restart": "게임을 다시 시작하면 적용됩니다",
+ "summaryOff": "게임 깊이 없음"
+ },
"headPrediction": {
"heading": "머리 예측 확장",
"description": "Frame Generation은 게임이 최대 약 150 ms 앞서 렌더링하도록 하는데, Pimax 등 일부 런타임은 그중 약 20 ms만큼만 머리 움직임을 예측합니다. 이 설정은 나머지 구간에도 머리 회전을 이어 적용하여, 머리를 돌리는 쪽 가장자리의 검은 영역을 줄입니다. 게임을 시작하기 전에 켜십시오."
diff --git a/app/src/i18n/locales/ko/layers.json b/app/src/i18n/locales/ko/layers.json
index e3ede637..51710d70 100644
--- a/app/src/i18n/locales/ko/layers.json
+++ b/app/src/i18n/locales/ko/layers.json
@@ -20,7 +20,9 @@
"turboLabel": "Turbo 충돌:",
"toolkitTurbo": "VectorXR Turbo를 사용하는 동안 OpenXR Toolkit이 사용 설정되어 있습니다. 두 프레임 페이싱 레이어는 서로 충돌합니다. OXRTK의 Turbo Mode가 켜져 있으면 OXRTK 또는 VectorXR 중 한쪽에서만 끄고, 둘 다 켜 두지 마십시오.",
"quadviewsOffLabel": "Quadviews 꺼짐:",
- "toolkitQuad": "OpenXR Toolkit이 VectorXR보다 위에 있습니다({slices}). OpenXR Toolkit은 쿼드 뷰를 지원하지 않으므로 VectorXR은 OpenXR Toolkit이 실행되는 모든 게임에서 Quadviews를 꺼 둡니다. Quadviews를 사용하려면 OpenXR Toolkit을 사용 안 함으로 설정하거나 해당 게임에서 끄십시오."
+ "toolkitQuad": "OpenXR Toolkit이 VectorXR보다 위에 있습니다({slices}). OpenXR Toolkit은 쿼드 뷰를 지원하지 않으므로 VectorXR은 OpenXR Toolkit이 실행되는 모든 게임에서 Quadviews를 꺼 둡니다. Quadviews를 사용하려면 OpenXR Toolkit을 사용 안 함으로 설정하거나 해당 게임에서 끄십시오.",
+ "frameGenOffLabel": "Frame Generation 꺼짐:",
+ "toolkitFrameGen": "OpenXR Toolkit이 VectorXR 아래에 있습니다({slices}). 이 위치에서는 Frame Generation의 추가 프레임을 처리할 수 없으므로, VectorXR은 OpenXR Toolkit이 실행되는 모든 게임에서 Frame Generation을 끕니다. Frame Generation을 사용하려면 OpenXR Toolkit을 VectorXR 위로 옮기거나 해당 게임에서 끄세요."
},
"status": {
"unlocked": "이 앱 세션에서 시스템 전체 OpenXR 레이어 쓰기가 잠금 해제되었습니다.",
diff --git a/app/src/i18n/locales/ko/pivot.json b/app/src/i18n/locales/ko/pivot.json
index 6c5e114d..59dad490 100644
--- a/app/src/i18n/locales/ko/pivot.json
+++ b/app/src/i18n/locales/ko/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "아직 사용자 지정 프로필이 없습니다. Pivot 회전을 특정 애플리케이션에 바인딩하려면 프로필을 추가하십시오.",
"profileNumber": "프로필 {number}",
"nudgeSetDefaultName": "미세 조정 세트",
- "nudgeSetCopyName": "{name} 복사본"
+ "nudgeSetCopyName": "{name} 복사본",
+ "profileCopyName": "{name} 복사본"
},
"warnings": {
"noActivationTitle": "모션 보조 활성화 없음",
diff --git a/app/src/i18n/locales/pl/app.json b/app/src/i18n/locales/pl/app.json
index 8856330c..a44be9ba 100644
--- a/app/src/i18n/locales/pl/app.json
+++ b/app/src/i18n/locales/pl/app.json
@@ -152,6 +152,7 @@
"priority": "Kolejność priorytetów — gdy profile nakładają się na jedną aplikację, wyższy profil przejmuje wszystkie wspólne przypisania.",
"moveUp": "Przenieś profil w górę (wyższy priorytet)",
"moveDown": "Przenieś profil w dół (niższy priorytet)",
+ "duplicateTitle": "Skopiuj ten profil wraz z ustawieniami i przypisaniami do nowego profilu poniżej.",
"enabledTitle": "Ten profil stosuje niestandardowe ustawienia {module} do przypisanych mu aplikacji.",
"disabledTitle": "Ten profil jest ignorowany w czasie działania.",
"on": "Profil wł.",
diff --git a/app/src/i18n/locales/pl/framegen.json b/app/src/i18n/locales/pl/framegen.json
index 9b34f2a6..3a391ba4 100644
--- a/app/src/i18n/locales/pl/framegen.json
+++ b/app/src/i18n/locales/pl/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Wartość limitu ruchu w procentach szerokości widoku",
"description": "Największe przesunięcie obrazu przez generowaną klatkę jako część szerokości widoku. Szybszy ruch pokazuje rzeczywisty obraz."
},
+ "gameDepth": {
+ "heading": "Używaj głębi z gry",
+ "description": "Używa głębi dostarczanej przez grę, aby bliskie obiekty pozostawały stabilne. Wyłącz, jeśli gra z Frame Generation zacina się, zawiesza lub pokazuje artefakty głębi; Frame Generation działa wtedy bez głębi.",
+ "restart": "Działa po ponownym uruchomieniu gry",
+ "summaryOff": "Bez głębi z gry"
+ },
"headPrediction": {
"heading": "Rozszerz predykcję głowy",
"description": "Frame Generation sprawia, że gra renderuje nawet ~150 ms do przodu, a niektóre środowiska uruchomieniowe, np. Pimax, przewidują ruch głowy tylko dla ~20 ms z tego czasu. Ta opcja przenosi obrót głowy na resztę, aby było mniej czerni na krawędzi, w którą się obracasz. Włącz ją przed uruchomieniem gry."
diff --git a/app/src/i18n/locales/pl/layers.json b/app/src/i18n/locales/pl/layers.json
index 78d24709..4b8dc969 100644
--- a/app/src/i18n/locales/pl/layers.json
+++ b/app/src/i18n/locales/pl/layers.json
@@ -23,7 +23,9 @@
"turboLabel": "Konflikt Turbo:",
"toolkitTurbo": "OpenXR Toolkit jest włączony, gdy używany jest VectorXR Turbo. Dwie warstwy taktowania klatek walczą ze sobą — jeśli tryb Turbo Mode w OXRTK jest włączony, wyłącz go tam albo w VectorXR, nigdy w obu.",
"quadviewsOffLabel": "Quadviews wyłączone:",
- "toolkitQuad": "OpenXR Toolkit znajduje się powyżej VectorXR ({slices}). Nie obsługuje on quad views, więc VectorXR utrzymuje Quadviews wyłączone w każdej grze, w której działa OpenXR Toolkit. Wyłącz OpenXR Toolkit lub wyłącz go dla tych gier, aby używać Quadviews."
+ "toolkitQuad": "OpenXR Toolkit znajduje się powyżej VectorXR ({slices}). Nie obsługuje on quad views, więc VectorXR utrzymuje Quadviews wyłączone w każdej grze, w której działa OpenXR Toolkit. Wyłącz OpenXR Toolkit lub wyłącz go dla tych gier, aby używać Quadviews.",
+ "frameGenOffLabel": "Frame Generation wyłączone:",
+ "toolkitFrameGen": "OpenXR Toolkit jest poniżej VectorXR ({slices}). W tym miejscu nie obsługuje dodatkowych klatek Frame Generation, więc VectorXR utrzymuje Frame Generation wyłączone w każdej grze, w której działa OpenXR Toolkit. Aby używać Frame Generation, przenieś OpenXR Toolkit nad VectorXR lub wyłącz go dla tych gier."
},
"status": {
"unlocked": "Zapisy warstw OpenXR dla całego komputera są odblokowane na czas tej sesji aplikacji.",
diff --git a/app/src/i18n/locales/pl/pivot.json b/app/src/i18n/locales/pl/pivot.json
index a7f8a0ff..2e3e0287 100644
--- a/app/src/i18n/locales/pl/pivot.json
+++ b/app/src/i18n/locales/pl/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Brak profili niestandardowych. Dodaj profil, aby powiązać obrót Pivot z określoną aplikacją.",
"profileNumber": "Profil {number}",
"nudgeSetDefaultName": "Zestaw przesunięć",
- "nudgeSetCopyName": "{name} — kopia"
+ "nudgeSetCopyName": "{name} — kopia",
+ "profileCopyName": "{name} — kopia"
},
"warnings": {
"noActivationTitle": "Brak aktywacji Wspomagania ruchu",
diff --git a/app/src/i18n/locales/pt-BR/app.json b/app/src/i18n/locales/pt-BR/app.json
index b456266c..5c72d843 100644
--- a/app/src/i18n/locales/pt-BR/app.json
+++ b/app/src/i18n/locales/pt-BR/app.json
@@ -144,6 +144,7 @@
"priority": "Ordem de prioridade — quando perfis se sobrepõem em um aplicativo, o perfil mais acima fica com qualquer atribuição que eles compartilhem.",
"moveUp": "Mover o perfil para cima (prioridade mais alta)",
"moveDown": "Mover o perfil para baixo (prioridade mais baixa)",
+ "duplicateTitle": "Copia este perfil, com suas configurações e atribuições, para um novo perfil logo abaixo.",
"enabledTitle": "Este perfil aplica configurações personalizadas de {module} aos aplicativos atribuídos.",
"disabledTitle": "Este perfil é ignorado durante a execução.",
"on": "Perfil ligado",
diff --git a/app/src/i18n/locales/pt-BR/framegen.json b/app/src/i18n/locales/pt-BR/framegen.json
index feb48311..a7706356 100644
--- a/app/src/i18n/locales/pt-BR/framegen.json
+++ b/app/src/i18n/locales/pt-BR/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Valor do limite de movimento em porcentagem da largura da visão",
"description": "O máximo que um quadro gerado pode mover a imagem, como fração da largura da visão. Movimentos mais rápidos mostram a imagem real."
},
+ "gameDepth": {
+ "heading": "Usar profundidade do jogo",
+ "description": "Usa a profundidade fornecida pelo jogo para manter estáveis os objetos próximos. Desative se um jogo engasgar, travar ou mostrar artefatos de profundidade com o Frame Generation; o Frame Generation passa a funcionar sem profundidade.",
+ "restart": "Vale após reiniciar o jogo",
+ "summaryOff": "Sem profundidade do jogo"
+ },
"headPrediction": {
"heading": "Estender a previsão da cabeça",
"description": "A Frame Generation faz o jogo renderizar até ~150 ms adiante, e alguns runtimes, como o da Pimax, preveem a sua cabeça em apenas ~20 ms disso. Isto prolonga o giro da sua cabeça pelo restante, deixando menos preto na borda para onde você vira. Ligue antes de iniciar o jogo."
diff --git a/app/src/i18n/locales/pt-BR/layers.json b/app/src/i18n/locales/pt-BR/layers.json
index c9280542..0e710418 100644
--- a/app/src/i18n/locales/pt-BR/layers.json
+++ b/app/src/i18n/locales/pt-BR/layers.json
@@ -21,7 +21,9 @@
"turboLabel": "Conflito do Turbo:",
"toolkitTurbo": "O OpenXR Toolkit está ativado enquanto o Turbo do VectorXR está em uso. Duas camadas de ritmo de quadros brigam entre si — se o Turbo Mode do OXRTK estiver ligado, desative-o lá ou no VectorXR, nunca nos dois.",
"quadviewsOffLabel": "Quadviews desligado:",
- "toolkitQuad": "O OpenXR Toolkit está acima do VectorXR ({slices}). Ele não oferece suporte a quad views, então o VectorXR mantém o Quadviews desligado em todos os jogos em que o OpenXR Toolkit é executado. Desative o OpenXR Toolkit, ou desligue-o para esses jogos, para usar o Quadviews."
+ "toolkitQuad": "O OpenXR Toolkit está acima do VectorXR ({slices}). Ele não oferece suporte a quad views, então o VectorXR mantém o Quadviews desligado em todos os jogos em que o OpenXR Toolkit é executado. Desative o OpenXR Toolkit, ou desligue-o para esses jogos, para usar o Quadviews.",
+ "frameGenOffLabel": "Frame Generation desligado:",
+ "toolkitFrameGen": "O OpenXR Toolkit está abaixo do VectorXR ({slices}). Nessa posição ele não consegue lidar com os quadros extras do Frame Generation, então o VectorXR mantém o Frame Generation desligado em todos os jogos em que o OpenXR Toolkit é executado. Mova o OpenXR Toolkit para cima do VectorXR, ou desative-o nesses jogos, para usar o Frame Generation."
},
"status": {
"unlocked": "As gravações de camadas OpenXR de toda a máquina estão desbloqueadas nesta sessão do aplicativo.",
diff --git a/app/src/i18n/locales/pt-BR/pivot.json b/app/src/i18n/locales/pt-BR/pivot.json
index 8877f62e..c8d94fa1 100644
--- a/app/src/i18n/locales/pt-BR/pivot.json
+++ b/app/src/i18n/locales/pt-BR/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Nenhum perfil personalizado ainda. Adicione um perfil para vincular a rotação do Pivot a um aplicativo específico.",
"profileNumber": "Perfil {number}",
"nudgeSetDefaultName": "Conjunto de deslocamentos",
- "nudgeSetCopyName": "Cópia de {name}"
+ "nudgeSetCopyName": "Cópia de {name}",
+ "profileCopyName": "Cópia de {name}"
},
"warnings": {
"noActivationTitle": "Nenhuma ativação da Assistência de movimento",
diff --git a/app/src/i18n/locales/ru/app.json b/app/src/i18n/locales/ru/app.json
index d547ef5f..f8575045 100644
--- a/app/src/i18n/locales/ru/app.json
+++ b/app/src/i18n/locales/ru/app.json
@@ -152,6 +152,7 @@
"priority": "Порядок приоритета: если профили пересекаются по приложению, общей привязкой владеет профиль, расположенный выше.",
"moveUp": "Переместить профиль вверх (выше приоритет)",
"moveDown": "Переместить профиль вниз (ниже приоритет)",
+ "duplicateTitle": "Скопировать этот профиль с настройками и назначениями в новый профиль под ним.",
"enabledTitle": "Этот профиль применяет свои параметры {module} к назначенным приложениям.",
"disabledTitle": "Этот профиль игнорируется во время работы.",
"on": "Профиль вкл.",
diff --git a/app/src/i18n/locales/ru/framegen.json b/app/src/i18n/locales/ru/framegen.json
index 56f0ed8f..aa7d8a0d 100644
--- a/app/src/i18n/locales/ru/framegen.json
+++ b/app/src/i18n/locales/ru/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "Предел движения в процентах от ширины обзора",
"description": "Максимальное смещение изображения сгенерированным кадром, как доля ширины обзора. При более быстром движении показывается реальное изображение."
},
+ "gameDepth": {
+ "heading": "Использовать глубину игры",
+ "description": "Использует глубину, которую передаёт игра, чтобы близкие объекты оставались стабильными. Выключите, если с Frame Generation игра подтормаживает, зависает или показывает артефакты глубины; тогда Frame Generation работает без глубины.",
+ "restart": "Применяется после перезапуска игры",
+ "summaryOff": "Без глубины игры"
+ },
"headPrediction": {
"heading": "Расширенный прогноз головы",
"description": "Frame Generation заставляет игру рендерить до ~150 ms вперёд, а некоторые среды выполнения, например Pimax, прогнозируют положение головы лишь на ~20 ms из них. Этот параметр продлевает поворот головы на оставшееся время, чтобы у края, к которому вы поворачиваетесь, было меньше чёрного. Включите его до запуска игры."
diff --git a/app/src/i18n/locales/ru/layers.json b/app/src/i18n/locales/ru/layers.json
index c30b4696..2105e158 100644
--- a/app/src/i18n/locales/ru/layers.json
+++ b/app/src/i18n/locales/ru/layers.json
@@ -23,7 +23,9 @@
"turboLabel": "Конфликт Turbo:",
"toolkitTurbo": "OpenXR Toolkit включён, пока используется Turbo VectorXR. Два слоя управления темпом кадров мешают друг другу: если в OXRTK включён режим Turbo Mode, отключите его там или в VectorXR, но не оба одновременно.",
"quadviewsOffLabel": "Quadviews выключен:",
- "toolkitQuad": "OpenXR Toolkit находится выше VectorXR ({slices}). Он не поддерживает quad views, поэтому VectorXR держит Quadviews выключенным во всех играх, в которых работает OpenXR Toolkit. Чтобы использовать Quadviews, отключите OpenXR Toolkit или выключите его для этих игр."
+ "toolkitQuad": "OpenXR Toolkit находится выше VectorXR ({slices}). Он не поддерживает quad views, поэтому VectorXR держит Quadviews выключенным во всех играх, в которых работает OpenXR Toolkit. Чтобы использовать Quadviews, отключите OpenXR Toolkit или выключите его для этих игр.",
+ "frameGenOffLabel": "Frame Generation выключен:",
+ "toolkitFrameGen": "OpenXR Toolkit находится ниже VectorXR ({slices}). В этом положении он не справляется с дополнительными кадрами Frame Generation, поэтому VectorXR оставляет Frame Generation выключенным во всех играх, где работает OpenXR Toolkit. Чтобы использовать Frame Generation, переместите OpenXR Toolkit выше VectorXR или отключите его для этих игр."
},
"status": {
"unlocked": "Запись слоёв OpenXR для всего компьютера разблокирована на этот сеанс приложения.",
diff --git a/app/src/i18n/locales/ru/pivot.json b/app/src/i18n/locales/ru/pivot.json
index 89ea128f..bdb601b3 100644
--- a/app/src/i18n/locales/ru/pivot.json
+++ b/app/src/i18n/locales/ru/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "Своих профилей пока нет. Добавьте профиль, чтобы привязать поворот Pivot к определённому приложению.",
"profileNumber": "Профиль {number}",
"nudgeSetDefaultName": "Набор сдвигов",
- "nudgeSetCopyName": "{name} (копия)"
+ "nudgeSetCopyName": "{name} (копия)",
+ "profileCopyName": "{name} (копия)"
},
"warnings": {
"noActivationTitle": "Нет активации усиления движения",
diff --git a/app/src/i18n/locales/zh-CN/app.json b/app/src/i18n/locales/zh-CN/app.json
index dd608e4f..cc92bad8 100644
--- a/app/src/i18n/locales/zh-CN/app.json
+++ b/app/src/i18n/locales/zh-CN/app.json
@@ -140,6 +140,7 @@
"priority": "优先级顺序——当多个配置文件作用于同一应用程序时,位置较高的配置文件拥有它们共用的任何绑定。",
"moveUp": "上移配置文件(更高优先级)",
"moveDown": "下移配置文件(更低优先级)",
+ "duplicateTitle": "将此配置文件连同其设置和绑定复制为下方的新配置文件。",
"enabledTitle": "此配置文件会将自定义 {module} 设置应用于其分配的应用程序。",
"disabledTitle": "此配置文件在运行时会被忽略。",
"on": "配置文件已开启",
diff --git a/app/src/i18n/locales/zh-CN/framegen.json b/app/src/i18n/locales/zh-CN/framegen.json
index 005b080e..8c71c124 100644
--- a/app/src/i18n/locales/zh-CN/framegen.json
+++ b/app/src/i18n/locales/zh-CN/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "运动限制值(占视图宽度的百分比)",
"description": "生成帧可以移动图像的最大距离,以视图宽度的比例表示。更快的运动会显示真实图像。"
},
+ "gameDepth": {
+ "heading": "使用游戏深度",
+ "description": "使用游戏提供的深度,让近处物体保持稳定。如果开启 Frame Generation 后游戏卡顿、卡死或出现深度伪影,请关闭此项;Frame Generation 将在没有深度的情况下工作。",
+ "restart": "重启游戏后生效",
+ "summaryOff": "不使用游戏深度"
+ },
"headPrediction": {
"heading": "延长头部预测",
"description": "Frame Generation 会让游戏提前最多约 150 ms 进行渲染,而某些运行时(例如 Pimax 的运行时)只预测其中约 20 ms 的头部运动。此选项会将您的头部转动延续到剩余时间,从而减少您转向一侧边缘的黑边。请在启动游戏之前开启。"
diff --git a/app/src/i18n/locales/zh-CN/layers.json b/app/src/i18n/locales/zh-CN/layers.json
index 162439f6..f13165da 100644
--- a/app/src/i18n/locales/zh-CN/layers.json
+++ b/app/src/i18n/locales/zh-CN/layers.json
@@ -20,7 +20,9 @@
"turboLabel": "Turbo 冲突:",
"toolkitTurbo": "正在使用 VectorXR Turbo 时启用了 OpenXR Toolkit。两个帧节奏控制层会相互冲突——如果 OXRTK 的 Turbo 模式已开启,请在它或 VectorXR 中禁用其中一个,切勿同时开启。",
"quadviewsOffLabel": "Quadviews 已关闭:",
- "toolkitQuad": "OpenXR Toolkit 位于 VectorXR 之上({slices})。它不支持四视图,因此对于运行 OpenXR Toolkit 的所有游戏,VectorXR 都会保持 Quadviews 关闭。要使用 Quadviews,请禁用 OpenXR Toolkit,或为这些游戏关闭它。"
+ "toolkitQuad": "OpenXR Toolkit 位于 VectorXR 之上({slices})。它不支持四视图,因此对于运行 OpenXR Toolkit 的所有游戏,VectorXR 都会保持 Quadviews 关闭。要使用 Quadviews,请禁用 OpenXR Toolkit,或为这些游戏关闭它。",
+ "frameGenOffLabel": "Frame Generation 已关闭:",
+ "toolkitFrameGen": "OpenXR Toolkit 位于 VectorXR 之下({slices})。在此位置它无法处理 Frame Generation 的额外帧,因此在运行 OpenXR Toolkit 的所有游戏中,VectorXR 都会保持 Frame Generation 关闭。要使用 Frame Generation,请将 OpenXR Toolkit 移到 VectorXR 之上,或在这些游戏中将其关闭。"
},
"status": {
"unlocked": "已为本次应用会话解锁计算机全局 OpenXR 层的写入。",
diff --git a/app/src/i18n/locales/zh-CN/pivot.json b/app/src/i18n/locales/zh-CN/pivot.json
index d045261d..47c167e3 100644
--- a/app/src/i18n/locales/zh-CN/pivot.json
+++ b/app/src/i18n/locales/zh-CN/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "还没有自定义配置文件。添加一个配置文件即可将 Pivot 旋转绑定到特定应用程序。",
"profileNumber": "配置文件 {number}",
"nudgeSetDefaultName": "微调组",
- "nudgeSetCopyName": "{name} 副本"
+ "nudgeSetCopyName": "{name} 副本",
+ "profileCopyName": "{name} 副本"
},
"warnings": {
"noActivationTitle": "没有运动辅助激活",
diff --git a/app/src/i18n/locales/zh-TW/app.json b/app/src/i18n/locales/zh-TW/app.json
index 83b6d98a..d2a18eb0 100644
--- a/app/src/i18n/locales/zh-TW/app.json
+++ b/app/src/i18n/locales/zh-TW/app.json
@@ -140,6 +140,7 @@
"priority": "優先順序:當多個設定檔重疊套用於同一應用程式時,較上方的設定檔擁有它們共用的任何繫結。",
"moveUp": "將設定檔上移(較高優先順序)",
"moveDown": "將設定檔下移(較低優先順序)",
+ "duplicateTitle": "將此設定檔連同其設定與綁定複製為下方的新設定檔。",
"enabledTitle": "此設定檔會將自訂 {module} 設定套用至其指派的應用程式。",
"disabledTitle": "執行階段會忽略此設定檔。",
"on": "設定檔開啟",
diff --git a/app/src/i18n/locales/zh-TW/framegen.json b/app/src/i18n/locales/zh-TW/framegen.json
index c39ec41c..f6f5ae90 100644
--- a/app/src/i18n/locales/zh-TW/framegen.json
+++ b/app/src/i18n/locales/zh-TW/framegen.json
@@ -229,6 +229,12 @@
"valueLabel": "動態限制值,以視野寬度的百分比表示",
"description": "生成影格可移動影像的最大距離,以視野寬度的比例表示。更快的動態會顯示真實影像。"
},
+ "gameDepth": {
+ "heading": "使用遊戲深度",
+ "description": "使用遊戲提供的深度,讓近處物體保持穩定。如果開啟 Frame Generation 後遊戲卡頓、當住或出現深度瑕疵,請關閉此項;Frame Generation 將在沒有深度的情況下運作。",
+ "restart": "重新啟動遊戲後生效",
+ "summaryOff": "不使用遊戲深度"
+ },
"headPrediction": {
"heading": "延伸頭部預測",
"description": "Frame Generation 會讓遊戲最多提前約 150 ms 渲染,而某些執行階段(例如 Pimax 的)只會預測其中約 20 ms 的頭部動作。此選項會將您頭部的轉動延續到剩餘的時間,讓您轉向的那一側邊緣出現較少黑邊。請在啟動遊戲前開啟。"
diff --git a/app/src/i18n/locales/zh-TW/layers.json b/app/src/i18n/locales/zh-TW/layers.json
index dc0b8783..0068c6b7 100644
--- a/app/src/i18n/locales/zh-TW/layers.json
+++ b/app/src/i18n/locales/zh-TW/layers.json
@@ -20,7 +20,9 @@
"turboLabel": "Turbo 衝突:",
"toolkitTurbo": "使用 VectorXR Turbo 時,OpenXR Toolkit 處於啟用狀態。兩個影格節奏層會互相干擾:如果 OXRTK 的 Turbo Mode 已開啟,請在該處或在 VectorXR 中停用其中一個,切勿兩者同時開啟。",
"quadviewsOffLabel": "Quadviews 已關閉:",
- "toolkitQuad": "OpenXR Toolkit 位於 VectorXR 之上({slices})。它不支援四視圖,因此在所有執行 OpenXR Toolkit 的遊戲中,VectorXR 都會讓 Quadviews 保持關閉。若要使用 Quadviews,請停用 OpenXR Toolkit,或針對那些遊戲將其關閉。"
+ "toolkitQuad": "OpenXR Toolkit 位於 VectorXR 之上({slices})。它不支援四視圖,因此在所有執行 OpenXR Toolkit 的遊戲中,VectorXR 都會讓 Quadviews 保持關閉。若要使用 Quadviews,請停用 OpenXR Toolkit,或針對那些遊戲將其關閉。",
+ "frameGenOffLabel": "Frame Generation 已關閉:",
+ "toolkitFrameGen": "OpenXR Toolkit 位於 VectorXR 之下({slices})。在此位置它無法處理 Frame Generation 的額外影格,因此在執行 OpenXR Toolkit 的所有遊戲中,VectorXR 都會保持 Frame Generation 關閉。若要使用 Frame Generation,請將 OpenXR Toolkit 移到 VectorXR 之上,或在這些遊戲中將其關閉。"
},
"status": {
"unlocked": "已為此應用程式工作階段解除鎖定全機 OpenXR 層寫入。",
diff --git a/app/src/i18n/locales/zh-TW/pivot.json b/app/src/i18n/locales/zh-TW/pivot.json
index 4832e320..a4dd30ad 100644
--- a/app/src/i18n/locales/zh-TW/pivot.json
+++ b/app/src/i18n/locales/zh-TW/pivot.json
@@ -16,7 +16,8 @@
"noCustomProfiles": "尚無自訂設定檔。新增設定檔即可將 Pivot 旋轉繫結到特定應用程式。",
"profileNumber": "設定檔 {number}",
"nudgeSetDefaultName": "微調組",
- "nudgeSetCopyName": "{name} 複本"
+ "nudgeSetCopyName": "{name} 複本",
+ "profileCopyName": "{name} 複本"
},
"warnings": {
"noActivationTitle": "沒有動態輔助啟用方式",
diff --git a/app/src/lib/model.ts b/app/src/lib/model.ts
index aabd556c..1f2e7b04 100644
--- a/app/src/lib/model.ts
+++ b/app/src/lib/model.ts
@@ -701,6 +701,16 @@ export interface FrameGenSettings {
// Present only when on; absent means off here and in the layer, so a
// profile never inherits it from the defaults.
extendHeadPrediction?: boolean
+ // Edge fill: frames Frame Generation writes reach a few degrees past the
+ // game's field of view, the margin repeating the frame's edge. Present only
+ // when on, like extendHeadPrediction; not in the app's pages until it has
+ // flown (set in settings.json), but kept when the app saves.
+ edgeFill?: boolean
+ // Use the game's depth. Present only when off (absent means on, here and
+ // in the layer). Off, Frame Generation works without depth and the bridges
+ // keep a Direct3D 11 or Vulkan game's depth to themselves; the bridges read
+ // it when the game's VR session starts.
+ useGameDepth?: boolean
}
export interface FrameGenProfileConfig {
@@ -772,6 +782,8 @@ export function normalizeFrameGenSettings(value: unknown, fallback: FrameGenSett
// Absent means off, as in the layer: a profile does not inherit it from
// the defaults (new profiles copy the defaults' value when created).
...(source.extendHeadPrediction === true ? { extendHeadPrediction: true } : {}),
+ ...(source.edgeFill === true ? { edgeFill: true } : {}),
+ ...(source.useGameDepth === false ? { useGameDepth: false } : {}),
}
}
@@ -1231,6 +1243,16 @@ export function createPivotProfile(
}
}
+// A deep copy with fresh ids, so the copy's bindings and Quick Views are keyed
+// apart from the source. The nudge set stays shared, like any other profile.
+export function duplicatePivotProfile(source: PivotXRProfileConfig): PivotXRProfileConfig {
+ const copy = JSON.parse(JSON.stringify(source)) as PivotXRProfileConfig
+ copy.id = newPivotProfileId()
+ copy.name = t('pivot.tab.profileCopyName', { name: source.name })
+ copy.viewControls.quickViews = copy.viewControls.quickViews.map((view) => ({ ...view, id: newPivotQuickViewId() }))
+ return copy
+}
+
export function createQuadViewsProfile(defaultSettings: QuadViewsSettings, applicationIds: string[] = []): QuadViewsProfileConfig {
return {
name: defaultProfileName(),
diff --git a/app/src/lib/patchNotes.json b/app/src/lib/patchNotes.json
index 754375a4..3f8e7de5 100644
--- a/app/src/lib/patchNotes.json
+++ b/app/src/lib/patchNotes.json
@@ -1,4 +1,56 @@
[
+ {
+ "version": "0.20.1",
+ "date": "2026-11-08",
+ "title": "Depth for Direct3D 11 Games, PimaxXR Fixes, and Duplicate Pivot Profiles",
+ "summary": "A fix release for 0.20.0. Frame Generation can now use depth from Direct3D 11 games, including UEVR titles. Frame Generation no longer stalls games on PimaxXR. Turbo's Auto mode gives async pacing a fairer trial, and eye-tracked foveation is placed better on Pimax. VectorXR works beside OpenXR Toolkit and Quad-Views-Foveated in more setups, and custom Pivot profiles can now be duplicated.",
+ "items": [
+ {
+ "html": "Frame Generation",
+ "items": [
+ "Depth for Direct3D 11 games. Frame Generation can now use the depth that Direct3D 11 games provide, including UEVR titles, for steadier generated frames.",
+ "Use game depth option. If a game stutters, hangs or shows depth artifacts with Frame Generation, turn off Use game depth in the profile's advanced settings and restart the game. Frame Generation then works without depth.",
+ "No more stalls on PimaxXR. With Frame Generation engaged, PimaxXR could hold up the game's own rendering, and the game's frame rate dropped sharply. Frame Generation now works around it.",
+ "Smoother output on PimaxXR 0.4.4 and earlier, which could skip a refresh when no new frame was ready.",
+ "Frame Generation stays off when OpenXR Toolkit is below VectorXR, because Toolkit can't handle the extra frames there. The OSD and the OpenXR Layers page now say when this applies; move OpenXR Toolkit above VectorXR there to use both.",
+ "OpenXR Toolkit's prediction dampening is respected instead of being undone by Frame Generation.",
+ "No rejected frames from misplaced depth. Some games, such as UEVR titles, can describe depth that doesn't fit its image, and PimaxXR and Virtual Desktop then reject the whole frame. VectorXR now leaves that depth out."
+ ]
+ },
+ {
+ "html": "Turbo",
+ "items": [
+ "Auto gives async pacing a fair trial. A stutter right as a game left its loading screen could make Auto settle on sequenced pacing for good. Auto now rides out early stutters. It also tries async again after a quick failure, a VectorXR or runtime update, or 30 days.",
+ "More accurate frame timing with sequenced pacing in games that prepare frames ahead, such as DCS.",
+ "Turbo stands aside when OpenXR Toolkit's Turbo runs above VectorXR, instead of both pacing frames."
+ ]
+ },
+ {
+ "html": "Quadviews and eye tracking",
+ "items": [
+ "Better-placed focus areas on Pimax. On headsets with angled displays, VectorXR's emulated quad views placed each eye's sharp area off to the side. Both eyes now line up on where you're looking.",
+ "A frozen eye tracker no longer pins the focus area. If the tracker stops updating, the focus area follows your head until the tracker recovers.",
+ "Eye-tracked foveation is no longer switched off in PimaxXR's native quad views.",
+ "DCS's focus views stay aligned on PimaxXR's native quad views."
+ ]
+ },
+ {
+ "html": "Pivot",
+ "items": [
+ "Duplicate custom profiles. A new Duplicate button next to Remove copies a profile with all its settings and bindings, places the copy just below the original, and scrolls to it. Change the copy's applications or bindings so the two profiles don't overlap.",
+ "Pivot stays centred after a recenter on Pimax. Recentering in Pimax Play during a session could leave Pivot turning around your old head position.",
+ "A restarted VR session starts Pivot fresh, instead of picking up the previous session's origin."
+ ]
+ },
+ {
+ "html": "Compatibility",
+ "items": [
+ "Games start with OpenXR Toolkit or Quad-Views-Foveated on VIVE runtimes.",
+ "Stability fixes for PimaxXR around starting VR again in the same game, and around head tracking."
+ ]
+ }
+ ]
+ },
{
"version": "0.20.0",
"date": "2026-10-29",
diff --git a/app/src/lib/validation.ts b/app/src/lib/validation.ts
index 9060ec64..7ae18fd0 100644
--- a/app/src/lib/validation.ts
+++ b/app/src/lib/validation.ts
@@ -364,6 +364,12 @@ function validateFrameGenSettings(prefix: string, settings: FrameGenSettings): s
if (settings.extendHeadPrediction !== undefined && typeof settings.extendHeadPrediction !== 'boolean') {
errors.push(t('validation.field.trueOrFalse', { field: prefix + 'extendHeadPrediction' }))
}
+ if (settings.edgeFill !== undefined && typeof settings.edgeFill !== 'boolean') {
+ errors.push(t('validation.field.trueOrFalse', { field: prefix + 'edgeFill' }))
+ }
+ if (settings.useGameDepth !== undefined && typeof settings.useGameDepth !== 'boolean') {
+ errors.push(t('validation.field.trueOrFalse', { field: prefix + 'useGameDepth' }))
+ }
const bounded = [
['artifactSuppression', settings.artifactSuppression, 0, 100],
diff --git a/app/src/stores/configStore.ts b/app/src/stores/configStore.ts
index 24302097..2040fdc7 100644
--- a/app/src/stores/configStore.ts
+++ b/app/src/stores/configStore.ts
@@ -16,7 +16,7 @@ import {
import { errorText } from '../lib/errors'
import { t } from '../i18n/index.ts'
import { createTaskQueue } from '../lib/taskQueue'
-import { cloneConfig, createApplication, createFrameGenProfile, createProfile, createPivotProfile, createQuadViewsProfile, createTurboProfile, defaultConfig, defaultProfileName, isDefaultProfileName } from '../lib/model'
+import { cloneConfig, createApplication, createFrameGenProfile, createProfile, createPivotProfile, createQuadViewsProfile, duplicatePivotProfile as clonePivotProfile, createTurboProfile, defaultConfig, defaultProfileName, isDefaultProfileName } from '../lib/model'
import type { AppTab, ModuleId, RuntimePacingObservation, TurboMetricsSession, VectorXRConfig } from '../lib/model'
interface StoreState {
@@ -332,6 +332,17 @@ export function useConfigStore() {
)
}
+ // The copy lands right below its source, so it starts one step lower in
+ // priority order than the profile it came from.
+ function duplicatePivotProfile(index: number) {
+ const profiles = state.config.modules.pivotxr.profiles
+ const source = profiles[index]
+ if (!source) {
+ return
+ }
+ profiles.splice(index + 1, 0, clonePivotProfile(source))
+ }
+
function removePivotProfile(index: number) {
state.config.modules.pivotxr.profiles.splice(index, 1)
}
@@ -535,6 +546,7 @@ export function useConfigStore() {
removeProfile,
syncProfileName,
addPivotProfile,
+ duplicatePivotProfile,
removePivotProfile,
movePivotProfile,
syncPivotProfileName,
diff --git a/app/tests/framegen.test.mjs b/app/tests/framegen.test.mjs
index ba9be14a..fa317607 100644
--- a/app/tests/framegen.test.mjs
+++ b/app/tests/framegen.test.mjs
@@ -43,6 +43,16 @@ test('invalid imported values normalize safely: enums fall back, integers clamp'
assert.equal('extendHeadPrediction' in normalizeFrameGenSettings({ extendHeadPrediction: 'yes' }), false)
// A profile saved without it is off, as the layer reads it, whatever the defaults say.
assert.equal('extendHeadPrediction' in normalizeFrameGenSettings({}, { ...defaultFrameGenSettings(), extendHeadPrediction: true }), false)
+ // Edge fill likewise: kept when on, absent otherwise, never inherited.
+ assert.deepEqual(normalizeFrameGenSettings({ edgeFill: true }), { ...defaultFrameGenSettings(), edgeFill: true })
+ assert.equal('edgeFill' in normalizeFrameGenSettings({ edgeFill: false }), false)
+ assert.equal('edgeFill' in normalizeFrameGenSettings({ edgeFill: 1 }), false)
+ assert.equal('edgeFill' in normalizeFrameGenSettings({}, { ...defaultFrameGenSettings(), edgeFill: true }), false)
+ // useGameDepth is stored only when off; absent means on.
+ assert.deepEqual(normalizeFrameGenSettings({ useGameDepth: false }), { ...defaultFrameGenSettings(), useGameDepth: false })
+ assert.equal('useGameDepth' in normalizeFrameGenSettings({ useGameDepth: true }), false)
+ assert.equal('useGameDepth' in normalizeFrameGenSettings({ useGameDepth: 0 }), false)
+ assert.equal('useGameDepth' in normalizeFrameGenSettings({}, { ...defaultFrameGenSettings(), useGameDepth: false }), false)
assert.deepEqual(normalizeFrameGenSettings({ artifactSuppression: -5, motionLimitPercent: 99 }), { ...defaultFrameGenSettings(), artifactSuppression: 0, motionLimitPercent: 25 })
assert.equal(normalizeFrameGenSettings({ artifactSuppression: 33.6 }).artifactSuppression, 34)
assert.equal(normalizeFrameGenSettings({ motionLimitPercent: Infinity }).motionLimitPercent, 10)
diff --git a/app/tests/model.test.mjs b/app/tests/model.test.mjs
index 3053924c..81429e6b 100644
--- a/app/tests/model.test.mjs
+++ b/app/tests/model.test.mjs
@@ -7,6 +7,7 @@ import {
createPivotQuickView,
defaultConfig,
createPivotProfile,
+ duplicatePivotProfile,
normalizeConfig,
normalizeKeyboardKey,
pivotBindingConflictWarnings,
@@ -613,3 +614,31 @@ test('0.15 and 0.15.1 configs preserve existing settings, profiles, and bindings
assert.deepEqual(validateConfig(normalized), [])
assert.deepEqual(normalizeConfig(normalized), normalized)
})
+
+test('Duplicating a Pivot profile copies its settings under fresh ids', () => {
+ const config = defaultConfig()
+ config.applications = [{ id: 'dcs-world', name: 'DCS World', enabled: true, match: { exe: 'DCS.exe' } }]
+ const appId = 'dcs-world'
+ const source = createPivotProfile(config.modules.pivotxr.defaults, [appId], false, [activation('hold', keyboard('F1'))])
+ source.name = 'DCS Hornet'
+ source.settings.rotationMultiplier = 1.7
+ source.viewControls.quickViews.push(createPivotQuickView('Left'))
+ const copy = duplicatePivotProfile(source)
+
+ assert.notEqual(copy.id, source.id)
+ assert.equal(copy.name, 'DCS Hornet Copy')
+ assert.deepEqual(copy.applicationIds, [appId])
+ assert.equal(copy.settings.rotationMultiplier, 1.7)
+ assert.deepEqual(copy.activationBindings, source.activationBindings)
+ assert.equal(copy.nudgeSetId, source.nudgeSetId)
+ assert.notEqual(copy.viewControls.quickViews[0].id, source.viewControls.quickViews[0].id)
+
+ copy.applicationIds = []
+ copy.settings.rotationMultiplier = 1
+ assert.deepEqual(source.applicationIds, [appId])
+ assert.equal(source.settings.rotationMultiplier, 1.7)
+
+ copy.applicationIds = [appId]
+ config.modules.pivotxr.profiles.push(source, copy)
+ assert.deepEqual(validateConfig(config), [])
+})
diff --git a/config/vectorxr.schema.json b/config/vectorxr.schema.json
index 488463ee..0c8bfa42 100644
--- a/config/vectorxr.schema.json
+++ b/config/vectorxr.schema.json
@@ -1721,6 +1721,16 @@
"type": "boolean",
"default": false,
"description": "Frame Generation has the game render for a display time up to ~150 ms ahead; some runtimes (Pimax's) predict the head only ~20 ms of that. When on, VectorXR measures how far the runtime predicts and carries the head's turn over the rest, which shrinks the black band at the edge you turn toward. Turn it on before the game starts: it needs the runtime's clock, which is requested at startup."
+ },
+ "edgeFill": {
+ "type": "boolean",
+ "default": false,
+ "description": "Frames Frame Generation writes reach a few degrees past the game's field of view (3 degrees left and right, 1.5 up and down), the extra margin repeating the frame's edge. On a fast head turn the runtime then shows a smeared edge on the side you turn toward instead of a black band. Costs some GPU time and video memory for the wider images. Direct3D 12 games and Direct3D 11 or Vulkan games through the bridge; it can be changed while the game runs."
+ },
+ "useGameDepth": {
+ "type": "boolean",
+ "default": true,
+ "description": "Use the depth the game provides. Turn off if a game stutters, hangs or shows depth artifacts with Frame Generation: Frame Generation then works without depth, and Direct3D 11 and Vulkan games through the bridge keep their depth to themselves (the runtime gets none from them), as before 0.20.1. Written only when off. The bridges read it when the game's VR session starts."
}
}
},
diff --git a/docs/architecture.md b/docs/architecture.md
index 9de6f69f..420cd2e4 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -175,7 +175,7 @@ it at headset size. Generation works on whatever projection views reach the runt
so it follows Quadviews composition and Varjo-native quad views alike.
When a game submits depth with its projection views (`XR_KHR_composition_layer_depth`) and the
-backend can read it (Direct3D 12 so far), the depth image is converted to linear view depth at
+backend can read it (Direct3D 12, which the bridges' sessions are), the depth image is converted to linear view depth at
release, next to the color capture, and the previous frame is mapped into the newest view by the
full relative head pose instead of rotation alone. Content fixed in the head's reference space,
such as a cockpit, then lines up exactly and the flow carries only motion relative to that space.
diff --git a/docs/usage.md b/docs/usage.md
index 2011c102..92e67de1 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -765,7 +765,16 @@ stand still for a refresh and then jump.
#### Game depth
When a game sends depth to the headset, Frame Generation uses it automatically in Direct3D 12
-games, and in Vulkan games through the Vulkan bridge.
+games, in Direct3D 11 games through the Direct3D 11 bridge, and in Vulkan games through the
+Vulkan bridge.
+
+If a game stutters, hangs or shows depth artifacts with Frame Generation, turn off **Use game
+depth** under the advanced settings of that game's Frame Generation profile (or of the default
+profile), then restart the game. Frame Generation then works without depth, and Direct3D 11 and
+Vulkan games through the bridges keep their depth to themselves, as before 0.20.1: the bridge
+makes no copy of it, and the runtime gets none from them. Direct3D 12 games still send their
+depth to the runtime; only Frame Generation leaves it out.
+
MSFS 2024 only fills the depth it sends while its **Motion reprojection** setting is **Depth**;
with it off, the depth is empty and Frame Generation does without. With depth, head movement is
compensated exactly, so cockpit instruments, panels and text stay still in generated frames
@@ -774,10 +783,39 @@ cockpit from where your eyes will be when each frame is displayed: they keep mov
between the game's last two frames. Most headset runtimes only correct head rotation between
frames, so without this, near cockpit detail would jump at the game's frame rate whenever your
head moved. Depth also lets generated frames resample nearby content with a sharper (cubic)
-filter, so cockpit detail stays crisper. Direct3D 11 games such as DCS keep their depth to
-themselves through the Direct3D 11 bridge, so they use head rotation only for now, and Star
-Citizen's depth currently arrives empty. When a game supplies useful depth for only one eye,
-Frame Generation can use it for the other eye too.
+filter, so cockpit detail stays crisper. Direct3D 11 games that send depth, such as iRacing,
+and Unreal Engine games through UEVR with its **Enable Depth-based Latency Reduction** option
+on, have it copied from the game's private depth images into the headset runtime's at each
+release, so the runtime gets it as well (about 0.1 to 0.2 ms of the game's GPU time on an
+RTX 5090 at headset resolutions). DCS sends no depth, so it uses head rotation only. When a
+game supplies useful depth for only one eye, Frame Generation can use it for the other eye too.
+
+Star Citizen currently writes its depth after it has handed the image over for the frame, so the
+depth is still empty when the frame ends (CIG plans to fix this). While Frame Generation finds a
+Vulkan game's depth empty, the Vulkan bridge checks its depth image about once a second at the
+frame's end and again just before the game's next frame. When depth turns up only at the second check, twice in a row, the bridge takes it
+from there: each frame then carries the depth of the frame before. Frame Generation checks that
+depth against the other eye like any other, and uses it only when it lines the eyes up. The log
+says when this starts (**the game writes its depth after its frame's end**) and when it stops
+again, as soon as the depth is there at the frame's end. Taking depth this way costs one more
+copy of each depth image per frame, and one more depth image of memory per depth swapchain
+(about 110 MB for each eye at Star Citizen's 5424x5356). `VECTORXR_VULKAN_BRIDGE_DEPTH=end-frame`
+only takes a Vulkan game's depth at the frame's end, and `VECTORXR_VULKAN_BRIDGE_DEPTH=private`
+keeps every Vulkan game's depth to itself, out of the frames Frame Generation and the runtime get.
+
+
+The bridge keeps a Direct3D 11 game's depth to itself, as before, when it cannot copy it: depth
+images with more than one sample, or a runtime that does not make its depth images depth
+targets. The log says so for each such depth swapchain, and the game's depth then reaches
+neither Frame Generation nor the runtime. `VECTORXR_D3D11_BRIDGE_DEPTH=private` keeps every
+Direct3D 11 game's depth to itself, if copying it ever causes a problem in a game. While the
+bridge copies a game's depth, it turns the game's Direct3D 11 multithread protection on (if the
+game has not), so no other thread of the game's renders in the middle of a copy.
+
+Depth whose rectangle lies outside its depth image, as UEVR sends with an upscaler or a screen
+percentage that makes its depth image smaller than its color image, is left out of the frame for
+both eyes, in every kind of game: some runtimes (PimaxXR, Virtual Desktop) refuse a whole frame
+for it. The log says so once a session. The color goes on as before.
Games do not always describe their depth correctly, so Frame Generation first checks it against
the other eye: depth that is right lines the two eyes' images up. It starts using depth once
@@ -860,7 +898,9 @@ at 6864x6908 per eye and 0.2 GB at 3000x3000. In all, plan for about 3 to 4 GB o
6864x6908 per eye, and under 1 GB at 3000x3000. Direct3D 11 and Vulkan games (DCS, Star Citizen)
also keep a shared copy of each of the game's swapchain images for the bridge, about as much again
as the output images (the bridge logs it as `twinMiB`): plan for about 4 to 5 GB for them at
-6864x6908 per eye.
+6864x6908 per eye. A Direct3D 11 game that sends depth adds a shared copy of each depth image
+too: 2 bytes per pixel for 16-bit depth, 4 for the others (iRacing's 6904x3184 16-bit depth:
+about 130 MB for three images).
Outside quad views, the log says how many real frames are kept (**Frame Generation keeps the
last 5 real frames to generate from**, or 3 with the reason; quad views sessions always keep five), and the **Frame Generation process video memory** lines
@@ -994,7 +1034,7 @@ engages, or sooner once the game's own frames show the runtime giving them every
#### Current limits
- Frame Generation does not use game motion vectors yet; motion is estimated from color
- images, with the game's depth (Direct3D 12, and Vulkan through the bridge) used to remove head
+ images, with the game's depth (Direct3D 12, and Direct3D 11 and Vulkan through the bridges) used to remove head
movement and sharpen nearby detail.
- There is no HUD masking yet. Text, HUDs, and gauges baked into the 3D image can shimmer on
generated frames.
diff --git a/layer/CMakeLists.txt b/layer/CMakeLists.txt
index 89235a23..3f5addf3 100644
--- a/layer/CMakeLists.txt
+++ b/layer/CMakeLists.txt
@@ -91,10 +91,58 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
endif()
endif()
+ # Pinned archives (the Vulkan headers, DXC) are downloaded once into a
+ # cache directory, DEPTHXR_DOWNLOAD_CACHE or /_downloads, and
+ # FetchContent extracts the cached file. Downloads are retried: GitHub's
+ # release downloads sometimes answer 5xx for a while.
+ function(depthxr_cached_archive out_var name url sha256)
+ if(DEFINED ENV{DEPTHXR_DOWNLOAD_CACHE} AND NOT "$ENV{DEPTHXR_DOWNLOAD_CACHE}" STREQUAL "")
+ file(TO_CMAKE_PATH "$ENV{DEPTHXR_DOWNLOAD_CACHE}" _dir)
+ else()
+ set(_dir "${CMAKE_BINARY_DIR}/_downloads")
+ endif()
+ set(_file "${_dir}/${name}")
+ string(TOLOWER "${sha256}" _want)
+ if(EXISTS "${_file}")
+ file(SHA256 "${_file}" _have)
+ if(NOT _have STREQUAL _want)
+ file(REMOVE "${_file}")
+ endif()
+ endif()
+ if(NOT EXISTS "${_file}")
+ set(_attempts 5)
+ foreach(_attempt RANGE 1 ${_attempts})
+ file(DOWNLOAD "${url}" "${_file}.part" STATUS _status TLS_VERIFY ON)
+ list(GET _status 0 _code)
+ list(GET _status 1 _message)
+ if(_code EQUAL 0)
+ file(SHA256 "${_file}.part" _have)
+ if(NOT _have STREQUAL _want)
+ file(REMOVE "${_file}.part")
+ message(FATAL_ERROR "${url} has SHA256 ${_have}, not the pinned ${_want}")
+ endif()
+ file(RENAME "${_file}.part" "${_file}")
+ break()
+ endif()
+ file(REMOVE "${_file}.part")
+ if(_attempt EQUAL _attempts)
+ message(FATAL_ERROR "Downloading ${url} failed ${_attempts} times: ${_message}")
+ endif()
+ math(EXPR _delay "15 * ${_attempt}")
+ message(STATUS "Downloading ${name} failed (${_message}); retrying in ${_delay} s")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep ${_delay})
+ endforeach()
+ endif()
+ set(${out_var} "${_file}" PARENT_SCOPE)
+ endfunction()
+
set(VULKAN_HEADERS_ENABLE_MODULE OFF CACHE BOOL "" FORCE)
include(FetchContent)
+ depthxr_cached_archive(_vulkan_headers_archive vulkan-headers-b379292b2ab6df5771ba9870d53cf8b2c9295daf.tar.gz
+ https://github.com/KhronosGroup/Vulkan-Headers/archive/b379292b2ab6df5771ba9870d53cf8b2c9295daf.tar.gz
+ 2ad177c0e468ac2eb3db9b5be6b8a18a6730d339378ac670e5fbda3503ac7d64)
FetchContent_Declare(vulkan_headers
- URL https://github.com/KhronosGroup/Vulkan-Headers/archive/b379292b2ab6df5771ba9870d53cf8b2c9295daf.tar.gz
+ URL "${_vulkan_headers_archive}"
URL_HASH SHA256=2ad177c0e468ac2eb3db9b5be6b8a18a6730d339378ac670e5fbda3503ac7d64
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(vulkan_headers)
@@ -123,8 +171,11 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
find_program(DEPTHXR_FXC fxc HINTS ${_framegen_fxc_hints} REQUIRED)
set(DEPTHXR_DXC "")
if(DEPTHXR_FRAMEGEN_SPIRV)
+ depthxr_cached_archive(_dxc_archive dxc_2025_07_14.zip
+ https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2505.1/dxc_2025_07_14.zip
+ 9ad895a6b039e3a8f8c22a1009f866800b840a74b50db9218d13319e215ea8a4)
FetchContent_Declare(dxc_release
- URL https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2505.1/dxc_2025_07_14.zip
+ URL "${_dxc_archive}"
URL_HASH SHA256=9ad895a6b039e3a8f8c22a1009f866800b840a74b50db9218d13319e215ea8a4
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(dxc_release)
@@ -204,6 +255,33 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
DEPENDS "${_framegen_hlsl}"
COMMENT "Compiling Frame Generation FLOW_MERGE (DXBC)"
VERBATIM)
+ # The Direct3D 11 bridge's depth: a Direct3D 11 compute shader copying the
+ # game's depth into a shared twin, and the Direct3D 12 draw writing the
+ # twin into the runtime's depth image, included by the bridge as headers.
+ set(_bridge_depth_hlsl "${CMAKE_CURRENT_SOURCE_DIR}/shaders/bridge_depth.hlsl")
+ set(_bridge_depth_headers "")
+ foreach(_bridge_depth_shader TO_TWIN VS PS)
+ if(_bridge_depth_shader STREQUAL "TO_TWIN")
+ set(_bridge_depth_args -T cs_5_0 -E CSMain)
+ set(_bridge_depth_name kBridgeDepthToTwinDxbc)
+ elseif(_bridge_depth_shader STREQUAL "VS")
+ set(_bridge_depth_args -T vs_5_0 -E VSMain)
+ set(_bridge_depth_name kBridgeDepthVsDxbc)
+ else()
+ set(_bridge_depth_args -T ps_5_0 -E PSMain)
+ set(_bridge_depth_name kBridgeDepthPsDxbc)
+ endif()
+ string(TOLOWER "${_bridge_depth_shader}" _bridge_depth_file)
+ set(_bridge_depth_header "${_framegen_out}/bridge_depth_${_bridge_depth_file}.h")
+ add_custom_command(
+ OUTPUT "${_bridge_depth_header}"
+ COMMAND "${DEPTHXR_FXC}" -nologo ${_bridge_depth_args} -D "BRIDGE_DEPTH_${_bridge_depth_shader}=1" -O3 -WX
+ -Vn ${_bridge_depth_name} -Fh "${_bridge_depth_header}" "${_bridge_depth_hlsl}"
+ DEPENDS "${_bridge_depth_hlsl}"
+ COMMENT "Compiling the Direct3D 11 bridge's depth ${_bridge_depth_shader} (DXBC)"
+ VERBATIM)
+ list(APPEND _bridge_depth_headers "${_bridge_depth_header}")
+ endforeach()
string(REPLACE ";" "," _framegen_pass_list "${_framegen_passes}")
string(REPLACE ";" "," _framegen_draw_list "${_framegen_draw_shaders}")
set(_framegen_spirv_dir "")
@@ -241,7 +319,8 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
# ...and the engine motion record and census made from it.
src/engine_motion.cpp
"${_framegen_out}/framegen_shaders.cpp"
- "${_framegen_out}/framegen_flow_merge.h")
+ "${_framegen_out}/framegen_flow_merge.h"
+ ${_bridge_depth_headers})
target_include_directories(depthxr_framegen PUBLIC include)
target_include_directories(depthxr_framegen PRIVATE "${_framegen_out}")
target_compile_features(depthxr_framegen PUBLIC cxx_std_20)
@@ -558,7 +637,7 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
# Frame Generation's Direct3D 11 bridge against a stand-in runtime, on WARP
# (`depthxr_d3d11_bridge_tests hw` runs it on the GPU).
add_executable(depthxr_d3d11_bridge_tests tests/d3d11_bridge_tests.cpp)
- target_link_libraries(depthxr_d3d11_bridge_tests PRIVATE depthxr_framegen d3d11 d3d12 dxgi)
+ target_link_libraries(depthxr_d3d11_bridge_tests PRIVATE depthxr_framegen d3d11 d3d12 dxgi d3dcompiler)
target_compile_definitions(depthxr_d3d11_bridge_tests PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX XR_USE_GRAPHICS_API_D3D11 XR_USE_GRAPHICS_API_D3D12)
add_test(NAME depthxr_d3d11_bridge_tests COMMAND depthxr_d3d11_bridge_tests)
add_test(NAME depthxr_d3d11_bridge_hw_tests COMMAND depthxr_d3d11_bridge_tests hw)
@@ -576,10 +655,18 @@ if(WIN32 AND DEPTHXR_BUILD_LAYER)
add_executable(depthxr_framegen_presenter_tests tests/framegen_presenter_tests.cpp)
target_link_libraries(depthxr_framegen_presenter_tests PRIVATE depthxr_framegen)
target_compile_definitions(depthxr_framegen_presenter_tests PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
- add_test(NAME depthxr_framegen_presenter_tests COMMAND depthxr_framegen_presenter_tests)
- # Paced by the wall clock: about 375 s on a fast desktop (0.19.2), longer on a shared CI runner. The lead
- # ceiling's tests add about 3 minutes; serially (FG_TEST_SERIAL=1) the suite takes about 16 minutes.
- set_tests_properties(depthxr_framegen_presenter_tests PROPERTIES TIMEOUT 1200)
+ # Paced by the wall clock, mostly waiting: about 680 s on a fast desktop (0.20.1) in one process beside its
+ # policy tests (no argument). CTest runs its groups (--group, GROUP in the test) as tests of their own, side by
+ # side under ctest -j: 45-160 s each on a desktop, about 18 minutes in all. -R depthxr_framegen_presenter_tests_
+ # selects them. They create no graphics device.
+ set(_presenter_tests "")
+ foreach(_group IN ITEMS pacing lifecycle quad clocks probe_burst lead ceiling policy policy_late)
+ add_test(NAME depthxr_framegen_presenter_tests_${_group}
+ COMMAND depthxr_framegen_presenter_tests --group ${_group})
+ list(APPEND _presenter_tests depthxr_framegen_presenter_tests_${_group})
+ endforeach()
+ # COST: CTest starts the longest tests first, before it has timings of its own.
+ set_tests_properties(${_presenter_tests} PROPERTIES TIMEOUT 600 COST 200)
add_executable(depthxr_osd_tests tests/osd_tests.cpp)
target_link_libraries(depthxr_osd_tests PRIVATE depthxr_osd)
target_compile_definitions(depthxr_osd_tests PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX XR_USE_GRAPHICS_API_D3D11)
@@ -852,3 +939,48 @@ if(DEPTHXR_BUILD_TESTS)
add_test(NAME depthxr_action_set_attachment_tests COMMAND depthxr_action_set_attachment_tests)
set_tests_properties(depthxr_action_set_attachment_tests PROPERTIES TIMEOUT 10)
endif()
+
+if(DEPTHXR_BUILD_TESTS)
+ # CTest may run tests side by side (ctest -j, as Build-Layer.ps1 does), but a test that touches a graphics device
+ # runs alone (RUN_SERIAL), WARP and the software Vulkan device included: never two at once (0x139 bug checks on
+ # this machine's GPU), and never beside the presenter's wall-clock pacing, which WARP's load on every core makes
+ # late (four presenter groups failed beside it under -j 8; none failed with only the CPU tests beside them).
+ # Every test is such a test except those listed here, which create no Direct3D or Vulkan device at all
+ # (stand-in runtimes and devices, or none).
+ set(_cpu_only_tests
+ vectorxr_hardware_probe_self_test
+ depthxr_layer_crt_imports_tests
+ depthxr_layer_load_tests
+ depthxr_crt_failure_report_tests
+ depthxr_test_adapter_tests
+ ${_presenter_tests}
+ depthxr_turbo_frame_tests
+ depthxr_pivot_pose_tests
+ depthxr_pivot_snap_tests
+ depthxr_pivot_gaze_tests
+ depthxr_eye_gaze_tests
+ depthxr_head_prediction_layer_tests
+ depthxr_spacewarp_probe_tests
+ depthxr_layer_tests
+ depthxr_head_prediction_tests
+ depthxr_turbo_trace_tests
+ depthxr_turbo_recovery_tests
+ depthxr_runtime_relay_tests
+ depthxr_external_status_tests
+ depthxr_process_exit_tests
+ depthxr_path_unicode_tests
+ depthxr_sound_player_tests
+ depthxr_thread_census_tests
+ depthxr_action_set_attachment_tests)
+ get_property(_layer_tests DIRECTORY PROPERTY TESTS)
+ # Labelled too, so CI runs the two kinds on separate runners at once
+ # (Build-Layer.ps1 -Tests Cpu or Graphics): ctest -L graphics / -LE graphics.
+ foreach(_test IN LISTS _layer_tests)
+ if(NOT _test IN_LIST _cpu_only_tests)
+ set_property(TEST ${_test} PROPERTY RUN_SERIAL TRUE)
+ set_property(TEST ${_test} APPEND PROPERTY LABELS graphics)
+ else()
+ set_property(TEST ${_test} APPEND PROPERTY LABELS cpu)
+ endif()
+ endforeach()
+endif()
diff --git a/layer/include/depthxr/framegen_d3d11_bridge.h b/layer/include/depthxr/framegen_d3d11_bridge.h
index 938c0ebc..48e6bb15 100644
--- a/layer/include/depthxr/framegen_d3d11_bridge.h
+++ b/layer/include/depthxr/framegen_d3d11_bridge.h
@@ -33,8 +33,21 @@ namespace depthxr {
// acquired again. Neither API waits for the other on the CPU.
//
// Images a twin cannot be: multisampled ones are rendered privately and
-// resolved into the twin at release; depth stays private and never reaches
-// the runtime (the caller keeps it out of submitted frames).
+// resolved into the twin at release. Depth is rendered privately too
+// (Direct3D 12 shares no depth with simultaneous access): at release,
+// Direct3D 11 copies its depth plane into a twin (R16_UNORM for D16, else
+// R32_FLOAT), and the bridge's
+// queue draws the twin into the runtime's depth image as depth, ahead of
+// Frame Generation's capture as for colour, so the runtime and Frame
+// Generation both get the game's depth plane (D16, D24S8, D32 and D32S8
+// alike: value for value, but for D24S8, whose 24-bit depth is read
+// normalized and may arrive one 24-bit step off; stencil is not carried).
+// Depth the bridge cannot mirror (multisampled, a runtime image that is no
+// depth target, or VECTORXR_D3D11_BRIDGE_DEPTH=private) stays private and
+// never reaches the runtime (the caller keeps it out of submitted frames).
+// A mirrored depth swapchain turns the game device's multithread protection
+// on (never off): each copy holds the immediate context through its calls,
+// which keeps out only threads whose calls are protected.
//
// Every Direct3D 11 call is made inside the application's own OpenXR calls,
// on its thread; nothing here is called from the presenter thread.
@@ -47,6 +60,9 @@ class D3D11Bridge {
// Where retirements that leaked, skipped copies and second threads are reported.
void SetLog(std::function log);
+ // Before Begin: keep every depth swapchain private (Frame Generation's
+ // Use game depth off), as VECTORXR_D3D11_BRIDGE_DEPTH=private does.
+ void SetKeepDepthPrivate(bool keep);
// Before xrCreateSession, for a session whose first structure is a
// Direct3D 11 binding: makes a Direct3D 12 device on the game's adapter
@@ -83,14 +99,16 @@ class D3D11Bridge {
// At each xrEndFrame (the application's thread): the game's immediate
// context is used by the bridge from the threads its swapchain calls come
// from; when those (or the frame's) differ, the device's multithread
- // protection is turned on, so the bridge's calls cannot race the game's.
+ // protection is turned on at the next StageReleases (before any lock,
+ // as it waits for the device's lock), so the bridge's calls cannot race
+ // the game's.
// With VECTORXR_D3D11_BRIDGE_DEBUG=1, also reports what the Direct3D 12
// debug layer found.
void FrameEnded();
// The runtime's create info for the application's: the bridge's copies
- // write the runtime's colour images as render targets do, and
- // multisampled images are resolved to one sample.
+ // write the runtime's colour images as render targets do, multisampled
+ // images are resolved to one sample, and depth images are depth targets.
static XrSwapchainCreateInfo RuntimeCreateInfo(const XrSwapchainCreateInfo& info);
// After the runtime created `swapchain` from RuntimeCreateInfo(info):
// makes an image for each of its images (`enumerate` is the runtime's).
@@ -102,15 +120,16 @@ class D3D11Bridge {
// fails: their releases need not wait on the runtime's queue.
void SetComposed(XrSwapchain swapchain, bool composed);
bool Composed(XrSwapchain swapchain) const;
- // Bridged, and the runtime's images never get anything (depth): the
- // runtime's calls on it need no ordering with the bridge's queue, and its
- // depth stays out of submitted frames.
+ // Bridged, and the runtime's images never get anything (depth the
+ // bridge cannot mirror): the runtime's calls on it need no ordering with
+ // the bridge's queue, and its depth stays out of submitted frames.
bool Unmirrored(XrSwapchain swapchain) const;
bool HasUnmirrored() const;
// The Direct3D 11 textures rendered into, by image index (empty when not bridged).
std::vector Images(XrSwapchain swapchain) const;
// After the runtime handed out image `index`: Direct3D 11 waits (on the
- // GPU) until the bridge's queue is done with the image's last release.
+ // GPU) until the bridge's queue is done with the image's last release
+ // (queued on the game's context without the bridge's lock).
void Acquired(XrSwapchain swapchain, std::uint32_t index);
// At the frame's end after the application released the image (the layer
// hands releases over inside xrEndFrame, or the next acquire on the
@@ -120,12 +139,33 @@ class D3D11Bridge {
// copied into the runtime's image on the bridge's queue. False when the
// copy was skipped (the bridge's queue is stalled): the runtime's image
// holds an older frame, which Frame Generation must not capture as new.
+ // Released calls the game's immediate context only for a release whose
+ // Direct3D 11 half StageReleases did not run, taking it first.
bool Released(XrSwapchain swapchain);
// The application's xrReleaseSwapchainImage of a bridged image, whose
// hand-over (Released) waits for the frame's end: its thread counts among
// the game's swapchain and frame calls' threads, as it did when the copy
- // ran there (a second thread turns multithread protection on).
- void ReleaseCalled();
+ // ran there (a second thread turns multithread protection on), and the
+ // release is counted for StageReleases.
+ void ReleaseCalled(XrSwapchain swapchain);
+ // At a hand-over, before the caller takes any lock of its own (xrEndFrame
+ // for every swapchain: XR_NULL_HANDLE; the next acquire or wait on
+ // `swapchain`): runs the Direct3D 11 half of each release ReleaseCalled
+ // counted (a depth image's copy into its twin, a multisampled image's
+ // resolve, the "written" signal), holding the game's immediate context
+ // first. Released then only submits the copy into the runtime's image.
+ // A game thread may hold the device's lock (ID3D11Multithread::Enter)
+ // while it makes an OpenXR call that takes the caller's locks: this waits
+ // for that lock holding none of them. Nothing to run: returns at once.
+ void StageReleases(XrSwapchain swapchain);
+ // Tests: called inside a depth copy into its twin, holding the game's
+ // immediate context with the copy's compute state bound, before its
+ // dispatch and before the game's state goes back.
+ void SetDepthCopyHookForTest(std::function hook);
+ // Tests: called just before the bridge enters the game's immediate
+ // context's lock (multithread protection on), on the thread entering it.
+ // Set and cleared while no bridge call runs.
+ void SetContextWaitHookForTest(std::function hook);
// A release of an image nothing was drawn into: no copy; the runtime's
// image keeps what it had.
void Abandoned(XrSwapchain swapchain);
@@ -144,6 +184,7 @@ class D3D11Bridge {
std::unique_ptr impl_;
std::function log_;
bool queried_d3d12_requirements_{false};
+ bool keep_depth_private_{false};
};
} // namespace depthxr
diff --git a/layer/include/depthxr/framegen_gpu.h b/layer/include/depthxr/framegen_gpu.h
index b70a6fd3..3352d123 100644
--- a/layer/include/depthxr/framegen_gpu.h
+++ b/layer/include/depthxr/framegen_gpu.h
@@ -23,6 +23,12 @@ struct FrameGenImage {
std::uint32_t array_index{0};
XrRect2Di rect{};
std::int64_t format{0}; // swapchain creation format, native to the graphics API
+ // Edge fill (an output image, FrameGenGpu::SupportsEdgeFill): where the
+ // view's frame starts in `rect`, which is then wider than the frame (its
+ // FrameGenViewRequest::extent, or a composed eye's) by a margin on each
+ // side; every margin pixel repeats the frame's nearest edge pixel. {0, 0}
+ // with `rect` the frame's own size: no fill.
+ XrOffset2Di content{0, 0};
};
struct FrameGenViewSubmission {
@@ -282,6 +288,18 @@ class FrameGenGpu {
// Whether generated frames are drawn straight into the output images
// (no intermediate image per view).
virtual bool DrawsOutputs() const { return false; }
+ // Edge fill: output images wider than their frame, the frame placed at
+ // FrameGenImage::content and the margin around it its nearest edge
+ // repeated (Direct3D 12, while it draws generated frames straight into
+ // the outputs). Without it, outputs are the frame's own size.
+ virtual bool SupportsEdgeFill() const { return false; }
+ // Edge fill: whether the last Execute, Synthesize, SynthesizeStale or
+ // SynthesizeComposed(Stale) drew the margin of every output it wrote
+ // that has one. False when an output was written by the copy fallback
+ // (its margin keeps what it held): the caller then shows that frame from
+ // its own region (FrameGenImage::content, the frame's extent) with the
+ // game's field of view. Under the caller's GPU lock, right after the call.
+ virtual bool EdgesFilled() const { return false; }
// Tests: the draws of generated frames into the output images recorded
// so far (DrawsOutputs; frames drawn together count once).
virtual std::uint64_t DrawsForTest() const { return 0; }
diff --git a/layer/include/depthxr/framegen_plan.h b/layer/include/depthxr/framegen_plan.h
index aeba7a0f..26139ae8 100644
--- a/layer/include/depthxr/framegen_plan.h
+++ b/layer/include/depthxr/framegen_plan.h
@@ -511,6 +511,50 @@ struct FrameGenFov {
float down{0.0f};
};
+// Edge fill (FrameGenSettings::edge_fill): the runtime turns each frame it is
+// given to where the head is when it shows it, and where it turns past the
+// frame's edge it has nothing to show (black on the leading edge of a fast
+// turn, widest for generated frames, which keep their real frame's pose).
+// Output images are made wider than the frame by a margin each side, the
+// margin filled with the frame's nearest edge (FrameGenImage::content), and
+// submitted with the field of view widened to match: the runtime then turns
+// a smeared edge into view instead of black. Margins in pixels.
+struct FrameGenEdgeMargins {
+ std::uint32_t left{0};
+ std::uint32_t right{0};
+ std::uint32_t up{0};
+ std::uint32_t down{0};
+ bool Any() const { return left || right || up || down; }
+ bool operator==(const FrameGenEdgeMargins& other) const {
+ return left == other.left && right == other.right && up == other.up && down == other.down;
+ }
+ bool operator!=(const FrameGenEdgeMargins& other) const { return !(*this == other); }
+};
+
+// The margin each side the fill adds by default: degrees beyond each edge
+// (VECTORXR_FRAMEGEN_EDGE_FILL=h[,v] in the research file changes them).
+inline constexpr float kFrameGenEdgeFillHorizontalDegrees = 3.0f;
+inline constexpr float kFrameGenEdgeFillVerticalDegrees = 1.5f;
+// Output images are never made wider or taller than this (Direct3D 12's
+// largest texture); margins shrink alike to fit.
+inline constexpr std::uint32_t kFrameGenEdgeFillMaxExtent = 16384;
+
+// The margins widening a frame of `extent` with field of view `fov` by
+// `horizontal_degrees` beyond its left and right edges and
+// `vertical_degrees` beyond its top and bottom, at the frame's own pixel
+// spacing (the image stays one projection, its tangents spaced alike): no
+// edge goes past 85 degrees off the view axis, no margin is wider than half
+// the frame, and the image fits kFrameGenEdgeFillMaxExtent. None for a field
+// of view that is not one (right not right of left, up not above down).
+FrameGenEdgeMargins FrameGenEdgeFillMargins(const FrameGenFov& fov, FrameGenExtent extent, float horizontal_degrees,
+ float vertical_degrees);
+// The widened image's field of view: the frame's, its tangents carried on
+// across each margin at the frame's spacing (what the margins' pixels show).
+FrameGenFov FrameGenEdgeFillFov(const FrameGenFov& fov, FrameGenExtent extent, const FrameGenEdgeMargins& margins);
+// Parses VECTORXR_FRAMEGEN_EDGE_FILL: "h" or "h,v" degrees (0-15 each; one
+// value for both). Nullopt for anything else.
+std::optional> ParseFrameGenEdgeFillDegrees(const std::string& value);
+
// The quad views diagnostic overlay over one composed eye, drawn last, as the
// layer's Direct3D 11 compositor draws it (QuadViewsD3D11ShaderSource): the
// periphery, blend band and inset tinted, the inset's outline and the band's
diff --git a/layer/include/depthxr/framegen_presenter.h b/layer/include/depthxr/framegen_presenter.h
index 1dadefa6..3b60a456 100644
--- a/layer/include/depthxr/framegen_presenter.h
+++ b/layer/include/depthxr/framegen_presenter.h
@@ -26,6 +26,8 @@
namespace depthxr {
+class GameContextLock;
+
class Logger;
// Downstream calls the presenter makes for the frames it submits. `submit`
@@ -158,6 +160,12 @@ struct FrameGenStatus {
std::uint64_t runtime_clock_displacements{0};
bool threaded{false}; // presenting from the presenter thread
FrameGenDepthState depth{FrameGenDepthState::kUnknown};
+ // The last depth check found the game's depth the same all over in both
+ // eyes (no varying cells): sent and readable, but empty or never written
+ // (Star Citizen's, October 2026). The Vulkan bridge then checks when the
+ // game writes it (VulkanBridge::WantDepthTimingCheck).
+ bool depth_uniform{false};
+
// The game's motion vectors steer the generated frames. Engine motion
// vectors are research only so far: nothing sets this yet; the OSD and
// the app say so once it does.
@@ -225,6 +233,9 @@ struct FrameGenStatus {
// its swapchains by then (the runtime shows a swapchain's newest), and no
// newer frame shown as it is could take its place.
std::uint64_t stale_skipped{0};
+ // Such refreshes shown with a later frame as it is instead, past frames
+ // written first (a runtime that blanks frames left open, PimaxXR 0.4.4).
+ std::uint64_t stale_shown_ahead{0};
};
// What the On-Screen Display and the desktop app say about a Frame Generation
@@ -290,6 +301,7 @@ struct FrameGenDynamicPolicy {
double generated_share{0.2}; // (b) generated frames per second over the refreshes the game misses
double unready_share{0.05}; // (c) refreshes whose real frame was not on the GPU yet, at most
double late_analyses_share{0.5}; // (d) analyses ending after their frames were needed, at most
+ double game_rate_share{0.75}; // (e) the game's own rate engaged, at least this share of its rate before
};
// Interpolate's hardware-flow fallback. Tests shorten these times; the
@@ -431,6 +443,13 @@ class FrameGenPresenter {
// session begun on quad views natively (Varjo) has four. Stereo until
// the layer says otherwise.
void SetRuntimeViewConfiguration(XrViewConfigurationType type);
+ // The runtime shows a blank refresh for a frame begun and never ended
+ // (PimaxXR 0.4.4 and earlier: its submission thread completes the PVR
+ // frame left out with one disabled layer, then waits a refresh more), so
+ // the presenter thread never leaves one open where anything consistent
+ // can be shown: the frame shown as it is nearest after the last, even
+ // past frames it writes, rather than nothing. Off unless the layer says.
+ void SetRuntimeBlanksOpenFrames(bool blanks);
// Started with a working GPU backend; such a session keeps frame pacing
// away from Turbo even while toggled off, so toggling never races Turbo.
bool OwnsPacing() const;
@@ -440,6 +459,12 @@ class FrameGenPresenter {
// Settings can turn a running session off (frames pass through) and back
// on; only starting Frame Generation needs a new session.
void SetConfigured(bool enabled);
+ // The game's Direct3D 11 device's lock, in the game's own Direct3D 11
+ // session (none otherwise): the backend's work on the game's immediate
+ // context waits for it before the presenter's locks (GameContextLock).
+ // Captures at a release are made under the layer's locks, which take it
+ // first themselves. Outlives the session it is set for.
+ void SetGameContextLock(GameContextLock* lock);
// Steady renderable frames and session age required before engaging.
void SetEngagementPolicy(std::uint32_t steady_frames, std::chrono::milliseconds minimum_session_age);
// How long the video memory budget must have room for another set of
@@ -687,7 +712,8 @@ class FrameGenPresenter {
struct Output {
XrSwapchain swapchain{XR_NULL_HANDLE};
- FrameGenExtent extent;
+ FrameGenExtent extent; // the whole image: with edge fill, the frame and its margins
+ FrameGenEdgeMargins margins;
std::int64_t format{0};
FrameGenOutputKind requested{FrameGenOutputKind::kSrgb8}; // what the source asked for
FrameGenOutputKind kind{FrameGenOutputKind::kSrgb8}; // what the swapchain format holds
@@ -864,9 +890,21 @@ class FrameGenPresenter {
// An output image per output index: its extent and what it holds.
struct OutputSpec {
- FrameGenExtent extent;
+ FrameGenExtent extent; // the frame's (the image adds `margins`)
FrameGenOutputKind kind{FrameGenOutputKind::kSrgb8};
+ FrameGenEdgeMargins margins; // edge fill (EdgeMarginsLocked)
};
+ // Edge fill: the margins of the output image for a frame of `extent`
+ // seen with `fov` (none while the setting is off or the backend cannot
+ // fill them: FrameGenGpu::SupportsEdgeFill).
+ FrameGenEdgeMargins EdgeMarginsLocked(const XrFovf& fov, FrameGenExtent extent) const;
+ // An output image's region and where its frame starts in it.
+ static FrameGenImage OutputImage(const Output& output);
+ // A view shown from `output`: its image, and with edge fill its field of
+ // view widened across the margins; unless the backend did not draw them
+ // (`filled` false: FrameGenGpu::EdgesFilled), then the frame's own region
+ // with the game's field of view.
+ static void ShowOutput(XrCompositionLayerProjectionView& view, const Output& output, bool filled);
bool WantsEngagementLocked() const;
// Frames are generated or about to be: the game's releases are captured.
@@ -895,7 +933,10 @@ class FrameGenPresenter {
// refresh period.
void UpdateDynamicLocked(std::chrono::steady_clock::time_point now, XrDuration period);
void DynamicEngageLocked(std::chrono::steady_clock::time_point now, double rate, double refresh);
- void DynamicStandDownLocked(std::chrono::steady_clock::time_point now, const std::string& reason, bool probe);
+ // With check_engaged_fps (the game's rate engaged, (e)), it stands by
+ // without a hold while the game's rate standing by decides.
+ void DynamicStandDownLocked(std::chrono::steady_clock::time_point now, const std::string& reason, bool probe,
+ std::optional check_engaged_fps = std::nullopt);
// Turned back on (toggled, configured, retried after a pause): Dynamic
// stands by again and judges the game's rate afresh.
void DynamicReenableLocked(std::chrono::steady_clock::time_point now);
@@ -1047,7 +1088,10 @@ class FrameGenPresenter {
std::uint64_t id{0};
XrTime time{0};
};
- AsIs CurrentAsIsLocked(const FrameCopy& copy, std::uint64_t id, XrTime time) const;
+ // `past_written`: frames Frame Generation writes do not end the search
+ // (a runtime that shows a blank refresh for a frame left open: a step
+ // back later beats it).
+ AsIs CurrentAsIsLocked(const FrameCopy& copy, std::uint64_t id, XrTime time, bool past_written = false) const;
// How far each eye moves per unit of generated-frame time from the real
// frame shown at `newest_time` (FrameGenViewRequest::shift), in that
// eye's view space: as far as it moved since the previous real frame
@@ -1164,7 +1208,15 @@ class FrameGenPresenter {
// Arms GPU-aware pacing once a window shows the game's frames reaching
// the GPU late (real frames uncaptured when needed, or captures ending
// after their refresh was due).
- void NoteGpuEvidenceLocked(std::uint64_t real_frames, std::uint64_t late_gpu, std::vector capture_done_ms);
+ struct GpuEvidence {
+ std::uint64_t real_frames{0};
+ std::uint64_t late_gpu{0};
+ std::vector capture_done_ms;
+ };
+ // `window`'s evidence, if `clean` (no pause, loading, unrendered refresh
+ // or restart); with `pending`, it waits there for the next window and is
+ // taken only if that one is clean too.
+ void NoteGpuEvidenceLocked(std::optional* pending, bool clean, GpuEvidence window);
// Wakes the presenter thread and app threads waiting on slots.
void WakeSlots();
// Every runtime frame call goes through these, so the presenter knows the
@@ -1546,6 +1598,7 @@ class FrameGenPresenter {
std::chrono::steady_clock::time_point dynamic_engaged_at_{};
bool dynamic_probing_{false};
double passthrough_fps_{0.0}; // the game's own rate when Dynamic last engaged
+ std::optional dynamic_rate_check_fps_; // (e): its rate engaged, while standing by checks it
std::string dynamic_reason_;
std::uint64_t dynamic_engagements_{0};
std::uint64_t dynamic_stand_downs_{0};
@@ -1577,6 +1630,9 @@ class FrameGenPresenter {
std::uint64_t copies_skipped{0};
std::uint64_t ring_exhausted{0}; // refreshes whose real frame's images newer captures had replaced
std::uint64_t stale_skipped{0}; // refreshes not submitted: nothing current to show
+ // Refreshes that would have been left open, shown with a later frame
+ // as it is instead (SetRuntimeBlanksOpenFrames).
+ std::uint64_t stale_shown_ahead{0};
std::uint64_t unrendered{0}; // refreshes the runtime did not render (shouldRender false)
std::uint64_t late_cpu{0};
std::uint64_t late_gpu{0};
@@ -1621,6 +1677,10 @@ class FrameGenPresenter {
// that found it so (NoteRuntimeClockLocked).
std::uint64_t clock_displacements{0};
std::uint64_t clock_unsteady_waits{0};
+ // Runtime waits made (RuntimeWait), and of those, ones that blocked
+ // (at least max(1 ms, a tenth of a refresh), as NotePhaseLocked counts).
+ std::uint64_t runtime_waits_timed{0};
+ std::uint64_t runtime_waits_blocked{0};
};
// ", quad=..." for summaries over the window since `start` (empty when
// no frame of the quad compose site ended in it).
@@ -1639,7 +1699,7 @@ class FrameGenPresenter {
Totals totals;
};
GuardWindow guard_;
- std::array guard_failing_{}; // windows in a row each trigger (a)-(d) failed
+ std::array guard_failing_{}; // windows in a row each trigger (a)-(e) failed
std::vector guard_capture_done_ms_;
// GPU-aware pacing (VECTORXR_FRAMEGEN_GPU_AHEAD: off, 0, 1, 2 or
@@ -1650,6 +1710,9 @@ class FrameGenPresenter {
// no capture running meanwhile (a slow GPU is held for, a stuck one not).
bool gpu_gate_enabled_{true};
bool gpu_gate_armed_{false};
+ // The last summary window's evidence for GPU-aware pacing, pending the
+ // next window (NoteGpuEvidenceLocked).
+ std::optional summary_evidence_;
void ArmGpuGateLocked(const std::string& why);
int gpu_frames_ahead_{1};
std::uint32_t gpu_timeouts_in_row_{0};
@@ -1904,6 +1967,7 @@ class FrameGenPresenter {
bool logged_order_guard_{false};
double display_offset_periods_{0.0};
std::uint32_t display_offset_samples_{0};
+ std::uint64_t display_offset_earlier_{0}; // frames ended for an earlier time than given (not compensated)
// For the watchdog logs and PresenterActivity (read without locks).
std::atomic compositor_phase_{"stopped"};
bool logged_watchdog_{false};
@@ -2077,6 +2141,8 @@ class FrameGenPresenter {
// The runtime session's view configuration (SetRuntimeViewConfiguration):
// the one the probe's locates ask for.
XrViewConfigurationType runtime_view_configuration_{XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO};
+ bool runtime_blanks_open_frames_{false}; // SetRuntimeBlanksOpenFrames
+ bool logged_open_frame_shown_{false};
// Probed frames waiting for the real frame after their time: the first
// eye where the runtime put it and where the frame was shown from, in
// the space of the real frame it was written from. `ahead`: past that
@@ -2153,7 +2219,26 @@ class FrameGenPresenter {
std::vector gpu_wait_ms_;
std::vector end_call_ms_;
std::vector runtime_end_ms_;
+ // The runtime's xrWaitFrame time (RuntimeWait): beside runtime_end_ms_,
+ // it tells a runtime pacing in xrEndFrame (PimaxXR's "Prefer framerate
+ // over latency": no wait ever blocks) from a late caller.
+ std::vector runtime_wait_ms_;
std::vector synth_lock_ms_;
+ // A runtime whose xrEndFrame holds each frame until its own slot
+ // (PimaxXR with defer_frame_wait, as its async submission waits there)
+ // holds its swapchain lock all that time, and the game's swapchain calls
+ // wait for it. Its frames are then submitted shortly before the slot
+ // (RuntimeEnd): `runtime_end_block_ms_` is how long its calls made at
+ // once took (smoothed), `runtime_end_return_` the last one's return, and
+ // `runtime_end_margin_ms_` how long before the slot a frame goes.
+ // `runtime_end_hold_ms_`: since the last summary, how long frames waited.
+ double runtime_end_block_ms_{0.0};
+ std::uint32_t runtime_end_block_samples_{0};
+ std::optional runtime_end_return_;
+ double runtime_end_margin_ms_{0.0};
+ std::vector runtime_end_hold_ms_;
+ bool runtime_end_hold_{true}; // VECTORXR_FRAMEGEN_END_HOLD (on unless "off")
+ bool logged_runtime_end_hold_{false};
// Since the last summary, for the game's frames (ThreadedWaitLocked,
// ThreadedEndJit):
std::uint64_t told_lead_sum_{0}; // the leads told, summed
@@ -2354,6 +2439,11 @@ class FrameGenPresenter {
// sub-pixel motion, with VECTORXR_FRAMEGEN_SYNTH_FLOW_VIEW=fine, read at
// Start and at each config reload.
bool flow_view_fine_{false};
+ // Edge fill (FrameGenSettings::edge_fill): degrees each margin reaches
+ // past the frame's edge, horizontally and vertically; research
+ // VECTORXR_FRAMEGEN_EDGE_FILL=h[,v] changes them, read at Start and at
+ // each config reload.
+ std::array edge_fill_degrees_{kFrameGenEdgeFillHorizontalDegrees, kFrameGenEdgeFillVerticalDegrees};
// Research (the head-motion shimmer diagnosis, D): where extrapolated
// frames' eyes go (FrameGenPredictEye; VECTORXR_FRAMEGEN_SYNTH_EYE), read
// at Start.
@@ -2419,6 +2509,7 @@ class FrameGenPresenter {
EngineWindow engine_window_;
// Timed: teardown never waits on them for long (LockForTeardown).
std::timed_mutex submit_mutex_; // presenter-thread submissions vs output swapchain calls
+ std::atomic game_context_lock_{nullptr}; // SetGameContextLock
std::timed_mutex gpu_mutex_; // the GPU backend (Track, Capture, Execute, WaitIdle, Forget, Reset)
double gpu_ms_{-1.0}; // last generation GPU time, read without the backend
// The GPU did not finish this session's Frame Generation work before
diff --git a/layer/include/depthxr/framegen_runtime_queue.h b/layer/include/depthxr/framegen_runtime_queue.h
index ad261c7d..5e7461a9 100644
--- a/layer/include/depthxr/framegen_runtime_queue.h
+++ b/layer/include/depthxr/framegen_runtime_queue.h
@@ -78,6 +78,15 @@ class FrameGenQueueSubstitution {
bool Active() const;
// Where a held-back call the runtime failed is reported (a few times).
void SetLog(std::function log);
+ // The runtime queues work for an application image on the session's
+ // queue only once, before its first wait (PimaxXR and Virtual Desktop's
+ // runtime: a barrier batch at the first xrEnumerateSwapchainImages; their
+ // compositors read images on a device of their own, after a fence on the
+ // queue at xrEndFrame). Then only each image's first wait makes the
+ // game's queue wait for the runtime's: later ones would only make the
+ // game's next frame wait for Frame Generation's work queued there (each
+ // frame it writes, which waits for the game's last frame to be measured).
+ void SetRuntimeQueuesOnlyFirstUse(bool only_first_use);
// The chain Frame Generation's backend is created from: the runtime's
// queue (a FrameGenRuntimeQueue) ahead of the game's own `game_chain`.
const void* FrameGenChain(const void* game_chain);
diff --git a/layer/include/depthxr/framegen_vulkan_bridge.h b/layer/include/depthxr/framegen_vulkan_bridge.h
index edb68f8c..71ed56a5 100644
--- a/layer/include/depthxr/framegen_vulkan_bridge.h
+++ b/layer/include/depthxr/framegen_vulkan_bridge.h
@@ -49,7 +49,21 @@ struct VulkanBridgeGame {
// Depth is a twin as well (the runtime gets the game's depth). Multisampled
// colour is rendered privately and resolved into the twin at release;
// multisampled depth stays private and never reaches the runtime (the caller
-// keeps it out of submitted frames).
+// keeps it out of submitted frames), as does all depth with
+// VECTORXR_VULKAN_BRIDGE_DEPTH=private.
+//
+// A game may write its depth after the frame's end (Star Citizen in October
+// 2026, which CIG said it will fix). About once a second the bridge reads a
+// grid of a depth swapchain's image at its hand-over and again at the
+// swapchain's next acquire; depth that varies only at the acquire, twice in a
+// row, is taken from there: each acquire copies the image handed over last,
+// and each hand-over gives the runtime that copy (the frame before's depth)
+// until depth is in the image at the hand-over again.
+// VECTORXR_VULKAN_BRIDGE_DEPTH=end-frame keeps it at the hand-over, =late takes
+// it at the acquire from the start; VECTORXR_VULKAN_BRIDGE_DEPTH_CHECK_MS sets
+// the check's interval (tests: 0, every hand-over). The check runs only while
+// Frame Generation finds the game's depth empty (WantDepthTimingCheck).
+
//
// Every Vulkan call that uses the game's queue is made inside the
// application's own xrAcquireSwapchainImage, xrReleaseSwapchainImage and
@@ -133,6 +147,15 @@ class VulkanBridge {
// queue just after the copy, and logs both (nonzero texels, least and
// most). Off, nothing of it is made or submitted.
void SetDepthProbe(bool on);
+ // Before Begin: keep every depth swapchain private (Frame Generation's
+ // Use game depth off), as VECTORXR_VULKAN_BRIDGE_DEPTH=private does.
+ void SetKeepDepthPrivate(bool keep);
+ // Whether the bridge checks when the game's depth arrives (above): while
+ // Frame Generation finds the game's depth the same all over (empty, or
+ // written after the frame's end), and while the bridge takes it late.
+ // Otherwise a game's submissions are exactly as without the check.
+ // VECTORXR_VULKAN_BRIDGE_DEPTH_CHECK=always checks every depth swapchain.
+ void WantDepthTimingCheck(bool want);
// Swapchain formats: a VkFormat's DXGI format for the runtime, and back
// (0 when there is none).
@@ -237,6 +260,7 @@ class VulkanBridge {
std::function log_;
std::function info_log_;
bool queried_d3d12_requirements_{false};
+ bool keep_depth_private_{false};
};
} // namespace depthxr
diff --git a/layer/include/depthxr/game_context_lock.h b/layer/include/depthxr/game_context_lock.h
new file mode 100644
index 00000000..8b17bfa8
--- /dev/null
+++ b/layer/include/depthxr/game_context_lock.h
@@ -0,0 +1,126 @@
+#pragma once
+
+// Included by .cpp files only: it brings in Direct3D 11's headers.
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace depthxr {
+
+// The game's Direct3D 11 immediate context's lock (ID3D11Multithread), held
+// by GameContextLock::Hold until the hold goes.
+class GameContextHold {
+ public:
+ GameContextHold() = default;
+ explicit GameContextHold(Microsoft::WRL::ComPtr entered) : entered_(std::move(entered)) {}
+ GameContextHold(GameContextHold&& other) noexcept : entered_(std::move(other.entered_)) {}
+ GameContextHold& operator=(GameContextHold&& other) noexcept {
+ if (this != &other) {
+ Release();
+ entered_ = std::move(other.entered_);
+ }
+ return *this;
+ }
+ GameContextHold(const GameContextHold&) = delete;
+ GameContextHold& operator=(const GameContextHold&) = delete;
+ ~GameContextHold() { Release(); }
+
+ bool Held() const { return entered_ != nullptr; }
+ // Lets the lock go now (on the thread that took it); again does nothing.
+ void Release() {
+ if (entered_) {
+ entered_->Leave();
+ entered_.Reset();
+ }
+ }
+
+ private:
+ Microsoft::WRL::ComPtr entered_;
+};
+
+// The lock order for the game's Direct3D 11 immediate context: the device's
+// lock (ID3D11Multithread::Enter) before any lock of the layer's.
+//
+// With multithread protection on, every call on the immediate context takes
+// the device's lock (Flush and a few others take it even without). A game
+// may hold that lock (Enter) on one thread through an OpenXR call, which
+// waits for the layer's locks; a layer thread that waited for the device's
+// lock while holding one of them would deadlock with it. So code that calls
+// the game's context under its own locks takes the device's lock first,
+// holding none of them: Hold, before the first of its locks, kept until the
+// last of its calls on the context is made. Enter is recursive: calls on the
+// context, and holds taken again inside, then never wait.
+//
+// Only while the game's device is multithread protected: without protection
+// the context's calls take no lock a game could hold across its OpenXR calls
+// (but for Flush), and the layer adds no Enter/Leave to them. Protection is
+// read at each Hold (holding no lock: Direct3D 11's debug layer waits for
+// the device's lock to read it) and never changed here.
+//
+// Set and Hold may be called from any thread.
+class GameContextLock {
+ public:
+ // The game's device (its immediate context's lock), or none.
+ void Set(ID3D11Device* device) {
+ Microsoft::WRL::ComPtr multithread;
+ if (device) {
+ Microsoft::WRL::ComPtr context;
+ device->GetImmediateContext(&context);
+ if (context) {
+ context.As(&multithread);
+ }
+ }
+ std::scoped_lock lock(mutex_);
+ multithread_ = std::move(multithread);
+ active_.store(multithread_ != nullptr, std::memory_order_release);
+ }
+ bool Active() const { return active_.load(std::memory_order_acquire); }
+
+ // Before taking any lock of the caller's: enters the device's lock when
+ // its multithread protection is on, else holds nothing.
+ GameContextHold Hold() {
+ if (!Active()) {
+ return {};
+ }
+ Microsoft::WRL::ComPtr multithread;
+ std::function hook;
+ {
+ std::scoped_lock lock(mutex_);
+ multithread = multithread_;
+ if (has_hook_) hook = wait_hook_;
+ }
+ if (!multithread) {
+ return {};
+ }
+ if (hook) {
+ hook();
+ }
+ if (multithread->GetMultithreadProtected() == FALSE) {
+ return {};
+ }
+ multithread->Enter();
+ return GameContextHold(std::move(multithread));
+ }
+
+ // Tests: called in Hold, on its thread, before it reads the device's
+ // protection and enters its lock (holding none of the caller's locks).
+ void SetWaitHookForTest(std::function hook) {
+ std::scoped_lock lock(mutex_);
+ has_hook_ = static_cast(hook);
+ wait_hook_ = std::move(hook);
+ }
+
+ private:
+ mutable std::mutex mutex_; // only while copying the members: no call is made under it
+ Microsoft::WRL::ComPtr multithread_;
+ std::atomic active_{false};
+ bool has_hook_{false};
+ std::function wait_hook_;
+};
+
+} // namespace depthxr
diff --git a/layer/include/depthxr/openxr_layer.h b/layer/include/depthxr/openxr_layer.h
index 5f03e6b6..d81a8897 100644
--- a/layer/include/depthxr/openxr_layer.h
+++ b/layer/include/depthxr/openxr_layer.h
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -46,6 +47,8 @@
#include "depthxr/framegen_runtime_queue.h"
#include "depthxr/turbo_recovery.h"
#include "depthxr/turbo_prediction_history.h"
+#include "depthxr/turbo_probe_guard.h"
+#include "depthxr/upstream_turbo.h"
#include "depthxr/turbo_trace.h"
#include "depthxr/settings_resolver.h"
#include "depthxr/handshake_census.h"
@@ -69,6 +72,9 @@ struct ID3D11VertexShader;
namespace depthxr {
+class GameContextLock;
+class GameContextHold;
+
#if defined(DEPTHXR_TESTING)
class TurboFrameTestPeer;
#endif
@@ -85,8 +91,34 @@ class OpenXrLayer {
void SetLayerDirectory(std::filesystem::path dll_directory);
void SetNextProcAddr(PFN_xrGetInstanceProcAddr next_get_instance_proc_addr);
bool CanCreateInstance();
+ // A second instance passed straight through (layer_entry.cpp's
+ // PassThroughInstance): said in the first instance's log.
+ void NotePassThroughInstance(const std::string& application_name, XrResult result);
+ // Another instance is being created while VectorXR's is alive. An instance
+ // that enabled no graphics extension and never asked for a session cannot
+ // have a session VectorXR could serve: OpenXR Toolkit's and
+ // Quad-Views-Foveated's probe instance, which they keep alive on VIVE
+ // runtimes. VectorXR lets it go as at xrDestroyInstance, without
+ // destroying it in the runtime, and answers true with what its calls
+ // go on to (it passes straight through from here); the new instance is
+ // VectorXR's. Any other instance keeps VectorXR (false).
+ struct RetiredInstance {
+ XrInstance instance{XR_NULL_HANDLE};
+ PFN_xrGetInstanceProcAddr next_get_instance_proc_addr{nullptr};
+ PFN_xrDestroyInstance next_destroy_instance{nullptr};
+ };
+ bool RetireIdleInstance(const std::string& next_application_name, RetiredInstance* retired);
+ // The application's name as it created the instance.
+ std::string application_name_;
+ // Native quad views on a runtime that shows the focus views with the FOVs
+ // it located for the frame's display time (PimaxXR, DCS World).
+ bool RuntimeTakesFocusFovsFromLocateLocked() const;
+ bool native_quad_focus_shares_eye_poses_{false};
+ bool has_logged_focus_fov_quirk_convergence_{false};
struct InstanceCreateDiagnostics {
+ // "absent", "above" or "below" VectorXR.
+ std::string quad_views_foveated{"absent"};
bool turbo_clock_enabled{false};
bool app_requested_quad_views{false};
bool app_requested_varjo_foveated_rendering{false};
@@ -145,9 +177,9 @@ class OpenXrLayer {
// The names of the layers below VectorXR, nearest first.
std::string layers_below;
// Where OpenXR Toolkit is: "absent", "below", "above", or
- // "above-bypassed" (its per-application bypass passes everything
- // through). Above VectorXR it gets a game's quad views, which it does
- // not support.
+ // "above-bypassed" / "below-bypassed" (its per-application bypass
+ // passes everything through). Above VectorXR it gets a game's quad
+ // views, which it does not support; below it, Frame Generation's frames.
std::string openxr_toolkit{"absent"};
// The space-warp probe (spacewarp_probe.h): VECTORXR_SPACEWARP_PROBE
// (parsed, and as set: empty when it is not), what the application
@@ -195,6 +227,9 @@ class OpenXrLayer {
void AbandonInstance();
XrResult GetInstanceProcAddr(XrInstance instance, const char* name, PFN_xrVoidFunction* function);
XrResult DestroyInstance(XrInstance instance);
+ // DestroyInstance's teardown; `in_runtime` false keeps the runtime's
+ // instance (RetireIdleInstance).
+ XrResult EndInstance(XrInstance instance, bool in_runtime);
XrResult CreateSession(XrInstance instance, const XrSessionCreateInfo* create_info, XrSession* session);
XrResult DestroySession(XrSession session);
XrResult BeginSession(XrSession session, const XrSessionBeginInfo* begin_info);
@@ -316,7 +351,7 @@ class OpenXrLayer {
friend class SpaceWarpProbeTestPeer;
#endif
- OpenXrLayer() = default;
+ OpenXrLayer();
~OpenXrLayer();
struct SwapchainInfo {
@@ -599,7 +634,8 @@ class OpenXrLayer {
// (and again after a config change); the verdict/stall helpers run on the
// frame thread after the lock is released.
void ResolveTurboPacingModeLocked();
- void RecordTurboPacingVerdict(TurboPacingMode mode, const char* source, std::int64_t stable_seconds);
+ void RecordTurboPacingVerdict(TurboPacingMode mode, const char* source, std::int64_t stable_seconds,
+ std::int64_t early_probe_failures = 0);
void QueueRuntimePacingWrite(RuntimePacingObservation observation);
void DrainRuntimePacingWrites();
void NoteTurboPacingStableFrame(double app_frame_delta_ms);
@@ -609,10 +645,16 @@ class OpenXrLayer {
// Releases config_lock (mutex_) before any blocking runtime call so
// xrLocateViews/xrLocateSpace from other app threads are never serialized
// behind the compositor pacing wait. Call as the tail of EndFrame only.
+ // `context_hold`: EndFrame's hold of the game's Direct3D 11 context
+ // (game_context_), let go with config_lock.
XrResult ForwardEndFrame(XrSession session,
const XrFrameEndInfo* frame_end_info,
- std::unique_lock& config_lock);
+ std::unique_lock& config_lock,
+ GameContextHold* context_hold = nullptr);
void ObserveCompositionLayerTopology(const XrFrameEndInfo* frame_end_info);
+ // At the app's xrEndFrame: whether a layer above pipelines its frames
+ // already (upstream_turbo_); logs once when that is first seen.
+ bool NoteUpstreamTurboFrame();
void ArmTurboAsyncHandoffLocked(const char* reason);
void PublishTurboAsyncHandoffLocked();
void CancelTurboAsyncHandoffLocked(const char* reason);
@@ -724,9 +766,21 @@ class OpenXrLayer {
// swapchain's: while the Vulkan bridge gives the game's motion vector
// images back at their releases (vulkan_bridge_motion_), each
// swapchain's copies are made first, then the captures and releases.
+ // `forward_later`: the releases due on to the runtime are added to it
+ // (a swapchain per release) instead, for ForwardHandedOverReleases.
XrResult HandOverBridgedReleasesLocked(XrSwapchain swapchain, SwapchainInfo& info, std::string_view reason,
- bool copy = true);
- XrResult HandOverBridgedReleasesLocked(std::string_view reason, bool copy = true);
+ bool copy = true, std::vector* forward_later = nullptr);
+ XrResult HandOverBridgedReleasesLocked(std::string_view reason, bool copy = true,
+ std::vector* forward_later = nullptr);
+ // The releases a hand-over left for later, on to the runtime with
+ // `lock` (of mutex_) let go meanwhile: a runtime's swapchain calls can
+ // stall for a refresh (PimaxXR's xrEndFrame holds their lock, called from
+ // Frame Generation's thread), and the game's other threads' calls into
+ // the layer must not wait for that. The caller holds
+ // bridge_handover_mutex_, so no other hand-over or swapchain call of the
+ // game's comes between the hand-over and its releases.
+ XrResult ForwardHandedOverReleases(std::unique_lock& lock, std::vector& releases,
+ std::string_view reason);
// At a session's (or an instance's) end, before the Vulkan bridge's
// Escape: releases no frame's end handed over still give the game's
// rendering into their images to the bridge (its Released, not Frame
@@ -890,13 +944,23 @@ class OpenXrLayer {
bool EnsureD3D11QuadViewsPixelProbeResources(int64_t format);
void ReleaseD3D11QuadViewsPixelProbeResources(bool preserve_history);
void PollD3D11QuadViewsPixelProbe();
+ // `eye_in_view`: each stereo eye's orientation relative to VIEW when the
+ // runtime's eyes are canted (CantedEyeOrientations), else null.
bool SynthesizeQuadViewsFromStereo(std::span stereo_views,
const QuadViewsSettings& quadviews_settings,
double focus_yaw_radians,
double focus_pitch_radians,
uint32_t view_capacity_input,
uint32_t* view_count_output,
- XrView* views) const;
+ XrView* views,
+ const std::array* eye_in_view = nullptr) const;
+ // Whether the two stereo eyes the runtime located are turned from each
+ // other (a canted display), and if so each eye's orientation relative to
+ // VIEW at the locate's display time. Caller holds mutex_.
+ bool CantedEyeOrientations(XrSession session,
+ const XrViewLocateInfo& view_locate_info,
+ std::span stereo_views,
+ std::array* eye_in_view);
XrResult LocateSpaceWithPivot(XrSpace space,
XrSpace base_space,
XrTime time,
@@ -982,7 +1046,16 @@ class OpenXrLayer {
// be sharpened is left untouched (submits the app's unsharpened focus).
void SharpenNativeFocusViews(std::vector& views, XrTime display_time);
+ // The game's Direct3D 11 device's lock (a Direct3D 11 session's, bridged
+ // or not; set at xrCreateSession): taken before bridge_handover_mutex_
+ // and mutex_ by every call that uses the game's immediate context under
+ // them (GameContextLock), while the game's device is multithread
+ // protected. Made with the layer, never replaced.
+ std::unique_ptr game_context_;
std::mutex mutex_;
+ // Held across a bridged hand-over and its releases' runtime calls
+ // (ForwardHandedOverReleases), which go without mutex_; taken before mutex_.
+ std::mutex bridge_handover_mutex_;
std::filesystem::path dll_directory_;
std::filesystem::path config_path_;
std::filesystem::path log_path_;
@@ -1088,6 +1161,7 @@ class OpenXrLayer {
D3D11Bridge d3d11_bridge_;
bool d3d11_bridge_lost_logged_{false}; // mutex_
bool d3d11_bridge_depth_logged_{false}; // mutex_
+ bool depth_rect_logged_{false}; // mutex_: a depth sub-image outside its image was left out (any session)
bool d3d11_bridge_sharpen_logged_{false}; // mutex_
std::chrono::steady_clock::time_point d3d11_bridge_last_summary_; // mutex_
// Quad views frames of a bridged session (mutex_): composed by Frame
@@ -1120,6 +1194,53 @@ class OpenXrLayer {
std::optional pending_trace_quad_space_;
D3D11BridgeQuadFrames d3d11_bridge_quad_frames_;
D3D11BridgeQuadFrames d3d11_bridge_quad_frames_summarized_;
+ // The game's swapchain calls while the bridge is active: how long each
+ // took in the layer and the runtime, for the bridge's summary (a game
+ // blocked inside its own frame, DCS 2026-10-22: 57 ms of a frame with
+ // its thread 41% busy, the GPU half idle).
+ struct BridgeCallTiming {
+ std::atomic calls{0};
+ std::atomic total_ns{0};
+ std::atomic max_ns{0};
+ void Add(std::uint64_t ns) {
+ ++calls;
+ total_ns += ns;
+ for (std::uint64_t seen = max_ns.load(); ns > seen && !max_ns.compare_exchange_weak(seen, ns);) {
+ }
+ }
+ // "avg/max" ms since the last call, then starts over.
+ std::string Take() {
+ const std::uint64_t count = calls.exchange(0);
+ const std::uint64_t total = total_ns.exchange(0);
+ const std::uint64_t most = max_ns.exchange(0);
+ if (!count) return "-";
+ const auto ms = [](double ns) {
+ const long long hundredths = std::llround(ns / 1e4);
+ return std::to_string(hundredths / 100) + "." + (hundredths % 100 < 10 ? "0" : "") +
+ std::to_string(hundredths % 100);
+ };
+ return ms(static_cast(total) / static_cast(count)) + "/" + ms(static_cast(most));
+ }
+ };
+ std::array bridge_call_timing_; // acquire, wait, release
+ class BridgeCallTimer {
+ public:
+ explicit BridgeCallTimer(BridgeCallTiming* timing)
+ : timing_(timing), start_(timing ? std::chrono::steady_clock::now() : std::chrono::steady_clock::time_point{}) {}
+ ~BridgeCallTimer() {
+ if (timing_) {
+ timing_->Add(static_cast(
+ std::chrono::duration_cast(std::chrono::steady_clock::now() - start_)
+ .count()));
+ }
+ }
+ BridgeCallTimer(const BridgeCallTimer&) = delete;
+ BridgeCallTimer& operator=(const BridgeCallTimer&) = delete;
+
+ private:
+ BridgeCallTiming* timing_;
+ std::chrono::steady_clock::time_point start_;
+ };
// Vulkan games with Frame Generation: the session is Direct3D 12 and the
// game renders into images shared with it (see VulkanBridge); decided at
// xrCreateSession. Frame Generation runs a Vulkan session only through it.
@@ -1132,6 +1253,8 @@ class OpenXrLayer {
// Frame Generation's captures (HandOverBridgedReleasesLocked). mutex_.
bool vulkan_bridge_motion_{false};
std::chrono::steady_clock::time_point vulkan_bridge_last_summary_; // mutex_
+ std::chrono::steady_clock::time_point vulkan_bridge_last_depth_poll_; // mutex_
+
// Either bridge's swapchain, and one whose runtime images never get
// anything (its calls need no ordering with the game's queue).
bool BridgedSwapchain(XrSwapchain swapchain) const {
@@ -1319,6 +1442,12 @@ class OpenXrLayer {
// number of extensions it enabled for it.
bool instance_requested_session_{false};
uint32_t instance_enabled_extension_count_{0};
+ // The application enabled a graphics API's extension (or a headless
+ // one): the instance can create a session.
+ bool instance_enabled_session_extension_{false};
+ // RetireIdleInstance's line for the next instance's log (the retired
+ // instance's own log is a probe's, removed with it).
+ std::string retired_instance_note_;
std::vector pivotxr_profile_input_states_;
// IsPivotXrActive's per-call claim lists (under mutex_), kept so the
// locate paths do not allocate.
@@ -1387,6 +1516,19 @@ class OpenXrLayer {
};
std::vector pivotxr_reference_changes_;
bool PivotAnchorAffectedBy(XrReferenceSpaceType type) const;
+ // A runtime that recenters without the event (PimaxXR): the head located
+ // at the previous drive, against which a jump no head can make is taken
+ // as a recenter (NoteSilentRecenterLocked). Not watched once the runtime
+ // has sent a reference space change itself.
+ struct PivotDriveSample {
+ XrTime time{0};
+ XrSpace reference_space{XR_NULL_HANDLE};
+ XrPosef view_pose{};
+ };
+ std::optional pivotxr_last_drive_;
+ bool pivotxr_runtime_reports_recenters_{false};
+ uint32_t pivotxr_silent_recenter_logs_{0};
+ void NoteSilentRecenterLocked(XrTime time, XrSpace reference_space, const XrPosef& view_pose);
bool depthxr_toggle_enabled_{true};
bool depthxr_toggle_binding_was_down_{false};
std::optional pivotxr_binding_last_poll_time_;
@@ -1528,7 +1670,18 @@ class OpenXrLayer {
// runtime, or the in-session fallback after async tripped.
enum class TurboPacingSource { kForced, kPinned, kDiscovered, kProbing, kFallback };
std::uint64_t turbo_test_started_at_{0};
- bool TryTurboAutoFallbackLocked(const std::string& reason);
+ bool TryTurboAutoFallbackLocked(const std::string& reason,
+ std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now());
+ // Auto's async probe (frame thread): stalls in its first seconds are not
+ // counted, and a fallback within seconds of engaging is "early"
+ // (TurboProbeGuard, runtime_pacing.h).
+ TurboProbeGuard turbo_probe_guard_;
+ int turbo_probe_grace_log_budget_{0};
+ // This session's sequenced fallback came from a probe that failed early.
+ bool turbo_fallback_early_{false};
+ // The recorded sequenced verdict a re-probe is testing again: its outcome
+ // is recorded at once if async falls back (sequenced is already proven).
+ std::optional turbo_reprobe_of_;
// Frame-submission-thread only (resolved under the config lock at
// EndFrame, consumed after it is released); the sequenced state machine
// below is turbo_mutex_-guarded because WaitFrame/BeginFrame consult it.
@@ -1558,6 +1711,11 @@ class OpenXrLayer {
std::optional session_begin_wall_time_;
bool turbo_cadence_pause_logged_{false};
double turbo_last_frame_blocked_ms_{0.0};
+ // A layer above already pipelining the game's frames (OpenXR Toolkit's
+ // Turbo, upstream_turbo.h), under turbo_mutex_. Detected, Turbo stands
+ // aside for the session.
+ UpstreamTurboDetector upstream_turbo_;
+ bool upstream_turbo_logged_{false};
// Sequenced pacing state machine (turbo_mutex_). DCS overlaps xrWaitFrame
// (sim thread) with xrEndFrame (render thread) — spec-legal — so the
// fabrication shield must never have a per-frame gap, and establishment
@@ -1796,6 +1954,24 @@ class OpenXrLayer {
// Quadviews stays off and the game runs stereo.
bool openxr_toolkit_above_{false};
bool openxr_toolkit_quadviews_logged_{false};
+ // OpenXR Toolkit is below VectorXR for this instance (not bypassed): it
+ // holds every release back until its next xrEndFrame and then releases
+ // every swapchain it held, and is not safe to call from two threads, so
+ // Frame Generation (more frames than the game's, from its own thread)
+ // stays off.
+ bool openxr_toolkit_below_{false};
+ bool openxr_toolkit_framegen_logged_{false};
+ // Frame Generation was asked for but is kept off for that reason; the
+ // OSD says so instead of a plain Off (read on the OSD's thread).
+ std::atomic framegen_off_for_toolkit_{false};
+ // The layers below VectorXR (names, nearest first) for this instance:
+ // with Frame Generation they get every frame it shows, from its thread,
+ // and (Direct3D 12) its queue as the session's. The session's frames the
+ // game ended and the frames the runtime got, for the session's end.
+ std::string layers_below_;
+ std::atomic game_frames_ended_{0};
+ std::atomic runtime_frames_ended_{0};
+ bool layers_below_get_framegen_{false}; // the session's (StartFrameGen)
bool defer_quadviews_swapchain_releases_{false};
// Quadviews changes the application's view/swapchain topology. Once a session
// is created, keep its initial activation state until teardown so a config
@@ -1811,6 +1987,7 @@ class OpenXrLayer {
XrSpace varjo_native_view_space_{XR_NULL_HANDLE};
XrSpace varjo_native_combined_eye_space_{XR_NULL_HANDLE};
bool varjo_native_rendering_gaze_tracked_{false};
+ bool has_logged_varjo_native_rendering_gaze_uninformative_{false};
bool has_logged_varjo_native_rendering_gaze_active_{false};
bool has_logged_varjo_native_rendering_gaze_unavailable_{false};
bool varjo_native_foveation_resources_attempted_{false};
@@ -1853,6 +2030,7 @@ class OpenXrLayer {
uint32_t pending_quadviews_pixel_diagnostics_{0};
bool has_active_primary_view_configuration_{false};
bool has_logged_quad_view_short_count_{false};
+ bool has_logged_canted_quadviews_eyes_{false};
bool has_logged_pivotxr_spike_mode_{false};
bool has_logged_quadviews_view_configuration_capabilities_{false};
uint64_t varjo_native_view_configuration_calls_{0};
@@ -1944,6 +2122,26 @@ class OpenXrLayer {
std::optional last_app_action_sync_result_;
std::optional last_eye_gaze_self_sync_result_;
XrSessionState observed_session_state_{XR_SESSION_STATE_UNKNOWN};
+ // A new session's first state event not yet seen: events the runtime kept
+ // from the previous session (PimaxXR) are not taken as this one's state.
+ // Head prediction's answer to one xrLocateSpace query (space, base) at one
+ // display time, as its first locate gave it: later locates of the query
+ // at that time answer the same (LocateSpace). Never used for another time.
+ struct HeadExtensionAnswer {
+ XrTime time{0};
+ XrSpace space{XR_NULL_HANDLE};
+ XrSpace base_space{XR_NULL_HANDLE};
+ XrTime limit{0};
+ bool applied{false};
+ XrPosef pose{};
+ };
+ static constexpr std::size_t kHeadExtensionAnswersKept = 8;
+ std::vector head_extension_answers_;
+ bool awaiting_session_start_event_{false};
+ XrTime session_create_time_{0};
+ uint32_t stale_session_event_logs_{0};
+ void NoteSessionCreatedLocked(XrTime create_time);
+ bool IsStaleSessionEventLocked(const XrEventDataSessionStateChanged& change);
bool eye_gaze_sync_not_focused_{false};
uint32_t eye_gaze_sync_transition_logs_remaining_{32};
std::optional last_eye_gaze_bound_sources_probe_;
@@ -1953,6 +2151,19 @@ class OpenXrLayer {
std::string eye_gaze_unfocused_outcome_;
std::optional eye_gaze_unfocused_last_orientation_;
uint32_t eye_gaze_unfocused_identical_frames_{0};
+ // The focused session's gaze as last located, at which display time, and
+ // for how many display times in a row it has not changed at all.
+ std::optional eye_gaze_focused_last_orientation_;
+ XrTime eye_gaze_focused_last_time_{0};
+ uint32_t eye_gaze_focused_identical_frames_{0};
+ bool eye_gaze_focused_frozen_logged_{false};
+ // Diagnostic: the display time since which the focused gaze has stayed
+ // near (yaw, pitch); logged once per episode, a few times per session.
+ std::optional eye_gaze_still_since_;
+ double eye_gaze_still_yaw_{0.0};
+ double eye_gaze_still_pitch_{0.0};
+ bool eye_gaze_still_logged_{false};
+ int eye_gaze_still_logs_remaining_{8};
uint32_t eye_gaze_unfocused_logs_remaining_{16};
// Focused and inactive since (reset by valid gaze or focus loss); the
// "no data" line is logged once per session.
diff --git a/layer/include/depthxr/osd_graphics.h b/layer/include/depthxr/osd_graphics.h
index dd3b88e5..645c1bb7 100644
--- a/layer/include/depthxr/osd_graphics.h
+++ b/layer/include/depthxr/osd_graphics.h
@@ -21,6 +21,8 @@ class OsdGraphics {
virtual OsdUpload Upload(std::uint32_t, const OsdBitmap&, std::string& error) = 0;
// Only teardown/retry may wait for this backend's outstanding copy.
virtual void Reset() = 0;
+ // Direct3D 11: the game's device, whose immediate context Upload uses.
+ virtual ID3D11Device* D3D11Device() const { return nullptr; }
};
std::unique_ptr CreateOsdGraphics(const void* binding_chain, std::string& error);
std::unique_ptr CreateOsdD3D11(ID3D11Device*);
diff --git a/layer/include/depthxr/osd_renderer.h b/layer/include/depthxr/osd_renderer.h
index d0e55db7..a77182ea 100644
--- a/layer/include/depthxr/osd_renderer.h
+++ b/layer/include/depthxr/osd_renderer.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -160,8 +161,11 @@ void FeatherOsdPixels(const std::uint32_t* bits, std::uint32_t* pixels, int pane
// Produces premultiplied sRGB pixels for an sRGB OpenXR swapchain.
OsdBitmap RasterizeOsd(const OsdSettings&, bool compact, const OsdSnapshot&, const OsdTelemetry&, bool rgba);
+class GameContextLock;
+
class OsdRenderer {
public:
+ OsdRenderer();
~OsdRenderer();
void Initialize(XrSession, ID3D11Device*, std::uint32_t max_layers, OsdDispatch);
void InitializeGraphics(XrSession, const void* binding_chain, std::uint32_t max_layers, OsdDispatch, Logger*, std::string identity);
@@ -184,8 +188,13 @@ class OsdRenderer {
// Called for every runtime xrEndFrame, after game-layer transforms: on the
// application's end-frame thread, or Frame Generation's presenter thread.
// Makes runtime calls (swapchain images; a world-anchored panel's space and
- // head location) under the renderer's lock.
+ // head location) under the renderer's lock. Direct3D 11: while the panel
+ // is drawn, the game's device's lock is taken before the renderer's
+ // (GameContextLock), as its upload uses the game's immediate context.
const XrCompositionLayerBaseHeader* Append(const XrFrameEndInfo&, bool should_render);
+ // Tests: called on Append's thread just before it takes the game's
+ // device's lock (GameContextLock::SetWaitHookForTest).
+ void SetContextWaitHookForTest(std::function hook);
OsdStatus Status() const;
// Places the panel in the world at each frame's head pose, located at
// that frame's own display time, instead of in the VIEW space. A runtime
@@ -202,6 +211,9 @@ class OsdRenderer {
void Event(bool error, std::string message);
std::vector> CollectDiagnosticsLocked(bool final);
std::size_t Mode() const;
+ // The Direct3D 11 game's device's lock (InitializeGraphics), made with
+ // the renderer: read by Append before mutex_.
+ const std::unique_ptr context_lock_;
mutable std::mutex mutex_;
XrSession session_{XR_NULL_HANDLE};
XrSwapchain swapchain_{XR_NULL_HANDLE};
diff --git a/layer/include/depthxr/runtime_pacing.h b/layer/include/depthxr/runtime_pacing.h
index 435af49f..1c493a87 100644
--- a/layer/include/depthxr/runtime_pacing.h
+++ b/layer/include/depthxr/runtime_pacing.h
@@ -31,8 +31,29 @@ struct RuntimePacingObservation {
// verdict, and how long the winning mode ran clean.
std::int64_t probe_timeouts{0};
std::int64_t stable_seconds{0};
+ // Async probes in a row that fell back to sequenced within seconds of
+ // engaging (TurboProbeGuard). One such verdict is provisional: the next
+ // session probes async again. 0 in records from before 0.20.1.
+ std::int64_t early_probe_failures{0};
};
+// A recorded sequenced verdict is probed with async again once its evidence
+// may be stale; the re-probe records its outcome either way, so each reason
+// costs at most one probe (two when the re-probe also fails early):
+// - the async probe behind it fell back early, once (kEarlyProbeFailureLimit
+// early failures in a row and the verdict stands);
+// - it was recorded by another VectorXR version, or last used with another
+// runtime version (both empty-tolerant: no version, no reason);
+// - it is older than kReprobeAge (testStartedAt, the session that tested it).
+// Async verdicts are never re-probed here: async failing later falls back in
+// the session. Returns the reason, or nothing when the verdict stands.
+inline constexpr std::int64_t kEarlyProbeFailureLimit = 2;
+inline constexpr std::int64_t kReprobeAgeMs = 30LL * 24 * 60 * 60 * 1000;
+std::optional RuntimePacingReprobeReason(const RuntimePacingObservation& observation,
+ const std::string& layer_version,
+ const std::string& runtime_version,
+ std::int64_t now_unix_ms);
+
std::filesystem::path ResolveRuntimePacingPath();
std::vector ReadRuntimePacingObservations(const std::filesystem::path& path);
diff --git a/layer/include/depthxr/settings.h b/layer/include/depthxr/settings.h
index 9b0aa105..71fef8ad 100644
--- a/layer/include/depthxr/settings.h
+++ b/layer/include/depthxr/settings.h
@@ -581,6 +581,16 @@ struct FrameGenSettings {
// Generation tells the game that the runtime does not predict (see
// head_prediction.h). Off by default.
bool extend_head_prediction{false};
+ // Edge fill: frames Frame Generation writes reach a few degrees past the
+ // game's field of view, the margin repeating the frame's edge, so a fast
+ // head turn shows a smeared edge instead of black on its leading side
+ // (FrameGenEdgeMargins). Direct3D 12 and the bridges only. Off by default.
+ bool edge_fill{false};
+ // Use the game's depth (on by default). Off, Frame Generation works
+ // without it and the bridges keep a bridged game's depth to itself, as
+ // before 0.20.1: no copy, and no multithread protection turned on for it.
+ // The bridges read it when the session starts.
+ bool use_game_depth{true};
};
struct FrameGenProfile {
diff --git a/layer/include/depthxr/turbo_probe_guard.h b/layer/include/depthxr/turbo_probe_guard.h
new file mode 100644
index 00000000..064faf11
--- /dev/null
+++ b/layer/include/depthxr/turbo_probe_guard.h
@@ -0,0 +1,107 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace depthxr {
+
+// When a stalled async xrWaitFrame counts against Auto's async pacing.
+//
+// DCS on Pimax (Oct 29 S4 flight) left its loading screen at about 18 fps. The
+// first two pipelined waits after Turbo engaged both ran into the drain bound,
+// half a second apart, which tripped the probe's two-stall fallback the same
+// moment async engaged, and Auto recorded a sequenced verdict. A session with
+// async pinned then ran clean for 17 minutes, with one stall at its own
+// engagement. So stalls right after engaging, or while the game is still
+// hitching, are not counted. They still cost the frame its drain, so the grace
+// is short and capped: a runtime that interlocks every off-thread wait (the
+// case the fallback exists for) still falls back a few seconds after engaging.
+//
+// A fallback soon after engaging is "early": its sequenced verdict is recorded
+// as provisional, so the next session probes async again (runtime_pacing.h).
+//
+// The times come from the caller (steady_clock in the layer, a script in its
+// tests). The frame thread makes the calls; the times are atomic so an Auto
+// fallback on another thread may read Early and SinceEngaged.
+class TurboProbeGuard {
+ public:
+ using Clock = std::chrono::steady_clock;
+
+ struct Limits {
+ // Stalls this soon after async pacing engages are not counted.
+ std::chrono::milliseconds grace{2000};
+ // A game hitch (app time only, Turbo's own blocking subtracted) keeps
+ // stalls uncounted for this long after it...
+ std::chrono::milliseconds hitch_grace{1000};
+ // ...but never past this point after engaging.
+ std::chrono::milliseconds max_grace{5000};
+ // An app frame this slow is a hitch (the cadence gate's healthy bound).
+ double hitch_ms{50.0};
+ // A fallback this soon after engaging is early.
+ std::chrono::milliseconds early_failure{10000};
+ };
+
+ // Limits are set before use (tests); never while frames run.
+ void Configure(const Limits& limits) { limits_ = limits; }
+ const Limits& Settings() const { return limits_; }
+ void Reset() {
+ engaged_ns_.store(kNotEngaged, std::memory_order_relaxed);
+ grace_until_ns_.store(kNotEngaged, std::memory_order_relaxed);
+ }
+
+ // Async pacing engaged (each engage, re-engages after a toggle included).
+ void Engaged(Clock::time_point now) {
+ grace_until_ns_.store(Ns(now + limits_.grace), std::memory_order_relaxed);
+ engaged_ns_.store(Ns(now), std::memory_order_relaxed);
+ }
+
+ // Every app frame, with its app-only frame time (negative when unknown).
+ void AppFrame(Clock::time_point now, double app_frame_ms) {
+ const std::int64_t engaged = engaged_ns_.load(std::memory_order_relaxed);
+ if (engaged == kNotEngaged || app_frame_ms < limits_.hitch_ms) return;
+ const std::int64_t cap = engaged + Ns(limits_.max_grace);
+ const std::int64_t until = std::min(cap, Ns(now + limits_.hitch_grace));
+ if (until > grace_until_ns_.load(std::memory_order_relaxed))
+ grace_until_ns_.store(until, std::memory_order_relaxed);
+ }
+
+ bool InGrace(Clock::time_point now) const {
+ return engaged_ns_.load(std::memory_order_relaxed) != kNotEngaged &&
+ Ns(now) < grace_until_ns_.load(std::memory_order_relaxed);
+ }
+
+ std::optional SinceEngaged(Clock::time_point now) const {
+ const std::int64_t engaged = engaged_ns_.load(std::memory_order_relaxed);
+ if (engaged == kNotEngaged) return std::nullopt;
+ return std::chrono::duration_cast(std::chrono::nanoseconds(Ns(now) - engaged));
+ }
+
+ bool Early(Clock::time_point now) const {
+ const auto since = SinceEngaged(now);
+ return since && *since < limits_.early_failure;
+ }
+
+ private:
+ // Written on the frame thread; an Auto fallback can read them from the
+ // app's wait/begin thread (NoteTurboRuntimeFailure), so they are atomic
+ // (single words: no torn reads, no lock on the frame path).
+ static constexpr std::int64_t kNotEngaged = INT64_MIN;
+ template
+ static std::int64_t Ns(T value) {
+ if constexpr (std::is_same_v) {
+ return std::chrono::duration_cast(value.time_since_epoch()).count();
+ } else {
+ return std::chrono::duration_cast(value).count();
+ }
+ }
+ Limits limits_{};
+ std::atomic engaged_ns_{kNotEngaged};
+ std::atomic grace_until_ns_{kNotEngaged};
+};
+
+} // namespace depthxr
diff --git a/layer/include/depthxr/upstream_turbo.h b/layer/include/depthxr/upstream_turbo.h
new file mode 100644
index 00000000..9f2a9acc
--- /dev/null
+++ b/layer/include/depthxr/upstream_turbo.h
@@ -0,0 +1,81 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+
+namespace depthxr {
+
+// OpenXR Toolkit's Turbo above VectorXR (its layer.cpp xrEndFrame): xrWaitFrame
+// on a pool thread as soon as the app's xrEndFrame returns, xrBeginFrame right
+// before the next xrEndFrame. Games that wait on a thread of their own begin
+// before they render (DCS, MSFS), so all three together are the layer's.
+//
+// Neither the OS nor the Toolkit promises the short intervals: a pool thread
+// can start late, and a begin can be preempted before its end. A frame that
+// misses one is not evidence against the pattern, so the frames are judged
+// over a window: enough of the last kWindow frames in the pattern is a layer
+// pipelining them. With the Toolkit known to be above (its manifest's place in
+// the chain) seven in ten of them are; with no such layer known, nearly all.
+// Once seen it stays seen until Reset (the session's end).
+//
+// The times come from the caller (steady_clock in the layer, a script in its
+// tests); the caller serializes the calls.
+class UpstreamTurboDetector {
+ public:
+ using Clock = std::chrono::steady_clock;
+ static constexpr std::size_t kWindow = 60;
+ static constexpr std::size_t kNeededWithToolkitAbove = 42;
+ static constexpr std::size_t kNeededOtherwise = 54;
+ static constexpr auto kWaitAfterEnd = std::chrono::milliseconds(4);
+ static constexpr auto kBeginBeforeEnd = std::chrono::milliseconds(1);
+
+ void Reset() { *this = {}; }
+ void Wait(std::thread::id thread, Clock::time_point at) {
+ wait_thread_ = thread;
+ wait_at_ = at;
+ }
+ void Begin(Clock::time_point at) { begin_at_ = at; }
+ void EndReturned(Clock::time_point at) { end_returned_ = at; }
+
+ // At the app's xrEndFrame on `thread`: the frame is judged, and the
+ // answer is whether a layer above pipelines the frames.
+ bool End(std::thread::id thread, Clock::time_point at, bool toolkit_above) {
+ const bool pattern = wait_thread_ != std::thread::id{} && wait_thread_ != thread &&
+ end_returned_ != Clock::time_point{} && wait_at_ >= end_returned_ &&
+ wait_at_ - end_returned_ < kWaitAfterEnd && begin_at_ > wait_at_ && at >= begin_at_ &&
+ at - begin_at_ < kBeginBeforeEnd;
+ if (frames_ == kWindow) {
+ matching_ -= window_[next_] ? 1 : 0;
+ } else {
+ ++frames_;
+ }
+ window_[next_] = pattern;
+ matching_ += pattern ? 1 : 0;
+ next_ = (next_ + 1) % kWindow;
+ if (!seen_ && frames_ == kWindow &&
+ matching_ >= (toolkit_above ? kNeededWithToolkitAbove : kNeededOtherwise)) {
+ seen_ = true;
+ }
+ return seen_;
+ }
+ bool Seen() const { return seen_; }
+ // Of the last frames judged (up to kWindow), how many were in the pattern.
+ std::size_t Matching() const { return matching_; }
+ std::size_t Frames() const { return frames_; }
+
+ private:
+ std::thread::id wait_thread_{};
+ Clock::time_point wait_at_{};
+ Clock::time_point begin_at_{};
+ Clock::time_point end_returned_{};
+ std::array window_{};
+ std::size_t next_{0};
+ std::size_t frames_{0};
+ std::size_t matching_{0};
+ bool seen_{false};
+};
+
+} // namespace depthxr
diff --git a/layer/shaders/bridge_depth.hlsl b/layer/shaders/bridge_depth.hlsl
new file mode 100644
index 00000000..bee6a921
--- /dev/null
+++ b/layer/shaders/bridge_depth.hlsl
@@ -0,0 +1,48 @@
+// The Direct3D 11 bridge's depth (framegen_d3d11_bridge.cpp). Direct3D 12
+// shares no depth texture with simultaneous access, and Direct3D 11 opens a
+// Direct3D 12 texture only as a render target, so a game's depth reaches the
+// runtime's Direct3D 12 depth image in two passes through a shared twin
+// (R16_UNORM for D16, R32_FLOAT otherwise): Direct3D 11 copies the game's
+// depth into the twin at its release
+// (BRIDGE_DEPTH_TO_TWIN), and the bridge's queue writes the twin into the
+// runtime's image as depth (BRIDGE_DEPTH_VS and BRIDGE_DEPTH_PS). The depth
+// view gives every format's depth as a float (D16 and D24 normalized), and
+// writing it as SV_Depth converts it back: D16, D32 and D32S8's depth
+// arrives as it was, and D24's may arrive one 24-bit step off (its
+// normalized float is not always converted back to the same step).
+
+#if defined(BRIDGE_DEPTH_TO_TWIN)
+
+// The game's depth, viewed as its depth plane (R32_FLOAT,
+// R32_FLOAT_X8X24_TYPELESS, R24_UNORM_X8_TYPELESS or R16_UNORM).
+Texture2DArray g_depth : register(t0);
+RWTexture2DArray g_twin : register(u0);
+
+[numthreads(8, 8, 1)] void CSMain(uint3 id : SV_DispatchThreadID) {
+ uint width, height, slices;
+ g_twin.GetDimensions(width, height, slices);
+ if (id.x < width && id.y < height) {
+ g_twin[id] = g_depth.Load(int4(id, 0));
+ }
+}
+
+#elif defined(BRIDGE_DEPTH_VS)
+
+// One triangle covering the viewport.
+float4 VSMain(uint vertex : SV_VertexID) : SV_Position {
+ const float2 uv = float2((vertex << 1) & 2, vertex & 2);
+ return float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
+}
+
+#elif defined(BRIDGE_DEPTH_PS)
+
+Texture2DArray g_twin : register(t0);
+cbuffer Slice : register(b0) {
+ uint g_slice;
+};
+
+float PSMain(float4 position : SV_Position) : SV_Depth {
+ return g_twin.Load(int4(int2(position.xy), g_slice, 0));
+}
+
+#endif
diff --git a/layer/shaders/framegen.hlsl b/layer/shaders/framegen.hlsl
index adf658aa..b0ec1ed0 100644
--- a/layer/shaders/framegen.hlsl
+++ b/layer/shaders/framegen.hlsl
@@ -95,6 +95,18 @@ cbuffer FrameGenConstantBuffer : register(b0) {
};
#endif
+#if defined(FG_PASS_SYNTHESIZE_DRAW) || defined(FG_PASS_COMPOSE_DRAW)
+// Edge fill (Direct3D 12 draws, FrameGenImage::content): xy is where the
+// frame's own pixels start in the render target, which is wider than the
+// frame by a margin on each side. Every pixel of the margin repeats the
+// frame's nearest edge pixel, so a runtime that turns the frame toward the
+// head finds the edge smeared outward there instead of nothing (black). Zero
+// for an output the frame's own size.
+cbuffer FrameGenFillBuffer : register(b1) {
+ uint4 g_fill;
+};
+#endif
+
#define FG_FLAG_SRGB_ENCODE 1u
#define FG_FLAG_EXTRAPOLATE 2u
#define FG_FLAG_TEMPORAL 4u
@@ -2410,7 +2422,9 @@ struct DrawOutput {
};
DrawOutput PSMain(float4 position : SV_Position) {
- const float2 pixel = position.xy;
+ // Edge fill: a margin pixel is the frame's nearest edge pixel (its
+ // centre; a coarse pixel's centre inside the frame is left as it is).
+ const float2 pixel = clamp(position.xy - float2(g_fill.xy), 0.5, float2(g.size.xy) - 0.5);
DrawOutput output;
output.frame0 = Synthesize(pixel, g.tuning.x);
#if FG_DRAW_OUTPUTS > 1
@@ -2539,8 +2553,9 @@ float3 Overlay(float3 composed, float2 uv, bool inside, float alpha) {
}
float4 PSMain(float4 position : SV_Position) : SV_Target {
- // The pixel's centre: the Direct3D 11 compositor's interpolated uv.
- const float2 uv = saturate(position.xy / float2(g.size.xy));
+ // The pixel's centre: the Direct3D 11 compositor's interpolated uv. With
+ // edge fill (g_fill) the margin around the eye reads its nearest edge.
+ const float2 uv = saturate((position.xy - float2(g_fill.xy)) / float2(g.size.xy));
const float4 rect = g.fov_current;
float4 composed = g_peripheral.SampleLevel(g_linear, uv, 0.0);
const bool inside = all(uv >= rect.xy) && all(uv <= rect.zw);
@@ -4346,9 +4361,11 @@ FG_BIND(4) FG_FORMAT("r8ui") RWTexture2D g_rates : register(u0);
// angle) is shaded per 2x2 pixels unless it shows cockpit content: a wide
// view's periphery is rendered far denser than the headset shows it, while
// cockpit edges there are what generated frames must keep sharp. size.xy:
-// tiles, size.zw: the output extent, options.x: the tile's side in pixels,
+// tiles, size.zw: the frame's extent, options.x: the tile's side in pixels,
// options.y: FG_FLAG_DEPTH when the newest frame's depth is bound (without
-// it, the angle alone decides).
+// it, the angle alone decides), options.zw: with edge fill, where the frame
+// starts in the output image (the tiles cover the whole image; a tile of
+// the margin is judged as the frame's nearest edge, which it repeats).
[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID) {
if (any(id.xy >= g.size.xy)) {
@@ -4356,7 +4373,8 @@ void CSMain(uint3 id : SV_DispatchThreadID) {
}
const float tile = float(g.options.x);
const float2 extent = float2(g.size.zw);
- const float2 centre = min((float2(id.xy) + 0.5) * tile, extent) / extent;
+ const float2 start = float2(id.xy) * tile - float2(g.options.zw);
+ const float2 centre = clamp(start + 0.5 * tile, 0.0, extent) / extent;
const float2 tangent = float2(lerp(g.fov_current.x, g.fov_current.y, centre.x),
lerp(g.fov_current.z, g.fov_current.w, centre.y));
uint rate = length(tangent) >= g.tuning.x ? FG_RATE_2X2 : FG_RATE_1X1;
@@ -4364,8 +4382,8 @@ void CSMain(uint3 id : SV_DispatchThreadID) {
uint width, height;
g_depth.GetDimensions(width, height);
const float2 scale = float2(width, height) / extent;
- const int2 first = int2(floor(float2(id.xy) * tile * scale));
- const int2 last = min(int2(ceil((float2(id.xy) + 1.0) * tile * scale)), int2(width, height)) - 1;
+ const int2 first = min(int2(floor(max(start, 0.0) * scale)), int2(width, height) - 1);
+ const int2 last = max(min(int2(ceil((start + tile) * scale)), int2(width, height)) - 1, first);
// Four texels a fetch: the 2x2 block from (x, y) (clamped at edges).
const float2 texel = 1.0 / float2(width, height);
[loop]
diff --git a/layer/src/config_parser.cpp b/layer/src/config_parser.cpp
index 8be7440a..aa95a8e7 100644
--- a/layer/src/config_parser.cpp
+++ b/layer/src/config_parser.cpp
@@ -2463,6 +2463,8 @@ bool ParseFrameGenSettings(const JsonValue::Object& object, const char* field, F
"artifactSuppression",
"motionLimitPercent",
"extendHeadPrediction",
+ "edgeFill",
+ "useGameDepth",
};
NoteUnknownKeys(object, allowed);
@@ -2525,6 +2527,20 @@ bool ParseFrameGenSettings(const JsonValue::Object& object, const char* field, F
if (extend_head_prediction) {
out.extend_head_prediction = *extend_head_prediction;
}
+ std::optional edge_fill;
+ if (!ReadOptionalBool(object, "edgeFill", edge_fill, error)) {
+ return false;
+ }
+ if (edge_fill) {
+ out.edge_fill = *edge_fill;
+ }
+ std::optional use_game_depth;
+ if (!ReadOptionalBool(object, "useGameDepth", use_game_depth, error)) {
+ return false;
+ }
+ if (use_game_depth) {
+ out.use_game_depth = *use_game_depth;
+ }
return ReadOptionalBoundedInt(object, "artifactSuppression", field, 0, 100, out.artifact_suppression, error) &&
ReadOptionalBoundedInt(object, "motionLimitPercent", field, 2, 25, out.motion_limit_percent, error);
}
diff --git a/layer/src/framegen/framegen_d3d11_bridge.cpp b/layer/src/framegen/framegen_d3d11_bridge.cpp
index f40e22d9..9b10910a 100644
--- a/layer/src/framegen/framegen_d3d11_bridge.cpp
+++ b/layer/src/framegen/framegen_d3d11_bridge.cpp
@@ -8,6 +8,10 @@
#include "depthxr/framegen_d3d11_bridge.h"
+#include "bridge_depth_ps.h"
+#include "bridge_depth_to_twin.h"
+#include "bridge_depth_vs.h"
+
#include
#include
#include
@@ -16,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
@@ -81,6 +86,50 @@ DXGI_FORMAT DepthStorageFormat(DXGI_FORMAT format) {
}
}
+// The depth plane of private depth, as the bridge's copy into the twin reads
+// it (normalized for D16 and D24).
+DXGI_FORMAT DepthReadFormat(DXGI_FORMAT storage) {
+ switch (storage) {
+ case DXGI_FORMAT_R32_TYPELESS:
+ return DXGI_FORMAT_R32_FLOAT;
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
+ case DXGI_FORMAT_R16_TYPELESS:
+ return DXGI_FORMAT_R16_UNORM;
+ default:
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+// A depth twin's format: D16's depth fits R16_UNORM exactly (half the
+// memory of iRacing's 6904x3184 depth images), every other R32_FLOAT.
+DXGI_FORMAT DepthTwinFormat(DXGI_FORMAT storage) {
+ return storage == DXGI_FORMAT_R16_TYPELESS ? DXGI_FORMAT_R16_UNORM : DXGI_FORMAT_R32_FLOAT;
+}
+
+// The depth-stencil view format of a runtime's depth image, typed or
+// typeless: what the bridge's draw writes it through.
+DXGI_FORMAT DepthTargetFormat(DXGI_FORMAT format) {
+ switch (format) {
+ case DXGI_FORMAT_D32_FLOAT:
+ case DXGI_FORMAT_R32_TYPELESS:
+ return DXGI_FORMAT_D32_FLOAT;
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
+ case DXGI_FORMAT_D16_UNORM:
+ case DXGI_FORMAT_R16_TYPELESS:
+ return DXGI_FORMAT_D16_UNORM;
+ default:
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
// Twins are typeless, as runtimes' Direct3D 11 images usually are: the game
// may view an image as any member of its format's family (an sRGB
// swapchain's images are often rendered through UNORM views).
@@ -196,6 +245,41 @@ std::uint64_t MiB(std::uint64_t bytes) {
return (bytes + (1u << 19)) >> 20;
}
+// Holds the game's immediate context for the bridge's calls on it at a
+// release (a depth copy changes its state and puts it back). Multithread
+// protection serializes each Direct3D 11 call on its own: without the hold,
+// another thread's draw could land between the bridge's calls, under the
+// bridge's state, or have its own state overwritten when the game's goes
+// back. Entered whether protection is on or not (a thread entering it alone
+// does not wait; Direct3D 11 takes the same lock for some calls, Flush among
+// them, even without protection, and its debug layer to read whether
+// protection is on). It serializes the CPU's calls only, nothing waits for
+// the GPU inside it.
+//
+// Lock order: taken before the bridge's mutex, and, at a hand-over
+// (D3D11Bridge::StageReleases), before any lock of the layer's. A game thread
+// may hold the device's lock (ID3D11Multithread::Enter) through an OpenXR
+// call that takes those: waiting for the context while holding one of them
+// would deadlock with it.
+class ContextHold {
+ public:
+ ContextHold(ID3D11Multithread* multithread, const std::function* before_enter) {
+ if (multithread) {
+ if (before_enter && *before_enter) (*before_enter)();
+ multithread_ = multithread;
+ multithread_->Enter();
+ }
+ }
+ ~ContextHold() {
+ if (multithread_) multithread_->Leave();
+ }
+ ContextHold(const ContextHold&) = delete;
+ ContextHold& operator=(const ContextHold&) = delete;
+
+ private:
+ ID3D11Multithread* multithread_{nullptr};
+};
+
// The session's mean and longest handover, "mean/max" in milliseconds.
std::string HandoverText(double total_ms, std::uint64_t count, double max_ms) {
char buffer[48];
@@ -209,9 +293,11 @@ struct D3D11Bridge::Impl {
enum class Mode {
kTwin, // rendered into the twin
kResolve, // multisampled: rendered privately, resolved into the twin at release
- kPrivate, // depth: rendered privately, never reaches the runtime's images
+ kDepth, // depth: rendered privately, copied into a twin at release and drawn into the runtime's
+ kPrivate, // depth the bridge cannot mirror: rendered privately, never reaches the runtime's images
};
- // A recording of the copy of a twin into the runtime's image.
+ // A recording of the copy of a twin into the runtime's image (for depth,
+ // the draw of the twin into it).
struct Copy {
ComPtr allocator;
ComPtr list;
@@ -221,24 +307,45 @@ struct D3D11Bridge::Impl {
ComPtr twin;
ComPtr twin11; // the twin, opened on the game's device
ComPtr private11; // rendered into instead of the twin
+ // Depth: the game's depth as read into the twin, and the twin as written.
+ ComPtr depth_read11;
+ ComPtr twin_write11;
+ D3D12_GPU_DESCRIPTOR_HANDLE twin_read{}; // the twin, read by the draw
+ std::vector depth_targets; // the runtime's image, by slice
// The runtime's image, referenced: a copy still queued when the
// runtime lets the image go writes memory that still exists.
ComPtr runtime;
std::vector copies;
UINT64 done{0}; // the done value after its last copy
};
+ // A release whose Direct3D 11 half ran ahead of its hand-over
+ // (StageReleases): the image, its "written" value and that half's time.
+ struct Staged {
+ std::uint32_t index{0};
+ UINT64 written{0};
+ double ms{0.0};
+ };
struct Swapchain {
Mode mode{Mode::kTwin};
DXGI_FORMAT format{DXGI_FORMAT_UNKNOWN}; // as the application asked
DXGI_FORMAT storage{DXGI_FORMAT_UNKNOWN};
+ DXGI_FORMAT depth_target{DXGI_FORMAT_UNKNOWN}; // depth: the runtime images' depth-stencil view format
+ std::string private_reason; // depth kept private: why
+ std::string protection; // mirrored depth: the device's multithread protection (NoteDepthProtection)
std::uint32_t width{0};
std::uint32_t height{0};
std::uint32_t array_size{1};
std::uint32_t mip_count{1};
std::uint32_t sample_count{1};
bool composed{false};
+ // Depth: the twins' views read by the draws (shader-visible, kept
+ // while the draws are queued) and the runtime images' depth targets.
+ ComPtr twin_reads;
+ ComPtr depth_targets;
std::vector images;
std::deque acquired; // acquired and not released yet, oldest first
+ std::uint32_t pending{0}; // the application's releases whose hand-over waits (ReleaseCalled)
+ std::deque staged; // releases whose Direct3D 11 half ran (StageReleases), oldest first
UINT64 last_done{0};
std::uint64_t twin_bytes{0};
std::uint64_t copies{0};
@@ -249,6 +356,7 @@ struct D3D11Bridge::Impl {
ComPtr device11;
ComPtr context11;
+ ComPtr multithread; // the immediate context's lock (ContextHold)
bool multithread_protected{false};
ComPtr device12;
ComPtr adapter; // for video memory figures
@@ -258,6 +366,16 @@ struct D3D11Bridge::Impl {
ComPtr idle; // the bridge's queue's progress, for retiring
ComPtr written11;
ComPtr done11;
+ // Depth reaches the runtime's images unless VECTORXR_D3D11_BRIDGE_DEPTH=private.
+ bool mirror_depth{true};
+ std::string depth_private_reason; // why mirror_depth is off
+
+ // The depth passes, made with the first depth swapchain mirrored (each
+ // with `pipeline_mutex`; a draw's pipeline only for its target format).
+ std::mutex pipeline_mutex;
+ ComPtr depth_to_twin;
+ ComPtr depth_root;
+ std::unordered_map> depth_pipelines;
// Everything below, and the order of signals on both APIs: each fence's
// values are signalled in the order they are handed out.
@@ -267,6 +385,10 @@ struct D3D11Bridge::Impl {
UINT64 idle_value{0};
DWORD thread{0}; // the first thread a swapchain or frame call came from
bool reported_second_thread{false};
+ DWORD second_thread{0}; // the first other thread NoteThread saw
+ // A second thread was seen and protection is off: ApplyWantedProtection
+ // turns it on (read without `mutex`).
+ std::atomic protection_wanted{false};
bool debug_layer{false}; // VECTORXR_D3D11_BRIDGE_DEBUG=1
std::uint32_t debug_reported{0}; // debug-layer messages reported
std::uint64_t next_skip_report{1}; // skipped copies are reported at 1, 10, 100...
@@ -279,7 +401,15 @@ struct D3D11Bridge::Impl {
std::atomic recordings{0}; // also counted outside the mutex, as swapchains are made
std::uint64_t done_waits{0};
std::uint64_t unmatched_releases{0};
- // The game thread's time in a release's handover (Direct3D 11's flush, a
+ std::uint64_t depth_copies{0}; // releases of depth copied into a twin
+ std::uint64_t depth_target_unbinds{0}; // of them, with the image still the game's depth target
+ // The game thread's time issuing those copies (CopyDepthToTwin, its
+ // Direct3D 11 calls only; the GPU's work is not timed), milliseconds: the
+ // session's total and longest.
+ double depth_copy_ms_total{0.0};
+ double depth_copy_ms_max{0.0};
+ // The game thread's time in a release's handover (a depth image's copy
+ // into its twin or a multisampled image's resolve, Direct3D 11's flush, a
// recording of the copy, the bridge queue's submission), milliseconds:
// the session's total and longest, and how many took kSlowHandoverMs.
double handover_ms_total{0.0};
@@ -287,10 +417,16 @@ struct D3D11Bridge::Impl {
std::uint64_t handovers{0};
std::uint64_t slow_handovers{0};
std::function log;
-
- // Counts a handover that started at `start` (holding `mutex`).
- void NoteHandover(std::chrono::steady_clock::time_point start) {
- const double ms = std::chrono::duration(std::chrono::steady_clock::now() - start).count();
+ std::function depth_copy_hook; // SetDepthCopyHookForTest
+ // SetContextWaitHookForTest: read without `mutex` (set while nothing runs).
+ std::function context_wait_hook;
+ bool depth_protection_reported{false}; // the device has none to turn on: said once
+
+ // Counts a handover that started at `start`, `ahead_ms` of it having run
+ // before (its Direct3D 11 half, StageReleases), holding `mutex`.
+ void NoteHandover(std::chrono::steady_clock::time_point start, double ahead_ms = 0.0) {
+ const double ms =
+ ahead_ms + std::chrono::duration(std::chrono::steady_clock::now() - start).count();
handover_ms_total += ms;
handover_ms_max = std::max(handover_ms_max, ms);
++handovers;
@@ -303,7 +439,11 @@ struct D3D11Bridge::Impl {
// A swapchain or frame call's thread (holding `mutex`): Direct3D 11's
// immediate context is the game's, and is only safe from another thread
// when the device is multithread protected. Calls from more than one
- // thread turn that protection on.
+ // thread want that protection on: ApplyWantedProtection turns it on,
+ // never here. SetMultithreadProtected waits for the device's lock, which
+ // a thread holding the context (ContextHold, or a game thread of its
+ // own) may hold while it waits for `mutex`, or for the layer's locks
+ // these calls are made under.
void NoteThread() {
const DWORD current = GetCurrentThreadId();
if (!thread) {
@@ -314,22 +454,66 @@ struct D3D11Bridge::Impl {
return;
}
reported_second_thread = true;
- ComPtr multithread;
- if (SUCCEEDED(context11.As(&multithread))) {
+ second_thread = current;
+ protection_wanted = true;
+ }
+
+ // Turns protection on once NoteThread wanted it, holding neither `mutex`
+ // nor any lock of the layer's (or holding the context already, which
+ // makes the device's lock this thread's): at the start of a hand-over
+ // (StageReleases, called before any of the layer's locks), before the
+ // bridge's Direct3D 11 calls there. Until then a second thread's calls
+ // are not serialized, as the calls before it never were.
+ void ApplyWantedProtection() {
+ if (!protection_wanted.exchange(false)) {
+ return;
+ }
+ bool on = false;
+ if (multithread) {
multithread->SetMultithreadProtected(TRUE);
- multithread_protected = multithread->GetMultithreadProtected() != FALSE;
+ on = multithread->GetMultithreadProtected() != FALSE;
}
+ std::scoped_lock lock(mutex);
+ multithread_protected = multithread_protected || on;
if (log) {
log("Direct3D 11 bridge: the game's swapchain and frame calls come from more than one thread (" +
- std::to_string(current) + ", first " + std::to_string(thread) + "); " +
- (multithread_protected
- ? "turned the game device's multithread protection on, so each of the bridge's Direct3D 11 "
- "calls is serialized with the game's (calls made before this one were not)."
- : "its device has no multithread protection to turn on: the bridge's Direct3D 11 calls there "
- "may race the game's rendering."));
+ std::to_string(second_thread) + ", first " + std::to_string(thread) + "); " +
+ (on ? "turned the game device's multithread protection on, so each of the bridge's Direct3D 11 "
+ "calls is serialized with the game's (calls made before this one were not)."
+ : "its device has no multithread protection to turn on: the bridge's Direct3D 11 calls there "
+ "may race the game's rendering."));
}
}
+ // Holds the game's immediate context (ContextHold): before `mutex`.
+ ContextHold HoldContext() {
+ return ContextHold(multithread.Get(), &context_wait_hook);
+ }
+
+ // When a depth swapchain is mirrored, before its first copy (holding
+ // `mutex`, AddSwapchain having turned protection on, and read it as
+ // `now_protected`, before: Direct3D 11's debug layer reads it under the
+ // device's lock, which a thread holding the context may hold while it
+ // waits for `mutex`): the copy
+ // changes the immediate context's state and puts it back over many
+ // calls, which only multithread protection keeps the game's other
+ // threads out of (ContextHold), and a game rendering on a thread that
+ // never calls OpenXR would otherwise never get it (NoteThread sees
+ // OpenXR's threads only). Turned on once, never off; a game's own is
+ // left as it is. What the chain's description says of it.
+ std::string NoteDepthProtection(bool was_protected, bool now_protected) {
+ multithread_protected = now_protected;
+ if (multithread_protected) {
+ return was_protected ? "on" : "turned on";
+ }
+ if (log && !depth_protection_reported) {
+ depth_protection_reported = true;
+ log("Direct3D 11 bridge: the game's device has no multithread protection to turn on: its depth copies "
+ "may race a thread of the game's rendering at the same time.");
+ }
+ return "unavailable";
+ }
+
// The Direct3D 12 debug layer's errors since the last call (holding `mutex`).
void ReportDebugMessages() {
ComPtr queue12;
@@ -361,6 +545,7 @@ struct D3D11Bridge::Impl {
// For the process: work still queued may use them.
static void DetachGpu(Swapchain& chain) {
+ chain.twin_reads.Detach();
for (Image& image : chain.images) {
image.twin.Detach();
image.runtime.Detach();
@@ -370,32 +555,55 @@ struct D3D11Bridge::Impl {
}
}
}
+ // ...and the depth draws' pipelines.
+ void DetachPipelines() {
+ depth_root.Detach();
+ for (auto& [format, pipeline] : depth_pipelines) {
+ pipeline.Detach();
+ }
+ }
std::string VideoMemory() const {
DXGI_QUERY_VIDEO_MEMORY_INFO memory{};
if (!adapter || FAILED(adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &memory))) {
return "unavailable";
}
- return std::to_string(MiB(memory.CurrentUsage)) + "/" + std::to_string(MiB(memory.Budget)) + " MiB";
+ std::string text = std::to_string(MiB(memory.CurrentUsage)) + "/" + std::to_string(MiB(memory.Budget)) + " MiB";
+ // The process's system memory on the adapter: it grows when Windows
+ // moves video memory out over the budget (the GPU then waits on it).
+ DXGI_QUERY_VIDEO_MEMORY_INFO shared{};
+ if (SUCCEEDED(adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &shared))) {
+ text += ", sharedMemory=" + std::to_string(MiB(shared.CurrentUsage)) + " MiB";
+ }
+ return text;
}
std::string Describe(const Swapchain& chain) const {
std::ostringstream stream;
stream << "mode="
- << (chain.mode == Mode::kTwin ? "twin" : chain.mode == Mode::kResolve ? "resolve" : "private-depth")
- << ", images=" << chain.images.size() << ", format=" << static_cast(chain.format)
+ << (chain.mode == Mode::kTwin ? "twin"
+ : chain.mode == Mode::kResolve ? "resolve"
+ : chain.mode == Mode::kDepth ? "depth"
+ : "private-depth");
+ if (!chain.private_reason.empty()) {
+ stream << " (" << chain.private_reason << ")";
+ }
+ stream << ", images=" << chain.images.size() << ", format=" << static_cast(chain.format)
<< ", storage=" << static_cast(chain.storage) << ", size=" << chain.width << "x" << chain.height
<< ", array=" << chain.array_size << ", mips=" << chain.mip_count << ", samples=" << chain.sample_count
<< ", twinMiB=" << MiB(chain.twin_bytes) << ", composed=" << (chain.composed ? 1 : 0)
<< ", copies=" << chain.copies << ", doneWaits=" << chain.done_waits
<< ", skippedCopies=" << chain.skipped_copies << ", unmatchedReleases=" << chain.unmatched_releases;
+ if (!chain.protection.empty()) {
+ stream << ", multithreadProtection=" << chain.protection;
+ }
return stream.str();
}
// Records the twin's copy into the runtime's image. The runtime's colour
// images are render targets whenever the game holds them; the twin, with
// simultaneous access, needs no transition of its own.
- bool RecordCopy(Image& image, Copy& copy, std::string& reason) {
+ bool RecordCopy(const Swapchain& chain, Image& image, Copy& copy, std::string& reason) {
HRESULT hr = device12->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(©.allocator));
if (SUCCEEDED(hr)) {
hr = device12->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, copy.allocator.Get(), nullptr,
@@ -405,6 +613,9 @@ struct D3D11Bridge::Impl {
reason = Failure("Creating the bridge's copy commands", hr);
return false;
}
+ if (chain.mode == Mode::kDepth) {
+ return RecordDepthDraw(chain, image, copy, reason);
+ }
D3D12_RESOURCE_BARRIER barrier{};
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
barrier.Transition.pResource = image.runtime.Get();
@@ -427,7 +638,7 @@ struct D3D11Bridge::Impl {
// A recording of the image's copy whose last execution is done (holding
// `mutex`): one more is made while fewer than kCopyRecordings exist, and
// otherwise the oldest is waited for, a while. nullptr: none in time.
- Copy* ReadyCopy(Image& image) {
+ Copy* ReadyCopy(const Swapchain& chain, Image& image) {
const UINT64 completed = done->GetCompletedValue();
for (Copy& copy : image.copies) {
if (copy.done <= completed) {
@@ -437,7 +648,7 @@ struct D3D11Bridge::Impl {
if (image.copies.size() < kCopyRecordings) {
std::string reason;
image.copies.emplace_back();
- if (RecordCopy(image, image.copies.back(), reason)) {
+ if (RecordCopy(chain, image, image.copies.back(), reason)) {
return &image.copies.back();
}
image.copies.pop_back();
@@ -515,7 +726,461 @@ struct D3D11Bridge::Impl {
return false;
}
image.copies.emplace_back();
- return RecordCopy(image, image.copies.back(), reason);
+ return RecordCopy(chain, image, image.copies.back(), reason);
+ }
+
+ // Records the draw of a depth twin into the runtime's depth image, slice
+ // by slice (mip 0). The runtime's depth images are depth targets whenever
+ // the game holds them (XR_KHR_D3D12_enable), so the draw needs no
+ // transition; the twin, with simultaneous access, neither.
+ bool RecordDepthDraw(const Swapchain& chain, Image& image, Copy& copy, std::string& reason) {
+ ID3D12PipelineState* pipeline = nullptr;
+ {
+ std::scoped_lock lock(pipeline_mutex);
+ const auto it = depth_pipelines.find(chain.depth_target);
+ pipeline = it == depth_pipelines.end() ? nullptr : it->second.Get();
+ }
+ if (!pipeline || !depth_root) {
+ reason = "the bridge's depth draw has no pipeline";
+ return false;
+ }
+ ID3D12DescriptorHeap* heaps[] = {chain.twin_reads.Get()};
+ copy.list->SetDescriptorHeaps(1, heaps);
+ copy.list->SetGraphicsRootSignature(depth_root.Get());
+ copy.list->SetPipelineState(pipeline);
+ copy.list->SetGraphicsRootDescriptorTable(1, image.twin_read);
+ const D3D12_VIEWPORT viewport{0.0f, 0.0f, static_cast(chain.width), static_cast(chain.height),
+ 0.0f, 1.0f};
+ const D3D12_RECT scissor{0, 0, static_cast(chain.width), static_cast(chain.height)};
+ copy.list->RSSetViewports(1, &viewport);
+ copy.list->RSSetScissorRects(1, &scissor);
+ copy.list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ for (std::uint32_t slice = 0; slice < chain.array_size; ++slice) {
+ copy.list->SetGraphicsRoot32BitConstant(0, slice, 0);
+ copy.list->OMSetRenderTargets(0, nullptr, FALSE, &image.depth_targets[slice]);
+ copy.list->DrawInstanced(3, 1, 0, 0);
+ }
+ const HRESULT hr = copy.list->Close();
+ if (FAILED(hr)) {
+ reason = Failure("Recording the bridge's depth draw", hr);
+ return false;
+ }
+ ++recordings;
+ return true;
+ }
+
+ // The depth passes: the Direct3D 11 copy into twins (once), the draw's
+ // root signature (once) and its pipeline for `target`.
+ bool MakeDepthPasses(DXGI_FORMAT target, std::string& reason) {
+ std::scoped_lock lock(pipeline_mutex);
+ if (!depth_to_twin) {
+ const HRESULT hr = device11->CreateComputeShader(kBridgeDepthToTwinDxbc, sizeof(kBridgeDepthToTwinDxbc),
+ nullptr, &depth_to_twin);
+ if (FAILED(hr)) {
+ reason = Failure("Creating the Direct3D 11 depth copy (the game's device needs feature level 11)", hr);
+ return false;
+ }
+ }
+ if (!depth_root) {
+ D3D12_DESCRIPTOR_RANGE range{};
+ range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+ range.NumDescriptors = 1;
+ D3D12_ROOT_PARAMETER parameters[2]{};
+ parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
+ parameters[0].Constants.Num32BitValues = 1;
+ parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
+ parameters[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+ parameters[1].DescriptorTable.NumDescriptorRanges = 1;
+ parameters[1].DescriptorTable.pDescriptorRanges = ⦥
+ parameters[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
+ D3D12_ROOT_SIGNATURE_DESC desc{};
+ desc.NumParameters = 2;
+ desc.pParameters = parameters;
+ desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS |
+ D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS |
+ D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS;
+ ComPtr blob;
+ ComPtr error;
+ HRESULT hr = D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &error);
+ if (SUCCEEDED(hr)) {
+ hr = device12->CreateRootSignature(0, blob->GetBufferPointer(), blob->GetBufferSize(),
+ IID_PPV_ARGS(&depth_root));
+ }
+ if (FAILED(hr)) {
+ reason = Failure("Creating the bridge's depth root signature", hr);
+ return false;
+ }
+ }
+ if (depth_pipelines.count(target)) {
+ return true;
+ }
+ D3D12_GRAPHICS_PIPELINE_STATE_DESC desc{};
+ desc.pRootSignature = depth_root.Get();
+ desc.VS = {kBridgeDepthVsDxbc, sizeof(kBridgeDepthVsDxbc)};
+ desc.PS = {kBridgeDepthPsDxbc, sizeof(kBridgeDepthPsDxbc)};
+ desc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL;
+ desc.SampleMask = UINT_MAX;
+ desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
+ desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
+ desc.RasterizerState.DepthClipEnable = TRUE;
+ // Every texel written, whatever the image held.
+ desc.DepthStencilState.DepthEnable = TRUE;
+ desc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
+ desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_ALWAYS;
+ desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
+ desc.NumRenderTargets = 0;
+ desc.DSVFormat = target;
+ desc.SampleDesc.Count = 1;
+ ComPtr pipeline;
+ const HRESULT hr = device12->CreateGraphicsPipelineState(&desc, IID_PPV_ARGS(&pipeline));
+ if (FAILED(hr)) {
+ reason = Failure("Creating the bridge's depth draw", hr) + " for format " +
+ std::to_string(static_cast(target));
+ return false;
+ }
+ pipeline->SetName(L"VectorXR Direct3D 11 bridge depth");
+ depth_pipelines[target] = pipeline;
+ return true;
+ }
+
+ // Whether the runtime's images can take the game's depth, and how: depth
+ // targets of the depth format's family, one sample, the chain's size.
+ bool CheckRuntimeDepth(Swapchain& chain, std::string& reason) {
+ for (const Image& image : chain.images) {
+ if (!image.runtime) {
+ reason = "the runtime's image is null";
+ return false;
+ }
+ const D3D12_RESOURCE_DESC runtime = image.runtime->GetDesc();
+ const DXGI_FORMAT target = DepthTargetFormat(runtime.Format);
+ if (runtime.Width != chain.width || runtime.Height != chain.height ||
+ runtime.DepthOrArraySize != chain.array_size || runtime.SampleDesc.Count != 1 ||
+ target == DXGI_FORMAT_UNKNOWN || DepthStorageFormat(target) != chain.storage) {
+ std::ostringstream stream;
+ stream << "the runtime's depth image (" << runtime.Width << "x" << runtime.Height << ", array "
+ << runtime.DepthOrArraySize << ", samples " << runtime.SampleDesc.Count << ", format "
+ << static_cast(runtime.Format) << ") does not match the game's (" << chain.width << "x"
+ << chain.height << ", array " << chain.array_size << ", format "
+ << static_cast(chain.format) << ")";
+ reason = stream.str();
+ return false;
+ }
+ if ((runtime.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) == 0) {
+ reason = "the runtime's depth image is not a depth target";
+ return false;
+ }
+ chain.depth_target = target;
+ }
+ return true;
+ }
+
+ // A depth image's twin (DepthTwinFormat, shared, opened on the game's
+ // device), the views each pass uses and the first recording of its draw.
+ // The chain's descriptor heaps hold `index`'s views.
+ bool MakeDepthTwin(Swapchain& chain, Image& image, std::uint32_t index, std::string& reason) {
+ const DXGI_FORMAT twin_format = DepthTwinFormat(chain.storage);
+ D3D12_HEAP_PROPERTIES heap{};
+ heap.Type = D3D12_HEAP_TYPE_DEFAULT;
+ D3D12_RESOURCE_DESC desc{};
+ desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ desc.Width = chain.width;
+ desc.Height = chain.height;
+ desc.DepthOrArraySize = static_cast(chain.array_size);
+ desc.MipLevels = 1;
+ desc.Format = twin_format;
+ desc.SampleDesc.Count = 1;
+ desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ // Direct3D 11 opens it only as a render target, and writes it as an
+ // unordered-access view, which needs simultaneous access.
+ desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS |
+ D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
+ HRESULT hr = device12->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_SHARED, &desc,
+ D3D12_RESOURCE_STATE_COMMON, nullptr,
+ IID_PPV_ARGS(&image.twin));
+ if (FAILED(hr)) {
+ reason = Failure("Creating a shared Direct3D 12 depth twin", hr);
+ return false;
+ }
+ image.twin->SetName(L"VectorXR Direct3D 11 bridge depth twin");
+ chain.twin_bytes += device12->GetResourceAllocationInfo(0, 1, &desc).SizeInBytes;
+ HANDLE handle = nullptr;
+ hr = device12->CreateSharedHandle(image.twin.Get(), nullptr, GENERIC_ALL, nullptr, &handle);
+ if (FAILED(hr)) {
+ reason = Failure("Sharing a Direct3D 12 depth twin", hr);
+ return false;
+ }
+ hr = device11->OpenSharedResource1(handle, IID_PPV_ARGS(&image.twin11));
+ CloseHandle(handle);
+ if (FAILED(hr)) {
+ reason = Failure("Opening a shared depth twin on the game's Direct3D 11 device", hr);
+ return false;
+ }
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC read{};
+ read.Format = DepthReadFormat(chain.storage);
+ read.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ read.Texture2DArray.MipLevels = 1;
+ read.Texture2DArray.ArraySize = chain.array_size;
+ hr = device11->CreateShaderResourceView(image.private11.Get(), &read, &image.depth_read11);
+ if (SUCCEEDED(hr)) {
+ D3D11_UNORDERED_ACCESS_VIEW_DESC write{};
+ write.Format = twin_format;
+ write.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
+ write.Texture2DArray.ArraySize = chain.array_size;
+ hr = device11->CreateUnorderedAccessView(image.twin11.Get(), &write, &image.twin_write11);
+ }
+ if (FAILED(hr)) {
+ reason = Failure("Making the Direct3D 11 views of the depth copy", hr);
+ return false;
+ }
+
+ const UINT read_size = device12->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
+ D3D12_SHADER_RESOURCE_VIEW_DESC twin_read{};
+ twin_read.Format = twin_format;
+ twin_read.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
+ twin_read.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ twin_read.Texture2DArray.MipLevels = 1;
+ twin_read.Texture2DArray.ArraySize = chain.array_size;
+ D3D12_CPU_DESCRIPTOR_HANDLE read_cpu = chain.twin_reads->GetCPUDescriptorHandleForHeapStart();
+ read_cpu.ptr += static_cast(index) * read_size;
+ device12->CreateShaderResourceView(image.twin.Get(), &twin_read, read_cpu);
+ image.twin_read = chain.twin_reads->GetGPUDescriptorHandleForHeapStart();
+ image.twin_read.ptr += static_cast(index) * read_size;
+
+ const UINT target_size = device12->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
+ for (std::uint32_t slice = 0; slice < chain.array_size; ++slice) {
+ D3D12_DEPTH_STENCIL_VIEW_DESC target{};
+ target.Format = chain.depth_target;
+ target.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
+ target.Texture2DArray.FirstArraySlice = slice;
+ target.Texture2DArray.ArraySize = 1;
+ D3D12_CPU_DESCRIPTOR_HANDLE handle12 = chain.depth_targets->GetCPUDescriptorHandleForHeapStart();
+ handle12.ptr += static_cast(index * chain.array_size + slice) * target_size;
+ device12->CreateDepthStencilView(image.runtime.Get(), &target, handle12);
+ image.depth_targets.push_back(handle12);
+ }
+ image.copies.emplace_back();
+ return RecordCopy(chain, image, image.copies.back(), reason);
+ }
+
+ // The twins and views of a depth chain whose images are made privately:
+ // false (with `reason`) when the runtime's images or the devices cannot
+ // take them, the chain then stays private.
+ bool MirrorDepth(Swapchain& chain, std::string& reason) {
+ if (!CheckRuntimeDepth(chain, reason) || !MakeDepthPasses(chain.depth_target, reason)) {
+ return false;
+ }
+ const auto images = static_cast(chain.images.size());
+ D3D12_DESCRIPTOR_HEAP_DESC reads{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, images,
+ D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0};
+ D3D12_DESCRIPTOR_HEAP_DESC targets{D3D12_DESCRIPTOR_HEAP_TYPE_DSV, images * chain.array_size,
+ D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0};
+ HRESULT hr = device12->CreateDescriptorHeap(&reads, IID_PPV_ARGS(&chain.twin_reads));
+ if (SUCCEEDED(hr)) {
+ hr = device12->CreateDescriptorHeap(&targets, IID_PPV_ARGS(&chain.depth_targets));
+ }
+ if (FAILED(hr)) {
+ reason = Failure("Making the bridge's depth descriptors", hr);
+ return false;
+ }
+ for (std::uint32_t i = 0; i < images; ++i) {
+ if (!MakeDepthTwin(chain, chain.images[i], i, reason)) {
+ reason = "image " + std::to_string(i) + ": " + reason;
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // Lets a depth chain's twins go, nothing having used them (MirrorDepth failed).
+ static void KeepDepthPrivate(Swapchain& chain, const std::string& reason) {
+ for (Image& image : chain.images) {
+ image.twin.Reset();
+ image.twin11.Reset();
+ image.depth_read11.Reset();
+ image.twin_write11.Reset();
+ image.depth_targets.clear();
+ image.copies.clear();
+ }
+ chain.twin_reads.Reset();
+ chain.depth_targets.Reset();
+ chain.twin_bytes = 0;
+ chain.mode = Mode::kPrivate;
+ chain.private_reason = reason;
+ }
+
+ // Copies the game's depth into the image's twin on the game's immediate
+ // context (holding the context, ContextHold, then `mutex`), leaving the
+ // context's state as it was. A game still holding the image as its depth
+ // target gets the target back after the copy: Direct3D 11 reads no
+ // texture bound for writing (it would unbind the copy's read instead).
+ // The caller's hold makes the whole sequence one: no other thread's call
+ // lands inside it.
+ void CopyDepthToTwin(const Swapchain& chain, Image& image) {
+ const auto start = std::chrono::steady_clock::now();
+ CopyDepthToTwinHeld(chain, image, context11.Get());
+ const double ms = std::chrono::duration(std::chrono::steady_clock::now() - start).count();
+ depth_copy_ms_total += ms;
+ depth_copy_ms_max = std::max(depth_copy_ms_max, ms);
+ ++depth_copies;
+ }
+
+ // CopyDepthToTwin's calls, holding the context.
+ void CopyDepthToTwinHeld(const Swapchain& chain, Image& image, ID3D11DeviceContext4* context) {
+ // The output merger: only its depth target changes, and only while it
+ // is the image. Its render targets are set again up to the last one
+ // bound, with its unordered-access views kept: a view in a slot the
+ // targets set would be unbound (the keep flag keeps only the slots
+ // past them), and Direct3D 11 keeps none in a slot below a bound
+ // target, so every one stays where it was, its hidden counter with it
+ // (which a view set again could not be given back). OMSetRenderTargets
+ // would unbind them all.
+ ID3D11RenderTargetView* targets[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]{};
+ ID3D11DepthStencilView* depth_target_raw = nullptr;
+ context->OMGetRenderTargets(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, targets, &depth_target_raw);
+ ComPtr held_targets[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
+ UINT target_count = 0;
+ for (UINT i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) {
+ held_targets[i].Attach(targets[i]);
+ if (targets[i]) target_count = i + 1;
+ }
+ ComPtr depth_target;
+ depth_target.Attach(depth_target_raw);
+ bool unbound = false;
+ if (depth_target) {
+ ComPtr bound;
+ depth_target->GetResource(&bound);
+ if (bound.Get() == image.private11.Get()) {
+ context->OMSetRenderTargetsAndUnorderedAccessViews(target_count, target_count ? targets : nullptr,
+ nullptr, 0, D3D11_KEEP_UNORDERED_ACCESS_VIEWS,
+ nullptr, nullptr);
+ unbound = true;
+ ++depth_target_unbinds;
+ }
+ }
+
+ ID3D11ComputeShader* shader_raw = nullptr;
+ ID3D11ClassInstance* instances[256]{};
+ UINT instance_count = 256;
+ context->CSGetShader(&shader_raw, instances, &instance_count);
+ ComPtr shader;
+ shader.Attach(shader_raw);
+ ComPtr held_instances[256];
+ for (UINT i = 0; i < 256; ++i) {
+ held_instances[i].Attach(instances[i]);
+ }
+ ComPtr read;
+ context->CSGetShaderResources(0, 1, &read);
+ ComPtr write;
+ context->CSGetUnorderedAccessViews(0, 1, &write);
+
+ ID3D11ShaderResourceView* depth_read = image.depth_read11.Get();
+ ID3D11UnorderedAccessView* twin_write = image.twin_write11.Get();
+ context->CSSetShader(depth_to_twin.Get(), nullptr, 0);
+ context->CSSetShaderResources(0, 1, &depth_read);
+ context->CSSetUnorderedAccessViews(0, 1, &twin_write, nullptr);
+ if (depth_copy_hook) {
+ depth_copy_hook();
+ }
+ context->Dispatch((chain.width + 7) / 8, (chain.height + 7) / 8, chain.array_size);
+
+ // Unbound before the game's views go back, whichever slot they held.
+ ID3D11UnorderedAccessView* no_write = nullptr;
+ ID3D11ShaderResourceView* no_read = nullptr;
+ context->CSSetUnorderedAccessViews(0, 1, &no_write, nullptr);
+ context->CSSetShaderResources(0, 1, &no_read);
+ // -1: the game's view keeps its hidden counter.
+ const UINT keep_counter = static_cast(-1);
+ context->CSSetUnorderedAccessViews(0, 1, write.GetAddressOf(), &keep_counter);
+ context->CSSetShaderResources(0, 1, read.GetAddressOf());
+ context->CSSetShader(shader.Get(), instance_count ? instances : nullptr, instance_count);
+ if (unbound) {
+ context->OMSetRenderTargetsAndUnorderedAccessViews(target_count, target_count ? targets : nullptr,
+ depth_target.Get(), 0, D3D11_KEEP_UNORDERED_ACCESS_VIEWS,
+ nullptr, nullptr);
+ }
+ }
+
+ // Whether the release of `chain`'s oldest acquired image needs the
+ // game's immediate context (holding `mutex`): it is copied, and its
+ // Direct3D 11 half has not run yet.
+ static bool NeedsContext(const Swapchain& chain) {
+ return chain.staged.empty() && !chain.acquired.empty() && chain.mode != Mode::kPrivate &&
+ chain.acquired.front() < chain.images.size();
+ }
+
+ // The Direct3D 11 half of the release of `chain`'s oldest acquired image
+ // (holding the context, then `mutex`; NeedsContext): a depth image's copy
+ // into its twin, a multisampled image's resolve, and the "written"
+ // signal the bridge's queue waits for, flushed.
+ Staged Stage(Swapchain& chain) {
+ const auto start = std::chrono::steady_clock::now();
+ Staged staged;
+ staged.index = chain.acquired.front();
+ chain.acquired.pop_front();
+ NoteThread();
+ Image& image = chain.images[staged.index];
+ if (chain.mode == Mode::kDepth) {
+ // The twin is written again only after the bridge's queue is done
+ // drawing its last release (a wait on the GPU, ending as the
+ // colour's at acquire does); then the game's depth goes into it.
+ const UINT64 value = image.done;
+ if (value && done->GetCompletedValue() < value) {
+ context11->Wait(done11.Get(), value);
+ ++chain.done_waits;
+ ++done_waits;
+ }
+ CopyDepthToTwin(chain, image);
+ }
+ if (chain.mode == Mode::kResolve) {
+ const DXGI_FORMAT format = ResolveFormat(chain.format);
+ for (UINT slice = 0; slice < chain.array_size; ++slice) {
+ const UINT subresource = D3D11CalcSubresource(0, slice, 1);
+ context11->ResolveSubresource(image.twin11.Get(), subresource, image.private11.Get(), subresource,
+ format);
+ }
+ }
+ staged.written = ++written_value;
+ context11->Signal(written11.Get(), staged.written);
+ context11->Flush();
+ staged.ms = std::chrono::duration(std::chrono::steady_clock::now() - start).count();
+ return staged;
+ }
+
+ // The Direct3D 12 half (holding `mutex`; nothing of the game's context):
+ // the bridge's queue copies the twin into the runtime's image once
+ // Direct3D 11's "written" is signalled, ahead of anything else queued on
+ // it for the release (Frame Generation's capture). False when the copy
+ // was skipped (the bridge's queue is stalled).
+ bool Submit(Swapchain& chain, const Staged& staged) {
+ const auto start = std::chrono::steady_clock::now();
+ Image& image = chain.images[staged.index];
+ Copy* copy = ReadyCopy(chain, image);
+ if (!copy) {
+ NoteHandover(start, staged.ms);
+ // Every recording of the copy is still queued: the bridge's queue is
+ // stalled. The runtime's image keeps what it had.
+ ++chain.skipped_copies;
+ ++skipped_copies;
+ if (skipped_copies == next_skip_report && log) {
+ next_skip_report *= 10;
+ log("Direct3D 11 bridge: its queue is stalled; releases not copied into the runtime's images so "
+ "far: " + std::to_string(skipped_copies) + ".");
+ }
+ return false;
+ }
+ queue->Wait(written.Get(), staged.written);
+ ID3D12CommandList* lists[] = {copy->list.Get()};
+ queue->ExecuteCommandLists(1, lists);
+ const UINT64 done_at = ++done_value;
+ queue->Signal(done.Get(), done_at);
+ copy->done = done_at;
+ image.done = done_at;
+ chain.last_done = done_at;
+ ++chain.copies;
+ ++copies;
+ NoteHandover(start, staged.ms);
+ return true;
}
bool MakePrivate(const Swapchain& chain, Image& image, const XrSwapchainCreateInfo& info, std::string& reason) {
@@ -527,17 +1192,19 @@ struct D3D11Bridge::Impl {
desc.Format = chain.storage;
desc.SampleDesc.Count = chain.sample_count;
desc.Usage = D3D11_USAGE_DEFAULT;
- if (chain.mode == Mode::kPrivate) {
+ const bool depth = chain.mode == Mode::kDepth || chain.mode == Mode::kPrivate;
+ if (depth) {
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
- if (info.usageFlags & XR_SWAPCHAIN_USAGE_SAMPLED_BIT) desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ // Mirrored depth is read by the copy into its twin.
+ if ((info.usageFlags & XR_SWAPCHAIN_USAGE_SAMPLED_BIT) || chain.mode == Mode::kDepth) {
+ desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
} else {
desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
}
const HRESULT hr = device11->CreateTexture2D(&desc, nullptr, &image.private11);
if (FAILED(hr)) {
- reason = Failure(chain.mode == Mode::kPrivate ? "Creating a private depth texture"
- : "Creating a private multisampled texture",
- hr);
+ reason = Failure(depth ? "Creating a private depth texture" : "Creating a private multisampled texture", hr);
return false;
}
return true;
@@ -560,9 +1227,12 @@ D3D11Bridge::~D3D11Bridge() {
if (impl_) {
const auto detach = [](Impl::Swapchain& chain) {
Impl::DetachGpu(chain);
+ chain.depth_targets.Detach();
for (Impl::Image& image : chain.images) {
image.twin11.Detach();
image.private11.Detach();
+ image.depth_read11.Detach();
+ image.twin_write11.Detach();
}
};
for (auto& [swapchain, chain] : impl_->swapchains) {
@@ -571,6 +1241,8 @@ D3D11Bridge::~D3D11Bridge() {
for (Impl::Swapchain& chain : impl_->retired) {
detach(chain);
}
+ impl_->DetachPipelines();
+ impl_->depth_to_twin.Detach();
impl_->queue.Detach();
impl_->written.Detach();
impl_->done.Detach();
@@ -579,6 +1251,7 @@ D3D11Bridge::~D3D11Bridge() {
impl_->done11.Detach();
impl_->adapter.Detach();
impl_->device12.Detach();
+ impl_->multithread.Detach();
impl_->context11.Detach();
impl_->device11.Detach();
}
@@ -592,6 +1265,10 @@ void D3D11Bridge::SetLog(std::function log) {
}
}
+void D3D11Bridge::SetKeepDepthPrivate(bool keep) {
+ keep_depth_private_ = keep;
+}
+
const XrSessionCreateInfo* D3D11Bridge::Begin(XrInstance instance, const XrSessionCreateInfo* info,
PFN_xrGetInstanceProcAddr get_instance_proc_addr,
std::string& reason, std::string& description) {
@@ -625,9 +1302,8 @@ const XrSessionCreateInfo* D3D11Bridge::Begin(XrInstance instance, const XrSessi
reason = "the game's immediate context has no ID3D11DeviceContext4";
return nullptr;
}
- ComPtr multithread;
- if (SUCCEEDED(immediate.As(&multithread))) {
- impl->multithread_protected = multithread->GetMultithreadProtected() != FALSE;
+ if (SUCCEEDED(immediate.As(&impl->multithread))) {
+ impl->multithread_protected = impl->multithread->GetMultithreadProtected() != FALSE;
}
ComPtr dxgi_device;
@@ -770,6 +1446,16 @@ const XrSessionCreateInfo* D3D11Bridge::Begin(XrInstance instance, const XrSessi
}
}
+ // VECTORXR_D3D11_BRIDGE_DEPTH=private keeps depth the game's own, as
+ // before the bridge mirrored it (left out of submitted frames).
+ if (const char* depth = std::getenv("VECTORXR_D3D11_BRIDGE_DEPTH"); depth && std::string(depth) == "private") {
+ impl->mirror_depth = false;
+ impl->depth_private_reason = "VECTORXR_D3D11_BRIDGE_DEPTH=private";
+ } else if (keep_depth_private_) {
+ impl->mirror_depth = false;
+ impl->depth_private_reason = "Frame Generation's Use game depth is off";
+ }
+
impl->binding.next = game.next;
impl->binding.device = impl->device12.Get();
impl->binding.queue = impl->queue.Get();
@@ -784,6 +1470,7 @@ const XrSessionCreateInfo* D3D11Bridge::Begin(XrInstance instance, const XrSessi
<< ", sharedResourceCompatibilityTier=" << static_cast(options4.SharedResourceCompatibilityTier)
<< ", d3d11SharedResourceTier=" << static_cast(options5.SharedResourceTier)
<< ", multithreadProtected=" << (impl->multithread_protected ? "yes" : "no")
+ << ", depth=" << (impl->mirror_depth ? std::string("mirrored") : "private (" + impl->depth_private_reason + ")")
<< ", videoMemory=" << impl->VideoMemory() << (impl->debug_layer ? ", debugLayer=on" : "");
description = stream.str();
impl_ = std::move(impl);
@@ -853,6 +1540,7 @@ void D3D11Bridge::End() {
for (Impl::Swapchain& chain : impl_->retired) {
Impl::DetachGpu(chain);
}
+ impl_->DetachPipelines();
impl_->queue.Detach();
impl_->written.Detach();
impl_->done.Detach();
@@ -888,6 +1576,11 @@ XrSwapchainCreateInfo D3D11Bridge::RuntimeCreateInfo(const XrSwapchainCreateInfo
if (!IsDepthSwapchain(info)) {
runtime.usageFlags |= XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT | XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT;
runtime.sampleCount = 1;
+ } else {
+ // The bridge's draw writes depth through a depth target: PimaxXR and
+ // Virtual Desktop make an image one (in the depth-write state) only
+ // when asked for depth-stencil use.
+ runtime.usageFlags |= XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
}
return runtime;
}
@@ -907,8 +1600,19 @@ bool D3D11Bridge::AddSwapchain(XrSwapchain swapchain, const XrSwapchainCreateInf
chain.mip_count = std::max(1u, info.mipCount);
chain.sample_count = std::max(1u, info.sampleCount);
const bool depth = IsDepthSwapchain(info);
- chain.mode = depth ? Impl::Mode::kPrivate : chain.sample_count > 1 ? Impl::Mode::kResolve : Impl::Mode::kTwin;
+ chain.mode = depth ? Impl::Mode::kDepth : chain.sample_count > 1 ? Impl::Mode::kResolve : Impl::Mode::kTwin;
chain.storage = depth ? DepthStorageFormat(chain.format) : ColorStorageFormat(chain.format);
+ // Depth the bridge cannot mirror stays the game's own (with why).
+ if (depth && !impl_->mirror_depth) {
+ chain.mode = Impl::Mode::kPrivate;
+ chain.private_reason = impl_->depth_private_reason;
+ } else if (depth && chain.sample_count > 1) {
+ chain.mode = Impl::Mode::kPrivate;
+ chain.private_reason = "multisampled";
+ } else if (depth && !IsDepthFormat(chain.format)) {
+ chain.mode = Impl::Mode::kPrivate;
+ chain.private_reason = "format " + std::to_string(static_cast(chain.format)) + " is not depth";
+ }
std::uint32_t count = 0;
if (!enumerate || XR_FAILED(enumerate(swapchain, 0, &count, nullptr)) || count == 0) {
@@ -927,7 +1631,8 @@ bool D3D11Bridge::AddSwapchain(XrSwapchain swapchain, const XrSwapchainCreateInf
for (std::uint32_t i = 0; i < count; ++i) {
Impl::Image& image = chain.images[i];
image.runtime = runtime_images[i].texture;
- if (chain.mode != Impl::Mode::kPrivate && !impl_->MakeTwin(chain, image, unordered_access, reason)) {
+ const bool twin = chain.mode == Impl::Mode::kTwin || chain.mode == Impl::Mode::kResolve;
+ if (twin && !impl_->MakeTwin(chain, image, unordered_access, reason)) {
reason = "image " + std::to_string(i) + ": " + reason;
return false;
}
@@ -936,7 +1641,28 @@ bool D3D11Bridge::AddSwapchain(XrSwapchain swapchain, const XrSwapchainCreateInf
return false;
}
}
+ if (chain.mode == Impl::Mode::kDepth) {
+ std::string why;
+ if (!impl_->MirrorDepth(chain, why)) {
+ Impl::KeepDepthPrivate(chain, why);
+ }
+ }
+ // Before taking `mutex`: turning protection on may wait for the
+ // context's lock.
+ const bool protect = chain.mode == Impl::Mode::kDepth && impl_->multithread;
+ const bool was_protected = protect && impl_->multithread->GetMultithreadProtected() != FALSE;
+ if (protect && !was_protected) {
+ impl_->multithread->SetMultithreadProtected(TRUE);
+ }
+ const bool now_protected = protect && impl_->multithread->GetMultithreadProtected() != FALSE;
+ if (chain.mode == Impl::Mode::kPrivate && chain.private_reason != impl_->depth_private_reason && impl_->log) {
+ impl_->log("Direct3D 11 bridge: depth swapchain " + Hex(reinterpret_cast(swapchain)) +
+ " stays the game's own (its depth is left out of submitted frames): " + chain.private_reason + ".");
+ }
std::scoped_lock lock(impl_->mutex);
+ if (protect) {
+ chain.protection = impl_->NoteDepthProtection(was_protected, now_protected);
+ }
impl_->swapchains[swapchain] = std::move(chain);
++impl_->swapchains_added;
return true;
@@ -1005,13 +1731,14 @@ void D3D11Bridge::Acquired(XrSwapchain swapchain, std::uint32_t index) {
if (!impl_) {
return;
}
- std::scoped_lock lock(impl_->mutex);
+ std::unique_lock lock(impl_->mutex);
Impl::Swapchain* chain = impl_->Find(swapchain);
if (!chain) {
return;
}
chain->acquired.push_back(index);
- if (chain->mode == Impl::Mode::kPrivate || index >= chain->images.size()) {
+ // Depth is rendered privately: its twin is written only at release.
+ if (chain->mode == Impl::Mode::kPrivate || chain->mode == Impl::Mode::kDepth || index >= chain->images.size()) {
return;
}
// Until the bridge's queue is done reading the image's last release, the
@@ -1022,82 +1749,136 @@ void D3D11Bridge::Acquired(XrSwapchain swapchain, std::uint32_t index) {
return;
}
impl_->NoteThread();
- impl_->context11->Wait(impl_->done11.Get(), value);
++chain->done_waits;
++impl_->done_waits;
+ // Queued without `mutex`: a call on the game's context may wait for its
+ // lock, which a game thread may hold while it waits for `mutex`.
+ lock.unlock();
+ impl_->context11->Wait(impl_->done11.Get(), value);
}
bool D3D11Bridge::Released(XrSwapchain swapchain) {
if (!impl_) {
return true;
}
- std::scoped_lock lock(impl_->mutex);
+ std::unique_lock lock(impl_->mutex);
Impl::Swapchain* chain = impl_->Find(swapchain);
if (!chain) {
return true;
}
+ // A release whose Direct3D 11 half did not run ahead (StageReleases)
+ // runs it here, holding the context first (ContextHold's lock order).
+ std::optional hold;
+ if (Impl::NeedsContext(*chain)) {
+ lock.unlock();
+ hold.emplace(impl_->multithread.Get(), &impl_->context_wait_hook);
+ lock.lock();
+ chain = impl_->Find(swapchain);
+ if (!chain) {
+ return true;
+ }
+ }
++impl_->releases;
+ if (chain->pending > 0) {
+ --chain->pending;
+ }
+ if (!chain->staged.empty()) {
+ // ...and the bridge's queue then copies it into the runtime's image.
+ const Impl::Staged staged = chain->staged.front();
+ chain->staged.pop_front();
+ hold.reset();
+ return impl_->Submit(*chain, staged);
+ }
if (chain->acquired.empty()) {
++chain->unmatched_releases;
++impl_->unmatched_releases;
return true;
}
- const std::uint32_t index = chain->acquired.front();
- chain->acquired.pop_front();
- if (chain->mode == Impl::Mode::kPrivate || index >= chain->images.size()) {
+ if (!Impl::NeedsContext(*chain)) {
+ // Private depth (or an index past the images): nothing to copy.
+ chain->acquired.pop_front();
return true;
}
- impl_->NoteThread();
- Impl::Image& image = chain->images[index];
- if (chain->mode == Impl::Mode::kResolve) {
- const DXGI_FORMAT format = ResolveFormat(chain->format);
- for (UINT slice = 0; slice < chain->array_size; ++slice) {
- const UINT subresource = D3D11CalcSubresource(0, slice, 1);
- impl_->context11->ResolveSubresource(image.twin11.Get(), subresource, image.private11.Get(),
- subresource, format);
- }
- }
- // The game's rendering into the image is handed to the bridge's queue...
- const auto handover = std::chrono::steady_clock::now();
- const UINT64 written = ++impl_->written_value;
- impl_->context11->Signal(impl_->written11.Get(), written);
- impl_->context11->Flush();
- Impl::Copy* copy = impl_->ReadyCopy(image);
- if (!copy) {
- impl_->NoteHandover(handover);
- // Every recording of the copy is still queued: the bridge's queue is
- // stalled. The runtime's image keeps what it had.
- ++chain->skipped_copies;
- ++impl_->skipped_copies;
- if (impl_->skipped_copies == impl_->next_skip_report && impl_->log) {
- impl_->next_skip_report *= 10;
- impl_->log("Direct3D 11 bridge: its queue is stalled; releases not copied into the runtime's images so "
- "far: " + std::to_string(impl_->skipped_copies) + ".");
+ // The game's rendering into the image is handed to the bridge's queue
+ // (depth copied into its twin first, multisampled images resolved)...
+ const Impl::Staged staged = impl_->Stage(*chain);
+ hold.reset();
+ return impl_->Submit(*chain, staged);
+}
+
+void D3D11Bridge::StageReleases(XrSwapchain swapchain) {
+ if (!impl_) {
+ return;
+ }
+ const auto waiting = [&](const Impl::Swapchain& chain) {
+ return chain.pending > chain.staged.size() && chain.acquired.size() > 0;
+ };
+ bool any = false;
+ {
+ std::scoped_lock lock(impl_->mutex);
+ // This call's thread counts (a frame's or swapchain call's, as
+ // FrameEnded and ReleaseCalled note theirs).
+ impl_->NoteThread();
+ if (swapchain != XR_NULL_HANDLE) {
+ const Impl::Swapchain* chain = impl_->Find(swapchain);
+ any = chain && waiting(*chain);
+ } else {
+ any = std::any_of(impl_->swapchains.begin(), impl_->swapchains.end(),
+ [&](const auto& entry) { return waiting(entry.second); });
}
- return false;
}
- // ...which copies it into the runtime's image, ahead of anything else
- // queued on it for the release (Frame Generation's capture).
- impl_->queue->Wait(impl_->written.Get(), written);
- ID3D12CommandList* lists[] = {copy->list.Get()};
- impl_->queue->ExecuteCommandLists(1, lists);
- const UINT64 done = ++impl_->done_value;
- impl_->queue->Signal(impl_->done.Get(), done);
- copy->done = done;
- image.done = done;
- chain->last_done = done;
- ++chain->copies;
- ++impl_->copies;
- impl_->NoteHandover(handover);
- return true;
+ // Before the context and `mutex`: a second thread seen since the last
+ // hand-over (this one included) turns protection on first.
+ impl_->ApplyWantedProtection();
+ if (!any) {
+ return;
+ }
+ // The context first, holding nothing else (ContextHold's lock order)...
+ const ContextHold hold = impl_->HoldContext();
+ std::scoped_lock lock(impl_->mutex);
+ const auto stage = [&](Impl::Swapchain& chain) {
+ // ...each release the application made, oldest first: the image
+ // acquired earliest, as Released hands it over.
+ while (waiting(chain)) {
+ if (chain.mode == Impl::Mode::kPrivate || chain.acquired.front() >= chain.images.size()) {
+ return; // nothing to run ahead: Released hands it over as it is
+ }
+ chain.staged.push_back(impl_->Stage(chain));
+ }
+ };
+ if (swapchain != XR_NULL_HANDLE) {
+ if (Impl::Swapchain* chain = impl_->Find(swapchain)) {
+ stage(*chain);
+ }
+ } else {
+ for (auto& [handle, chain] : impl_->swapchains) {
+ stage(chain);
+ }
+ }
+}
+
+void D3D11Bridge::SetContextWaitHookForTest(std::function hook) {
+ if (impl_) {
+ impl_->context_wait_hook = std::move(hook);
+ }
+}
+
+void D3D11Bridge::SetDepthCopyHookForTest(std::function hook) {
+ if (impl_) {
+ std::scoped_lock lock(impl_->mutex);
+ impl_->depth_copy_hook = std::move(hook);
+ }
}
-void D3D11Bridge::ReleaseCalled() {
+void D3D11Bridge::ReleaseCalled(XrSwapchain swapchain) {
if (!impl_) {
return;
}
std::scoped_lock lock(impl_->mutex);
impl_->NoteThread();
+ if (Impl::Swapchain* chain = impl_->Find(swapchain)) {
+ ++chain->pending;
+ }
}
void D3D11Bridge::Abandoned(XrSwapchain swapchain) {
@@ -1184,6 +1965,9 @@ std::string D3D11Bridge::Summary() const {
<< ", releases=" << impl_->releases << ", copies=" << impl_->copies
<< ", skippedCopies=" << impl_->skipped_copies << ", copyRecordings=" << impl_->recordings.load()
<< ", doneWaits=" << impl_->done_waits << ", unmatchedReleases=" << impl_->unmatched_releases
+ << ", depthCopies=" << impl_->depth_copies << ", depthTargetUnbinds=" << impl_->depth_target_unbinds
+ << ", depthCopyMs="
+ << HandoverText(impl_->depth_copy_ms_total, impl_->depth_copies, impl_->depth_copy_ms_max)
<< ", handoverMs=" << HandoverText(impl_->handover_ms_total, impl_->handovers, impl_->handover_ms_max)
<< ", slowHandovers=" << impl_->slow_handovers
<< ", writtenValue=" << impl_->written_value << ", doneValue=" << impl_->done_value
diff --git a/layer/src/framegen/framegen_d3d12.cpp b/layer/src/framegen/framegen_d3d12.cpp
index 39196bb3..abfefafc 100644
--- a/layer/src/framegen/framegen_d3d12.cpp
+++ b/layer/src/framegen/framegen_d3d12.cpp
@@ -58,6 +58,8 @@ constexpr UINT kDescriptorsPerSynthesis = 256;
// dispatch per capture slot, after every frame's range.
constexpr UINT kShaderResources = 6;
constexpr UINT kFirstUav = kShaderResources;
+// The root parameter holding the draws' edge fill (b1, FrameGenImage::content).
+constexpr UINT kFillParameter = 3;
constexpr UINT kDescriptorsPerDispatch = kShaderResources + 2;
// Engine motion vectors (CaptureMotion): submissions in flight, never waited
// for, each with a block of descriptors per dispatch (the two eyes'
@@ -270,6 +272,10 @@ struct ViewResources {
// frames read again (0: no frame's).
std::uint64_t shading_frame{0};
const Texture* shading_depth{nullptr};
+ // Edge fill: the output image the rates cover and where the frame starts
+ // in it (the frame's own extent and {0, 0} without the fill).
+ FrameGenExtent shading_covered{};
+ XrOffset2Di shading_offset{0, 0};
bool trust_stereo{false}; // this frame's stereo evidence is in trust[newest]
bool depth_ready{false}; // captured since the last Execute
bool depth_fresh{false}; // captured for this Execute's frame (for the check)
@@ -562,7 +568,7 @@ class D3D12FrameGen final : public FrameGenGpu {
D3D12_DESCRIPTOR_RANGE ranges[2]{};
ranges[0] = {D3D12_DESCRIPTOR_RANGE_TYPE_SRV, kShaderResources, 0, 0, 0};
ranges[1] = {D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 2, 0, 0, 0};
- D3D12_ROOT_PARAMETER parameters[3]{};
+ D3D12_ROOT_PARAMETER parameters[4]{};
parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
parameters[0].Constants = {0, 0, sizeof(FrameGenConstants) / 4};
parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
@@ -571,12 +577,16 @@ class D3D12FrameGen final : public FrameGenGpu {
parameters[1 + i].DescriptorTable = {1, &ranges[i]};
parameters[1 + i].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
}
+ // b1: the draws' edge fill (g_fill), set by every draw.
+ parameters[kFillParameter].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
+ parameters[kFillParameter].Constants = {1, 0, 4};
+ parameters[kFillParameter].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
D3D12_STATIC_SAMPLER_DESC sampler{};
sampler.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
sampler.AddressU = sampler.AddressV = sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
sampler.MaxLOD = D3D12_FLOAT32_MAX;
sampler.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
- D3D12_ROOT_SIGNATURE_DESC root{3, parameters, 1, &sampler, D3D12_ROOT_SIGNATURE_FLAG_NONE};
+ D3D12_ROOT_SIGNATURE_DESC root{4, parameters, 1, &sampler, D3D12_ROOT_SIGNATURE_FLAG_NONE};
ComPtr serialized, diagnostics;
if (!check(D3D12SerializeRootSignature(&root, D3D_ROOT_SIGNATURE_VERSION_1, &serialized, &diagnostics),
"D3D12 Frame Generation root signature") ||
@@ -1256,6 +1266,20 @@ class D3D12FrameGen final : public FrameGenGpu {
error = "Frame Generation cannot read depth format " + std::to_string(static_cast(desc.Format));
return false;
}
+ // Texels past the image read as zero, which decodes as near or
+ // infinitely far: a rect the game placed by its colour image's size
+ // in a smaller depth image (UEVR with an upscaler or screen
+ // percentage) is refused instead.
+ const XrRect2Di& rect = depth.rect;
+ if (rect.offset.x < 0 || rect.offset.y < 0 || rect.extent.width <= 0 || rect.extent.height <= 0 ||
+ static_cast(rect.offset.x) + static_cast(rect.extent.width) > desc.Width ||
+ static_cast(rect.offset.y) + static_cast(rect.extent.height) > desc.Height) {
+ error = "Frame Generation's depth rect (" + std::to_string(rect.offset.x) + "," +
+ std::to_string(rect.offset.y) + " " + std::to_string(rect.extent.width) + "x" +
+ std::to_string(rect.extent.height) + ") lies outside its " + std::to_string(desc.Width) + "x" +
+ std::to_string(desc.Height) + " image";
+ return false;
+ }
HRESULT hr = DeviceRemovedReason();
if (FAILED(hr)) {
error = Failure("D3D12 device", hr);
@@ -2538,9 +2562,24 @@ class D3D12FrameGen final : public FrameGenGpu {
return pipeline;
}
+ // Whether `image`'s region holds a frame of `extent` at its content
+ // offset: the frame's own size, or (edge fill) wider by a margin each
+ // side.
+ static bool HoldsFrame(const FrameGenImage& image, FrameGenExtent extent) {
+ return image.content.x >= 0 && image.content.y >= 0 &&
+ static_cast(image.content.x) + extent.width <= image.rect.extent.width &&
+ static_cast(image.content.y) + extent.height <= image.rect.extent.height;
+ }
+
+ // The draws' edge fill constants (b1) for an output image.
+ static std::array FillConstants(const FrameGenImage& image) {
+ return {static_cast(image.content.x), static_cast(image.content.y), 0u, 0u};
+ }
+
// Whether every generated frame of the view can be drawn straight into
// its output image: renderable, single-sampled, a typed format, and the
- // whole image at the view's size; together, or `one_at_a_time`.
+ // whole image at the view's size (edge fill: wider, the frame at the same
+ // place in each); together, or `one_at_a_time`.
bool CanDraw(const FrameGenViewSubmission& submission, const std::vector& outputs,
std::size_t count, bool one_at_a_time) {
if (!direct_output_ || !rtv_heap_ || count == 0 || count > kFrameGenMaxGenerated || outputs.size() < count) {
@@ -2550,13 +2589,17 @@ class D3D12FrameGen final : public FrameGenGpu {
for (std::size_t i = 0; i < count; ++i) {
formats[i] = static_cast(submission.outputs[i].format);
}
+ const FrameGenImage& first_image = submission.outputs[0];
for (std::size_t i = 0; i < count; ++i) {
const FrameGenImage& image = submission.outputs[i];
const D3D12_RESOURCE_DESC desc = outputs[i]->GetDesc();
if (!(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) || desc.SampleDesc.Count != 1 ||
image.array_index >= desc.DepthOrArraySize || image.rect.offset.x != 0 || image.rect.offset.y != 0 ||
- static_cast(image.rect.extent.width) != submission.request.extent.width ||
- static_cast(image.rect.extent.height) != submission.request.extent.height ||
+ !HoldsFrame(image, submission.request.extent) ||
+ image.rect.extent.width != first_image.rect.extent.width ||
+ image.rect.extent.height != first_image.rect.extent.height || image.content.x != first_image.content.x ||
+ image.content.y != first_image.content.y || static_cast(image.rect.extent.width) > desc.Width ||
+ static_cast(image.rect.extent.height) > desc.Height ||
image.format == DXGI_FORMAT_R8G8B8A8_TYPELESS || image.format == DXGI_FORMAT_B8G8R8A8_TYPELESS ||
image.format == DXGI_FORMAT_R16G16B16A16_TYPELESS || image.format == DXGI_FORMAT_UNKNOWN) {
return false;
@@ -2739,6 +2782,19 @@ class D3D12FrameGen final : public FrameGenGpu {
void SetDirectOutput(bool on) override { direct_output_ = on; }
bool DrawsOutputs() const override { return direct_output_ && rtv_heap_; }
+ // The margin is drawn with the frame (FG_PASS_SYNTHESIZE_DRAW, and the
+ // quad views compose draw); a frame copied by compute fills none.
+ bool SupportsEdgeFill() const override { return DrawsOutputs(); }
+ bool EdgesFilled() const override { return edges_filled_; }
+ // Edge fill: no output with a margin written by the copy fallback since
+ // the frame function began (EdgesFilled).
+ bool edges_filled_{true};
+ // Whether image has a margin around a frame of extent.
+ static bool HasMargin(const FrameGenImage& image, FrameGenExtent extent) {
+ return image.content.x != 0 || image.content.y != 0 ||
+ static_cast(image.rect.extent.width) != extent.width ||
+ static_cast(image.rect.extent.height) != extent.height;
+ }
std::uint64_t DrawsForTest() const override { return draws_; }
std::uint64_t ShadingRatesForTest() const override { return shading_rates_; }
@@ -2763,8 +2819,20 @@ class D3D12FrameGen final : public FrameGenGpu {
if (!shading_tile_) {
return false;
}
+ // Edge fill: the tiles cover the whole output image, the frame at its
+ // content offset (every output of a view's draw alike, CanDraw).
+ const FrameGenImage* image = submission.outputs.empty() ? nullptr : &submission.outputs.front();
+ const XrOffset2Di offset = image ? image->content : XrOffset2Di{0, 0};
+ const FrameGenExtent covered =
+ image && (image->content.x || image->content.y ||
+ static_cast(image->rect.extent.width) != submission.request.extent.width ||
+ static_cast(image->rect.extent.height) != submission.request.extent.height)
+ ? FrameGenExtent{static_cast(image->rect.extent.width),
+ static_cast(image->rect.extent.height)}
+ : submission.request.extent;
if (drawing_frame_ && view.shading_frame == drawing_frame_ && view.shading_depth == depth &&
- view.shading_rate.resource) {
+ view.shading_rate.resource && view.shading_offset.x == offset.x && view.shading_offset.y == offset.y &&
+ view.shading_covered.width == covered.width && view.shading_covered.height == covered.height) {
return true;
}
view.shading_frame = 0;
@@ -2789,10 +2857,16 @@ class D3D12FrameGen final : public FrameGenGpu {
if (!view.shading_coarse) {
return false;
}
- const UINT tiles_x = (extent.width + shading_tile_ - 1) / shading_tile_;
- const UINT tiles_y = (extent.height + shading_tile_ - 1) / shading_tile_;
+ const UINT tiles_x = (covered.width + shading_tile_ - 1) / shading_tile_;
+ const UINT tiles_y = (covered.height + shading_tile_ - 1) / shading_tile_;
if (!view.shading_rate.resource || view.shading_rate.resource->GetDesc().Width != tiles_x ||
view.shading_rate.resource->GetDesc().Height != tiles_y) {
+ // Replaced (edge fill turned on or off, a view of another size):
+ // earlier submissions may still read the old image.
+ if (view.shading_rate.resource && !WaitIdle()) {
+ error = "D3D12 Frame Generation GPU work did not finish before reallocation";
+ return false;
+ }
if (!Create(view.shading_rate, {tiles_x, tiles_y}, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, true, error)) {
view.shading_coarse = false;
return false;
@@ -2817,7 +2891,8 @@ class D3D12FrameGen final : public FrameGenGpu {
FrameGenConstants constants{};
constants.fov_current = tangents;
constants.size = {tiles_x, tiles_y, extent.width, extent.height};
- constants.options = {shading_tile_, depth ? kFrameGenFlagDepth : 0u, 0u, 0u};
+ constants.options = {shading_tile_, depth ? kFrameGenFlagDepth : 0u, static_cast(offset.x),
+ static_cast(offset.y)};
constants.tuning = {static_cast(coarse_tangent_), 0.0f, 0.0f, 0.0f};
commands_->SetPipelineState(pipelines_[static_cast(FrameGenPass::kShadingRate)].Get());
commands_->SetComputeRoot32BitConstants(0, sizeof(FrameGenConstants) / 4, &constants, 0);
@@ -2828,6 +2903,8 @@ class D3D12FrameGen final : public FrameGenGpu {
Stamp(static_cast(FrameGenPass::kShadingRate));
view.shading_frame = drawing_frame_;
view.shading_depth = depth;
+ view.shading_offset = offset;
+ view.shading_covered = covered;
++shading_rates_;
return true;
}
@@ -2904,13 +2981,18 @@ class D3D12FrameGen final : public FrameGenGpu {
const float fraction = frames[i]->constants.tuning[0];
std::memcpy(i < 3 ? &constants.size[1 + i] : &constants.options[0], &fraction, sizeof(fraction));
}
- const D3D12_VIEWPORT viewport{0.0f, 0.0f, static_cast(submission.request.extent.width),
- static_cast(submission.request.extent.height), 0.0f, 1.0f};
- const D3D12_RECT scissor{0, 0, static_cast(submission.request.extent.width),
- static_cast(submission.request.extent.height)};
+ // The whole output image: with edge fill, the margin around the frame
+ // too (CanDraw: every output of the draw alike).
+ const FrameGenImage& image = submission.outputs[indices[0]];
+ const D3D12_VIEWPORT viewport{0.0f, 0.0f, static_cast