google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.85k stars 1.9k forks source link

Vulkan backend is excruciatingly slow on debug builds. #6466

Closed pixelflinger closed 1 year ago

pixelflinger commented 1 year ago

Repro:

Make a debug build of filament on MacOS and run gltf_viewer, notice that rendering is about 1fps. There must be some debugging code in the vulkan backend enabled only in debug that causes this. This is too much/not usable.

poweifeng commented 1 year ago

I'm unable to repro this on my M1. Any other info? Im on MoltenVK 1.2.1 for example.

pixelflinger commented 1 year ago

It doesn't happen with the default model, because it's too simple. I can reproduce easily with the sponza scene. I looked at it a but more, and it is definitely related to the validation layers being enabled. about 50% of the CPU time is spent in BestPractices::ValidateBoundDescriptorSets.

poweifeng commented 1 year ago

vk_layers_settings.txt can be used to customize (i.e. disable) parts of the validation if it's doing too much work. Alternatively, maybe using vkconfig from the VulkanSDK can be easier.