Improved Demo and multithreading rendering:
-added support for multithreaded rendering (fast) -improved shaders -added support for rendering depth -added rendering color support -improved DeptThreadPool (dynamics setting number of tryWait counts before TryWait. Low cpu usage with high responivity) -added possibility to change number of threads
This commit is contained in:
parent
f6e7af1014
commit
c94510a487
8 changed files with 311 additions and 105 deletions
6
demos/external/sources/mmutils/thread_pool.d
vendored
6
demos/external/sources/mmutils/thread_pool.d
vendored
|
|
@ -9,13 +9,14 @@ import bubel.ecs.atomic;
|
|||
//import std.stdio;
|
||||
import std.algorithm : map;
|
||||
|
||||
//version = MM_NO_LOGS; // Disable log creation
|
||||
version = MM_NO_LOGS; // Disable log creation
|
||||
//version = MM_USE_POSIX_THREADS; // Use posix threads insted of standard library, required for betterC
|
||||
|
||||
version (Posix)version = MM_USE_POSIX_THREADS;
|
||||
|
||||
version (WebAssembly)
|
||||
{
|
||||
version = MM_NO_LOGS;
|
||||
extern(C) struct FILE
|
||||
{
|
||||
|
||||
|
|
@ -799,6 +800,7 @@ struct ThreadPool
|
|||
alias FlushLogsDelegaste = void delegate(ThreadData* threadData, JobLog[] logs); /// Type of delegate to flush logs
|
||||
FlushLogsDelegaste onFlushLogs; /// User custom delegate to flush logs, if overriden defaultFlushLogs will be used. Can be sset after initialize() call
|
||||
int logsCacheNum; /// Number of log cache entries. Should be set before setThreadsNum is called
|
||||
int tryWaitCount = 2000; ///Number of times which tryWait are called before timedWait call. Higher value sets better response but takes CPU time even if there are no jobs.
|
||||
private:
|
||||
ThreadData*[gMaxThreadsNum] threadsData; /// Data for threads
|
||||
align(64) shared int threadsNum; /// Number of threads currentlu accepting jobs
|
||||
|
|
@ -1455,7 +1457,7 @@ private void threadFunc(ThreadData* threadData)
|
|||
while(!threadData.semaphore.tryWait())
|
||||
{
|
||||
tryWait++;
|
||||
if(tryWait>5000)
|
||||
if(tryWait>threadPool.tryWaitCount)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue