Jump to content

[SOLVED] Issue when implemented in our application


photo

Recommended Posts

Posted

Please checlk the steps listed below for the problem.

1)  First I am Initializing Unigine Engine by calling Engine::init() 
method and passing  required arguments to this method when I am 
creating my Device context.

  2) I have implemented One "UnigineImpl" class which is derived from 
"App" class. I have implemented all the virtual function of "App" 
class in my "UnigineImpl" class. In this class i am initializing 
Direct3D11 render in setVideoMode() function by calling initD3D11() 
function by passing required arguments.

3) Our application controlling main loop, hence I have given empty 
implementation to doUpdate() , doRender() and doSwap() functions. I am 
calling update() , render() and swap()     functions of App class as 
per my requirement.

4) Up to this my engine part is over.

5) Now I have added one object in our application which loads world 
from data folder which is located at position where I am creating my 
.exe.

6) when I am loading my object first time and calling run() method of 
"Console" class and passing world_load command with world name then it 
loads world correctly.     But when I am selecting another .world file 
and passing it to run() method then it giving me a following error.

     Unigine~# world_load dof_00
     FileSystem::getFile(): can't open "data/samples/render/dof_00.cpp"
file
     Interpreter::load(): can't open "dof_00.cpp" file
     World::loadWorld(): can't load "dof_00.cpp" world script

     After run() method I am calling flush() method of "Console" class 
for executing all pending console commands.

7) I have set data folder path manually By calling data_path command 
of console. But still I am getting same error. Only first time world 
loaded correctly and for next time may be its taking wrong path . I 
haven't set any data_path manually. Even I had tried to load world by 
passing full path of .world file for second time but world hadn't 
loaded.

8) I am calling  run() and flush() only once for initialization 
purpose and after that calling update(), render() and swap() methods 
of App class continuously for per frame.

Posted

Hi Rohit,

 

Sorry for the late reply.

 

It is hard to say what can cause such behavior. A minimal test application is required. Could you please provide us an actual source code that could be built and more detailed step-by-step guide for reproduction? This surely will help us to get to the root of this issue faster.

 

Thank you!

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

Posted

Silent,

 

We have investigated the problem and here is the problem defination..

 

Our product which runs on two main threads. One is DX11 rendering thread and other one is application thread with all resource loading.

Even our engine uses object cloning where if one world is loaded, the application loads the second world in background and after loading completes we swap pointers between the threads. Due this behaviour we achieve break free rendering on output as our solutions are for broadcast and video.

 

Now if unigine is initialized in application thread and then from rendering thread we issue console.run for loading world  or vice versa; it fails.

 

How to handle this situation?

 

Rohit

Posted

Hi Rohit,

 

Could you be more specific how exactly engine.console.run fails? Did you get engine crash or so?

 

Also, all console are executing during engine update function, before script update. You can force console command execution by calling engine.console.flush.

Posted

Hi Rohit,

 

Could you be more specific how exactly engine.console.run fails? Did you get engine crash or so?

 

Also, all console are executing during engine update function, before script update. You can force console command execution by calling engine.console.flush.

 

 

The error is as follows

 

Unigine~# world_load samples/render/auxiliary_00

Edit -- Class Name 1342242944 Style

Edit -- Class Name 1342242944 Style

FileSystem::getFile(): can't open "data/samples/render/auxiliary_00.cpp" file

First-chance exception at 0x000007fefd67a49d in Monarch Twister HD.exe: Microsoft C++ exception: char * __ptr64 at memory location 0x384fb6f0..

Interpreter::load(): can't open "samples/render/auxiliary_00.cpp" file

World::loadWorld(): can't load "samples/render/auxiliary_00.cpp" world script.

 

Even before console.run  command for world loading tried filesystem_reload and it doesn't work.

 

Please advise.

 

Posted

Looks like something had happened inside Monarch Twister HD.exe, I can't tell exactly what was the reason. Could you please make a test scene so I'll be able to get that result on my PC?

 

Another way we can go is to run your application with debugger attached to it and post crash callstack here. I recommend you to use visual studio on Windows and gdb on Linux. Here's an article of how to do that on Windows: http://msdn.microsoft.com/en-us/library/3s68z0b3.aspx

Posted

Please take a look at the sample application attached. If world loading is called from the other thread with proper synchronization the things works but world does not load. It only shows blank screen.

 

The application loads the sample and then on right click of mouse creates another thread which invokes the world loading. But it fails. Renders black.

 

Please advise.

Tutorial01.zip

Posted

Hello again, Rohit.

 

I had a look at your code and dig deep inside Unigine world loading function. The problem is that it's using rendering context which is not thread-safe so for now, I believe, it's not possible to load world from another thread that way. Though the engine heavily uses threads inside it's not thread-safe outside especially if we're talking about rendering.

 

However, you have several options to do a background level loading in Unigine Script:

 

1) Use WorldLayer node (https://developer.unigine.com/en/docs/1.0/objects/worlds/world_layer/). It's possible to write simple script logic which will check for new files and create new WorldLayer instance.

 

2) Use engine.world.loadAsyncNode (https://developer.unigine.com/en/docs/1.0/scripting/library/engine/engine.world#engine.world.loadAsyncNode_string_int_float).

 

You're able to use this two methods both in C++ and in Unigine Script.

×
×
  • Create New...