Skip to content
HUBrisOrigami project journal
Color Schemes
Color Scheme Browser
Desktop SchemesBase · gamma 1.7
Monitor gamma
Chrome type · pointer

/usr/lib/X11/schemes · x_eoe_6530m

IRIS InSight: HUBris Library

HUBris Library / Engineering Notes / Octane2: VPro Textured Fills, Nearly Nine Times Fasterpage 44 of 97

NavigatorHUBris Library
Engineering Notespage 44 of 97

Engineering Notes Octane

Octane2: VPro Textured Fills, Nearly Nine Times Faster

Fixed-point row loops that test depth before sampling took GLperf's trilinear fill on the emulated Octane2 V12 from 14.2 to 124.5 Mpix/s.

GLperf’s depth-tested trilinear fill on our Octane2 V12 went from 14.2 to 124.5 million pixels a second. That is 8.8 times, from a change whose own benchmark showed about three. Most of the difference came from not drawing pixels nobody would see.

The figures are GLperf medians on our emulator, run under IRIX 6.5.30 on an emulated Octane2 with a VPro V12. They say how fast our renderer got, not how fast a V12 is.

The slowest thing every board did

Textured fills were the slowest operation on every SGI graphics family we emulate. Measured with GLperf against the matching real board, our V12’s depth-tested trilinear fill ran at 0.025 of the real figure. Solid Impact’s ran at 0.003. A flat fill on the V12 managed 0.16 to 0.17. One trilinear fragment cost about 260 nanoseconds on one host thread.

The boards draw through a shared software renderer, and its texture path was written for correctness: a general per-fragment loop, sampling in double precision.

Where the time went

Before changing anything we drew one scene several ways. It was a 1280 by 1024 frame, a 256 by 256 mipmapped texture with trilinear filtering and a depth test, a screen-filling quad and a perspective floor: about 2.1 million textured fragments. In millions of pixels a second, on one thread:

ArmSpeed
The renderer as it stood3.84
The same double-precision arithmetic in a tight loop11.7
32-bit fixed point in a tight loop22.6

So about two thirds of the time was the framework around the arithmetic, not the arithmetic. A tight loop alone was 3.0 times faster, and integer arithmetic added another 1.94 times.

Speed over identical pixels

Fixed point changes the colours. Against the existing output, a first fixed-point sampler changed about half the pixels in that scene by up to 14 of 255. Most of that came from coordinate precision, and with the coordinates kept exact the worst case fell to 4, then to 2 with the level-of-detail choice kept exact too.

We decided that was acceptable, with a rule. Coverage, depth, stencil and the set of pixels written stay exact. Only colour may move, and only within a stated bound. The reasoning is that the double precision was never fidelity either. No source we have gives the sub-texel, filter-weight or level-of-detail widths of MGRAS, VPro or InfiniteReality, so the old path’s arithmetic was as much our choice as any fixed-point width would be. The widths we picked are labelled as the model’s own in the texture-precision datasheet, each with a test that pins it.

The mechanism

The new sampler takes a texel position to 1/256 of a texel at each level, uses 8-bit bilinear weights and an 8-bit blend between levels, and finds the level of detail through a 1024-entry table of logarithms. Near a point where the filter or level would change, it falls back to exact arithmetic so those choices land where double precision would put them.

On top of that, twelve common states get their own row loops: nearest, bilinear or trilinear on a repeated RGB or RGBA image, replace or modulate, depth tested, no blending, no fog. Other states go through a loop that checks the state per pixel. Every specialised loop is tested against the general per-fragment loop and must match it pixel for pixel.

The row loops also test depth before they sample. The old path sampled every fragment’s texture and then tested its depth.

Nearly nine times

On the Octane2 V12, two sessions of three runs each, with the guest clock running at 0.983 to 0.997 of real time:

BuildGLperf fill-z-trilinear, medianRange
Before14.2 Mpix/s11.4 to 15.0
Fixed point124.5 Mpix/s97.5 to 148

Our own raster benchmark improved 2.8 to 3.5 times on one thread and 2.4 to 3.1 times with four bands. GLperf’s result is far larger, and we think depth-first sampling explains it: GLperf’s quads overdraw, so many fragments fail the depth test, and the new loops skip their texture work entirely. In the old build sampling took about 70% of the QEMU time; in the new one, depth reads stand out instead. That explanation is inferred, not measured [inference]. A run with the row loops switched off, which would sample after the depth test again, would settle it.

What this does not establish

  • Colour differs from the double-precision path by at most 3 of 255, with a mean of 0.0045, over a 100,000-case comparison corpus. It is not the old picture, and neither is a real V12 known to match either.
  • Draws routed through the Mesa renderer keep the double-precision sampler, so a board with Mesa on and the same board with Mesa off draw textured fills slightly differently, within that bound. The speed-up applies with Mesa off, the default.
  • Points, lines, pixel rectangles, bitmaps, InfiniteReality’s prepared samplers and the states the fixed path does not take still use the slow path.
  • Every fragment still reaches the board through per-pixel depth and colour callbacks. On scenes with no overdraw those callbacks and the colour conversion now take about half the time, and the benchmark’s goal of three times faster with bands is not met there.
  • The GLperf figure is one case on one machine.