[Bf-committers] SVN commit: /data/svn/bf-blender [20094] trunk/blender: BGE performance, 3rd round: culling and rasterizer.

blender at erwincoumans.com blender at erwincoumans.com
Thu May 7 14:29:33 CEST 2009


This is great news, thanks for the hard work on this! 

Campbell Barton writes: 

> This is incredible!
> YoFrankie's main level (level_1_home.blend) is now faster in my debug
> build (-O0 -fno-inline -g3) then 2.48, and thats while it  was still
> building the optimized blender! :) 
> 
> the optimized build is somewhere between 2x and 3x faster overall!
> <happy dance> 
> 
> On Thu, May 7, 2009 at 2:13 AM, Benoit Bolsee <benoit.bolsee at online.be> wrote:
>> Revision: 20094
>>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20094
>> Author:   ben2610
>> Date:     2009-05-07 11:13:01 +0200 (Thu, 07 May 2009) 
>>
>> Log Message:
>> -----------
>> 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... 
>>
>> Modified Paths:
>> --------------
>>    trunk/blender/projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj
>>    trunk/blender/projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj
>>    trunk/blender/source/gameengine/Ketsji/BL_BlenderShader.cpp
>>    trunk/blender/source/gameengine/Ketsji/BL_BlenderShader.h
>>    trunk/blender/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_BlenderMaterial.h
>>    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
>>    trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_Light.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
>>    trunk/blender/source/gameengine/Rasterizer/CMakeLists.txt
>>    trunk/blender/source/gameengine/Rasterizer/Makefile
>>    trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp
>>    trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.h
>>    trunk/blender/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
>>    trunk/blender/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
>>    trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
>>    trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.h
>>    trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.cpp
>>    trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.h
>>    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
>>    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
>>    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
>>    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
>>    trunk/blender/source/gameengine/Rasterizer/SConscript
>>    trunk/blender/source/gameengine/SceneGraph/SG_DList.h
>>    trunk/blender/source/gameengine/SceneGraph/SG_QList.h
>>    trunk/blender/source/gameengine/SceneGraph/SG_Spatial.cpp
>>    trunk/blender/source/gameengine/SceneGraph/SG_Spatial.h
>>    trunk/blender/source/gameengine/VideoTexture/ImageRender.cpp
>>    trunk/blender/source/kernel/gen_system/GEN_HashedPtr.cpp 
>>
>> Modified: trunk/blender/projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj
>> ===================================================================
>> --- trunk/blender/projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj  2009-05-07 05:23:15 UTC (rev 20093)
>> +++ trunk/blender/projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj  2009-05-07 09:13:01 UTC (rev 20094)
>> @@ -43,7 +43,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                Optimization="0"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
>>                                BasicRuntimeChecks="3"
>>                                RuntimeLibrary="1"
>> @@ -118,7 +118,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                InlineFunctionExpansion="1"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
>>                                StringPooling="true"
>>                                RuntimeLibrary="2"
>> @@ -193,7 +193,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                InlineFunctionExpansion="1"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
>>                                StringPooling="true"
>>                                RuntimeLibrary="0"
>> @@ -268,7 +268,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                Optimization="0"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
>>                                BasicRuntimeChecks="3"
>>                                RuntimeLibrary="3"
>> @@ -343,7 +343,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                Optimization="0"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
>>                                BasicRuntimeChecks="3"
>>                                RuntimeLibrary="1"
>> @@ -418,7 +418,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                InlineFunctionExpansion="1"
>> -                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>> +                               AdditionalIncludeDirectories="..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\Expressions;..\..\..\source\gameengine\SceneGraph;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\source\blender\makesdna"
>>                                PreprocessorDefinitions="NDEBUG;WIN32;_LIB;WITH_GLEXT"
>>                                StringPooling="true"
>>                                RuntimeLibrary="0" 
>>
>> Modified: trunk/blender/projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj
>> ===================================================================
>> --- trunk/blender/projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj   2009-05-07 05:23:15 UTC (rev 20093)
>> +++ trunk/blender/projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj   2009-05-07 09:13:01 UTC (rev 20094)
>> @@ -43,7 +43,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                Optimization="0"
>> -                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>> +                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>>                                PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
>>                                BasicRuntimeChecks="3"
>>                                RuntimeLibrary="3"
>> @@ -118,7 +118,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                Optimization="0"
>> -                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>> +                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>>                                PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_GLEXT"
>>                                BasicRuntimeChecks="3"
>>                                RuntimeLibrary="1"
>> @@ -193,7 +193,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                InlineFunctionExpansion="1"
>> -                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>> +                               AdditionalIncludeDirectories="..\..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\..\build\msvc_9\intern\moto\include;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\kernel\gen_system;..\..\..\..\source\gameengine\Rasterizer;..\..\..\..\source\gameengine\SceneGraph;..\..\..\..\source\blender\gpu;..\..\..\..\source\gameengine\Ketsji;..\..\..\..\source\blender\makesdna;..\..\..\..\source\blender\blenkernel;..\..\..\..\source\blender\blenlib"
>>                                PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
>>                                StringPooling="true"
>>                                RuntimeLibrary="2"
>> @@ -268,7 +268,7 @@
>>                        <Tool
>>                                Name="VCCLCompilerTool"
>>                                InlineFunctionExpansion="1" 
>>
>> @@ Diff output truncated at 10240 characters. @@ 
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs 
>>
>  
> 
> 
> -- 
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
 



More information about the Bf-committers mailing list