I'm using two vertex buffers in my app, one is bound to the input assembler / vertex shader, the other is bound as a streamout target to the geometry shader.
What I want to do is save the new vertices to the buffer, then flip the buffers each frame.
The problem is, the geometry shader can only append new vertices at the end, so I need some way to clear the new streamout target before each frame.
I tried to use ID3D11DeviceContext::UpdateSubresource(..) with a NULL'ed array the size of the buffer as a source, and that does clear the buffer, but no new vertices are saved to it.
Maybe the geometry shader keeps track of how many vertices it has generated in total and tries to append new vertices to the buffer after that point. (which it can't since the buffer has only room for one set of vertices)
I tried to use CopyResource(..) to copy the contents of an empty buffer to the buffer I want to clear, same result.
I even tried releasing and recreating the buffer each frame (which is incredibly inefficient), but even that does not really work.
The only time it has worked somewhat is when I create a new buffer and bind that as the SO target, without deleting the old one, so of course I run out of memory in a matter of seconds.
I'm running out of ideas here, it has to be possible to clear a generic buffer?
melak47Member Since 02 Mar 2012
Offline Last Active Mar 08 2013 10:04 AM
- Group Members
- Active Posts 8
- Profile Views 204
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
melak47 hasn't added any contacts yet.
No latest visitors to show