nvidia/cuda: Apply coding guidelines

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-06-08 04:42:43 +02:00
parent c84c301d49
commit dcd4f7f9f0
2 changed files with 122 additions and 119 deletions

View file

@ -36,44 +36,44 @@
#endif #endif
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
#define CUDA_NAME "nvcuda.dll" #define ST_CUDA_NAME "nvcuda.dll"
#else #else
#define CUDA_NAME "libcuda.so.1" #define ST_CUDA_NAME "libcuda.so.1"
#endif #endif
#define CUDA_LOAD_SYMBOL(NAME) \ #define P_CUDA_LOAD_SYMBOL(NAME) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME)); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME)); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" ST_CUDA_NAME "'."); \
} }
#define CUDA_LOAD_SYMBOL_OPT(NAME) \ #define P_CUDA_LOAD_SYMBOL_OPT(NAME) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME)); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME)); \
if (!NAME) \ if (!NAME) \
D_LOG_WARNING("Loading of optional symbol '" #NAME "' failed.", 0); \ D_LOG_WARNING("Loading of optional symbol '" #NAME "' failed.", 0); \
} }
#define CUDA_LOAD_SYMBOL_EX(NAME, OVERRIDE) \ #define P_CUDA_LOAD_SYMBOL_EX(NAME, OVERRIDE) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#OVERRIDE)); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#OVERRIDE)); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" ST_CUDA_NAME "'."); \
} }
#define CUDA_LOAD_SYMBOL_OPT_EX(NAME, OVERRIDE) \ #define P_CUDA_LOAD_SYMBOL_OPT_EX(NAME, OVERRIDE) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#OVERRIDE)); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#OVERRIDE)); \
if (!NAME) \ if (!NAME) \
D_LOG_WARNING("Loading of optional symbol '" #NAME "' failed.", 0); \ D_LOG_WARNING("Loading of optional symbol '" #NAME "' failed.", 0); \
} }
#define CUDA_LOAD_SYMBOL_V2(NAME) \ #define P_CUDA_LOAD_SYMBOL_V2(NAME) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME "_v2")); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME "_v2")); \
if (!NAME) \ if (!NAME) \
throw std::runtime_error("Failed to load '" #NAME "' from '" CUDA_NAME "'."); \ throw std::runtime_error("Failed to load '" #NAME "' from '" ST_CUDA_NAME "'."); \
} }
#define CUDA_LOAD_SYMBOL_OPT_V2(NAME) \ #define P_CUDA_LOAD_SYMBOL_OPT_V2(NAME) \
{ \ { \
NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME "_v2")); \ NAME = reinterpret_cast<decltype(NAME)>(_library->load_symbol(#NAME "_v2")); \
if (!NAME) \ if (!NAME) \
@ -91,14 +91,14 @@ nvidia::cuda::cuda::cuda() : _library()
D_LOG_DEBUG("Initialization... (Addr: 0x%" PRIuPTR ")", this); D_LOG_DEBUG("Initialization... (Addr: 0x%" PRIuPTR ")", this);
_library = streamfx::util::library::load(std::string_view(CUDA_NAME)); _library = streamfx::util::library::load(std::string_view(ST_CUDA_NAME));
{ // 1. Load critical initialization functions. { // 1. Load critical initialization functions.
// Initialization // Initialization
CUDA_LOAD_SYMBOL(cuInit); P_CUDA_LOAD_SYMBOL(cuInit);
// Version Management // Version Management
CUDA_LOAD_SYMBOL(cuDriverGetVersion); P_CUDA_LOAD_SYMBOL(cuDriverGetVersion);
} }
{ // 2. Get the CUDA Driver version and log it. { // 2. Get the CUDA Driver version and log it.
@ -117,44 +117,44 @@ nvidia::cuda::cuda::cuda() : _library()
// - Not yet needed. // - Not yet needed.
// Primary Context Management // Primary Context Management
CUDA_LOAD_SYMBOL(cuDevicePrimaryCtxRetain); P_CUDA_LOAD_SYMBOL(cuDevicePrimaryCtxRetain);
CUDA_LOAD_SYMBOL_V2(cuDevicePrimaryCtxRelease); P_CUDA_LOAD_SYMBOL_V2(cuDevicePrimaryCtxRelease);
CUDA_LOAD_SYMBOL_OPT_V2(cuDevicePrimaryCtxSetFlags); P_CUDA_LOAD_SYMBOL_OPT_V2(cuDevicePrimaryCtxSetFlags);
// Context Management // Context Management
CUDA_LOAD_SYMBOL_V2(cuCtxCreate); P_CUDA_LOAD_SYMBOL_V2(cuCtxCreate);
CUDA_LOAD_SYMBOL_V2(cuCtxDestroy); P_CUDA_LOAD_SYMBOL_V2(cuCtxDestroy);
CUDA_LOAD_SYMBOL_V2(cuCtxPushCurrent); P_CUDA_LOAD_SYMBOL_V2(cuCtxPushCurrent);
CUDA_LOAD_SYMBOL_V2(cuCtxPopCurrent); P_CUDA_LOAD_SYMBOL_V2(cuCtxPopCurrent);
CUDA_LOAD_SYMBOL_OPT(cuCtxGetCurrent); P_CUDA_LOAD_SYMBOL_OPT(cuCtxGetCurrent);
CUDA_LOAD_SYMBOL_OPT(cuCtxSetCurrent); P_CUDA_LOAD_SYMBOL_OPT(cuCtxSetCurrent);
CUDA_LOAD_SYMBOL(cuCtxGetStreamPriorityRange); P_CUDA_LOAD_SYMBOL(cuCtxGetStreamPriorityRange);
CUDA_LOAD_SYMBOL(cuCtxSynchronize); P_CUDA_LOAD_SYMBOL(cuCtxSynchronize);
// Module Management // Module Management
// - Not yet needed. // - Not yet needed.
// Memory Management // Memory Management
CUDA_LOAD_SYMBOL_V2(cuMemAlloc); P_CUDA_LOAD_SYMBOL_V2(cuMemAlloc);
CUDA_LOAD_SYMBOL_V2(cuMemAllocPitch); P_CUDA_LOAD_SYMBOL_V2(cuMemAllocPitch);
CUDA_LOAD_SYMBOL_V2(cuMemFree); P_CUDA_LOAD_SYMBOL_V2(cuMemFree);
CUDA_LOAD_SYMBOL(cuMemcpy); P_CUDA_LOAD_SYMBOL(cuMemcpy);
CUDA_LOAD_SYMBOL_V2(cuMemcpy2D); P_CUDA_LOAD_SYMBOL_V2(cuMemcpy2D);
CUDA_LOAD_SYMBOL_V2(cuMemcpy2DAsync); P_CUDA_LOAD_SYMBOL_V2(cuMemcpy2DAsync);
CUDA_LOAD_SYMBOL_OPT_V2(cuArrayGetDescriptor); P_CUDA_LOAD_SYMBOL_OPT_V2(cuArrayGetDescriptor);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoA); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoA);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoD); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoD);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoH); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoH);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoHAsync); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyAtoHAsync);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoA); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoA);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoD); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoD);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoH); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoH);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoHAsync); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyDtoHAsync);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoA); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoA);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoAAsync); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoAAsync);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoD); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoD);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoDAsync); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemcpyHtoDAsync);
CUDA_LOAD_SYMBOL_OPT_V2(cuMemHostGetDevicePointer); P_CUDA_LOAD_SYMBOL_OPT_V2(cuMemHostGetDevicePointer);
// Virtual Memory Management // Virtual Memory Management
// - Not yet needed. // - Not yet needed.
@ -166,11 +166,11 @@ nvidia::cuda::cuda::cuda() : _library()
// - Not yet needed. // - Not yet needed.
// Stream Management // Stream Management
CUDA_LOAD_SYMBOL(cuStreamCreate); P_CUDA_LOAD_SYMBOL(cuStreamCreate);
CUDA_LOAD_SYMBOL_V2(cuStreamDestroy); P_CUDA_LOAD_SYMBOL_V2(cuStreamDestroy);
CUDA_LOAD_SYMBOL(cuStreamSynchronize); P_CUDA_LOAD_SYMBOL(cuStreamSynchronize);
CUDA_LOAD_SYMBOL_OPT(cuStreamCreateWithPriority); P_CUDA_LOAD_SYMBOL_OPT(cuStreamCreateWithPriority);
CUDA_LOAD_SYMBOL_OPT(cuStreamGetPriority); P_CUDA_LOAD_SYMBOL_OPT(cuStreamGetPriority);
// Event Management // Event Management
// - Not yet needed. // - Not yet needed.
@ -200,10 +200,10 @@ nvidia::cuda::cuda::cuda() : _library()
// - Not yet needed. // - Not yet needed.
// Graphics Interoperability // Graphics Interoperability
CUDA_LOAD_SYMBOL(cuGraphicsMapResources); P_CUDA_LOAD_SYMBOL(cuGraphicsMapResources);
CUDA_LOAD_SYMBOL(cuGraphicsSubResourceGetMappedArray); P_CUDA_LOAD_SYMBOL(cuGraphicsSubResourceGetMappedArray);
CUDA_LOAD_SYMBOL(cuGraphicsUnmapResources); P_CUDA_LOAD_SYMBOL(cuGraphicsUnmapResources);
CUDA_LOAD_SYMBOL(cuGraphicsUnregisterResource); P_CUDA_LOAD_SYMBOL(cuGraphicsUnregisterResource);
// Driver Entry Point Access // Driver Entry Point Access
// - Not yet needed. // - Not yet needed.
@ -225,12 +225,12 @@ nvidia::cuda::cuda::cuda() : _library()
// - Not yet needed. // - Not yet needed.
// Direct3D10 Interoperability // Direct3D10 Interoperability
CUDA_LOAD_SYMBOL(cuD3D10GetDevice); P_CUDA_LOAD_SYMBOL(cuD3D10GetDevice);
CUDA_LOAD_SYMBOL_OPT(cuGraphicsD3D10RegisterResource); P_CUDA_LOAD_SYMBOL_OPT(cuGraphicsD3D10RegisterResource);
// Direct3D11 Interoperability // Direct3D11 Interoperability
CUDA_LOAD_SYMBOL(cuD3D11GetDevice); P_CUDA_LOAD_SYMBOL(cuD3D11GetDevice);
CUDA_LOAD_SYMBOL_OPT(cuGraphicsD3D11RegisterResource); P_CUDA_LOAD_SYMBOL_OPT(cuGraphicsD3D11RegisterResource);
#endif #endif
} }

