But now it seems that its memcpy hogging the cpu, and Im hardly getting a noticeable fps boost from this when the camera is static (which is when I use stored vertex arrays instead of making new ones)
memcpy of cvertexarrays in map rendering
Moderator: Moderators
memcpy of cvertexarrays in map rendering
Since my profiling is always showing dodrawgroundrow as a large hit, especially with high viewradii, I tried to optimize by storing the finished vertex array for each bigtex square by memcpy-ing the striparrays and drawarrays.
But now it seems that its memcpy hogging the cpu, and Im hardly getting a noticeable fps boost from this when the camera is static (which is when I use stored vertex arrays instead of making new ones)

But now it seems that its memcpy hogging the cpu, and Im hardly getting a noticeable fps boost from this when the camera is static (which is when I use stored vertex arrays instead of making new ones)
Re: memcpy of cvertexarrays in map rendering
That happens quite often and proves that profiling changes is very important. I dismissed many of those tweaking attempts myself 
PS: the only way to speedup the SMF renderer is to rewrite it.
PS: the only way to speedup the SMF renderer is to rewrite it.
Re: memcpy of cvertexarrays in map rendering
Related tangent, did that improved map lod get implemented?
Re: memcpy of cvertexarrays in map rendering
no, roam is on ice untill someone unfucks the shadows shader IIRC
Re: memcpy of cvertexarrays in map rendering
But its just so wierd, that it hardly gives any boost. I wish I could just pass the pointers to the stored vertexarrays to the Drawvertexarray function. But somewhere after draw, the array gets freed, and I havent been able to pinpoint it.
I find it so hard to believe that a straight copy is not faster than doing the lookup of each vertexes height from the heightmap in a near random fashion.
I find it so hard to believe that a straight copy is not faster than doing the lookup of each vertexes height from the heightmap in a near random fashion.
Code: Select all
inline void CVertexArray::clone(CVertexArray * from){
delete drawArray;
delete stripArray;
drawArray= new float[(from->drawArraySize - from->drawArray)];
memcpy( drawArray,from->drawArray,(from->drawArrayPos+1 - from->drawArray)*sizeof(float));
drawArraySize=drawArray +(from->drawArraySize - from->drawArray);
drawArrayPos=drawArray +(from->drawArrayPos - from->drawArray);
stripArray= new unsigned int[(from->stripArraySize - from->stripArray)];
memcpy(stripArray,from->stripArray,(from->stripArrayPos+1 - from->stripArray)*sizeof(unsigned int));
stripArraySize=stripArray +(from->stripArraySize - from->stripArray);
stripArrayPos=stripArray +(from->stripArrayPos - from->stripArray);
maxVertices=from->maxVertices;
}Re: memcpy of cvertexarrays in map rendering
Thanks for the inspiriation jK, I always value your input very highly.
Ah, It seems that I was gpu fill rate limited on the straight back-to-back tests with only map rendering.
With an additional 500 aks on screen, the (total) performance gain is about 6%. Which is not much, but doesnt look bad. Ill see if adding this for shadow vertex arrays as well helps ( since profiling shows that for some reason, dogroundshadowlod takes twice the cpu time of the normal dogroundrow)
No optimiziation: (row in question is highlighted)

With memcpy and reuse of existing vertex arrays:

So its 9% vs 3%. Me happy :D
Ah, It seems that I was gpu fill rate limited on the straight back-to-back tests with only map rendering.
With an additional 500 aks on screen, the (total) performance gain is about 6%. Which is not much, but doesnt look bad. Ill see if adding this for shadow vertex arrays as well helps ( since profiling shows that for some reason, dogroundshadowlod takes twice the cpu time of the normal dogroundrow)
No optimiziation: (row in question is highlighted)

With memcpy and reuse of existing vertex arrays:

So its 9% vs 3%. Me happy :D
Re: memcpy of cvertexarrays in map rendering
Nice. Any problems with terrain deformation + static camera?
Re: memcpy of cvertexarrays in map rendering
Havent put in hooks for that yet, because there is a wierd flickering issue I have to overcome first.
