Jump to content
  • Advertisement
Sign in to follow this  
rtclawson

Profiling Directx for comparison

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

The following code is used in our tests of Directx 9 to profile the time it takes to complete a task. My question is, what would be the equivalent in Directx 11?
 
 
SlimDX, Directx 9
/// <summary>
/// Flushes the queue of rendering commands. This is implemented as a blocking call.
/// </summary>
public void Flush() {
// From DirectX SDK Documentation "Accurately Profiling direct3D API Calls (Direct3D 9)" 
// Create an Event query from the current device
using ( Query q = new Query( _device, QueryType.Event ) ) {
 
// Add an end marker to the command buffer queue.
q.Issue( Issue.End );
 
// Empty the command buffer and wait until the GPU is idle.
 
while ( q.GetData<bool>( true ) == false ) {
// CPU spinning
//NOTE: device could be lost while querying driver
}
}
}
 
 
Here is my attempt. I have tried different combinations of calls, but nothing seems to work. Specifically, I get the error "DXGI_ERROR_INVALID_CALL"  on the GetData call. If I uncomment the begin, flush, and end calls, then I get the error "D3D11 ERROR: ID3D11DeviceContext::Begin: Begin is not supported and cannot be invoked for the D3D11_QUERY"
SlimDX, Directx 11
public void Flush() {
QueryDescription qd = new QueryDescription() {
Flags = QueryFlags.None,
Type = QueryType.Event
};
 
using (Query q = new Query(_device, qd)) {
 
//_device.ImmediateContext.Begin(q);
//_device.ImmediateContext.Flush();
//_device.ImmediateContext.End(q);
 
 
while (_device.ImmediateContext.GetData<bool>(q,AsynchronousFlags.DoNotFlush) == false) {
// CPU spinning
//NOTE: device could be lost while querying driver
}
}
}
 
 
 
Any help?
 
 

Share this post


Link to post
Share on other sites
Advertisement
This blog post of MJP explains how to time the D3D11 Pipeline. I couldn't use that approach for compute shaders though, I always got a disjoint, unfortunately.
 
Update: A little bit off topic (timing compute shaders). I do get sensible numbers (no disjoint) after the first dispatch. Looks like the device must be in "compute mode" already to make those queries work.

Scratch that, I was wrong. Anybody had success with timing compute shaders ?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!