vgaonly - 16-bit RGB?

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

vgaonly - 16-bit RGB?

Postby Great Hierophant » 2019-6-02 @ 18:38

I found out yesterday that with all standard machine types in DOSBox, color is output and recorded in an 8-bit palettized format except for vgaonly, which is 16-bit RGB. 16-bit RGB per pixel only covers 1/4 of the colors standard VGA can display. Standard VGA allows the Red, Green and Blue levels of a pixel to be independently selected with 6-bits for each color component. This gives 18-bits of RGB color information in total for each pixel. 18-bit gives 262,144 color choices whereas 16-bit gives only 65,536 colors.

vgaonly is typically used when you need to display video that can alter display parameters by scanline. Games that need it to display correctly are Lemmings/Oh No More Lemmings and Pinball Fantasies. Some demos like Copper will break without it. But the colors produced are not necessarily accurate to the hardware. The standard machine types should transform 18-bit RGB to 24-bit RGB for accurate color display.

Can vgaonly be displayed in 24-bit RGB? I understand that when vgaonly was created back in the mid-2000s, PCs weren't quite as powerful as they are today. But they should be sufficiently powerful in 2019 to manage the extra overhead. Is there another reason for the limitation?
http://nerdlypleasures.blogspot.com/ - Nerdly Pleasures - My Retro Gaming, Computing & Tech Blog
User avatar
Great Hierophant
l33t
 
Posts: 2398
Joined: 2003-4-27 @ 08:20

Re: vgaonly - 16-bit RGB?

Postby ripsaw8080 » 2019-6-02 @ 20:04

It might actually simplify some parts of the code to use 32-bit (DOSBox doesn't really deal with 24-bit, AFAIK) output instead; but vgaonly is useful for some games as well as demos, so the volume of data for image and video capture probably is/was a consideration. The RGB565 (human eyesight is more sensitive to green so it is given the full 6 bits) transform is probably not easy to notice except in gradients where banding might be slightly more evident; but 256-color palette modes don't do smooth gradients very well, anyway.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4408
Joined: 2006-4-25 @ 23:24

Re: vgaonly - 16-bit RGB?

Postby Harekiet » 2019-6-03 @ 06:20

16 bit must have been faster back in the day maybe?
But seems like you waste a lot of time later during the blitter stage to convert it to 32bit again there.
User avatar
Harekiet
DOSBox Author
 
Posts: 1050
Joined: 2002-7-01 @ 07:14
Location: Fryslan

Re: vgaonly - 16-bit RGB?

Postby Scali » 2019-6-03 @ 07:40

ripsaw8080 wrote:It might actually simplify some parts of the code to use 32-bit (DOSBox doesn't really deal with 24-bit, AFAIK) output instead;


To get into the confusion of 24 vs 32-bit colour:
I think there are two separate meanings of 24-bit colour:
1) Any pixel format that uses RGB data, where each component is 8-bit.
2) Storing pixels of the form 1) in a format that actually takes 24-bits in memory, so 3 bytes per pixel (usually RGB or BGR).

In theory, there are also different kinds of 32-bit pixel formats (such as 10-bit per component RGB), but in practice everyone seems to mean a format with 8-bit per component, where the extra 8-bits are either for a 4th component used for alpha, or are just padding. So for example, you can have ARGB, RGBA, BGRA, XRGB, RGBX etc.

Meaning 1) is often interchangeable with 32-bit pixelformats with 8-bit per component.
There has only been a very short period of time where hardware actually supported 24-bit truecolour as in meaning 2). This was in the very early days of truecolour, where 24-bit packing of pixel data would make the most efficient use of memory, which was still a scarce resource.
The obvious disadvantage is that you are working with unaligned pixel data, which is inefficient to manipulate with the CPU. So as memory became cheaper, these 24-bit formats were abandoned, in favour of the more performance-efficient 32-bit formats.
Modern graphics APIs and drivers do not even support such 3-byte formats anymore.

As for 16-bit colour, this can also be somewhat confusing. Some vendors chose a 5:6:5 format, where others used a 1:5:5:5 format instead.

But yea, it should be reasonably trivial to make vgaonly work with 8-bit RGB components, and I see no reason why not.

Personally I think the scanline rendering of vgaonly should be applied everywhere (including Hercules, which can do raster effects, because you can switch memory banks mid-frame).
So if the scanline rendering and perhaps some other tweaks are migrated to the svga modes, I suppose vgaonly no longer has a real purpose (aside perhaps from emulating a machine that is 'strictly' VGA, no extra memory or other features).
Scali
l33t
 
Posts: 4373
Joined: 2014-12-13 @ 14:24

Re: vgaonly - 16-bit RGB?

Postby ripsaw8080 » 2019-6-03 @ 12:16

Great Hierophant wrote:Games that need it to display correctly are Lemmings/Oh No More Lemmings and Pinball Fantasies.

For mid-screen palette changes in those cases; however, vgaonly is also useful with games that use video blanking for various reasons, e.g. Alien Carnage / Halloween Harry.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4408
Joined: 2006-4-25 @ 23:24


Return to DOSBox Development

Who is online

Users browsing this forum: Qwantify [Bot] and 2 guests