Run DirectX 11 stream output without drawing

Started by
10 comments, last by french_hustler 9 years, 10 months ago

What do I need to do to be able to use this resource in a compute kernel?

Apart from the obvious D3D11_BIND_STREAM_OUTPUT flag, your buffer additionally needs D3D11_BIND_SHADER_RESOURCE (or even D3D11_BIND_UNORDERED_ACCESS). You probably have to play around a bit: I once tested if one could use D3D11_BIND_VERTEX_BUFFER in combination with the latter two and it only worked with raw and typed buffers, not structured buffers, unfortunately.
Then you create the appropriate views which you bind to your compute shader (shader resource view/unordered access view).

Since I haven't done this, I can't say this works at all (the runtime is quite reluctant about combining "unusual" flags). Turn up the debug runtime, it will tell you exactly what is off.

Edit: Is this for vanilla DX11 ? Because 11.1 allows writing to UAVs from every shader stage. You wouldn't even need stream out functionality.

Also is there a way to know how many elements are in an SO buffer?

There are a couple of stream out related queries, of particular interest here is D3D11_QUERY_SO_STATISTICS (or the STREAMX versions thereof). Note that queries have a latency.
Advertisement

Hey unbird, thanks for your reply.

Edit: Is this for vanilla DX11 ? Because 11.1 allows writing to UAVs from every shader stage. You wouldn't even need stream out functionality.

You know, I recently bought a GTX 770 card that claims to support 11.2. Scattered RW from any stage was one feature I really wanted on my new GPU. Turns out NVIDIA does not support the full feature set. I do find it a bit misleading when the specifications fail to mention that it isn't a full support but "capable" of the 11.2 feature set.

This topic is closed to new replies.

Advertisement