mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat(vkbridge): VKBRIDGE_WSI_DUMP_EVERY=N dumps every Nth presented frame
For watching a real game make progress through the bridge (frames are named by present count). Used to check The Witcher 3 (D3D12 / vkd3d-proton) on the host: legal screen and the 3D account-link screen render correctly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1U9H1evGNjHRQ3wRUdv5V
This commit is contained in:
1 parent
a6296d3936
commit
850c929967
1 file changed
+8
-2
@@ -714,7 +714,10 @@ VKAPI_ATTR VkResult VKAPI_CALL vkb_ep_vkAcquireNextImage2KHR(VkDevice device, co
|
||||
/* VKBRIDGE_WSI_DUMP=/path/prefix: writes presented frame 60 as a PPM (debugging aid). */
|
||||
static void dump_frame(vkb_swapchain *sc, uint32_t index)
|
||||
{
|
||||
if (sc->presents != 60) return;
|
||||
/* The 60th present, or every VKBRIDGE_WSI_DUMP_EVERY-th (watching a game get somewhere). */
|
||||
static long every = -1;
|
||||
if (every < 0) every = getenv("VKBRIDGE_WSI_DUMP_EVERY") ? atol(getenv("VKBRIDGE_WSI_DUMP_EVERY")) : 0;
|
||||
if (every > 0 ? sc->presents % every != 0 : sc->presents != 60) return;
|
||||
uint32_t w = sc->info.imageExtent.width, h = sc->info.imageExtent.height, stride = w * 4;
|
||||
const uint8_t *px = NULL;
|
||||
void *map = NULL;
|
||||
@@ -730,7 +733,10 @@ static void dump_frame(vkb_swapchain *sc, uint32_t index)
|
||||
}
|
||||
if (!px) return;
|
||||
char path[512];
|
||||
snprintf(path, sizeof(path), "%s-%d.ppm", getenv("VKBRIDGE_WSI_DUMP"), (int)getpid());
|
||||
if (every > 0)
|
||||
snprintf(path, sizeof(path), "%s-%d-%06u.ppm", getenv("VKBRIDGE_WSI_DUMP"), (int)getpid(), (unsigned)sc->presents);
|
||||
else
|
||||
snprintf(path, sizeof(path), "%s-%d.ppm", getenv("VKBRIDGE_WSI_DUMP"), (int)getpid());
|
||||
FILE *f = fopen(path, "wb");
|
||||
if (f) {
|
||||
int bgr = sc->info.imageFormat == VK_FORMAT_B8G8R8A8_UNORM || sc->info.imageFormat == VK_FORMAT_B8G8R8A8_SRGB;
|
||||
|
||||
Reference in new issue
Block a user