Directx provides Structured Buffer. What's the analog of this in vulkan? How to create one in application? How to use it in glsl shaders?
1 Answer
A D3D "Structured Buffer" is equivalent to a Vulkan "Storage Buffer", if that storage buffer is read-only. However, Vulkan (like OpenGL) uses the storage buffer concept to cover a wide range of stuff that D3D considers different things.
RWStructuredBuffers in D3D are simply storage buffers that you declare in the shader to be writable. Append/ConsumeStructuredBuffers are just storage buffers where you bump an atomic variable to find the data that your shader instance is going to "append" or "consume".
At the level of the Vulkan API, these all utilize VkBuffers that have the VK_BUFFER_USAGE_STORAGE_BUFFER_BIT set. Even in the descriptor set, you need not specify whether a particular storage buffer binding point is read-only or read/write, or even write-only. How it gets used is decided by the shader, not the descriptor.
structs. (GLSL have those.) Just asking if it is the same thing because my knowledge of DX is lacking...arrayin hlsl - I can pass data only in buffers.