[SlimDX] DirectX 11 Query

Started by
8 comments, last by jpetrie 13 years, 5 months ago
Hi there,

I'm working on a compute shader in DirectX 11. I want to dispatch the compute shader and then wait for it to complete. Under DirectX 10, I could check with IsDataAvailable if the query has completed, I haven't been able to find the corresponding method on how to do this in DirectX 11.

This is the code I'm currently using, reduced to just the necessary parts:

SlimDX.Direct3D11.QueryDescription queryDescription = new QueryDescription(QueryType.Event, QueryFlags.None);SlimDX.Direct3D11.Query query = new Query(device, queryDescription);device.ImmediateContext.ComputeShader.Set(compute);device.ImmediateContext.ComputeShader.SetUnorderedAccessView(computeResult, 0);device.ImmediateContext.ComputeShader.SetShaderResource(pointerView, 0);device.ImmediateContext.ComputeShader.SetShaderResource(spanView, 1);device.ImmediateContext.Dispatch(8, 4096, 1);device.ImmediateContext.End(query);// want to check here on when the compute shader has finishedstring outFileName = Path.Combine(outFilePath, Path.ChangeExtension(Path.GetFileName(fileName), ".dds"));Texture2D.ToFile(device.ImmediateContext, outputTexture, ImageFileFormat.Dds, outFileName);


Any help is greatly appreciated.

Thanks
Marcel
Advertisement
Spent some more time looking for an answer but information around this is very slim at this point... have any of the SlimDX team worked with DirectCompute yet?
Still no one with an answer to this???
Sorry, I still don't have hardware that supports compute shaders, so I haven't had a chance to play with it. I don't think anyone else on the SlimDX team has either.
Mike Popoloski | Journal | SlimDX
I'm not at all familiar with DirectCompute, however a quick look through the documentation suggests that what you want to do is check if device.ImmediateContext.GetData(query, AsynchronousFlags.DoNotFlush) fails. If it does then it's not done yet.
Adam,

I saw that possibility but that means it has to move the data back over the PCIe bus... I don't want to do that, I just need to know when the shader has completed...
What are you trying to do that requires you to know on the CPU side if something has completed? Any such message of completion will require a message to be sent from the GPU to the CPU.
At this point I'm trying to time the execution of the ComputeShader. Eventually I will have another Compute or Pixel shader running after this initial one that will use the resource created by the first ComputeShader.
You won't need a query for this because the driver can determine dependencies and will wait until operations from your compute shader are complete before running the pixel shader pass. Just submit all the commands in the order you want them completed and you'll be in good shape.
I've implemented an IsDataAvailable() method that can be used to stimulate the native call sequences required to determine if a query has data available without actually passing that data back across the bus.

This topic is closed to new replies.

Advertisement