Exemplo n.º 1
0
        public Direct3DDevice9 CreateDevice(int adapter, D3DDEVTYPE deviceType, IntPtr hFocusWindow, D3DCREATE behaviorFlags, params D3DPRESENT_PARAMETERS[] pPresentationParameters)
        {
            IntPtr nativePointer;

            CreateDevice_(adapter, deviceType, hFocusWindow, behaviorFlags, pPresentationParameters, out nativePointer).CheckError();
            return(new Direct3DDevice9(nativePointer));
        }
Exemplo n.º 2
0
 /// <unmanaged>HRESULT IDirect3D9::GetDeviceCaps([In] unsigned int Adapter,[In] D3DDEVTYPE DeviceType,[Out] D3DCAPS9* pCaps)</unmanaged>
 public unsafe HRESULT GetDeviceCaps(int adapter, D3DDEVTYPE deviceType, out D3DCAPS9 caps)
 {
     fixed(void *pCaps = &caps)
     {
         //calli(System.Int32(System.Void*,System.Int32,System.Int32,System.Void*), this._nativePointer, adapter, deviceType, &result, *(*(IntPtr*)this._nativePointer + (IntPtr)14 * (IntPtr)sizeof(void*))).CheckError();
         return((HRESULT)NativeHelper.CalliInt32(14, _nativePointer, (int)adapter, (int)deviceType, (void *)pCaps));
     }
 }
Exemplo n.º 3
0
        public D3DCAPS9 GetCaps(D3DDEVTYPE type)
        {
            var caps = new D3DCAPS9();
            var hr   = _direct3d.GetDeviceCaps(this.Adapter, type, out caps);

            hr.CheckError();
            return(caps);
        }
Exemplo n.º 4
0
        /// <unmanaged>HRESULT IDirect3D9::CreateDevice([In] unsigned int Adapter,[In] D3DDEVTYPE DeviceType,[In] HWND hFocusWindow,[In] D3DCREATE BehaviorFlags,[In, Buffer] D3DPRESENT_PARAMETERS* pPresentationParameters,[Out, Fast] IDirect3DDevice9** ppReturnedDeviceInterface)</unmanaged>
        private unsafe HRESULT CreateDevice_(int adapter, D3DDEVTYPE deviceType, IntPtr hFocusWindow, D3DCREATE behaviorFlags, D3DPRESENT_PARAMETERS[] pPresentationParameters, out IntPtr ppReturnedDeviceInterface)
        {
            var     result = IntPtr.Zero;
            HRESULT hr;

            fixed(void *ptr = pPresentationParameters)
            {
                //result = calli(System.Int32(System.Void*,System.Int32,System.Int32,System.Void*,System.Int32,System.Void*,System.Void*), this._nativePointer, adapter, deviceType, (void*)hFocusWindow, behaviorFlags, ptr, &zero, *(*(IntPtr*)this._nativePointer + (IntPtr)16 * (IntPtr)sizeof(void*)));
                hr = (HRESULT)NativeHelper.CalliInt32(16, _nativePointer, adapter, (int)deviceType, (void *)hFocusWindow, (int)behaviorFlags, ptr, &result);
            }

            ppReturnedDeviceInterface = result;
            return(hr);
        }
Exemplo n.º 5
0
        //-----------------------------------------------------------------------------
        // CheckFormat
        //
        // Queries whether the D3DPresentEngine can use a specified Direct3D format.
        //-----------------------------------------------------------------------------

        public void CheckFormat(int iformat)
        {
            int        uAdapter = 0;
            D3DDEVTYPE type     = D3DDEVTYPE.HAL;

            D3DDISPLAYMODE mode;
            D3DDEVICE_CREATION_PARAMETERS dparams;

            D3DFORMAT format = (D3DFORMAT)iformat;

            if (m_pDevice != null)
            {
                m_pDevice.GetCreationParameters(out dparams);

                uAdapter = dparams.AdapterOrdinal;
                type     = dparams.DeviceType;
            }

            m_pD3D9.GetAdapterDisplayMode(uAdapter, out mode);

            m_pD3D9.CheckDeviceType(uAdapter, type, mode.Format, format, true);
        }