Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // why so slow (especially with different meshes / LODs)?
- void SMesh::DrawPart( UINT32 lod, UINT32 part, UINT32 inst )
- {
- // cache line on "this"
- SMeshLod& ml = LOD[ lod ]; // new cache line
- SMeshLodPiece& mlpc = ml.Pieces[ part ]; // ...
- SMeshPart& mp = Parts[ mlpc.ID ]; // ...
- SMeshLodPart& mlp = mp.LODParts[ mlpc.LOD ]; // ...
- if( inst )
- glDrawIndexedPrimitivesInst( PT_Triangles, mlp.TriangleCount * 3, MESH_INDEXTYPE, mlp.IBOffset, inst ); // ...
- else
- glDrawIndexedPrimitives( PT_Triangles, mlp.VertexCount, mlp.TriangleCount * 3, MESH_INDEXTYPE, mlp.IBOffset ); // ...
- }
- // while it might not be so bad in practice
- // (most arrays are allocated at +/- the same time
- // and thus probably at the same place,
- // the unexpectedly slow performance shows it is a problem
- // and that there's probably enough of this design
- // to make my old Athlon64 CPU beg for mercy.
- // P.S. Yes, this is my code.
- // P.P.S. I'm fixing it now.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement