Sign in to follow this  
Necrolis

[DX9] Deferred Message Processing

Recommended Posts

I like to fiddle around a lot with multi-threading my 'engine', however, I've been running into a few problems, mainly due to this article on MSDN. but I really don't want to merge my message pump and rendering loop, but at the same time, I really want to avoid problems and the D3D multithreaded flag... However thanks to work, I no longer have any time to test anything, so instead, its time for pseudo-code :)

So, how well would a setup like this work in place of the standard message pump:


while(not shutdown)
{
if(PeekAndGetMessge(Msg))
QueueThreadTask(new InputJob(Msg)) //queue the message in the thread pool, do it at the highest level possible
//the render thread has its own computations to do

if(not CheckCoop()) //yay now its being called from the message thread
RecoverDevices()

DoRendering() //this is too, but its not being delayed by input processing
}



or does D3D require that the messages go through the WNDPROC before I queue them? what at the downfalls of something like this? or is there a better way? With this kinda of model, can I also queue off resource creation(V/I buffers, textures, shaders etc)?

Something I'm curious about is if I need a WNDPROC even if I don't dispatch messages to it via DispatchMessage.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this