Posts: 1
Joined: 2011.03
Post: #1
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 ;
Quote this message in a reply
Posts: 245
Joined: 2005.11
Post: #2
Well, Macs don't support DirectX, so maybe that's it. Wink
Quote this message in a reply
⌘-R in Chief
Posts: 1,254
Joined: 2002.05
Post: #3
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 gamedev.net
Quote this message in a reply
Posts: 27
Joined: 2009.07
Post: #4
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.

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL_OPENGL flag causes VC++ app to crash renderer 3 3,781 Aug 5, 2005 10:14 AM
Last Post: Zekaric