Skip to main content

Module gpu

Expand description

Typed WGSL geometry kernels with deterministic CPU oracles.

These kernels complement WGSL Forge without pretending that branch-heavy exact topology edits belong on the GPU. Parallel broad phases run here; uncertain predicates are explicitly returned to the robust CPU/WASM path.

§P1.9 — orient3d and incircle GPU batches

Added Orient3dF32 and IncircleF32 kernels, each with:

  • A WGSL shader that computes the filtered determinant in f32 and flags GPU_ORIENTATION_UNCERTAIN when near the error bound.
  • A CPU/WASM oracle (evaluate_orient3d_batch_f32, evaluate_incircle_batch_f32) that runs the full filtered → compensated → exact ladder.

The GPU is the fast broad phase; uncertain lanes fall back to the CPU oracle’s exact path. On the no-adapter path, the CPU oracle is the deterministic fallback (identical results, no GPU needed).

Structs§

GeometryGpuSchedule

Enums§

GeometryGpuError
GeometryGpuKernel

Constants§

GPU_ORIENTATION_UNCERTAIN
GPU_OVERLAP_NO
GPU candidate-generation result flag: the pair is definitely not overlapping.
GPU_OVERLAP_UNCERTAIN
GPU candidate-generation result flag: uncertain (near-boundary), needs CPU verification.
GPU_OVERLAP_YES
GPU candidate-generation result flag: the pair is a definite overlap.

Functions§

emit_geometry_wgsl
Deterministically emit a typed computational-geometry shader.
evaluate_aabb_overlap_batch_f32
CPU/WASM oracle for packed AABB pairs (12 f32s per pair). Returns exact overlap results: 1 = overlap, 0 = no overlap.
evaluate_incircle_batch_f32
CPU/WASM oracle for packed (ax,ay, bx,by, cx,cy, dx,dy) f32 quadruples (8 f32s per quad). Runs the full filtered → compensated → exact ladder via incircle.
evaluate_orient3d_batch_f32
CPU/WASM oracle for packed (ax,ay,az, bx,by,bz, cx,cy,cz, dx,dy,dz) f32 quadruples (12 f32s per quad). Runs the full filtered → compensated → exact ladder via orient_3d.
evaluate_orientation_batch_f32
CPU/WASM oracle for packed (ax, ay, bx, by, cx, cy) f32 triples.
gpu_candidate_box_join
Generate candidate pairs from a BVH overlap query using GPU-style broad-phase filtering, then merge with CPU exact verification.
gpu_filter_incircle_f32
GPU filter result for a single incircle quadruple (f32).
gpu_filter_orient3d_f32
GPU filter result for a single orient3d quadruple (f32). Returns +1 / -1 / GPU_ORIENTATION_UNCERTAIN.
merge_aabb_overlap_results
Deterministic merge: combine GPU candidate results with CPU verification.