particle system with stream output not working

Started by
-1 comments, last by rgc183 9 years, 9 months ago
I am working on particle system using DX11 stream output. But there are some issues with it and not working as expected. Here are the steps I am following.
Technique 1: to update stream buffer
1. Create vertex and pixel shader using CreateShader() call. Set pixel shader to null.
2. create geometry shader using:

      D3D11_SO_DECLARATION_ENTRY pDecl[] =
    {
        // semantic name, semantic index, start component, component count, output slot
        { 0, "SV_POSITION", 0, 0, 4, 0 },   // output all components of position
        { 0, "VELOCITY", 0, 0, 3, 0 },     // output the first 3 of the normal
        { 0, "AGE", 0, 0, 1, 0 },     // output the first 2 texture coordinates
     { 0, "TYPE", 0, 0, 1, 0 }
    };  
       
       hr=pD3dDevice->CreateGeometryShaderWithStreamOutput(blob->GetBufferPointer(), blob->GetBufferSize(),pDecl, sizeof(pDecl)/sizeof(D3D11_SO_DECLARATION_ENTRY),NULL,0,0,NULL,&GeometryShader);
here the pointers are of geometry shader code.


3. Create two buffers with flags: `D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_STREAM_OUTPUT` .
technique 2: to render particles
1. compile the shaders using createshader call.
Render:
1. set pixel shader to NULL and disable rasterization using `OMSetDepthStencilState`.
2. update one of the buffers by generating particles in geometry shader.
3. Set both buffer targets to NULL.
4. Use the above buffer to render particles.
5. Set both buffer targets to NULL.
6. swap the buffers.
Is there anything i am missing?

This topic is closed to new replies.

Advertisement