[v2]Disable threading

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
KakCAT
Posts: 24
Joined: Mon Apr 14, 2014 2:08 pm

[v2]Disable threading

Post by KakCAT » Wed Feb 20, 2019 12:36 pm

Hi Norbo!

I'd like to disable threading in v2 for debugging purposes, in the default bepu2 Demos.sln . I've deduced from the deterministic documentation that it's just a matter to avoid passing ThreadDispatcher to Simulation.Update

However when I do that, an Assert fail appears in Buffer.cs here:

Code: Select all

Debug.Assert(index >= 0 && index < length, "Index out of range.");
index is 0, length is 0 .Stacktrace:

Code: Select all


 	BepuPhysics.dll!BepuPhysics.PoseIntegrator<Demos.DemoPoseIntegratorCallbacks>.IntegrateBodiesAndUpdateBoundingBoxes(int startIndex = 0, int endIndex = 0, float dt = 0.0166666675, ref BepuPhysics.BoundingBoxBatcher boundingBoxBatcher = {BepuPhysics.BoundingBoxBatcher}, int workerIndex = 0) Line 300	C#
 	BepuPhysics.dll!BepuPhysics.PoseIntegrator<Demos.DemoPoseIntegratorCallbacks>.IntegrateBodiesAndUpdateBoundingBoxes(float dt = 0.0166666675, BepuUtilities.Memory.BufferPool pool = {BepuUtilities.Memory.BufferPool}, BepuUtilities.IThreadDispatcher threadDispatcher = null) Line 556	C#
 	BepuPhysics.dll!BepuPhysics.Simulation.IntegrateBodiesAndUpdateBoundingBoxes(float dt = 0.0166666675, BepuUtilities.IThreadDispatcher threadDispatcher = null) Line 212	C#
 	BepuPhysics.dll!BepuPhysics.PositionFirstTimestepper.Timestep(BepuPhysics.Simulation simulation = {BepuPhysics.Simulation}, float dt = 0.0166666675, BepuUtilities.IThreadDispatcher threadDispatcher = null) Line 59	C#
 	BepuPhysics.dll!BepuPhysics.Simulation.Timestep(float dt = 0.0166666675, BepuUtilities.IThreadDispatcher threadDispatcher = null) Line 344	C#
 	Demos.dll!Demos.Demo.Update(DemoUtilities.Window window = {DemoUtilities.Window}, DemoRenderer.Camera camera = {DemoRenderer.Camera}, DemoUtilities.Input input = {DemoUtilities.Input}, float dt = 0.0121090971) Line 46	C#
 	Demos.dll!Demos.SpecializedTests.NotGJKTestDemo.Update(DemoUtilities.Window window = {DemoUtilities.Window}, DemoRenderer.Camera camera = {DemoRenderer.Camera}, DemoUtilities.Input input = {DemoUtilities.Input}, float dt = 0.0121090971) Line 144	C#
 	Demos.dll!Demos.DemoHarness.Update(float dt = 0.0121090971) Line 309	C#
 	Demos.dll!Demos.GameLoop.Update(float dt = 0.0121090971) Line 43	C#
 	DemoUtilities.dll!DemoUtilities.Window.Run(System.Action<float> updateHandler = {System.Action<float>}, System.Action<BepuUtilities.Int2> onResize = {System.Action<BepuUtilities.Int2>}) Line 166	C#
 	Demos.dll!Demos.GameLoop.Run(Demos.DemoHarness harness = {Demos.DemoHarness}) Line 55	C#
 	Demos.dll!Demos.Program.Main(string[] args = {string[0]}) Line 25	C#
	
Is this the correct way to disable threading? Any ideas of the problem?



By the way, I'd like to suggest to separate the "questions and help" subforum into V1 and V2.

In example, I'm trying to search how to disable threading in V2, however "v2" is discarded from the search query, probably because it's too short, but makes impossible to search for V1/V2 specific threads.

Thanks!

Norbo
Site Admin
Posts: 4682
Joined: Tue Jul 04, 2006 4:45 am

Re: [v2]Disable threading

Post by Norbo » Thu Feb 21, 2019 12:30 am

Is this the correct way to disable threading?
Yup, just don't pass a thread dispatcher into the timestep.
Any ideas of the problem?
Regression in the PoseIntegrator when there are zero bodies. Fixed, thanks for the report.
By the way, I'd like to suggest to separate the "questions and help" subforum into V1 and V2.

In example, I'm trying to search how to disable threading in V2, however "v2" is discarded from the search query, probably because it's too short, but makes impossible to search for V1/V2 specific threads.
Good chance I'll do this before release, but I would recommend avoiding phpbb's search regardless- google with site:forum.bepuentertainment.com search tends to be way better.

KakCAT
Posts: 24
Joined: Mon Apr 14, 2014 2:08 pm

Re: [v2]Disable threading

Post by KakCAT » Thu Feb 21, 2019 2:35 pm

thanks for the fix!

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests