VOGONS


First post, by Necrodude

User metadata
Rank Member
Rank
Member

Hello everyone!

I have a almost impossible task that I need help solving.
I am looking for the source code for the 3dnow patch for Quake 2 that AMD released back in 1998.

Here is the patch
https://www.moddb.com/games/quake-2/downloads … -minigl-updates

The reason I want the source code is that I have a custom faster quake2.exe that is compiled with VS2005, and I want to add 3dnow support.
You see. Me and my friends are hosting a tweaking competition. #Quake2ToTheMax. Tweak Quake2 and win a 3DFX Voodoo2 card.

https://www.youtube.com/watch?v=PldaM3mY_84&t
Tweak Quake2 and win a 3DFX Voodoo2 3D accelerator card

People are going all in and tweaking Quake2. And we are getting a lot of really nice stuff for the game.
So I figured I also want to add 3dnow support to the newly compiled exe:s that has been subitted from the competition participants.

I have looked all over the web for the source code. It is nowhere to be found. I even contacted AMD. But as expected they werent interested in helping me.
So I guess that we need to find the right people who worked back at AMD in 1998 and simply ask if they might have the source code in their possesion.
Or we need to find a dude that knows someone, that nows someone and so on.

Anyone up for the task? Any clues?

Reply 1 of 18, by elszgensa

User metadata
Rank Member
Rank
Member

Best of luck with that. In the meantime, how about decompiling the existing exe, looking at whereever any of the 3dnow instructions are used (hopefully there isn't too many places, and all the rest can be ignored), and trying to reproduce that within the source tree you already have? Or did you already try that and decided it was too much? -- edit: had a quick look just now. quake2.exe itself looks very doable, but once you go into any of the renderer dlls, unfortunately* there's a lot more changes.

Oh and maybe think about swapping the VS2K5 compiler out for a recent MinGW/gcc - 19 years of additional optimizations ought to gain you another percentage point or two.

*...unfortunate for this endeavour, that is. For a random player it's better, since it means they were thorough.

Reply 2 of 18, by Necrodude

User metadata
Rank Member
Rank
Member
elszgensa wrote on 2024-01-19, 19:17:

Oh and maybe think about swapping the VS2K5 compiler out for a recent MinGW/gcc - 19 years of additional optimizations ought to gain you another percentage point or two.

So you mean that if we compile the source code with MinGW/gcc we could get some extra performance compared with compiling with VS2005?
Sounds interesting 😀 .

Reply 4 of 18, by winuser_pl

User metadata
Rank Member
Rank
Member

What cpus do you plan to target? Are you aware 3dnow support is removed from amd cpus for almost 10 years or so?

Also if you compile with latest mingw you are limited to more modern cpus and operating systems.

PC1: Highscreen => FIC PA-2005, 64 MB EDO RAM, Pentium MMX 200, S3 Virge + Voodoo 2 8 MB
PC2: AOpen => GA-586SG, 512 MB SDRAM, AMD K6-2 400 MHz, Geforce 2 MX 400

Reply 6 of 18, by Gmlb256

User metadata
Rank l33t
Rank
l33t
Necrodude wrote on 2024-02-07, 20:49:

VS2005 works with windows98

Indeed, executables built with Visual Studio 2005 runs on Windows 98.

However, there are some minor inconveniences where the IDE can only be run starting from Windows 2000 SP4 and the built executables requires the Visual C++ 2005 Redist unless the runtime library is changed to "Multi-Threaded" (without the DLL part) in the project settings.

VIA C3 Nehemiah 1.2A @ 1.46 GHz | ASUS P2-99 | 256 MB PC133 SDRAM | GeForce3 Ti 200 64 MB | Voodoo2 12 MB | SBLive! | AWE64 | SBPro2 | GUS

Reply 7 of 18, by the3dfxdude

User metadata
Rank Member
Rank
Member
Necrodude wrote on 2024-02-07, 20:49:

The targeted cpu is amd:s K6-2 and K6-3 cpus. And the plan is to merge the code with our tweaked source code and recompile the code with VS2005. VS2005 works with windows98

GCC has the -march=k6-2 and -m3dnow compiler flags to let the compiler do the optimization. I've always kind of wondered how far you can get with that, when 3dnow has not been looked at much. Letting the compiler do it might be better than hand crafted 3dnow assembly.

Reply 8 of 18, by elszgensa

User metadata
Rank Member
Rank
Member
Gmlb256 wrote on 2024-02-08, 21:15:

the built executables requires the Visual C++ 2005 Redist unless the runtime library is changed to "Multi-Threaded" (without the DLL part)

If you want to get nerdy about dependencies... You can also link with certain object files from a WDK to avoid bloating your binaries by statically linking in the entire CRT and still only depending on good old msvcrt.dll. Here's a randomly chosen blog post about this.

Reply 9 of 18, by Necrodude

User metadata
Rank Member
Rank
Member
the3dfxdude wrote on 2024-02-08, 21:40:
Necrodude wrote on 2024-02-07, 20:49:

The targeted cpu is amd:s K6-2 and K6-3 cpus. And the plan is to merge the code with our tweaked source code and recompile the code with VS2005. VS2005 works with windows98

GCC has the -march=k6-2 and -m3dnow compiler flags to let the compiler do the optimization. I've always kind of wondered how far you can get with that, when 3dnow has not been looked at much. Letting the compiler do it might be better than hand crafted 3dnow assembly.

This sounds interesting. I am not sure where to start. What tools and programs do I need to do this? Any pointers?

Reply 10 of 18, by the3dfxdude

User metadata
Rank Member
Rank
Member
Necrodude wrote on 2024-02-10, 14:22:
the3dfxdude wrote on 2024-02-08, 21:40:
Necrodude wrote on 2024-02-07, 20:49:

The targeted cpu is amd:s K6-2 and K6-3 cpus. And the plan is to merge the code with our tweaked source code and recompile the code with VS2005. VS2005 works with windows98

GCC has the -march=k6-2 and -m3dnow compiler flags to let the compiler do the optimization. I've always kind of wondered how far you can get with that, when 3dnow has not been looked at much. Letting the compiler do it might be better than hand crafted 3dnow assembly.

This sounds interesting. I am not sure where to start. What tools and programs do I need to do this? Any pointers?

You'll want to get a distribution that provides GCC, like MinGW? You'll need to set up a new project build system it sounds like. If you want to run the newly compiled Quake 2 on Windows 98, you may want an older version of MinGW. With hacking, I was able to get recent MinGW to support WinXP, but I'm afraid about Win98, I haven't looked at it.

Reply 11 of 18, by elszgensa

User metadata
Rank Member
Rank
Member

Well, Cygwin includes a gcc, but you'll end up with dependencies you don't want/need, and I'm not sure about 3D API SDK support either... So I'd recommend getting yourself a MinGW compiler instead (e.g. TDM-GCC). You'll probably also need to convert your VS project into sth else (makefiles, CMake-files, ...). Or you can try to drive the compiler directly from VS, but seeing how the interfaces are completely different you're on your own there. Maybe there's addons to do it, no idea.

Reply 13 of 18, by the3dfxdude

User metadata
Rank Member
Rank
Member
Necrodude wrote on 2024-02-10, 19:23:

I found this when googling.

https://github.com/fsb4000/gcc-for-Windows98/ … s/tag/gcc11.1.0

But I have no idea what to do with it

Are you planning on compiling quake in Windows 98? I guess that could work. But the nice thing about seeing this, is that it gives a hint on what version of MinGW will be needed. So whether you compile on Win98 or you use a newer OS, probably some earlier MinGW-w64 4.0-ish version.

Also see this, as the person here mentions testing Windows 95 over a number of versions of MinGW:
https://glizda.wordpress.com/2021/05/19/compi … entium-in-2021/

Reply 14 of 18, by Necrodude

User metadata
Rank Member
Rank
Member
the3dfxdude wrote on 2024-02-10, 19:54:
Necrodude wrote on 2024-02-10, 19:23:

I found this when googling.

https://github.com/fsb4000/gcc-for-Windows98/ … s/tag/gcc11.1.0

But I have no idea what to do with it

Are you planning on compiling quake in Windows 98? I guess that could work. But the nice thing about seeing this, is that it gives a hint on what version of MinGW will be needed. So whether you compile on Win98 or you use a newer OS, probably some earlier MinGW-w64 4.0-ish version.

No not really.
Since I am a total noob I think I need a compiling program with a easy to use GUI that works in modern OS:s

Reply 15 of 18, by progman.exe

User metadata
Rank Newbie
Rank
Newbie

I had a bit of a mooch into this the other day, I never had a 3dnow chip back in the day, but did play a lot of Q2.

I concluded the 3dnow patch was provided by AMD, not id. So maybe written by AMD? And so AMD would own the copyright, I guess.

Considering how many mirrors there are out there of Quake2 stuff, surely the 3dnow code would be available somewhere if it had been released. But it really doesn't seem to be out there. The q2 source is widely available. So why no 3dnow? Perhaps id never released that code, because they simply never had it. Or did have the code but not the copyright, so could not release that detail.

I think this AMD page reflects the patch was an AMD thing:
https://web.archive.org/web/20010412105614/ht … uake/q2faq.html

The above page on archive.org did not last long, which I think means AMD were done with any support for Quake2 many years ago. I guess a Twitter hoard barraging AMD's support with requests might be the contemporary way of asking an uncooperative corporation for legacy data? But even so, all it takes is some lawyer to imagine that code has some secret that might be useful in the future, commercially, and no code for the users. I think we all know that a proprietary blob for a now obsolete and now GPL game will not provide info on a chip technology better than the info AMD otherwise have to make the damn chips. There is no reason to not release the code, other than some staff time and perhaps dusting off some old kit. They could recruit bloody volunteers from here to do that 😀

Reply 16 of 18, by elszgensa

User metadata
Rank Member
Rank
Member

So... I took a minute to compile Q2, using gcc 12.3, targeting k6-2, with heavy optimizations. The result was... underwhelming, to say the least. It emitted barely any 3dnow instructions at all - a handful of femms and prefetch here and there, and a single instance each of pfrcpit2, pi2fd, pfcmpge and pfrsqrt. If someone's gonna do this, it's gotta be manual.

Reply 18 of 18, by elszgensa

User metadata
Rank Member
Rank
Member

I didn't keep it, sorry. In fact it never even left the Linux box I cross compiled on, i.e. I have no idea whether it starts cleanly - examining the generated assembly was enough for me. I'll attach my Makefiles and changes though so you can do it yourself.

Attachments