on Optimus system Vulkan tries to use integrated intel graphics and fails with a blank black window

I have a Thinkpad T460p with an Optimus setup of integrated intel graphics and discrete 940MX. With the nvidia driver installed the intel graphics are mostly disabled, but Vulkan sees them, tries to use them, and fails. In vulkaninfo I see

    Devices         count = 3
            GPU id       : 0 (Intel(R) HD Graphics 530 (Skylake GT2))
            Layer-Device Extensions count = 0
            GPU id       : 1 (GeForce 940MX)
            Layer-Device Extensions count = 0
            GPU id       : 2 (GeForce 940MX)
            Layer-Device Extensions count = 0

and vkcube just displays a black window until I kill it. If I remove /usr/share/vulkan/icd.d/intel*, vulkan can’t see the intel graphics anymore, and everything works properly. Is there something the nvidia driver could do to hide the disabled intel graphics from vulkan?

Incidentally, I wonder why vulkan sees two copies of my 940MX.
nvidia-bug-report.log.gz (1.02 MB)