You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Push constants in MoltenVK only work correctly for the first pipeline you bind in a command buffer, or after you've called vkCmdBindDescriptorSets after you've bound a later pipeline.
The following call sequence is currently broken in MoltenVK but works on other conforming Vulkan implementations:
vkCmdBindPipeline(pipe1)
vkCmdBindDescriptorSet(pipe1, a uniform buffer in set 0, binding 0)
vkCmdPushConstants(constants1)
vkCmdDraw(draw1)
vkCmdPushConstants(constants2)
vkCmdDraw(draw2)
vkCmdBindPipeline(pipe2)
vkCmdPushConstants(constants3)
vkCmdDraw(draw3)
Note that vkCmdBindDescriptorSets is not called after the second vkCmdBindPipeline.
What happens is that draw3 sees constants2 instead of constants3.
If you do call vkCmdBindDescriptorSets with zero descriptor sets after the second vkCmdBindPipeline (which is UB so validation layers don't like it) it fixes things.
The reason for this behavior appears to be that cmdEncoder->getPushConstants(...)->setMTLBufferIndex is called in vkCmdBindDescriptorSets* instead of vkCmdBindPipeline, where that code should be (push constants are entirely independent of descriptors).
Broken out from #327.
Push constants in MoltenVK only work correctly for the first pipeline you bind in a command buffer, or after you've called vkCmdBindDescriptorSets after you've bound a later pipeline.
The following call sequence is currently broken in MoltenVK but works on other conforming Vulkan implementations:
Note that vkCmdBindDescriptorSets is not called after the second vkCmdBindPipeline.
What happens is that draw3 sees constants2 instead of constants3.
If you do call vkCmdBindDescriptorSets with zero descriptor sets after the second vkCmdBindPipeline (which is UB so validation layers don't like it) it fixes things.
The reason for this behavior appears to be that cmdEncoder->getPushConstants(...)->setMTLBufferIndex is called in vkCmdBindDescriptorSets* instead of vkCmdBindPipeline, where that code should be (push constants are entirely independent of descriptors).
*:
MoltenVK/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
Line 58 in a5cefa5
The text was updated successfully, but these errors were encountered: