Pass times: log the largest viewport each kind of pass draws with.

A dynamic resolution that keeps its targets at the largest size and draws the scene into part of them shows up as a
viewport smaller than the pass; one that resizes its targets shows up in the pass size. NX2NAVI_SCENE_SCALE=33 left
the handheld scene pass at 1440x810, so this tells which of the two the game does there.

(cherry picked from commit af7abe36b0b15c5a63b354d2870543987d1f4b1a)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tobim6
2026-11-12 16:21:54 +01:00
parent 496c163d86
commit 1bfe90e3e2
4 changed files with 13 additions and 0 deletions

View File

@@ -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]

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}