   Rendering to texture and Stream-Out
  Hi All,I'm generating some data on the GPU and then I'm sending them to a buffer through Stream-Out. I would like to use these generated data in the subsequent passes for both streaming out to another buffer and rendering to a 3d texture. Here come my questions:1. I've noticed that calling OMSetRenderTargets() invalidates the data necessary to invoke DrawAuto() call, therefore I lose the information about the vertex buffer size. Is using D3D10_QUERY_SO_STATISTICS the only solution here? Can I keep the data about the vertex buffer size in some other way? Maybe using Multiple Render Targets somehow?2. As far as I remember it is possible to Stream-Out from a Geometry Shader and use the same data in the following Pixel Shader. But is it possible to Stream-Out to a buffer and render to a 3d texture in one rendering pass?Regards.   
Quote: But is it possible to Stream-Out to a buffer and render to a 3d texture in one rendering pass?Regards.yes,Set a Texture dx object as render target, the texture should be created with RENDER_TARGET flag set.run a pass.Unbind the target and set it to effect sampling slot, you can use it.But unbinding a target will couse CPU to wait until the GPU is finished with rendering to it.   ;  correction, not unbinding but setting the target as a texture to effect.Or I actualy do not know exactly. but you have to have randering to target finished, or maybe it uses back buffer, not the front buffer, so you can unbind anywhen?   ;  The stream out buffer has a special hidden counter that keeps track of the number of items written to it during the last stream out.  You can also append data to the buffer, maintain the original count as a starting point.  Since this hidden counter is part of the buffer it cannot be 'lost' unless you overwrite/zero it using the DX API.  The counter is used to allow DrawAuto to work when the resource is later bound to the input assembler.  And as you've mentioned, it is available by using the d3d10_query_so_statistics.   I'm not sure how it is that you're losing the counter by calling OMSetRenderTargets().  I think that you probably have a different problem as the two are unrelated.You can always use stream out in combination with rasterization.  Because of this all of the usual pixel shader functionality and render target options are still available.   ;  Thank you for your answers.Quote:Original post by DieterVWI'm not sure how it is that you're losing the counter by calling OMSetRenderTargets().  I think that you probably have a different problem as the two are unrelated.Indeed, it was my mistake and thanks to your answer I was able to fix it.   