Game Development Community

AtlasClipMapBatcher stack overflow

by David \"lp\" Rosen · in Torque Game Engine Advanced · 03/09/2007 (6:49 am) · 0 replies

The class AtlasClipMapBatcher gave me a stack overflow in debug mode, but not release. I found out that it was the profiler's stack that got to big. I saw that the stack was not poped in the renderLight() function. Addng PROFILE_END() before the two returns fixed it.

if(!Sim::findObject("AtlasDynamicLightingMaterial", lightMat))
   {
      Con::errorf("AtlasClipMapBatcher::renderLight - no material 'AtlasDynamicLightingMaterial' found, skipping light rendering and spamming the console.");
	  PROFILE_END(); // <- Fixed stack overflow
      return;
   }

   // Get the lighting mask material.
   Material *lightMaskMat;
   if(!Sim::findObject("AtlasDynamicLightingMaskMaterial", lightMaskMat))
   {
      Con::errorf("AtlasClipMapBatcher::renderLight - no material 'AtlasDynamicLightingMaskMaterial' found, skipping light rendering and spamming the console.");
	  PROFILE_END(); // <- Fixed stack overflow
      return;
   }