XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Help with Device Creation

Last post 04-25-2008 3:11 PM by Ralf Kornmann. 4 replies.
  • 04-24-2008 10:49 AM

    Help with Device Creation

    I'm trying to create my device for Direct3D, but I keep getting D3DERR_INVALIDCALL. This is my call to CreateDevice():
    long dev_result = d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,m_window,D3DCREATE_MIXED_VERTEXPROCESSING,
    &d3dpp,&m_device);

    As far as I can see, the only things that could be wrong are the window(m_window), the presentation parameters (d3dpp), the device (m_device), or some thing else that I'm unaware of that could be causing the problem.

    Here's the declaration of m_device:
    IDirect3DDevice9* m_device;


    Here are my presentation parameters:
    D3DPRESENT_PARAMETERS d3dpp;
      ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS));
      d3dpp.BackBufferWidth = g_deviceEnumeration->GetSelectedDisplayMode()->Width;
      d3dpp.BackBufferHeight = g_deviceEnumeration->GetSelectedDisplayMode()->Height;
      d3dpp.BackBufferFormat = g_deviceEnumeration->GetSelectedDisplayMode()->Format;
      d3dpp.BackBufferCount = m_setup->totalBackBuffers;
      d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
      d3dpp.hDeviceWindow = m_window;
      d3dpp.Windowed = g_deviceEnumeration->IsWindowed();
      d3dpp.EnableAutoDepthStencil = true;
      d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
      d3dpp.FullScreen_RefreshRateInHz = g_deviceEnumeration->GetSelectedDisplayMode()->RefreshRate;
      if(g_deviceEnumeration->IsVSynced() == true)
        d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
      else
        d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;


    And here's the creation of the window:
      if((m_window = CreateWindow("WindowClass",m_setup->name,g_deviceEnumeration->IsWindowed() ? WS_OVERLAPPED : WS_POPUP,0,0,800,600,NULL,NULL,m_setup->instance,NULL)) == NULL)
      {
        MessageBox(NULL,"Error creating the window","CreateWindow()",MB_OK | MB_ICONERROR);
        return;
      }


    Can anyone help me with this? I've had this up in another forum but no one was able to help.

    Any and all help is greatly appreciated.
    Viri qui habent nullum, timent nullum. Men who have nothing, fear nothing.
  • 04-24-2008 12:07 PM In reply to

    Re: Help with Device Creation

    Have you enabled the debug runtime? It should tell you why Direct3D cannot create the device.

  • 04-24-2008 1:46 PM In reply to

    Re: Help with Device Creation

    Um, no. What exactly is the debug runtime? How do you activate/use it?
    Viri qui habent nullum, timent nullum. Men who have nothing, fear nothing.
  • 04-24-2008 8:43 PM In reply to

    Re: Help with Device Creation

    Err... I got this error: Direct3D9: (ERROR) : Device cannot perform mixed processing because driver cannot do hardware T&L. ValidateCreateDevice failed.

    I'm guessing that means my computer sucks too much...


    Viri qui habent nullum, timent nullum. Men who have nothing, fear nothing.
  • 04-25-2008 3:11 PM In reply to

    Re: Help with Device Creation

    You can at least try Software vertex processing. The SDK contains a tool called DirectX Caps Viewer. You can use it to check what’s supported.

Page 1 of 1 (5 items) Previous Next