Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » The true reason allegro is so damned slow in windows.

This thread is locked; no one can reply to it. rss feed Print
 1   2 
The true reason allegro is so damned slow in windows.
Burnt One
Member #3,014
December 2002

Umm Intel an AMD are working on there own version,read the directx 9 documantation more carefully... New processors/boards are going to support it. Its becomign a standard and allegro has no easy to access it... and pixel shaders would help alot...

Korval
Member #1,538
September 2001
avatar

Quote:

Umm Intel an AMD are working on there own version,read the directx 9 documantation more carefully... New processors/boards are going to support it. Its becomign a standard and allegro has no easy to access it... and pixel shaders would help alot...

First of all, do you even know what pixel shaders are? It seems that you do not, since you seem to ascribe some performance benifit to using them when, in fact, writing any significant pixel shader incurs a performance penalty

Secondly, AMD and Intel are not working on CPU pixel shaders; that doesn't even make since (which furthers the notion that you don't understand them). If they are working on anything in terms of shader programs, they are working on some kind of shader-capable embedded GPU for some of their motherboards. Where in the DX9 docs (specific page title or search string) does it say that Intel and AMD are adding pixel shader functionality to their CPU's?

Thirdly, how would pixel shaders "help alot" in terms of a primarily 2D graphics API? The primary use of pixel shaders is to perform per-pixel blending/arbiturary computation on incoming texels. That requires incoming texels; plurality is important. The usefulness of pixel shaders on a primarily 2D graphics API is pretty low.

Now there are ways to use shaders for 2D graphics. However, these do not mesh well at all with any normal 2D API. These concepts tend to involve taking multiple textures and applying a shader program to them; effectively, blitting them all at once to a destination. This is certainly possible, given an underlying 3D API, but specifying it in a traditional 2D API is just not possible.

Bob
Free Market Evangelist
September 2000
avatar

Quote:

Intel an AMD are working on there own version,read the directx 9 documantation more carefully...

Why would the vendor-neutral DirectX documentation mention specific boards by specific manufacturers, which aren't even anounced yet?

Quote:

New processors/boards are going to support it.

New General Purpose Processors? Supporting pixel shareds?? Please, point me to any one.

Quote:

Its becomign a standard

No, it's not.

Quote:

and allegro has no easy to access it... and pixel shaders would help alot...

Use AllegroGL if you really need fragment programs (which you mostly likely don't, as you don't seem to know what they are).

Korval said:

If they are working on anything in terms of shader programs, they are working on some kind of shader-capable embedded GPU for some of their motherboards.

If they are, it would be highly unlikely that these would be DX9 parts, as it would just require a far heavier transistor budget than what is usually embedded on motherboards. Ie: there'd be very little cost savings on the consummer part, highly expensive motherboards (in the short term), and no real reason for consummers to go this way, yet.

--
- Bob
[ -- All my signature links are 404 -- ]

Michael Jensen
Member #2,870
October 2002
avatar

Maybe I just don't optimize my code very well, but I started learning direct-x 7 from an "Andre' LaMothe" book and I tried to write a game than ran under direct-x and not only did it run slow compared to anything I wrote in allegro, but allegro also just seems to be easier to use, and more portable than direct-x too... it also has all the primitives and everything built in -- compared to direct-x which lets you basically plot pixels, and blit (as far as I could tell in 2D anyways...)

Maybe somebody should write a DOC about how to add new video drivers to allegro?

Vincent Deany
Member #3,188
February 2003

Though it seems like this thread is dead I felt like I should post about my experience with D3D8. This is only the impressions of about one week with the API. I have to say I rather like it. I've been working on a 2d tile based rpg with allegro and decided to port it over. The access to all the hardware accelaration is wonderful. I found that using transformed, textured vertices (basically a flat polygon) for the individual tiles was not only fast but allowed me to add lighting using D3DLIGHT, which may be overkill for a 2d game, but I'm a graphics whore. Alpha blending is very smooth with D3D as well, and water can really be done beautifully if you render it as a multi-textured emissive material. I also found that D3D is blazing with the particle effects, easily pushing 10000 particles of say, snow every frame without slow down, though I did find that a 400 mhz computer with a tnt2 was maxed out at that level, one can assume that the performance varies with the card technology. I like allegro for ease of use and the quick dev time. Though D3D is a headache at first, the benefits seem at this point to be well worth it.

JaTeR
Member #2,088
March 2002
avatar

Vincent Deany said:

... with D3D8. This ... using D3DLIGHT, which ... with D3D as well, ... that D3D is ... Though D3D is a ...

isn't allegro 2D?

i can't think of another way to prove my point.

JaTeR

--
Still spreading that sunshine!
for those that like informative profiles...

Bob
Free Market Evangelist
September 2000
avatar

Allegro can sit on top of a 3D API, although it's not very comfortable there (see AllegroGL).

--
- Bob
[ -- All my signature links are 404 -- ]

23yrold3yrold
Member #1,134
March 2001
avatar

Here's a question; if Allegro starts using OpenGL for stuff like drawing sprites, I assume they'll be textured quads, right? Does that mean all sprites will have to use dimensions that are a power of two?

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Bob
Free Market Evangelist
September 2000
avatar

AllegroGL currently compensates for that, so assuming that AllegroGL is used as a basis for OpenGL in Allegro, then you shouldn't have to. Of course, powers-of-2 sprites would have the nice property of wasting less memory and possibly being slightly faster than non-powers of 2 sprites. This is without considering extensions like NV_texture_rectangle which makes this issue irrelevent.

--
- Bob
[ -- All my signature links are 404 -- ]

Thomas Harte
Member #33
April 2000
avatar

Quote:

AllegroGL currently compensates for that, so assuming that AllegroGL is used as a basis for OpenGL in Allegro, then you shouldn't have to. Of course, powers-of-2 sprites would have the nice property of wasting less memory and possibly being slightly faster than non-powers of 2 sprites

Bearing in mind that Allegro does not allow for the sort of sprite co-ordinate wrapping that is used quite frequently with textures, surely AllegroGL dealing with this is a trivial matter of allocating textures at the board's maximum size until they stop being resident and then fitting sprites onto the textures (obviously more than one sprite per texture...) where possible using whatever algorithm? How does NV_texture_rectangle help?

Bob
Free Market Evangelist
September 2000
avatar

Quote:

Bearing in mind that Allegro does not allow for the sort of sprite co-ordinate wrapping that is used quite frequently with textures, surely AllegroGL dealing with this is a trivial matter of allocating textures at the board's maximum size until they stop being resident and then fitting sprites onto the textures (obviously more than one sprite per texture...) where possible using whatever algorithm

This would prevent users from using OpenGL at the same time as Allegro, which defeats the purpose of AllegroGL. However, this may be an idea for Allegro.

Quote:

How does NV_texture_rectangle help?

It would allow us to allocate non-power-of-2 textures (like 17 by 13 pixels).

--
- Bob
[ -- All my signature links are 404 -- ]

23yrold3yrold
Member #1,134
March 2001
avatar

But it would probably be slower? Plus I guess it might be a while before it becomes a standard thing ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Michael Jensen
Member #2,870
October 2002
avatar

Quote:

Of course, powers-of-2 sprites would have the nice property of wasting less memory and possibly being slightly faster than non-powers of 2 sprites. This is without considering extensions like NV_texture_rectangle which makes this issue irrelevent.

it seems like he's saying that with NV_texture_rectangle it would go just as fast and not waste as much memory unless I'm reading what he said wrong, considering that I know nothing about open-gl, i have no clue why I'm answering for Bob...

Bob
Free Market Evangelist
September 2000
avatar

Quote:

But it would probably be slower?

I never actually benchmarked it, so I can't tell you. I'm assuming that the speed should be the same.

--
- Bob
[ -- All my signature links are 404 -- ]

Korval
Member #1,538
September 2001
avatar

Quote:

I'm assuming that the speed should be the same.

It depends on how texture_rectangle is implemented by the driver.

