vblanco20-1 / vkguide-comments

Storage for the comments of vulkan-guide
0 stars 0 forks source link

Multithreading info Comments #10

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Multithreading for game engines - Vulkan Guide

Practical guide to vulkan graphics programming

https://www.vkguide.dev/docs/extra-chapter/multithreading/

MagicOneFr commented 3 years ago

In the example of atomics, it should be "std::atomic vertexAmount{0};" no?

Light7734 commented 2 years ago

Is it a good idea to make a container of related data for each thread to eliminate the need for synchronization?

for example:

std::for_each(std::execution::par, VecOfParticleSystems.begin(), VecOfParticleSystems.end(),
            [](ParticleSystem* System){ 
                for(Particle* Part : System)
                {
                    Part->Update();
                    System->vertexAmount += Part->IsDead ? 0ull : Part->vertexCount;
                }

                std::erase_if( System, [](Particle& Part){return Part->IsDead;} );
            });
Sand3r- commented 2 months ago

I recall when exactly 2 weeks ago I knew almost nothing about creating multi-threaded task-based systems when I've stumbled upon your article. It was such a good starting point, that today I obviously had to end up finding myself researching win32 api internals in pursuit of creating my own lightweight fiber implementation. down the rabbit hole