Jump to content

[SOLVED] Derived custom material sometimes crashes.


photo

Recommended Posts

Hello,

we have a custom Material with a custom Shader and a Unigine::ObjectDynamic with custom attributes.

Sometimes Engine::do_render() function will halt when call to RenderState::setMaterial(int pass, Material * mat) Line 216 happens with following Error code.

Unhandled exception thrown: read access violation.
texture-> was 0xFFFFFFFFFFFFFF3F.

We update the texture in this material frequently with a new image.

What can cause this crash?

If it helps I can provide a crash dump.

We are runnin 2.14.1

Thanks,

Sebastian

Link to comment

Hi Sebastian,

What really can help - a small reproduction test scene and your code that do the setMaterial(). In that case we would find the exact crash spot much faster.

Is that also happens only in virtualized environment (Dell VxRaill / vSphere ESXi from VMWare)?

Thanks!

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

Link to comment

No this is locally on my machine, it happens with directx and opengl. DirectX shows a bit more information:

grafik.png.0246cb251a19031508944b83baf892c2.png

  

     Unigine_double_x64d.dll!D3D11Texture::get_sampler_state(int sampler_state, int flags) Line 3091    C++
     [Inline Frame] Unigine_double_x64d.dll!D3D11Texture::getTextureSampler() Line 3191    C++
     Unigine_double_x64d.dll!D3D11Texture::bindControl(int unit) Line 2860    C++
     Unigine_double_x64d.dll!D3D11RenderState::setTexture(int binding, int num, Texture * texture) Line 855    C++
     Unigine_double_x64d.dll!RenderState::setMaterial(int pass, Material * mat) Line 343    C++
     Unigine_double_x64d.dll!RenderRenderer::setShaderParameters(int pass, Shader * shader, Material * material, RenderSurface * surface, int is_screen_space) Line 6917    C++
     Unigine_double_x64d.dll!RenderRenderer::setShaderParameters(int pass, RenderSurface * surface, int is_screen_space) Line 7281    C++
     Unigine_double_x64d.dll!ObjectDynamic::render(int pass, RenderSurface * surface) Line 632    C++
     [Inline Frame] Unigine_double_x64d.dll!RenderSurface::render(int) Line 137    C++
     Unigine_double_x64d.dll!RenderRenderer::render_transparent::__l12::<lambda>(int polygon_cull) Line 4326    C++
     Unigine_double_x64d.dll!RenderRenderer::render_transparent(RenderScene * scene, RenderScreen * screen, Unigine::Vector<RenderSurface *,int,Unigine::VectorAllocator> & surfaces, Texture * color_texture, bool post_refraction) Line 4218    C++
     Unigine_double_x64d.dll!RenderRenderer::render_scene_transparent(RenderScene * scene, RenderScreen * screen, Texture * color_texture) Line 4439    C++
     Unigine_double_x64d.dll!RenderRenderer::render_screen(RenderScene * scene, RenderScreen * screen) Line 6203    C++
     Unigine_double_x64d.dll!RenderRenderer::render_main_scene(Texture * depth_out) Line 6722    C++
     Unigine_double_x64d.dll!RenderRenderer::renderWorld(Texture * depth_out) Line 300    C++
     Unigine_double_x64d.dll!Viewport::render_frame(Camera * camera) Line 1154    C++
     Unigine_double_x64d.dll!Viewport::renderEngine(Camera * camera) Line 224    C++
     Unigine_double_x64d.dll!Render::renderWorld() Line 689    C++
     Unigine_double_x64d.dll!Engine::do_render() Line 2987    C++

 

Link to comment

This happened after we made changes with the optimization of node trees where we have to move some child nodes from one object to the other.

No multithreading involved.

Edited by sebastian.vesenmayer
Link to comment
On 8/24/2021 at 4:39 PM, sebastian.vesenmayer said:

Hello,

we have a custom Material with a custom Shader and a Unigine::ObjectDynamic with custom attributes.

Sometimes Engine::do_render() function will halt when call to RenderState::setMaterial(int pass, Material * mat) Line 216 happens with following Error code.

Unhandled exception thrown: read access violation.
texture-> was 0xFFFFFFFFFFFFFF3F.

We update the texture in this material frequently with a new image.

What can cause this crash?

If it helps I can provide a crash dump.

We are runnin 2.14.1

Thanks,

Sebastian

Dear @sebastian.vesenmayer,

I know this problem. I work with graph with custom components. Some components use custom material with custom textures and shaders. And I do then same where per frame some materials are changed or updated with new textures.

To solve this make sure that you are setting the texture or material before the do_render(). Do you have your state ready before do_render()? Technically it should. 

To be precise before your start rendering viewport.

Rohit

Link to comment

Hi @rohit.gonsalves

thanks for your input.

We do Texture or Material changes before or after do_render() has been processed. We are not changing Unigine Objects outside Engines working thread.

I think it should be fine but some other thing is going wrong :)

Link to comment
  • silent changed the title to [SOLVED] Derived custom material sometimes crashes.
×
×
  • Create New...