Jump to content
  • Advertisement
Sign in to follow this  
BattleMetalChris

[hlsl] Execute a line once per draw call

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

I'm pulling the near and far clip planes out of the projection matrix in a shader. This is only something which needs to be done once for each draw call, is there any way I can get this line to run just once, rather than for every vertex if I put it in the vertex shader?

Or is it best to calculate them outside of the shader and just pass them to the shader as global variables?

Share this post


Link to post
Share on other sites
Advertisement
I once asked this question, and it turned out the best solution was to do it on the CPU and pass it as a global variable. If you are pulling out the near and far, can't you just pass them in? You should have them lying around somewhere from when you made the matrix.

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!