4674 Commits

Author SHA1 Message Date
Kawe Mazidjatari
18f2e27409 Engine: implement support for loading ui_mainmenu.rpak
For future updates, this allows for customizing the main menu to its full extend without modifying larger ui rpak files as we separate all title screen assets and put it into this new pak.
2025-01-09 17:08:47 +01:00
Kawe Mazidjatari
03dd7046a6 Engine: use correct format specifiers for edict_t
edict_t is an u16 and will always be as that is the type it uses in the engine itself.
2025-01-09 17:06:29 +01:00
Kawe Mazidjatari
eee6aed033 Engine: qualify functions as static where possible 2025-01-09 17:05:28 +01:00
Kawe Mazidjatari
ec9fc7d77f RTech: fix return type for 'PakLoadFuncs_s::WaitForAsyncLoad()'
WaitForAsyncLoad() returns a bool; returns false if pak status = PAK_STATUS_ERROR.
2025-01-09 17:03:45 +01:00
Kawe Mazidjatari
6827d1ed02 Tier0: make sure the memalloc singleton initializer is thread safe
Only enter code if the atomic exchange was performed.
2025-01-09 16:56:48 +01:00
Kawe Mazidjatari
716a3efa0c VGui: deprecate old texture streaming debug overlay
Replaced by the new imgui version which offers the ability to explore the real-time list, in commit c2deaaf3e8c50e08776e960934a161845f55addf.
2025-01-08 21:46:18 +01:00
Kawe Mazidjatari
c2deaaf3e8 DebugSurface: implement new texture streaming debug overlay
Implement a new imgui based texture streaming overlay. The old one typically clips out of the screen and cannot be explored.
2025-01-08 21:44:14 +01:00
Kawe Mazidjatari
74d8cdfb26 DebugSurface: don't run ImGui::Begin if we aren't visible
Small optimization.
2025-01-08 21:23:31 +01:00
Kawe Mazidjatari
4d4fb66477 DebugSurface: minor deduplication
Will be called in either of the 2 branches, can be deduplicated.
2025-01-08 20:57:24 +01:00
Kawe Mazidjatari
117e2d77e4 ImguiSystem: purge the surface list on shutdown
Move purging logic to shutdown.
2025-01-08 20:56:06 +01:00
Kawe Mazidjatari
e9a2aea17c ImguiSystem: make getters const
Can be const.
2025-01-08 20:54:25 +01:00
Kawe Mazidjatari
5d000db867 MaterialSystem: fix incorrect vendor constant for AMD graphics hardware
Users have reported that AMD Anti-Lag 2 didn't work. The issue turned out to be the incorrect vendor constant. After this patch the Anti-Lag 2 implementation appears to work perfectly.

This constant is used to check if installed (and currently selected) hardware is of target vendor before making any driver API calls.
2025-01-07 22:04:00 +01:00
Kawe Mazidjatari
1a5a77f9c8 MaterialSystem: only run model texture crediting if we aren't GPU driven
The compute shader already takes care of this. This code updates the STBSP histogram which won't be used if the cvar 'gpu_driven_tex_stream' is set.

Added a check for if 'gpu_driven_tex_stream' is set, and if so, we don't run this code to save on CPU load.
2025-01-07 22:00:29 +01:00
Kawe Mazidjatari
d8326575e5 MaterialSystem: add handle to 'StreamDB_CreditModelTextures()'
Will be used for an optimization in the future.
2025-01-07 21:56:59 +01:00
Kawe Mazidjatari
4a2f5d2aa5 MaterialSystem: reverse virtual function
This is used to check if a model can credit textures for the texture streaming system. It will be used in the future.
2025-01-07 21:56:09 +01:00
Kawe Mazidjatari
68271b9768 MaterialSystem: fix incorrect member variable type
Should be unsigned int 16, not 32. Member gets accessed with uint16 instructions. Structure is now alligned correctly with the engine, and its size also matches now.
2025-01-07 21:54:56 +01:00
Kawe Mazidjatari
e1f0de0089 MaterialSystem: only update STBSP camera if we aren't GPU driven
Only update the stream camera if we aren't GPU driven to save on load in the render thread.

