-multithreading jobs dependencies:

*system has arrays of read only and modified components
 *new attribute "readonly" usable for variables which should be visible as read only. Const can be used instead for enable checks by compiler.
 *JobGroup was added. JobGroup contain array of jobs and array of dependencies (JobGroups)
 *new function generateDependencies() generate exclusion between systems, and then generate dependencies for SystemCallers and JobGroups
-fixed issue with jobs generating (empty blocks with only newly added entities was used, and led to crash)
-fixed small typo mistake
This commit is contained in:
Mergul 2018-10-20 11:42:29 +02:00
parent 2824bdb55b
commit 430ce8074c
4 changed files with 246 additions and 28 deletions

View file

@ -131,7 +131,7 @@ int main()
size_t length;
TestComp[] test;
TestComp2[] test2;
@optional TestComp3[] test3;
@readonly @optional const(TestComp3)[] test3;
//@absent TestComp4[] test4;
}
@ -208,7 +208,7 @@ import std.meta;
static struct EntitiesData
{
short length;
Entity[] entity;
const (Entity)[] entity;
TestComp3[] test;
//@absent TestComp[] testt;
}
@ -256,9 +256,9 @@ import std.meta;
}*/
}
void dispatch(EntityManager.Job[] jobs)
void dispatch(EntityManager.JobGroup jobs)
{
foreach(job;jobs)
foreach(job;jobs.jobs)
{
//writeln(job);
job.execute();
@ -366,6 +366,8 @@ import std.meta;
gEM.registerSystem!TestSystem2(0);
gEM.generateDependencies();
//assert(*(cast(EntityID*)(cast(void*)tmpl.info.first_block+24)) == EntityID(1,1));
//assert(*(cast(EntityID*)(cast(void*)tmpl.info.first_block+48)) == EntityID(1,1));