Hardware Images
#3
(01-14-2023, 04:32 PM)mnrvovrfc Wrote: No I'm not going to believe it's 2.5 million FPS on the last test! On a humble 10-year-old budget HP laptop. With desktop PC with GPU I would expect at least that much.

Can't believe the numbers?  How about if I use some easy animation to showcase the difference for you?  Surely you'd be able to tell if a box was bouncing around the screen faster than it did previously.  Right?

Code: (Select All)
DIM count AS _INTEGER64
displayScreen = _NEWIMAGE(1024, 720, 32)
workScreen = _NEWIMAGE(100, 100, 32)

SCREEN displayScreen
_DEST workScreen
CLS , &HFFFFFF00
hardwareScreen = _COPYIMAGE(workScreen, 33)
_DEST displayScreen

PRINT "For this demo, we're going to be scaling and placing a premade image onto the screen."
PRINT "For ease of output, our FPS count is going to be placed up in the TITLE area."
PRINT
PRINT "First, we'll do a FPS cound of simple software images."
PRINT "Let it run a few seconds, and then press <ANY KEY> when you'd like to move on."
PRINT
PRINT "After that, we'll use hardware images AND software images, and see how things compare."
PRINT "As before, watch the TITLE area for updates, and press <ANY KEY> when ready to move on."
PRINT
PRINT "And finally, we'll JUST use hardware images for our display."
PRINT "Once again, our FPS second count will be in the TITLE area, and you can press <ANY KEY> to"
PRINT "move to our final resulsts screen for ease of comparison."
PRINT
PRINT
PRINT "Press <ANY KEY> to begin."
SLEEP

_DELAY .5
_KEYCLEAR 'time to release any key


time# = TIMER + 1
xdirection = 1
ydirection = 1
DO
    CLS , 0
    scount = scount + 1
    IF TIMER > time# THEN
        _TITLE "Software FPS:" + STR$(scount)
        IF scount > smax THEN smax = scount
        scount = 0
        time# = TIMER + 1
    END IF
    x = x + xdirection
    y = y + ydirection
    IF x >= _WIDTH THEN xdirection = -xdirection
    IF x <= 0 THEN xdirection = -xdirection
    IF y >= _HEIGHT THEN ydirection = -ydirection
    IF y <= 0 THEN ydirection = -ydirection
    _PUTIMAGE (x, y)-STEP(100, 100), workScreen
    _DISPLAY
LOOP UNTIL _KEYHIT

_DELAY .5
_KEYCLEAR 'time to release any key

time# = TIMER + 1
DO
    CLS , 0
    mcount = mcount + 1
    IF TIMER > time# THEN
        _TITLE "Mixed FPS:" + STR$(mcount)
        IF mcount > mmax THEN mmax = mcount
        mcount = 0

        time# = TIMER + 1
    END IF
    x = x + xdirection
    y = y + ydirection
    IF x >= _WIDTH THEN xdirection = -xdirection
    IF x <= 0 THEN xdirection = -xdirection
    IF y >= _HEIGHT THEN ydirection = -ydirection
    IF y <= 0 THEN ydirection = -ydirection
    _PUTIMAGE (x, y)-STEP(100, 100), hardwareScreen

    _DISPLAY
LOOP UNTIL _KEYHIT

_DELAY .5
_KEYCLEAR 'time to release any key

time# = TIMER + 1
_DISPLAYORDER _HARDWARE
CLS , 0
DO
    hcount = hcount + 1
    IF TIMER > time# THEN
        _TITLE "Hardware FPS:" + STR$(hcount)
        IF hcount > hmax THEN hmax = hcount
        hcount = 0
        time# = TIMER + 1
    END IF
    x = x + xdirection
    y = y + ydirection
    IF x >= _WIDTH THEN xdirection = -xdirection
    IF x <= 0 THEN xdirection = -xdirection
    IF y >= _HEIGHT THEN ydirection = -ydirection
    IF y <= 0 THEN ydirection = -ydirection
    _PUTIMAGE (x, y)-STEP(100, 100), hardwareScreen

    _DISPLAY
LOOP UNTIL _KEYHIT

_DISPLAYORDER _SOFTWARE , _HARDWARE
CLS , 0
_AUTODISPLAY

PRINT USING "###,###,### FPS with Software Images"; smax
PRINT USING "###,###,### FPS with Software and Hardware Images"; mmax
PRINT USING "###,###,### FPS with Hardware Images only"; hmax
PRINT
PRINT
PRINT "I would think the figures here alone, would showcase why one might want to use hardware images over other types, when possible."


See the difference in performance?
Reply


Messages In This Thread
Hardware Images - by SMcNeill - 01-14-2023, 02:43 PM
RE: Hardware Images - by mnrvovrfc - 01-14-2023, 04:32 PM
RE: Hardware Images - by SMcNeill - 01-14-2023, 08:18 PM
RE: Hardware Images - by SMcNeill - 01-14-2023, 08:31 PM
RE: Hardware Images - by James D Jarvis - 01-16-2023, 10:13 PM
RE: Hardware Images - by OldMoses - 01-17-2023, 12:31 AM
RE: Hardware Images - by Ikerkaz - 01-17-2023, 10:33 AM
RE: Hardware Images - by SMcNeill - 01-17-2023, 10:51 AM
RE: Hardware Images - by SMcNeill - 02-16-2023, 10:34 PM
RE: Hardware Images - by mnrvovrfc - 02-16-2023, 11:03 PM
RE: Hardware Images - by TerryRitchie - 02-17-2023, 01:21 AM
RE: Hardware Images - by SMcNeill - 02-17-2023, 02:14 AM



Users browsing this thread: 5 Guest(s)