<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Jose, thanks for replying, I've seen your name inside many
      files in mesa ;)</p>
    <p>I have tried mesa master (previously I was using 17.0.1) but it
      still crashes for the same null pointer.<br>
      Do you have a link to that patch you've mentioned for kotor?</p>
    <p>I have used apitrace and took traces of both the nvidia driver
      (which runs kotor) and mesa (up until the crash).<br>
      Here's a link to them: <a
href="https://drive.google.com/file/d/0B6qj91UlSYlYa3dIM0FtaHNULW8/view?usp=sharing">https://drive.google.com/file/d/0B6qj91UlSYlYa3dIM0FtaHNULW8/view?usp=sharing</a><br>
    </p>
    <p>I tried reading them with the dump function but it's way above my
      comprehension.</p>
    <p>I know that some applications use wglGetProcAddress to check if
      an extension if available, but I've seen KOTOR check for the
      WGL_ARB_render_texture, and when it's present it enables frame
      buffer effects and soft shadows, which use
      wglMakeContextCurrentARB (not wglBindTexImageARB, I was wrong in
      my previous mail), which for some reason is a null pointer.<br>
    </p>
    <p><em></em><em></em><br>
    </p>
    <br>
    <div class="moz-cite-prefix">Il 2017-03-13 14:39, Jose Fonseca ha
      scritto:<br>
    </div>
    <blockquote
      cite="mid:deb551d4-fa06-9534-c848-11dc0dd528fb@vmware.com"
      type="cite">On 13/03/17 11:09, Emil Velikov wrote:
      <br>
      <blockquote type="cite">On 11 March 2017 at 11:51, Federico
        Dossena <a class="moz-txt-link-rfc2396E" href="mailto:dossenus91@gmail.com"><dossenus91@gmail.com></a> wrote:
        <br>
        <blockquote type="cite">In the last week I've been trying to
          bring an "old" game back to life, Star
          <br>
          Wars Knights of the old republic (KOTOR, for short). It's from
          2003 and uses
          <br>
          OpenGL 1.4.
          <br>
          <br>
          I have used Mesa, libtxc_dxtn and some trickery to decompress
          the textures
          <br>
          to boost performance, and right now I have it up and running
          smoothly with
          <br>
          Gallium on LLVMPipe, compiled on Windows. (I can upload a copy
          if someone is
          <br>
          interested). This took me about 2 days of compiling and
          figuring out stuff.
          <br>
          <br>
          Here's where the weirdness begins:
          <br>
          Turning on framebuffer effects or soft shadows make the game
          crash right
          <br>
          after the menu. Using a disassembler and debugger and what
          little knowledge
          <br>
          I have of reverse engineering, I managed to track down the
          issue to a
          <br>
          function which uses wglGetProcAddress to get the addresses of
          several OpenGL
          <br>
          functions. Some of these calls return a null pointer (even if
          there is a
          <br>
          valid context and it is current), and when the game tries to
          call them, it
          <br>
          crashes. The first one that makes it crash is a pointer to
          <br>
          wglBindTexImageARB, but there are a few others. NOPing the
          offending
          <br>
          instructions did not work, and returning a nop function just
          makes the game
          <br>
          display artifacts.
          <br>
          <br>
        </blockquote>
        Strange - afaict mesa (st/wgl) exposes both wglBindTexImageARB
        and the
        <br>
        WGL_ARB_render_texture extension.
        <br>
        You can break on DrvGetProcAddress and trace where/how we end up
        with
        <br>
        NULL function pointer.
        <br>
        <br>
        -Emil
        <br>
        _______________________________________________
        <br>
        mesa-dev mailing list
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
        <br>
        <a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
        <br>
        <br>
      </blockquote>
      <br>
      Federico,
      <br>
      <br>
      You should be using latest master for this.   There have been
      recent changes/fixes to our WGL implementation.
      <br>
      <br>
      <br>
      Last fall Brian Paul fixed an issue with WGL extension seen on
      KOTOR. I'm not sure the the issue has been crossported to Mesa
      master yet, and it might be unrelated.
      <br>
      <br>
      <br>
      Generally speaking, wglGetProcAddress returning NULL by itself is
      not a problem.  Many games wrongly rely on wglGetProcAddress NULL
      results to detect whether an GL/WGL extension is present (which
      goes against the spec).  Other libraries try to bindly get every
      possible entrypoint through wglGetProcAddress, then check which
      ones to use based on supported extensions (which is actually fine
      by the spec.)
      <br>
      <br>
      <br>
      For the record, getting an apitrace is usually useful to debug
      this sort of issues.  One can use apitrace straigh from windows or
      with WINE -- <a class="moz-txt-link-freetext" href="https://github.com/apitrace/apitrace/wiki/WINE">https://github.com/apitrace/apitrace/wiki/WINE</a>
      <br>
      <br>
      <br>
      Jose
      <br>
    </blockquote>
    <br>
  </body>
</html>