[no bug] Additional Textures cause problems in shaders

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Beroc
Posts: 18
Joined: Fri Sep 28, 2007 3:25 pm

[no bug] Additional Textures cause problems in shaders

Post by Beroc »

I got to testing this in 1.6 as I needed 6 textures in my Splat shader.

I changed IrrCompileConfig.h line 102 from this:

#define _IRR_MATERIAL_MAX_TEXTURES_ 4

to this:

#define _IRR_MATERIAL_MAX_TEXTURES_ 6

Here are my findings:

4: shaders appear normal
5: shaders did not appear
6: shaders did not appear
7: shaders did not appear
8: The engine crashes

I tested this on d3d9 and opengl.

Though the engine starts running, I believe that there are still things that need "fixing" in the area of more material textures
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Did you rebuild the Irrlicht library after changing IrrCompileConfig.h?

Travis
Beroc
Posts: 18
Joined: Fri Sep 28, 2007 3:25 pm

Post by Beroc »

This is in the includes folder, I checked the Irrlicht.dll in the source, and apart from errors when I try to build it, it never goes into the include folder to get anything. Unless... I am just missing what you are saying.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Vitek means that always, after add some important changes in Irrlicht headers (include), You have to rebuild engine from sources.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Exactly. If you change the value of _IRR_MATERIAL_MAX_TEXTURES_, you must rebuild the Irrlicht library for the changes to take effect.

The reason is that there is code inside the Irrlicht library that makes use of _IRR_MATERIAL_MAX_TEXTURES_. If the library was compiled with _IRR_MATERIAL_MAX_TEXTURES_ = 4, but your executable is compiled with _IRR_MATERIAL_MAX_TEXTURES_ = 8, your application will think that there are 8 textures, but the Irrlicht library only reserves space for and uses the 4 textures. When you access any texture past 4, you're actually asking the Irrlicht library to access one or more of its internal arrays past the end, which will cause crashes.

Of course it is a bug if the library attempts to index any of its internal arrays out of bounds. A bug report should be filed, and the issue should be fixed, but that won't actually resolve the problem that you will continue to see. Without rebuilding the library, you won't be able to access texture stages beyond 4.

Travis
Post Reply