<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=iso-8859-15">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>It doesn't even play in Windows to be honest.<br>
      Brian Paul is taking a look at it, he is a developer of apitrace I
      believe.</p>
    <p>Anyway, a couple of clues that you might find useful:<br>
    </p>
    <ul>
      <li>Brian found these calls (these are the ones that make apitrace
        crash):<br>
        3158346 glViewport(x = 0, y = -32, width = 8, height = -1)
        <br>
        3158364 glViewport(x = 80, y = 22730, width = 640, height = 480)
        <br>
        3159395 glViewport(x = 0, y = 768, width = 12624, height =
        22502)
        <br>
        They look suspicious as hell. I tried modifying
        src/mesa/main/viewport.c to clamp them to more reasonable
        values. It didn't fix the crashing in kotor, but I'm not an
        expert in how mesa works internally so maybe there are other
        source files involved and you can do something better</li>
      <li>The crash is related to pbuffers, and it's an access
        violation. I took a look at
        src/gallium/state_trackers/wgl/stw_ext_pbuffer.c and from what I
        understand, it is implemented by drawing to an invisible window,
        right? Looking back at those strange values in glViewport, it
        makes me wonder if those seemingly random numbers could be some
        properties taken from those invisible windows (height, width,
        ...). Again, I'm no expert so I'll leave that to you to decide.<br>
        And speaking of strange window manipulations, I noticed that
        when the game starts, the nvidia driver destroys and recreates
        the window, but mesa does not. Weird stuff, but it might be a
        clue.</li>
    </ul>
    <p>I can give you a link to a copy of kotor with mesa if you want. I
      can't post it publicly here for obvious copyright reasons, but
      it's only 1.8gb if you want to give it a try.</p>
    <p>Let me know what you think.</p>
    <p>Thanks :)<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Il 2017-10-07 14:46, Nicolai Hähnle ha
      scritto:<br>
    </div>
    <blockquote type="cite"
      cite="mid:423f466d-a06f-8471-eee1-27767ed5ece4@gmail.com">Hi
      Federico,
      <br>
      <br>
      I finally got a chance to look at your trace. Unfortunately, it's
      not easily usable: the trace basically fails to replay because it
      uses WGL (the Windows GL system interface) instead of GLX.
      <br>
      <br>
      I can't really justify spending time on it because of that, sorry.
      <br>
      <br>
      If you do have time and interest to investigate, you could
      probably do a lot of people a huge favor if you could modify
      apitrace in a way that allows it to play WGL traces natively under
      Linux (e.g. by translating the WGL functions into GLX ones).
      <br>
      <br>
      Cheers,
      <br>
      Nicolai
      <br>
      <br>
      On 27.09.2017 11:21, Federico Dossena wrote:
      <br>
      <blockquote type="cite">Hi, did you get my previous email with the
        trace?
        <br>
        <br>
        <br>
        On 2017-09-26 14:11, Nicolai Hähnle wrote:
        <br>
        <blockquote type="cite">On 26.09.2017 12:59, Federico Dossena
          wrote:
          <br>
          <blockquote type="cite">The crash is in GLU, and I'm 99% sure
            that it has to do with the format of that texture.
            <br>
          </blockquote>
          <br>
          So how about a backtrace?
          <br>
          <br>
          It would be really valuable to have a simple stand-alone
          reproduction.
          <br>
          <br>
          Cheers,
          <br>
          Nicolai
          <br>
          <br>
          <br>
          <blockquote type="cite">I saw a patch from Miklòs Màté a while
            ago that changed something in
            src/mesa/state_tracker/st_atom_sampler.c to fix this (link:
            <a class="moz-txt-link-freetext" href="https://patchwork.freedesktop.org/patch/68298/">https://patchwork.freedesktop.org/patch/68298/</a>). It never
            made it to master, and that function has changed quite a bit
            since his patch. I don't really understand what it does
            since I don't know mesa very well, do you know how I could
            do the same thing in the new st_convert_sampler function?
            <br>
            <br>
            Thanks
            <br>
            <br>
            <br>
            Il 2017-09-26 12:56, Nicolai Hähnle ha scritto:
            <br>
            <blockquote type="cite">On 25.09.2017 18:50, Federico
              Dossena wrote:
              <br>
              <blockquote type="cite">Hello everyone,
                <br>
                you may remember that a few months ago I was trying to
                fix KOTOR to work with Mesa to use the Gallium llvmpipe
                software renderer.
                <br>
                <br>
                Well, it's been a while and I'm happy to see that things
                are a bit better with Mesa 17.2. The game still crashes,
                but we're closer to fixing it.
                <br>
                <br>
                Here's what I found using 17.2.1:
                <br>
                With frame buffer effects and soft shadows the game
                crashes at the end of loading; the crash is inside a
                function that amongst other things, generates mipmaps
                for a texture used in a pbuffer (function at offset
                2FB37D in my exe).
                <br>
                The crash happens when gluBuild2DMipmaps is called,
                however doesn't seem to be a null pointer like it was
                back in march: it's an access violation alright but no
                longer a null pointer. So I think it's a different,
                hopefully simpler, problem.
                <br>
              </blockquote>
              <br>
              So is it a crash in KOTOR, in glu, or in Mesa? If it's in
              one of the last two, then you should be able to compile
              both glu and Mesa from source with debugging info to help
              you narrow things down. A backtrace would be a good start.
              <br>
              <br>
              If it's in KOTOR itself, then I'm afraid we're probably
              not going to be a lot of help here...
              <br>
              <br>
              Cheers,
              <br>
              Nicolai
              <br>
              <br>
              <blockquote type="cite">
                <br>
                Back in march, Miklòs Màté suggested that changing the
                checks for the pixel format could fix the problem, and
                he was right; without those checks we definitely got a
                step closer to fixing it.
                <br>
                <br>
                My first thought was to just NOP the entire section that
                generates mipmaps and a bit of code later that uses it.
                The game no longer crashes, however it displays nothing,
                but I can hear it running in background. So this is the
                last issue! We're almost there!
                <br>
                <br>
                Now, I'm bothering you again because I think that at
                this point it's just a problem with the texture format
                used there. The call to gluBuild2DMipmaps uses
                LuminanceAlpha' as texture format as well as internal
                format (0x190a). I tried changing it to RGB and RGBA
                just to try something, but that didn't work because I
                guess the texture was already generated with another
                format.
                <br>
                <br>
                What could I do to investigate this further? And where
                should I look inside Mesa if I wanted to say... force a
                specific texture format for pbuffers?
                <br>
                <br>
                I feel that we're very close to fixing this. Your help
                would mean the world to me and the whole KOTOR
                community.
                <br>
                <br>
                Thank you ;)
                <br>
                <br>
                P.S.
                <br>
                This has nothing to do with mesa, but you should know
                that KOTOR is slowly dieing. It is currently unplayable
                on Intel and AMD graphics, and recent nVidia driver
                updates have introduced a glitch with transparencies (it
                can be fixed, but still, no one can play KOTOR on modern
                hardware properly and we have to keep old computers as
                dedicated "shrines" for KOTOR, that's why I insist so
                much on Mesa)
                <br>
                <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://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
                <br>
                <br>
              </blockquote>
              <br>
              <br>
            </blockquote>
            <br>
          </blockquote>
          <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>