StarArawn / harmony

A modern 3D/2D game engine that uses wgpu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Texture unit stalling and performance improvements

StarArawn opened this issue · comments

commented

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.

  1. Generate mip-maps which gives us a free performance upgrade at runtime, and better quality visuals.
  2. Allow users to set the max "texture" quality/resolution.
  3. 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 to gfx-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.

commented

Unity has a great table of supported texture compression formats on platforms/api's here:
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html