KhronosGroup / KhronosGroup/Vulkan-Docs
Dynamic viewport/scissor states and static command buffers
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
I'm currently struggling with an issue and couldn't find if there's a workaround for it on Vulkan.
I have some pre-recorded secondary command buffers that are used for all the static draw commands in our game and the viewport/scissor are dynamic - so they have to be updated for each command buffer.
Now the problem is that since the game also uses dynamic resolution, the viewport/scissor recorded on those secondary command buffers might not match the one currently used on the current frame.
It would be great if the restrictions (setting the dynamic states) applied only to the primary command buffer instead, since secondary CBs can't be executed directly anyway.
We could then do something like (and for the record that's basically what we do on DX12):
```
allocate secondary command buffer
begin secondary command buffer
set scissor
set viewport
end secondary command buffer
if (updateStaticCommandBuffer)
{
begin secondary command buffer
draw
end secondary command buffer
}
execute commands (pass both secondary command buffers)
```
But currently the dynamic states need to be set on every command buffer, forcing us to recreate the static CBs every time the resolution changes.
Contributor guide
Assessment
This issue has not been assessed yet.