Hi,
I am fairly inexperienced in DX11 and I am trying to implement a particle system that is handled purely on the GPU. To keep things simple, the particle system will have a fixed number of particles that, once dead, will be respawned at the emitter location. As such, I only have a single compute shader that updates each particle.
Based on the method outlined in 'Practical Rendering and Computation in Direct3D 11', an AppendStructuredBuffer<Particle> and a ConsumeStructuredBuffer<Particle> are bound to the compute shader, so that last frame's particles can be consumed, updated and appended, ready for the next frame.
As I want to minimise the data flowing back to the CPU, I want to make a call to DrawIndexedInstancedIndirect(), feeding the particle data directly from the compute shader to the vertex shader. In the vertex shader, the particle will be expanded to a quad billboard (I am trying to avoid the geometry shader for performance) and sent to the pixel shader for rasterization. As a side-effect, the primitive topology will be set to TRIANGLELIST. I am using DrawIndexedInstancedIndirect() rather than DrawInstancedIndirect() as the number of particles and, by extension, the index buffer will remain fixed.
However, I am unclear on how to implement indirect draw calls and have the following questions:
- How can I pass the updated particle data from the compute shader to the vertex shader without sending the data back to the CPU? As I understand, the vertex shader cannot read from the AppendStructuredBuffer that was written to by the compute shader.
- How do I generate vertices without a vertex buffer bound to the input assembler? I know that vertices are identified with the semantic SV_VertexID, but I have no input layout bound to the input assembler.
Any help would be greatly appreciated, as I am not very confident with indirect drawing in DX11 and I cannot find any beginner-friendly resources to point me in the right direction.