0
\$\begingroup\$

I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, like PSSetShaderRsources. Because at load time I am bounding the resource views needed for that particular shader, then the next one and so on, but what I found is that the resources were not bound, I need to set them again every time the XXSetShader is called.

Am I doing something wrong? it's not supposed to work like that, the purpose of this is to have the least change states at runtime.

Thanks.

\$\endgroup\$
1
\$\begingroup\$

You can not bind resources to a particular shader, but a shader stage instead. For example, you bind a texture to pixel shader stage, then switch to an other pixel shader, the same texture will be bound to that new shader.

You should typically bind your resources before the draw call. To ensure few state changes, you can group a bunch of textures and bind them with a single call to XSSetShaderResources.

Good luck!

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.