Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

tommyF

Shader Optimisations

This topic is 5321 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 there, I am new to shaders and was just wondering if doing: m4x4 oPos, v0, c0 is any lower/quicker than doing: dp4 oPos.x, v0, c0 dp4 oPos.y, v0, c0 dp4 oPos.z, v0, c0 dp4 oPos.w, v0, c0 Thanks in advance. PS Does this also relate to m3x3 being faster/slower than 3 dp3s

Share this post


Link to post
Share on other sites
Advertisement
There will be no performance difference. If you look up m4x4 in the DirectX documentation it explicitly states: "This instruction is implemented as a series of dot products".

Personally, I prefer the m4x4 because it''s a bit clearer what you''re doing, and it''s less to type.

Also, I believe your expansion to dp4s isn''t actually correct, you always use the same constant register as an argument, whereas it should probably increase c0-c3.

-Mezz

PS: this also applies to m3x3 in relation to dp3s.

Share this post


Link to post
Share on other sites

  • 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!