joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.65k stars 377 forks source link

Hercules horizontal blend worse after version 2023.03.31. #5064

Closed thec0n closed 2 months ago

thec0n commented 2 months ago

Describe the bug

Hello, I had been using DosBox-X 2022.09.0 for playing QG1 on Hercules with horizontal blending (CTRL+F8) and decided to go for the latest DosBox-X version (currently at 2024.03.1). There, I noticed that there is no longer a horizontal blend, but something a bit different (high intensity), which produces a much less desirable effect (and not realistic, if I can remember correctly the ways of Hercules back in the day). During my tests, it doesn't matter if you use mingw or vs, 64-bit or 32-bit. The last version working is 2023.03.31. The first version with the problem is 2023.05.01 (up to the last available version: 2024.03.1). You may notice this difference on the files I attach (sorry for the crt shader): • 01_2023.03.31-normal.intensity.png (normal details, 1 shade of "color") • 02_2023.05.01-normal.intensity.png (99.9% same as 01, some pixels seem to be fixed on the right side, but some garbage at the bottom; everything not related to the matter at hand). • 03_2023.03.31-high.intensity.png ("correct" horizontal blend, details evident, 2 shades of "color") • 04_2023.05.01-high.intensity.png ("problematic" horizontal blend, details gone, I think I can also see 2 shades of "color", but it is MUCH worse than 03. The unrelated differences such as some pixels better rendered at the right but the existence of garbage pixels at the bottom, exist just as in 02).

Is the described problem about hercules horizontal blending a bug, or is it by design, changed after 2023.05.01? If any, the older version is much better IMHO, and closer to what I can remember.

01_2023 03 31-normal intensity 02_2023 05 01-normal intensity 03_2023 03 31-high intensity 04_2023 05 01-high intensity

Steps to reproduce the behaviour

Just run any hercules game (I only tested QG1, to be honest) with machine=hercules. Then press CTRL+F8 to activate hercules horizontal blend and see that details are lost (contrary to older builds of Dosbox-X).

Expected behavior

No response

What operating system(s) this bug have occurred on?

Windows 11 23H2

What version(s) of DOSBox-X have this bug?

2023.05.01+ all types

Used configuration

Typical configuration, with the following changes:
output=openglnb
machine=hercules
glshader=fakelottes.glsl

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

thec0n commented 2 months ago

Update: Removing the crt shader, I confirm that newer versions when employing the horizontal blend do not create 3 unique colors, as they should; they create only 2 colors, which probably confirms the bug report.

maron2000 commented 2 months ago

The change in vga_dac.cpp in commit https://github.com/joncampbell123/dosbox-x/commit/bc99b648ffd09de2c03943da8f4c8207aa892488 seems to be the reason. However, I don't know if reverting this will affect other games. @joncampbell123 do you have any observations?

vga_dac.cpp line 189

    else if (machine == MCH_MDA || machine == MCH_HERC) {
        /* the DAC mapping for MDA/Herc must be maintained or colors will not come out right */
#if 0  // current code
        if ((index&7) != 0)
            VGA_DAC_SendColor(index,(index & 8) ? 0xF : 0x7);
#else // reverted code
        if (index !=0)
            VGA_DAC_SendColor(index,(index & 1) ? 0x7 : 0xF); /* 1=>7, 2=>F Ref. vga_other.cpp function Herc_Palette() */
#endif

The upper screenshot is the latest commit, and the lower is when the above commit for vga_dac.cpp is reverted.

glory

joncampbell123 commented 2 months ago

The changes made to vga_dac.cpp were done to simplify how MDA/Hercules mode works in combination with HGC+ and InColor emulation. It normalizes the DAC layout to a 16-color mapping from the attribute bit according to how MDA/Hercules maps it from the attribute byte:

http://hackipedia.org/browse.cgi/Computer/Platform/PC%2c%20IBM%20compatible/Video/Hercules/HGC%2b/Hercules%20Graphics%20Card%20Plus%20Notes%20by%20John%20Elliott%20%282012%2d08%2d09%29%2ehtml

image

It was also done to solve some issues in DOSBox-X where at some point, triggered by I/O writes, the DAC mapping would change and make the MDA/Hercules display black and dark blue and other bugs.

If the shader was heavily dependent on the DOSBox SVN style {0,1,2} => {black, gray, white} mapping, I'm sorry.

joncampbell123 commented 2 months ago

If the shader works entirely on the color palette given, it will have to work with 0=black 1-7=gray 8=black 9-f=white instead of 0=black 1=gray 2=white.

maron2000 commented 2 months ago

Thanks for your comment. I didn't enable any shaders for the the screenshot I uploaded above. Anyway we have to find a solution to both this issue and the dark blue issue that you mentioned.

joncampbell123 commented 2 months ago

Got it. Should appear in the next nightly build.

dp_000