Sign in to follow this  

Shaders and Separate Rendering Contexts

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

I'm working on a virtual reality application to run on a shared memory machine. (I'm concerned that people will not know what shared memory is, but I'm certain that you know more about graphics than I do.) (On second thought you guys are technical, so you'll probably know what shared memory is.) The machine drives four screens arranged as if they were part of a cube, so that a person can step into the (four-walled) cube and feel immersed. (This is called a CAVE.) The machine has 2 NVIDIA Quadros that are linked together. For rendering, the application spawns one thread per screen. Each thread has its own rendering context. The threads all render the same scene, except with different camera direction (since each screen represents a different direction in the virtual world). The shaders are written in Cg, and I'm using the Cg runtime library to manage the shaders. Now that the ugly details are of the way, here are my questions: 1) At any point in time, the threads may be at different points in the rendering loop. Each thread has its own CG context and therefore its own shader programs. Is the graphics card setup able to handle multiple concurrent threads using different shader programs? 2) Say at a certain point in time two threads are using the same shader (compiled and linked from the same source code). Are the uniform and attribute variables unique for each thread? I would assume so, since each thread has its own rendering context. However, my knowledge of shaders being abominable, I ought not assume. If you made it this far, thank you for reading my entire post.

Share this post


Link to post
Share on other sites
1) Yes.
2) Yes, unless you specifically share the state.

As long as all threads use unique contexts (which they should), all state will be unique to the thread. However, some objects can be shared among contexts and threads - the geometry (VBO), textures, and also shaders. But this sharing should not affect states, unless you use bindable state objects (that are available only on G80+, that means the FX 5600 on the Quadro line).

However, this way of handling your rendering is suboptimal in terms of performance. You can easily render two walls per Quadro in a single thread (by using either the widescreen or the quad buffered stereo features). This way, you'll save yourself a lot of highly expensive context switches, and increase overall framerate. Unless you already use (passive) stereoscopic rendering.

Edit: I realize you haven't stated what API you're using. I assume OGL, since the Quadro is an OpenGL optimized card. If you're on D3D, then ignore my post above.


[Edited by - Yann L on May 21, 2007 11:48:53 AM]

Share this post


Link to post
Share on other sites
Thanks, that information helps. I don't know if we're using passive stereo (I've heard the word thrown around at meetings), but I'll ask the professor I'm working under about it. And yes, I'm using OpenGL.

Share this post


Link to post
Share on other sites

This topic is 3862 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.

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