You can accomplish this in direct3d12 by specifying a BaseShaderRegister
other than zero, or using different RegisterSpace
values, in the D3D12_DESCRIPTOR_RANGE
struct. If code changes are not feasible, you can isolate each set of registers implicitly by setting the root parameter's ShaderVisibility
property. This will isolate, for example, VS
b0
from PS
b0
. For more details, you can check out the developer video on the topic.
The only time you will run into trouble is if you've actually explicitly bound two resources to the same slot and register space (by explicitly specifying it using shader model 5.1 syntax). In this case, you are expected to understand that in D3D12, registers are shared cross-stage, and it's up to you to make sure you have no collisions.
In D3D11, this problem does not occur as each stage has its own register space (VS
b0
is not the same as PS
b0
) and you can't share even if you wanted to. Still, if you for some reason have a component hard-coded to attach data to VS
b0
but your vertex shader has already been compiled to expect it at b1
, there's not much you can do.