I have a D3D11 buffer with a few million elements that is supposed to hold data in the R8G8B8A8_UNorm
format.
The desired behavior is the following: One shader calculates a vec4
and writes it to the buffer in a random access pattern. In the next pass, another shader reads the data in a random access pattern and processes them further.
My best guess would be to create an UnorderedAccessView
with the R8G8B8A8_UNorm
format. But how do I declare the RWBuffer<?>
in HLSL, and how do I write to and read from it? Is it necessary to declare it as RWBuffer<uint>
and do the packing from vec4
to uint
manually?
In OpenGL I would create a buffer and a buffer texture. Then I can declare an imageBuffer
with the rgba8
format in the shader, access it with imageLoad
and imageStore
, and the hardware does all the conversions for me. Is this possible in D3D11?