Fix queue family transfer operations between graphics <-> compute queues, generalize getQueueFamilyIndex() to support VkQueueFlags vs. VkQueueFlagBits, computecloth deltaT now based on frameTimer

This commit is contained in:
Stephen Saunders 2022-06-13 22:53:48 -04:00
parent 17aaa7305b
commit b2f501dc98
7 changed files with 306 additions and 80 deletions

View file

@ -160,7 +160,7 @@ public:
vkCmdPipelineBarrier(
drawCmdBuffers[i],
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
0,
0, nullptr,
@ -207,7 +207,7 @@ public:
vkCmdPipelineBarrier(
drawCmdBuffers[i],
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0,
0, nullptr,
1, &buffer_barrier,
@ -243,7 +243,7 @@ public:
vkCmdPipelineBarrier(
compute.commandBuffer,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
0,
0, nullptr,
@ -300,7 +300,7 @@ public:
vkCmdPipelineBarrier(
compute.commandBuffer,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0,
0, nullptr,
1, &buffer_barrier,
@ -417,7 +417,7 @@ public:
vkCmdPipelineBarrier(
copyCmd,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0,
0, nullptr,
1, &buffer_barrier,
@ -746,7 +746,9 @@ public:
// Build a single command buffer containing the compute dispatch commands
buildComputeCommandBuffer();
// SRS - By reordering compute and graphics within draw(), the following code is no longer needed:
// If graphics and compute queue family indices differ, acquire and immediately release the storage buffer, so that the initial acquire from the graphics command buffers are matched up properly
/*
if (graphics.queueFamilyIndex != compute.queueFamilyIndex)
{
// Create a transient command buffer for setting up the initial buffer transfer state
@ -796,6 +798,7 @@ public:
vulkanDevice->flushCommandBuffer(transferCmd, compute.queue, compute.commandPool);
}
*/
}
// Prepare and initialize uniform buffer containing shader uniforms
@ -899,6 +902,11 @@ public:
updateGraphicsUniformBuffers();
}
}
virtual void viewChanged()
{
updateGraphicsUniformBuffers();
}
};
VULKAN_EXAMPLE_MAIN()