locked
DirectX 11.1 MultiThreaded Rendering Problem

    Question

  • Hi there

    Can any body help me please? I'm working on project which is based on DirectX 11.1.
    I want to create multiple render context and I need to wait for another thread in main thread. Unfortunately "WaitForSingleObject" is missing in C++/CX and I can not wait in main thread. How could i solve this solution?

    void RenderMethod()

    {

    auto t = create_task([this]()
    {
    //do rendering on deferred context

    });

    t.wait();

    //do final rendering

    }

    when t.wait called, it will throw an exception which said that "Illegal to wait on a task in a Windows Runtime STA".
    This means i can not use multiThread rending in DirectX 11.1 from Metro Style application?

    Any help is really appreciated.


    Best Regards. Pooya Eimandar.



    Monday, December 03, 2012 7:05 PM

Answers

  • C++/CX is the language extension, not the API.

    WaitForSingleObject is not available in the "WINAPI_PARTITION_APP" API Family, but WaitForSingleObjectEx is along with CreateEventEx.

    See Dual-use Coding Techniques for Games.

    • Marked as answer by Pooya Eimandar Tuesday, December 04, 2012 9:15 PM
    Tuesday, December 04, 2012 7:29 PM

All replies

  • C++/CX is the language extension, not the API.

    WaitForSingleObject is not available in the "WINAPI_PARTITION_APP" API Family, but WaitForSingleObjectEx is along with CreateEventEx.

    See Dual-use Coding Techniques for Games.

    • Marked as answer by Pooya Eimandar Tuesday, December 04, 2012 9:15 PM
    Tuesday, December 04, 2012 7:29 PM
  • Thanks a lot Chuck.
    It was helpful.


    Best Regards. Pooya Eimandar.

    Tuesday, December 04, 2012 9:17 PM