blender/source/gameengine/VideoTexture
Benoit Bolsee 42557f90bd BGE performance, 3rd round: culling and rasterizer.
This commit extend the technique of dynamic linked list to the mesh
slots so as to eliminate dumb scan or map lookup. It provides massive 
performance improvement in the culling and in the rasterizer when 
the majority of objects are static.

Other improvements:
- Compute the opengl matrix only for objects that are visible.
- Simplify hash function for GEN_HasedPtr
- Scan light list instead of general object list to render shadows
- Remove redundant opengl calls to set specularity, shinyness and diffuse
  between each mesh slots.
- Cache GPU material to avoid frequent call to GPU_material_from_blender
- Only set once the fixed elements of mesh slot
- Use more inline function

The following table shows the performance increase between 2.48, 1st round
and this round of improvement. The test was done with a scene containing 
40000 objects, of which 1000 are in the view frustrum approximately. The
object are simple textured cube to make sure the GPU is not the bottleneck.
As some of the rasterizer processing time has moved under culling, I present
the sum of scenegraph(includes culling)+rasterizer time

Scenegraph+rasterizer(ms)       2.48      1st round       3rd round

All objects static,            323.0           86.0             7.2
all visible, 1000 in 
the view frustrum

All objects static,            219.0           49.7             N/A(*)
all invisible.

All objects moving,            323.0          105.6            34.7
all visible, 1000 in 
the view frustrum

Scene destruction              40min          40min              4s

(*) : this time is not representative because the frame rate was at 60fps.
      In that case, the GPU holds down the GE by frame sync. By design, the
      overhead of the rasterizer is 0 when the the objects are invisible. 

This table shows a global speed up between 9x and 45x compared to 2.48a
for scenegraph, culling and rasterizer overhead. The speed up goes much
higher when objects are invisible.

An additional 2-4x speed up is possible in the scenegraph by upgrading
the Moto library to use Eigen2 BLAS library instead of C++ classes but
the scenegraph is already so fast that it is not a priority right now.

Next speed up in logic: many things to do there...
2009-05-07 09:13:01 +00:00
..
BlendType.h BGE VideoTexture: fix bug with VideoTexture.materialID() since recent commit. 2009-04-20 21:20:33 +00:00
blendVideoTex.cpp python modules in the game engine could point to builtin modules like GameLogic that was cleared. 2009-04-29 23:39:27 +00:00
CMakeLists.txt VideoTexture: reactivate VideoTexture for scons/cmake/makefile compilation systems, fix video streaming, fix camera support in Linux, add multi-thread cache service, fix crash when a VideoFFmpeg object could not be created. 2009-03-05 15:16:43 +00:00
Common.h VideoTexture module. 2008-10-31 22:35:52 +00:00
Exception.cpp VideoTexture: new ImageMirror class for easy mirror (and portal) creation 2008-12-04 16:07:46 +00:00
Exception.h VideoTexture: new ImageMirror class for easy mirror (and portal) creation 2008-12-04 16:07:46 +00:00
FilterBase.cpp remove warnings for the BGE 2009-02-25 03:26:02 +00:00
FilterBase.h VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
FilterBlueScreen.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
FilterBlueScreen.h VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
FilterColor.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
FilterColor.h VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
FilterNormal.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
FilterNormal.h VideoTexture: fix RGB/BGR confusion, make code compatible with big endian CPU, add RGBA source filter. 2008-11-04 12:04:59 +00:00
FilterSource.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
FilterSource.h BGE Python API 2009-04-19 12:46:39 +00:00
ImageBase.cpp VideoTexture: use PyObjectPlus.h instead of Python.h for compatibility with Python2.3 2008-11-02 18:02:31 +00:00
ImageBase.h VideoTexture: use PyObjectPlus.h instead of Python.h for compatibility with Python2.3 2008-11-02 18:02:31 +00:00
ImageBuff.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
ImageBuff.h VideoTexture module. 2008-10-31 22:35:52 +00:00
ImageMix.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
ImageMix.h VideoTexture module. 2008-10-31 22:35:52 +00:00
ImageRender.cpp BGE performance, 3rd round: culling and rasterizer. 2009-05-07 09:13:01 +00:00
ImageRender.h ImageMirror: add clip attribute to limit clipping distance of mirror rendering 2008-12-09 14:16:10 +00:00
ImageViewport.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
ImageViewport.h VideoTexture: new ImageRender class for Render To Texture 2008-11-26 17:47:42 +00:00
Makefile VideoTexture: reactivate VideoTexture for scons/cmake/makefile compilation systems, fix video streaming, fix camera support in Linux, add multi-thread cache service, fix crash when a VideoFFmpeg object could not be created. 2009-03-05 15:16:43 +00:00
PyTypeList.cpp VideoTexture: Bug report #17946: add (char*) casting to fix compile error with Python get-set method and module object. 2008-11-04 09:21:27 +00:00
PyTypeList.h VideoTexture: use PyObjectPlus.h instead of Python.h for compatibility with Python2.3 2008-11-02 18:02:31 +00:00
SConscript VideoTexture: reactivate VideoTexture for scons/cmake/makefile compilation systems, fix video streaming, fix camera support in Linux, add multi-thread cache service, fix crash when a VideoFFmpeg object could not be created. 2009-03-05 15:16:43 +00:00
Texture.cpp python3 compatibility for the BGE api, this only works with scons when WITH_BF_NOBLENDER is enabled. 2009-05-07 05:23:15 +00:00
Texture.h VideoTexture: new ImageMirror class for easy mirror (and portal) creation 2008-12-04 16:07:46 +00:00
VideoBase.cpp Added m_zombie to the base python class (PyObjectPlus), when this is set all the subclasses will raise an error on access to their members. 2009-04-17 20:06:06 +00:00
VideoBase.h VideoTexture: Preserve alpha channel if present in video, images and sequences. Better detection of end of video. 2008-11-09 21:42:30 +00:00
VideoFFmpeg.cpp ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing) 2009-04-29 16:54:45 +00:00
VideoFFmpeg.h == FFMPEG == 2009-03-22 19:19:21 +00:00