Fix C# benchmarks not being able to load, add ability to change benchmark time limit (#82)

- Allow the benchmark time limit to be changed by C# scripts.
  - Continuation of #73, fixes a crash when running C# physics benchmarks.
    Also sets the C# physics benchmarks to 10 seconds.
- Fix C# benchmarks not being loaded.
This commit is contained in:
Emmanouil Papadeas
2024-06-28 21:06:07 +03:00
committed by GitHub
parent dddd717a4d
commit cdea241009
4 changed files with 4 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ using Godot;
public partial class Benchmark : RefCounted
{
public double benchmark_time = 5e6;
public bool test_render_cpu = false;
public bool test_render_gpu = false;
public bool test_idle = false;

View File

@@ -20,6 +20,7 @@ public partial class RigidBody2D : Benchmark
SquareMesh.Size = new Vector2(20.0f, 20.0f);
CircleMesh.Radius = 10.0f;
CircleMesh.Height = 20.0f;
benchmark_time = 10e6;
test_physics = true;
test_idle = true;
}

View File

@@ -17,6 +17,7 @@ public partial class RigidBody3D : Benchmark
public RigidBody3D()
{
benchmark_time = 10e6;
test_physics = true;
test_idle = true;
}

View File

@@ -82,7 +82,7 @@ func _ready():
set_process(false)
# Register script language compatibility
if Engine.has_singleton("GodotSharp"):
if ClassDB.class_exists(&"CSharpScript"):
languages[".cs"] = {"test_prefix": "Benchmark"}
# Register contents of `benchmarks/` folder automatically.