multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 422 forks source link

Improve dxCreateTexture #590

Open CrosRoad95 opened 5 years ago

CrosRoad95 commented 5 years ago

Is your feature request related to a problem? Please describe. Now if you trying load some textures ( mainly bigger ), it cause lags

Describe the solution you'd like Add opportunity to load texture slowly but without lags ( like passwordHash but i tried and caused crash )

Describe alternatives you've considered

Additional context

Pirulax commented 3 years ago

You can't just do something thats designed to run in sync async, thats why you have crashed. Sadly, It's not really possible to optimize dxCreateTexture as the underlaying d3d9 API call is the slow part, not MTA code. The slowest part is converting the texture (and if you have a really really really shit HDD, then the IO as well). When loading ARGB into ARGB its fast, but, for example, DXT3 to ARGB is very slow.

The solution would be to:

My experience with this method is very weird, as passing in the preloaded(might have been a conversion issue) data was 10x slower than reading it from the disk.