Advertisement Jump to content
Sign in to follow this  

Direct3D 10 And Multiple Windows

This topic is 3824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all! :) I am planning to add multiple Window support to a 3D Engine. Is it better to have one device and one swap chain per window? (Multiple devices) Or one device and multiple swap chains(one swap chain per window)? Is there any restrictions when I have multiple swap chains on one device? What u suggest? thank you!

Share this post

Link to post
Share on other sites
In most cases a single-device-multiple-swapchain approach is the preferred method. This allows you to share resources between windows (resources are allocated per-device) but with shared handles in WDDM you can have a single device with single swapchain per window and share resources between them... but you will find it a bit more restrictive than the former.


Share this post

Link to post
Share on other sites
That is the way I'm doing it, one device and multiple swapchains. Lemme grab some code from my project.

RenderWindowDesc, struct - pass and array of this struct to the class constructor

struct RenderWindowDesc
//window related
HWND m_hWnd;
bool m_bWindowed;

//swapchain related
float m_fSwapchainWidth;
float m_fSwapchainHeight;
float m_fRefreshHz;
unsigned int m_nBufferCount;
float m_fClearRed;
float m_fClearGreen;
float m_fClearBlue;

//viewport related
float m_fViewportWidth;
float m_fViewportHeight;
float m_fViewportMinD;
float m_fViewportMaxD;
float m_fTopLeftX;
float m_fTopLeftY;

RenderWindow, struct - The actual stored data in my renderer class

struct RenderWindow
IDXGISwapChain* m_pd3dSwapChain;
ID3D10RenderTargetView* m_pd3dRenderTargetView;
D3D10_VIEWPORT m_d3dViewport;
ShtrColor* m_pClearColor;
ShtrMatrix4 m_matOrtho;
bool m_bIsRendering;
bool m_bIsWindowed;

Also, you should create the device with the
function. Then create a IDXGI factory with the
function. And then create the swapchains through the factory with the

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!