Profiled the terrain demo, including rendering lots of cubes

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Crivens

Profiled the terrain demo, including rendering lots of cubes

Post by Crivens »

I just profiled the terrain demo, plus rendering about 100 small cubes. The function that used the most time?

irr::video::SColor::toOpenGLColor() const

Odd!

This is just the first part of the results:

Code: Select all

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 14.26     15.73    15.73                             irr::video::SColor::toOpenGLColor() const
  7.60     24.12     8.39                             irr::core::matrix4::operator*(irr::core::matrix4 const&) const
  6.24     31.01     6.89                             irr::core::matrix4::operator*=(irr::core::matrix4 const&)
  5.67     37.27     6.26                             irr::core::matrix4::makeIdentity()
  4.12     41.81     4.55                             irr::scene::CTerrainSceneNode::getIndex(int const&, int const&, int const&, unsigned int, unsigned int)
  4.11     46.34     4.53 44648444     0.00     0.00  irr::core::vector3d<float>::operator=(irr::core::vector3d<float> const&)
  4.01     50.76     4.42                             irr::core::matrix4::operator=(irr::core::matrix4 const&)
  3.50     54.62     3.86                             irr::core::vector2d<float>::operator=(irr::core::vector2d<float> const&)
  3.20     58.16     3.54                             irr::video::COpenGLDriver::drawIndexedTriangleList(irr::video::S3DVertex2TCoords const*, int, unsigned short const*, int)
  2.61     61.03     2.88                             irr::scene::ISceneNode::OnPostRender(unsigned int)
  2.51     63.81     2.78                             irr::video::S3DVertex2TCoords::operator=(irr::video::S3DVertex2TCoords const&)
  2.15     66.18     2.37                             irr::video::COpenGLDriver::createGLMatrix(float*, irr::core::matrix4 const&)
  2.12     68.52     2.34                             irr::scene::CTerrainSceneNode::OnPreRender()
  1.85     70.56     2.04                             irr::core::matrix4::transformVect(irr::core::vector3d<float>&) const
  1.60     72.32     1.76                             irr::core::matrix4::setRotationRadians(irr::core::vector3d<float> const&)
  1.42     73.89     1.57                             irr::video::COpenGLDriver::drawIndexedTriangleList(irr::video::S3DVertex const*, int, unsigned short const*, int)
  1.33     75.36     1.47                             irr::core::array<irr::video::S3DVertex2TCoords>::operator[](unsigned int)
  1.23     76.72     1.36                             irr::video::CImage::getPixel(int, int)
  1.19     78.03     1.31                             irr::scene::CSceneManager::registerNodeForRendering(irr::scene::ISceneNode*, irr::scene::E_SCENE_NODE_RENDER_PASS)
  1.04     79.17     1.15                             irr::core::array<int>::operator[](unsigned int)
disanti
Posts: 367
Joined: Sat Jan 17, 2004 1:36 am
Location: California, US
Contact:

Post by disanti »

Funny, that function looks VERY optimized. I would assume that it takes that much time because it is called a LOT in COpenGLDriver.cpp.

In SColor.h:

Code: Select all

		//! Converts color to open gl color format.
		//! \return Returns the 32 bit openGL color value.
		inline s32 toOpenGLColor() const 
		{
			return (((color>>24) & 0xff)<<24) |
					(((color)& 0xff)<<16) |
					((color>>8 & 0xff)<<8) |
					((color>>16) & 0xff);
		};
________
Teen vids
Last edited by disanti on Thu Feb 24, 2011 10:40 am, edited 1 time in total.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

It's true, this function is called once for every vertex which is renderered in OpenGL mode. :) But I think I could optimize that away too :)
Post Reply