Repository navigation
Host hooks, capacity, counters and the getters the reference has (#163, first part) - #164
Merged
Merged
Conversation
… first part) A host's allocator takes every block the engine makes (the scheduler, its semaphore and the ragdoll layer now allocate through basics too), its log the engine's messages and its failure function the one hard stop. The world keeps its maximum capacity at each step's start and a snapshot carries it; Counters has the rest of b3Counters; the memory goes to the log part by part. Contact data by id, the joint tuning getter, the mesh material count, world counts, version, precision, AVX2 and the reference's b3Hash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first part of #163: the public API that e77352c has and no reference test reaches. Debug draw is the second part, so #163 stays open.
Getters and queries
dynamics.contact_get_data(id)(b3Contact_GetData). An id that is not a contact's gives an empty result.dynamics.joint_get_constraint_tuning(b3Joint_GetConstraintTuning), returning both values.dynamics.shape_get_mesh_material_count(b3Shape_GetMeshMaterialCount).physics_world.get_world_countandget_max_world_count.physics_world.get_version: the reference version this engine follows, 0.2.0. aephysics has no version scheme of its own, so it does not invent one.physics_world.is_double_precision: true, since world positions are double, as in the reference's large-world build.physics_world.is_avx2_available: the CPU and OS check, as GCC's and Clang's__builtin_cpu_supportsread it. This is the query half of SIMD width chosen at run time: AVX2 when the CPU has it, one binary for every CPU (b3SetSIMDWidth) #156.physics_world.get_max_capacity(b3World_GetMaxCapacity):Capacityin its layout hash);Capacitygains the body counts.basics.djb2_hash: the reference'sb3Hash, word-wise as it is. The test pins values from the reference's function compiled in C.Host hooks
basics.set_allocator(allocate, release)(b3SetAllocator): every block the engine makes comes from the host's allocator, asked at the reference's 32-byte alignment and zeroed here.b3CreateSemaphoredoes throughb3Alloc) and the ragdoll layer now allocate through it too.set_allocatorrefuses while blocks from the previous allocator are still out, since they must go back to the allocator that made them.human.destroy_shape. Plainfree()stays memory-safe while no host allocator is set, so existing callers (ae3d) keep working until they switch.basics.set_log_fn(b3SetLogFcn): the scheduler's overflow message and the solver's stage report go through it.basics.set_assert_fn(b3SetAssertFcn): aephysics checks its inputs and returns instead of asserting. Its one hard stop, the scheduler's task overflow, reports to the host before it aborts.Diagnostics
physics_world.dump_memory_stats(b3World_DumpMemoryStats) andworld_byte_count: the reference's parts with its labels, plus ours (fat bounds, owned geometry, names), to the host's log.Countersgains the rest ofb3Counters:byte_count,arena_capacity,task_count;manifold_counts: the collide pass's contacts by manifold count, recycled ones included, as the reference counts them;distance_iterations,push_back_iterations,root_iterations: maxima over the world's life, as the reference keeps them.b3World_DumpShapeBounds, which e77352c declares but never defines.Bugs found on the way, filed
varof a void function type rejects a matching function as its initializer. The hooks did not need it, since they are a record a pointer reaches, null until a host sets one, as the reference's are null-checked pointers.&p.fieldof one struct type passes the checker as an argument of another pointer type, and gcc rejects the C.Tests
test_host_api.ae, 31 checks. A counting allocator that hands out dirty memory is set before anything is made. It takes every block of a world on four workers with a ragdoll, a mesh, a hinge, a bullet, a snapshot and a recording, and gets each back except the scratch the modules keep for the program, which matches the counters exactly. It is asked at 32 bytes every time. The other checks:b3Hashagainst the reference's own values.test_human.ae: frees shapes withdestroy_shape.Pins
Aether 0.796.0 and aeb v0.325, both the latest releases.