[Mesa-dev] MESA and KOTOR

Emil Velikov emil.l.velikov at gmail.com
Mon Mar 13 11:09:39 UTC 2017


On 11 March 2017 at 11:51, Federico Dossena <dossenus91 at gmail.com> wrote:
> 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.
>
Strange - afaict mesa (st/wgl) exposes both wglBindTexImageARB and the
WGL_ARB_render_texture extension.
You can break on DrvGetProcAddress and trace where/how we end up with
NULL function pointer.

-Emil


More information about the mesa-dev mailing list