Re: [AD] SF.net SVN: alleg:[12124] allegro/branches/4.9 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
trentg@xxxxxxxxxx wrote:
Revision: 12124
http://alleg.svn.sourceforge.net/alleg/?rev=12124&view=rev
Author: trentg
Date: 2009-04-25 05:12:57 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
D3D is somewhat of an oddity in that the
d3d device can be lost at any time and
thus the contents of textures lost.
Presently there are display events that
are fired when a device is lost and again
when "found". This isn't good enough.
Reloading all your textures is a pain
and the common case is that you just want
them preserved, even if it's a slight
performance hit. To solve this the
driver in a5 "backs up" any modified
textures when the backbuffer is flipped.
In most cases this works fine because
drawing to textures isn't that common.
However, in some cases it would be nice
to tell the driver to skip backing up
certain textures (e.g. temporary
buffers). This revision allows that
by adding al_d3d_set_preserve_bitmap.
In extreme cases (like my game) it
can speed up al_flip_display by as
much as 30% if you're using a manual
double buffer.
I'm open to suggestions on how to
improve this functionality.
Change it to a bitmap flag, which other platforms can simply ignore (it should
be defined on all paltforms). Introducing a platform-dependent function always
should be the last resort, and in this case it's not needed.
It would work like this:
al_set_new_bitmap_flags(ALLEGRO_PRESERVE_TEXTURES)
Or if it has to work on created bitmap, could introduce a new function:
al_add_bitmap_flag(bmp, flag)
and then you could do:
al_add_bitmap_flag(bmp, ALLEGRO_PRESERVE_TEXTURES)