Skip to content

Unused auto dx textures cleanup #4073

Open
@C0DELEVEL

Description

@C0DELEVEL

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

In the current solution of dxDrawImage (and similar functions), when an image is passed as a string (to image file) rather than a previously created Texture, an auto texture is created that is never deleted from memory. It seems to me that a reasonable solution would be to add some sort of garbage collector to this solution, which would, for example, rely on the elapsed time since the last call to FindAutoTexture and remove it from memory when unused. This would certainly free up a lot of VRAM on servers that don't use textures, but render "one-time" or temporary images of some kind using the aforementioned function.

ref:

CClientTexture* CClientRenderElementManager::FindAutoTexture(const SString& strFullFilePath, const SString& strUniqueName)
{
// Check if we've already done this file
CClientTexture** ppTextureElement = MapFind(m_AutoTextureMap, strUniqueName);
if (!ppTextureElement)
{
// Try to create
CClientTexture* pNewTextureElement = CreateTexture(strFullFilePath);
if (!pNewTextureElement)
return NULL;
// Add to automap if created
MapSet(m_AutoTextureMap, strUniqueName, pNewTextureElement);
ppTextureElement = MapFind(m_AutoTextureMap, strUniqueName);
}
return *ppTextureElement;
}

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions