I will!

New test scenario, _bmap vs manual setTexture: http://superku.de/materialTest2.zip

Click to reveal..
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <d3d9.h>
///////////////////////////////

BMAP* bmpTest = "tex1024x1024.tga";
BMAP* bmpTestb = "tex1024x1024b.tga";

void levelNull()
{
	level_load(NULL);
}

void material_set_texture(MATERIAL * mat, BMAP * bmap, char * name)
{
	LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)bmap->d3dtex;
	
	if(tex == NULL)
	{
		printf("error in 'material_set_texture()': empty d3dtex pointer");
		return;
	}
	
	if(mat == NULL)
	{
		printf("error in 'material_set_texture()': empty material pointer");
		return;
	}
	
	if(name == NULL)
	{
		printf("error in 'material_set_texture()': empty name pointer");
		return;
	}
	
	LPD3DXEFFECT eff = (LPD3DXEFFECT)mat->d3deffect;
	
	if(eff != NULL)
	{
		eff->SetTexture(name, tex);
	}
	else
	{
		printf("error in 'material_set_texture()': empty effect");
		return;
	}
}

MATERIAL* mats[500];

void main()
{
	fps_max = 9999;
	video_mode = 10;
	level_load(NULL);
	
	int testMode = 0; // (0 == manual), (1 == _bmap)
	int i;
	for(i = 0; i < 500; i++)
	{
		MATERIAL* matNew = mtl_create();
		if(testMode)
		{
			you = ent_create(CUBE_MDL,vector(100+random(100),random(100)-50,random(100)-50),NULL); // 
			effect_load(matNew,"testBmap.fx");
		}
		else
		{
			you = ent_create(CUBE_MDL,vector(100+random(100),random(100)-50,random(100)-50),NULL);
			effect_load(matNew,"test.fx");
		}
		your.material = matNew;
		mats[i] = matNew;
	}
	on_space = levelNull;
	while(1)
	{
		DEBUG_VAR(time_frame*1000.0/16.0,200);
		if(key_e)
		{
			for(i = 0; i < 500; i++)
			{
				material_set_texture(mats[i],bmpTest,"bmpTest_bma");
				material_set_texture(mats[i],bmpTestb,"bmpTestb_bma");
			}
		}
		if(total_frames < 3)
		{
			draw_quad(bmpTest,vector(0,0,0),NULL,NULL,NULL,NULL,100,0);
			draw_quad(bmpTestb,vector(0,0,0),NULL,NULL,NULL,NULL,100,0);
		}
		wait(1);
	}
}


Results:

- testMode = _bmap: 2.9-3ms per frame, over 1.5ms after level_load(NULL) (or no entities on screen)

- testMode = manual: 1.45ms per frame, 0.18ms after level_load(NULL) (or no entities on screen)

Holding down the [e] key to call setTexture() for 2 textures for 500 materials makes a difference of ~0.04-0.06ms.


Obversation: 1.5ms additional computation time for the _bmap approach. If it was the fault of setTexture() calls, why is it 1.5ms and not < 0.06ms?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends