texture packer, single surface speed test

BlitzMax Forums/BlitzMax Programming/texture packer, single surface speed test

dmaz(Posted 2007) [#1]
I know there are quite a few image packers and font packers out there but I could noy find one that did everything I needed, like alpha... some said they did, but I couldn't get it to work. So I wrote one. I also created an import module for BlitzMax using (a heavily adding to) indiepath's TAnimImage routine found elsewhere in this forum.

I plan on releasing it very soon but I was wondering as programmers if there are any features you would want to see in such an application? right now it supports alpha, packs fonts and allows you to setup animations. it comes with a BlitzMax module that (on my machine) has seen up to a 71% image drawing speed increase over Max's default commands. While with the font routines I got almost 200% increase. Now that is an extreme case with that font and my routine doesn't

Also, I was hoping some of you can test and post fps results from these 2 tests...


Press 'S' to switch between draw types
ssFont.exe
I get: 620 for blitz and 1812 for ss
ssImage2.exe
I get: 1562 for blitz and 2489 for ss

old one
ssImage.exe
I get: 1685 for blitz and 2463 for ss


altitudems(Posted 2007) [#2]
ssFont in Fullscreen
~290 for blitz and ~580 for ss
ssImage in Fullscreen
~218 for blitz and ~221 for ss

GFX5200 - 2.4Ghz Athlon


Dreamora(Posted 2007) [#3]
ssFont:

DualCore ThreadAffinity:
660 with blitz, 2050 with ss
SingleCore ThreadAffinity:
480 with blitz, 1100 with ss

ssImage:

DualCore ThreadAffinity:
2050 for blitz, 2900 with ss
SingleCore ThreadAffinity:
1350 for blitz, 2100 with ss

Everything in window mode. Fullscreen didn't change anything.

Don't ask me why the app is able to use up to 100% of the CPU ...


System: Core 2 Duo E6600 @ 2x 3Ghz, 8800 GTS EVGA Factory Overclocked to GTX clocking, 2GB RAM


dmaz(Posted 2007) [#4]
ssImage in Fullscreen
~218 for blitz and ~221 for ss

hmmm, I've had some examples that gave the same results.. the example only uses 4 of the same size images and that's probably why you didn't see an increase there. the more images and different size the better the gain. I (wrongly) assumed that since I used an off size image others would see the same type of gain as me. I'm going to modify that example to include more variation.

Don't ask me why the app is able to use up to 100% of the CPU ...

wow, mine too! I didn't notice that before, now I have to ask... :)

it only seems to do it for OpenGL... is that possibly why OpenGL has always had better performance over DX (in BlitzMax)for these last couple of years? is OpenGL batching better?

[edit]it seems when I run in dx, I get very little cpu?


tonyg(Posted 2007) [#5]
Windowed or Fullscreen
Blitz : 279 ssfont : 395
Blitz : 597 ssimage : 566


dmaz(Posted 2007) [#6]
alright.... I'm going to try this again. I was hoping for better performance on lower end machines.... be right back with a new demo.


Jake L.(Posted 2007) [#7]
Hehe, everyone's writing a texture packer ;)

My Packer let's the user create and edit sprites (defined by single images) and animations (any combination of a sprite images/frames). You assign sprites to a texture-definition. So when doing a huge project with a lot of sprites on different textures you open the app, hit "Generate & Pack everything" and all textures are assembled.

Only problem is that my drawing routines are build deep into my sprite-engine (I don't want to release that), so releasing the packer yet is useless without a drawing module.

It's nice that you plan to release yours to the community (I hope for free?), so maybe I can give you some sources to build into your module.
I can give you some code to load fonts from FontCandyStudio and FonText, also I can give you my port of this algorithm to produce highly packed textures. I don't know if you have that already or want it, but leave me a mail and I will send you the code.

In my opinion it's better to bundle our knowledge to build better (free!) modules for all instead of starting a TexturePacker-competition, isn't it?


dmaz(Posted 2007) [#8]
ok, lets try this one...
ssImage2.exe
I get: 1562 for blitz and 2489 for ss


dmaz(Posted 2007) [#9]
It's nice that you plan to release yours to the community (I hope for free?)
... man, you kill joy! ;) I was going to use it as my first commercial experience but I was only going to ask for a few bucks, that's why I made it all pretty!

yeah, I saw that algorithm but I'm using a different one although any would be pretty easy to add.


tonyg(Posted 2007) [#10]
I get: 530 for blitz and 520 for ss


Muttley(Posted 2007) [#11]
Interesting.

My results with a 2.6GHz Pentium 4, 4GB Ram and ATI Radeon X1950 Pro GFX card.

ssFont:
OpenGL - 307 blitz, 745 ss
DirectX - 173 blitz, 236 ss

ssImage:
OpenGL - 793 blitz, 1156 ss
DirectX - 450 blitz, 521 ss

ssImage2:
OpenGL - 741 blitz, 1192 ss
DirectX - 400 blitz, 483 ss


dmaz(Posted 2007) [#12]
tonyg... did you happen to try any of the indiepath TAnimImage examples on that 9800 of yours?


tonyg(Posted 2007) [#13]
Yep. They made a big difference up until about 1.12 then Bmax caught up (I think it was that way around). At the time I posted querying whether anything had changed


dmaz(Posted 2007) [#14]
ok so I was going to say maybe a ATI / Nvidia thing but Muttley saw a little improvment on his ATI 1950... while altitudems 5200 didn't see any (for ssImage).

Yeah tony, the same thing happened to me on my ATI 850, I forgot about that... It seems now only the fastest cards get the big boost which is not what I was looking for! well, at least everybody seems to see an improvement with ssFont so that's good.


altitudems(Posted 2007) [#15]
With the new ssImage I get:
Blitz: ~118 SS: ~115

Gofigure :)


Derron(Posted 2007) [#16]
With good old SIS 641 I see no real changes for changing between "Single Surface" and "Normal Mode"...

old example: windowed, both about 40fps
new example: about 45fps in both cases...

fullscreen increases font-example from 60 to 90fps in both cases.

Thats why I did mention this in a thread about the single surface function some weeks ago.

On other graphiccards (no onboard thingies) a small improvement was visible/readable). But for a 2D-Application the problem are old graphicchips.


bye
MB


Dreamora(Posted 2007) [#17]
ssImage2:

1950 for blitz, 2900 for ss


And I don't think the dual core usage is something "against DX". Its more of a fact of which DX Version you and Max2D use.
It does not support multi core optimations, which I actually have enabled in my graphic drivers. (DX9 has that for quite some time now, OpenGL got its multithreaded support a while ago)

The only reason OpenGL performs better in BM is because the used DX is that old that drivers never got optimized for it. Use the usermade DX9 driver and check again and you will see that OpenGL most likely will be slower :)


Dreamora(Posted 2007) [#18]
Will be waiting for this to be launched as it seems like a good addition to what I am creating right now which might need this kind of performance.

The only thing missing is benchmark on some really crappy system.
Lucky that I have a tablet for study ^^

1.6 Ghz ULV P-M Banias, GMA900, 1GB RAM, XP Tablet Edition 2005


ssFont, fullscreen:
Blitz:
OGL: 40
DX: 70

SS:
OGL: 195
DX: 90


ssImage1, fullscreen:
Blitz:
OGL: 105
DX: 85

SS:
OGL: 140
DX: 105


Image2, fullscreen
Blitz:
OGL: 100
DX: 95

SS:
OGL: 160
DX: 110



What I would be interested, is a test with the DX9 driver.
As the DX7 clearly shows the main problem with the lower end cards: their makers didn't have 3d hardware acceleration back in the days of DX7 and thats what the users will suffer of.
Due to the fact that OGL is faster, I'm quite sure that DX9 would be far higher than both ... due to the fact that OGL does a fallback on the Microsoft driver and with the ULV 1.6 P-M there isn't much power it can get from that end.

But great results non the less, especially image2 and font :)


TaskMaster(Posted 2007) [#19]
Yep, I have seen the same results on all of the tests I have done with this stuff as well.

Lower end machines do not see much, if any, improvement using a single texture. And, since everything I have written seems fine on the lower end machine, I can't see it mattering whether I make it faster on a faster machine or not. So, in the end, I stuck with the standard Blitzmax commands for ease of use.

I tried a bunch of tests with the standard BM font commands vs. the stuff people have released with textured fonts and I could see very little increase in performance and that was if I was filling the screen with crazy amounts of text.

So, I just decided it was not worth the effort. I will be surprised if you can do anything to improve performance on low end machines.

And by low end, I don't mean anything that bad. I have 3.2GHz P4 with a ATI 9600 Pro (crap card) and see little to no increase at work. At home I also have a p4 3.2GHz, but it is running a nVidia 7600GT, and I still see very little increase in performance. Basically I figure if anything I write looks good on my work machine, it will look OK on most PCs.


Dreamora(Posted 2007) [#20]
Any ATI or NVIDIA beside the NVidia 6100 or 6150 and the HD2000 or IGP isn't low end.
Low end normally are onboard with a few exceptions and are the major part of the userbase actually (intel on its own has more than 50% marketshare)

And just to mention that: Radeon 9600 Pro is a higher medium range card, far far off from low end.


dmaz(Posted 2007) [#21]
I have that dx9 piece now... I'll try it and report back. I added some to the basic text routine... actually made it slightly more efficient (no real fps change) but added paragraph sethandle so you can do this.
drawtext2.exe


MGE(Posted 2007) [#22]
AWESOME! I'd forget the DX9 stuff, concentrate on keeping this OpenGL/DX7 compatible. ;)


dmaz(Posted 2007) [#23]
I'd forget the DX9 stuff,

yeah but... too late
ssImage2DX9.exe

again, starts with opengl. then d selects dx7 and hitting it again selects dx9, remember to hit s for the single texture.

also, there must be a bug in Max's opengl setup cause I can't get rid of it waiting for the vblank when you reset back to opengl.

BTW: the dx9 test won't show anything on my crappy 6 year old laptop even though 9.2 is installed.


MGE(Posted 2007) [#24]
No DX9 rendering here either on my intel box. But no bombing either??? Other DX9 games run fine.


dmaz(Posted 2007) [#25]
hmmm, work great on my main machine... the dx9 falls just short of the opengl but is almost 2x faster than the 7. doesn't matter though if it doesn't work everywhere :)

yeah, well it tries to set the graphics but it won't draw anything if it didn't get the graphics. you just got a blank screen... or you saw what was under the window right?


Jake L.(Posted 2007) [#26]
@dmaz: Got my mail?


dmaz(Posted 2007) [#27]
just saw it.


MGE(Posted 2007) [#28]
Update. Did a reboot and it works! DX7 ran at 67 fps on my main box, DX9 ran at 79 so there is a very nice speed improvement using the DX9 driver. Sweet!


xlsior(Posted 2007) [#29]
ssFont.exe
I get: 659 for blitz and 1292 for ss

ssimage2.exe
~772 typical for blitz (occasional peak at 802)
~752 typical for ss (occasional peak at 778)


dmaz(Posted 2007) [#30]
This is ready to go at http://www.ooeyug.com/texpac

the module is precompiled with Doug Stastny's DX9 driver found elsewhere on these forums. so if you use that driver this will still work just fine but with an added speed bonus.

there is still some things to do.... like the full mac port. Another big one will be custom export file syntax. The syntax now is very easy and should be able to be used in any engine or sprite library (hint, hint ;)

I will probably make a more formal announcement in the coming days.


MGE(Posted 2007) [#31]
Nice!!!


dmaz(Posted 2007) [#32]
thanks very much!

found a big bug... dang it! it seem on XP I can't go to the windows\fonts directory and choose a font. it will allow you to choose a font that you might have someplace else. Vista doesn't seem to have this limitation.... looking into it.

[edit] it looks like I will have not use the system file requester. In the mean time choosing a font not in windows\fonts works just fine.


dmaz(Posted 2007) [#33]
I uploaded a new demo of the application with a custom font requester that I created using bah.fontconfig. that mod does seem to take a little while to read all the fonts... I might just do it raw? there is some more clean up with that requester so it's really just a stop gap for now... it looks real go though (IMO).