Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I use stream-out data of unknown size with hardware instancing

28 views
Skip to first unread message

Bill

unread,
Oct 24, 2009, 6:43:01 AM10/24/09
to

I want to use a Geometry shader to generate instance locations. In the way I
am doing this I don't know how many instance locations will be generated. If
the geometry shader were just generating simple primitives, I could render
from the stream out buffer using DrawAuto. However I would like to use this
buffer with hardware instancing. Can anyone tell me if this is possible in
DX10 or DX11.
--
Thanks
Bill

Hexadecimal

unread,
Oct 28, 2009, 10:40:22 PM10/28/09
to
One possibility is to use the new D3D11 AppendStructuredBuffer type in
a compute shader in conjunction with the indirect draw feature.

The steps would look like this:

1) Run the compute pass which writes out positions into an
AppendStructuredBuffer.
2) Copy the size of the structured buffer into an indirect draw buffer
(misc flag = D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS) by using the
CopyStructureCount method.
3) Render the instanced objects by using DrawInstancedIndirect; access
the data in the form of a StructuredBuffer and index it by the
instance ID as usual.

0 new messages