mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

dxCreateRenderTarget consumes more video memory than it should be

Open MortimerSapkowski opened this issue 1 year ago • 1 comments

Describe the bug

Creating render target of size 1024*1024 with 32bit (surfaceFormat = a8r8g8b8) per pixel should consume 4MB of video memory. And for 8bit per pixel (surfaceFormat = 8a) should take 1MB But in fact 32bit takes 8MB and 8bit takes 5MB

Steps to reproduce

local mem_used = dxGetStatus().VideoMemoryUsedByRenderTargets
dxCreateRenderTarget(1024, 1024, "a8")
print(tostring(dxGetStatus().VideoMemoryUsedByRenderTargets - mem_used) .. " MB")

mem_used = dxGetStatus().VideoMemoryUsedByRenderTargets
dxCreateRenderTarget(1024, 1024, "a8r8g8b8")
print(tostring(dxGetStatus().VideoMemoryUsedByRenderTargets - mem_used) .. " MB")

Version

Client: Multi Theft Auto v1.6-release-22388 Server: v1.6-release-22388

Additional context

image

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

MortimerSapkowski avatar May 17 '24 16:05 MortimerSapkowski

That's because internally MTA creates a depth-stencil texture for each RT. So, in case of 1024x1024 texture you will have extra 4 MB in an optimistic scenario and plus 2 MB in the pessimistic one.

tederis avatar May 24 '24 13:05 tederis