Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » No hardware scaling?

This thread is locked; no one can reply to it. rss feed Print
No hardware scaling?
Thomas Harte
Member #33
April 2000
avatar

gfx_capabilities seems not to have a flag for hardware sprite scaling, yet I am aware that it is supported almost across the board by libraries such as DirectDraw. Am I to understand that Allegro never uses the hardware for this purpose?

If not, then how can I determine whether Allegro will use acceleration at runtime?

Elias
Member #358
May 2000

There are no bits for it, and I think no driver so far accelerates anything but unscaled and unrotated blits. (Not completely sure, especially not about the OpenGL driver.)

There are however methods in the BITMAP vtable for all those operations, so it should be trivial to fill them in for someone with some basic DX knowledge. We could then add flags to gfx_capabilities.

Or maybe we should provide a way to query for every method if it is accelerated or not? Would require a flag for each one though..

--
"Either help out or stop whining" - Evert

Evert
Member #794
November 2000
avatar

Quote:

gfx_capabilities seems not to have a flag for hardware sprite scaling, yet I am aware that it is supported almost across the board by libraries such as DirectDraw. Am I to understand that Allegro never uses the hardware for this purpose?

Correct.
Not that it couldn't do it in principle, but as Elias said, no one has ever bothered to write the support for it as far as I know.

Richard Phipps
Member #1,632
November 2001
avatar

Want to give it a go Thomas? You certainly have the knowledge to fo it.. :)

Mika Halttunen
Member #760
November 2000
avatar

If I remember correctly, scaling in DirectX is just as simple as blitting. When you pass a destination rectangle of different dimensions, it rescales it automatically. Could be wrong, though.

---------------------------------------------
.:MHGames | @mhgames_ :.

Thomas Harte
Member #33
April 2000
avatar

Quote:

If I remember correctly, scaling in DirectX is just as simple as blitting. When you pass a destination rectangle of different dimensions, it rescales it automatically. Could be wrong, though.

No, you're pretty much right. The Blt member takes a source and target rectangle. There is also BltFast that doesn't scale and as a result goes around 10% faster for the same blit.

Quote:

Want to give it a go Thomas? You certainly have the knowledge to fo it..

But I no longer have the operating system! I don't believe Mac OS does anything much for 2d acceleration. Even the GUI is built on 3d hardware. It only turned up in 2001 though, so you can forgive that.

gillius
Member #119
April 2000

But you can always do 2D acceleration work on 3D APIs and graphics hardware without any problem. In the very worst case, you assume the 3rd axis to always be constant, but usually you can get away without having to make some arbitrary assumption for the value of the 3rd axis.

Gillius
Gillius's Programming -- https://gillius.org/

Richard Phipps
Member #1,632
November 2001
avatar

Oh sorry, I thought you had the old PC still.

Mika Halttunen
Member #760
November 2000
avatar

Quote:

No, you're pretty much right. The Blt member takes a source and target rectangle. There is also BltFast that doesn't scale and as a result goes around 10% faster for the same blit.

Yeah, that's what I thought. Been a few years.

---------------------------------------------
.:MHGames | @mhgames_ :.

Thomas Harte
Member #33
April 2000
avatar

Quote:

Oh sorry, I thought you had the old PC still.

Well, I do, but using it really annoys me. To be honest it always did - that fan noise is enough to drive anyone crazy! From now on I am definitely sticking with laptops.

I have a vague plan of installing a VNC server on it then packaging it off into a cupboard with its wifi thing and using it from my laptop as I sit in some much quieter area.

My main reason for not working on Allegro is the same as its always been - until someone documents the source I can't really be bothered to try and figure it out myself. Damn my laziness!

Quote:

But you can always do 2D acceleration work on 3D APIs and graphics hardware without any problem

You can, but you can't squeeze the Allegro API around such a thing without most things going very slowly.

Evert
Member #794
November 2000
avatar

Quote:

The Blt member takes a source and target rectangle. There is also BltFast that doesn't scale and as a result goes around 10% faster for the same blit.

I can have a look if I'm bored next time I accidentally find myself using Windows.

Quote:

My main reason for not working on Allegro is the same as its always been - until someone documents the source I can't really be bothered to try and figure it out myself.

It's not really that hard. There's a GFX_VTABLE that has a list of platform specific functions for doing certain tasks. The prototype is documented in comments in the declaration of any particular vtable. It's simply a matter of writing the function with the correct prototype and putting it in the vtable.
A bit more bothersome than it could be with documentation, I agree.
Note that the Windows port is rather a confused mess in my opinion. The MacOS X port, I hear, is much nicer and cleaner internally.

By the way, AllegroGL may already support some of these things. I don't know if it does, but it may be worth a check.

Mika Halttunen
Member #760
November 2000
avatar

Browsing through 4.2.0 code, in wddaccel.c I noticed that masked blitting uses Blt and normal blitting uses BltFast. Why is that?

Also, DDBLTFAST_NOCOLORKEY could be added to the non-masked BltFast call, though I'm not sure if it improves the performance. I remember reading somewhere that it might improve performance on some cards.

---------------------------------------------
.:MHGames | @mhgames_ :.

Evert
Member #794
November 2000
avatar

Quote:

Also, DDBLTFAST_NOCOLORKEY could be added to the non-masked BltFast call, though I'm not sure if it improves the performance.

I think not:

MSDN said:

The software implementation of DirectDrawSurface7.BltFast is 10 percent faster than the DirectDrawSurface7.Blt method. However, there is no speed difference between the two if display hardware is being used.

About the difference otherwise, I'm not sure.

Mika Halttunen
Member #760
November 2000
avatar

Ok, but why not to use BltFast on both masked and non-masked blits?

---------------------------------------------
.:MHGames | @mhgames_ :.

Go to: