GPUOpen-LibrariesAndSDKs / RadeonRays_SDK

Radeon Rays is ray intersection acceleration library for hardware and software multiplatforms using CPU and GPU
MIT License
1.06k stars 190 forks source link

Vulkan synchronization #209

Closed himanshugoel2797 closed 4 years ago

himanshugoel2797 commented 4 years ago

I'm trying to integrate the library into my vulkan game engine, but for it to fit nicely into the vulkan pipeline (and particularly since the library chooses to handle command buffer submission itself), can we please get a way to pass in vulkan semaphores to rrSubmitCommandStream?

ilyas-gazizov commented 4 years ago

It is not possible to use semaphores in frames of RadeonRays API. However, it is possible to use external to the library VkCommandBuffer, create RadeonRays command stream from it and then use for RadeonRays operation. After that you can use initial vulkan command buffer to submit all the tasks to vulkan queue.

VkCommandBuffer command_buffer;
// init command buffer
rrGetCommandStreamFromVkCommandBuffer(context, command_buffer, &command_stream);
// use command_stream for RadeonRays specific code
// add some other vulkan things to command_buffer, e.g
vkCmdCopyBuffer(command_buffer, hits_buffer, staging_hits_buffer, 1u, &copy_region);
vkEndCommandBuffer(command_buffer);
// fill vkSubmitInfo and submit queue where you can use semaphores
himanshugoel2797 commented 4 years ago

Ah, that did the trick! Thanks for the help :)