I’m trying to learn more about RDG in Unreal and HLSL, so far so good, with one exception: I’m trying to pass an array of a custom struct from C++ to HLSL via a structured buffer, and I currently don’t know how to tell the C++ buffer: hey, this is your data so you can pass it to the GPU.
it is possible that I don’t fully comprehend the role and scope of a structured buffer…
In C++ my shader has
SHADER_PARAMETER_RDG_BUFFER_UAV(RWStructuredBuffer<FMyStuff>, MyStuffBuffer)
Then at some point I create it
FRDGBufferRef MyStuffBuffer = GraphBuilder.CreateBuffer(MyStuffBufferDesc, TEXT("MyStuffBuffer"));
here I was expecting to be able to do something like
MyStuffBuffer.SetData(some TArray<FMyStuff>)
then I assign it to the parameters
PassParameters.MyStuffBuffer = GraphBuilder.CreateUAV(MyStuffBuffer);
And then I pass everything to the GPU via
FComputeShaderUtils::AddPass
I was hoping there is a way, after I create the RDG buffer in C++, to set its data/payload as some TArray<FMyStuff> I previously created and populated in C++
I poked around the source code, but to no avail, this specific aspect of RDG still eludes me do you happen to have any idea, by any chance? Thanks!