The camera is used to get the correct column from the STBSP file. Though, if we use the GPU feedback driven texture streaming system, it doesn't make sense to burn CPU here since the GPU system doesn't use the camera at all.
2025-01-07 20:27:35 +01:00
Kawe Mazidjatari
164c594486 MaterialSystem: only run world texture crediting if we aren't GPU driven
This code credits textures based on the STBSP column we are in. However, the GPU driven texture streaming system has its own logic for this. Don't run the STBSP world texture crediting code if the GPU driven system is enabled to save on runtime overhead and possible interference.
2025-01-07 11:38:53 +01:00
Kawe Mazidjatari
37e3c8c653 MaterialSystem: correctly define 'CMaterialGlue'
Remove structure packing (not needed), and properly lay it out. The material glue class is a wrapper around the actual material struct, which is what has been seperated out in this path.

The material struct also contains more newly reversed members.
2025-01-07 01:53:01 +01:00
Kawe Mazidjatari
4445edac6d MaterialSystem: add material shader type enum 2025-01-07 00:57:14 +01:00
Kawe Mazidjatari
561fc25c8e MaterialSystem: split off the render parameters 2025-01-07 00:48:20 +01:00
Kawe Mazidjatari
6d4de8c5b7 MaterialSystem: split off remaining texture streaming specific code
This should all be moved to the new file dedicated to texture streaming.
2025-01-07 00:18:50 +01:00
Kawe Mazidjatari
ca7b0d9981 MaterialSystem: reverse engineer more of 'TextureStreamMgr_s'
More member variables reverse engineered.
2025-01-06 19:59:03 +01:00
Kawe Mazidjatari
b1ad2c19b8 RTech: improve StreamDB type name consistency 2025-01-06 19:46:34 +01:00
Kawe Mazidjatari
3cbdab512d RenderSystem: reverse engineer more of 'TextureAsset_s'
Reversed the last used frame (last time the texture was accumulated), and the last time the texture was credited. Also reversed the actual histogram bin fields; in Apex Legends there is a new one for the GPU driven texture streaming system.
2025-01-06 17:09:14 +01:00
Kawe Mazidjatari
b617caf1d8 MaterialSystem: add histogram bin count define
Will be used in the future.
2025-01-06 17:06:59 +01:00
Kawe Mazidjatari
538df8e02c RTech: enforce member name consistency 2025-01-06 16:57:07 +01:00
Kawe Mazidjatari
05f37cad73 RTech: move forward delcarations out of public headers
These are only used by the runtime's global state.
2025-01-06 16:43:21 +01:00
Kawe Mazidjatari
e6c7c7d279 RenderSystem: enforce type and type name consistency
Use same types used by the game in either the public presentations or binary code. And enforce type name consistency.
2025-01-06 16:41:25 +01:00
Kawe Mazidjatari
62d0dab7cd GFX: add support for creating cubemap textures
Later versions of the game store their cube maps in the RPak as DDS textures now, the engine needs a modification to its texture creation code to support these.
2025-01-06 16:35:36 +01:00
Kawe Mazidjatari
746660490b MaterialSystem: add more reversed types for texture streaming
Reverse engineered.
2025-01-06 16:26:23 +01:00
Kawe Mazidjatari
059f9fc82d RTech: move and rename texture streaming global state struct
More correct names.
2025-01-06 00:53:54 +01:00
Kawe Mazidjatari
aefebd846e MaterialSystem: decouple texture streaming code 2025-01-06 00:44:23 +01:00
Kawe Mazidjatari
aba1ed26b5 RTech: map more fields out for StreamDB_s
More fields reverse engineered.
2025-01-06 00:39:59 +01:00
Kawe Mazidjatari
48e79faffa RTech: search for pattern again
The extra runtime overhead this creates is negligible as all patterns will be searched once, and have their results being cached off. Due to a planned future change, we can't extern it anymore.
2025-01-06 00:37:00 +01:00
Kawe Mazidjatari
49d1f6f1fe RTech: remove unused define
As of commit 3b44bbc6bc8cf26136c5bf6db05a84907f74e089, no longer used.
2025-01-04 17:41:11 +01:00
Kawe Mazidjatari
3b44bbc6bc MaterialSystem: remove the need for a dummy STBSP file
As of commit 5e0c24ad8437a02c1c62325d1d0e5f39e6684f90, the dummy file is no longer necessary.
2025-01-04 17:40:43 +01:00
Kawe Mazidjatari
bd9beaa33a Resource: improve assembly code formatting
Don't use byte opcodes, and suffix hexadecimal values with 'h'.
2025-01-03 22:36:31 +01:00
Kawe Mazidjatari
5e0c24ad84 Resource: patch out forced texture streaming disable code
If we do not have resident pages, then we can still rely on the GPU driven texture streaming system. However, this code forces the mode to TSM_OPMODE_LEGACY_PICMIP. This is a bug because it contradicts the ability to switch between the dynamic and static systems. Patched the jump from a conditional one to an unconditional one to always skip over this broken code.

