Game Development Community

[1.1b2 bug] Large performance drop in shape editor - RESOLVED

by Manoel Neto · in Torque 3D Professional · 08/26/2010 (7:35 pm) · 8 replies

I'm seeing a quite large framerate drop while using the shape editor. In debug builds it can bring the machine to a crawl. Profiling shows a large amount of time being spent in GFXVertexFormat_updateDirty, and looking at this code it's obviously it should not be called so often. Tracing back the calls, seems the bug seems related to primBuild: for some reason the vertex buffer's is always making a copy of a vertex format that is always dirty, and requires the costly update (which involves string operations) when rendering the joint nodes.

#1
08/26/2010 (9:01 pm)
Bug Logged as: TQA-920
#2
08/27/2010 (8:26 pm)
I just fixed this the other day. In source/gfx/gfxVertexBuffer.h around line 55...

GFXVertexBuffer(  GFXDevice *device, 
                     U32 numVerts, 
                     const GFXVertexFormat *vertexFormat, 
                     U32 vertexSize, 
                     GFXBufferType bufferType )
      :  mDevice( device ),
         mVolatileStart( 0 ),         
         mNumVerts( numVerts ),
         mVertexSize( vertexSize ),
         mBufferType( bufferType )      
   {
      if ( vertexFormat )
      {
         vertexFormat->getDecl(); // ADDED!
         mVertexFormat.copy( *vertexFormat );
      }
   }
#3
08/27/2010 (9:17 pm)
Much appreciated =)
#4
08/27/2010 (9:51 pm)
Well that sure makes it easy to confirm the bug.

@Tom
Was there a pre-existing ticket for this?
#5
08/27/2010 (11:00 pm)
Just to point out I get a crash with that new line. Builds fine but Torque dies on startup.
#6
08/28/2010 (8:12 am)
@Scott - Not that i know of... i just saw the post and remebered i fixed it already.

@Steve - Don't forget the if statement... the line has to go inside of it.
#7
08/28/2010 (2:00 pm)
Ahem ... derp ... ya got me ... fix works fine!
#8
09/06/2010 (9:09 pm)
Fixed in 1.1 Beta 3.