Another SSE/x87 rendering difference (R_LightPoint)
Posted: Mon Jan 26, 2015 6:25 am
Just noticed this.. in my map jam3_ericw, there's a zombie at the start of the map that's embedded partly into a wall. It gets rendered as black in some engines (winquake.exe, fitzquake085.exe, the 32-bit windows quakespasm 0.90.0).
In others, it's lit at a medium brightness (64-bit windows QS 0.90.0).
You can see the zombie in the top middle picture here, in this case it's lit up:
Here's a screenshot from winquake:
(the map is available here, including source)
Even though it looks worse in winquake / fitzquake, that's the reference rendering IMHO, and it's probably my fault for sticking the zombie too far inside the wall.
The cause seems to be another x76 vs SSE difference, like this previous one that was causing lightmap corruption in some maps.
I was able to get winquake-equivalent lighting in code compiled with SSE with the following changes to RecursiveLightPoint (this is modifying the version in Quakespasm):
Add:
In others, it's lit at a medium brightness (64-bit windows QS 0.90.0).
You can see the zombie in the top middle picture here, in this case it's lit up:
Here's a screenshot from winquake:
(the map is available here, including source)
Even though it looks worse in winquake / fitzquake, that's the reference rendering IMHO, and it's probably my fault for sticking the zombie too far inside the wall.
The cause seems to be another x76 vs SSE difference, like this previous one that was causing lightmap corruption in some maps.
I was able to get winquake-equivalent lighting in code compiled with SSE with the following changes to RecursiveLightPoint (this is modifying the version in Quakespasm):
Add:
Change:#define DoublePrecisionDotProduct(x,y) ((double)x[0]*y[0]+(double)x[1]*y[1]+(double)x[2]*y[2])
To:ds = (int) ((float) DotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
dt = (int) ((float) DotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]);
ds = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3]);
dt = (int) ((double) DoublePrecisionDotProduct (mid, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3]);