Exemple #1
0
        public static IComObject <ID3D11Device> D3D11CreateDevice(
            IDXGIAdapter adapter,
            D3D_DRIVER_TYPE driverType,
            D3D11_CREATE_DEVICE_FLAG flags,
            D3D_FEATURE_LEVEL[] featureLevels = null,
            uint sdkVersion = Constants.D3D11_SDK_VERSION)
        {
            //featureLevels = featureLevels ?? new D3D_FEATURE_LEVEL[]
            //{
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_1,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_1,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_0,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_3,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_2,
            //        D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_1
            //};

            D3D11CreateDevice(
                adapter,
                driverType,
                IntPtr.Zero,
                (uint)flags,
                featureLevels,
                (uint)(featureLevels?.Length).GetValueOrDefault(),
                sdkVersion,
                out ID3D11Device device,
                out D3D_FEATURE_LEVEL level,
                out ID3D11DeviceContext dc).ThrowOnError();
            if (dc != null)
            {
                Marshal.ReleaseComObject(dc);
            }
            return(new ComObject <ID3D11Device>(device));
        }
Exemple #2
0
 public static extern int D3D11CreateDevice(
     [MarshalAs(UnmanagedType.Interface)] IDXGIAdapter pAdapter,
     D3D_DRIVER_TYPE DriverType,
     IntPtr Software,
     D3D11_CREATE_DEVICE_FLAG Flags,
     D3D_FEATURE_LEVEL[] pFeatureLevels,
     UINT FeatureLevels,
     UINT SDKVersion,
     [MarshalAs(UnmanagedType.Interface)] out ID3D11Device ppDevice,
     out D3D_FEATURE_LEVEL pFeatureLevel,
     [MarshalAs(UnmanagedType.Interface)] out ID3D11DeviceContext ppImmediateContext
     );
Exemple #3
0
 public static extern int D3D11CreateDevice(
     IntPtr pAdapter,
     D3D_DRIVER_TYPE DriverType,
     HINSTANCE Software,
     uint Flags,
     ref D3D_FEATURE_LEVEL pFeatureLevels,
     uint FeatureLevels,
     uint SDKVersion,
     ref IntPtr ppDevice,
     ref D3D_FEATURE_LEVEL pFeatureLevel,
     ref IntPtr ppImmediateContext
     );
Exemple #4
0
 public static extern int D3D11CreateDeviceAndSwapChain(
     IntPtr pAdapter,
     D3D_DRIVER_TYPE DriverType,
     HINSTANCE Software,
     uint Flags,
     ref D3D_FEATURE_LEVEL pFeatureLevels,
     uint FeatureLevels,
     uint SDKVersion,
     ref DXGI_SWAP_CHAIN_DESC pSwapChainDesc,
     ref IntPtr ppSwapChain,
     ref IntPtr ppDevice,
     ref D3D_FEATURE_LEVEL pFeatureLevel,
     ref IntPtr ppImmediateContext
     );
Exemple #5
0
 public static extern HRESULT D3D11CreateDevice(IDXGIAdapter pAdapter, D3D_DRIVER_TYPE DriverType, IntPtr Software, uint Flags, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] D3D_FEATURE_LEVEL[] pFeatureLevels, uint FeatureLevels, uint SDKVersion, out ID3D11Device ppDevice, out D3D_FEATURE_LEVEL pFeatureLevel, out ID3D11DeviceContext ppImmediateContext);
 public static extern HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, uint Flags, [NativeTypeName("const D3D_FEATURE_LEVEL *")] D3D_FEATURE_LEVEL *pFeatureLevels, uint FeatureLevels, uint SDKVersion, [NativeTypeName("const DXGI_SWAP_CHAIN_DESC *")] DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, IDXGISwapChain **ppSwapChain, ID3D11Device **ppDevice, D3D_FEATURE_LEVEL *pFeatureLevel, ID3D11DeviceContext **ppImmediateContext);
 public static extern HRESULT D3D11CreateDevice(IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, uint Flags, [NativeTypeName("const D3D_FEATURE_LEVEL *")] D3D_FEATURE_LEVEL *pFeatureLevels, uint FeatureLevels, uint SDKVersion, ID3D11Device **ppDevice, D3D_FEATURE_LEVEL *pFeatureLevel, ID3D11DeviceContext **ppImmediateContext);