Jump to content
  • Advertisement
Sign in to follow this  
Quat

d3d11 gather

This topic is 3297 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

This function gets 4 texels at once. Is this equivalent in cost to a single texture sample? 2 times more expensive? I'm just wondering if this is a 4 for 1 deal. Also for the compare versions like GatherCmpRed, are these cheaper than doing the comparison in the shader yourself? Why? It seems like it does the same work, or are they somehow able to optimize it more rather than compiling it into general shader code?

Share this post


Link to post
Share on other sites
Advertisement
A filtered texture sample instruction will read the same 4 texels as Gather, so yes, in effect it is 4 memory reads "for the price of one" (if you compare to 4 discrete filtered samples). The advantage of using Gather is that you can determine yourself how you want to mix or otherwise use the individual texel values. This is especially useful on shadow edges, where a naïve bilinear filtering just isn't correct.

The hardware, if I remember correctly, has a lot of fixed-function comparators built-in for stuff like depth and stencil buffering, so the comparison in the relevant intrinsic shader functions is much more lightweight than if you emulated the behavior in your own shader code.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!