Skip to content

Commit 081804e

Browse files
committed
fix(vulkan): improve logging for device loss handling and frame skipping
- Enhanced logging to provide clearer messages when the Vulkan device is lost, including suggestions to restart the application or update GPU drivers. - Added a mechanism to limit log frequency to avoid spamming during frame skips caused by device loss. - Updated error messages to clarify the impact on video playback and rendering functionality.
1 parent c25e089 commit 081804e

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/renderers/vulkan/tr_cmds.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,16 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
413413
ri.Printf(PRINT_DEVELOPER, "Vulkan: Skipping frame - not fully initialized\n");
414414
return;
415415
}
416-
// Skip rendering if device is lost
416+
// Skip rendering if device is lost (prevents video playback and all rendering)
417417
if (vk.device_lost) {
418-
ri.Printf(PRINT_DEVELOPER, "Vulkan: Skipping frame - device is lost\n");
418+
// Only log once per second to avoid spam
419+
static int last_log_time = 0;
420+
int current_time = ri.Milliseconds();
421+
if (current_time - last_log_time > 1000) {
422+
ri.Printf(PRINT_WARNING, "Vulkan: Device is lost - rendering disabled. Video playback will not work.\n");
423+
ri.Printf(PRINT_WARNING, "Vulkan: Try restarting the application or updating GPU drivers.\n");
424+
last_log_time = current_time;
425+
}
419426
return;
420427
}
421428
#endif

src/renderers/vulkan/vk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,8 @@ void end_command_buffer(VkCommandBuffer command_buffer, const char *location)
948948
vk.device_lost = qtrue; // Mark device as lost
949949
ri.Printf(PRINT_ERROR, "Vulkan: Device lost during queue submit - GPU driver issue\n");
950950
ri.Printf(PRINT_ERROR, "Vulkan: This may cause rendering artifacts or instability\n");
951-
ri.Printf(PRINT_ERROR, "Vulkan: Rendering disabled until device recovery\n");
951+
ri.Printf(PRINT_ERROR, "Vulkan: Rendering disabled. Try restarting the application or updating GPU drivers.\n");
952+
ri.Printf(PRINT_ERROR, "Vulkan: Video playback may not work until device is recovered.\n");
952953
// Don't terminate - let vk_queue_wait_idle handle cleanup
953954
} else {
954955
// For other errors, use the standard error handling

0 commit comments

Comments
 (0)