1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-16 21:27:10 +00:00

Add a monitor renderer using TBOs (#443)

This uses the system described in #409, to render monitors in a more
efficient manner.

Each monitor is backed by a texture buffer object (TBO) which contains
a relatively compact encoding of the terminal state. This is then
rendered using a shader, which consumes the TBO and uses it to index
into main font texture.

As we're transmitting significantly less data to the GPU (only 3 bytes
per character), this effectively reduces any update lag to 0. FPS appears
to be up by a small fraction (10-15fps on my machine, to ~110), possibly
as we're now only drawing a single quad (though doing much more work in
the shader).

On my laptop, with its Intel integrated graphics card, I'm able to draw
120 full-sized monitors (with an effective resolution of 3972 x 2330) at
a consistent 60fps. Updates still cause a slight spike, but we always
remain above 30fps - a significant improvement over VBOs, where updates
would go off the chart.

Many thanks to @Lignum and @Lemmmy for devising this scheme, and helping
test and review it! ♥
This commit is contained in:
Jonathan Coates
2020-05-05 13:05:23 +01:00
committed by GitHub
parent 1547ecbeb3
commit 70b457ed18
8 changed files with 367 additions and 12 deletions

View File

@@ -50,12 +50,12 @@ public final class FixedWidthFontRenderer
{
}
private static float toGreyscale( double[] rgb )
public static float toGreyscale( double[] rgb )
{
return (float) ((rgb[0] + rgb[1] + rgb[2]) / 3);
}
private static int getColour( char c, Colour def )
public static int getColour( char c, Colour def )
{
return 15 - Terminal.getColour( c, def );
}