Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high resolution VESA 2.0 Graphics modes with improved debugging and build facilities #161

Merged
merged 5 commits into from
Jan 9, 2024

Conversation

dougvj
Copy link
Contributor

@dougvj dougvj commented Jan 8, 2024

Resolves #81

Paves way for #140 and mitigates #160

Captured Footage Demo

https://www.youtube.com/watch?v=pgIRHeQ0e_g

New Features to Rendering

  • Avoid all hard coded references to screen size in VESA relevant code, screen size can be set by defines (as long as there is a MulX for screen width). Build adds the following new VESA binaries: 320x240 512x384 640x400 640x480 800x600 1024x768 1280x1024 in both real and direct modes.
  • Optional pixel scaling for patches (IE UI and Hud). Enabled by default for all new modes except 312x512
  • Preserve layout of UI elements relative to standard 320x200 mode: Centered status bar, text pinned to top left and top right, minified status in bottom left, and centered intermission/start/end screens. No need to maintain list of offsets for each resolution
  • Auto detect CPU renderer when not set in config

Features added to debugging

The many ways in which rendering could write off the end of screen memory when trying to make these changes and corrupting things later in execution prompted some time spent on adding the following features:

  • Stack trace output from parsed *.map file, ability to do symbol look up arbitrary pointers, useful for outputting which render functions are enabled
  • Asserts, including bounds checking for rendering (only in debug mode and configurable)
  • New configurable output channels besides MDA: Serial port, Bochs E9 (Supported by Dosbox-x), and text mode screen (for stack traces)
  • I_Error when out of zone memory

Build features added

  • Separate options for NASM and CC (necessary for configuring stack frames and debug symbols)
  • Optional GNU Makefile along side Watcom makefile, allows for much much faster parallel builds. Enabled by default in build.sh
  • build.sh has additional sanity checks (IE, does wmake exist?)
  • buildall.sh automatically derives list from build.sh

Tested hardware configurations

The following hardware configurations were tested by myself:

Pentium 60 with S3 Trio, ran at 800x600
Pentium 133 with Cirrus Logic chip Running up to 1024x768, required UniVBE
Pentium 400 and ATI Rage PRO

Benchmarks

  • I spot tested before and after benchmarks on real hardware and the differences were within a margin of error, but needs more verification and datapoints.

Known issues

  • Wipe effect setup time with (IE, with mallocs, copies, and column major order) makes the effect lag on startup on high res modes, and skews the tick rate significantly.
  • Background around intermission/end screens isn't always properly cleared to black
  • On higher res modes, we run out of zone memory due to many large mallocs of screen buffers. We technically have enough memory to do, IE, the wipe effect but fragmentation causes a contiguous region to fail to materialize after a few wipe screens. Recommend -ram parameter.

dougvj added 5 commits January 8, 2024 03:40
    - Ability to parse MAP file at runtime
    - Ability to dump backtrace
    - More debugging channels (serial, bochs E9, screen backtrace)
    - Asserts and bounds checking facilities
- Added many fastmath routines for additional resolutions
- Removed all hardcoded references to resolution
- Allow pixel doubling for UI/HUD elements (Selectable via define)
- Introduce center screen offset calculations
- Create fastmath macros for asm code for switchable resolutions
- Improved option defines to enable granular options based on
  environment (IE, Debug, BUild type). This includes separating the
  option defines for NASM and WCC
- Duplicate Makefile with a GNU compatible one, use it by default with
  parallel builds (-j $(nproc)).
- Setup build.sh to check for dependencies and select the proper make
Avoids the problem encountered in viti95#160
@dougvj
Copy link
Contributor Author

dougvj commented Jan 8, 2024

@viti95 I would be happy to go over these changes in more detail and welcome any feedback you might have.

@viti95
Copy link
Owner

viti95 commented Jan 8, 2024

OMG this is huge and awesome! I'll try to review this PR as soon as possible, although I will be very busy next weeks as my girlfriend goes under surgery tomorrow. From what I've seen from the video it looks incredible.

@viti95
Copy link
Owner

viti95 commented Jan 9, 2024

Checked everything and looks pretty good to me. I'll try in the next days on my 386 / 486 systems, impressive work!

@viti95 viti95 merged commit 32db97e into viti95:master Jan 9, 2024
@viti95
Copy link
Owner

viti95 commented Jan 9, 2024

I've done some testing on real hardware, it works really well.

https://twitter.com/viti95/status/1744676438869975266?t=ErowQOPdBb_LCyh97foLdw&s=19

There is only one bug I've found on my eBox Vortex86MX, it seems that VRAM is not initialized at start, so it shows garbled pixels on the Doom title screen (right and down) on modes that don't fill the screen (I'll try to post the image later).

@dougvj
Copy link
Contributor Author

dougvj commented Jan 12, 2024

OK thanks for the report. I will spend some time testing this on some other machines and addressing other issues over the coming weeks (VESA 3.0 Refresh rate, Frame Interpolation, etc)

@viti95
Copy link
Owner

viti95 commented Jan 19, 2024

I think I've fixed most of the bugs I've found for VESA modes, just missing the Episode 3 final scroll image, this will take me a bit more time. Also I did a small test release to see people's reaction and help us finding bugs. I'll probably try to add support for 1280x800 resolution, as is a perfect fit (4x resolution both horizontal and vertical), and modify current 1280x1024 mode to apply 4x resize for the status bar.

@dougvj
Copy link
Contributor Author

dougvj commented Jan 28, 2024

Thanks for fixing those bugs.

I haven't yet circled back to some of the other enhancements I want to add regarding dynamic linking, animation interpolation, and vesa 3 support, but it's still on my radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enhacement: 640x400 resolution
2 participants