Skip to content

Commit e484095

Browse files
committed
1. Removed Max framerate case from tests #2 and #7.
2. Now sets min frame rate to be the minimum of the enumerated modes and the Frame Duration if supported. 3. Made sure test 5 frame rate respects max fps override. 4. Test #5 G2G auto mode now computes ¼ second brightness hold by rounding up to the nearest even frame count instead of rounding down.
1 parent 5d54635 commit e484095

2 files changed

Lines changed: 48 additions & 29 deletions

File tree

Game.cpp

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//*********************************************************
1111

12-
#define versionString L"v0.952"
12+
#define versionString L"v0.953"
1313

1414
#include "pch.h"
1515

@@ -128,8 +128,8 @@ void Game::ConstructorInternal()
128128
m_sweepPos = 0; // position of bar in Tearing test 0
129129

130130
m_targetFrameRate = 60.f;
131-
m_frameTime = 0.016666;
132-
m_lastFrameTime = 0.016666;
131+
m_frameTime = 0.016667;
132+
m_lastFrameTime = 0.016667;
133133
m_sleepDelay = 16.0; // ms simulate workload of app (just used for some tests)
134134
m_frameCount = 0; // number of frames in current stats
135135
m_presentCount = 0; // number of Presents in current stats
@@ -1095,12 +1095,8 @@ void Game::UpdateFlickerConstant()
10951095
m_targetFrameRate = minFrameRate; // min reported by implementation
10961096
break;
10971097

1098-
case 1:
1099-
m_targetFrameRate = maxFrameRate; // max reported by implementation
1100-
break;
1101-
11021098
default:
1103-
m_targetFrameRate = mediaRefreshRates[m_flickerRateIndex - 2];
1099+
m_targetFrameRate = mediaRefreshRates[m_flickerRateIndex - 1];
11041100
break;
11051101
}
11061102

@@ -1281,8 +1277,18 @@ float Game::GrayToGrayValue(INT32 index)
12811277
// update routine for Gray2Gray Test pattern 5
12821278
void Game::UpdateGrayToGray()
12831279
{
1280+
double maxFrameRate = m_maxFrameRate;
1281+
double minFrameRate = m_minFrameRate;
1282+
1283+
// check for overrides and apply
1284+
if (m_maxFrameRateOverride != 0)
1285+
maxFrameRate = m_maxFrameRateOverride;
1286+
if (m_minFrameRateOverride != 0)
1287+
minFrameRate = m_minFrameRateOverride;
1288+
12841289
if (m_autoG2G) // if we are in auto-sequence
12851290
{
1291+
m_targetFrameRate = maxFrameRate; // per CTS
12861292
/*
12871293
update the timer
12881294
if it has run down, then
@@ -1291,7 +1297,7 @@ void Game::UpdateGrayToGray()
12911297
Increment the FromIndex
12921298
if that overflows, increment the ToIndex
12931299
*/
1294-
// m_testTimeRemainingSec -= m_frameTime;
1300+
// m_testTimeRemainingSec -= m_frameTime;
12951301
if (m_g2gCounter <= 0) // counter ran down, so change something
12961302
{
12971303
if (m_g2gFrom)
@@ -1315,28 +1321,30 @@ void Game::UpdateGrayToGray()
13151321
{
13161322
m_g2gCounter = static_cast<int32_t>(0.25 * m_targetFrameRate); // reset counter to take 250ms at ANY frame rate
13171323
if (m_g2gCounter & 0x01) // if it is odd,
1318-
m_g2gCounter--; // subtract one to make it even
1324+
m_g2gCounter++; // add one to make it even
13191325
}
13201326
// m_testTimeRemainingSec = 0.250; // 0.006944444 * 5;
13211327
}
13221328

1323-
m_targetFrameRate = m_maxFrameRate; // per CTS
13241329
}
13251330
else // we are in manual state setting mode (not auto sequence)
13261331
{
1327-
// m_g2gFrom = (m_frameCounter >> 4) & 1; // switch every 16 frames
1328-
// m_g2gFrom = (m_frameCounter >> 2) & 1; // switch every 8 frames
1329-
// m_g2gFrom = (m_frameCounter >> 2) & 1; // switch every 4 frames
1330-
// m_g2gFrom = (m_frameCounter >> 1) & 1; // switch every 2 frames
1331-
// m_g2gFrom = (m_frameCounter ) & 1; // switch every other frame
1332+
// m_g2gFrom = (m_frameCounter >> 4) & 1; // switch every 16 frames
1333+
// m_g2gFrom = (m_frameCounter >> 2) & 1; // switch every 8 frames
1334+
// m_g2gFrom = (m_frameCounter >> 2) & 1; // switch every 4 frames
1335+
// m_g2gFrom = (m_frameCounter >> 1) & 1; // switch every 2 frames
1336+
// m_g2gFrom = (m_frameCounter ) & 1; // switch every other frame
13321337

13331338
if (m_g2gCounter <= 0)
13341339
{
1335-
m_g2gFrom = !m_g2gFrom; // flip to showing the other color
1340+
m_g2gFrom = !m_g2gFrom; // flip to showing the other color
13361341
m_g2gCounter = m_g2gInterval; // reset the interval timer
13371342
}
13381343

13391344
m_targetFrameRate = m_g2gFrameRate; // per CTS
1345+
if (m_targetFrameRate > maxFrameRate )
1346+
m_targetFrameRate = maxFrameRate;
1347+
13401348
}
13411349

13421350
// define color for test patch
@@ -1664,7 +1672,7 @@ void Game::ChangeSubtest(INT32 increment)
16641672

16651673
case TestPattern::FlickerConstant: // 2
16661674
m_flickerRateIndex += increment;
1667-
m_flickerRateIndex = wrap(m_flickerRateIndex, 0, numMediaRates + 1);
1675+
m_flickerRateIndex = wrap(m_flickerRateIndex, 0, numMediaRates );
16681676
AutoResetAverageStats();
16691677
break;
16701678

@@ -1846,15 +1854,21 @@ void Game::UpdateDxgiRefreshRatesInfo()
18461854
m_minDuration = closestLargerPresentDuration;
18471855

18481856
// this may need to be adjusted based on the VESA criteria. TODO
1849-
if (m_minDuration > 0)
1857+
if (m_minDuration > 0) // if Durations are supported,
1858+
{
18501859
m_vTotalFixedSupported = true;
1860+
m_minFrameRate = 10000000.f / m_maxDuration; // then these should be non-zero
1861+
m_maxFrameRate = 10000000.f / m_minDuration;
1862+
}
18511863

18521864
// initialize those scenes that should default to max frame rate
18531865
// TODO: Keep this below actual frame rate of OS!
1854-
if (m_latencyTestFrameRate < 5) // 4
1855-
m_latencyTestFrameRate = m_maxFrameRate;
18561866

1857-
// m_latencyTestFrameRate = m_displayFrequency; // default this to current OS setting
1867+
// set those rates that default to max (and apply override)
1868+
1869+
if (m_latencyTestFrameRate < 5) // 4
1870+
m_latencyTestFrameRate = m_maxFrameRate;
1871+
// m_latencyTestFrameRate = m_displayFrequency; // default this to current OS setting
18581872

18591873
if (m_g2gFrameRate < 5) // 5
18601874
m_g2gFrameRate = m_maxFrameRate;
@@ -2025,7 +2039,7 @@ bool Game::CheckHDR_On()
20252039
return HDR_On;
20262040
}
20272041

