Reuse Buffer from ComputeShader in VertexFactory

I try to render Data created inside a ComputeShader to VertexShader via LocalVertexFactory.
How can i reuse the Buffer created inside the ComputeShader without copying the Data from GPU to CPU and than back to GPU?
I looked inside Engine Source and found some cases With normal ShaderParameter but not with FDataType a VertexFactory uses.

This is what i do:

I change the SRV and Buffer of the FVertexBuffer like this:

NumVertices = InNumVertices;
VertexBufferRHI = InPositionBuffer.Buffer;
PositionComponentSRV = InPositionBuffer.SRV;

InPositionBuffer is of type FRWBuffer

Than i bind the Data to the LocalVertexFactory:

void BindPositionVertexBuffer(const FVertexFactory* VertexFactory, FStaticMeshDataType& StaticMeshData)
	StaticMeshData.PositionComponent = FVertexStreamComponent(
		STRUCT_OFFSET(FPositionVertex, Position),
	StaticMeshData.PositionComponentSRV = PositionComponentSRV;

But i miss some Part because when i try to draw it, nothing happens…
GetDynamicMeshElements is called and shows no Error too

I don’t know whats wrong
If you need more Source Code let me know

1 Like