2
\$\begingroup\$

I am reading Practical Rendering and Computation with Direct3D 11.
In the book the D3D11 pipeline is often described with this image:

From Jason Zink GameDev.net article

In the Chapter about resources, Paragraph about buffers, I understood that the only stages that can write to buffers are the Pixel Shader and the Compute Shader, using Unordered Access Views.
Is it correct? If so, why? Is it because of the inherent architecture of GPUs?

Then, what would be the typical method to output data from a different stage?
For example, how could one get the result of a computation done in the vertex shader, without needing to pass through the other stages?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

No, you can write to the stream output buffer from the vertex or geometry shader in D3D11. You must create your shader using ID3D11DeviceContext::CreateGeometryShaderWithStreamOutput call to enable this function. You can call it for a vertex shader or a geometry shader too. You also need to create a buffer which you write to and set it with ID3D11DeviceContext::SOSetTargets before the draw call.
It is all documented very well on MSDN.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Starting in D3D11.1 (Windows 8) you can also write to UAVs from every pipeline stage. \$\endgroup\$ Commented Jul 5, 2014 at 17:23
  • \$\begingroup\$ @jános-turánszki I didn't read the details about Stream Output yet, but I had the impression that the output buffer had to have a vertex buffer structure. Is it possible to write to a raw buffer using Stream Output ? \$\endgroup\$
    – wip
    Commented Jul 5, 2014 at 23:54
  • \$\begingroup\$ @nathan-reed I did not know that, thanks for the link. Could this work on Windows 7 too? \$\endgroup\$
    – wip
    Commented Jul 5, 2014 at 23:59
  • 1
    \$\begingroup\$ No, D3D11.1 is only available in Windows 8 and up. (Although the equivalent OpenGL functionality, image load/store and SSBOs, are available on any OS that supports OpenGL.) \$\endgroup\$ Commented Jul 6, 2014 at 0:04
  • 1
    \$\begingroup\$ @wil You need a vertex buffer-like structure because the vertex shader (or geometry shader) output is the data that will be streamed out, so some structuring is definetly needed. \$\endgroup\$ Commented Jul 6, 2014 at 10:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .