mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2024-11-24 15:09:17 +08:00
update simpleVulkan sample
This commit is contained in:
parent
3a05f29b94
commit
0563025cde
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user