mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
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.
This commit is contained in:
parent
d8326575e5
commit
1a5a77f9c8
@ -198,6 +198,35 @@ Vector2D CMaterialSystem::GetScreenSize(CMaterialSystem* pMatSys)
|
||||
return vecScreenSize;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: same as StreamDB_CreditWorldTextures, but also takes the coverage
|
||||
// of the dynamic model into account.
|
||||
// Input : *pMatSys -
|
||||
// *materialGlue -
|
||||
// a3 -
|
||||
// a4 -
|
||||
// a5 -
|
||||
// *pViewOrigin -
|
||||
// tanOfHalfFov -
|
||||
// viewWidthPixels -
|
||||
// a9 -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialSystem::CreditModelTextures(CMaterialSystem* const pMatSys, CMaterialGlue* const materialGlue, __int64 a3, __int64 a4, unsigned int a5, const Vector3D* const pViewOrigin, const float tanOfHalfFov, const float viewWidthPixels, int a9)
|
||||
{
|
||||
if (!materialGlue->CanCreditModelTextures())
|
||||
return;
|
||||
|
||||
// If we use the GPU driven texture streaming system, do not run this code
|
||||
// as the compute shaders deals with both static and dynamic model textures.
|
||||
if (gpu_driven_tex_stream->GetBool())
|
||||
return;
|
||||
|
||||
MaterialGlue_s* const material = materialGlue->Get();
|
||||
material->lastFrame = s_textureStreamMgr->thisFrame;
|
||||
|
||||
v_StreamDB_CreditModelTextures(material->streamingTextureHandles, material->streamingTextureHandleCount, a3, a4, a5, pViewOrigin, tanOfHalfFov, viewWidthPixels, a9);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: updates the stream camera used for getting the column from the STBSP
|
||||
// Input : *pMatSys -
|
||||
@ -234,6 +263,7 @@ void VMaterialSystem::Detour(const bool bAttach) const
|
||||
DetourSetup(&CMaterialSystem__SwapBuffers, &CMaterialSystem::SwapBuffers, bAttach);
|
||||
DetourSetup(&CMaterialSystem__FindMaterialEx, &CMaterialSystem::FindMaterialEx, bAttach);
|
||||
|
||||
DetourSetup(&CMaterialSystem__CreditModelTextures, &CMaterialSystem::CreditModelTextures, bAttach);
|
||||
DetourSetup(&CMaterialSystem__UpdateStreamCamera, &CMaterialSystem::UpdateStreamCamera, bAttach);
|
||||
|
||||
DetourSetup(&v_DispatchDrawCall, &DispatchDrawCall, bAttach);
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
static CMaterialGlue* FindMaterialEx(CMaterialSystem* pMatSys, const char* pMaterialName, uint8_t nMaterialType, int nUnk, bool bComplain);
|
||||
static Vector2D GetScreenSize(CMaterialSystem* pMatSys = nullptr);
|
||||
|
||||
static void CreditModelTextures(CMaterialSystem* const pMatSys, CMaterialGlue* const materialGlue, __int64 a3, __int64 a4, unsigned int a5, const Vector3D* const pViewOrigin, const float tanOfHalfFov, const float viewWidthPixels, int a9);
|
||||
static void UpdateStreamCamera(CMaterialSystem* const pMatSys, const Vector3D* const camPos, const QAngle* const camAng, const float halfFovX, const float viewWidth);
|
||||
#endif // !MATERIALSYSTEM_NODX
|
||||
|
||||
@ -75,6 +76,7 @@ inline void*(*CMaterialSystem__SwapBuffers)(CMaterialSystem* pMatSys);
|
||||
inline CMaterialGlue*(*CMaterialSystem__FindMaterialEx)(CMaterialSystem* pMatSys, const char* pMaterialName, uint8_t nMaterialType, int nUnk, bool bComplain);
|
||||
inline void(*CMaterialSystem__GetScreenSize)(CMaterialSystem* pMatSys, float* outX, float* outY);
|
||||
|
||||
inline void(*CMaterialSystem__CreditModelTextures)(CMaterialSystem* const pMatSys, CMaterialGlue* const materialGlue, __int64 a3, __int64 a4, unsigned int a5, const Vector3D* const pViewOrigin, const float tanOfHalfFov, const float viewWidthPixels, int a9);
|
||||
inline void(*CMaterialSystem__UpdateStreamCamera)(CMaterialSystem* const pMatSys, const Vector3D* const camPos, const QAngle* const camAng, const float halfFovX, const float viewWidth);
|
||||
|
||||
inline void*(*v_DispatchDrawCall)(int64_t a1, uint64_t a2, int a3, int a4, int64_t a5, int a6, uint8_t a7, int64_t a8, uint32_t a9, uint32_t a10, int a11, __m128* a12, int a13, int64_t a14);
|
||||
@ -106,6 +108,7 @@ class VMaterialSystem : public IDetour
|
||||
LogFunAdr("CMaterialSystem::SwapBuffers", CMaterialSystem__SwapBuffers);
|
||||
LogFunAdr("CMaterialSystem::FindMaterialEx", CMaterialSystem__FindMaterialEx);
|
||||
LogFunAdr("CMaterialSystem::GetScreenSize", CMaterialSystem__GetScreenSize);
|
||||
LogFunAdr("CMaterialSystem::CreditModelTextures", CMaterialSystem__CreditModelTextures);
|
||||
LogFunAdr("CMaterialSystem::UpdateStreamCamera", CMaterialSystem__UpdateStreamCamera);
|
||||
LogFunAdr("DispatchDrawCall", v_DispatchDrawCall);
|
||||
LogFunAdr("SpinPresent", v_SpinPresent);
|
||||
@ -130,6 +133,7 @@ class VMaterialSystem : public IDetour
|
||||
g_GameDll.FindPatternSIMD("44 89 4C 24 ?? 44 88 44 24 ?? 48 89 4C 24 ??").GetPtr(CMaterialSystem__FindMaterialEx);
|
||||
g_GameDll.FindPatternSIMD("8B 05 ?? ?? ?? ?? 89 02 8B 05 ?? ?? ?? ?? 41 89 ?? C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC 8B 05 ?? ?? ?? ??").GetPtr(CMaterialSystem__GetScreenSize);
|
||||
|
||||
g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8B 02 48 8B CA 49 8B F9").GetPtr(CMaterialSystem__CreditModelTextures);
|
||||
g_GameDll.FindPatternSIMD("48 83 EC ?? 48 8B 05 ?? ?? ?? ?? 44 0F 29 44 24").GetPtr(CMaterialSystem__UpdateStreamCamera);
|
||||
|
||||
g_GameDll.FindPatternSIMD("44 89 4C 24 ?? 44 89 44 24 ?? 48 89 4C 24 ?? 55 53 56").GetPtr(v_DispatchDrawCall);
|
||||
|
Loading…
x
Reference in New Issue
Block a user