This commit is contained in:
Henrik Rydgård committed 2023-08-08 13:26:27 +02:00
1 parent 527e16c17a
commit 8fec4fb02f
3 files changed
+12 -2

No files matched your search

+3
View File
@@ -21,6 +21,9 @@ typedef std::function<void(InvalidationCallbackFlags)> InvalidationCallback;
// Also, this might be joined with more non-GPU timing information later.
struct FrameTimeData {
uint64_t frameId;
int waitCount;
double frameBegin;
double afterFenceWait;
double firstSubmit;
+3 -1
View File
@@ -304,7 +304,7 @@ bool VulkanRenderManager::CreateBackbuffers() {
INFO_LOG(G3D, "Starting Vulkan compiler thread");
compileThread_ = std::thread(&VulkanRenderManager::CompileThreadFunc, this);
if (vulkan_->GetDeviceFeatures().enabled.presentWait.presentWait) {
if (vulkan_->Extensions().KHR_present_wait && vulkan_->GetPresentMode() == VK_PRESENT_MODE_FIFO_KHR) {
INFO_LOG(G3D, "Starting Vulkan present wait thread");
presentWaitThread_ = std::thread(&VulkanRenderManager::PresentWaitThreadFunc, this);
}
@@ -551,6 +551,8 @@ void VulkanRenderManager::PresentWaitThreadFunc() {
if (VK_SUCCESS == vkWaitForPresentKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), waitedId, timeout)) {
frameTimeData_[waitedId].actualPresent = time_now_d();
waitedId++;
} else {
frameTimeData_[waitedId].waitCount++;
}
_dbg_assert_(waitedId <= frameIdGen_);
}
+6 -1
View File
@@ -114,9 +114,11 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
for (int i = 0; i < 8; i++) {
FrameTimeData data = ctx->GetDrawContext()->GetFrameTimeData(6 + i);
FrameTimeData prevData = ctx->GetDrawContext()->GetFrameTimeData(7 + i);
if (data.frameBegin == 0.0) {
snprintf(statBuf, sizeof(statBuf), "(No frame time data)");
} else {
double stride = data.frameBegin - prevData.frameBegin;
double fenceLatency_s = data.afterFenceWait - data.frameBegin;
double submitLatency_s = data.firstSubmit - data.frameBegin;
double queuePresentLatency_s = data.queuePresent - data.frameBegin;
@@ -135,11 +137,14 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
computedMargin * 1000.0);
}
snprintf(statBuf, sizeof(statBuf),
"%llu: From start of frame to event:\n"
"* Stride: %0.1f (waits: %d)\n"
"%llu: From start:\n"
"* Past fence: %0.1f ms\n"
"* Submit #1: %0.1f ms\n"
"* Queue-p: %0.1f ms\n"
"%s",
stride * 1000.0,
data.waitCount,
(long long)data.frameId,
fenceLatency_s * 1000.0,
submitLatency_s * 1000.0,