iDevGames Forums

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE Flag (/thread-8701.html)

DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE Flag - Belkacem - Mar 6, 2011 02:55 AM

Hi all

i have a problem in directx11

whene i want to create device using DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE

i get return e_fail why

_Swp_Chain_desc.BufferCount = 1 ;
    _Swp_Chain_desc.BufferDesc .Format = _Mode_Desc->Format ;
    _Swp_Chain_desc.BufferDesc .Height = _Height;
    _Swp_Chain_desc.BufferDesc .RefreshRate = _Mode_Desc->RefreshRate ;
    _Swp_Chain_desc.BufferDesc .Scaling = _Mode_Desc->Scaling ;
    _Swp_Chain_desc.BufferDesc .ScanlineOrdering = _Mode_Desc->ScanlineOrdering ;
    _Swp_Chain_desc.BufferDesc .Width = _Width ;
    _Swp_Chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT ;
    _Swp_Chain_desc.OutputWindow = hwnd ;
    _Swp_Chain_desc.SampleDesc = _Sapmle_Desc;
    _Swp_Chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD ;
    _Swp_Chain_desc.Windowed = Windowed ;

    if ( FAILED (D3D11CreateDeviceAndSwapChain  ( NULL , D3D_DRIVER_TYPE_HARDWARE , NULL  , D3D11_CREATE_DEVICE_SINGLETHREADED, Feature_Level_List
                           ,_Number_Feature_Level_List , D3D11_SDK_VERSION , &_Swp_Chain_desc, &_SwapChain, &_Device ,&_featureLevel , &_DeviceContext )))

        return E_FAIL ;

RE: DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE Flag - backslash - Mar 6, 2011 06:28 AM

Well, Macs don't support DirectX, so maybe that's it. Wink

RE: DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE Flag - SethWillits - Mar 6, 2011 04:17 PM

To elaborate...... Wink

iDevGames is a Mac and iOS game development website. "We don't do" DirectX so you're not likely to ever receive a reply. You're better off trying at

RE: DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE Flag - Nobody - Mar 9, 2011 11:12 AM

Just to make sure, you can get it to run if you're using any other swap chain, correct? Because it could be an issue with your machine lacking support for D3D11. <.<

Why, exactly, do you need a GDI-compatible swap chain? There's very little reason to render GDI controls on top of a rendered scene. If you're doing as I suspect and working on a level editor of sorts, it would be much better to simply create the D3D device on a control (in GDI, all controls are simply windows, and should have a window handle (hwnd) that can be used in the device creation), while having your editing controls placed elsewhere, such as on a property grid (possibly floating) docked to the right of the editing window.

As far as figuring out what's wrong (barring a lack of support for D3D11), use the debug version of DXGI and build your project. That should allow you to see what is going wrong with the swap chain creation.