locked
Get content from Surface

    Question

  • I noticed "Another alternative for non-full-screen content is to render to a separate scratch surface on a background thread, then copy its contents to the surface returned from BeginDraw on the UI thread" in MSDN. I want to ask how to create an instance ofIDXGISurface and how to copy this content to another one?

    DXGI_SURFACE_DESC desc;

     desc.Width = 1024;
     desc.Height = 704;
     desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
     desc.SampleDesc.Count = 1;
     desc.SampleDesc.Quality = 0;

     if (m_dxgiDevice != nullptr)
     {
           m_dxgiDevice->CreateSurface(&desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &m_tempSurface);

    }

    HRESULT beginDrawHR = sisNative->BeginDraw(updateRectNative, &surface, &offset);

     m_tempSurface.CopyTo(&surface);

    Thursday, April 10, 2014 6:39 AM

All replies

  • I'll get our DirectX guys on this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 10, 2014 2:59 PM
    Moderator
  • Can you provide some codes to copy the content of "IDXGISurface" to another one?
    Monday, April 14, 2014 7:06 AM
  • I'll get our DirectX guys on this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    Can you provide some codes to copy the content of "IDXGISurface" to another one?
    Monday, April 14, 2014 7:06 AM
  • What do you want to implement? I think you are in the wrong way. See IDXGIDevice::CreateSurface, notably the remarks. It says we should not directly call this method.  
    Monday, May 19, 2014 6:31 AM