This also ultimately drops the need for having a dummy STBSP file, and the benefit of not having a dummy STBSP file is that 'hasResidentPages' will be false, which disables the STBSP world texture crediting code, reducing frame times.
2025-01-03 22:32:37 +01:00
Kawe Mazidjatari
36d2b3534a MaterialSystem: properly switch between static and dynamic texture streaming systems
The engine has a bug where it would use GPU feedback even when a static precomputed texture streaming database file exists. If we have an STBSP file for the given level or override, load that in and disable GPU feedback so proper use of the static file could be made. Else we load gpu_driven.stbsp which is a dummy to enable the dynamic, GPU based texture streaming system.
2025-01-03 15:19:48 +01:00
Kawe Mazidjatari
d20488c919 RTech: add constant for GPU driven texure streaming database file
This is a dummy file which enables the GPU driven texture streaming system, which loads/drops textures based on GPU feedback rather than a static texture streaming database file.
2025-01-03 15:15:36 +01:00
Kawe Mazidjatari
f0511a89a7 Common: add cvar 'gpu_driven_tex_stream'
Also compiled out stream_overlay and stream_overlay_mode for dedicated server builds; texture streaming is a client only feature.
2025-01-03 15:13:27 +01:00
Kawe Mazidjatari
8720dde3cb MaterialSystem: obtain texture streaming instance pointer 2025-01-03 14:06:17 +01:00
Kawe Mazidjatari
6ae072386d RTech: add texture streaming database types to SDK 2025-01-03 14:05:21 +01:00
Kawe Mazidjatari
6bf516f1ef MaterialSystem: implement stream info dump command
Implement the ability to dump the entire texture streaming debug info to the console. This will also log it to the log file.
2025-01-01 22:49:18 +01:00
Kawe Mazidjatari
b75655c101 Tier0: binary io stream class refactor
Class has been reworked to always take the reverve seek amount into account when adding to output size. Previously, we still incremented the output size even when we seeked back and modified data rather than appending to the end.

The manual write size calculation was a design choice as seeking and calling tellp is slow.

The enum has also been slightly reworked by removing the BINARY enumerant, and adding a new mode which allows you to open a stream in read/write mode.
2025-01-01 22:44:43 +01:00
Kawe Mazidjatari
4ffcc4ca75 RTech: show header alignments in asset types overview
Show the asset's header's requested memory alignment.
2025-01-01 21:42:59 +01:00
Kawe Mazidjatari
bef61249fd RTech: function qualification and symbol naming consistency improvements
Use static and const where possible, and rename 'segments' to 'slabs' as this represents a huge buffer in which pages are allocated to, and slab fits this name better.
2025-01-01 21:40:04 +01:00
Kawe Mazidjatari
c6d451c753 Recast: implement editor window resizing
Small UX improvement.
2025-01-01 21:36:01 +01:00
Kawe Mazidjatari
26f48507f4 Tier0: pattern searching code improvements
Eliminate extraneous type promotion/demotion.
2025-01-01 21:33:02 +01:00