mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- submit the upload commands
This commit is contained in:
parent
e875198b37
commit
854526dee4
2 changed files with 46 additions and 14 deletions
|
@ -66,6 +66,7 @@ VulkanFrameBuffer::~VulkanFrameBuffer()
|
||||||
|
|
||||||
void VulkanFrameBuffer::InitializeState()
|
void VulkanFrameBuffer::InitializeState()
|
||||||
{
|
{
|
||||||
|
mUploadSemaphore.reset(new VulkanSemaphore(device));
|
||||||
mGraphicsCommandPool.reset(new VulkanCommandPool(device, device->graphicsFamily));
|
mGraphicsCommandPool.reset(new VulkanCommandPool(device, device->graphicsFamily));
|
||||||
|
|
||||||
mVertexData = new FFlatVertexBuffer(GetWidth(), GetHeight());
|
mVertexData = new FFlatVertexBuffer(GetWidth(), GetHeight());
|
||||||
|
@ -109,21 +110,51 @@ void VulkanFrameBuffer::Update()
|
||||||
|
|
||||||
mPresentCommands->end();
|
mPresentCommands->end();
|
||||||
|
|
||||||
VkSemaphore waitSemaphores[] = { device->imageAvailableSemaphore->semaphore };
|
if (mUploadCommands)
|
||||||
VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
{
|
||||||
|
// Submit upload commands immediately
|
||||||
|
VkSubmitInfo submitInfo = {};
|
||||||
|
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||||
|
submitInfo.commandBufferCount = 1;
|
||||||
|
submitInfo.pCommandBuffers = &mUploadCommands->buffer;
|
||||||
|
submitInfo.signalSemaphoreCount = 1;
|
||||||
|
submitInfo.pSignalSemaphores = &mUploadSemaphore->semaphore;
|
||||||
|
VkResult result = vkQueueSubmit(device->graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
I_FatalError("Failed to submit command buffer!\n");
|
||||||
|
|
||||||
VkSubmitInfo submitInfo = {};
|
// Wait for upload commands to finish, then submit render commands
|
||||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
VkSemaphore waitSemaphores[] = { mUploadSemaphore->semaphore, device->imageAvailableSemaphore->semaphore };
|
||||||
submitInfo.waitSemaphoreCount = 1;
|
VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
||||||
submitInfo.pWaitSemaphores = waitSemaphores;
|
submitInfo.waitSemaphoreCount = 2;
|
||||||
submitInfo.pWaitDstStageMask = waitStages;
|
submitInfo.pWaitSemaphores = waitSemaphores;
|
||||||
submitInfo.commandBufferCount = 1;
|
submitInfo.pWaitDstStageMask = waitStages;
|
||||||
submitInfo.pCommandBuffers = &mPresentCommands->buffer;
|
submitInfo.commandBufferCount = 1;
|
||||||
submitInfo.signalSemaphoreCount = 1;
|
submitInfo.pCommandBuffers = &mPresentCommands->buffer;
|
||||||
submitInfo.pSignalSemaphores = &device->renderFinishedSemaphore->semaphore;
|
submitInfo.signalSemaphoreCount = 1;
|
||||||
VkResult result = vkQueueSubmit(device->graphicsQueue, 1, &submitInfo, device->renderFinishedFence->fence);
|
submitInfo.pSignalSemaphores = &device->renderFinishedSemaphore->semaphore;
|
||||||
if (result != VK_SUCCESS)
|
result = vkQueueSubmit(device->graphicsQueue, 1, &submitInfo, device->renderFinishedFence->fence);
|
||||||
I_FatalError("Failed to submit command buffer!\n");
|
if (result != VK_SUCCESS)
|
||||||
|
I_FatalError("Failed to submit command buffer!\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VkSemaphore waitSemaphores[] = { device->imageAvailableSemaphore->semaphore };
|
||||||
|
VkPipelineStageFlags waitStages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
||||||
|
|
||||||
|
VkSubmitInfo submitInfo = {};
|
||||||
|
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||||
|
submitInfo.waitSemaphoreCount = 1;
|
||||||
|
submitInfo.pWaitSemaphores = waitSemaphores;
|
||||||
|
submitInfo.pWaitDstStageMask = waitStages;
|
||||||
|
submitInfo.commandBufferCount = 1;
|
||||||
|
submitInfo.pCommandBuffers = &mPresentCommands->buffer;
|
||||||
|
submitInfo.signalSemaphoreCount = 1;
|
||||||
|
submitInfo.pSignalSemaphores = &device->renderFinishedSemaphore->semaphore;
|
||||||
|
VkResult result = vkQueueSubmit(device->graphicsQueue, 1, &submitInfo, device->renderFinishedFence->fence);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
I_FatalError("Failed to submit command buffer!\n");
|
||||||
|
}
|
||||||
|
|
||||||
Flush3D.Unclock();
|
Flush3D.Unclock();
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
std::unique_ptr<VulkanCommandPool> mGraphicsCommandPool;
|
std::unique_ptr<VulkanCommandPool> mGraphicsCommandPool;
|
||||||
std::unique_ptr<VulkanCommandBuffer> mUploadCommands;
|
std::unique_ptr<VulkanCommandBuffer> mUploadCommands;
|
||||||
std::unique_ptr<VulkanCommandBuffer> mPresentCommands;
|
std::unique_ptr<VulkanCommandBuffer> mPresentCommands;
|
||||||
|
std::unique_ptr<VulkanSemaphore> mUploadSemaphore;
|
||||||
std::unique_ptr<VkRenderState> mRenderState;
|
std::unique_ptr<VkRenderState> mRenderState;
|
||||||
|
|
||||||
int camtexcount = 0;
|
int camtexcount = 0;
|
||||||
|
|
Loading…
Reference in a new issue