Jump to content
  • Advertisement

Archived

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

Goodlife

My distant love... MMX!

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

Hello you crazy programmers-- This question goes out to the real MARLBORO MEN on the board, who know MMX: I want to override the direct3d lighting and do my own lighting. And also, some of my own rotating, since the 3d objects in my game only need to rotate around one axis. I want to play around with MMX, but don't know where to begin. Well, I need a good distance formula, in MMX! You know the distance formula, right? Lemme refresh: x=point1.x-point2.x; // Pretty fast y=point1.y-point2.y; // Pretty fast dist=sqrt((x*x)+(y*y)); // 2976 cycles????? Whoa! That's a lotta cycles!!! So, m'question is: has anyone written a little MMX subroutine to do distance? I'm not sure MMX is really suited for sqrt(), but I thought someone out there probably knows more about it than I do. Also, does anyone know the minimal MMX code to do the following in one 'operation'? float chuck; float sally; float sandra; float bill; float marriage; float divorce; marriage=chuck*sally; divorce=sandra*bill; Assembly language preferred, but C (not C++) okay! Thanks in advance!! -- Goodlife ----------------------------- Think of your mind as a door on a house. Leave the door always closed, and it's not a house, it's a prison. Leave the door always open, and it's not a house, it's a wilderness-- all the vermin creep in. Edited by - Goodlife on 5/9/00 7:39:14 AM Edited by - Goodlife on 5/9/00 7:41:15 AM

Share this post


Link to post
Share on other sites
Advertisement
i dont hink MMX is good for floating point operations

Theoretically you can represent sqrt into a convergent series that uses only integers .... quite elementary i think

but it will req multiple iterations to be acurate...

IMHO you should try to use FPU for that...dosent your C/C++ does it for you (are they floating numbers ?)

If compile wont do it for you : then i will try and send you some ASM fpu oerations code...

ASM rocks...

regards

Share this post


Link to post
Share on other sites
MMX cannot be used with floating point at all. MMX aliases the floating point regesters for its own use. MMX is basicly a set of instructions that optimize integer operations by performing two, four, or even eight integer operations in a single cycle. You could use AMD 3Dnow intructions or PentiumIII SIMD instructions with floating point with some restrictions.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!