sharpdx/SharpDX

Convert a script written by DirectX to SharpDX for Unity

idealist33 opened this issue · 0 comments

I have a script to use DirectX Device. but it does not work in Unity as it is not .NET managed DLL.
so I am trying to use SharpDX.
Here is DirectX code.

        var d3dpp = new Direct3D.PresentParameters();
        d3dpp.BackBufferFormat = Direct3D.Format.Unknown;
        d3dpp.BackBufferCount = 2;
        d3dpp.Windowed = true;
        d3dpp.SwapEffect = Direct3D.SwapEffect.Discard;
        d3dpp.DeviceWindow = this;
        d3dpp.PresentationInterval = Direct3D.PresentInterval.Default;

        m_d3DDevice = new SharpDX.Direct3D11.Device(0, Direct3D.DeviceType.Hardware, this, Direct3D.CreateFlags.HardwareVertexProcessing | Direct3D.CreateFlags.MultiThreaded, d3dpp);
        m_d3DDevice.DeviceReset += device_DeviceReset;
        device_DeviceReset(m_d3DDevice, null);
        unsafe
        {
            m_previewHelper.Initialize(new IntPtr(m_d3DDevice.UnmanagedComPointer));
        }

how can I convert this script for SharpDX?