Sign in to follow this  

Is it possible to make a multi-threaded renderer?

This topic is 728 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

When I put the renderer into a thread pool,

the debugger jumps all over the places,

and I want to protect the device from being accessed by the main thread

and the renderer at the same time without success.

 

 

 

I just want to keep one thread to have access to the m_pDevice,

Also, How can I keep the right order of the pipeline, I think the pipeline has run out of order.

I just hate the idea of the next thread being activated when the first request is finished.

When the mainthread is going to present the batch, the renderer suddenly wake up again... How nasty

How can I do that?

Thanks in advance

Jack

class d3d
{
private:
    // protected resource
    static LPDIRECT3DDEVICE9 m_pDevice;
    static LPD3DXEFFECT m_pEffect;

    

public:
    virtual ~d3d() {    }
    static d3d& GetInstance();

    static LPDIRECT3DDEVICE9& GetDevice() { return m_pDevice; }
    

private:
    static std::unique_ptr<d3d> m_instance;
    static std::once_flag m_onceFlag;
    d3d(void) { }
    d3d(const d3d& src);
    d3d& operator=(const d3d& rhs);
};
Edited by lucky6969b

Share this post


Link to post
Share on other sites

Difficult enough to achieve multi-threaded renderer.

I believe the pipeline is definitely messed up, just too random...

Thanks

Edited by lucky6969b

Share this post


Link to post
Share on other sites

@AThompson I think he is talking about the Direct3D9 specific multithreaded device.

In that case, no for the love of god do not do this. Multithreaded rendering should not even be attempted unless you are using a D3D 11 device at the very least. It's a difficult recommendation even then. D3D 12 is the only solid choice for multithreaded rendering.

 

D3D9's multi-threaded mode is probably best left to situations where you wish to use the device on a single non-UI thread.

Edited by Promit

Share this post


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