Skip to content

Conversation

TJnotJT
Copy link
Contributor

@TJnotJT TJnotJT commented Oct 4, 2025

Description of Changes

Adds support for dumping per-draw and per-frame stats.

Known issues:

  1. If dumping doesn’t start from draw 0, the first dumped draw includes stats accumulated from draw 0 onward.
  2. If draws are skipped, the next dumped draw includes all stats since the last dump.

This is mainly a debug tool, so the current behavior is suitable for comparing branches.

Rationale

Makes it easier to compare branches and identify the draw or frame where stats start to differ.

Testing Steps

  1. Enable Draw/Frame Stats Dumping in Settings → GS → Debug. Files will appear as 00005_draw_stats.txt (for Save Draw Stats) or 00005_f00001_frame_stats.txt (for Save Frame Stats).
  2. You can also enable the same behavior using the GS runner command-line arguments.

Example output:

Prim: 4281
Draw: 16
DrawCalls: 1136
Readbacks: 0
Swizzle: 657408
Unswizzle: 0
TextureCopies: 0
TextureUploads: 9
Barriers: 1120
RenderPasses: 4

AI Assistance

Yes, to draft this message.

@TJnotJT TJnotJT force-pushed the gs-dump-stats branch 5 times, most recently from 892a978 to f05905d Compare October 4, 2025 23:02
"Unswizzle",
"Fillrate",
"SyncPoint",
"Barriers",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need barrier info for sw?

@TJnotJT
Copy link
Contributor Author

TJnotJT commented Oct 10, 2025

Updated GSUtil arrays to reflects that SW renderer does not track barriers or render passes. Also removed the "CounterLast" string from both HW and SW arrays.

@TJnotJT
Copy link
Contributor Author

TJnotJT commented Oct 10, 2025

Small fix: The barrier/render pass stats were still being dumped for SW--removed that also.

@TJnotJT
Copy link
Contributor Author

TJnotJT commented Oct 10, 2025

There was a typo causing an out of bounds exception in the previous change. Fixed it and checked to make sure it's running correctly.

"DrawCalls",
"Readbacks",
"Swizzle",
"Unswizzle",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the swizzle/unswizzle stuff relevant to sw as well?

std::size_t last = hw ? CounterLastHW : CounterLastSW;
for (std::size_t i = 0; i < last; i++)
{
fprintf(fp, "%s: %I64u\n", GSUtil::GetPerfMonCounterName(static_cast<counter_t>(i), hw), static_cast<u64>(m_counters[i]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%I64u is a Microsoft extension.

You can either use PRIu64 or %llu with a cast to unsigned long long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants