- Home /
RWStructuredBuffer register field
Hello, I am just starting to learn stuff about structured buffers in shaders and got into a problem.
I am trying to set up a RWStructuredBuffer with some float data for vertex shader so that I can set some values via material buffer in C#, then read those in vertex shader to modify vertex position based on those values. It all works great when I use StructuredBuffer, but now I want to modify this buffer from inside the vertex shader as well and have to use RWStructuredBuffer (from the info I gathered), so I set it up like this:
#pragma target 5.0
uniform RWStructuredBuffer<float> verts : register(u1);
That's what I found online, but can't find anything about the register part besides random snippets of code, what is it exactly and how to deal with it? Is there some documentation about those registers? Whenever I set up the buffer like this and try to access it from within the vertex shader, my mesh turns cyan and I don't know what I'm doing wrong.