Loading ...
Sorry, an error occurred while loading the content.

RE: SwapBuffers problem (?)

Expand Messages
  • JM
    Use QueryPerformaceCounter(). There s another function working in conjunction with the above. You might find it on search for it. Unless I ve got the cat at
    Message 1 of 9 , Oct 23, 2003
    View Source
    • 0 Attachment
      Use QueryPerformaceCounter().

      There's another function working in conjunction with the above. You
      might find it on search for it.

      Unless I've got the cat at the tail.



      -JM.


      -----Original Message-----
      Scott Southurst
      Sent: 23 October 2003 02:36 PM
      To: Multiple recipients of list OPENGL-GAMEDEV-L

      Actually it looks like it might be an issue with GetTickCount(). I looked
      at one of my older projects and found it was running OK. Added the same
      timing code in and I got the problem. If anyone has any suggestions Re:
      this function please e-mail me direct.

      Thx,

      Scott S.

      -----Original Message-----
      Sent: Thursday, 23 October 2003 12:09 AM
      To: Multiple recipients of list OPENGL-GAMEDEV-L


      Hi All,

      Does anyone know of any issues relating to Swap buffers and geforce fx
      5900's? I recently rebuilt my PC and since the rebuild my current project
      has been misbehaving. The frame rate is "uneven". ie. It seems to go OK
      for say 10 or so frames then there's one frame that'll take something like
      10 to 20 times longer than the previous frames, then that pattern will
      repeat. I'm getting a frame rate of around 800fps, but the jerkiness is
      still noticable.

      I've tried eliminating bits of code to see what is causing it and the only
      thing that appears to have an effect is the swap buffers call (I say appears
      because the display is rather garbled when in "single" buffer mode). I have
      run some profiling tests and the call to Swapbuffers is around 40% of my
      entire applications run-time. And this is an actual game (not just a simple
      demo) - plus I don't have VSync turned on. 40% seems a bit (or very)
      extreme to me.

      Does anyone have any ideas as to what might be causing this?

      My system is Win2k, Leadtek geforce fx 5900 Ultra, AMD 2400+ XP, 512Meg
      PC3200 RAM. The drivers are the current public release (45.23?). There is
      essentially no difference between the machine and it's software compared to
      before the rebuild (with the exception of a new SATA HDD - and yes I tried
      disabling it to see if it was doing something it shouldn't)

      Thanks,

      Scott S.

      PS. When I run the same code on a geforce 3 Ti200 the problem doesn't
      appear to be happening (ie. the motion appears to be much more even/smooth
      on the geforce 3)
      -----
      FAQ and OpenGL Resources at:
      http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

      --
      Author: Scott Southurst
      INET: Scott@...

      Fat City Network Services -- 858-538-5051 http://www.fatcity.com
      San Diego, California -- Mailing list and web hosting services
      ---------------------------------------------------------------------
      To REMOVE yourself from this mailing list, send an E-Mail message
      to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
      the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
      (or the name of mailing list you want to be removed from). You may
      also send the HELP command for other information (like subscribing).
      -----
      FAQ and OpenGL Resources at:
      http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

      --
      Author: Scott Southurst
      INET: Scott@...

      Fat City Network Services -- 858-538-5051 http://www.fatcity.com
      San Diego, California -- Mailing list and web hosting services
      ---------------------------------------------------------------------
      To REMOVE yourself from this mailing list, send an E-Mail message
      to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
      the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
      (or the name of mailing list you want to be removed from). You may
      also send the HELP command for other information (like subscribing).

      -----
      FAQ and OpenGL Resources at:
      http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

      --
      Author: JM
      INET: jm_1983310@...

      Fat City Network Services -- 858-538-5051 http://www.fatcity.com
      San Diego, California -- Mailing list and web hosting services
      ---------------------------------------------------------------------
      To REMOVE yourself from this mailing list, send an E-Mail message
      to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
      the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
      (or the name of mailing list you want to be removed from). You may
      also send the HELP command for other information (like subscribing).
    • Kevin Bray
      GetTickCount is horribly innaccurate. You want to use high performance counters for timing. Kevin ...
      Message 2 of 9 , Oct 23, 2003
      View Source
      • 0 Attachment
        GetTickCount is horribly innaccurate. You want to use high performance
        counters for timing.

        Kevin


        >From: Scott Southurst <Scott@...>
        >Reply-To: OPENGL-GAMEDEV-L@...
        >To: Multiple recipients of list OPENGL-GAMEDEV-L
        ><OPENGL-GAMEDEV-L@...>
        >Subject: RE: SwapBuffers problem (?)
        >Date: Thu, 23 Oct 2003 04:36:16 -0800
        >
        >Actually it looks like it might be an issue with GetTickCount(). I looked
        >at one of my older projects and found it was running OK. Added the same
        >timing code in and I got the problem. If anyone has any suggestions Re:
        >this function please e-mail me direct.
        >
        >Thx,
        >
        >Scott S.
        >
        >-----Original Message-----
        >Sent: Thursday, 23 October 2003 12:09 AM
        >To: Multiple recipients of list OPENGL-GAMEDEV-L
        >
        >
        >Hi All,
        >
        >Does anyone know of any issues relating to Swap buffers and geforce fx
        >5900's? I recently rebuilt my PC and since the rebuild my current project
        >has been misbehaving. The frame rate is "uneven". ie. It seems to go OK
        >for say 10 or so frames then there's one frame that'll take something like
        >10 to 20 times longer than the previous frames, then that pattern will
        >repeat. I'm getting a frame rate of around 800fps, but the jerkiness is
        >still noticable.
        >
        >I've tried eliminating bits of code to see what is causing it and the only
        >thing that appears to have an effect is the swap buffers call (I say
        >appears
        >because the display is rather garbled when in "single" buffer mode). I
        >have
        >run some profiling tests and the call to Swapbuffers is around 40% of my
        >entire applications run-time. And this is an actual game (not just a
        >simple
        >demo) - plus I don't have VSync turned on. 40% seems a bit (or very)
        >extreme to me.
        >
        >Does anyone have any ideas as to what might be causing this?
        >
        >My system is Win2k, Leadtek geforce fx 5900 Ultra, AMD 2400+ XP, 512Meg
        >PC3200 RAM. The drivers are the current public release (45.23?). There is
        >essentially no difference between the machine and it's software compared to
        >before the rebuild (with the exception of a new SATA HDD - and yes I tried
        >disabling it to see if it was doing something it shouldn't)
        >
        >Thanks,
        >
        >Scott S.
        >
        >PS. When I run the same code on a geforce 3 Ti200 the problem doesn't
        >appear to be happening (ie. the motion appears to be much more even/smooth
        >on the geforce 3)
        >-----
        >FAQ and OpenGL Resources at:
        > http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
        >
        >--
        >Author: Scott Southurst
        > INET: Scott@...
        >
        >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
        >San Diego, California -- Mailing list and web hosting services
        >---------------------------------------------------------------------
        >To REMOVE yourself from this mailing list, send an E-Mail message
        >to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
        >the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
        >(or the name of mailing list you want to be removed from). You may
        >also send the HELP command for other information (like subscribing).
        >-----
        >FAQ and OpenGL Resources at:
        > http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
        >
        >--
        >Author: Scott Southurst
        > INET: Scott@...
        >
        >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
        >San Diego, California -- Mailing list and web hosting services
        >---------------------------------------------------------------------
        >To REMOVE yourself from this mailing list, send an E-Mail message
        >to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
        >the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
        >(or the name of mailing list you want to be removed from). You may
        >also send the HELP command for other information (like subscribing).

        _________________________________________________________________
        Concerned that messages may bounce because your Hotmail account has exceeded
        its 2MB storage limit? Get Hotmail Extra Storage!
        http://join.msn.com/?PAGE=features/es

        -----
        FAQ and OpenGL Resources at:
        http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

        --
        Author: Kevin Bray
        INET: ebray99@...

        Fat City Network Services -- 858-538-5051 http://www.fatcity.com
        San Diego, California -- Mailing list and web hosting services
        ---------------------------------------------------------------------
        To REMOVE yourself from this mailing list, send an E-Mail message
        to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
        the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
        (or the name of mailing list you want to be removed from). You may
        also send the HELP command for other information (like subscribing).
      • Parveen Kaler
        ... Not true for all platforms. QueryPerformanceCounter is horrible on some platforms too. Try this on WinXP machine and then on a Win98 machine
        Message 3 of 9 , Oct 23, 2003
        View Source
        • 0 Attachment
          On Thu, 23 Oct 2003 08:59:23 -0800 OPENGL-GAMEDEV-L@... wrote:
          > GetTickCount is horribly innaccurate. You want to use high performance
          > counters for timing.
          >
          > Kevin

          Not true for all platforms. QueryPerformanceCounter is horrible on some
          platforms too.

          Try this on WinXP machine and then on a Win98 machine
          http://developer.nvidia.com/object/timer_function_performance.html
          -----
          FAQ and OpenGL Resources at:
          http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

          --
          Author: Parveen Kaler
          INET: pk@...

          Fat City Network Services -- 858-538-5051 http://www.fatcity.com
          San Diego, California -- Mailing list and web hosting services
          ---------------------------------------------------------------------
          To REMOVE yourself from this mailing list, send an E-Mail message
          to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
          the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
          (or the name of mailing list you want to be removed from). You may
          also send the HELP command for other information (like subscribing).
        • Scott Southurst
          That s the ticket. The other function is QueryPerformanceFrequency(). Thanks, Scott S. ... Sent: Thursday, 23 October 2003 10:54 PM To: Multiple recipients of
          Message 4 of 9 , Oct 24, 2003
          View Source
          • 0 Attachment
            That's the ticket. The other function is QueryPerformanceFrequency().

            Thanks,

            Scott S.

            -----Original Message-----
            Sent: Thursday, 23 October 2003 10:54 PM
            To: Multiple recipients of list OPENGL-GAMEDEV-L


            Use QueryPerformaceCounter().

            There's another function working in conjunction with the above. You
            might find it on search for it.

            Unless I've got the cat at the tail.



            -JM.
            -----
            FAQ and OpenGL Resources at:
            http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

            --
            Author: Scott Southurst
            INET: Scott@...

            Fat City Network Services -- 858-538-5051 http://www.fatcity.com
            San Diego, California -- Mailing list and web hosting services
            ---------------------------------------------------------------------
            To REMOVE yourself from this mailing list, send an E-Mail message
            to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
            the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
            (or the name of mailing list you want to be removed from). You may
            also send the HELP command for other information (like subscribing).
          • Scott Southurst
            Odd that I haven t had problems with it before. Maybe a recent security patch changed something... Who knows. Scott S. ... Sent: Friday, 24 October 2003
            Message 5 of 9 , Oct 24, 2003
            View Source
            • 0 Attachment
              Odd that I haven't had problems with it before. Maybe a recent "security"
              patch changed something... Who knows.

              Scott S.

              -----Original Message-----
              Sent: Friday, 24 October 2003 2:59 AM
              To: Multiple recipients of list OPENGL-GAMEDEV-L


              GetTickCount is horribly innaccurate. You want to use high performance
              counters for timing.

              Kevin
              -----
              FAQ and OpenGL Resources at:
              http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

              --
              Author: Scott Southurst
              INET: Scott@...

              Fat City Network Services -- 858-538-5051 http://www.fatcity.com
              San Diego, California -- Mailing list and web hosting services
              ---------------------------------------------------------------------
              To REMOVE yourself from this mailing list, send an E-Mail message
              to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
              the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
              (or the name of mailing list you want to be removed from). You may
              also send the HELP command for other information (like subscribing).
            • Viet-Tam Luu
              As far as I can recall (going back to Win16 days), GetTickCount() is tied to the clock tick counter which has a frequency of 18.2065 Hz (or something like
              Message 6 of 9 , Oct 27, 2003
              View Source
              • 0 Attachment
                As far as I can recall (going back to Win16 days), GetTickCount() is tied to
                the clock tick counter which has a frequency of 18.2065 Hz (or something
                like that).

                The timer that drivers QueryPerformanceCounter() varies. If I recall
                correctly, my own experiments showed that on a single-CPU system, it's
                typically implemented using some high-resolution counter with a frequency
                just above 1MHz (?). On SMP systems it appears to be implemented using an
                interlocked read of the first (?) CPU's timestamp counter (TSC). The
                implementation calls into the kernel (ring 0) so there's a slight amount of
                overhead (something in the neighbourhood of thousands of CPU clocks)
                associated with QueryPerformanceCounter().

                The cheapest high-resolution timing solution is to use RDTSC directly to
                read the timestamp counter; RDTSC returns a result within a handful of clock
                cycles. However its use assumes a number of things:
                - That you know the exact CPU frequency.
                - That the CPU frequency doesn't change (not true in some mobile systems!).
                - On SMP systems, that you're always reading the same CPU's TSC or that the
                CPUs' TSCs are synchronized (not generally the case).

                --
                Viet-Tam Luu
                gl_geek@...

                ----- Original Message -----
                To: "Multiple recipients of list OPENGL-GAMEDEV-L"
                <OPENGL-GAMEDEV-L@...>
                Sent: Friday, October 24, 2003 03:14


                > Odd that I haven't had problems with it before. Maybe a recent "security"
                > patch changed something... Who knows.
                >
                > Scott S.
                >
                > -----Original Message-----
                > Sent: Friday, 24 October 2003 2:59 AM
                > To: Multiple recipients of list OPENGL-GAMEDEV-L
                >
                >
                > GetTickCount is horribly innaccurate. You want to use high performance
                > counters for timing.
                >
                > Kevin
                > -----
                > FAQ and OpenGL Resources at:
                > http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
                >
                > --
                > Author: Scott Southurst
                > INET: Scott@...
                >
                > Fat City Network Services -- 858-538-5051 http://www.fatcity.com
                > San Diego, California -- Mailing list and web hosting services
                > ---------------------------------------------------------------------
                > To REMOVE yourself from this mailing list, send an E-Mail message
                > to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
                > the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
                > (or the name of mailing list you want to be removed from). You may
                > also send the HELP command for other information (like subscribing).
                >
                -----
                FAQ and OpenGL Resources at:
                http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

                --
                Author: Viet-Tam Luu
                INET: gl_geek@...

                Fat City Network Services -- 858-538-5051 http://www.fatcity.com
                San Diego, California -- Mailing list and web hosting services
                ---------------------------------------------------------------------
                To REMOVE yourself from this mailing list, send an E-Mail message
                to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
                the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
                (or the name of mailing list you want to be removed from). You may
                also send the HELP command for other information (like subscribing).
              • Kevin Bray
                The RDTSC solution does not work on some mobile processors (because they can have varying clock speeds to save on power consumption). IIRC, the instruction
                Message 7 of 9 , Oct 28, 2003
                View Source
                • 0 Attachment
                  The RDTSC solution does not work on some mobile processors (because they can
                  have varying clock speeds to save on power consumption). IIRC, the
                  instruction seems to work sometimes, and others it seems to just return
                  errata (or it may just return errata all of the time... one of the two =�).

                  Kevin

                  >From: "Viet-Tam Luu" <gl_geek@...>
                  >Reply-To: OPENGL-GAMEDEV-L@...
                  >To: Multiple recipients of list OPENGL-GAMEDEV-L
                  ><OPENGL-GAMEDEV-L@...>
                  >Subject: Re: SwapBuffers problem (?)
                  >Date: Mon, 27 Oct 2003 16:24:22 -0800
                  >
                  >As far as I can recall (going back to Win16 days), GetTickCount() is tied
                  >to
                  >the clock tick counter which has a frequency of 18.2065 Hz (or something
                  >like that).
                  >
                  >The timer that drivers QueryPerformanceCounter() varies. If I recall
                  >correctly, my own experiments showed that on a single-CPU system, it's
                  >typically implemented using some high-resolution counter with a frequency
                  >just above 1MHz (?). On SMP systems it appears to be implemented using an
                  >interlocked read of the first (?) CPU's timestamp counter (TSC). The
                  >implementation calls into the kernel (ring 0) so there's a slight amount of
                  >overhead (something in the neighbourhood of thousands of CPU clocks)
                  >associated with QueryPerformanceCounter().
                  >
                  >The cheapest high-resolution timing solution is to use RDTSC directly to
                  >read the timestamp counter; RDTSC returns a result within a handful of
                  >clock
                  >cycles. However its use assumes a number of things:
                  >- That you know the exact CPU frequency.
                  >- That the CPU frequency doesn't change (not true in some mobile systems!).
                  >- On SMP systems, that you're always reading the same CPU's TSC or that the
                  >CPUs' TSCs are synchronized (not generally the case).
                  >
                  >--
                  >Viet-Tam Luu
                  >gl_geek@...
                  >
                  >----- Original Message -----
                  >To: "Multiple recipients of list OPENGL-GAMEDEV-L"
                  ><OPENGL-GAMEDEV-L@...>
                  >Sent: Friday, October 24, 2003 03:14
                  >
                  >
                  > > Odd that I haven't had problems with it before. Maybe a recent
                  >"security"
                  > > patch changed something... Who knows.
                  > >
                  > > Scott S.
                  > >
                  > > -----Original Message-----
                  > > Sent: Friday, 24 October 2003 2:59 AM
                  > > To: Multiple recipients of list OPENGL-GAMEDEV-L
                  > >
                  > >
                  > > GetTickCount is horribly innaccurate. You want to use high performance
                  > > counters for timing.
                  > >
                  > > Kevin
                  > > -----
                  > > FAQ and OpenGL Resources at:
                  > > http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
                  > >
                  > > --
                  > > Author: Scott Southurst
                  > > INET: Scott@...
                  > >
                  > > Fat City Network Services -- 858-538-5051 http://www.fatcity.com
                  > > San Diego, California -- Mailing list and web hosting services
                  > > ---------------------------------------------------------------------
                  > > To REMOVE yourself from this mailing list, send an E-Mail message
                  > > to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
                  > > the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
                  > > (or the name of mailing list you want to be removed from). You may
                  > > also send the HELP command for other information (like subscribing).
                  > >
                  >-----
                  >FAQ and OpenGL Resources at:
                  > http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
                  >
                  >--
                  >Author: Viet-Tam Luu
                  > INET: gl_geek@...
                  >
                  >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
                  >San Diego, California -- Mailing list and web hosting services
                  >---------------------------------------------------------------------
                  >To REMOVE yourself from this mailing list, send an E-Mail message
                  >to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
                  >the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
                  >(or the name of mailing list you want to be removed from). You may
                  >also send the HELP command for other information (like subscribing).

                  _________________________________________________________________
                  Cheer a special someone with a fun Halloween eCard from American Greetings!
                  Go to http://www.msn.americangreetings.com/index_msn.pd?source=msne134

                  -----
                  FAQ and OpenGL Resources at:
                  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

                  --
                  Author: Kevin Bray
                  INET: ebray99@...

                  Fat City Network Services -- 858-538-5051 http://www.fatcity.com
                  San Diego, California -- Mailing list and web hosting services
                  ---------------------------------------------------------------------
                  To REMOVE yourself from this mailing list, send an E-Mail message
                  to: ListGuru@... (note EXACT spelling of 'ListGuru') and in
                  the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
                  (or the name of mailing list you want to be removed from). You may
                  also send the HELP command for other information (like subscribing).
                Your message has been successfully submitted and would be delivered to recipients shortly.