FWGS / xash3d

DEPRECATED in favor of https://github.com/FWGS/xash3d-fwgs. Only bugfixes are accepted.
https://xash.su
GNU General Public License v3.0
549 stars 107 forks source link

Add support for DirectX or Vulkan #376

Closed simxo closed 6 years ago

simxo commented 6 years ago

Hi, this is a suggestion for the Xash3D engine and a issue regarding AMD cards.

I've benchmarked HL1 games such as Counter-strike 1.6 on my AMD gfx card testing all different drivers and .dlls (tens of them) for my AMD graphics card (2GB, GDDR5) with my 4 core AMD CPU and different Windows versions both 32 bit and 64 bit, and I've had friends with AMD to aswell benchmark like I did with AMD, and with NVIDIA. A friend had a more powerful CPU (8 core) and GPU (4GB, GDDR5) AMD like me, 100% more powerful GFX and CPU than mine. And yet he got 5%~ less fps than I did. Because the game is obviously not multithreaded. but more importantly, this!

"The GPU doesn't matter because AMD doesn't utilize OpenGL to it's max potential like NVIDIA do so it will bottleneck seriously. This is a big limit/issue. It doesn't matter so much how powerful your CPU is in single-threaded performance for games, your AMD graphics card will still hold you back by 200-300 fps"

AMD has bad drivers for OpenGL generally and suffers fps drops especially in GoldSrc games. You can see this by going to open-world maps with big towns and viewpoint. E.g. map: awp_rooftops for CS 1.6. Go to the worst possible location you can find for your fps in the map and you'll see it will even go down to 100fps, compare it to Nvidia and you will have way more. On Nvidia it'll be about a ~250% increase more even with a weaker GPU. This can be big issue/limit when you're modding and you have users that play with AMD, I had a old Nvidia card and dual core CPU and less ram, and had possibly 120-200% fps more than this.

The solution to this problem: Would be to either to Implement DirectX like in Source engine or Vulkan shown to increase AMD's graphics performance by up to 100% from OpenGL in Doom 4 - ("Also note, that when Vulkan support was added to Doom, some AMD saw almost double the performance over OpenGL (which it was running on at launch), while Nvidia didn't gain that much of a performance gain" link to thread: amd opengl issue) I get way more fps in Source Engine, 300% more~ than in GoldSrc, this is wrong, because of OpenGL.

All new AMD graphics card are affected! ~Atleast from 2012. Mine graphics card is from 2012. I don't know about older AMD graphics card. They are most likely probably affected too.

If you need more info, tell me. Anyone with a AMD card can test this by going to big (open-world) maps. If you don't believe me have your friend with Nvidia to go to the same place and he will have much more fps by a margin. I don't know how it's currently with Xash3D's engine, but I guess it's the same as it's using OpenGL like GoldSrc. That's it.. long text, hopefully you'll come with a suggestion or insight into this. Wanna hear what you think.. If it's too much work for to implement in Xash3D or if you are having issues yourself. Another question I have is, when will Xash3D completely support CS 1.6?

Thanks, hopefully it gave you some insight with AMD and OpenGL games

a1batross commented 6 years ago

Multiple renderers requires serious changes in engine architecture. It's obviously not possible at this time. The only thing I can recommend is to use software like QindieGL, which translates OpenGL calls to Direct3D.

Xash3D FWGS already fully supports CS 1.6 game logic. Client DLL cannot be loaded due to missing features, which will not be implemented in near future. However, we made cs16-client. But I don't have plans to make cs16-client for PC platforms.

simxo commented 6 years ago

a1batross Multiple renderers requires serious changes in engine architecture. It's obviously not possible at this time. The only thing I can recommend is to use software like QindieGL, which translates OpenGL calls to Direct3D. ...

I'm not sure if I may be able to add that myself with no knowledge about existing Xash3D code and OpenGL generally. EDIT: I did not see that you could just put the .dll of QindieGL into the game folder (had to use older version though) and it worked. I benchmarked and the result was a loss of 25fps out of 100fps so it didn't work as a alternative method. Anyway the cs16-client in future for PC platforms would be very cool, as without it, you can't run Xash3D CS 1.6 full in a box without extra code/configuration, It'd be cool with having it as it would make CS 1.6 a new experience, a complete new game using Xash3D. Well so you said DirectX takes alot of changes, I guess that is no solution then at this time. I suppose Vulkan would be easier to add, but would still add plenty of work then I assume.

