Increase max count of material texture

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
EViruS
Posts: 19
Joined: Sat Jul 07, 2007 8:32 pm

Increase max count of material texture

Post by EViruS »

How to increase max count of material texture? I tried to change:
//! Maximum number of texture an SMaterial can have.
const u32 MATERIAL_MAX_TEXTURES = 4;
When I had changed value and recompiled engine, engine crashed. When I call any function from recompiled engine, I have random probability to catch unhandled exception.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Works for me. Which driver do you use? You should also get the latest revisions because I fixed some stuff (which might be in 1.3.1, though, I'm not sure).
EViruS
Posts: 19
Joined: Sat Jul 07, 2007 8:32 pm

Post by EViruS »

hybrid wrote:Works for me. Which driver do you use? You should also get the latest revisions because I fixed some stuff (which might be in 1.3.1, though, I'm not sure).
Engine version is 1.3.1 My videocard supports 8 textures. Video card driver info: 8.342.0.0, 02.02.2007, Ati Radeon 9800
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I meant the Irrlicht driver: OpenGL or DirectX?
EViruS
Posts: 19
Joined: Sat Jul 07, 2007 8:32 pm

Post by EViruS »

hybrid wrote:I meant the Irrlicht driver: OpenGL or DirectX?
Sorry, DirectX 9.0 only
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, you're right. The Windows dll memory allocator problem does not exist under Linux, so I did not encounter the buffer overflow. The problem is that the current texture matrices are stored in the drivers. But these matrices are fixed to 4 textures so you get a buffer overflow when using more.
I'll have to check to to overcome this limit (probably at first by limiting the texture matrices to the first 4 textures. I move this post to the bug forum.
EViruS
Posts: 19
Joined: Sat Jul 07, 2007 8:32 pm

Post by EViruS »

hybrid wrote: I'll have to check to to overcome this limit (probably at first by limiting the texture matrices to the first 4 textures. I move this post to the bug forum.
Ok, thanks. How I can fix this bug?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

A first quick hack would avoid to set the transform for textures larger than 4. The pretty solution is more involved because we have to get the correct size for the matrix array and several other things together with the necessary symbols inside an enum. I guess we have to add a large number of symbols and just not create all those matrices inside the driver. But I'm not sure about this.
Post Reply