2#include <UnCompute/Acceleration/AdapterInfo.h>
3#include <UnCompute/Memory/Object.h>
4#include <UnCompute/Utils/DynamicLibrary.h>
5#include <UnCompute/Containers/ArraySlice.h>
10 enum class BackendKind
28 class IKernelCompiler;
30 struct ComputeDeviceDesc;
67 inline constexpr const char* CreateDeviceFactoryProcName =
"CreateDeviceFactoryImpl";
68 inline constexpr const char* UraniumComputeDllName =
"UnCompute";
72 typedef ResultCode (*CreateDeviceFactoryProc)(BackendKind backendKind,
IDeviceFactory** ppDeviceFactory);
80 inline ResultCode LoadCreateDeviceFactoryProc(DynamicLibrary** ppLibrary, CreateDeviceFactoryProc* pCreateDeviceFactoryProc)
86 auto resultCode = DynamicLibrary::Create(ppLibrary);
87 if (Failed(resultCode))
92 resultCode = (*ppLibrary)->Init(UraniumComputeDllName);
93 if (Failed(resultCode))
95 UN_Error(
false,
"Couldn't load {} library", UraniumComputeDllName);
99 resultCode = (*ppLibrary)->GetFunction(CreateDeviceFactoryProcName, pCreateDeviceFactoryProc);
100 if (Failed(resultCode))
103 "Couldn't get the entry point named \"{}\" in \"{}\" library",
104 CreateDeviceFactoryProcName,
105 UraniumComputeDllName);
This class represents a non-owning slice of contiguously stored elements.
Definition: ArraySlice.h:12
Interface for all backend-specific compute devices.
Definition: IComputeDevice.h:38
This class is used to create backend-specific compute devices and related objects.
Definition: IDeviceFactory.h:34
virtual BackendKind GetBackendKind() const =0
Get kind of backend for the compute devices created by this factory.
virtual ArraySlice< const AdapterInfo > EnumerateAdapters()=0
Get all adapters supported by the specified backend.
virtual ResultCode CreateDevice(IComputeDevice **ppDevice)=0
Create a compute device.
virtual ResultCode Init(const DeviceFactoryDesc &desc)=0
Initialize the compute device factory.
virtual ResultCode CreateKernelCompiler(IKernelCompiler **ppCompiler)=0
Create a kernel compiler.
virtual void Reset()=0
Reset the compute device factory.
An interface for kernel compiler that is used for compiling compute shader source into backend's nati...
Definition: IKernelCompiler.h:74
Base interface for dynamic reference counted objects.
Definition: Object.h:8
IDeviceFactory descriptor.
Definition: IDeviceFactory.h:19
const char * ApplicationName
Name of the application.
Definition: IDeviceFactory.h:20