My distant love... MMX!

Started by
1 comment, last by Goodlife 23 years, 11 months ago
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
-- Goodlife-----------------------------Those whom the gods would destroy, they first drive mad.--DirectX design team official motto
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
obysoft
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.

This topic is closed to new replies.

Advertisement