Thanks for your answer.

a1batross commented 6 years ago

Vulkan is completely different too. And also there is no known working OpenGL 1.x wrappers around Vulkan.

mittorn commented 6 years ago

I think, there must be gles2->vulkan wrappers and you can use gl_wes_v2 But usually opengl driver doing similar translatioon better. And for dx: you may use angle with gl-wes-v2 (for newer dx versions) or fakegl There are fakegl xash3d ports. Try use it. We not interested to implement or test these configurations now.

simxo commented 6 years ago

Okay, thanks for all the answers. I was curious and went to load the same map on CS 1.6 under Half-life Xash3D, it loaded successfully. I just wondered, the fps is capped at 200, do Xash3D support a fps over 200? Or do I have to run the Steam version of Half-Life? Because Half-Life WON is capped at 100 only. I'd want to get a fps over 200 so I can see if I'm getting more fps in Xash3D than the original HL1 engine, even though I know both use OpenGL, I wanna try.

a1batross commented 6 years ago

FPS cap is controlled by fps_max in console. Hardcoded cap is 500.

Half-Life itself isn't designed for high FPS values. It may break monsters AI, breaks their movement and breaks player movement code.

simxo commented 6 years ago

Wow, I didn't notice that I did actually get 50+ (up to maybe 200?) fps more in Xash3D than in original GoldSrc engine on same map as I tested in CS 1.6 (even though both use OpenGL) this means that Xash3D doesn't suffer bad fps for AMD cards I think!

I just recently tested by loading CS 1.6 map on Half-Life. This means that Xash3D renders better for AMD cards than the GoldSrc engine, maybe because it's using newer OpenGL libraries and renders differently? I didn't know this until now, this is good news. Fps is capped at 200 for me (for some reason, Update: used older xash3d engine (not fwgs) so tried newest version and fps was no longer capped) I'm using WON to test this, from 150 in CS 1.6 to a fps of 255 (old result 200 when fps was capped) in Xash3D, fps_max 999, fps no longer capped when I used newest xash3d so getting 255 fps, which is pretty good compared to that of CS 1.6.

But anyway it's clear I'm getting more fps in Xash3D than in GoldSrc engine. This is very good. And all this I talked about before in this thread may not be a trouble in Xash3D because AMD has better drivers for newer OpenGL versions. As it looks like Xash3D seem to be using or differently coded renderer.

There were only texture errors (not loading textures) on the CS 1.6 map running under Half-Life but that shouldn't matter. It's clear Xash3D gives me more fps! So Xash3D can be a solution to low fps with AMD cards in CS 1.6 or all GoldSrc games (big maps, only that you have to play on insecure/non VAC servers right? I guess) + there's no current PC/Windows support for 1.6. anyway I'm supporting/donating to Xash3D for this reason whatever you will do, if you have no plans to port cs16-client for PC.. I understand that, Thank you, anyways! :).

mittorn commented 6 years ago

recent Goldsrc using FBO to scale rendered image. Maybe it's reason of getting lower fps with it. Also, recent Xash3D uses DrawElements to draw studiomodels and VBO for bsp

nekonomicon commented 6 years ago

@simxo, have you tested original xash3d or xash3d fwgs? Some users wrote about bug with fps cap (limit in 200fps)in the original xash3d.

simxo commented 6 years ago

nekonomicon have you tested original xash3d or xash3d fwgs? Some users wrote about bug with fps cap (limit in 200fps)in the original xash3d.

Yes, you are right. Not fwgs. Thank you. I was using a older version of xash3d (I followed installation guide on moddb) so it was old version: v0.99. I now tested benchmarking again with xash3d fwgs (with no more fps cap) and I got 255 fps. Compared to 150 fps in CS 1.6. So Xash3D is giving me 100 more fps finally than GoldSrc engine on my AMD graphics card. Pretty signifcant. Thanks. Good job on xash3d dev team.

a1batross commented 6 years ago
#define MAX_FPS             200.0       // upper limit for maxfps.

From Xash3D build 4097. Just for reference. :)