Jump to content

Material Crash


photo

Recommended Posts

hi: 

   We currently have a material crash. It's reproducible on 2.2 and 2.2.1.

Our artist need to add some controls over a base material, so later we found this crash happen every time. If we remove the last 2 parameter, everything went normal. As the beginning we thought might be the cbuffer limit on dx11. but seems a memory leak from the material system. so please help.

system:win10 64bit directx11, 980 ti graphics.

 

steps:

1:put the material file somewhere.

2:load any world and add that material to material editor.

3:crash.

4:remove last 2 parameters of the mat file and save.

5:do step 2 and works.

 

it might be cbuffer not aligned? 

thanks

mesh_crash.mat

Link to comment

Hi Cinetec,

 

Thank you for the detailed description. I've successfully reproduced this issue and added ticket to our internal bug tracker.

 

As soon as I get more information about this I will surely let you know.

 

Could you please also send us callstack from Visual Studio to make sure that we have identical crashes. Here is what I get:

>	Unigine_x64d.dll!String::destroy() Line 100	C++
 	Unigine_x64d.dll!String::~String() Line 26	C++
 	[External Code]	
 	Unigine_x64d.dll!StringPtr::clear() Line 206	C++
 	Unigine_x64d.dll!StringPtr::operator=(const StringPtr & s) Line 1441	C++
 	[External Code]	
 	Unigine_x64d.dll!Vector<Material::MaterialParameter,char>::append(const Material::MaterialParameter & t) Line 325	C++
 	Unigine_x64d.dll!Material::load(const Xml * xml) Line 743	C++
 	Unigine_x64d.dll!MaterialManager::load(const char * name, int is_world) Line 147	C++
 	Unigine_x64d.dll!MaterialManager::loadWorld(const Xml * xml) Line 1185	C++
 	Unigine_x64d.dll!World::loadWorld(const char * n, const char * cache) Line 2512	C++
 	Unigine_x64d.dll!World::world_load(int argc, char * * argv) Line 1266	C++
 	Unigine_x64d.dll!CallbackObject2<World,void (__cdecl World::*)(int,char * __ptr64 * __ptr64) __ptr64,int,char * __ptr64 * __ptr64>::run(int arg0, char * * arg1) Line 297	C++
 	Unigine_x64d.dll!CallbackBase::run<int,char * __ptr64 * __ptr64>(int a0, char * * a1) Line 75	C++
 	Unigine_x64d.dll!Console::flush() Line 1195	C++
 	Unigine_x64d.dll!Engine::do_update() Line 2322	C++
 	Unigine_x64d.dll!engine_update_func() Line 327	C++
 	Unigine_x64d.dll!App::update() Line 278	C++
 	Unigine_x64d.dll!AppWindow::doUpdate() Line 1215	C++
 	Unigine_x64d.dll!Engine::doUpdate() Line 2833	C++
 	Unigine_x64d.dll!Engine::main(Unigine::SystemLogic * system_logic, Unigine::WorldLogic * world_logic, Unigine::EditorLogic * editor_logic) Line 2851	C++
 	Unigine_x64d.dll!Unigine::EngineInterface::main(Unigine::SystemLogic * system_logic, Unigine::WorldLogic * world_logic, Unigine::EditorLogic * editor_logic) Line 189	C++

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi Cinetec,

 

Thank you for the detailed description. I've successfully reproduced this issue and added ticket to our internal bug tracker.

 

As soon as I get more information about this I will surely let you know.

 

Could you please also send us callstack from Visual Studio to make sure that we have identical crashes. Here is what I get:

