update simpleVulkan sample

This commit is contained in:
Rutwik Choughule 2021-11-23 18:51:00 +05:30
parent 3a05f29b94
commit 0563025cde
2 changed files with 13 additions and 4 deletions

View File

@ -1683,8 +1683,8 @@ void VulkanBaseApp::copyBuffer(VkBuffer dst, VkBuffer src, VkDeviceSize size) {
}
#ifdef _VK_TIMELINE_SEMAPHORE
void VulkanBaseApp::drawFrame() {
const uint64_t waitValue = 0;
const uint64_t signalValue = 1;
static uint64_t waitValue = 0;
static uint64_t signalValue = 1;
VkSemaphoreWaitInfo semaphoreWaitInfo = {};
semaphoreWaitInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO;
@ -1761,6 +1761,9 @@ void VulkanBaseApp::drawFrame() {
}
m_currentFrame++;
waitValue += 2;
signalValue += 2;
}
#else
void VulkanBaseApp::drawFrame() {

View File

@ -482,13 +482,16 @@ class VulkanCudaSineWave : public VulkanBaseApp {
VulkanBaseApp::drawFrame();
#ifdef _VK_TIMELINE_SEMAPHORE
static uint64_t waitValue = 1;
static uint64_t signalValue = 2;
cudaExternalSemaphoreWaitParams waitParams = {};
waitParams.flags = 0;
waitParams.params.fence.value = 1;
waitParams.params.fence.value = waitValue;
cudaExternalSemaphoreSignalParams signalParams = {};
signalParams.flags = 0;
signalParams.params.fence.value = 0;
signalParams.params.fence.value = signalValue;
// Wait for vulkan to complete it's work
checkCudaErrors(cudaWaitExternalSemaphoresAsync(&m_cudaTimelineSemaphore,
&waitParams, 1, m_stream));
@ -497,6 +500,9 @@ class VulkanCudaSineWave : public VulkanBaseApp {
// Signal vulkan to continue with the updated buffers
checkCudaErrors(cudaSignalExternalSemaphoresAsync(
&m_cudaTimelineSemaphore, &signalParams, 1, m_stream));
waitValue += 2;
signalValue += 2;
#else
cudaExternalSemaphoreWaitParams waitParams = {};
waitParams.flags = 0;