Now, stretching a BITMAP to be power-of-two and then re-shrinking it every blit has some overhead attached to it.

But, a non-power-of-2 texture can be slower than power-of-two textures. One primary reason for this is that some drivers like to "twiddle" a texture. That is, they rearrange the bytes in the texture (into 4x4 or 8x8 contiguous tiles plus additional movement) to give them better caching and spatial coherance. However, they can't guarenteeably do this with a texture rectangle, for various reasons (not necessarily divisible by 2, 4, or 8).

What is the performance difference between texture rectangle and stretch/shrink? I don't know; it depends. It all depends on how the hardware internally handles it.

I would like to point out, however, that leveraging 3D hardware at all is very fast; it's not likely that many 2D games are going to be pushing it very far, unless you're rendering at high resolutions (1024x768+).

23yrold3yrold
Member #1,134
March 2001
avatar

As long as I'm being an inquisitive noob :P ...

I assume a 2D game could be made drawing textured quads with the Painter's Algorithm and the depth buffer turned off, or just keeping track of each image's "depth" (I do that anyway; sorting before drawing). Would a game using OpenGL (or AllegGL) run much faster than Allegro, even with no hardware acceleration? Since I assume Allegro gets a boost in hardware via DirectX, if nothing else ... just wondering. I'd try it, but it would take me a month :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Marcello
Member #1,860
January 2002
avatar

Couldn't you put several sprites on a single larger texture, and just use UV's to get the specific sprite you want? You might have a precision problem though, since uv's are floats...but padding should solve that.

Marcello

Korval
Member #1,538
September 2001
avatar

Quote:

I assume a 2D game could be made drawing textured quads with the Painter's Algorithm and the depth buffer turned off, or just keeping track of each image's "depth" (I do that anyway; sorting before drawing). Would a game using OpenGL (or AllegGL) run much faster than Allegro, even with no hardware acceleration? Since I assume Allegro gets a boost in hardware via DirectX, if nothing else ... just wondering. I'd try it, but it would take me a month

Remember that the 3D pipeline is the pipeline that driver writers spend their time augmenting more than anything. Certainly more than the 2D API.

Also, it is important to note that even a TNT2 has a 3D fillrate of something like 500 MegaPixels or so. Even at 75frames per second, a TNT2's 3D path can draw to the entire screen 22 times per frame. True, it never gets this in practice with actual textured polys, since it is bandwidth limitted. However, even within bandwidth limits, I imagine a TNT2's 3D path could get around 10 full screen draws per frame.

The key, especially on older hardware, to getting good 3D performance is sub-bitmaps. That is, for each layer, you have one gigantic texture that you render from. You want to minimize texture swapping as much as possible. You can't do much about sprites, but your tilemap should be easy enough to make efficient.

So yeah. I think a 3D pipeline would probably be faster than even an accelerated 2D pipe. When I finish my uber-tilemap library, I can do some performance analysis to find out for sure (though I run a Ti4200, not a TNT2).

Quote:

Couldn't you put several sprites on a single larger texture, and just use UV's to get the specific sprite you want? You might have a precision problem though, since uv's are floats...but padding should solve that.

To get precision problems, you'd have to have a texture with a 7-digit width. And, even then, you could get some of that back with denormalized floats (assuming the hardware supports them).

Thomas Harte
Member #33
April 2000
avatar

Quote:

This would prevent users from using OpenGL at the same time as Allegro, which defeats the purpose of AllegroGL. However, this may be an idea for Allegro.

Okay, so only allocate new textures when they are actually required... in any case it wouldn't prevent OpenGL from being used at the same time, because it manages texture memory for you, right? Just make sure everything is prioritised sensibly.

Dan MacDonald
Member #2,801
October 2002
avatar

I switched my project from DX8.1 (2D in 3D) to allegro because I wanted to support the older systems. I moved to allegro because it was a 2D graphics platform that would run on old win95 machines. I didn't want to cut my market in half by enforcing people who download my game demo to install a 20mb DX driver.

 1   2 


Go to: