203f2df0
by Elizabeth Figura at 2025-08-03T11:18:52+09:00
Revert "wined3d/glsl: Transpose the bump environment matrix.".
This reverts commit ed62b8bf30ac926ae100eee42fee3f6ceb8541e2.
GL_TRUE here signifies that the matrix is in row-major storage, and we do indeed
pass it in row-major order here (like other d3d matrices).
The problem is that this matrix, like other d3d matrices, is not only row-major
in storage, it also uses what Sean Middleditch [1] calls "row-major notation".
Contrary to GL, Vulkan, and almost the entire world of mathematics, Direct3D
matrices have the *column* in their first component.
A matrix which is row-major in both storage and notation is effectively
identical, at least in storage order, to one which is column-major in both
storage and notation, as here. That is, it should *not* be transposed.
Adding to the confusion is the fact that, as mentioned by the commit being
reverted (as well as texbem_test() in d3d9:visual), some drivers get this wrong
too, and transpose the matrix. I originally thought that NVidia was broken, but
it turns out that AMD is the one in the wrong here, at least for the BEM and
TEXBEM(L) shader instructions. Incidentally, WARP incorrectly transposes the
matrix for TEXBEM(L) but not for BEM.
This fixes test failures in texbem_test() and fixed_function_bumpmap_test().
[1] https://web.archive.org/web/20180419095941/http://seanmiddleditch.com/matrices-handedness-pre-and-post-multiplication-row-vs-column-major-and-notations/