I have been trying to enable multiple viewports in my Vulkan Pipeline but have been unsucsessfull. I used this code sample as a reference point. The problem is that when I attempt to draw two side by side (splitscreen) views of a scene I am unsuccessful.
Pipeline Initialisation
// Viewport state
VkPipelineViewportStateCreateInfo viewport_state = initializers::PipelineViewportStateCreateInfo(CameraComponent::GetCameraCount(), CameraComponent::GetCameraCount());
// Dynamic shader stages
std::vector<VkDynamicState> dynamic_states = {
VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR,
VK_DYNAMIC_STATE_LINE_WIDTH,
};
VkPipelineDynamicStateCreateInfo dynamic_states_info = initializers::PipelineDynamicStateCreateInfo(dynamic_states);
(Using the debuger shows that CameraComponent::GetCameraCount() is 2)
Command Buffer
vkCmdSetViewport(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetViewports());
vkCmdSetScissor(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetScissors());
(Here CameraComponent::GetCameraCount() is 2 aswell as the viewport and scissor methods returning valid data)
When Using Nvidia NSight we can see that both Scissors and Viewports are detected
As well as there position data existing within the gpu
But when it comes to the result, all that is visible is half of the screen. When I flip the cameras around within the code, the second half is rendered instead showing that the first camera is being rendered but not the second one.