VOGONS


First post, by thp

User metadata
Rank Member
Rank
Member

In a different forum, the question came up if it's possible to measure FPS for Glide API games (like Fraps does for OpenGL and Direct3D games). Here's my take on the challenge (please let me know if there's already such a tool 😀), it provides a drop-in glide2x.dll and will forward all Glide calls to the "real" glide2x.dll which should be renamed to glide2y.dll. I tested this on Windows 98 SE with the Wing Commander Prophecy 3Dfx Test and dgVoodoo, but it should work with any Glide 2.x game and a real Voodoo (but I haven't tested it).

What the modified glide2x.dll will do is forward all calls to glide2y.dll, except for grBufferSwap(), which will first count FPS, and every second write a new line to "fps.txt" with the current FPS, and then call the "real" grBufferSwap() to update the screen. So after running a game, it's possible to look what the FPS were by opening fps.txt.

In the future, it would be possible to also render the FPS on-screen, but it needs some tracking of the Glide state machine (in a test, I was already able to render something, but it requires forcing the Glide state, disabling rendering features such as depth testing, blending, fog and chroma keying).

Attachments

  • Filename
    glidefps-2018-09-28.zip
    File size
    20.82 KiB
    Downloads
    206 downloads
    File comment
    Glide FPS DLL
    File license
    Fair use/fair dealing exception

Reply 1 of 19, by vvbee

User metadata
Rank Oldbie
Rank
Oldbie

Fraps hooks its dll through the windows api rather than replacement, any reason for not taking this approach?

When I looked at implementing an fps overlay, I found it's a bunch of tedious work the details of which you need to chase down. Hope people appreciate it.

Reply 2 of 19, by thp

User metadata
Rank Member
Rank
Member
vvbee wrote:

Fraps hooks its dll through the windows api rather than replacement, any reason for not taking this approach?

No particular reason other that I'm unfamiliar with the Win32 API, and haven't found the Windows equivalent of LD_PRELOAD and dlsym(RTLD_NEXT, ...). Do you have any pointers what the Windows API for hooking into (one or more) functions by name/library is? I only found "Detours" which seems a bit overkill, and "AppInit_DLLs", which seems a bit intrusive, so I stuck with this weird brute-force approach.

I'd love to use a more standard approach, so any pointers would be helpful.

vvbee wrote:

When I looked at implementing an fps overlay, I found it's a bunch of tedious work the details of which you need to chase down. Hope people appreciate it.

Yeah, I got some overlay working already (forcing all internal Glide state so that I can just draw geometry on top), but would have to save/restore the Glide internal state (e.g. I disable depth testing when drawing the overlay, but obviously would need to restore it to its previous value or there will be rendering issues in the game if it doesn't reset depth testing state). Not impossible, but as you said tedious.

Reply 3 of 19, by vvbee

User metadata
Rank Oldbie
Rank
Oldbie

Maybe start there for fraps: https://web.archive.org/web/20150526181708/ht … ase-study-Fraps, and do keyword searches on google to fill in the blanks. My impression was that the people who know how to do it don't want others to have an easier time at it.

Reply 4 of 19, by thp

User metadata
Rank Member
Rank
Member
vvbee wrote:

Maybe start there for fraps: https://web.archive.org/web/20150526181708/ht … ase-study-Fraps, and do keyword searches on google to fill in the blanks. My impression was that the people who know how to do it don't want others to have an easier time at it.

Yeah, as I suspected, it hooks into /every process/ in the system, not something I want to do, but thanks for the link, it was an interesting link.

Here's an updated build, it now renders the FPS in the top left corner, source code is included as well in case anybody is interested.

How to use:

- Place glide2x.dll from the archive into the game's folder
- Copy the "real" driver (or wrapper) glide2x.dll as glide2y.dll into the game's folder
- Start the game

Attachments

  • Screen Shot 2018-09-30 at 20.22.06.png
    Filename
    Screen Shot 2018-09-30 at 20.22.06.png
    File size
    510.9 KiB
    Views
    5379 views
    File comment
    Need For Speed 2 SE Demo on Windows 98 SE with dgVoodoo
    File license
    Fair use/fair dealing exception
  • Screen Shot 2018-09-30 at 20.22.18.png
    Filename
    Screen Shot 2018-09-30 at 20.22.18.png
    File size
    577.98 KiB
    Views
    5379 views
    File comment
    Wing Commander Prophecy 3Dfx Test on Windows 98 SE with dgVoodoo
    File license
    Fair use/fair dealing exception
  • Filename
    glidefps-2018-09-30.zip
    File size
    30.7 KiB
    Downloads
    159 downloads
    File comment
    Glide FPS Overlay 2018-09-30 + Source Code (VC++6)
    File license
    Fair use/fair dealing exception

Reply 5 of 19, by meljor

User metadata
Rank Oldbie
Rank
Oldbie

Amazing stuff man! Downloaded and will be testing this soon, very much appreciated!

asus tx97-e, 233mmx, voodoo1, s3 virge ,sb16
asus p5a, k6-3+ @ 550mhz, voodoo2 12mb sli, gf2 gts, awe32
asus p3b-f, p3-700, voodoo3 3500TV agp, awe64
asus tusl2-c, p3-S 1,4ghz, voodoo5 5500, live!
asus a7n8x DL, barton cpu, 6800ultra, Voodoo3 pci, audigy1

Reply 6 of 19, by vvbee

User metadata
Rank Oldbie
Rank
Oldbie
thp wrote:

Yeah, as I suspected, it hooks into /every process/ in the system, not something I want to do, but thanks for the link, it was an interesting link.

Why not? Fraps did, and who doesn't use fraps.

Reply 7 of 19, by omarsis

User metadata
Rank Newbie
Rank
Newbie
vvbee wrote:
thp wrote:

Yeah, as I suspected, it hooks into /every process/ in the system, not something I want to do, but thanks for the link, it was an interesting link.

Why not? Fraps did, and who doesn't use fraps.

Does that means it make it slower?

Reply 9 of 19, by Gamecollector

User metadata
Rank Oldbie
Rank
Oldbie

@thp: glide3x version, please?

Asus P4P800 SE/Pentium4 3.2E/2 Gb DDR400B,
Radeon HD3850 Agp (Sapphire), Catalyst 14.4 (XpProSp3).
Voodoo2 12 MB SLI, Win2k drivers 1.02.00 (XpProSp3).

Reply 10 of 19, by thp

User metadata
Rank Member
Rank
Member
Gamecollector wrote:

@thp: glide3x version, please?

Does the current Glide 2x version work with real Voodoo cards and games? Are there any games that need fixing? Are there any freely available Glide 3 game demos that I could use for testing? Not sure if I will find time, but having a demo game for testing and knowing that the 2x version actually works for people would go a long way 😀 (Also, is there a Glide wrapper that supports Glide 3? I think at least dgVoodoo does not?).

Reply 11 of 19, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie
thp wrote:

Are there any freely available Glide 3 game demos that I could use for testing? Not sure if I will find time, but having a demo game for testing and knowing that the 2x version actually works for people would go a long way 😀

Turok 2 and NFS Porche 2000 free demos have Glide3x.
Or, any game demos that use 3Dfx OpenGL, not miniGL. 3Dfx OpenGL driver wraps into Glide3x. For eg. Quake 3 Arena.
I used them to checkout Glide3x on QEMU 3Dfx Glide pass-through.

thp wrote:

(Also, is there a Glide wrapper that supports Glide 3? I think at least dgVoodoo does not?).

DgVoodoo2 and nGlide support Glide3x.

Reply 12 of 19, by thp

User metadata
Rank Member
Rank
Member

I tested it with a real Voodoo2 today. It works, but on some games that use the lower-left origin coordinate system (as opposed to the top-right origin coordinate system), the overlay appears in the lower left and is flipped vertically. Should be easy to fix, I hope..

Reply 13 of 19, by thp

User metadata
Rank Member
Rank
Member

Updated build with support for GR_ORIGIN_LOWER_LEFT (version 2018-10-18, including source code), attached. No Glide 3.x support at the moment.

Attachments

  • Filename
    glidefps-2018-10-18.zip
    File size
    31.43 KiB
    Downloads
    176 downloads
    File comment
    Glide 2.x FPS Overlay, version 2018-10-18
    File license
    Fair use/fair dealing exception

Reply 14 of 19, by lost77

User metadata
Rank Member
Rank
Member

This sounds interesting. Does this work with any version of glide2x.dll?

How hard would it be to implement writing values to a file on disk, initialized and stopped by e.g. scroll lock? And then do an average of the values (like Fraps)?

I'll be putting together a Voodoo 2 SLI build when I have a bit more time and will definitely try it out.

Reply 15 of 19, by thp

User metadata
Rank Member
Rank
Member
lost77 wrote:

This sounds interesting. Does this work with any version of glide2x.dll?

Yes, it only hooks officially documented Glide 2 API functions, so should be independent of the version of glide2x.dll (I've only tested with Voodoo2 "FastVoodoo" drivers and the dgVoodoo wrapper, though).

lost77 wrote:

How hard would it be to implement writing values to a file on disk, initialized and stopped by e.g. scroll lock? And then do an average of the values (like Fraps)?

The version from the initial post in this thread ("glidefps-2018-09-28.zip") already writes the FPS (once per second) to "fps.txt", that you can then process however you like, doing averages/minimum/maximum/whatnot (the initial version doesn't include the overlay text, though). The source is attached in the latest builds if you want (just needs VS6 + Glide SDK to build), it should be relatively easy to re-add the file writing there.

Reply 17 of 19, by vlask

User metadata
Rank Member
Rank
Member

Just tested few games on Voodoo 1 4MB and here are results....
1]youve gotta rename glide2x.dll in windows/system directory if you have win98se as most games have not included this dll in its own directories
2]GLQuake with 3dfx minigl patch - ok
3]Carmageddon II - ok
4]Subculture - ok
5]Turok demo - ok
6]MDK - numbers are not refreshing properly, its mess, looks like old values are not deleted, impossible to measure
7]Croc - have some issues with glide mode with blinking textures, i guess its problem with too fast cpu, fps counter works

One question - is it possible to recompile dll and make alternate version with fps showing in right top corner instead of left one? Might help me a lot, as i wont need recapture all videos from games.

Not only mine graphics cards collection at http://www.vgamuseum.info

Reply 18 of 19, by ruthan

User metadata
Rank Oldbie
Rank
Oldbie

Glide3 support would be really nice, especially now with PCem Voodoo emulation.

Im old goal oriented goatman, i care about facts and freedom, not about egos+prejudices. Hoarding=sickness. If you want respect, gain it by your behavior. I hate stupid SW limits, SW=virtual world, everything should be possible if you have enough raw HW.