RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.74k stars 160 forks source link

Fix parameters for import CUDA and HIP external memory from shared ha… #167

Closed guoxx closed 1 year ago

atafra commented 1 year ago

I reviewed the cudaExternalMemoryHandleDesc structure and there is actually no bug in the code:

typedef struct cudaExternalMemoryHandleDesc_st {
                  cudaExternalMemoryHandleType type;
                  union {
                      int fd;
                      struct {
                          void *handle;
                          const void *name;
                      } win32;
                      const void *nvSciBufObject;
                  } handle;
                  unsigned long long size;
                  unsigned int flags;
              } cudaExternalMemoryHandleDesc];

There is indeed a union but not for handle and name, which are in a struct. So initializing both values is correct and nothing is overwritten.