I have discovered that there are two ways to update the viewport (might be more, but not sure). Currently I am rebuilding the Pipeline when I resize my screen but there is a noticeable stutter as it rebuilds, but I have also found out that you can use vkCmdSetViewport when building/rebuilding your command buffers. But is this the right way to do it? And if I used vkCmdSetViewport, what should be put into the VkGraphicsPipelineCreateInfo pViewportState?

If there is an even better way of handling screen resizing please let me know.


1 Answer 1


Both suggested methods are fine, but they should be preferred in certain situations.

Dynamic state should be preferred in situations where you have many, perhaps thousands of, pipeline objects or you need to change the resolution often (such as in some sort of windowed tool. The downside to this is that it may reduce runtime performance since the driver may not be able apply optimizations for this.

Having the viewport only defined when building the pipeline objects might be more appropriate for games or simulators where you don't change the resolution often. Of course, when the viewport does change, it hits performance hard during resizing. This also has the drawback of needing to generate new pipeline objects, which could be especially problematic if you cache pipelines in a hash table of something similar.

  • 1
    $\begingroup$ You could have a backup dynamic viewport pipeline object for use during resize until the finalized pipeline object with fixed viewport is ready. $\endgroup$ Commented Oct 18, 2017 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.