3266 Commits

Author SHA1 Message Date
Kawe Mazidjatari
57feab706c Add NVIDIA NvAPI legal notice
Should be in the thirdpartylegalnotices.txt we ship with builds.
2023-09-16 17:45:38 +02:00
Kawe Mazidjatari
00e79268d7 Fix infinite memalloc exploit in NET_SetConVar
Reported by Wanderer. Don't allow the creation of new ConVar entries in CClient::m_ConVars after the initial creation.
2023-09-16 16:18:18 +02:00
Kawe Mazidjatari
ee3560e722 Reimplement 'KeyValues::FindKey(...)'
Reimplement.
2023-09-16 16:13:14 +02:00
Kawe Mazidjatari
66daec04db Fix compile errors in non cert builds 2023-09-16 13:10:12 +02:00
Kawe Mazidjatari
c9637196b8 Improve CEngineAPI signatures 2023-09-16 13:09:22 +02:00
Kawe Mazidjatari
140270f426 Fix infinite recursion
Bug introduced in recent commit 1d41b23a.
2023-09-16 13:08:56 +02:00
Kawe Mazidjatari
5bab1bc6af Move CClient pointer adjuster to separate function
All process methods have a shifted CClient pointer, so this will be used more often.
2023-09-16 12:18:32 +02:00
Kawe Mazidjatari
1d41b23abb Make sure language is never NULL
* Initialize CPylon::m_Language to "english".
* Make sure cvar change callback is always setting values instead of returning out early.
2023-09-16 00:45:11 +02:00
Amos
0634261c18 Move global language constants to single file
Deduplicate.
2023-09-15 18:25:31 +02:00
Amos
95cd34eb23 Replace hardcoded sleep threshold constant
Replaced with a cvar.
2023-09-14 09:17:03 +02:00
Kawe Mazidjatari
1874443425 Disable NVIDIA Reflex Boost by default
Default the implementation to On, as per the documentation.
2023-09-14 00:02:37 +02:00
Kawe Mazidjatari
cdf03d8df7 Add UI settings cvar for NVIDIA Reflex
Required for settings scripts to work.
2023-09-14 00:01:33 +02:00
Kawe Mazidjatari
75e585ddeb
Merge pull request #112 from Mauler125/nvidia_reflex_timing
Nvidia reflex timing
2023-09-13 22:41:35 +02:00
Kawe Mazidjatari
eaa5347fa3 Only run NVIDIA Reflex if the display driver vendor is NVIDIA
This is to ensure we don't cause any performance hits when running the game on an AMD or Intel GPU.
2023-09-13 22:24:59 +02:00
Kawe Mazidjatari
a639a4befd Add 'CMaterialDeviceMgr' singleton to SDK
Manager class for display adapters.
2023-09-13 22:22:25 +02:00
Kawe Mazidjatari
d0887da27a Cleanup
No longer used.
2023-09-13 22:20:56 +02:00
Kawe Mazidjatari
688a76c358 Use correct types for frame numbering
Structure contains an NvU64 type for frame ID, use this type instead. Also no need to worry about overflowing it, as it would just 'wrap around'.
2023-09-13 17:42:47 +02:00
Kawe Mazidjatari
907e582f55 Remove latency markers
Some parts of the engine have to be rebuild in order to implement this correctly, therefore, it has been removed for now to avoid potential performance problems.

fps_max_rt and fps_max_gfx have been limited to 295 to avoid a contest with the engine's hard limit causing huge performance hits.
2023-09-13 17:37:09 +02:00
Kawe Mazidjatari
4927654da0 Bugfix: only run NVIDIA Reflex if we ran an actual engine frame
CEngine::Frame() tends to return out early if we are ahead of frame time, and therefore need to sleep. In this particular engine, CEngine::Frame() returns true if it had actually executed an engine frame, else it returns false.

Therefore, we end up calling 'NvAPI_D3D_Sleep()' multiple times a frame, and thus causing a major loss in performance. Now we check if we have actually ran a frame (incrementing reflex frame if so). If the frame was not incremented, but 'GFX_RunLowLatencyFrame()' was called, it will not call 'NvAPI_D3D_Sleep()'.

Code has been tested and appears to work on my system (never called twice or more per frame). Needs more testing on other systems to make sure its good.
2023-09-12 20:50:38 +02:00
Kawe Mazidjatari
c8dea8927c Force rebuild of sigcache
Signatures changed and need to be force rebuild.
2023-09-12 17:45:17 +02:00
Kawe Mazidjatari
384ad649bf Update CEngineAPI::PumpMessages() signature
Function has been modified internally.
2023-09-12 17:44:58 +02:00
Kawe Mazidjatari
51a3f4a1c4 Only call 'NvAPI_D3D_SetSleepMode(...)' on pending changes
No need to keep calling this if there are no pending changes.
2023-09-12 17:44:24 +02:00
Kawe Mazidjatari
b87d7bf1c3 More improvements to the comment
Make a bit more sense.
2023-09-12 17:13:12 +02:00
Kawe Mazidjatari
bf29365e04 Fix typo
Should be tick as its possible to run more frames per simulation tick.
2023-09-12 17:09:19 +02:00
Kawe Mazidjatari
bcf7d03d90 Properly place PC_LATENCY_PING marker
Call once we peeked a message.
2023-09-12 13:20:13 +02:00
Kawe Mazidjatari
ea6c15df4c Initial implementation of NVIDIA Reflex Low Latency timing
Propagated latency markers in an attempt to further reduce input latency. Code is pending rigorous testing on several systems, including systems powered by an AMD GPU to make sure we are not impacting performance on systems that does NOT support NVIDIA Reflex.
2023-09-12 11:06:16 +02:00
Kawe Mazidjatari
9df90d4a25 Add cvar for low latency timing (work in progress)
Work in progress NVIDIA Low Latency timing implementation.
2023-09-12 00:19:47 +02:00
Kawe Mazidjatari
804f96625b Move NVIDIA Reflex implementation to library function
Improve code, there will be more NVIDIA GeForce related stuff soon.
2023-09-12 00:08:46 +02:00
Kawe Mazidjatari
85de096f98 Take into account television refresh rates
TV's tend to output @59.939999 FPS, set out frame limiter's to that if FPS happens to be 59 or 60.
2023-09-11 22:48:28 +02:00
Kawe Mazidjatari
1baaf25929 Fix typo in help strings for newly added cvars
Small typo.
2023-09-11 22:23:07 +02:00
Kawe Mazidjatari
07dade5d5d Implement high precision frame limiter
Limits frames at a much higher level of precision than 'fps_max' and 'fps_max_gfx', probably ideal to reduce input latency even more. Also changed the logic of the NVIDIA Reflex frame limiter, to which it would use the desktop's refresh rate if set to '-1'. The new render thread frame limiter has a similar behavior. Using desktop refresh rates on the render thread or NVIDIA Reflex frame limiter requires 'fps_max' to be set to 0 (unlimited), as it would otherwise result in a major performance drop due to a contest if fps_max_(gfx/rt) is set to a similar number as fps_max.
2023-09-11 22:20:24 +02:00
Kawe Mazidjatari
fdb4a4d429 Reverse CGame class
Class structure reversed.
2023-09-11 20:38:18 +02:00
Kawe Mazidjatari
0306d7788b More reversed TEB64 structure 2023-09-11 01:32:11 +02:00
Kawe Mazidjatari
0fe7b40506 Add inline DX device getters 2023-09-11 01:28:17 +02:00
Kawe Mazidjatari
ee1a2c5207 Add time globals 2023-09-10 11:41:50 +02:00
Kawe Mazidjatari
bf01287129 Add cvar for NVAPI frame limiter
Might be useful for someone.
2023-09-10 01:44:04 +02:00
Kawe Mazidjatari
fce3b1f46a CCrashHandler: small code cleanup 2023-09-09 20:57:23 +02:00
Kawe Mazidjatari
3fd898bf30 Fix crash during RPak load
* Added missing parameter to 'PakLoadFuncs_s::WaitAsync'.
* Fix offset to 'g_pakLoadApi'.
2023-09-09 20:57:00 +02:00
Kawe Mazidjatari
6215fd5dc6
Merge pull request #111 from Mauler125/nvidia_reflex
NVIDIA Reflex Low Latency
2023-09-09 15:20:09 +02:00
Kawe Mazidjatari
21093ca1a1 Implement NVIDIA Reflex Low Latency technology 2023-09-09 15:12:58 +02:00
Kawe Mazidjatari
00aee57e7c Add NVIDIA SDK 2023-09-09 14:50:11 +02:00
Kawe Mazidjatari
9cfc2b4b6a Use actual pakLoadApi pointer
Actual pakLoadApi pointer used internally.
2023-09-08 23:52:00 +02:00
Kawe Mazidjatari
f0bbc7dbf0 Change logging context
Should be engine.
2023-09-07 22:46:12 +02:00
Kawe Mazidjatari
942e2c2a74
Merge pull request #110 from O-Robotic/json-validation
Validate json root is an object before trying to retrieve members
2023-09-07 21:56:15 +02:00
O-Robotic
51dd17ad2a Validate json root is an object before trying to retrieve members from it. 2023-09-07 20:32:09 +01:00
Kawe Mazidjatari
5c3b7d1b56 Enable SIMD optimizations for RapidJSON 2023-09-07 11:18:00 +02:00
Kawe Mazidjatari
b85003a9ac Replace JSON library with RapidJSON
Less copies and overall CPU time parsing/constructing JSON's as we are mostly still using string pointers rather than STL string container.
2023-09-07 11:17:05 +02:00
Kawe Mazidjatari
bc59f1349d Use CUtlVector for map list 2023-09-05 17:34:22 +02:00
Kawe Mazidjatari
a994da728d Fix compile error
GetDouble has been removed.
2023-09-04 09:49:15 +02:00
Kawe Mazidjatari
7e247d9943 Create separate cvar to enable Base_CmdKeyValues netmsg's
The server can exploit the client with these netmessages, therefore, sv_cheats shouldn't be used to toggle it. Create a cvar that the server and client have to enable individually to enable the system.
2023-09-04 09:48:47 +02:00