swap pointer safety

The swap pointer should be NULLed after being fetched by another thread. The getter function should get a mutex that protects the pointer while being NULLed. After the swap has occurred in the fetcher-thread, the pointer can be written back to the item. This guarantees that no other thread accesses the current swap pointer while one of the cache threads writes new image data.

LightBox: Performance-Test

Using an OpenGL-Viewport, a curious behaviour takes place:

rendering ~1000 items (partially overlapping) is slow if they are painted directly onto the scene background.

If however an item covers the area they’re all in and lies in the background, rendering is a *lot* faster.

 

A performance test function should help determining bottlenecks in display performance:

 

void performanceTest(ETestMode mode)
{
  // disable loading & rendering of textures
  // create a grid of 200x200 items, non-overlapping 
  // or overlapping, depending on the mode
  switch (mode)
  {
    case eNonOverlapping:
      break;
    case eOverlapping:
      break;
    default:
      break;
  }
}