lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I actually zoomed in to a call to DirectX9-s CreateDevice() (which returns
successfully, I don't think it is memory leaking / writing in invalid
places). *Right* before CreateDevice() string.sub works, *right* after
CreateDevice(), string.sub fails.

This could be the FAQ where DirectX sets the FPU precision to
single, which starts to clobber double lua_numbers.  I think
there was a thread about it quite recently (or maybe I'm mixing
up this list with one of the many others where people get frequently
hit by the same DirectX misdesign... sigh...).

It was this list :).

There's a DirectX init flag which causes DirectX calls to preserve
the FPU state, which is anecdotally a speed hit but avoids the
problem.  Using OpenGL is also a pretty good workaround. :D

Exact name of this flag is GCF_FPUPRESERVE. Can it be part of lua FAQ? :)
Using OpenGL is surely most safe workaround :) but if you really want DirectX you can use lua with floats instead of doubles or you can pass this magic directx flag. In documentation (msdn) are few lines about speed but I made few tests and can't tell you the difference between using and not using this flag. Maybe it is some dinosaur from
fixed function pipeline era :-))

Jan Kratochvil
Illusion softworks, a.s.