cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

desperateamddeveloper
Journeyman III

PerfStudio 2.15.2095: API Trace for multiple contexts for OpenGL 3.3

How is it possible to activate an api trace for each shared context?

Currently, it seems that all the commands I send to multiple contexts are streamlined into one api trace time line...

CodeXL shows all shared contexts with stats, which is nice.

Thanks.

Alex

0 Likes
5 Replies
desperateamddeveloper
Journeyman III

Don't I get an answer because it is not possible to do what I want to do, or?

0 Likes

Hi,

Sorry about the delay. How are you using multiple contexts? Are all contexts in the same thread or do you have a context per thread?

If you have a context per thread, you should see the API calls for each thread in their own tab. If there are multiple contexts in the same thread, then all API calls will go to the same window. If it's something you would like to see in PerfStudio and it would be of help to you, I can certainly put a feature request in for you.

Thanks,

Tony.

0 Likes

Hi Tony.

Thank you for taking some time.

Now, actually, I implemented a command queue on top of OpenGL that allows me to send render commands from multiple thread to one render thread, but it is also possible to use multiple render threads with shared contexts.

For my game, I implemented an iso-extraction pipeline with OpenGL 3.3. The extraction process uses a scheduler that feeds a support render thread that performs the action. This means, rendering is performed in one separate render thread with the main GL context, and the computation (the extraction), is done in another separate render thread which uses a shared context from the main render context, as follows:

some_threads_19.07.2014.png

In the image above, taken from VS 2010, you can see the MT Extraction Thread which performs the scheduling of CPU extraction requests to GPU computation execution. ALL render(computation) calls are send to Render Thread (Support #0) which is a separate thread running a shared context from Render Thread (Main). Render Thread (Support #1) is the async I/O thread which is also a shared context from Render Thread (Main).

So I have 3 OpenGL threads that perform OpenGL commands.

1. Render Thread (Main) which is the main render thread for rendering.

2. Render Thread (Support #0) which is the render thread performing the computation commads

3. Render Thread (Support #1) which is the render thread that is doing async CPU/GPU-GPU/GPU I/O

And this is what I get from PerfStudio in API Trace.

some_threads_2_19.07.2014.png

I really would like to see whats going on in Render Thread (Support #0), which performs the whole iso-extraction pipeline. Or to put it more general, how is it possible to inspect GL commands from shared contexts?

Currently, it seems, that every command is just in one trace in the image posted, so every command across multiple threads are put into one trace.

I hope, my explanation helps.

Thanks,

Alex

0 Likes

Hi Alex,

There are multithreaded DirectX apps which work correctly with PerfStudio; you'll see a different API trace for each thread. I'm not sure why things are not working correctly with GL; some of the code is shared between GL and DX. I've put in a feature request for this & I'll have to write a couple demos with a shared context on separate threads and trace through the code & see what's going on. There's probably a similar issue with separate contexts on each thread which applications seem to be using more of these days.

The only other thing I can suggest is to go into the settings and make sure that "Flatten CommandLists" is unchecked, but you've probably done that already.

Thanks,

Tony.

0 Likes

Thank you Tony.

"Flatten CommandLists" is unchecked.

When pressing the pause button in the PerfClient, it seems that only the main render context is paused, but the shared contexts are not affected by this action. I can see it because the extracted surface is totally de-synced after I resume the application. But this only happens when I pause the application during the support render thread running, which is doing the computation. If I pause the application when no support render threads are running, i.e. no extraction is done/no copy is done, the application resumes correctly.

But to be perfectly honest, there are more bugs. For example, if I press the frame profiler, the computer crashes with a blue screen. Very often, the server crashes on start up. Windows only says, "application not working". But I can start my app without problems with CodeXL, with Visual Studio or just by double clicking and it never crashes. When I press debug, Visual Studio only shows me the stack trace that ends within PerfServer. May not mean anything, just saying.

Hopefully, PerfStudio is becoming a bit more stable in the near future. I really need it. I am only one guy doing his game with his own engine. I really appreciate PerfStudio a lot.

Thanks,

Alex

0 Likes