Demo update and start counting tests times

-Fixed performance issue with multithreading and rendering
-start making better shaders (by using many macros)
-speed up rendeing when maximum objects count was reached
-remove map rendering form Snake demo, and render entities by themself
-start adding depth and color rendering parameters
-added properly names to jobs (for debugging purpses)
-starts adding multithreaded rendering
-added some math to vectors
-changes execute() to willExecute(). Probably should have different name.
This commit is contained in:
Mergul 2020-05-07 14:07:07 +02:00
parent 46aba822d0
commit 4bd5a37b5d
13 changed files with 429 additions and 198 deletions

View file

@ -9,6 +9,8 @@ import bubel.ecs.vector;
import bubel.ecs.simple_vector;
import bubel.ecs.std;
import tests.time;
enum int ASSERTED = 123;
enum string OUT_FILE = "test_report.xml";
@ -95,6 +97,8 @@ struct TestRunner(Args...)
write(test.name);
write("\" classname=\"");
write(suite.name);
write("\" time=\"");
write(cast(double)test.time*0.000001);
write("\">");
if (test.msg)
{
@ -189,8 +193,10 @@ struct TestRunner(Args...)
}
else
{
long time = Time.getUSecTime();
unittest_();
test.passed = true;
test.time = cast(int)(Time.getUSecTime() - time);
}
}
else
@ -281,6 +287,14 @@ struct TestRunner(Args...)
junit.add(cast(ubyte[]) txt);
}
void write(double num)
{
ubyte[40] buffer;
int len;
len = sprintf(cast(char*) buffer.ptr, "%2.8lf", num);
junit.add(buffer[0 .. len]);
}
void write(uint num)
{
ubyte[20] buffer;

66
tests/time.d Normal file
View file

@ -0,0 +1,66 @@
module tests.time;
version (WebAssembly)
{
alias int time_t;
alias int clockid_t;
enum CLOCK_REALTIME = 0;
struct timespec
{
time_t tv_sec;
int tv_nsec;
}
extern (C) int clock_gettime(clockid_t, timespec*) @nogc nothrow @system;
struct Time
{
static long getUSecTime()
{
time_t time;
timespec spec;
clock_gettime(CLOCK_REALTIME, &spec);
//time = spec.tv_sec;
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000; //time / 1000_000;
}
}
}
else version (Windows)
{
import core.stdc.stdio : printf;
import core.sys.windows.windows;
struct Time
{
static long getUSecTime()
{
LARGE_INTEGER time, freq;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&time);
return time.QuadPart / (freq.QuadPart / 1000_000);
}
}
}
else version (Posix)
{
import core.stdc.stdio : printf;
import core.sys.posix.time;
struct Time
{
static long getUSecTime()
{
time_t time;
timespec spec;
clock_gettime(CLOCK_REALTIME, &spec);
//time = spec.tv_sec;
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000; //time / 1000_000;
}
}
}