Switch Irrlicht to 8 textures per Material as default by increasing value of _IRR_MATERIAL_MAX_TEXTURES_.

Reason is that 4 haven't been enough anymore for even pretty common graphic pipelines for a while now. 
8 might still not be enough, but let's see first if people are happy with it.

This has some costs for people not needing more textures, as we have fatter Materials now. 
- Memory usage increases by 64 bytes per SMaterial.
- Serialization files for the irr-format are now larger. 
- Slight speed cost, thought mainly in debug

For people who don't need this and want to avoid some of the costs there is a new variable irr::video::MATERIAL_MAX_TEXTURES_USED which can be set to the maximal number of textures a project will need
before creating any device. This avoids pretty much all speed-costs involved with this change.

Software drivers are not much affected as they use their own texture-limits (2).

I did a few speed-comparison with varying numbers of _IRR_MATERIAL_MAX_TEXTURES_. The numbers displayed are FPS, so higher is better. I had 2 tests - one which forced many material changes and the other used a single material for all nodes. When there are 2 numbers in a result then I got different (generally lower) FPS when forcing material changes. The test used a simple model with 500 polygons and rendered it 4500 times.
OLD means - before working on all changes related to increasing texture-numbers and without changing materials (found a bunch of places to decrease the impact of this change which also sometimes did speed up Irrlicht generally). 1.8 refers to Irrlicht 1.8 with same test. All tests done on Windows/VisualStudio.

Max.textures    4       8       16      64      64 MATERIAL_MAX_TEXTURES_USED=4
GL/debug        50/68   44/58   35/45
GL/release      117     117     117     80/100  117	
D3D9/debug	51/56	45/49	37/39				
D3D9/release    168     168     152/168 90/87   168
OLD GL/debug    63
OLD GL/release  117
OLD D3D9/debug  44
OLD D3D9/rel    168
1.8 GL/debug    23/29
1.8 GL/release  94/117
1.8 D3D9/debug  59/63
1.8 D3D9/rel    142/152

Take all results with a grain of salt, it probably often is limited by fill-rate and doesn't even notice the texture-number changes (especially in release). 

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5682 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-01-17 15:34:57 +00:00
parent 60b295bcdb
commit 957d34ff0e
5 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
--------------------------
Changes in 1.9 (not yet released)
- _IRR_MATERIAL_MAX_TEXTURES_ now set to 8 by default. So we can use now 8 textures per material without recompiling the engine.
Additionally there's a new global variable irr::video::MATERIAL_MAX_TEXTURES_USED which can be set to lower numbers to avoid most of the costs coming with this for people not needing more textures.
But using more textures via _IRR_MATERIAL_MAX_TEXTURES_ also has become less calculation intensive than it was in the past, so in release builds the difference is hardly noticeable.
- Serialization fixes for materials in irr format (in IVideoDriver::createAttributesFromMaterial/fillMaterialStructureFromAttributes).
- Add serialization for ToolTip to IGUIElement. Thanks @chronologicaldot for patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52374)
- Try recovering lost device in D3D9 for 3 seconds when device reset fails after resizing Window.
- Add typedefs like value_type and size_type to array, list and map like std containers have. Thanks @SLC for idea (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52363)

View File

@ -110,7 +110,7 @@
//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
#define _IRR_MATERIAL_MAX_TEXTURES_ 4
#define _IRR_MATERIAL_MAX_TEXTURES_ 8
//! Whether to support XML and XML-based formats (irrmesh, collada...)
#define _IRR_COMPILE_WITH_XML_

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
Tests finished. 1 test of 1 passed.
Compiled as DEBUG
Test suite pass at GMT Mon Nov 19 21:48:32 2018
Test suite pass at GMT Thu Jan 17 14:29:44 2019