Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DirectX11: Pass data from ComputeShader to VertexShader?

Is it possible to apply a filter to the geometry data that is to be rendered using Compute Shader and then use the result as an input buffer in the Vertex Shader? That would save me the trouble (&time) of reading back the data.

Any help is much appreciated.

like image 888
testalino Avatar asked Oct 29 '10 07:10

testalino


1 Answers

Yes absolutely. First you create two identicals ID3D11Buffer of structures using BIND_VERTEX_BUFFER, BIND_SHADER_RESOURCE and BIND_UNORDERED_ACCESS usage flags, and the associated UAVs and SRVs.

First step is to apply your filter to input source buffer and write to the destination buffer during your compute pass.

Then during the draw pass, you just have to bind the destination buffer to the IA stage. You can do some ping-pong if you need to accumulate computations on the vertices (I assume that by filter you mean a functional map, for refering to the Functional Programming term).

like image 133
Stringer Avatar answered Oct 17 '22 15:10

Stringer