Has Single-surface been introduced?

BlitzMax Forums/BlitzMax Programming/Has Single-surface been introduced?

tonyg(Posted 2005) [#1]
I sort of remember looking through the image.loadanim
code pre-1.12 and saw it created a seperate pixmap for each frame in a loadanimimage.
Looking at it now, and it seems to create a pointer to a rectangular area of the image using staticpixmaps.
A quick test seems to suggest the code is running at similar speeds to Indie's SS code.
Can somebody check the code and see what they think (or if BRL could comment...)?


Robert Cummings(Posted 2005) [#2]
Anyone?


DStastny(Posted 2005) [#3]
No, I have been extensivily through the code. Each Frame of image is loaded into a seperate texture surface.

Doug Stastny


Robert Cummings(Posted 2005) [#4]
Thanks!

Should be a good speed boost when/if they decide to put this in (for ogl and dx)?


tonyg(Posted 2005) [#5]
It's only my GL test that runs at similar speeds.
DX is still approx 40% slower with loadanimimage.
All very odd.


HrdNutz(Posted 2005) [#6]
DX7 is slightly slower than GL if unoptimized, optimized they are about the same speed. Being able to draw from a single surface isn't going to speed stuff up too much, as the problem lies in sending single quad to the renderer at one time. Most optimal solution is to keep as much stuff in one texture as possible, and then batch geometry by texture/render state. Without batching, you won't see much improvement, and without having everything in a single surface, batching can't work.

If you want to use single surface now, there is code on this forum on how to do it, and it's very simple. Thank IndiePath for that :) http://www.blitzbasic.com/Community/posts.php?topic=51647&hl=single%20surface

However, without batching geometry you cannot possibly achieve high end results like other games do. I think this is what buffered mode is trying to acomplish, but either way we need custom ways to handle this for optimal results. DrawVertexArray() function, if properly implemented, would solve all this


tonyg(Posted 2005) [#7]
Hi HrdNutz, that's the code I was comparing.
Something has definately changed somewhere.
I checked again and it doesn't seem to be single-surface although (at one point) there is a staticpixmap xcreated for a cell. This is then copied into the image and split into seperate frames to display.
It's possible the recent changed to the DX and GL drivers have closed the gap a bit by performance improvements.
There also seems to be some memory changes as Indie's code in DX now takes more memory than before and needs a gccollect.
My results..
DX GL
MEM TIME MEM TIME
Loadanimimage -200 500 1000 1665
TAnimImage 30000 471 1000 1659
+GCCollect -200 460 No change.
using...
For Local a = 1 To 100
	Cls
	For Local b = 1 To 1000
    SetRotation Rand(360)
		blob.Draw(Rand(0,640),Rand(0,480),32,32,Rand(0,4))
'        DrawImage blob,Rand(0,640),Rand(0,480),Rand(0,4)
	Next
	Flip
Next
End Rem