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.e. there are no regions of incorrectly colored pixels for 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. Is there any documentation on how to properly import a depth attachment from Vulkan into CUDA?
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| CUDA access to Vulkan depth texture | 0 | 836 | October 15, 2020 | |
| Create Depth Renderbuffer in CUDA | 2 | 11467 | November 14, 2011 | |
| Map OpenGL depth buffer in CUDA kernel | 3 | 2020 | September 8, 2016 | |
| CUDA Interop for depth component, work-around. | 0 | 1875 | December 21, 2014 | |
| Does CUDA support 24bit float ? Try to use openGL depthbuffer in CUDA | 7 | 2168 | June 23, 2011 | |
| CUDA Open GL interop depth component | 0 | 584 | January 24, 2015 | |
| OpenGL cuda interoperability | 0 | 762 | September 8, 2016 | |
| Vulkan wrong depth values | 15 | 189 | May 18, 2025 | |
| SSAO in CUDA & Depth Buffer Access | 4 | 3745 | April 10, 2009 | |
| GL_DEPTH_COMPONENT support in CUDA GL interop | 0 | 993 | May 6, 2011 |
