Comments (14)
I would rather not use OpenMP. It seems like it could be nice if you want to speed up stuff that is more sequential in nature. So I'm not sure it would be all that useful for us.
I think the traditional thread route would be better as long as we can reasonably figure a decent way to spread the workload around.
One idea is to look into implementing some form of thread pools. Basically we would setup a fixed number of threads based upon the number of cpu cores. The threads would always be running. Then we would queue up work to the threads. Certain things probably wont be able to be multithreaded, for example most windowing apis require you to only use the window from the thread you created it from for example. So we would probably need a few fixed threads, along with some threadpools to handle the other work.
from openrhythm.
However despite needing to do window/event stuff from the main thread. OpenGL should work from a thread that is separate from the main thread though i would need to experiment with that somewhat... I'm curious if that would allow us reduce input latency any :P
from openrhythm.
Though if we were going to go that route I would want to implement my own native Win32 and X11 windowing support. Because i think for X11 threading OpenGL is a bit more Finicky, I know its allowed on windows though.
from openrhythm.
I think you didnt understand one thing : I didnt mean it was one implementation or the other ;)
For instance I think that audio on-the-fly decoding could be speed up a (very little ?) bit with openMP. And SoundTouch uses (optionnal) OpenMP anyways ;)
I see what you mean about windowing, i've done enough GTK+ to know it ^^
Using thread pools could be a good idea, although we usually will have "fixed" tasks for the whole app lifetime. And I don't want some tasks to eventually block the app because we only have 2cores :p
from openrhythm.
Just as an update to this I did do that experiment with running opengl on a separate thread from the window event thread. It helps immensely with getting more accurate time stamps for input events, which i think will be very very useful when doing note hit detection.
So i really would like to transition everything to use this if possible, and move away for sdl2(it gives event timestamps but i just don't see them being as accurate as I want). The other option if a platform gives very accurate time stamps without needing to do a separate events thread then we wont need another thread for it(and if SDL2 uses the data the platform its running on for its internal timestamps then we can even use sdl2 for that platform as well).
from openrhythm.
That's a good thing then :D Even on Windows ?
from openrhythm.
Well the current thing is I know i can do it on windows, i'm not sure about linux or mac yet.
from openrhythm.
Well as I said in #17, we don't need to create a thread for the audio tasks, LibSoundio handles everything. Right now I don't think the code in soundio.cpp is multithread safe but I'll come around that. It's basically a non-issue right now.
from openrhythm.
The problem last I looked soundio is blocking unless you've changed its usage so it doesn't
from openrhythm.
It's not blocking "anymore". The only blocking function in libsoundio is wait_events
and can be replaced by a regular call to flush_events
. Its only purpose is to send the SoundIo::on_devices_change
and SoundIo::on_backend_disconnect
callbacks if needed.
from openrhythm.
Oh alright, good to know. I looked at it briefly a while back to see if there was something other than wait_events but didn't immediately find it.
from openrhythm.
Yeah. And my soundio wrapper exposes soundio_flush_events as a direct call to flush_events(&soundio)
from openrhythm.
Something i was thinking about, with the new rendering architecture the main game thread can probably be ran on a totally separate thread from the rendering thread.
from openrhythm.
My current short term plan for this is to just haphazardly add extra threads where they make sense. Longer term i'd like to have some sort of task system where tasks can be launched as a thread.
from openrhythm.
Related Issues (20)
- Translation support HOT 6
- Configuration and Config Files. HOT 13
- Finish the VFS and integrate it with the codebase. HOT 4
- Complete the audio system. HOT 13
- How to save scores HOT 12
- Change MIDI for another format HOT 1
- Doc HOT 7
- Perhaps look into unit testing? HOT 6
- Audio compilation errors with Visual Studio. HOT 4
- Error while compiling master HOT 2
- Optional PNG++ ? HOT 8
- Possible memory leak in audiotests.cpp HOT 3
- gettext has issues on windows, find an alternative. HOT 7
- Configuration systems HOT 3
- Rust HOT 2
- Go through and make a documentation pass on everything.
- OSX Build HOT 7
- Link SoundTouch-C on Mac HOT 1
- Can't run without notes.mid and song.ogg HOT 1
- Status of project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openrhythm.