d3dx9 [patch 1/5]: Implement D3DXSHMultiply4
kgbricola at web.de
Wed Sep 26 13:14:38 CDT 2012
On 26.09.2012 19:09, Nozomi Kodama wrote:
> >> + D3DXSHMultiply4(c, a, b);
> >>What happens if you use something like D3DXSHMultiply4(c, c, c). Is
> that allowed?
> Tests in native show that D3DXSHMultiply gives what I implemented.
> We can not reuse a input variable as output (we don't obtain what we
> expect logically).
I gave it a try, and your implementation seems to be correct. I tried:
D3DXSHMultiply4(c, a, c);
D3DXSHMultiply4(c, c, b);
// used c[i] = ((float)i) / 20; to not give always -nan
D3DXSHMultiply4(c, c, c);
They look pretty much the same for wine and native. Why then not add a
test for this? Sure, you don't get what you logically expect, but we
need to reproduce the results and that has not always something to do
with logic :-) . It is a little bit contrary to the part below, because
when you change the order and reuse code, the calculation for this
corner cases might get wrong (I'm not sure, haven't tried it).
> >Also is there a reason why it uses slightly different values than e.g.
> D3DXSHMultiply3? Why don't we >use defines? A problem might be to find
> good names... Maybe the Multiply functions could share the >same base?
> To me it looks like they do share a lot of calculations, And if the
> order doesn't matter (see >comment above) then it may be possible to
> rearrange the calculation.
> >ta = 0.28209479f * a - 0.12615663f * a - 0.21850969f * a;
> >ta = 0.28209479f * a - 0.12615662f * a - 0.21850968f * a;
> I do the computations with a formal computation software. Unfortunately
> I did not use the same for D3DXSHMultiply4 and D3DXSHMultiply3 .....
> (Xcas vs Maple). And obtain the exact values look beyond the capacities
> of these softwares.
> And even the worst, since the integrated functions oscillate, the
> internal algorithm of the software are not robust to compute the
> integrals. For a given number of significative digits, that's why we
> obtain slightly different values for the both softwares.
> Addind defines will add tons on variables for no gain. But I can
> simplify slightly the function by calling D3DXSHMultiply3.
Ok, no problem. See above. I'd say compatibility before simplicity. It
was just a thought, because there was no test / comment in the code that
makes my suggestion a stupid idea, but the test above makes this idea
More information about the wine-devel