Announcement

Collapse
No announcement yet.

More about FPS benchmark

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Patrice Terrier
    replied
    I have posted another one, where each drawing mode is doing exactly the same, with a fixed rate of 65 FPS on VISTA AERO computers.

    ...

    Leave a comment:


  • Patrice Terrier
    replied
    60 FPS = 60 Hz

    The latest demo has been posted there

    ...

    Leave a comment:


  • Patrice Terrier
    replied
    Note: 320 fps means nothing if your screen only refreshes 60 times a second.

    most LCD display have a refresh rate of 60 Hz only!

    I shall post a new demo to make this more obvious.

    ...
    Last edited by Patrice Terrier; 11 Sep 2009, 07:29 AM.

    Leave a comment:


  • Patrice Terrier
    replied
    Here is another old one, however rather slow.

    Code:
    ' Transparent BitBlt Function
    SUB TransBlt(BYVAL hDC&, _
                 BYVAL xDest&, BYVAL yDest&, BYVAL nWidth&, BYVAL nHeight&, _
                 BYVAL hSrcDC&, _
                 BYVAL xSrc&, BYVAL ySrc&, _
                 BYVAL TransColor&) 
    '   hDC&           Destination device context
    '   xDest&, yDest& Upper-left destination coordinates (pixels)
    '   nWidth&        Width of destination
    '   nHeight&       Height of destination
    '   hSrcBMP&       Handle of the source bitmap
    '   xSrc&, ySrc&   Upper-left source coordinates (pixels)
    '   TransColor&    RGB value for transparent pixels, typically &HC0C0C0.
    '                  Value < 0 means use GetPixel(hDC, X, Y)
    '
    '   32-Bit Transparent BitBlt Function
    '   Adapted to PowerBASIC by Patrice Terrier on 02-15-1999
    
        IF TransColor& < 0 THEN TransColor& = GetPixel(hSrcDC&, 0, 0)
    
      ' Create DCs to hold various stages of transformation.
        SavedDC& = CreateCompatibleDC(hDC&)
        MaskDC& = CreateCompatibleDC(hDC&)
        InvDC& = CreateCompatibleDC(hDC&)
        ResultDC& = CreateCompatibleDC(hDC&)
    
      ' Create monochrome bitmaps for the mask-related bitmaps.
        hMaskBmp& = CreateBitmap(nWidth&, nHeight&, 1, 1, BYVAL %NULL)
        hInvBmp& = CreateBitmap(nWidth&, nHeight&, 1, 1, BYVAL %NULL)
    
      ' Create color bitmaps for final result & stored copy of source.
        hResultBmp& = CreateCompatibleBitmap(hDC&, nWidth&, nHeight&)
        hSaveBmp& = CreateCompatibleBitmap(hDC&, nWidth&, nHeight&)
    
      ' Select bitmaps into DCs.
        hSavePrevBmp& = SelectObject(SavedDC&, hSaveBmp&)
        hMaskPrevBmp& = SelectObject(MaskDC&, hMaskBmp&)
        hInvPrevBmp& = SelectObject(InvDC&, hInvBmp&)
        hDestPrevBmp& = SelectObject(ResultDC&, hResultBmp&)
    
      ' Create mask: set background color of source to transparent color.
        WasColor& = SetBkColor(hSrcDC&, TransColor&)
        CALL BitBlt(MaskDC&, 0, 0, nWidth&, nHeight&, hSrcDC&, xSrc&, ySrc&, %SRCCOPY)
        TransColor& = SetBkColor(hSrcDC&, WasColor&)
    
      ' Create inverse of mask to AND w/ source & combine w/ background.
        CALL BitBlt(InvDC&, 0, 0, nWidth&, nHeight&, MaskDC&, 0, 0, &H00330008) ' %NOTSRCCOPY
    
      ' Copy background bitmap to result.
        CALL BitBlt(ResultDC&, 0, 0, nWidth&, nHeight&, hDC&, xDest&, yDest&, %SRCCOPY)
    
      ' AND mask bitmap w/ result DC to punch hole in the background by
      ' painting black area for non-transparent portion of source bitmap.
        CALL BitBlt(ResultDC&, 0, 0, nWidth&, nHeight&, MaskDC&, 0, 0, &H008800C6) ' %SRCAND
    
      ' Get overlapper
        CALL BitBlt(SavedDC&, 0, 0, nWidth&, nHeight&, hSrcDC&, xSrc&, ySrc&, %SRCCOPY)
    
      ' AND with inverse monochrome mask
        CALL BitBlt(SavedDC&, 0, 0, nWidth&, nHeight&, InvDC&, 0, 0, &H008800C6) ' %SRCAND
    
      ' XOR these two
        CALL BitBlt(ResultDC&, 0, 0, nWidth&, nHeight&, SavedDC&, 0, 0, &H00660046) ' %SRCINVERT
    
      ' Display transparent bitmap on background.
        CALL BitBlt(hDC&, xDest&, yDest&, nWidth&, nHeight&, ResultDC&, 0, 0, %SRCCOPY)
    
      ' Select original objects back.
        CALL SelectObject(SavedDC&, hSavePrevBmp&)
        CALL SelectObject(ResultDC&, hDestPrevBmp&)
        CALL SelectObject(MaskDC&, hMaskPrevBmp&)
        CALL SelectObject(InvDC&, hInvPrevBmp&)
    
      ' Deallocate system resources.
        CALL DeleteObject(hSaveBmp&)
        CALL DeleteObject(hMaskBmp&)
        CALL DeleteObject(hInvBmp&)
        CALL DeleteObject(hResultBmp&)
        CALL DeleteDC(SavedDC&)
        CALL DeleteDC(InvDC&)
        CALL DeleteDC(MaskDC&)
        CALL DeleteDC(ResultDC&)
    
    END SUB
    ...

    Leave a comment:


  • Patrice Terrier
    replied
    See also the TransBlt example that was first posted 10 years ago!

    Last edited by Patrice Terrier; 10 Sep 2009, 08:14 AM.

    Leave a comment:


  • Patrice Terrier
    replied
    Chris,

    Just a small correction, they are not new mode, TransBlt has been there since the first version of GDImage, and was borrowed to my WinLIFT SkinEngine.
    What i did in the new demo was the hability to easily switch from one mode to the other, using this small function:
    Code:
    FUNCTION ZI_BoostSprite ALIAS "ZI_BoostSprite" (BYVAL nFlag AS LONG, BYVAL RW AS LONG) EXPORT AS LONG
        STATIC WasFlag AS LONG
        IF RW THEN WasFlag = nFlag
        FUNCTION = WasFlag
    END FUNCTION
    as you can see nothing fancy there.

    Note that TransparentBlt works only on true 32-bit OS, and it is one of the fastest mode, probably due to hardware graphic acceleration.
    However it has several limitations that makes it not suitable for advanced graphics. (see the link to MSDN below for further details)

    Indeed it is so fast than even on VISTA DWM you can see small vertical retrace, when you use it on nVidia GeForce GO 7600 and above.

    http://msdn.microsoft.com/en-us/libr...41(VS.85).aspx

    ...
    Last edited by Patrice Terrier; 10 Sep 2009, 02:30 AM.

    Leave a comment:


  • Chris Boss
    replied
    Patrice added two new drawing modes in GDImage.

    My tests and others show the two new modes:

    AlphaBlend mode - to be 200% faster than the previous composite drawing mode

    TransBlt mode - to be 300% faster than the previous composite mode.

    Where fast graphics, we are talking here!

    Very good Patrice!

    Note, the speed improvements will really most likely be most noticable on Windows Vista.
    Last edited by Chris Boss; 9 Sep 2009, 11:43 PM.

    Leave a comment:


  • Patrice Terrier
    started a topic More about FPS benchmark

    More about FPS benchmark

    Latest FPS benchmark can be found there

    ...
    Last edited by Patrice Terrier; 9 Sep 2009, 11:28 AM.
Working...
X