[PATCH] d3dx9: Implement D3DXSHProjectCubeMap().

Zebediah Figura zfigura at codeweavers.com
Thu Feb 3 19:59:15 CST 2022


On 2/1/22 05:41, Matteo Bruni wrote:
>> +        if (FAILED(hr = IDirect3DCubeTexture9_LockRect(texture, face, 0, &map_desc, NULL, D3DLOCK_READONLY)))
> 
> Are levels > 0 entirely ignored?
> I think we should test that and update the implementation as necessary.

Yes, they are. I've added tests in v2.

>> +                diff_solid = 4.0f / ((1.0f + u * u + v * v) * sqrtf(1.0f + u * u + v * v));
> 
> This could also be written more concisely as
> diff_solid = 4.0f * powf(1.0f + u * u + v * v, -1.5f);
> Does the original code mention anything about it? Is one version
> faster, or more accurate, than the alternative? I'd give it another
> look (no need to do crazy benchmarking, I'm just curious if one
> version is much better than the other i.e. one order of magnitude or
> more) and put a comment here to explain the choice made, either way.

The original code doesn't mention anything. At least for these tests the 
sqrtf() approximation is slightly more accurate, but only barely. A very 
crude benchmark implies it's slightly faster, too, but probably not 
enough to matter.



More information about the wine-devel mailing list