d3dx9_36 [try 3]: Implement D3DXSHRotate

Rico Schüller kgbricola at web.de
Tue Sep 4 13:26:11 CDT 2012


On 04.09.2012 19:31, Nozomi Kodama wrote:
> Your mail makes me thing two or three remarks.
>
> I agree that in the plain wine, code must be optimized to use less
> memory as possible and to be the fastest as possible.
> But, the tests are here to check that the implemented function behaves
> like the windows one.
> So, they don't need to be optimized. So, what is the point to worry
> about efficiency?
>
> It is not important that I allocate 100 floats  for my array even if I
> use 49 only.
> In the same idea, the time in the loop is not important. It is the same
> if I  spend 1s  in a loop or 1/100s. They are there for testing.
> Tests work, it is OK. I think function is optimized in plain wine, so I
> can send the patch. Tests don't work. I must figure out why.

While I agree with you, partly, one problem doesn't make much trouble, 
but if you add a couple of problems the app might explode. See the bad 
example (using a bigger index) for accessing the array... it may work 
for your machine, but the app may crash on another. You may overwrite 
some stuff and it is very hard to debug. For the floats, I think it 
shows that you are familiar with the code and know what you are doing. 
The question is, why don't you use 1000000 floats then, shouldn't be a 
problem at all? And you'll never know the next guy tries to implement 
something and copies your test code (that's not recommended at all) or 
just gets an idea and does the same and voila we got more and more of 
the hassle. Just think about it... I guess you took a look at 
test_D3DXSHRotateZ which is also a very bad example, but I missed it 
somehow when it was added. And still no one fixed it yet and that's how 
bad code and code style comes to that file...

>
> About coding style, I can not understand the policy.
> If I look in the d3dx9_36/math.c file, I can see almost as much styles
> as functions.
> So, complaining about the style I use is a non-sense for me.

Sure that's the problem. d3dx9_36 (especially math.c) is a very bad 
example when it comes to code style. Do we have to make it worse? Why do 
we need to produce more bad examples, if it is relatively easy to write 
clean code?

Cheers
Rico



More information about the wine-devel mailing list