PDA

View Full Version : Question about vector and matrix operations speed



cronodragon
04-11-2005, 03:27 AM
In DX9, are the vector and matrix operations (i.e. D3DXVec3Transform) hardware accelerated, or are those made only by software? Haven't found information on that. I ask because some operations like translation could be made directly instead of wasting processor cycles calling a DX function.

JSoftware
04-11-2005, 12:08 PM
i don't think they are hardware accelerated. if you want speed you should look into SIMD

Sly
04-11-2005, 02:09 PM
The D3DX functions are optimized for speed. I believe they take advantage of any features available such as MMX or SIMD.

Yes, there is the overhead of a function call, but for many functions that would be a minimal amount of overhead compared to what the function does.

Clootie
04-11-2005, 07:04 PM
Complex D3DX math functions take advantage of available SIMD instruction set (be it 3DNow!, SSE or SSE2). For most performance when performing matrix manipulations (multiply, etc) they should be aligned on 16byte boundary. As Delphi/FPC do not allow 16byte alignment on compiler level you should watch for this. Installing DirectX SDK and compiling headers with DEBUG conditional will lead to linking against debug D3DX layer -> it emits some helpfull information via OutputDebugString.

cronodragon
04-11-2005, 07:16 PM
Do you mean the acceleration of those DX operations doesn't work on Delphi? Maybe I'm misunderstanding...

Clootie
04-11-2005, 09:12 PM
Sure it's working, but if your matrices are not aligned on 16byte boundaries then SSE(2?) instructions will not be working, so D3DX will need to first move your matrix.