Example #1
0
    public static T DMLCreateDevice <T>(ID3D12Device d3d12Device, CreateDeviceFlags createDeviceFlags, FeatureLevel minimumFeatureLevel)
        where T : IDMLDevice
    {
        DMLCreateDevice1(
            d3d12Device,
            createDeviceFlags,
            minimumFeatureLevel,
            typeof(T).GUID,
            out IntPtr nativePtr).CheckError();

        return(MarshallingHelpers.FromPointer <T>(nativePtr) ?? throw new NullReferenceException());
    }
Example #2
0
    public static Result DMLCreateDevice <T>(ID3D12Device d3d12Device, CreateDeviceFlags createDeviceFlags, out T?device)
        where T : IDMLDevice
    {
        Result result = DMLCreateDevice(
            d3d12Device,
            createDeviceFlags,
            typeof(T).GUID,
            out IntPtr nativePtr);

        if (result.Failure)
        {
            device = default;
            return(result);
        }

        device = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #3
0
 public static IDMLDevice DMLCreateDevice(ID3D12Device d3d12Device, CreateDeviceFlags createDeviceFlags)
 {
     DMLCreateDevice(d3d12Device, createDeviceFlags, typeof(IDMLDevice).GUID, out IntPtr nativePtr).CheckError();
     return(new(nativePtr));
 }