Skip to content

Commit d13f898

Browse files
committed
В статистику добавлена строка "Frame sync", в которой будут отображаться активные настройки "wait VBlank" и "adjust present time".
Косметические изменения статистики.
1 parent 87e1255 commit d13f898

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

Source/DX11VideoProcessor.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ void CDX11VideoProcessor::CalcStatsParams()
10931093
if (S_OK == m_Font3D.CreateFontBitmap(L"Consolas", m_StatsFontH, 0)) {
10941094
SIZE charSize = m_Font3D.GetMaxCharMetric();
10951095
m_StatsRect.right = m_StatsRect.left + 61 * charSize.cx + 5 + 3;
1096-
m_StatsRect.bottom = m_StatsRect.top + 18 * charSize.cy + 5 + 3;
1096+
m_StatsRect.bottom = m_StatsRect.top + 19 * charSize.cy + 5 + 3;
10971097
}
10981098
m_StatsBackground.Set(m_StatsRect, rtSize, D3DCOLOR_ARGB(80, 0, 0, 0));
10991099

@@ -3832,9 +3832,6 @@ void CDX11VideoProcessor::UpdateStatsPresent()
38323832
DXGI_SWAP_CHAIN_DESC1 swapchain_desc;
38333833
if (m_pDXGISwapChain1 && S_OK == m_pDXGISwapChain1->GetDesc1(&swapchain_desc)) {
38343834
m_strStatsPresent.assign(L"\nPresentation : ");
3835-
if (m_bVBlankBeforePresent && m_pDXGIOutput) {
3836-
m_strStatsPresent.append(L"wait VBlank, ");
3837-
}
38383835
switch (swapchain_desc.SwapEffect) {
38393836
case DXGI_SWAP_EFFECT_DISCARD:
38403837
m_strStatsPresent.append(L"Discard");
@@ -3851,6 +3848,19 @@ void CDX11VideoProcessor::UpdateStatsPresent()
38513848
}
38523849
m_strStatsPresent.append(L", ");
38533850
m_strStatsPresent.append(DXGIFormatToString(swapchain_desc.Format));
3851+
3852+
if ((m_bVBlankBeforePresent && m_pDXGIOutput) || m_bAdjustPresentTime) {
3853+
m_strStatsPresent.append(L"\nFrame sync :");
3854+
if (m_bVBlankBeforePresent && m_pDXGIOutput) {
3855+
m_strStatsPresent.append(L" wait VBlank");
3856+
}
3857+
if (m_bAdjustPresentTime) {
3858+
if (m_strStatsPresent.back() != ':') {
3859+
m_strStatsPresent += ',';
3860+
}
3861+
m_strStatsPresent.append(L" adjust present time");
3862+
}
3863+
}
38543864
}
38553865
}
38563866

@@ -4005,11 +4015,12 @@ HRESULT CDX11VideoProcessor::DrawStats(ID3D11Texture2D* pRenderTarget)
40054015
str.append(m_strStatsHDR);
40064016
str.append(m_strStatsPresent);
40074017

