Jump to content
  • Advertisement
Sign in to follow this  
jakovo

SetShaderResource and SetSampler to the same Slot?

This topic is 1233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, 

 

Currently for each draw I'm setting both ShaderResource and Samplers to the same Slot:

uint32_t resViewSlot = structure->Slot;
uint32_t samplerSlot = structure->Slot;

mpDeviceContext->PSSetShaderResources( resViewSlot, numViews, pShaderResourceView );
mpDeviceContext->PSSetSamplers( samplerSlot, numSamplers, &pSamplerState );

As each Texture  in the PixelShader needs a corresponding SamplerState, makes sense to have both of them set at the same Slot number (Texture represented on the ResourceView of Slot 0, corresponding to the SampelrState in Slot 0).

 

However I was wondering if there is any good reason to keep their slot number independently form each other, or if it would be just fine to keep both of them at the same slot?

 

Any personal experience handling one way or the other?

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement


As each Texture  in the PixelShader needs a corresponding SamplerState

 

This is actually untrue.  In D3D11, the texture and the sampler are decoupled and you can reuse samplers as you see fit as a result.  You'll want to create a sampler state for each unique state (IE you'll need different samplers to be able to do point sampling vs bilinear sampling), but that's it.

Share this post


Link to post
Share on other sites

Aaaahh.... Right.. that makes total sense... I was handling it as if each texture required a sampler for its own...  how dumb!

 

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!