View file

@ -32,7 +32,7 @@
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#define CUDA_DEFINE_FUNCTION(name, ...) \ #define P_CUDA_DEFINE_FUNCTION(name, ...) \
private: \ private: \
typedef ::nvidia::cuda::result (*t##name)(__VA_ARGS__); \ typedef ::nvidia::cuda::result (*t##name)(__VA_ARGS__); \
\ \
@ -186,55 +186,57 @@ namespace nvidia::cuda {
public: public:
// Initialization // Initialization
CUDA_DEFINE_FUNCTION(cuInit, int32_t flags); P_CUDA_DEFINE_FUNCTION(cuInit, int32_t flags);
// Version Management // Version Management
CUDA_DEFINE_FUNCTION(cuDriverGetVersion, int32_t* driverVersion); P_CUDA_DEFINE_FUNCTION(cuDriverGetVersion, int32_t* driverVersion);
// Device Management // Device Management
// - Not yet needed. // - Not yet needed.
// Primary Context Management // Primary Context Management
CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxRelease, device_t device); P_CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxRelease, device_t device);
CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxRetain, context_t* ctx, device_t device); P_CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxRetain, context_t* ctx, device_t device);
CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxSetFlags, device_t device, context_flags flags); P_CUDA_DEFINE_FUNCTION(cuDevicePrimaryCtxSetFlags, device_t device, context_flags flags);
// Context Management // Context Management
CUDA_DEFINE_FUNCTION(cuCtxCreate, context_t* ctx, context_flags flags, device_t device); P_CUDA_DEFINE_FUNCTION(cuCtxCreate, context_t* ctx, context_flags flags, device_t device);
CUDA_DEFINE_FUNCTION(cuCtxDestroy, context_t ctx); P_CUDA_DEFINE_FUNCTION(cuCtxDestroy, context_t ctx);
CUDA_DEFINE_FUNCTION(cuCtxGetCurrent, context_t* ctx); P_CUDA_DEFINE_FUNCTION(cuCtxGetCurrent, context_t* ctx);
CUDA_DEFINE_FUNCTION(cuCtxGetStreamPriorityRange, int32_t* lowestPriority, int32_t* highestPriority); P_CUDA_DEFINE_FUNCTION(cuCtxGetStreamPriorityRange, int32_t* lowestPriority, int32_t* highestPriority);
CUDA_DEFINE_FUNCTION(cuCtxPopCurrent, context_t* ctx); P_CUDA_DEFINE_FUNCTION(cuCtxPopCurrent, context_t* ctx);
CUDA_DEFINE_FUNCTION(cuCtxPushCurrent, context_t ctx); P_CUDA_DEFINE_FUNCTION(cuCtxPushCurrent, context_t ctx);
CUDA_DEFINE_FUNCTION(cuCtxSetCurrent, context_t ctx); P_CUDA_DEFINE_FUNCTION(cuCtxSetCurrent, context_t ctx);
CUDA_DEFINE_FUNCTION(cuCtxSynchronize); P_CUDA_DEFINE_FUNCTION(cuCtxSynchronize);
// Module Management // Module Management
// - Not yet needed. // - Not yet needed.
// Memory Management // Memory Management
CUDA_DEFINE_FUNCTION(cuArrayGetDescriptor, array_descriptor_v2_t* pArrayDescripter, array_t array); P_CUDA_DEFINE_FUNCTION(cuArrayGetDescriptor, array_descriptor_v2_t* pArrayDescripter, array_t array);
CUDA_DEFINE_FUNCTION(cuMemAlloc, device_ptr_t* ptr, std::size_t bytes); P_CUDA_DEFINE_FUNCTION(cuMemAlloc, device_ptr_t* ptr, std::size_t bytes);
CUDA_DEFINE_FUNCTION(cuMemAllocPitch, device_ptr_t* ptr, std::size_t* pitch, std::size_t width_in_bytes, P_CUDA_DEFINE_FUNCTION(cuMemAllocPitch, device_ptr_t* ptr, std::size_t* pitch, std::size_t width_in_bytes,
std::size_t height, uint32_t element_size_bytes); std::size_t height, uint32_t element_size_bytes);
CUDA_DEFINE_FUNCTION(cuMemFree, device_ptr_t ptr); P_CUDA_DEFINE_FUNCTION(cuMemFree, device_ptr_t ptr);
CUDA_DEFINE_FUNCTION(cuMemHostGetDevicePointer, device_ptr_t* devptr, void* ptr, uint32_t flags); P_CUDA_DEFINE_FUNCTION(cuMemHostGetDevicePointer, device_ptr_t* devptr, void* ptr, uint32_t flags);
CUDA_DEFINE_FUNCTION(cuMemcpy, device_ptr_t dst, device_ptr_t src, std::size_t bytes); P_CUDA_DEFINE_FUNCTION(cuMemcpy, device_ptr_t dst, device_ptr_t src, std::size_t bytes);
CUDA_DEFINE_FUNCTION(cuMemcpy2D, const memcpy2d_v2_t* copy); P_CUDA_DEFINE_FUNCTION(cuMemcpy2D, const memcpy2d_v2_t* copy);
CUDA_DEFINE_FUNCTION(cuMemcpy2DAsync, const memcpy2d_v2_t* copy, stream_t stream); P_CUDA_DEFINE_FUNCTION(cuMemcpy2DAsync, const memcpy2d_v2_t* copy, stream_t stream);
CUDA_DEFINE_FUNCTION(cuMemcpyAtoA, array_t dst, std::size_t dstOffset, array_t src, std::size_t srcOffset, P_CUDA_DEFINE_FUNCTION(cuMemcpyAtoA, array_t dst, std::size_t dstOffset, array_t src, std::size_t srcOffset,
std::size_t byteCount); std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyAtoD, device_ptr_t dst, array_t src, std::size_t srcOffset, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyAtoD, device_ptr_t dst, array_t src, std::size_t srcOffset,
CUDA_DEFINE_FUNCTION(cuMemcpyAtoH, void* dst, array_t src, std::size_t srcOffset, std::size_t byteCount); std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyAtoHAsync, void* dst, array_t src, std::size_t srcOffset, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyAtoH, void* dst, array_t src, std::size_t srcOffset, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyDtoA, array_t dst, std::size_t dstOffset, device_ptr_t src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyAtoHAsync, void* dst, array_t src, std::size_t srcOffset, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyDtoD, device_ptr_t dst, array_t srcArray, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyDtoA, array_t dst, std::size_t dstOffset, device_ptr_t src,
CUDA_DEFINE_FUNCTION(cuMemcpyDtoH, void* dst, array_t src, std::size_t byteCount); std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyDtoHAsync, void* dst, array_t src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyDtoD, device_ptr_t dst, array_t srcArray, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyHtoA, array_t dst, std::size_t dstOffset, void* src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyDtoH, void* dst, array_t src, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyHtoAAsync, array_t dst, std::size_t dstOffset, void* src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyDtoHAsync, void* dst, array_t src, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyHtoD, device_ptr_t dst, void* src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyHtoA, array_t dst, std::size_t dstOffset, void* src, std::size_t byteCount);
CUDA_DEFINE_FUNCTION(cuMemcpyHtoDAsync, device_ptr_t dst, void* src, std::size_t byteCount); P_CUDA_DEFINE_FUNCTION(cuMemcpyHtoAAsync, array_t dst, std::size_t dstOffset, void* src, std::size_t byteCount);
P_CUDA_DEFINE_FUNCTION(cuMemcpyHtoD, device_ptr_t dst, void* src, std::size_t byteCount);
P_CUDA_DEFINE_FUNCTION(cuMemcpyHtoDAsync, device_ptr_t dst, void* src, std::size_t byteCount);
// Virtual Memory Management // Virtual Memory Management
// - Not yet needed. // - Not yet needed.
@ -246,11 +248,11 @@ namespace nvidia::cuda {
// - Not yet needed. // - Not yet needed.
// Stream Managment // Stream Managment
CUDA_DEFINE_FUNCTION(cuStreamCreate, stream_t* stream, stream_flags flags); P_CUDA_DEFINE_FUNCTION(cuStreamCreate, stream_t* stream, stream_flags flags);
CUDA_DEFINE_FUNCTION(cuStreamCreateWithPriority, stream_t* stream, stream_flags flags, int32_t priority); P_CUDA_DEFINE_FUNCTION(cuStreamCreateWithPriority, stream_t* stream, stream_flags flags, int32_t priority);
CUDA_DEFINE_FUNCTION(cuStreamDestroy, stream_t stream); P_CUDA_DEFINE_FUNCTION(cuStreamDestroy, stream_t stream);
CUDA_DEFINE_FUNCTION(cuStreamSynchronize, stream_t stream); P_CUDA_DEFINE_FUNCTION(cuStreamSynchronize, stream_t stream);
CUDA_DEFINE_FUNCTION(cuStreamGetPriority, stream_t stream, int32_t* priority); P_CUDA_DEFINE_FUNCTION(cuStreamGetPriority, stream_t stream, int32_t* priority);
// Event Management // Event Management
// - Not yet needed. // - Not yet needed.
@ -280,11 +282,12 @@ namespace nvidia::cuda {
// - Not yet needed. // - Not yet needed.
// Graphics Interoperability // Graphics Interoperability
CUDA_DEFINE_FUNCTION(cuGraphicsMapResources, uint32_t count, graphics_resource_t* resources, stream_t stream); P_CUDA_DEFINE_FUNCTION(cuGraphicsMapResources, uint32_t count, graphics_resource_t* resources, stream_t stream);
CUDA_DEFINE_FUNCTION(cuGraphicsSubResourceGetMappedArray, array_t* array, graphics_resource_t resource, P_CUDA_DEFINE_FUNCTION(cuGraphicsSubResourceGetMappedArray, array_t* array, graphics_resource_t resource,
uint32_t index, uint32_t level); uint32_t index, uint32_t level);
CUDA_DEFINE_FUNCTION(cuGraphicsUnmapResources, uint32_t count, graphics_resource_t* resources, stream_t stream); P_CUDA_DEFINE_FUNCTION(cuGraphicsUnmapResources, uint32_t count, graphics_resource_t* resources,
CUDA_DEFINE_FUNCTION(cuGraphicsUnregisterResource, graphics_resource_t resource); stream_t stream);
P_CUDA_DEFINE_FUNCTION(cuGraphicsUnregisterResource, graphics_resource_t resource);
// Driver Entry Point Access // Driver Entry Point Access
// - Not yet needed. // - Not yet needed.
@ -306,14 +309,14 @@ namespace nvidia::cuda {
// - Not yet needed. // - Not yet needed.
// Direct3D10 Interoperability // Direct3D10 Interoperability
CUDA_DEFINE_FUNCTION(cuD3D10GetDevice, device_t* device, IDXGIAdapter* adapter); P_CUDA_DEFINE_FUNCTION(cuD3D10GetDevice, device_t* device, IDXGIAdapter* adapter);
CUDA_DEFINE_FUNCTION(cuGraphicsD3D10RegisterResource, graphics_resource_t* resource, P_CUDA_DEFINE_FUNCTION(cuGraphicsD3D10RegisterResource, graphics_resource_t* resource,
ID3D10Resource* d3dresource, uint32_t flags); ID3D10Resource* d3dresource, uint32_t flags);
// Direct3D11 Interoperability // Direct3D11 Interoperability
CUDA_DEFINE_FUNCTION(cuD3D11GetDevice, device_t* device, IDXGIAdapter* adapter); P_CUDA_DEFINE_FUNCTION(cuD3D11GetDevice, device_t* device, IDXGIAdapter* adapter);
CUDA_DEFINE_FUNCTION(cuGraphicsD3D11RegisterResource, graphics_resource_t* resource, P_CUDA_DEFINE_FUNCTION(cuGraphicsD3D11RegisterResource, graphics_resource_t* resource,
ID3D11Resource* d3dresource, uint32_t flags); ID3D11Resource* d3dresource, uint32_t flags);
#endif #endif
public: public:
static std::shared_ptr<::nvidia::cuda::cuda> get(); static std::shared_ptr<::nvidia::cuda::cuda> get();