Texture unit stalling and performance improvements
StarArawn opened this issue · comments
Currently on lower end hardware it's possible to stall the texture units in metal, and probably other api's, which causes very poor performance. We're also using up too much texture bandwidth as well. This can be addressed in a couple of different ways.
- Generate mip-maps which gives us a free performance upgrade at runtime, and better quality visuals.
- Allow users to set the max "texture" quality/resolution.
- Use compressed textures(not available in wgpu yet..), but perhaps we can access it from
gfx-hal
via an wgpu native extension. Would require changes togfx-hal
, and wgpu.
For the first two options the best soultion is some sort of asset/texture pre-processing. Although generating mip-maps during load isn't exactly slow it's not something we really want to be doing. Instead we can generate them ahead of runtime and save them to disk. When loading the textures into harmony we can load the mipmaps backwards up to the max texture resolution specified in the quality settings.
Unity has a great table of supported texture compression formats on platforms/api's here:
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html