Jump to content

  • Log In with Google      Sign In   
  • Create Account


Multithreaded renderer (with multiple devices)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 CrescentFresh   Members   -  Reputation: 141

Like
0Likes
Like

Posted 18 December 2012 - 01:20 PM

I have a directx 9 application that needs to run on a Windows XP (embedded) machine with two monitors.

My first iteration of the renderer was a single IDirect3DDevice9 object and then I IDirect3DDevice9::CreateAdditionalSwapChain() per "screen", which rendered out multiple 'windows' positioned and sized to simulate full screen.

This worked well, however I'd get lots of screen tearing since I used D3DPRESENT_INTERVAL_IMMEDIATE within the presentation parameters because I don't want to stall the updates waiting for vBlank. Also, I assume that with only one device querying one adapter, I'd not be able to safely assume the vBlank period for both monitors, only the 'main' monitor.

So this lead me to re-writing the renderer to use multiple devices (one for each monitor), and each device has its own adapter for its respective monitor. For my purposes, this is working just as well as the additional swap chains method, however I'm back to the same issue of tearing since the alternative is stalling the main thread twice for both vBlank's, which leads to unacceptable framerate jittering.

 
If I were to put forth the incredible amount of effort of rewriting my engine to be a multi-threaded renderer, will this solve my screen tearing issue? More specifically, am I able to create a thread for each device and render/present them independently? If I must keep all DX API calls on the same thread (which I believe is the case), will stalling multiple times waiting for vBlank still allow me to achieve a 60hz FPS?

-or-

Is there an easier way to know when to invoke IDirect3DSwapChain9::Present() without D3DPRESENT_INTERVAL_DEFAULT and on a single thread?

I've tried polling IDirect3DSwapChain9::GetRasterStatus() to manually present an already rendered backbuffer in the vBlank period (per device/monitor), but that doesn't seem to be accurate enough as I still get tearing.

Edited by CrescentFresh, 18 December 2012 - 01:30 PM.

Can I play with madness?


Sponsor:

#2 fanaticlatic   Members   -  Reputation: 462

Like
1Likes
Like

Posted 31 January 2013 - 08:44 AM

directx will only vsync in fullscreen exclusive mode. So your windowed mode must be false for all your swapchains. Search fullscreen exclusive mode on MSDN should take you through it step by step.

 

Good luck.


"I have more fingers in more pies than a leper at a bakery!"




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS