zeux / niagara

A Vulkan renderer written from scratch on stream
MIT License
1.33k stars 75 forks source link

Correctly handle maxTaskWorkGroupCount restriction #33

Closed zeux closed 1 year ago

zeux commented 1 year ago

maxTaskWorkGroupCountX/Y/Z is limited to 65535 (which is a min guaranteed spec limit as well as an actual command encoding restriction on some drivers). maxTaskWorkGroupTotalCount is limited to 2^22 (min guaranteed spec limit).

This means that when we use taskSubmit we need another small shader that converts the total task WG count into X/Y/Z, e.g. hardcoding Y as 64, Z as 1, and padding the task commands to a multiple of 64 with dummy 0-count entries to handle overflow.

Without this, when we disable LOD or culling in the new pipeline, we're going over the limit.