Ok, started doing tests to see if you guys can help me out.

firstly... I will detail the method I am using to get the times (just in case this is not a good option and it screws up all my timings).

I declare this globar variable:
Code:
double STOPWATCH;


And then I do this before and after my paint function calls:
Quote:
beep();
dtimer();


t_format2=bmap_lock(Sand_BM,0);
t_format2=bmap_lock(Grass_BM,0);
t_format2=bmap_lock(Rock_BM,0);
t_format2=bmap_lock(Snow_BM,0);

for(x=0;x<TERRAIN_COUNT;x++)
{
for(y=0;y<TERRAIN_COUNT;y++)
{
Terrain_Paint(x,y);
wait(1);
}
}

wait_for(Terrain_Paint);
bmap_unlock(Sand_BM);
bmap_unlock(Grass_BM);
bmap_unlock(Rock_BM);
bmap_unlock(Snow_BM);

STOPWATCH=dtimer();
STOPWATCH/=1000000;
beep();

NOTE: I am now using 9x9 (81) Terrains, because I want an odd number for the future when I want everything centerd around a central terrain the player is on, but that will come later...


-Times with my current code: all around 25.5 secs

0> No wait calls during my my single paint functions or height calculation function, only between terrains.

1>Only have one pixel_for_bmap and one pixel_to_bmap instructions, disabled both of them:
around 25.1 secs
Code:
//pixel_source = pixel_for_bmap(Source_BM,Pixel_pos.x,Pixel_pos.y);
//pixel_to_bmap(NewSkin,Pixel_pos.x,Pixel_pos.y,pixel_dest);



2>I think I only have two pixel colour calculation instructions, disabled both of them:
around 24.7 secs
Code:
//t_color = pixel_to_vec(NULL, t_alpha ,t_format2,pixel_source);
//pixel_dest=pixel_for_vec(t_color,t_alpha,t_format1);



3>enabled all my previously disabled pixel & colour instructions. Disabled my height funcion call and substituted it with a random number:
around 5 secs
Code:
//height = get_height(Pixel_pos.x,Pixel_pos.y,i,Terr);
height=random(200);



4>pulled bmap_create out of the function to set it as a global and only create it once on startup after level_load. I also disabled "if(height>16)", since the bmap will be fully substituted each time because we don't start off from sand texture for consecutive paint calls. Enabled height calculations again:
around 26 secs
NOTE: does not work correctly, all skins are modified since the same bmap is reused for all terrains, they all end up having the same texture as the last terrain created.

5> Cannot disable bmap_lock, they have to be locked to read from (or write to), causes an E1513. No viable way to solve this unless I disable absolutely everything else.



The culprit seems to be the height calculations... only 5 secs withought that... 5 secs for painting 100 512x512 textures?!?!? That is awesome!!!! (but sadly this paint speed is only with random heights instead of my height calculations), but still the paint speed is pretty impressive for retrieving 100 textures, creating 100 textures, reading 26214400 pixels, calculating their respective 78643200 colour vector values, setting those 26214400pixels again, removing 100 ent skins, and setting 100 skins! all in 5 secs!
http://www.youtube.com/watch?v=CbNp-rD4Jog

EDIT: my get_height() function mostly does simple add, subtract, multiply and divide operations. Besides that it uses some vector operations that also are fairly simple vec_set and vec_sub. besides that I only have one vec_cross and one vec_to_angle instruction (that also do nothing extraordinary besides a few basic multiplications and additions). So I think the only instructions left in that function that could be causing the problem are the ent_getvertex calls?

I havn't used shaders yet, so I am not sure if I can. But I own A8 Commercial.

Last edited by Carlos3DGS; 11/04/11 16:30.

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1