4008-
str += std::format(L"\nFrames: {:5}, skipped: {}/{}, failed: {}",
4018+
str += std::format(L"\nFrames : {:5}, skipped: {}/{}, failed: {}",
40094019
m_pFilter->m_FrameStats.GetFrames(), m_pFilter->m_DrawStats.m_dropped, m_RenderStats.dropped2, m_RenderStats.failed);
4010-
str += std::format(L"\nTimes(ms): Copy{:3}, Paint{:3}, Present{:3}",
4011-
m_RenderStats.copyticks * 1000 / GetPreciseTicksPerSecondI(),
4012-
m_RenderStats.paintticks * 1000 / GetPreciseTicksPerSecondI(),
4020+
4021+
str += std::format(L"\nTimes(ms) : Copy{:3}, Paint{:3}, Present{:3}",
4022+
m_RenderStats.copyticks * 1000 / GetPreciseTicksPerSecondI(),
4023+
m_RenderStats.paintticks * 1000 / GetPreciseTicksPerSecondI(),
40134024
m_RenderStats.presentticks * 1000 / GetPreciseTicksPerSecondI());
40144025

40154026
str += std::format(L"\nSync offset : {:+3} ms", (m_RenderStats.syncoffset + 5000) / 10000);

Source/DX9VideoProcessor.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ void CDX9VideoProcessor::CalcStatsParams()
997997
if (S_OK == m_Font3D.CreateFontBitmap(L"Consolas", m_StatsFontH, 0)) {
998998
SIZE charSize = m_Font3D.GetMaxCharMetric();
999999
m_StatsRect.right = m_StatsRect.left + 61 * charSize.cx + 5 + 3;
1000-
m_StatsRect.bottom = m_StatsRect.top + 18 * charSize.cy + 5 + 3;
1000+
m_StatsRect.bottom = m_StatsRect.top + 19 * charSize.cy + 5 + 3;
10011001
m_StatsBackground.Set(m_StatsRect, D3DCOLOR_ARGB(80, 0, 0, 0));
10021002
}
10031003

@@ -2935,9 +2935,6 @@ void CDX9VideoProcessor::UpdateStatsPresent()
29352935
{
29362936
if (m_d3dpp.SwapEffect) {
29372937
m_strStatsPresent.assign(L"\nPresentation : ");
2938-
if (m_bVBlankBeforePresent) {
2939-
m_strStatsPresent.append(L"wait VBlank, ");
2940-
}
29412938
switch (m_d3dpp.SwapEffect) {
29422939
case D3DSWAPEFFECT_DISCARD:
29432940
m_strStatsPresent.append(L"Discard");
@@ -2957,6 +2954,19 @@ void CDX9VideoProcessor::UpdateStatsPresent()
29572954
}
29582955
m_strStatsPresent.append(L", ");
29592956
m_strStatsPresent.append(D3DFormatToString(m_d3dpp.BackBufferFormat));
2957+
2958+
if (m_bVBlankBeforePresent || m_bAdjustPresentTime) {
2959+
m_strStatsPresent.append(L"\nFrame sync :");
2960+
if (m_bVBlankBeforePresent) {
2961+
m_strStatsPresent.append(L" wait VBlank");
2962+
}
2963+
if (m_bAdjustPresentTime) {
2964+
if (m_strStatsPresent.back() != ':') {
2965+
m_strStatsPresent += ',';
2966+
}
2967+
m_strStatsPresent.append(L" adjust present time");
2968+
}
2969+
}
29602970
}
29612971
}
29622972

@@ -3098,12 +3108,14 @@ HRESULT CDX9VideoProcessor::DrawStats(IDirect3DSurface9* pRenderTarget)
30983108
str.append(m_strStatsHDR);
30993109
str.append(m_strStatsPresent);
31003110

3101-
str += std::format(L"\nFrames: {:5}, skipped: {}/{}, failed: {}",
3111+
str += std::format(L"\nFrames : {:5}, skipped: {}/{}, failed: {}",
31023112
m_pFilter->m_FrameStats.GetFrames(), m_pFilter->m_DrawStats.m_dropped, m_RenderStats.dropped2, m_RenderStats.failed);
3103-
str += std::format(L"\nTimes(ms): Copy{:3}, Paint{:3}, Present{:3}",
3113+
3114+
str += std::format(L"\nTimes(ms) : Copy{:3}, Paint{:3}, Present{:3}",
31043115
m_RenderStats.copyticks * 1000 / GetPreciseTicksPerSecondI(),
31053116
m_RenderStats.paintticks * 1000 / GetPreciseTicksPerSecondI(),
31063117
m_RenderStats.presentticks * 1000 / GetPreciseTicksPerSecondI());
3118+
31073119
str += std::format(L"\nSync offset : {:+3} ms", (m_RenderStats.syncoffset + 5000) / 10000);
31083120

31093121
#if SYNC_OFFSET_EX

0 commit comments

Comments
 (0)