<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    The game still crashes at the same null pointer, but I've seen it
    use that function you changed so I guess I'll keep the patch just to
    be safe.
    <br>
    <br>
    Are there any patches that touch wglMakeContextCurrentARB and didn't
    make it to master?
    <br>
    <br>
    (Resent the email because thunderbird removed the mesa-dev cc)<br>
    <br>
    <br>
    Il 2017-03-14 03:44, Brian Paul ha scritto:
    <br>
    <blockquote type="cite" style="color: #000000;">Looks like my KOTOR
      patch never made it to master.  I'm attaching it below so you can
      try it.  I should commit it master.  In any case, let me know if
      it helps.
      <br>
      <br>
      -Brian
      <br>
      <br>
      On 03/13/2017 10:55 AM, Federico Dossena wrote:
      <br>
      <blockquote type="cite" style="color: #000000;">Hi Jose, thanks
        for replying, I've seen your name inside many files in
        <br>
        mesa <span class="moz-smiley-s3" title=";)"></span>
        <br>
        <br>
        I have tried mesa master (previously I was using 17.0.1) but it
        still
        <br>
        crashes for the same null pointer.
        <br>
        Do you have a link to that patch you've mentioned for kotor?
        <br>
        <br>
        I have used apitrace and took traces of both the nvidia driver
        (which
        <br>
        runs kotor) and mesa (up until the crash).
        <br>
        Here's a link to them:
        <br>
        <a class="moz-txt-link-freetext"
href="https://drive.google.com/file/d/0B6qj91UlSYlYa3dIM0FtaHNULW8/view?usp=sharing">https://drive.google.com/file/d/0B6qj91UlSYlYa3dIM0FtaHNULW8/view?usp=sharing</a>
        <br>
        <a class="moz-txt-link-rfc2396E"
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_0B6qj91UlSYlYa3dIM0FtaHNULW8_view-3Fusp-3Dsharing&d=DwMDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=u9OxTt6a0b4XxAVoFjjG7RmQNYLAIe3smaD2NtY0mhE&s=h5NDyV1_DsR1WIruLOfH3IDrWkYTa8VEHeC3vIiucF4&e="><https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_0B6qj91UlSYlYa3dIM0FtaHNULW8_view-3Fusp-3Dsharing&d=DwMDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=u9OxTt6a0b4XxAVoFjjG7RmQNYLAIe3smaD2NtY0mhE&s=h5NDyV1_DsR1WIruLOfH3IDrWkYTa8VEHeC3vIiucF4&e=></a>
        <br>
        <br>
        I tried reading them with the dump function but it's way above
        my
        <br>
        comprehension.
        <br>
        <br>
        I know that some applications use wglGetProcAddress to check if
        an
        <br>
        extension if available, but I've seen KOTOR check for the
        <br>
        WGL_ARB_render_texture, and when it's present it enables frame
        buffer
        <br>
        effects and soft shadows, which use wglMakeContextCurrentARB
        (not
        <br>
        wglBindTexImageARB, I was wrong in my previous mail), which for
        some
        <br>
        reason is a null pointer.
        <br>
        <br>
        ////
        <br>
        <br>
        <br>
        Il 2017-03-13 14:39, Jose Fonseca ha scritto:
        <br>
        <blockquote type="cite" style="color: #000000;">On 13/03/17
          11:09, Emil Velikov wrote:
          <br>
          <blockquote type="cite" style="color: #000000;">On 11 March
            2017 at 11:51, Federico Dossena <a
              class="moz-txt-link-rfc2396E"
              href="mailto:dossenus91@gmail.com"><dossenus91@gmail.com></a>
            <br>
            wrote:
            <br>
            <blockquote type="cite" style="color: #000000;">In the last
              week I've been trying to bring an "old" game back to
              <br>
              life, Star
              <br>
              Wars Knights of the old republic (KOTOR, for short). It's
              from 2003
              <br>
              and uses
              <br>
              OpenGL 1.4.
              <br>
              <br>
              I have used Mesa, libtxc_dxtn and some trickery to
              decompress the
              <br>
              textures
              <br>
              to boost performance, and right now I have it up and
              running
              <br>
              smoothly with
              <br>
              Gallium on LLVMPipe, compiled on Windows. (I can upload a
              copy if
              <br>
              someone is
              <br>
              interested). This took me about 2 days of compiling and
              figuring out
              <br>
              stuff.
              <br>
              <br>
              Here's where the weirdness begins:
              <br>
              Turning on framebuffer effects or soft shadows make the
              game crash
              <br>
              right
              <br>
              after the menu. Using a disassembler and debugger and what
              little
              <br>
              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
              <br>
              several OpenGL
              <br>
              functions. Some of these calls return a null pointer (even
              if there
              <br>
              is a
              <br>
              valid context and it is current), and when the game tries
              to call
              <br>
              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
              <br>
              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
          <br>
          changes/fixes to our WGL implementation.
          <br>
          <br>
          <br>
          Last fall Brian Paul fixed an issue with WGL extension seen on
          KOTOR.
          <br>
          I'm not sure the the issue has been crossported to Mesa master
          yet,
          <br>
          and it might be unrelated.
          <br>
          <br>
          <br>
          Generally speaking, wglGetProcAddress returning NULL by itself
          is not
          <br>
          a problem.  Many games wrongly rely on wglGetProcAddress NULL
          results
          <br>
          to detect whether an GL/WGL extension is present (which goes
          against
          <br>
          the spec).  Other libraries try to bindly get every possible
          <br>
          entrypoint through wglGetProcAddress, then check which ones to
          use
          <br>
          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
          <br>
          sort of issues.  One can use apitrace straigh from windows or
          with
          <br>
          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>
        <br>
        <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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=u9OxTt6a0b4XxAVoFjjG7RmQNYLAIe3smaD2NtY0mhE&s=jnsrLdbWwBr7d8cUeUr_dxHK8sN25_6TfLQjoVbMCj8&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=u9OxTt6a0b4XxAVoFjjG7RmQNYLAIe3smaD2NtY0mhE&s=jnsrLdbWwBr7d8cUeUr_dxHK8sN25_6TfLQjoVbMCj8&e=</a>
        <br>
        <br>
      </blockquote>
      <br>
    </blockquote>
  </body>
</html>