2028-
void Game::GenerateTestPattern_ConnectionProperties(ID2D1DeviceContext2* ctx) // 1
2042+
void Game::GenerateTestPattern_ConnectionProperties(ID2D1DeviceContext2* ctx) // ******************************* 1
20292043
{
20302044
std::wstringstream text;
20312045

@@ -2392,14 +2406,13 @@ void Game::GenerateTestPattern_FlickerConstant(ID2D1DeviceContext2* ctx) //****
23922406
title << versionString;
23932407
title << L" Test 2 - Flicker at Constant Refresh Rate: ";
23942408

2409+
// title << m_flickerRateIndex; // debug printf
23952410
switch (m_flickerRateIndex)
23962411
{
23972412
case 0:
23982413
title << " Minimum";
23992414
break;
2400-
case 1:
2401-
title << " Maximum";
2402-
break;
2415+
24032416
default:
24042417
break;
24052418
}
@@ -2545,6 +2558,9 @@ void Game::GenerateTestPattern_FlickerVariable(ID2D1DeviceContext2* ctx) //****
25452558
break;
25462559
}
25472560

2561+
// would be nice to show the min max rates for square and sine wave,
2562+
// but those values are not easy to get from here
2563+
25482564
if (m_targetFrameRate > m_displayFrequency)
25492565
title << L"\nWARNING: **** Windows Settings prevent operation over " << m_displayFrequency << L"Hz ****\n\n";
25502566

@@ -3540,6 +3556,9 @@ void Game::GenerateTestPattern_EndOfMandatoryTests(ID2D1DeviceContext2* ctx)
35403556

35413557
void Game::GenerateTestPattern_MotionBlur(ID2D1DeviceContext2* ctx) // ***************************************** 8.
35423558
{
3559+
if (m_newTestSelected)
3560+
AutoResetAverageStats();
3561+
35433562
// get window dimensions in pixels
35443563
auto logSize = m_deviceResources->GetLogicalSize();
35453564
float2 center = float2(logSize.right - logSize.left, logSize.bottom - logSize.top) * 0.5f;

Game.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class Game : public DX::IDeviceNotify
9696

9797
// Media rate Flicker test indexes into these arrays using its FlickerRateIndex
9898

99-
#define numMediaRates 11 // number of refresh rates in the media rate test 2, 7
100-
double mediaRefreshRates[numMediaRates] = {23.976, 24.0, 25.0, 29.97, 30.0, 47.952, 48.0, 50.0, 59.94, 60.0, 120.0};
101-
UINT mediaPresentDurations[numMediaRates] = {417083, 416666, 400000, 333666, 333333, 208542, 208333, 200000, 166833, 166667, 83333};
99+
#define numMediaRates 10 // number of refresh rates in the media rate test 2, 7
100+
double mediaRefreshRates[numMediaRates] = {23.976, 24.0, 25.0, 29.97, 30.0, 47.952, 48.0, 50.0, 59.94, 60.0};
101+
UINT mediaPresentDurations[numMediaRates] = {417083, 416666, 400000, 333666, 333333, 208542, 208333, 200000, 166833, 166667};
102102

103103
#define numGtGValues 5 // number of levels in the G2G tests 5
104104

0 commit comments

Comments
 (0)