MaterialSystem: add more reversed types for texture streaming

Reverse engineered.
This commit is contained in:
Kawe Mazidjatari 2025-01-06 16:26:23 +01:00
parent 059f9fc82d
commit 746660490b

View File

@ -1,8 +1,59 @@
//=============================================================================//
//
// Purpose: texture streaming and runtime management
//
//-----------------------------------------------------------------------------
// Some of these structs are based on the presentation held by the developer of
// the texture streaming system in Titanfall 2 and Apex Legends, see the links:
// - https://www.gdcvault.com/play/1024418/Efficient-Texture-Streaming-in-Titanfall
// - https://www.youtube.com/watch?v=q0aKNGH8WbA
//=============================================================================//
#ifndef TEXTURESTREAMING_H
#define TEXTURESTREAMING_H
#include "public/rtech/istreamdb.h"
inline void(*v_StreamDB_Init)(const char* const pszLevelName);
struct TextureStreamMgr_Task_s
{
TextureAsset_t* textureAsset;
// The mip level count to load or drop.
uint8 mipLevelCount;
char padding[3];
// The 'cost vs benefit' metric used to partially sort the task list to get
// the best and worst 16 textures.
float metric;
};
struct TextureStreamMgr_TaskList_s
{
// STBSP async file handle and index to the current page.
int fileHandle;
int pageIndex;
// Whether we should update the current page state.
bool updatePageState;
int padding;
// Offset to the page in the STBSP to read up to size bytes.
uint64 pageOffset;
uint64 pageSize;
// - loadBegin points to the first texture load task.
// - loadEnd points to the last texture load task.
// - loadLimit points to the absolute end of the load task buffer.
TextureStreamMgr_Task_s* loadBegin;
TextureStreamMgr_Task_s* loadEnd;
TextureStreamMgr_Task_s* loadLimit;
// - dropBegin points to the first texture drop task.
// - dropEnd points to the last texture drop task.
// - dropLimit points to the absolute end of the drop task buffer.
TextureStreamMgr_Task_s* dropBegin;
TextureStreamMgr_Task_s* dropEnd;
TextureStreamMgr_Task_s* dropLimit;
};
struct TextureStreamMgr_s
{
@ -39,6 +90,8 @@ struct TextureStreamMgr_s
TextureAsset_t* streamableTextures[4];
};
inline void(*v_StreamDB_Init)(const char* const pszLevelName);
inline TextureStreamMgr_s* s_textureStreamMgr;
///////////////////////////////////////////////////////////////////////////////