Jump to content

Recommended Posts

Posted

Hei ya I would like to make a loader for gamestarts with a video and a loader for meshes / textures.

 

I would like to make a video at the start like in all games and load at the same time the stuff for the game.

 

The problem is that I can't do that with Threads ( loading a mesh in a second thread close the whole app )

And playing the video in a other thread needs the created GL Context.....

 

An other idea was to load the data in a ifstream to some buffers ( in a thread) and "copy that to the memory" ( I saw that LE loads the data from the memory when you load the same asset the second time )

 

Have somebody a idea ?

Posted

But I need a Context for video playing, because the Data is loaded into a GLTexture.

Not sure if it's a best way for playing video.

 

And how should I separate the App ??

I'm not sure. That was just an idea. You can create a standalone app for player and run it from game app in separate thread with waiting for finishing. And after closing player app your thread will get control and continue execution. So you will know that video is finished.

Guest Red Ocktober
Posted

would something along the lines of an anim-gif be a satisfactory solution...

although, that itself may take a while to load...

 

--Mike

Posted

Okey I have it now.I created a manager for videos with sound in a second thread with DirectShow , supporting lots of formats, will upload the new player ;)

 

Now I can load assets and play a video at the same time ;)

Posted

Nice work ParaToxic, that's about as much as you can do really given that LE2's commands are not thread safe.

 

 

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

Actually only LoadModel is not thread-safe, because it gets the texture size from the GPU, which returns 0 for other threads.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Actually only LoadModel is not thread-safe, because it gets the texture size from the GPU, which returns 0 for other threads.

From all that I've seen in the past from people that have tried it, most of the commands are not thread safe and can cause crashes if run asynchronously, what makes you believe the others are all 'thread safe'?

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

I made once a multi-threaded demo which did everything else except loading models on a 2nd thread, and it worked fine.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Well I have seen examples where mutli-threaded calls to basic Entity functions caused crashes. The general concensus as I understand it has always been that Leadwerks is NOT thread safe!

 

What mechanisms are in place to ensure, for example, that only one thread reads or writes shared data at any time?

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

You can use mutexes to avoid that 2 threads use LE2 commands at the same time. But I prefer to do all heavy calculations on other threads only (like AI, raycasts, etc...), and let the main thread handle all the LE2 commands. Then I just unlock the mutex and inform the main thread that it can read now, so the main thread can read the calculated data and do its LE2 commands on the data.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Fair comment, but that's not the same as saying that LE2 commands are thread safe ... they are not!

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

Even if they would be internally threadsafe, they would use mutexes anyway, so there is really not a big difference.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Except that when you tell people it is thread safe they assume you don't have to use mutexes. Avoid misinformation please, it's not helpful to people.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

As long as you are not using seperate contextes for each thread and use shared memory there is no way making it threadsafe.

 

@metatron: As far as i remember your mt sample was based on loading the meshes seperatly before loading the scene in another thread. And due the instanced nature of le this might have worked. But as soon as you load a new mesh outside the mainthread le/opengl will crash and this has nothing to do with mutexes.

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...