mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
pass pNext to present
This commit is contained in:
parent
f62c2578da
commit
3a6458ab7a
3 changed files with 9 additions and 7 deletions
|
|
@ -52,11 +52,12 @@ public:
|
||||||
/// @param queue The Vulkan queue to present the frame on.
|
/// @param queue The Vulkan queue to present the frame on.
|
||||||
/// @param semaphores The semaphores to wait on before presenting.
|
/// @param semaphores The semaphores to wait on before presenting.
|
||||||
/// @param idx The index of the swapchain image to present.
|
/// @param idx The index of the swapchain image to present.
|
||||||
|
/// @param pNext Pointer to the next structure in a chain, if any.
|
||||||
///
|
///
|
||||||
/// @throws LSFG::vulkan_error if any Vulkan call fails.
|
/// @throws LSFG::vulkan_error if any Vulkan call fails.
|
||||||
///
|
///
|
||||||
void presentSwapchain(VkSwapchainKHR handle, VkQueue queue,
|
void presentSwapchain(VkSwapchainKHR handle, VkQueue queue,
|
||||||
const std::vector<VkSemaphore>& semaphores, uint32_t idx);
|
const std::vector<VkSemaphore>& semaphores, uint32_t idx, const void* pNext);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Remove a swapchain from the application.
|
/// Remove a swapchain from the application.
|
||||||
|
|
@ -120,11 +121,12 @@ public:
|
||||||
/// @param queue The Vulkan queue to present the frame on.
|
/// @param queue The Vulkan queue to present the frame on.
|
||||||
/// @param semaphores The semaphores to wait on before presenting.
|
/// @param semaphores The semaphores to wait on before presenting.
|
||||||
/// @param idx The index of the swapchain image to present.
|
/// @param idx The index of the swapchain image to present.
|
||||||
|
/// @param pNext Pointer to the next structure in a chain, if any.
|
||||||
///
|
///
|
||||||
/// @throws LSFG::vulkan_error if any Vulkan call fails.
|
/// @throws LSFG::vulkan_error if any Vulkan call fails.
|
||||||
///
|
///
|
||||||
void present(const Application& app, VkQueue queue,
|
void present(const Application& app, VkQueue queue,
|
||||||
const std::vector<VkSemaphore>& semaphores, uint32_t idx);
|
const std::vector<VkSemaphore>& semaphores, uint32_t idx, const void* pNext);
|
||||||
|
|
||||||
/// Get the Vulkan swapchain handle.
|
/// Get the Vulkan swapchain handle.
|
||||||
[[nodiscard]] VkSwapchainKHR handle() const { return this->swapchain; }
|
[[nodiscard]] VkSwapchainKHR handle() const { return this->swapchain; }
|
||||||
|
|
|
||||||
|
|
@ -65,17 +65,16 @@ SwapchainContext::SwapchainContext(const Application& app, VkSwapchainKHR swapch
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::presentSwapchain(VkSwapchainKHR handle, VkQueue queue,
|
void Application::presentSwapchain(VkSwapchainKHR handle, VkQueue queue,
|
||||||
const std::vector<VkSemaphore>& semaphores, uint32_t idx) {
|
const std::vector<VkSemaphore>& semaphores, uint32_t idx, const void* pNext) {
|
||||||
auto it = this->swapchains.find(handle);
|
auto it = this->swapchains.find(handle);
|
||||||
if (it == this->swapchains.end())
|
if (it == this->swapchains.end())
|
||||||
throw std::logic_error("Swapchain not found");
|
throw std::logic_error("Swapchain not found");
|
||||||
|
|
||||||
it->second.present(*this, queue, semaphores, idx);
|
it->second.present(*this, queue, semaphores, idx, pNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwapchainContext::present(const Application& app, VkQueue queue,
|
void SwapchainContext::present(const Application& app, VkQueue queue,
|
||||||
const std::vector<VkSemaphore>& semaphores, uint32_t idx) {
|
const std::vector<VkSemaphore>& semaphores, uint32_t idx, const void* pNext) {
|
||||||
|
|
||||||
// present deferred frame if any
|
// present deferred frame if any
|
||||||
if (this->deferredIdx.has_value()) {
|
if (this->deferredIdx.has_value()) {
|
||||||
VkSemaphore deferredSemaphore = this->copySemaphores2.at((this->frameIdx - 1) % 8).handle();
|
VkSemaphore deferredSemaphore = this->copySemaphores2.at((this->frameIdx - 1) % 8).handle();
|
||||||
|
|
@ -283,6 +282,7 @@ void SwapchainContext::present(const Application& app, VkQueue queue,
|
||||||
VkSemaphore presentSemaphoreHandle = presentSemaphore.handle();
|
VkSemaphore presentSemaphoreHandle = presentSemaphore.handle();
|
||||||
const VkPresentInfoKHR presentInfo = {
|
const VkPresentInfoKHR presentInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||||
|
.pNext = pNext,
|
||||||
.waitSemaphoreCount = 1,
|
.waitSemaphoreCount = 1,
|
||||||
.pWaitSemaphores = &presentSemaphoreHandle,
|
.pWaitSemaphores = &presentSemaphoreHandle,
|
||||||
.swapchainCount = 1,
|
.swapchainCount = 1,
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ namespace {
|
||||||
std::copy_n(pPresentInfo->pWaitSemaphores, waitSemaphores.size(), waitSemaphores.data());
|
std::copy_n(pPresentInfo->pWaitSemaphores, waitSemaphores.size(), waitSemaphores.data());
|
||||||
|
|
||||||
application->presentSwapchain(*pPresentInfo->pSwapchains,
|
application->presentSwapchain(*pPresentInfo->pSwapchains,
|
||||||
queue, waitSemaphores, *pPresentInfo->pImageIndices);
|
queue, waitSemaphores, *pPresentInfo->pImageIndices, pPresentInfo->pNext);
|
||||||
|
|
||||||
Log::info("lsfg-vk(hooks): Frame presented successfully");
|
Log::info("lsfg-vk(hooks): Frame presented successfully");
|
||||||
} catch (const LSFG::vulkan_error& e) {
|
} catch (const LSFG::vulkan_error& e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue