Skip to main content

Crate oxiphysics_gpu

Crate oxiphysics_gpu 

Source
Expand description

GPU acceleration backends for the OxiPhysics engine.

This crate provides a GPU compute abstraction layer that can work with any backend, with a CPU fallback as the default implementation. No heavy GPU dependencies (such as wgpu) are required.

Re-exports§

pub use compute::BufferHandle;
pub use compute::ComputeBackend;
pub use compute::ComputeKernel;
pub use compute::CpuBackend;
pub use neural_compute::*;
pub use particle_system::*;
pub use sparse_gpu::*;

Modules§

bvh
CPU BVH (Bounding Volume Hierarchy) tree for broad-phase acceleration.
cell_list
Auto-generated module structure
collision_gpu
Auto-generated module structure
compute
Auto-generated module structure
compute_pipeline
CPU-side simulation of a wgpu compute pipeline abstraction.
deformable_gpu
Deformable GPU simulation module.
fluid_gpu
GPU fluid simulation: Navier-Stokes, LBM kernels, SPH kernels, vortex confinement, and shallow-water equations — CPU mock backend.
fluid_sim_gpu
Auto-generated module structure
flux_compute
CPU-side parallel flux and advection compute kernels.
gpu_cloth
GPU-accelerated cloth simulation (CPU mock implementation).
gpu_collision_detection
GPU-accelerated collision detection (CPU mock backend via Rayon).
gpu_collision_ext
GPU collision detection extensions (CPU mock backend).
gpu_fem_assembly
GPU-accelerated FEM matrix assembly (CPU mock implementation).
gpu_fluid
GPU-accelerated fluid simulation using a MAC (Marker-and-Cell) grid.
gpu_fluid_euler
GPU Eulerian fluid simulation on a staggered MAC grid (CPU mock backend).
gpu_lbm
GPU-accelerated Lattice Boltzmann Method (D2Q9) — CPU mock backend.
gpu_md_solver
GPU-side molecular dynamics (MD) solver — CPU mock backend.
gpu_mesh_processing
GPU triangle mesh processing (CPU mock implementation).
gpu_neural_solver
GPU neural network solver for physics (CPU mock backend).
gpu_nn
GPU-accelerated neural network compute (CPU mock backend).
gpu_particle_system
GPU-accelerated particle system (CPU mock implementation).
gpu_particles
GPU-style particle system simulated on the CPU.
gpu_ray_tracing
GPU ray tracing (CPU mock implementation).
gpu_reduction
GPU reduction and scan operations (CPU mock implementation).
gpu_rigid
GPU-accelerated rigid body batch simulation (CPU mock).
gpu_sdf
GPU-accelerated Signed Distance Field (SDF) computation (CPU mock).
gpu_sort
GPU-style parallel sorting algorithms (CPU simulation).
gpu_sparse_solver
GPU sparse linear system solver (CPU mock implementation).
gpu_sph_density
GPU-accelerated SPH density computation (CPU mock implementation).
gpu_sph_pressure
GPU SPH pressure solver (CPU mock backend).
gpu_sph_solver
GPU-side SPH solver — CPU mock backend.
gpu_thermal
GPU-accelerated thermal computation (CPU mock backend via Rayon).
gpu_voxel
GPU voxel grid operations (CPU mock implementation).
grid_reduce
GPU-style grid-based reduction and aggregation kernels.
kernels
GPU/CPU compute kernels for physics simulation.
memory
GPU memory management abstractions.
neural_compute
Auto-generated module structure
neural_physics
Neural network-based physics acceleration (CPU mock).
parallel
Auto-generated module structure
parallel_sort
Parallel sorting and reduction utilities (CPU-side, rayon-based).
particle_system
Auto-generated module structure
path_tracer
CPU path tracer using GPU-style algorithms.
pipeline
Auto-generated module structure
ray_marching
Ray marching and Signed Distance Field (SDF) rendering utilities.
ray_tracing_gpu
GPU ray tracing with f32 precision (CPU mock).
raytracing
Auto-generated module structure
scheduler
GPU workload scheduler.
sdf_compute
Auto-generated module structure
shader_registry
Auto-generated module structure
shaders
Auto-generated module structure
sparse_gpu
GPU-ready sparse matrix formats and iterative solvers with data-oriented layouts.

Structs§

AnnotatedError
An error annotated with severity and an optional kernel name.
DispatchTimer
A simple timer utility for profiling GPU-like dispatches.
PipelineStageError
A pipeline-stage error: carries the stage name plus the underlying cause.

Enums§

Error
Main error type for the gpu module.
ErrorSeverity
Severity level for a GPU error.

Functions§

aligned_size
Compute the padded buffer size to meet alignment requirements.
alloc_err
Build a Error::BufferAllocationFailed error.
arg_mismatch_err
Build a Error::KernelArgCountMismatch error.
bandwidth_gb_s
Estimate memory bandwidth in GB/s.
buffer_size_2d
Compute the 2-D buffer size (rows × pitch) for a texture-like allocation.
check
Check a boolean condition; return Err(Error::General(msg)) if false.
clamp_f64
Clamp v to [lo, hi].
collect_errors
Collect multiple errors from a batch dispatch. Returns Ok(()) if the vec is empty, or Err containing the first error otherwise.
cross3
Compute the cross product of two 3-element arrays.
dispatch_count
Compute the optimal work group size for a given total work item count.
dispatch_limit_err
Build a Error::DispatchLimitExceeded error.
dot3
Compute the dot product of two 3-element arrays.
elements_in_budget
Compute the number of elements that fit in a given memory budget.
exclusive_scan
Parallel prefix sum (scan) on a slice of f64 values.
grid_oob_err
Build a Error::GridIndexOutOfBounds error.
inclusive_scan
Inclusive scan: result[i] = sum(data[0..=i]).
index_3d_from_linear
Convert a linear index back to 3D coordinates.
inv_lerp
Inverse lerp: returns t such that lerp(a, b, t) == v, or 0 if a==b.
is_power_of_two
True when value is a power of two (including 1).
length3
Length of a 3-D vector.
lerp
Linear interpolation: a + t*(b-a).
linear_index_3d
Flatten a 3D dispatch (x, y, z) into a linear index, given grid dimensions.
log2_pow2
Log2 of a power-of-two value. Panics in debug mode if v is not a power of two.
next_power_of_two
Round value up to the next power of two.
normalize3
Normalise a 3-D vector. Returns the zero vector if the length is < eps.
reduce_max
Parallel reduce: compute the maximum of all elements.
reduce_min
Parallel reduce: compute the minimum of all elements.
reduce_sum
Parallel reduce: compute the sum of all elements.
reflect3
Reflect vector d about normal n (both assumed normalised).
row_pitch
Stride (in bytes) of a row in a 2-D buffer, given the element count per row and the required alignment.
safe_recip
Safe reciprocal: returns 1/x when |x| > eps, else 0.
safe_sqrt
Safe square root: clamps negative values to 0 before taking sqrt.
shader_err
Build a Error::ShaderCompilationError.
smootherstep
Smoother-step (Ken Perlin’s quintic): 6t⁵ − 15t⁴ + 10t³.
smoothstep
Smooth-step function: 3t² - 2t³ with t = (v - lo) / (hi - lo).
tile_count_2d
Divides a 2-D problem of (width × height) into tiles of (tw × th) and returns (tiles_x, tiles_y).
tile_index_to_2d
Convert a flat tile index back to (tile_x, tile_y) for a grid with tiles_x columns.
total_tiles_2d
Total number of tiles for a 2-D problem.
unsupported_err
Build an Error::UnsupportedFeature.
wrap_angle
Wrap an angle in radians to (-π, π].

Type Aliases§

Result
Result type alias