• Advertisement
Sign in to follow this  

Matrix Multiplication Efficiency - HLSL vs Dx10

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

Hey guys!

I'm new to the forums and to directX, shaders, game programming in general, and all that jazz.

Anywho, I assume this is the appropriate board to post this question.

Been wondering for awhile if it was more efficient to have directX perform matrix multiplication for my transformations or if it is better to have a shader do the bulk of the calculations using constant buffers updated per frame (or per object)?

Also I assume the bulk of the directX processing is done with my CPU, however is the shader processing handled exclusively by the GPU or are only certain functions tossed over to it?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Shaders are handled entirely on the GPU, if you have a hardware device, so it's definitely better to do the multiplication in the shader. However, if you want to multiply a million vertices by the same two matrices, then it might be better to do that one multiplication of the two matrices on the CPU and send the combined matrix to the GPU to do the one million vector/matrix multiplications, instead of doing a million unnecessary matrix multiplications.
If you want to store the result of the multiplication in system memory however, it might be better to do it on the CPU, as reading results back from GPU memory can be slow or incur a delay.
For normal transformation you should definitely do it in the vertex shader.

Share this post


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

  • Advertisement