What's the point of assigning a register...?

My understanding was that a register assigned a location in memory so that your CPU knows where to access it. Every guide on how to make a RWStructured Buffer says to assign a register.

Someone working on my project didn’t assign a register but their code still runs. Being curious, I removed all the assigned registers from the rest of our code and everything still runs perfectly. Obviously my understanding of a register is off. Can someone explain what it is and when it’s needed.

Thanks!!

  • For clarification: I’m writing to the RWStructured Buffer inside of a shader

My understanding is most of the time these will get auto-assigned, at least on Windows. However that might not work on all platforms. And if you have multiple RW buffers there’s no guarantee all the shaders will use the same register(s) for the same buffer.

Thanks!!!