>	Unigine_x64d.dll!String::destroy() Line 100	C++
 	Unigine_x64d.dll!String::~String() Line 26	C++
 	[External Code]	
 	Unigine_x64d.dll!StringPtr::clear() Line 206	C++
 	Unigine_x64d.dll!StringPtr::operator=(const StringPtr & s) Line 1441	C++
 	[External Code]	
 	Unigine_x64d.dll!Vector<Material::MaterialParameter,char>::append(const Material::MaterialParameter & t) Line 325	C++
 	Unigine_x64d.dll!Material::load(const Xml * xml) Line 743	C++
 	Unigine_x64d.dll!MaterialManager::load(const char * name, int is_world) Line 147	C++
 	Unigine_x64d.dll!MaterialManager::loadWorld(const Xml * xml) Line 1185	C++
 	Unigine_x64d.dll!World::loadWorld(const char * n, const char * cache) Line 2512	C++
 	Unigine_x64d.dll!World::world_load(int argc, char * * argv) Line 1266	C++
 	Unigine_x64d.dll!CallbackObject2<World,void (__cdecl World::*)(int,char * __ptr64 * __ptr64) __ptr64,int,char * __ptr64 * __ptr64>::run(int arg0, char * * arg1) Line 297	C++
 	Unigine_x64d.dll!CallbackBase::run<int,char * __ptr64 * __ptr64>(int a0, char * * a1) Line 75	C++
 	Unigine_x64d.dll!Console::flush() Line 1195	C++
 	Unigine_x64d.dll!Engine::do_update() Line 2322	C++
 	Unigine_x64d.dll!engine_update_func() Line 327	C++
 	Unigine_x64d.dll!App::update() Line 278	C++
 	Unigine_x64d.dll!AppWindow::doUpdate() Line 1215	C++
 	Unigine_x64d.dll!Engine::doUpdate() Line 2833	C++
 	Unigine_x64d.dll!Engine::main(Unigine::SystemLogic * system_logic, Unigine::WorldLogic * world_logic, Unigine::EditorLogic * editor_logic) Line 2851	C++
 	Unigine_x64d.dll!Unigine::EngineInterface::main(Unigine::SystemLogic * system_logic, Unigine::WorldLogic * world_logic, Unigine::EditorLogic * editor_logic) Line 189	C++

Thanks!

hi Silent:

   Yes, this is one of the crash points we have met. As different parameters config , we meet different crash points. So it looks like a memory corruption

Link to comment

Hello Cinetec,

 

for me it looks like you are hitting the "64 parameters" limitation with your material, since your material is inherited from mesh_base and mesh_base has already quite many parameters defined.

There is a  limitation for the number of parameters, I don't know if it is exactly 64, please read the posting from Necris in this thread:

 

https://developer.unigine.com/forum/topic/3748-problem-updating-custom-material-from-unigine-2-beta-2-unigine-22-beta/

 

There are two possibilities to work around that:

 

1) Copy the mesh_base material and remove those parameters from mesh_base which are never used.

2) Create a single array parameter and put all your parameters into that array.

 

I would recommend the first workaround, but the number of free parameter slots you get is quite limited.

The second one is very inconvenient to use, because you cannot use the material editor anymore, but you should be able to put up to 4096 vec4 s into a single array parameter.

 

Cheers

 Helmut

Link to comment

Hello Cinetec,

 

for me it looks like you are hitting the "64 parameters" limitation with your material, since your material is inherited from mesh_base and mesh_base has already quite many parameters defined.

There is a  limitation for the number of parameters, I don't know if it is exactly 64, please read the posting from Necris in this thread:

 

https://developer.unigine.com/forum/topic/3748-problem-updating-custom-material-from-unigine-2-beta-2-unigine-22-beta/

 

There are two possibilities to work around that:

 

1) Copy the mesh_base material and remove those parameters from mesh_base which are never used.

2) Create a single array parameter and put all your parameters into that array.

 

I would recommend the first workaround, but the number of free parameter slots you get is quite limited.

The second one is very inconvenient to use, because you cannot use the material editor anymore, but you should be able to put up to 4096 vec4 s into a single array parameter.

 

Cheers

 Helmut

thanks for your suggestion.

if 64 is the parameter limitation. that is not enough for us.

Is that possible to extend the limitation? how much dx11 could handle? 2048 bytes?

thanks

Link to comment

i tried modify SHADER_MATERIAL_PARAMETERS from 64 to 80. seems working now. just don't know if there is any side effects

Link to comment

It is indeed a good news, that this issue can be resolved simply by modifying a constant. I hope that this value will be increased in future sdk releases.

As far as I know d3d11 supports up to 14 constant buffers, with a maximum size of 64kb for each buffer.

 

Good luck with your project and cheers

 Helmut

Link to comment
  • 1 month later...
  • 3 months later...

Fixed. Fix will be available in 2.3 SDK update.

hi Silent:

    It seems the 2.3 sdk has some updates on the material parameters. Do you know the current limitation of parameters? previously in 2.2 it's 64 parameters. What's the 2.3 limit? also what's the limit of status

thanks

Link to comment

Hi Cinetec,

 

As far as I know there is no limit on material parameters. 64 materials have internal material_id for fast search. If you have more than 64 parameters starting from 65 they will not have "fast" material ID and will work a little bit slower (it's even will be very hard to notice).

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...