Fixes in examples: support swapchain image count change on resize, fix multiple validation layer errors on resize and quit, multiview now supports resize/fullscreen, computecloth deltaT now based on frame time, multisampling recreates attachments on resize, P key now pauses computeparticles, descriptorsets, and pushdescriptors
This commit is contained in:
parent
cb343c329a
commit
121612857c
10 changed files with 148 additions and 65 deletions
|
|
@ -620,6 +620,13 @@ public:
|
|||
// Semaphore for compute & graphics sync
|
||||
VkSemaphoreCreateInfo semaphoreCreateInfo = vks::initializers::semaphoreCreateInfo();
|
||||
VK_CHECK_RESULT(vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &graphics.semaphore));
|
||||
|
||||
// Signal the semaphore
|
||||
VkSubmitInfo submitInfo = vks::initializers::submitInfo();
|
||||
submitInfo.signalSemaphoreCount = 1;
|
||||
submitInfo.pSignalSemaphores = &graphics.semaphore;
|
||||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
|
||||
}
|
||||
|
||||
void prepareCompute()
|
||||
|
|
@ -736,13 +743,6 @@ public:
|
|||
VkSemaphoreCreateInfo semaphoreCreateInfo = vks::initializers::semaphoreCreateInfo();
|
||||
VK_CHECK_RESULT(vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &compute.semaphore));
|
||||
|
||||
// Signal the semaphore
|
||||
VkSubmitInfo submitInfo = vks::initializers::submitInfo();
|
||||
submitInfo.signalSemaphoreCount = 1;
|
||||
submitInfo.pSignalSemaphores = &compute.semaphore;
|
||||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
|
||||
|
||||
// Build a single command buffer containing the compute dispatch commands
|
||||
buildComputeCommandBuffer();
|
||||
|
||||
|
|
@ -841,6 +841,20 @@ public:
|
|||
|
||||
void draw()
|
||||
{
|
||||
// Wait for rendering finished
|
||||
VkPipelineStageFlags waitStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
|
||||
// Submit compute commands
|
||||
VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo();
|
||||
computeSubmitInfo.commandBufferCount = 1;
|
||||
computeSubmitInfo.pCommandBuffers = &compute.commandBuffer;
|
||||
computeSubmitInfo.waitSemaphoreCount = 1;
|
||||
computeSubmitInfo.pWaitSemaphores = &graphics.semaphore;
|
||||
computeSubmitInfo.pWaitDstStageMask = &waitStageMask;
|
||||
computeSubmitInfo.signalSemaphoreCount = 1;
|
||||
computeSubmitInfo.pSignalSemaphores = &compute.semaphore;
|
||||
VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, VK_NULL_HANDLE));
|
||||
|
||||
VulkanExampleBase::prepareFrame();
|
||||
|
||||
VkPipelineStageFlags graphicsWaitStageMasks[] = { VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
||||
|
|
@ -858,20 +872,6 @@ public:
|
|||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||
|
||||
VulkanExampleBase::submitFrame();
|
||||
|
||||
// Wait for rendering finished
|
||||
VkPipelineStageFlags waitStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
|
||||
// Submit compute commands
|
||||
VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo();
|
||||
computeSubmitInfo.commandBufferCount = 1;
|
||||
computeSubmitInfo.pCommandBuffers = &compute.commandBuffer;
|
||||
computeSubmitInfo.waitSemaphoreCount = 1;
|
||||
computeSubmitInfo.pWaitSemaphores = &graphics.semaphore;
|
||||
computeSubmitInfo.pWaitDstStageMask = &waitStageMask;
|
||||
computeSubmitInfo.signalSemaphoreCount = 1;
|
||||
computeSubmitInfo.pSignalSemaphores = &compute.semaphore;
|
||||
VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, VK_NULL_HANDLE));
|
||||
}
|
||||
|
||||
void prepare()
|
||||
|
|
@ -901,4 +901,4 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
VULKAN_EXAMPLE_MAIN()
|
||||
VULKAN_EXAMPLE_MAIN()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue