The GPU transforms the vertices

The cockpit displays were updating every two to three seconds while the
3D view held a perfectly smooth 55 fps. This is why, and it is one line.

Every device was created D3DCREATE_SOFTWARE_VERTEXPROCESSING - every
vertex on the track transformed and lit on the CPU, on the one core this
game uses for everything. That was not a choice when the engine was
written; there was no hardware to hand it to. The error message beneath
the call still says "Couldn't create HARDWARE_VERTEXPROCESSING device",
so the flag was changed at some point and the message left behind.

Measured on the biggest track, 1920x1080:

  software   foreground 17.2 ms   background 1.2 ms   2.4 gauge passes/s
  hardware   foreground  0.2 ms   background 17.9 ms  50.0 gauge passes/s

The frame loop runs the foreground and then spends whatever is LEFT on
the background gauge work. A foreground costing 17.2 ms of an 18 ms frame
leaves nothing, so the gauge loop got the single pass it is guaranteed
and no more. A pass needs about twenty steps - eighteen gauges and three
display copies - so the cockpit ran at two passes a second, and since the
renderer walks a sixteen-step rate wheel, a gauge on one step redrew once
per SIXTEEN of those. Three seconds. The map, the clock, the boost gauge
and the sim still running after the fade to black were all that one
number.

Hardware T&L is now the default and sw is the way back. Fixed-function
lighting and fog are not bit-identical between the old software path and
a driver, so the escape hatch stays - but the picture was checked against
both and the difference is not the one worth defending. A cockpit whose
instruments update twice a second is. It falls back to software by itself
if the adapter has no hardware T&L.

The instruments that found it stay in, because nothing about this was
visible from outside:

- FrameSplit, under RP412GAUGEDIAG, reports foreground against background
  against whole frame. APPMGR has computed those four timestamps every
  frame since forever and never reported one of them; it would have
  pointed here on the first day.
- FrameDiag reports frames per second on the same window, so the gauge
  sweep rate can be read against the frame rate rather than guessed at.
- ProfileReport, which already existed and was only reachable through F11
  on the RIO controls mapper - not the mapper a desktop player runs, so
  in practice unreachable - now runs on a timer under RP412GAUGEPROFILE.
  Its per-gauge line gains the rate mask and tier, which is what names a
  display as one-in-sixteen rather than merely slow.
- The winners' circle logs what its exterior and name-plate rebuilds
  cost, since nothing else runs while they do.

RP412VSYNC is here too, and it is honest about itself: presenting
IMMEDIATE was measured and made no difference to the frame budget,
because the frame was full of work rather than waiting. It stays as a
latency-against-tearing preference, not a fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-08-09 13:12:34 -05:00
co-authored by Claude Opus 5
parent 827c5b295b
commit b7b2c3b148
8 changed files with 320 additions and 4 deletions
+21
View File
@@ -244,6 +244,14 @@ void
// you would be the one empty spot. Turn it inside out before the shot.
//---------------------------------------------------------------------
//
//
// Timed, because the black screen between the race fading out and the
// stand fading in is several seconds long and the fade only accounts
// for 0.7 of them. Nothing else runs while this does - the whole game
// is one thread - so whatever these two cost IS that gap.
//
Time podiumOutsideStart = Now();
dpl_renderer->ShowViewpointFromOutside();
//
@@ -253,8 +261,21 @@ void
// whatever order the players were created.
//---------------------------------------------------------------------
//
Time podiumNamesStart = Now();
dpl_renderer->SortAndReloadNameBitmaps();
{
Time podiumNamesEnd = Now();
char timing[160];
sprintf(timing,
"WinnersCircle: exterior %.0f ms, name plates %.0f ms\n",
(double)((Scalar)(podiumNamesStart - podiumOutsideStart) * 1000.0f),
(double)((Scalar)(podiumNamesEnd - podiumNamesStart) * 1000.0f));
DEBUG_STREAM << timing << std::flush;
}
//
//---------------------------------------------------------------------
// Widen to 45 degrees and pull back in front of the stand so the whole
+18
View File
@@ -276,6 +276,24 @@ namespace
"# X = invert X only, Y = invert Y only, XY = both (case-insensitive).\n"
"#L4PADFLIP=XY\n"
"\n"
"# Who transforms the vertices: hw hands it to the GPU, sw does it on the\n"
"# CPU as this engine always has. There was no hardware to hand it to when\n"
"# it was written; there is now, and it is not close - on a busy track the\n"
"# 3D foreground drops from about 17ms a frame to under half a\n"
"# millisecond, and all of that time goes back to the cockpit displays,\n"
"# which is what makes the map, the clock and the gauges live rather than\n"
"# updating every few seconds.\n"
"# Falls back to sw by itself if the adapter has no hardware T&L. sw is\n"
"# the way back if a driver's fixed-function lighting or fog looks wrong -\n"
"# the two are not bit-identical.\n"
"RP412VERTEXPROC=hw\n"
"\n"
"# 0 = present without waiting for the panel's retrace. Costs tearing,\n"
"# buys latency. Measured to make very little difference to the frame\n"
"# budget here - the frame is full of work, not waiting - so this is a\n"
"# preference rather than a fix.\n"
"#RP412VSYNC=0\n"
"\n"
"# Anti-aliasing sample count, passed straight to Direct3D 9:\n"
"# 0 = off, else 2..16 as the GPU supports (1 selects the driver's\n"
"# \"nonmaskable\" mode; unsupported counts fail device creation).\n"