diff options
Diffstat (limited to 'tools/gfx/cuda/cuda-helper-functions.cpp')
| -rw-r--r-- | tools/gfx/cuda/cuda-helper-functions.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/gfx/cuda/cuda-helper-functions.cpp b/tools/gfx/cuda/cuda-helper-functions.cpp index 6325d9fc6..702caf253 100644 --- a/tools/gfx/cuda/cuda-helper-functions.cpp +++ b/tools/gfx/cuda/cuda-helper-functions.cpp @@ -72,6 +72,22 @@ void _optixLogCallback(unsigned int level, const char* tag, const char* message, # endif } // namespace cuda +Result SLANG_MCALL getCUDAAdapters(List<AdapterInfo>& outAdapters) +{ + int count; + cudaGetDeviceCount(&count); + for (int i = 0; i < count; i++) + { + cudaDeviceProp prop; + cudaGetDeviceProperties(&prop, i); + AdapterInfo info = {}; + memcpy(info.name, prop.name, Math::Min(strlen(prop.name), sizeof(AdapterInfo::name) - 1)); + outAdapters.add(info); + } + + return SLANG_OK; +} + Result SLANG_MCALL createCUDADevice(const IDevice::Desc* desc, IDevice** outDevice) { RefPtr<cuda::DeviceImpl> result = new cuda::DeviceImpl(); @@ -80,6 +96,13 @@ returnComPtr(outDevice, result); return SLANG_OK; } #else + +Result SLANG_MCALL getCUDAAdapters(List<AdapterInfo>& outAdapters) +{ + SLANG_UNUSED(outAdapters); + return SLANG_FAIL; +} + Result SLANG_MCALL createCUDADevice(const IDevice::Desc* desc, IDevice** outDevice) { SLANG_UNUSED(desc); |
