[DirectX 11] Binding Shader resources

Started by
3 comments, last by Jason Z 12 years, 7 months ago
When I bind a shader resource or a buffer using this method:

device->VSSetShaderResources(0, 1, rv);

The shader resouce is bound to vertex shader resource slot 0. But will it also be accessible by a pixel shader in the slot 0 or do I also have to call PSSetShaderResource?
Advertisement

When I bind a shader resource or a buffer using this method:

device->VSSetShaderResources(0, 1, rv);

The shader resouce is bound to vertex shader resource slot 0. But will it also be accessible by a pixel shader in the slot 0 or do I must also call PSSetShaderResource?


Kinda render PSSetShaderResources() redundant if it did :)
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
No, it will not be bound to the ps also. You will have to send it to another slot too, not slot 0, so for example:

[color="#000000"]device[color="#666600"]->PS[color="#660066"]SetShaderResources[color="#666600"]([color="#006666"]1[color="#666600"], [color="#006666"]1[color="#666600"],[color="#000000"] rv);

You will have to send it to another slot too, not slot 0


Why is that?

No, it will not be bound to the ps also. You will have to send it to another slot too, not slot 0, so for example:

[color="#000000"]device[color="#666600"]->PS[color="#660066"]SetShaderResources[color="#666600"]([color="#006666"]1[color="#666600"], [color="#006666"]1[color="#666600"],[color="#000000"] rv);


That isn't correct - the set of resources that are bound to each stage don't influence each other (outside of the restrictions with UAVs being bound to multiple locations). So you could set a shader resource view to the same index on each stage, or different indices - they are independent of each other.

This topic is closed to new replies.

Advertisement