Vulkan CUDA interop depth attachment

I am trying to write to an imported VK_FORMAT_D32_SFLOAT depth attachment created in Vulkan within a CUDA kernel. I have successfully imported and written to color attachments using CUDA kernels but the depth buffers is causing problems. Writing to the depth attachment seems to not work correctly and I think it is related to the depth buffer memory layout but I can’t be certain. Attached is a screenshot of a rendered image demonstrating the behavior I am seeing. The test render pipeline which produced the image consists of 2 stages. A CUDA kernel sets the depth and color values (the gray background) in the first stage and in the second stage a shader uses the depth value to draw a color over a single triangle (the green object in the attached image). If the depth buffer value at each pixel is equal to 1 green is drawn, otherwise red is drawn. There are a number of strange red artifacts indicating the depth buffer is being written to incorrectly. This same behavior is not seen with the color attachments. I’ve tried adjusting the parameters used when exporting the device memory from Vulkan (for example adding the CUDA_ARRAY3D_DEPTH_TEXTURE and CUDA_ARRAY3D_COLOR_ATTACHMENT flags to the external mipmap array) but the changes either cause the code to crash or change nothing. Does anyone know of any resources that discuss importing depth attachments into CUDA from Vulkan?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.