diff --git a/runtime/vk.h b/runtime/vk.h index 77faf919..b1756797 100644 --- a/runtime/vk.h +++ b/runtime/vk.h @@ -128,6 +128,7 @@ typedef struct { uint32_t step; // index of the pass, or of the dispatch, within its submission, from 0 uint32_t w, h, d; // render area and layers; a dispatch: group counts (0 0 0: indirect) uint32_t draws; // draws recorded in the pass; UINT32_MAX until its end is recorded + uint32_t vw, vh; // the largest viewport a draw of the pass set (dynamic resolution draws in part) uint64_t fence; // the submission: the timeline value it signals VkFormat color[8], depth; // attachment formats (VK_FORMAT_UNDEFINED: none) const GfxShader *first[2], *last[2];// vertex and fragment shader of the first and last draw; a dispatch: first[0] diff --git a/runtime/vk_crumbs.c b/runtime/vk_crumbs.c index 6f45bf2f..86fd6ba4 100644 --- a/runtime/vk_crumbs.c +++ b/runtime/vk_crumbs.c @@ -628,6 +628,7 @@ typedef struct { unsigned long long sid; double us; uint64_t n, draws; + uint32_t vw, vh; // the largest viewport its draws set } PtSum; static PtSum pt_sum[PT_SUMS]; static uint32_t pt_read; // the newest mark id taken in @@ -677,6 +678,9 @@ static void pt_add(const VkPassMark *m, double us) { if (e->key && e->key != key) continue; if (!e->key) *e = (PtSum){key, m->kind, m->ncolor, m->w, m->h, m->d, m->ncolor ? m->color[0] : VK_FORMAT_UNDEFINED, + m->depth, sid, 0, 0, 0, 0, 0}; + if (m->vw > e->vw) e->vw = m->vw; + if (m->vh > e->vh) e->vh = m->vh; e->us += us, e->n++, e->draws += m->draws == UINT32_MAX ? 0 : m->draws; return; } @@ -705,6 +709,9 @@ static void pt_report(uint64_t frames) { e->us / (double)e->n / 1e3); else rt_log("vk: %5.2f ms/frame %5.1f%% pass %ux%u x%u, %u colour (first fmt %d), depth fmt %d, fs %016llx: %.1f per " + "frame, %.3f ms and %.0f draws each, viewport up to %ux%u", e->us / f / 1e3, + pt_total_us > 0 ? e->us * 100 / pt_total_us : 0, e->w, e->h, e->d, e->ncolor, (int)e->c0, (int)e->depth, + e->sid, e->n / f, e->us / (double)e->n / 1e3, (double)e->draws / (double)e->n, e->vw, e->vh); } memset(pt_sum, 0, sizeof pt_sum); pt_total_us = 0, pt_marks = 0, pt_lost = 0; diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c index 7e139eff..74a6f35a 100644 --- a/runtime/vk_exec.c +++ b/runtime/vk_exec.c @@ -860,6 +860,7 @@ void vk_exec_pass_begin(VkExec *ex) { m->step = ex->mark_passes++; m->w = ex->pass_w, m->h = ex->pass_h, m->d = ex->pass_layers; m->layer = ex->depth.image ? ex->depth.base_layer : 0; + m->vw = m->vh = 0; m->ncolor = (uint8_t)(ex->pass_ncolor < 8 ? ex->pass_ncolor : 8); for (int i = 0; i < m->ncolor; i++) m->color[i] = ex->pass_color[i]; m->depth = ex->pass_depth ? ex->pass_depth : ex->pass_stencil; diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index 0c588229..8936f2de 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -3682,6 +3682,10 @@ static VkViewport draw_viewport(VkExec *ex) { if (w < 1) w = 1; if (h < 1) h = 1; VkViewport v = {x, y + h, w, -h, ex->depth_range[0], ex->depth_range[1]}; // the y flip: negative height + if (ex->mark) { // NX2NAVI_PASS_TIMES: how much of the pass the draws cover + if ((uint32_t)w > ex->mark->vw) ex->mark->vw = (uint32_t)w; + if ((uint32_t)h > ex->mark->vh) ex->mark->vh = (uint32_t)h; + } vk_dlaa_viewport(ex, &v); // the scene's draws move by the DLAA jitter return v; }