HLSL Buffer<> Data Type

HLSL Buffer<> Data Type

I'm working on converting a dx11 shader from a .fx file for use in Unity3D and I'm a little puzzled by the HLSL Buffer<> type declared in the shader. More specifically, what are these and how can I implement them in Unity? I'm aware of the Structured, Append, and Consume Buffers but those appear to be different then this and the Microsoft documentation wasn't to helpful. Is it just like an array that is populated and sized from code before getting assigned to the shader? Are they read only or writable as well?
So far I'm thinking the closest approximation I can use is a StructuredBuffer but the .fx file has its own declaration for that as well so I'm not entirely sure I should go that route.
Example:
Buffer g_someData : register(t18);

Solutions/Answers:

Answer 1:

I’ve had similar buffer interop issues with HLSL Compute under Unity. HLSL itself is poorly documented; it doesn’t get any better when it comes to interop with Unity specifically.

I have had consistent success with RWStructuredBuffer, though there you must set the C# struct size and offsets explicitly, and pad the entire struct according to 16-byte boundaries used by HLSL. The HLSL struct needs to be exactly the same order and types / sizes, including pad members.

References