ensure eval and compilation do not conflict/overlap, add pending indicator
This commit is contained in:
parent
6ac115fe0b
commit
ec098a72da
|
|
@ -100,7 +100,7 @@ void Main()
|
||||||
shouldEvaluate = false;
|
shouldEvaluate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRecompile)
|
if (shouldRecompile && !isEvaluating)
|
||||||
{
|
{
|
||||||
Compiler.CompilerCache<Vector<float>>.CachedPrograms.Clear();
|
Compiler.CompilerCache<Vector<float>>.CachedPrograms.Clear();
|
||||||
Compiler.CompilerCache<float>.CachedPrograms.Clear();
|
Compiler.CompilerCache<float>.CachedPrograms.Clear();
|
||||||
|
|
@ -169,7 +169,7 @@ void Main()
|
||||||
double nanoSecondsPerPixel = evaluationTimeNanoSeconds / (currentOutputImageSize * currentOutputImageSize);
|
double nanoSecondsPerPixel = evaluationTimeNanoSeconds / (currentOutputImageSize * currentOutputImageSize);
|
||||||
Raylib.DrawText(
|
Raylib.DrawText(
|
||||||
shouldUseCompiler
|
shouldUseCompiler
|
||||||
? $" - evaluation took: {lastEvaluationTimeTook:0.0} s ({nanoSecondsPerPixel:0.0} ns / pixel) (compilation: {lastCompilationTimeTook:0.0} s)"
|
? $" - evaluation took: {lastEvaluationTimeTook:0.0} s ({nanoSecondsPerPixel:0.0} ns / pixel) (compilation: {lastCompilationTimeTook:0.0} s{(shouldRecompile ? " (pending)" : string.Empty)})"
|
||||||
: $" - evaluation took: {lastEvaluationTimeTook:0.0} s ({nanoSecondsPerPixel:0.0} ns / pixel)", 12,
|
: $" - evaluation took: {lastEvaluationTimeTook:0.0} s ({nanoSecondsPerPixel:0.0} ns / pixel)", 12,
|
||||||
52, 20, Color.White);
|
52, 20, Color.White);
|
||||||
}
|
}
|
||||||
|
|
@ -204,6 +204,7 @@ void Main()
|
||||||
if (Raylib.IsKeyPressed(KeyboardKey.C))
|
if (Raylib.IsKeyPressed(KeyboardKey.C))
|
||||||
{
|
{
|
||||||
shouldUseCompiler = !shouldUseCompiler;
|
shouldUseCompiler = !shouldUseCompiler;
|
||||||
|
shouldRecompile = shouldUseCompiler;
|
||||||
if (shouldUseCompiler)
|
if (shouldUseCompiler)
|
||||||
{
|
{
|
||||||
shouldRecompile = true;
|
shouldRecompile = true;
|
||||||
|
|
@ -1021,7 +1022,6 @@ internal static class Interpreter
|
||||||
public static T EvaluateCompiled<T>(EvaluationInstructions evaluationInstructions, T xs, T ys)
|
public static T EvaluateCompiled<T>(EvaluationInstructions evaluationInstructions, T xs, T ys)
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
// #TODO: this construction is just a little bit unhinged lol
|
|
||||||
Span<T> variables = stackalloc T[evaluationInstructions.Instructions.Length];
|
Span<T> variables = stackalloc T[evaluationInstructions.Instructions.Length];
|
||||||
|
|
||||||
// compile if we've not already cached this instruction set, and evaluate!
|
// compile if we've not already cached this instruction set, and evaluate!
|
||||||
|
|
@ -1034,7 +1034,6 @@ internal static class Interpreter
|
||||||
public static T EvaluateInterpreted<T>(EvaluationInstructions evaluationInstructions, T xs, T ys)
|
public static T EvaluateInterpreted<T>(EvaluationInstructions evaluationInstructions, T xs, T ys)
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
// #TODO: this construction is just a little bit unhinged lol
|
|
||||||
Span<T> variables = stackalloc T[evaluationInstructions.Instructions.Length];
|
Span<T> variables = stackalloc T[evaluationInstructions.Instructions.Length];
|
||||||
|
|
||||||
foreach (ref Instruction instruction in evaluationInstructions.Instructions.AsSpan())
|
foreach (ref Instruction instruction in evaluationInstructions.Instructions.AsSpan())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue