[bug?] drawing_alpha() takes more than 2 seconds

Started by EugeneP, November 12, 2010, 05:44:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

EugeneP

I suddenly found why my program freezes for second randomly.
First call of drawing_alpha() takes few seconds:
[code language="bennu"]import "mod_video"
import "mod_draw"
import "mod_say"
import "mod_time"

process main()
local
  int t1,t2;
end
begin
  set_mode( 320, 240, 16 );
  say("Start");
 
  t1 = get_timer();
  drawing_alpha( 127 );
  t2 = get_timer();
  say("dT = "+(t2-t1));
 
  t1 = get_timer();
  drawing_alpha( 255 );
  t2 = get_timer();
  say("dT = "+(t2-t1));
 
  say("End");
end;[/code]

Output ( OS Linux, r181 )
Start
dT = 2280
dT = 0
End


On Wiz, Bennu r165, results are similar.

Only the first call of drawing_alpha takes unreasonably much time. Next calls executed fast.

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

EugeneP

Is it unavoidable? May be it would be better to calculate these tables on set_mode or module import?

SplinterGU

#3
nop, because depend of the alpha value that you want...

yes, this can be calculate on set_mode.

and this need a better implement, because the tables are calculate once.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

handsource-dyko

Isn't it easier to use a lookup table loaded from a dat file?
Or to calculate this at the start of bgdi's execution?

This sort of methode was common practice in the dos days, according to
the maker of the dukenumen 3d's build engine this was the fastest way.

(Oke, computer back then sucked at floating point math).

SplinterGU

alpha tables consume lot of memory, and you not all games need it...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Drumpi

You also can do a "drawing_alpha" call at start of your program or in resources loading, so it takes 2 seconds more when loading FPGs, etc, and not when playing your game ;)
Hala, como con 1001 procesos sólo va a 9 FPS, vamos a meterle 32 veces más, a ver si revienta.
(Drumpi epic moment)

SplinterGU

yes, you can do un alpha_draw when you start the game...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2