rework ShaderCompilerService to improve performance
- remove support for non-shared contextes parallel compilation. this wasn't used. we can always revive it later if we need to. - rework how callbacks work so that we don't have to use a work list executed at each tick() in the shared context case (common case). this improves performance significantly on low-end devices, by not having to go through the list to check if all programs are compiled, multiple times per frame. The new CallbackManager handles scheduling the callbacks after all previous programs are compiled.
This commit is contained in:
committed by
Mathias Agopian
parent
c0db909c13
commit
c0389ac54c
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "CompilerThreadPool.h"
|
||||
|
||||
#include <utils/Systrace.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace filament::backend {
|
||||
@@ -38,6 +40,7 @@ void CompilerThreadPool::init(uint32_t threadCount, JobSystem::Priority priority
|
||||
|
||||
for (size_t i = 0; i < threadCount; i++) {
|
||||
mCompilerThreads.emplace_back([this, priority, setup]() {
|
||||
SYSTRACE_CONTEXT();
|
||||
// give the thread a name
|
||||
JobSystem::setThreadName("CompilerThreadPool");
|
||||
// run at a slightly lower priority than other filament threads
|
||||
@@ -53,7 +56,11 @@ void CompilerThreadPool::init(uint32_t threadCount, JobSystem::Priority priority
|
||||
(!std::all_of( std::begin(mQueues), std::end(mQueues),
|
||||
[](auto&& q) { return q.empty(); }));
|
||||
});
|
||||
if (!mExitRequested) {
|
||||
|
||||
SYSTRACE_VALUE32("CompilerThreadPool Jobs",
|
||||
mQueues[0].size() + mQueues[1].size());
|
||||
|
||||
if (UTILS_LIKELY(!mExitRequested)) {
|
||||
Job job;
|
||||
// use the first queue that's not empty
|
||||
auto& queue = [this]() -> auto& {
|
||||
|
||||
Reference in New Issue
Block a user