-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
THIS ISSUE IS EXCEPTIONALLY UNPLEASANT IN MY OPINION
See this comment.
VkPhysicalDeviceMultiviewProperties
has a field maxMultiviewInstanceIndex
. This is probably for feature emulation using instancing. Normally, all backends have a instance limit of u32::MAX
(except perhaps metal), due to taking a u32 argument for instances. The fact that this limit in vulkan exists probably means that some drivers out there actually have a more restricted limit. An implementation could in theory give a limit as low as u32::MAX
. Webgpu normally doesn't have an instance other than the implicit u32::MAX
. There is no pleasant way to expose this limit to the user.
The current strategy is to at draw call time, check the max instance index against a private capability, and then panic if it is violated (this can't be predicted so breaks wgpu-hal
's contract).
Automatic splitting into multiple draw calls could be done in theory, but this would at best still have no solution for indirect draws, and would make errors there unpredictable.
We could just not expose multiview on devices that expose a limit lower than u32::MAX
.
Also, one final thing to note: this is the instance index, and not the instance count, so it is possible to break wgpu
by specifying a ridculous range of indices that is still short (e.g. 134217728..134217729
).
Describe the solution you'd like
Honest to god I'm not sure
Describe alternatives you've considered
We could expose this limit. But that is extraordinarily shitty and nobody would ever pay attention to it anyway, because it would almost never cause actual problems, and on most devices the limit would probably be u32::MAX
anyway.
Additional context
#8206