[Mesa-dev] MESA and KOTOR

Federico Dossena dossenus91 at gmail.com
Sat Mar 11 11:51:28 UTC 2017


In the last week I've been trying to bring an "old" game back to life, 
Star Wars Knights of the old republic (KOTOR, for short). It's from 2003 
and uses OpenGL 1.4.

I have used Mesa, libtxc_dxtn and some trickery to decompress the 
textures to boost performance, and right now I have it up and running 
smoothly with Gallium on LLVMPipe, compiled on Windows. (I can upload a 
copy if someone is interested). This took me about 2 days of compiling 
and figuring out stuff.

Here's where the weirdness begins:
Turning on framebuffer effects or soft shadows make the game crash right 
after the menu. Using a disassembler and debugger and what little 
knowledge I have of reverse engineering, I managed to track down the 
issue to a function which uses wglGetProcAddress to get the addresses of 
several OpenGL functions. Some of these calls return a null pointer 
(even if there is a valid context and it is current), and when the game 
tries to call them, it crashes. The first one that makes it crash is a 
pointer to wglBindTexImageARB, but there are a few others. NOPing the 
offending instructions did not work, and returning a nop function just 
makes the game display artifacts.

This issue is not new: a guy named Miklós Máté, here in the Mesa mailing 
list somehow managed to fix it in Mesa 11, but his patches do not seem 
to work anymore 
(https://lists.freedesktop.org/archives/mesa-dev/2016-February/106695.html). 
I tried to contact him but without luck.
The issue affects LLVMPipe, Softpipe and OpenSWR, so I think it's 
something in Gallium itself.

Nvidia's OpenGL driver is the only implementation that seems to work 
properly with this game at the moment, so if someone here's willing to 
help me out with this, a lot of people would be very grateful, and I am 
willing to pay too.

Thank you


More information about the mesa-dev mailing list