Jump to content
  • Advertisement
Sign in to follow this  
HopHopTraLaLaGdaltiBshAna

Question about mulitple matrices

This topic is 1434 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 wanted to ask  about multiple the matrices in Shader or in program;

 

I have 3 matrices that affect the texture , but they are not affect the actual coordinates that my physics is need .

so I wanted to ask if should I multiple those texture matrix in my shdaer or in the program .

 

and antoher question , are shaders really run on GPU ?

Share this post


Link to post
Share on other sites
Advertisement

Shaders are run once per vertex or fragment, so the computations in them are also run once per vertex or fragment. While the shader compiler may be able to optimize a one-time "pre-shader" for calculations that only use uniforms, it's best not to assume that it will. Calculate as much as you can outside of the shader.


and antoher question , are shaders really run on GPU ?

Yes.

Edited by Promit

Share this post


Link to post
Share on other sites

It is hard to give one specific answer, without knowing more about your game. But if the matrices ONLY affects rendering, and you need to recalculate them each frame, then putting them in a vertex shader can be a good idea.

 

And yes shaders are run on the GPU. The GPU has groups of processors that are good for performing parallel tasks. As the single processors can't work on individual tasks, GPU's are not suited for code with branching i.e. code with lots of if-statements. But for code like blending colors or multiplying matrices, where every core does the same computations at the same time it is insanely fast.

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!