aboutsummaryrefslogtreecommitdiffstats
path: root/steamvr
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2026-11-15 02:11:51 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2026-11-15 02:11:51 +0000
commitc750b7298bddab8f273365a96ec482538cd39201 (patch)
tree376d90b28c391173fe634dd03b084fb42e66c131 /steamvr
parent423655f1b60f83f21f86068d82217840fddb95a2 (diff)
downloadsteamvr-patches-c750b7298bddab8f273365a96ec482538cd39201.tar.gz
steamvr-patches-c750b7298bddab8f273365a96ec482538cd39201.tar.xz
steamvr-patches-c750b7298bddab8f273365a96ec482538cd39201.zip
steamvr 2.19.3 (26655409)
Diffstat (limited to 'steamvr')
-rw-r--r--steamvr/image-wait/image_wait.c148
-rw-r--r--steamvr/image-wait/trampoline.S26
-rw-r--r--steamvr/patches.toml114
3 files changed, 52 insertions, 236 deletions
diff --git a/steamvr/image-wait/image_wait.c b/steamvr/image-wait/image_wait.c
deleted file mode 100644
index e8112c3..0000000
--- a/steamvr/image-wait/image_wait.c
+++ /dev/null
@@ -1,148 +0,0 @@
-// SPDX-FileCopyrightText: 2026 Tomasz Kramkowski <tomasz@kramkow.ski>
-// SPDX-License-Identifier: CC0-1.0
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define ASSERT_SIZE(type, expected) \
- static_assert(sizeof (type) == (expected), #type " size must be " #expected)
-#define ASSERT_OFFSET(type, field, expected) \
- static_assert( \
- offsetof(type, field) == (expected), \
- #type "." #field " offset must be " #expected \
- )
-
-ASSERT_SIZE(void *, 8);
-
-enum { VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000 };
-
-typedef struct {
- uintptr_t semaphore;
- uint64_t value;
-} SemaphoreEntry;
-ASSERT_SIZE(SemaphoreEntry, 16);
-ASSERT_OFFSET(SemaphoreEntry, value, 8);
-
-// vr::IVRSharedResource
-struct SharedResource {
- const struct SharedResourceVtable *vtable;
-};
-
-typedef struct Semaphore *GetSemaphore(struct SharedResource *);
-
-struct SharedResourceVtable {
- unsigned char unknown_000[0x30];
- GetSemaphore *get_semaphore;
-};
-ASSERT_OFFSET(struct SharedResourceVtable, get_semaphore, 0x30);
-
-typedef uint64_t SemaphoreGetU64(struct Semaphore *);
-
-struct SemaphoreVtable {
- unsigned char unknown_000[0x40];
- SemaphoreGetU64 *get_handle;
- unsigned char unknown_048[0x70 - 0x48];
- SemaphoreGetU64 *get_value;
-};
-ASSERT_OFFSET(struct SemaphoreVtable, get_handle, 0x40);
-ASSERT_OFFSET(struct SemaphoreVtable, get_value, 0x70);
-
-// vr::IVRSharedSemaphore
-struct Semaphore {
- const struct SemaphoreVtable *vtable;
-};
-
-// vr::IVRSharedImage
-struct Image {
- const void *vtable;
-};
-
-struct Texture {
- unsigned char unknown_000[0x48];
- struct Image *image;
-};
-ASSERT_OFFSET(struct Texture, image, 0x48);
-
-struct Batch {
- unsigned char unknown_000[0xf0];
- SemaphoreEntry *waits;
- SemaphoreEntry *waits_end;
- unsigned char unknown_100[0x140 - 0x100];
- uint32_t *wait_stages;
- unsigned char unknown_148[0x398 - 0x148];
- SemaphoreEntry *signals;
- SemaphoreEntry *signals_end;
-};
-ASSERT_OFFSET(struct Batch, waits, 0xf0);
-ASSERT_OFFSET(struct Batch, waits_end, 0xf8);
-ASSERT_OFFSET(struct Batch, wait_stages, 0x140);
-ASSERT_OFFSET(struct Batch, signals, 0x398);
-ASSERT_OFFSET(struct Batch, signals_end, 0x3a0);
-
-struct RendererContext {
- unsigned char unknown_000[8];
- struct Batch *batch;
-};
-ASSERT_OFFSET(struct RendererContext, batch, 8);
-
-// CFacetVRRenderer
-struct Renderer {
- unsigned char unknown_000[0x12b0];
- struct RendererContext *context;
-};
-ASSERT_OFFSET(struct Renderer, context, 0x12b0);
-
-extern void append_wait(
- struct Batch *batch, uintptr_t semaphore, uint32_t stages, uint64_t value
-) __attribute__((visibility("hidden")));
-
-// The patch calls this function at the beginning of a method in the "Facet"
-// `renderer` which is called, among other things, on `texture`s that the current
-// submission batch will use as shader inputs (e.g. eye textures).
-void register_image_wait(struct Renderer *renderer, struct Texture *texture)
-{
- // First we need the completion semaphore for the texture.
- struct Image *image = texture->image;
- if (!image) return;
-
- // The vbase offset entry for converting `vr::IVRSharedImage *` to
- // `vr::IVRSharedResource *` is located at `image->vtable - 0x50`.
- ptrdiff_t resource_offset =
- *(const ptrdiff_t *)((const char *)image->vtable - 0x50);
- struct SharedResource *resource = (void *)((char *)image + resource_offset);
-
- struct Semaphore *semaphore = resource->vtable->get_semaphore(resource);
- if (!semaphore) return;
-
- uintptr_t handle = semaphore->vtable->get_handle(semaphore);
- if (!handle) return;
-
- // The current batch that is being prepared, and that may need the image
- // semaphore as a dependency.
- struct Batch *batch = renderer->context->batch;
-
- // If the texture we got called on has the same completion semaphore as one
- // of the completion signals of this batch, then making the batch depend on
- // the semaphore could create a loop, and that would be bad.
- for (SemaphoreEntry *p = batch->signals; p != batch->signals_end; p++) {
- if (p->semaphore == handle) return;
- }
-
- // If there's already a wait on this texture's semaphore, ensure it will
- // block all work in this batch and that the value is at least as high as the
- // semaphore value required for this texture to be ready.
- uint64_t value = semaphore->vtable->get_value(semaphore);
- uint32_t *stages = batch->wait_stages;
- for (SemaphoreEntry *p = batch->waits; p != batch->waits_end;
- p++, stages++) {
- if (p->semaphore != handle) continue;
-
- if (p->value < value) p->value = value;
- *stages |= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
- return;
- }
-
- // Otherwise append a wait on this texture's completion semaphore.
- append_wait(batch, handle, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, value);
-}
diff --git a/steamvr/image-wait/trampoline.S b/steamvr/image-wait/trampoline.S
deleted file mode 100644
index 6c7dbc4..0000000
--- a/steamvr/image-wait/trampoline.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-FileCopyrightText: 2026 Tomasz Kramkowski <tomasz@kramkow.ski>
- * SPDX-License-Identifier: CC0-1.0
- */
-
-.intel_syntax noprefix
-.section .text.entry,"ax",@progbits
-.global input_wait
-input_wait:
- push rdi
- push rsi
- push rdx
- push rcx
- sub rsp, 8
- call register_image_wait
- add rsp, 8
- pop rcx
- pop rdx
- pop rsi
- pop rdi
-
- # Replay the three displaced instructions, then resume the original function.
- push rbp
- mov rax, rsi
- mov r9d, edx
- jmp resume_transition
-.section .note.GNU-stack,"",@progbits
diff --git a/steamvr/patches.toml b/steamvr/patches.toml
index fd9ca48..3061ede 100644
--- a/steamvr/patches.toml
+++ b/steamvr/patches.toml
@@ -1,22 +1,18 @@
# SPDX-FileCopyrightText: 2026 Tomasz Kramkowski <tomasz@kramkow.ski>
# SPDX-License-Identifier: CC0-1.0
-target = "Beta 2.19.2, build 26496310"
+target = "Beta 2.19.3, build 26655409"
[[targets]]
path = "bin/linux64/vrcompositor"
-sha256 = "7695e718ee0d070df596663d737b6a183aa650a2c66b90a035cc7f227a7a49e1"
+sha256 = "b3747b541c86f683286f13fcce9ed7761e0258ecef3827c5ce915167226947fe"
edits = [
- # Wait for GPU to finish using its resources (see #952)
- [0x4056c1, "84c00f842f570000eb06"],
- [0x4056d1, "488dbbe00d0000e90a570000"],
- [0x40addb, "e840db0600"],
- [0x40ade0, "e9dca8ffff9090"],
- # Stop reusing GPU work identifier across frames (allows above patch to
- # work reliably)
- [0x41dfa4, "31c09090909090"],
- [0x41e8b9, "31c09090909090"],
- [0x41e8f4, "909090909090"],
+ # Stop reusing GPU work identifiers across frames so that the (now fixed
+ # upstream) wait on prior GPU work waits on the _correct_ work (#952).
+ # TODO: Maybe this _can't_ actually happen? Needs more investigation.
+ [0x41eb34, "31c09090909090"],
+ [0x41f449, "31c09090909090"],
+ [0x41f484, "909090909090"],
# Fix shader descriptor texture array counts (should be 3, not 1) for
# bindings 9, 17, and 20. Affected shaders:
# - distort_none_ps
@@ -24,60 +20,54 @@ edits = [
# - distort_panorama_ps
# - distort_panorama_solid_color_ps
# - distort_ps_achromatic_nd
- [0x4056e1, "498b5500b80300000089424ceb22"],
- [0x405711, "89828c0000008982a4000000eb12"],
- [0x405731, "4c8bbd18feffffe902200100"],
- [0x417738, "e9a4dffeff9090"],
-]
-[targets.compiled]
-sources = ["image-wait/trampoline.S", "image-wait/image_wait.c"]
-imports = { append_wait = 0x466b60, resume_transition = 0x40f757 }
-hooks = [
- # Make the compositor wait for frames submitted by the application to
- # complete rendering before trying to encode them etc. (#1046)
- { address = 0x40f750, length = 7, target = "input_wait" },
-]
-
-[[targets]]
-path = "bin/linux64/vrserver"
-sha256 = "f2caabae6e7e5e00f712766d5aa5089ef1905a4ee70575a200ea4fb063471b6a"
-edits = [
- # Remove logger calls in forked processes (can cause a deadlock and make
- # the process linger preventing SteamVR from starting again)
- [0x2c12d6, "9090909090"],
- [0x2c14c7, "9090909090"],
- [0x2c155c, "9090909090"],
- [0x2c1676, "9090909090"],
- [0x2c174f, "9090909090"],
- [0x2c15e9, "9090909090"],
+ [0x4061c1, "498b5500b80300000089424ceb22"],
+ [0x4061f1, "89828c0000008982a4000000eb12"],
+ [0x406211, "4c8bbd18feffffe9b2200100"],
+ [0x4182c8, "e9f4defeff9090"],
+ # Increase Vulkan descriptor pool capacity from 200 to 1024. (#1067)
+ # Some games hit this (including Alyx for me since 2.19.3, despite the
+ # limit pre-dating this version) limit and crash since the error handling
+ # consists of logging, followed ignoring the error and passing a NULL
+ # pointer back to Vulkan.
+ # The correct fix would be to resize when the limit is hit. But 200 seemed
+ # to have worked for a long time so 1024 _ought to be enough for
+ # anybody_...
+ [0x4365ba, "00200000"],
+ [0x4365c9, "00100000"],
+ [0x4365e0, "00400000"],
+ [0x4365f3, "00400000"],
+ [0x436614, "00040000"],
]
[[targets]]
path = "drivers/vrlink/bin/linux64/driver_vrlink.so"
-sha256 = "df21d2496e78f5490fa1e0eb1f1b32546381a4aeee5dd6aa985982af8f6c07d7"
+sha256 = "b78a5a6bbfcb0cd80cd44f4b88ed97f5a93110ad62ebaaffff20768d0a7a9135"
edits = [
- # Keep increasing (mod(2^16)) the ACK cutoff instead of clearing it (#965)
- [0xd92ed, "89836c0d000090909090"],
- # Wait for encoder to finish before reconfiguring it
- # (ulVideoTimeline == ulTimelineSequence) (#965)
- [0x13c482, "83bb4c090000007458e9702c0000"],
- [0x13c4e3, "488b8328090000e9ec210000"],
- [0x13e6d4, "e9a9ddffff9090"],
- # Clean up failed encoded frames so the above fix doesn't wait forever when
- # these trigger a reset
- [0x13d8e5, "e927000000"],
- [0x13d911, "488b9d70ffffff4c01f3e9d6feffff"],
- # Reset tracking and encoding when starting a new streaming session
- [0x112bf1, "57488b7f184885ff740feb04"],
- [0x112c01, "488b076a015eff50285fe90013feff"],
- [0x11a3f1, "4c89a30804000031c0894308c3"],
- # Preserve the conditional readiness reset before the session store.
- [0x11a441, "e8abffffff6690"],
- [0x11a454, "e89887ffff"],
- # Ignore stale tracking IDs and repeated older attempts
- [0x11b4b1, "89d02b47084189c6c1e004"],
- [0x11b4bc, "0f8853050000"],
- [0x11b7c4, "0f84f718fdff"],
- [0xed0c1, "410fb644240988430ee946e90200"],
+ # Keep increasing (mod(2^16)) the ACK cutoff instead of clearing it (#965).
+ # If the headset's ACKs start to fall behind, the driver throttles new
+ # frame generation to once every 0.3s. Normally the driver stores the last
+ # ACK number regardless of whether it is newer or older than the currently
+ # stored one. This ACK number is used to determine if the headset has
+ # fallen behind. When a reset occurs, throttling should stop to allow the
+ # new frame (which does not depend on any prior frames) to be sent out
+ # immediately. But clearing the ACK cutoff means that the next frame
+ # immediately following that one can get throttled if the host is still
+ # receiving old ACKs.
+ [0xd7a6d, "89838401000090909090"],
+ # Ignore stale tracking IDs and repeated older tracking attempts
+ [0x116581, "89d02b47084189c6c1e004"],
+ [0x11658c, "0f8853050000"],
+ [0x116894, "0f84970ffdff"],
+ [0xe7831, "410fb644240988430ee9a6f20200"],
+ # Reset tracking and encoding when starting a new streaming session.
+ # The tracking ID rejection code above could otherwise drop some packets
+ # after a reconnect (since their IDs will start from 0 again).
+ # Resetting the encoder eagerly here avoids the high chance it will end up
+ # reset due to errors shortly after.
+ [0x10db61, "57488b7f184885ff740feb04"],
+ [0x10db71, "488b076a015eff50285fe91013feff"],
+ [0x1154c1, "4c89a30804000031c0894308c3"],
+ [0x115511, "e8abffffff6690"],
+ [0x115524, "e83886ffff"],
]