hyperdrone 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hyperdrone/__init__.py +28 -0
- hyperdrone/_native/cmake/hyperdrone_jit.cmake +43 -0
- hyperdrone/_native/common/bindings.h +39 -0
- hyperdrone/_native/common/cuda_staging.h +68 -0
- hyperdrone/_native/common/jit_host.h +69 -0
- hyperdrone/_native/dynamics/CMakeLists.txt +66 -0
- hyperdrone/_native/dynamics/host.cpp +191 -0
- hyperdrone/_native/dynamics/iface.h +81 -0
- hyperdrone/_native/dynamics/impl.cpp +659 -0
- hyperdrone/_native/render/CMakeLists.txt +96 -0
- hyperdrone/_native/render/host.cpp +276 -0
- hyperdrone/_native/render/iface.h +132 -0
- hyperdrone/_native/render/impl.cpp +620 -0
- hyperdrone/_native/render/scene_bindings.cpp +279 -0
- hyperdrone/_vendor/rl-tools/CMakeLists.txt +159 -0
- hyperdrone/_vendor/rl-tools/LICENSE +21 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +14 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +103 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +13 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +43 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +84 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +29 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +33 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +26 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/assimp_fixup.cmake +16 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +17 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +27 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +32 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +17 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +4 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +6 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +946 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +703 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1334 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +205 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +411 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +771 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +139 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +382 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +297 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +184 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +739 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1185 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +421 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +534 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +217 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +375 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +158 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +947 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +214 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +428 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +494 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +291 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +158 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +120 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +144 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +79 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +381 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +135 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +280 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +276 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +165 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +571 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +196 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +256 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +564 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/README.md +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +768 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +177 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +934 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1678 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +220 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +1967 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +1986 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +376 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/operations_cpu.h +226 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/scene.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/scene.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +159 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +240 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +245 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +334 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_extensions.h +244 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +172 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +195 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_extensions.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_per_env.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1083 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cuda.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +126 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +276 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +625 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +329 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +290 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +369 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +90 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/multirotor_visual.h +135 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cpu.h +244 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cuda.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_generic.h +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +160 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +149 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +9 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +113 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +815 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +275 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +865 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +34 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +205 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +281 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +175 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +494 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1629 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.cu +523 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.h +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +164 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +213 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +367 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +385 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +85 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +270 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +276 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +218 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +866 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1833 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +646 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +221 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/inference_ios.o +0 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/libinference_ios.a +0 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +456 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +445 -0
- hyperdrone/cuda/__init__.py +78 -0
- hyperdrone/dynamics/__init__.py +22 -0
- hyperdrone/dynamics/_component.py +40 -0
- hyperdrone/dynamics/_config.py +47 -0
- hyperdrone/dynamics/_sim.py +201 -0
- hyperdrone/env/__init__.py +15 -0
- hyperdrone/env/_sampling.py +67 -0
- hyperdrone/env/_world.py +60 -0
- hyperdrone/examples/__init__.py +11 -0
- hyperdrone/examples/benchmark.py +236 -0
- hyperdrone/examples/benchmark_minimal.py +66 -0
- hyperdrone/examples/data.py +42 -0
- hyperdrone/examples/drone_flythrough.py +142 -0
- hyperdrone/examples/render_procthor.py +41 -0
- hyperdrone/jit/__init__.py +111 -0
- hyperdrone/jit/_build.py +94 -0
- hyperdrone/jit/_lock.py +23 -0
- hyperdrone/jit/_patches.py +95 -0
- hyperdrone/jit/_toolchain.py +13 -0
- hyperdrone/jit/_workspace.py +70 -0
- hyperdrone/render/__init__.py +48 -0
- hyperdrone/render/_component.py +35 -0
- hyperdrone/render/_config.py +90 -0
- hyperdrone/render/_renderer.py +306 -0
- hyperdrone/render/_scene.py +34 -0
- hyperdrone-0.1.0.dist-info/METADATA +15 -0
- hyperdrone-0.1.0.dist-info/RECORD +660 -0
- hyperdrone-0.1.0.dist-info/WHEEL +4 -0
hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h
ADDED
|
@@ -0,0 +1,1678 @@
|
|
|
1
|
+
#include "../../../../version.h"
|
|
2
|
+
#include "../../../../rl_tools.h"
|
|
3
|
+
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_RENDERING_RAYTRACING_BACKENDS_OPTIX_OPERATIONS_CUDA_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
|
|
4
|
+
#pragma once
|
|
5
|
+
#define RL_TOOLS_RENDERING_RAYTRACING_BACKENDS_OPTIX_OPERATIONS_CUDA_H
|
|
6
|
+
|
|
7
|
+
#include "../../renderer.h"
|
|
8
|
+
#include "../../operations_cpu_common.h"
|
|
9
|
+
#include "device.h"
|
|
10
|
+
#include "overlay_accel.h"
|
|
11
|
+
|
|
12
|
+
#include "owl/owl.h"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
#include <vector>
|
|
16
|
+
#include <limits>
|
|
17
|
+
#include <algorithm>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <map>
|
|
21
|
+
#include <chrono>
|
|
22
|
+
#include <cmath>
|
|
23
|
+
#include <cstring>
|
|
24
|
+
#include <cuda_runtime.h>
|
|
25
|
+
|
|
26
|
+
RL_TOOLS_NAMESPACE_WRAPPER_START
|
|
27
|
+
namespace rl_tools {
|
|
28
|
+
extern "C" char device_ptx[];
|
|
29
|
+
extern "C" char device_depth_ptx[];
|
|
30
|
+
extern "C" char device_segmentation_ptx[];
|
|
31
|
+
extern "C" char device_depth_segmentation_ptx[];
|
|
32
|
+
extern "C" char device_normals_ptx[];
|
|
33
|
+
extern "C" char device_depth_normals_ptx[];
|
|
34
|
+
extern "C" char device_segmentation_normals_ptx[];
|
|
35
|
+
extern "C" char device_depth_segmentation_normals_ptx[];
|
|
36
|
+
|
|
37
|
+
namespace rendering::raytracing::backends::optix {
|
|
38
|
+
// inactive overlay slots point at a shared degenerate-triangle BLAS, so every overlay
|
|
39
|
+
// TLAS keeps a fixed instance count and instance-id layout across rebuilds
|
|
40
|
+
struct OverlayState {
|
|
41
|
+
std::vector<OWLGroup> object_groups;
|
|
42
|
+
OWLGroup filler_group = nullptr;
|
|
43
|
+
OverlayAccelState* accel = nullptr;
|
|
44
|
+
OWLBuffer traversables_buffer = nullptr;
|
|
45
|
+
OWLBuffer attachments_buffer = nullptr;
|
|
46
|
+
OWLBuffer instance_classes_buffer = nullptr;
|
|
47
|
+
// pageable staging for host-verb writes: cudaMemcpyAsync returns only after pageable
|
|
48
|
+
// sources are consumed, so rows can be rewritten on the next update without hazards
|
|
49
|
+
std::vector<OverlaySlotStructure> structure_staging;
|
|
50
|
+
std::vector<float> transforms_staging;
|
|
51
|
+
size_t num_scene_instances = 0;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
namespace rendering::raytracing::backends {
|
|
56
|
+
template <typename SPEC>
|
|
57
|
+
struct RendererState<rendering::raytracing::backends::Optix, SPEC> {
|
|
58
|
+
OWLContext context = nullptr;
|
|
59
|
+
OWLModule module = nullptr;
|
|
60
|
+
OWLBuffer cameras_buffer = nullptr;
|
|
61
|
+
OWLBuffer cameras_open_buffer = nullptr;
|
|
62
|
+
OWLGroup world = nullptr;
|
|
63
|
+
OWLParams launch_params = nullptr;
|
|
64
|
+
OWLRayGen collision_ray_gen = nullptr;
|
|
65
|
+
OWLBuffer collision_results_buffer = nullptr;
|
|
66
|
+
OWLBuffer probe_dirs_buffer = nullptr;
|
|
67
|
+
OWLParams coll_launch_params = nullptr;
|
|
68
|
+
optix::OverlayState* overlay_state = nullptr;
|
|
69
|
+
OWLRayGen ray_gen = nullptr;
|
|
70
|
+
OWLBuffer frame_buffer = nullptr;
|
|
71
|
+
OWLRayGen depth_ray_gen = nullptr;
|
|
72
|
+
OWLBuffer depth_buffer = nullptr;
|
|
73
|
+
OWLRayGen segmentation_ray_gen = nullptr;
|
|
74
|
+
OWLBuffer segmentation_buffer = nullptr;
|
|
75
|
+
OWLRayGen normals_ray_gen = nullptr;
|
|
76
|
+
OWLBuffer normals_buffer = nullptr;
|
|
77
|
+
OWLBuffer observation_buffer = nullptr;
|
|
78
|
+
OWLBuffer rgb_accumulator_buffer = nullptr;
|
|
79
|
+
OWLBuffer depth_accumulator_buffer = nullptr;
|
|
80
|
+
float* shutter_device = nullptr; // per-pass shutter time, written by the overlay fill kernel
|
|
81
|
+
rendering::raytracing::AssetLibrary<SPEC, rendering::raytracing::backends::Optix>* library = nullptr;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
template <typename SPEC>
|
|
85
|
+
struct LibraryState<rendering::raytracing::backends::Optix, SPEC> {
|
|
86
|
+
OWLContext context = nullptr;
|
|
87
|
+
OWLModule module = nullptr;
|
|
88
|
+
OWLGeomType geom_type = nullptr;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
template <typename SPEC>
|
|
92
|
+
struct SceneState<rendering::raytracing::backends::Optix, SPEC> {
|
|
93
|
+
OWLGroup world = nullptr;
|
|
94
|
+
OWLBuffer instance_classes_buffer = nullptr;
|
|
95
|
+
OWLGroup filler_group = nullptr;
|
|
96
|
+
std::vector<OWLGroup> object_groups;
|
|
97
|
+
size_t num_scene_instances = 0;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
namespace rendering::raytracing::detail {
|
|
102
|
+
template <bool T_DEPTH, typename SPEC>
|
|
103
|
+
const char* ray_gen_program_name(const char* depth_name, const char* srgb_name, const char* linear_name) {
|
|
104
|
+
if constexpr (T_DEPTH) {
|
|
105
|
+
return depth_name;
|
|
106
|
+
}
|
|
107
|
+
else if constexpr (SPEC::SHADING::SRGB_OUTPUT) {
|
|
108
|
+
return srgb_name;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return linear_name;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
template <bool T_DEPTH, typename SPEC>
|
|
116
|
+
const char* ray_gen_program_name() {
|
|
117
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
118
|
+
// the motion loop runs at launch level (one pass per sample), so only the AA grid
|
|
119
|
+
// is compiled in; accumulation is linear, srgb/linear resolve happens later
|
|
120
|
+
if constexpr (SPEC::ENABLE_ANTI_ALIASING) {
|
|
121
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
122
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthAccumRayGenAA2", "accumRayGenAA2", "accumRayGenAA2");
|
|
123
|
+
}
|
|
124
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
125
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthAccumRayGenAA3", "accumRayGenAA3", "accumRayGenAA3");
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthAccumRayGenAA4", "accumRayGenAA4", "accumRayGenAA4");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthAccumRayGen", "accumRayGen", "accumRayGen");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
136
|
+
if constexpr (SPEC::ENABLE_ANTI_ALIASING) {
|
|
137
|
+
if constexpr (SPEC::MOTION_BLUR_SAMPLES == 2) {
|
|
138
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
139
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur2AA2", "simpleRayGenMotionBlur2AA2", "linearRayGenMotionBlur2AA2");
|
|
140
|
+
}
|
|
141
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
142
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur2AA3", "simpleRayGenMotionBlur2AA3", "linearRayGenMotionBlur2AA3");
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur2AA4", "simpleRayGenMotionBlur2AA4", "linearRayGenMotionBlur2AA4");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 4) {
|
|
149
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
150
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur4AA2", "simpleRayGenMotionBlur4AA2", "linearRayGenMotionBlur4AA2");
|
|
151
|
+
}
|
|
152
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
153
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur4AA3", "simpleRayGenMotionBlur4AA3", "linearRayGenMotionBlur4AA3");
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur4AA4", "simpleRayGenMotionBlur4AA4", "linearRayGenMotionBlur4AA4");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 8) {
|
|
160
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
161
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur8AA2", "simpleRayGenMotionBlur8AA2", "linearRayGenMotionBlur8AA2");
|
|
162
|
+
}
|
|
163
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
164
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur8AA3", "simpleRayGenMotionBlur8AA3", "linearRayGenMotionBlur8AA3");
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur8AA4", "simpleRayGenMotionBlur8AA4", "linearRayGenMotionBlur8AA4");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 16) {
|
|
171
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
172
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur16AA2", "simpleRayGenMotionBlur16AA2", "linearRayGenMotionBlur16AA2");
|
|
173
|
+
}
|
|
174
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
175
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur16AA3", "simpleRayGenMotionBlur16AA3", "linearRayGenMotionBlur16AA3");
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur16AA4", "simpleRayGenMotionBlur16AA4", "linearRayGenMotionBlur16AA4");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
183
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur32AA2", "simpleRayGenMotionBlur32AA2", "linearRayGenMotionBlur32AA2");
|
|
184
|
+
}
|
|
185
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
186
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur32AA3", "simpleRayGenMotionBlur32AA3", "linearRayGenMotionBlur32AA3");
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur32AA4", "simpleRayGenMotionBlur32AA4", "linearRayGenMotionBlur32AA4");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 2) {
|
|
194
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur2", "simpleRayGenMotionBlur2", "linearRayGenMotionBlur2");
|
|
195
|
+
}
|
|
196
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 4) {
|
|
197
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur4", "simpleRayGenMotionBlur4", "linearRayGenMotionBlur4");
|
|
198
|
+
}
|
|
199
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 8) {
|
|
200
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur8", "simpleRayGenMotionBlur8", "linearRayGenMotionBlur8");
|
|
201
|
+
}
|
|
202
|
+
else if constexpr (SPEC::MOTION_BLUR_SAMPLES == 16) {
|
|
203
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur16", "simpleRayGenMotionBlur16", "linearRayGenMotionBlur16");
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenMotionBlur32", "simpleRayGenMotionBlur32", "linearRayGenMotionBlur32");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else if constexpr (SPEC::ENABLE_ANTI_ALIASING) {
|
|
210
|
+
if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 2) {
|
|
211
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenAA2", "simpleRayGenAA2", "linearRayGenAA2");
|
|
212
|
+
}
|
|
213
|
+
else if constexpr (SPEC::ANTI_ALIASING_GRID_SIZE == 3) {
|
|
214
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenAA3", "simpleRayGenAA3", "linearRayGenAA3");
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGenAA4", "simpleRayGenAA4", "linearRayGenAA4");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
return ray_gen_program_name<T_DEPTH, SPEC>("depthRayGen", "simpleRayGen", "linearRayGen");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
template <typename SPEC>
|
|
226
|
+
const char* closest_hit_program_name() {
|
|
227
|
+
if constexpr (SPEC::SHADING::PBR_SHADING) {
|
|
228
|
+
return SPEC::SHADING::PUNCTUAL_LIGHT_SHADOWS ? "TriangleMeshPBRShadows" : "TriangleMeshPBR";
|
|
229
|
+
}
|
|
230
|
+
else if constexpr (SPEC::SHADING::LOAD_TEXTURES) {
|
|
231
|
+
if constexpr (SPEC::SHADING::NORMAL_SHADING) {
|
|
232
|
+
return SPEC::SHADING::METALLIC_REFLECTIONS ? "TriangleMeshBasicTTT" : "TriangleMeshBasicTTF";
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return SPEC::SHADING::METALLIC_REFLECTIONS ? "TriangleMeshBasicTFT" : "TriangleMeshBasicTFF";
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
if constexpr (SPEC::SHADING::NORMAL_SHADING) {
|
|
240
|
+
return SPEC::SHADING::METALLIC_REFLECTIONS ? "TriangleMeshBasicFTT" : "TriangleMeshBasicFTF";
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
return SPEC::SHADING::METALLIC_REFLECTIONS ? "TriangleMeshBasicFFT" : "TriangleMeshBasicFFF";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
template <typename SPEC>
|
|
249
|
+
struct MediumShadingUsage {
|
|
250
|
+
static constexpr bool USES_INDEX = SPEC::SHADING::LOAD_TEXTURES || SPEC::SHADING::NORMAL_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS;
|
|
251
|
+
static constexpr bool USES_VERTEX = SPEC::SHADING::NORMAL_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS;
|
|
252
|
+
static constexpr bool USES_TEXTURE = SPEC::SHADING::LOAD_TEXTURES;
|
|
253
|
+
static constexpr bool USES_WORLD = SPEC::SHADING::METALLIC_REFLECTIONS;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// =========================================================================
|
|
258
|
+
// malloc: create OWL context and allocate buffers
|
|
259
|
+
// =========================================================================
|
|
260
|
+
namespace rendering::raytracing::backends::optix{
|
|
261
|
+
// context-scoped resources (context, module, miss programs): created once per renderer
|
|
262
|
+
// in standalone mode, once per AssetLibrary in shared mode
|
|
263
|
+
template <typename SPEC>
|
|
264
|
+
void create_context_resources(OWLContext& context_out, OWLModule& module_out){
|
|
265
|
+
OWLContext context = owlContextCreate(nullptr, 1);
|
|
266
|
+
// ray type 2 (normals) only exists in the normals-enabled PTX variants; the count
|
|
267
|
+
// must match the NUM_RAY_TYPES the selected PTX was compiled with (SBT stride)
|
|
268
|
+
owlContextSetRayTypeCount(context, SPEC::HAS_NORMALS ? 3 : 2);
|
|
269
|
+
owlContextSetNumPayloadValues(context, 4); // color ptr (2), recursion depth, hit distance
|
|
270
|
+
const char* ptx = nullptr;
|
|
271
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
272
|
+
if constexpr (SPEC::HAS_SEGMENTATION && SPEC::HAS_DEPTH) {
|
|
273
|
+
ptx = device_depth_segmentation_normals_ptx;
|
|
274
|
+
}
|
|
275
|
+
else if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
276
|
+
ptx = device_segmentation_normals_ptx;
|
|
277
|
+
}
|
|
278
|
+
else if constexpr (SPEC::HAS_DEPTH) {
|
|
279
|
+
ptx = device_depth_normals_ptx;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
ptx = device_normals_ptx;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else if constexpr (SPEC::HAS_SEGMENTATION && SPEC::HAS_DEPTH) {
|
|
286
|
+
ptx = device_depth_segmentation_ptx;
|
|
287
|
+
}
|
|
288
|
+
else if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
289
|
+
ptx = device_segmentation_ptx;
|
|
290
|
+
}
|
|
291
|
+
else if constexpr (SPEC::HAS_DEPTH) {
|
|
292
|
+
ptx = device_depth_ptx;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
ptx = device_ptx;
|
|
296
|
+
}
|
|
297
|
+
OWLModule module = owlModuleCreate(context, ptx);
|
|
298
|
+
|
|
299
|
+
// RGB miss program (ray type 0)
|
|
300
|
+
OWLVarDecl miss_prog_vars[] = {
|
|
301
|
+
{ "color_0", OWL_FLOAT3, OWL_OFFSETOF(MissProgData, color_0)},
|
|
302
|
+
{ "color_1", OWL_FLOAT3, OWL_OFFSETOF(MissProgData, color_1)},
|
|
303
|
+
{ /* sentinel */ }
|
|
304
|
+
};
|
|
305
|
+
const char* miss_program_name = "miss";
|
|
306
|
+
if constexpr (SPEC::HAS_RGB && !SPEC::SHADING::CHECKER_BACKGROUND) {
|
|
307
|
+
miss_program_name = "missConstant";
|
|
308
|
+
}
|
|
309
|
+
OWLMissProg miss_prog = owlMissProgCreate(context, module, miss_program_name,
|
|
310
|
+
sizeof(MissProgData), miss_prog_vars, -1);
|
|
311
|
+
if constexpr (SPEC::HAS_RGB && SPEC::SHADING::PBR_SHADING) {
|
|
312
|
+
owlMissProgSet3f(miss_prog, "color_0", owl3f{0.f, 0.f, 0.f});
|
|
313
|
+
owlMissProgSet3f(miss_prog, "color_1", owl3f{0.f, 0.f, 0.f});
|
|
314
|
+
} else {
|
|
315
|
+
owlMissProgSet3f(miss_prog, "color_0", owl3f{.8f, 0.f, 0.f});
|
|
316
|
+
owlMissProgSet3f(miss_prog, "color_1", owl3f{.8f, .8f, .8f});
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Collision miss program (ray type 1) — always registered to keep SBT consistent
|
|
320
|
+
OWLVarDecl collision_miss_vars[] = {
|
|
321
|
+
{ "dummy", OWL_INT, OWL_OFFSETOF(CollisionMissData, dummy)},
|
|
322
|
+
{ /* sentinel */ }
|
|
323
|
+
};
|
|
324
|
+
OWLMissProg collision_miss_prog = owlMissProgCreate(context, module, "collisionMiss",
|
|
325
|
+
sizeof(CollisionMissData), collision_miss_vars, -1);
|
|
326
|
+
(void)collision_miss_prog;
|
|
327
|
+
|
|
328
|
+
context_out = context;
|
|
329
|
+
module_out = module;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
namespace rendering::raytracing::backends::optix::detail{
|
|
334
|
+
// everything renderer-private: framebuffers, cameras, ray gens, collision resources
|
|
335
|
+
template <typename DEVICE, typename SPEC>
|
|
336
|
+
void malloc_renderer(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, OWLContext context, OWLModule module){
|
|
337
|
+
using TI = typename SPEC::TI;
|
|
338
|
+
|
|
339
|
+
if constexpr (SPEC::ENABLE_OVERLAYS) {
|
|
340
|
+
// device-resident transform input (see transforms(device, renderer)): producers write
|
|
341
|
+
// it directly, update_launch consumes it on the render stream
|
|
342
|
+
using TRANSFORMS_SPEC = typename decltype(renderer.transforms)::SPEC;
|
|
343
|
+
float* transforms_device = nullptr;
|
|
344
|
+
cudaMalloc(&transforms_device, TRANSFORMS_SPEC::SIZE_BYTES);
|
|
345
|
+
cudaMemset(transforms_device, 0, TRANSFORMS_SPEC::SIZE_BYTES);
|
|
346
|
+
renderer.transforms._data = transforms_device;
|
|
347
|
+
}
|
|
348
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
349
|
+
using TRANSFORMS_MOTION_SPEC = typename decltype(renderer.transforms_motion)::SPEC;
|
|
350
|
+
float* transforms_motion_device = nullptr;
|
|
351
|
+
cudaMalloc(&transforms_motion_device, TRANSFORMS_MOTION_SPEC::SIZE_BYTES);
|
|
352
|
+
cudaMemset(transforms_motion_device, 0, TRANSFORMS_MOTION_SPEC::SIZE_BYTES);
|
|
353
|
+
renderer.transforms_motion._data = transforms_motion_device;
|
|
354
|
+
using TRANSFORMS_PAIR_SPEC = typename decltype(renderer.transforms_pair)::SPEC;
|
|
355
|
+
float* transforms_pair_device = nullptr;
|
|
356
|
+
cudaMalloc(&transforms_pair_device, TRANSFORMS_PAIR_SPEC::SIZE_BYTES);
|
|
357
|
+
cudaMemset(transforms_pair_device, 0, TRANSFORMS_PAIR_SPEC::SIZE_BYTES);
|
|
358
|
+
renderer.transforms_pair._data = transforms_pair_device;
|
|
359
|
+
renderer.transforms_motion_staging.assign((size_t)SPEC::MOTION_BLUR_SAMPLES * SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES * 12, 0.0f);
|
|
360
|
+
cudaMalloc(&renderer.backend->shutter_device, sizeof(float));
|
|
361
|
+
cudaMemset(renderer.backend->shutter_device, 0, sizeof(float));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
constexpr TI cam_pixels = SPEC::CAM_PIXELS;
|
|
365
|
+
// device-resident outputs (see frame_buffer/depth_buffer/segmentation_buffer/observation
|
|
366
|
+
// accessors): the tensors alias the OWL buffers the ray gens write, so device consumers
|
|
367
|
+
// read them in place and host readers stage through an explicit copy
|
|
368
|
+
OWLBuffer frame_buffer = nullptr;
|
|
369
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
370
|
+
frame_buffer = owlDeviceBufferCreate(context, OWL_INT,
|
|
371
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels, nullptr);
|
|
372
|
+
renderer.frame_buffer._data = (uint32_t*)owlBufferGetPointer(frame_buffer, 0);
|
|
373
|
+
}
|
|
374
|
+
OWLBuffer observation_buffer = nullptr;
|
|
375
|
+
if constexpr (SPEC::HAS_OBSERVATION) {
|
|
376
|
+
static_assert(utils::typing::is_same_v<typename SPEC::OBSERVATION_T, float>, "The OptiX raytracing backend requires OBSERVATION_T = float");
|
|
377
|
+
observation_buffer = owlDeviceBufferCreate(context, OWL_FLOAT,
|
|
378
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels * SPEC::OBSERVATION_CHANNELS, nullptr);
|
|
379
|
+
renderer.backend->observation_buffer = observation_buffer;
|
|
380
|
+
renderer.observation._data = (float*)owlBufferGetPointer(observation_buffer, 0);
|
|
381
|
+
}
|
|
382
|
+
OWLBuffer depth_buffer = nullptr;
|
|
383
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
384
|
+
depth_buffer = owlDeviceBufferCreate(context, OWL_FLOAT,
|
|
385
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels, nullptr);
|
|
386
|
+
renderer.depth_buffer._data = (float*)owlBufferGetPointer(depth_buffer, 0);
|
|
387
|
+
}
|
|
388
|
+
OWLBuffer segmentation_buffer = nullptr;
|
|
389
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
390
|
+
segmentation_buffer = owlDeviceBufferCreate(context, OWL_UINT,
|
|
391
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels, nullptr);
|
|
392
|
+
renderer.segmentation_buffer._data = (uint32_t*)owlBufferGetPointer(segmentation_buffer, 0);
|
|
393
|
+
}
|
|
394
|
+
OWLBuffer normals_buffer = nullptr;
|
|
395
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
396
|
+
normals_buffer = owlDeviceBufferCreate(context, OWL_FLOAT,
|
|
397
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels * 3, nullptr);
|
|
398
|
+
renderer.normals_buffer._data = (float*)owlBufferGetPointer(normals_buffer, 0);
|
|
399
|
+
}
|
|
400
|
+
OWLBuffer rgb_accumulator_buffer = nullptr;
|
|
401
|
+
OWLBuffer depth_accumulator_buffer = nullptr;
|
|
402
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
403
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
404
|
+
rgb_accumulator_buffer = owlDeviceBufferCreate(context, OWL_FLOAT,
|
|
405
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels * 3, nullptr);
|
|
406
|
+
renderer.backend->rgb_accumulator_buffer = rgb_accumulator_buffer;
|
|
407
|
+
renderer.rgb_accumulator._data = (float*)owlBufferGetPointer(rgb_accumulator_buffer, 0);
|
|
408
|
+
}
|
|
409
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
410
|
+
depth_accumulator_buffer = owlDeviceBufferCreate(context, OWL_FLOAT,
|
|
411
|
+
(size_t)SPEC::NUM_CAMERAS * cam_pixels, nullptr);
|
|
412
|
+
renderer.backend->depth_accumulator_buffer = depth_accumulator_buffer;
|
|
413
|
+
renderer.depth_accumulator._data = (float*)owlBufferGetPointer(depth_accumulator_buffer, 0);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
OWLRayGen ray_gen = nullptr;
|
|
418
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
419
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
420
|
+
OWLVarDecl ray_gen_vars[] = {
|
|
421
|
+
{ "accum_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(AccumulateRayGenData, accum_ptr)},
|
|
422
|
+
{ "shutter_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(AccumulateRayGenData, shutter_ptr)},
|
|
423
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(AccumulateRayGenData, fb_size)},
|
|
424
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(AccumulateRayGenData, cam_size)},
|
|
425
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(AccumulateRayGenData, grid_cols)},
|
|
426
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(AccumulateRayGenData, num_cameras)},
|
|
427
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(AccumulateRayGenData, world)},
|
|
428
|
+
{ "cameras_open", OWL_BUFPTR, OWL_OFFSETOF(AccumulateRayGenData, cameras_open)},
|
|
429
|
+
{ "cameras_close", OWL_BUFPTR, OWL_OFFSETOF(AccumulateRayGenData, cameras_close)},
|
|
430
|
+
{ /* sentinel */ }
|
|
431
|
+
};
|
|
432
|
+
const char* ray_gen_name = rendering::raytracing::detail::ray_gen_program_name<false, SPEC>();
|
|
433
|
+
ray_gen = owlRayGenCreate(context, module, ray_gen_name,
|
|
434
|
+
sizeof(AccumulateRayGenData), ray_gen_vars, -1);
|
|
435
|
+
}
|
|
436
|
+
else if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
437
|
+
OWLVarDecl ray_gen_vars[] = {
|
|
438
|
+
{ "fb_ptr", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurRayGenData, fb_ptr)},
|
|
439
|
+
{ "obs_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(MotionBlurRayGenData, obs_ptr)},
|
|
440
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(MotionBlurRayGenData, fb_size)},
|
|
441
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(MotionBlurRayGenData, cam_size)},
|
|
442
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(MotionBlurRayGenData, grid_cols)},
|
|
443
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(MotionBlurRayGenData, num_cameras)},
|
|
444
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(MotionBlurRayGenData, world)},
|
|
445
|
+
{ "cameras_open", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurRayGenData, cameras_open)},
|
|
446
|
+
{ "cameras_close", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurRayGenData, cameras_close)},
|
|
447
|
+
{ /* sentinel */ }
|
|
448
|
+
};
|
|
449
|
+
const char* ray_gen_name = rendering::raytracing::detail::ray_gen_program_name<false, SPEC>();
|
|
450
|
+
ray_gen = owlRayGenCreate(context, module, ray_gen_name,
|
|
451
|
+
sizeof(MotionBlurRayGenData), ray_gen_vars, -1);
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
OWLVarDecl ray_gen_vars[] = {
|
|
455
|
+
{ "fb_ptr", OWL_BUFPTR, OWL_OFFSETOF(RayGenData, fb_ptr)},
|
|
456
|
+
{ "obs_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(RayGenData, obs_ptr)},
|
|
457
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(RayGenData, fb_size)},
|
|
458
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(RayGenData, cam_size)},
|
|
459
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(RayGenData, grid_cols)},
|
|
460
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(RayGenData, num_cameras)},
|
|
461
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(RayGenData, world)},
|
|
462
|
+
{ "cameras", OWL_BUFPTR, OWL_OFFSETOF(RayGenData, cameras)},
|
|
463
|
+
{ /* sentinel */ }
|
|
464
|
+
};
|
|
465
|
+
const char* ray_gen_name = rendering::raytracing::detail::ray_gen_program_name<false, SPEC>();
|
|
466
|
+
ray_gen = owlRayGenCreate(context, module, ray_gen_name,
|
|
467
|
+
sizeof(RayGenData), ray_gen_vars, -1);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
OWLRayGen depth_ray_gen = nullptr;
|
|
472
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
473
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
474
|
+
OWLVarDecl depth_ray_gen_vars[] = {
|
|
475
|
+
{ "depth_accum_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(AccumulateDepthRayGenData, depth_accum_ptr)},
|
|
476
|
+
{ "shutter_ptr", OWL_RAW_POINTER, OWL_OFFSETOF(AccumulateDepthRayGenData, shutter_ptr)},
|
|
477
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(AccumulateDepthRayGenData, fb_size)},
|
|
478
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(AccumulateDepthRayGenData, cam_size)},
|
|
479
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(AccumulateDepthRayGenData, grid_cols)},
|
|
480
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(AccumulateDepthRayGenData, num_cameras)},
|
|
481
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(AccumulateDepthRayGenData, world)},
|
|
482
|
+
{ "cameras_open", OWL_BUFPTR, OWL_OFFSETOF(AccumulateDepthRayGenData, cameras_open)},
|
|
483
|
+
{ "cameras_close", OWL_BUFPTR, OWL_OFFSETOF(AccumulateDepthRayGenData, cameras_close)},
|
|
484
|
+
{ "max_depth", OWL_FLOAT, OWL_OFFSETOF(AccumulateDepthRayGenData, max_depth)},
|
|
485
|
+
{ /* sentinel */ }
|
|
486
|
+
};
|
|
487
|
+
depth_ray_gen = owlRayGenCreate(context, module, rendering::raytracing::detail::ray_gen_program_name<true, SPEC>(),
|
|
488
|
+
sizeof(AccumulateDepthRayGenData), depth_ray_gen_vars, -1);
|
|
489
|
+
}
|
|
490
|
+
else if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
491
|
+
OWLVarDecl depth_ray_gen_vars[] = {
|
|
492
|
+
{ "depth_ptr", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurDepthRayGenData, depth_ptr)},
|
|
493
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(MotionBlurDepthRayGenData, fb_size)},
|
|
494
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(MotionBlurDepthRayGenData, cam_size)},
|
|
495
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(MotionBlurDepthRayGenData, grid_cols)},
|
|
496
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(MotionBlurDepthRayGenData, num_cameras)},
|
|
497
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(MotionBlurDepthRayGenData, world)},
|
|
498
|
+
{ "cameras_open", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurDepthRayGenData, cameras_open)},
|
|
499
|
+
{ "cameras_close", OWL_BUFPTR, OWL_OFFSETOF(MotionBlurDepthRayGenData, cameras_close)},
|
|
500
|
+
{ "max_depth", OWL_FLOAT, OWL_OFFSETOF(MotionBlurDepthRayGenData, max_depth)},
|
|
501
|
+
{ /* sentinel */ }
|
|
502
|
+
};
|
|
503
|
+
depth_ray_gen = owlRayGenCreate(context, module, rendering::raytracing::detail::ray_gen_program_name<true, SPEC>(),
|
|
504
|
+
sizeof(MotionBlurDepthRayGenData), depth_ray_gen_vars, -1);
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
OWLVarDecl depth_ray_gen_vars[] = {
|
|
508
|
+
{ "depth_ptr", OWL_BUFPTR, OWL_OFFSETOF(DepthRayGenData, depth_ptr)},
|
|
509
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(DepthRayGenData, fb_size)},
|
|
510
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(DepthRayGenData, cam_size)},
|
|
511
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(DepthRayGenData, grid_cols)},
|
|
512
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(DepthRayGenData, num_cameras)},
|
|
513
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(DepthRayGenData, world)},
|
|
514
|
+
{ "cameras", OWL_BUFPTR, OWL_OFFSETOF(DepthRayGenData, cameras)},
|
|
515
|
+
{ "max_depth", OWL_FLOAT, OWL_OFFSETOF(DepthRayGenData, max_depth)},
|
|
516
|
+
{ /* sentinel */ }
|
|
517
|
+
};
|
|
518
|
+
depth_ray_gen = owlRayGenCreate(context, module, rendering::raytracing::detail::ray_gen_program_name<true, SPEC>(),
|
|
519
|
+
sizeof(DepthRayGenData), depth_ray_gen_vars, -1);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
OWLRayGen segmentation_ray_gen = nullptr;
|
|
524
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
525
|
+
OWLVarDecl segmentation_ray_gen_vars[] = {
|
|
526
|
+
{ "seg_ptr", OWL_BUFPTR, OWL_OFFSETOF(SegmentationRayGenData, seg_ptr)},
|
|
527
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(SegmentationRayGenData, fb_size)},
|
|
528
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(SegmentationRayGenData, cam_size)},
|
|
529
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(SegmentationRayGenData, grid_cols)},
|
|
530
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(SegmentationRayGenData, num_cameras)},
|
|
531
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(SegmentationRayGenData, world)},
|
|
532
|
+
{ "cameras", OWL_BUFPTR, OWL_OFFSETOF(SegmentationRayGenData, cameras)},
|
|
533
|
+
{ /* sentinel */ }
|
|
534
|
+
};
|
|
535
|
+
segmentation_ray_gen = owlRayGenCreate(context, module, "segmentationRayGen",
|
|
536
|
+
sizeof(SegmentationRayGenData), segmentation_ray_gen_vars, -1);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
OWLRayGen normals_ray_gen = nullptr;
|
|
540
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
541
|
+
OWLVarDecl normals_ray_gen_vars[] = {
|
|
542
|
+
{ "normals_ptr", OWL_BUFPTR, OWL_OFFSETOF(NormalsRayGenData, normals_ptr)},
|
|
543
|
+
{ "fb_size", OWL_INT2, OWL_OFFSETOF(NormalsRayGenData, fb_size)},
|
|
544
|
+
{ "cam_size", OWL_INT2, OWL_OFFSETOF(NormalsRayGenData, cam_size)},
|
|
545
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(NormalsRayGenData, grid_cols)},
|
|
546
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(NormalsRayGenData, num_cameras)},
|
|
547
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(NormalsRayGenData, world)},
|
|
548
|
+
{ "cameras", OWL_BUFPTR, OWL_OFFSETOF(NormalsRayGenData, cameras)},
|
|
549
|
+
{ /* sentinel */ }
|
|
550
|
+
};
|
|
551
|
+
normals_ray_gen = owlRayGenCreate(context, module, "normalsRayGen",
|
|
552
|
+
sizeof(NormalsRayGenData), normals_ray_gen_vars, -1);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
const owl2i fb_size = {(int)SPEC::FB_WIDTH, (int)SPEC::FB_HEIGHT};
|
|
556
|
+
const owl2i cam_size = {(int)SPEC::CAM_WIDTH, (int)SPEC::CAM_HEIGHT};
|
|
557
|
+
|
|
558
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
559
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
560
|
+
owlRayGenSetPointer(ray_gen, "accum_ptr", owlBufferGetPointer(rgb_accumulator_buffer, 0));
|
|
561
|
+
owlRayGenSetPointer(ray_gen, "shutter_ptr", renderer.backend->shutter_device);
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
owlRayGenSetBuffer(ray_gen, "fb_ptr", frame_buffer);
|
|
565
|
+
owlRayGenSetPointer(ray_gen, "obs_ptr", SPEC::HAS_OBSERVATION ? owlBufferGetPointer(observation_buffer, 0) : nullptr);
|
|
566
|
+
}
|
|
567
|
+
owlRayGenSet2i (ray_gen, "fb_size", fb_size);
|
|
568
|
+
owlRayGenSet2i (ray_gen, "cam_size", cam_size);
|
|
569
|
+
owlRayGenSet1i (ray_gen, "grid_cols", SPEC::GRID_COLS);
|
|
570
|
+
owlRayGenSet1i (ray_gen, "num_cameras", SPEC::NUM_CAMERAS);
|
|
571
|
+
}
|
|
572
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
573
|
+
owlRayGenSetBuffer(segmentation_ray_gen, "seg_ptr", segmentation_buffer);
|
|
574
|
+
owlRayGenSet2i (segmentation_ray_gen, "fb_size", fb_size);
|
|
575
|
+
owlRayGenSet2i (segmentation_ray_gen, "cam_size", cam_size);
|
|
576
|
+
owlRayGenSet1i (segmentation_ray_gen, "grid_cols", SPEC::GRID_COLS);
|
|
577
|
+
owlRayGenSet1i (segmentation_ray_gen, "num_cameras", SPEC::NUM_CAMERAS);
|
|
578
|
+
renderer.backend->segmentation_ray_gen = segmentation_ray_gen;
|
|
579
|
+
renderer.backend->segmentation_buffer = segmentation_buffer;
|
|
580
|
+
}
|
|
581
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
582
|
+
owlRayGenSetBuffer(normals_ray_gen, "normals_ptr", normals_buffer);
|
|
583
|
+
owlRayGenSet2i (normals_ray_gen, "fb_size", fb_size);
|
|
584
|
+
owlRayGenSet2i (normals_ray_gen, "cam_size", cam_size);
|
|
585
|
+
owlRayGenSet1i (normals_ray_gen, "grid_cols", SPEC::GRID_COLS);
|
|
586
|
+
owlRayGenSet1i (normals_ray_gen, "num_cameras", SPEC::NUM_CAMERAS);
|
|
587
|
+
renderer.backend->normals_ray_gen = normals_ray_gen;
|
|
588
|
+
renderer.backend->normals_buffer = normals_buffer;
|
|
589
|
+
}
|
|
590
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
591
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR) {
|
|
592
|
+
owlRayGenSetPointer(depth_ray_gen, "depth_accum_ptr", owlBufferGetPointer(depth_accumulator_buffer, 0));
|
|
593
|
+
owlRayGenSetPointer(depth_ray_gen, "shutter_ptr", renderer.backend->shutter_device);
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
owlRayGenSetBuffer(depth_ray_gen, "depth_ptr", depth_buffer);
|
|
597
|
+
}
|
|
598
|
+
owlRayGenSet2i (depth_ray_gen, "fb_size", fb_size);
|
|
599
|
+
owlRayGenSet2i (depth_ray_gen, "cam_size", cam_size);
|
|
600
|
+
owlRayGenSet1i (depth_ray_gen, "grid_cols", SPEC::GRID_COLS);
|
|
601
|
+
owlRayGenSet1i (depth_ray_gen, "num_cameras", SPEC::NUM_CAMERAS);
|
|
602
|
+
owlRayGenSet1f (depth_ray_gen, "max_depth", 1e30f);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// The raygen-referenced buffers are created here so every raygen variable is set before
|
|
606
|
+
// init builds the SBT: OWL serializes raygen variables into the SBT records only during
|
|
607
|
+
// owlBuildSBT, so anything set later would be baked in as null.
|
|
608
|
+
OWLBuffer cameras_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(OptixCameraData), SPEC::NUM_CAMERAS, nullptr);
|
|
609
|
+
// device-resident camera input (see cameras(device, renderer)): the tensors alias the
|
|
610
|
+
// OWL buffers the ray gens bind, so producer writes are consumed with no copy
|
|
611
|
+
renderer.cameras._data = (rendering::raytracing::Camera<typename SPEC::T>*)owlBufferGetPointer(cameras_buffer, 0);
|
|
612
|
+
OWLBuffer cameras_open_buffer = nullptr;
|
|
613
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
614
|
+
cameras_open_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(OptixCameraData), SPEC::NUM_CAMERAS, nullptr);
|
|
615
|
+
renderer.backend->cameras_open_buffer = cameras_open_buffer;
|
|
616
|
+
renderer.cameras_open._data = (rendering::raytracing::Camera<typename SPEC::T>*)owlBufferGetPointer(cameras_open_buffer, 0);
|
|
617
|
+
}
|
|
618
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
619
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
620
|
+
owlRayGenSetBuffer(ray_gen, "cameras_open", cameras_open_buffer);
|
|
621
|
+
owlRayGenSetBuffer(ray_gen, "cameras_close", cameras_buffer);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
owlRayGenSetBuffer(ray_gen, "cameras", cameras_buffer);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
628
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
629
|
+
owlRayGenSetBuffer(depth_ray_gen, "cameras_open", cameras_open_buffer);
|
|
630
|
+
owlRayGenSetBuffer(depth_ray_gen, "cameras_close", cameras_buffer);
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
owlRayGenSetBuffer(depth_ray_gen, "cameras", cameras_buffer);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
637
|
+
owlRayGenSetBuffer(segmentation_ray_gen, "cameras", cameras_buffer);
|
|
638
|
+
}
|
|
639
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
640
|
+
owlRayGenSetBuffer(normals_ray_gen, "cameras", cameras_buffer);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
renderer.backend->context = context;
|
|
644
|
+
renderer.backend->module = module;
|
|
645
|
+
renderer.backend->cameras_buffer = cameras_buffer;
|
|
646
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
647
|
+
renderer.backend->ray_gen = ray_gen;
|
|
648
|
+
renderer.backend->frame_buffer = frame_buffer;
|
|
649
|
+
}
|
|
650
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
651
|
+
renderer.backend->depth_ray_gen = depth_ray_gen;
|
|
652
|
+
renderer.backend->depth_buffer = depth_buffer;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
#if !RL_TOOLS_RENDERING_RAYTRACING_DISABLE_PROBE_RAYS
|
|
656
|
+
OWLVarDecl collision_ray_gen_vars[] = {
|
|
657
|
+
{ "results", OWL_BUFPTR, OWL_OFFSETOF(CollisionRayGenData, results)},
|
|
658
|
+
{ "probe_directions", OWL_BUFPTR, OWL_OFFSETOF(CollisionRayGenData, probe_directions)},
|
|
659
|
+
{ "cameras", OWL_BUFPTR, OWL_OFFSETOF(CollisionRayGenData, cameras)},
|
|
660
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(CollisionRayGenData, world)},
|
|
661
|
+
{ "num_probes", OWL_INT, OWL_OFFSETOF(CollisionRayGenData, num_probes)},
|
|
662
|
+
{ "num_cameras", OWL_INT, OWL_OFFSETOF(CollisionRayGenData, num_cameras)},
|
|
663
|
+
{ "max_dist", OWL_FLOAT, OWL_OFFSETOF(CollisionRayGenData, max_dist)},
|
|
664
|
+
{ /* sentinel */ }
|
|
665
|
+
};
|
|
666
|
+
OWLRayGen collision_ray_gen = owlRayGenCreate(context, module, "collisionRayGen",
|
|
667
|
+
sizeof(CollisionRayGenData),
|
|
668
|
+
collision_ray_gen_vars, -1);
|
|
669
|
+
|
|
670
|
+
// device-resident (was host-pinned, which cost a PCIe write per probe launch): device
|
|
671
|
+
// consumers read collision_results(device, renderer) in place, host readers copy
|
|
672
|
+
OWLBuffer collision_results_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(CollisionResult),
|
|
673
|
+
(size_t)SPEC::NUM_CAMERAS * SPEC::NUM_PROBES, nullptr);
|
|
674
|
+
renderer.collision_results._data = (rendering::raytracing::CollisionResult*)owlBufferGetPointer(collision_results_buffer, 0);
|
|
675
|
+
OWLBuffer probe_dirs_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(owl::vec3f), SPEC::NUM_PROBES, nullptr);
|
|
676
|
+
|
|
677
|
+
owlRayGenSetBuffer(collision_ray_gen, "results", collision_results_buffer);
|
|
678
|
+
owlRayGenSetBuffer(collision_ray_gen, "probe_directions", probe_dirs_buffer);
|
|
679
|
+
owlRayGenSetBuffer(collision_ray_gen, "cameras", cameras_buffer);
|
|
680
|
+
owlRayGenSet1i (collision_ray_gen, "num_probes", SPEC::NUM_PROBES);
|
|
681
|
+
owlRayGenSet1i (collision_ray_gen, "num_cameras", SPEC::NUM_CAMERAS);
|
|
682
|
+
owlRayGenSet1f (collision_ray_gen, "max_dist", 1e30f);
|
|
683
|
+
|
|
684
|
+
renderer.backend->collision_ray_gen = collision_ray_gen;
|
|
685
|
+
renderer.backend->collision_results_buffer = collision_results_buffer;
|
|
686
|
+
renderer.backend->probe_dirs_buffer = probe_dirs_buffer;
|
|
687
|
+
#endif
|
|
688
|
+
rendering::raytracing::detail::announce_backend(renderer);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
template <typename DEVICE, typename SPEC>
|
|
693
|
+
void malloc(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
694
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
695
|
+
renderer.backend = new rendering::raytracing::backends::RendererState<rendering::raytracing::backends::Optix, SPEC>{};
|
|
696
|
+
OWLContext context = nullptr;
|
|
697
|
+
OWLModule module = nullptr;
|
|
698
|
+
optix::create_context_resources<SPEC>(context, module);
|
|
699
|
+
optix::detail::malloc_renderer(device, renderer, context, module);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// shared-library mode: the library owns the context; the renderer allocates only its own
|
|
703
|
+
// cameras/outputs/ray gens against it
|
|
704
|
+
template <typename DEVICE, typename SPEC>
|
|
705
|
+
void malloc(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, rendering::raytracing::AssetLibrary<SPEC, rendering::raytracing::backends::Optix>& library){
|
|
706
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
707
|
+
renderer.backend = new rendering::raytracing::backends::RendererState<rendering::raytracing::backends::Optix, SPEC>{};
|
|
708
|
+
optix::detail::malloc_renderer(device, renderer, library.backend->context, library.backend->module);
|
|
709
|
+
renderer.backend->library = &library;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
template <typename DEVICE, typename SPEC>
|
|
713
|
+
void malloc(DEVICE& device, rendering::raytracing::AssetLibrary<SPEC, rendering::raytracing::backends::Optix>& library){
|
|
714
|
+
library.backend = new rendering::raytracing::backends::LibraryState<rendering::raytracing::backends::Optix, SPEC>{};
|
|
715
|
+
rendering::raytracing::backends::optix::create_context_resources<SPEC>(library.backend->context, library.backend->module);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
template <typename DEVICE, typename SPEC>
|
|
719
|
+
void free(DEVICE& device, rendering::raytracing::AssetLibrary<SPEC, rendering::raytracing::backends::Optix>& library){
|
|
720
|
+
if(library.backend != nullptr && library.backend->context != nullptr){
|
|
721
|
+
owlContextDestroy(library.backend->context);
|
|
722
|
+
}
|
|
723
|
+
for(auto* assets : library.assets){
|
|
724
|
+
delete assets;
|
|
725
|
+
}
|
|
726
|
+
library.assets.clear();
|
|
727
|
+
library.scenes.clear();
|
|
728
|
+
library.hashes.clear();
|
|
729
|
+
delete library.backend;
|
|
730
|
+
library.backend = nullptr;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// =========================================================================
|
|
734
|
+
// init: upload meshes, build single shared BVH, build programs/pipeline/SBT
|
|
735
|
+
// =========================================================================
|
|
736
|
+
template <typename DEVICE, typename SPEC>
|
|
737
|
+
void update(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer);
|
|
738
|
+
|
|
739
|
+
namespace rendering::raytracing::backends::optix::detail{
|
|
740
|
+
template <typename SPEC>
|
|
741
|
+
OWLGeomType create_geom_type(OWLContext context, OWLModule module){
|
|
742
|
+
OWLGeomType triangles_geom_type;
|
|
743
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
744
|
+
if constexpr (SPEC::SHADING::PBR_SHADING) {
|
|
745
|
+
OWLVarDecl triangles_geom_vars[] = {
|
|
746
|
+
{ "index", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, index)},
|
|
747
|
+
{ "vertex", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, vertex)},
|
|
748
|
+
{ "tex_coord", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, tex_coord)},
|
|
749
|
+
{ "color", OWL_FLOAT3, OWL_OFFSETOF(TrianglesGeomData, color)},
|
|
750
|
+
{ "texture", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, texture)},
|
|
751
|
+
{ "has_texture", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_texture)},
|
|
752
|
+
{ "metallic", OWL_FLOAT, OWL_OFFSETOF(TrianglesGeomData, metallic)},
|
|
753
|
+
{ "world", OWL_GROUP, OWL_OFFSETOF(TrianglesGeomData, world)},
|
|
754
|
+
{ "normal", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, normal)},
|
|
755
|
+
{ "roughness", OWL_FLOAT, OWL_OFFSETOF(TrianglesGeomData, roughness)},
|
|
756
|
+
{ "normal_map", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, normal_map)},
|
|
757
|
+
{ "has_normal_map", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_normal_map)},
|
|
758
|
+
{ "metallic_roughness_map", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, metallic_roughness_map)},
|
|
759
|
+
{ "has_metallic_roughness_map", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_metallic_roughness_map)},
|
|
760
|
+
{ "emissive", OWL_FLOAT3, OWL_OFFSETOF(TrianglesGeomData, emissive)},
|
|
761
|
+
{ "emissive_map", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, emissive_map)},
|
|
762
|
+
{ "has_emissive_map", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_emissive_map)},
|
|
763
|
+
{ "occlusion_map", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, occlusion_map)},
|
|
764
|
+
{ "has_occlusion_map", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_occlusion_map)},
|
|
765
|
+
{ "opacity", OWL_FLOAT, OWL_OFFSETOF(TrianglesGeomData, opacity)},
|
|
766
|
+
{ "alpha_mode", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, alpha_mode)},
|
|
767
|
+
{ "alpha_cutoff", OWL_FLOAT, OWL_OFFSETOF(TrianglesGeomData, alpha_cutoff)},
|
|
768
|
+
{ "scene_lights", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, scene_lights)},
|
|
769
|
+
{ "num_scene_lights", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, num_scene_lights)},
|
|
770
|
+
{ "ambient_color", OWL_FLOAT3, OWL_OFFSETOF(TrianglesGeomData, ambient_color)},
|
|
771
|
+
{ /* sentinel */ }
|
|
772
|
+
};
|
|
773
|
+
triangles_geom_type = owlGeomTypeCreate(context, OWL_TRIANGLES,
|
|
774
|
+
sizeof(TrianglesGeomData),
|
|
775
|
+
triangles_geom_vars, -1);
|
|
776
|
+
owlGeomTypeSetClosestHit(triangles_geom_type, 0, module, rendering::raytracing::detail::closest_hit_program_name<SPEC>());
|
|
777
|
+
} else {
|
|
778
|
+
using SHADING_USAGE = rendering::raytracing::detail::MediumShadingUsage<SPEC>;
|
|
779
|
+
std::vector<OWLVarDecl> triangles_geom_vars;
|
|
780
|
+
if constexpr (SHADING_USAGE::USES_INDEX || SPEC::HAS_NORMALS) {
|
|
781
|
+
triangles_geom_vars.push_back({ "index", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, index)});
|
|
782
|
+
}
|
|
783
|
+
if constexpr (SHADING_USAGE::USES_VERTEX || SPEC::HAS_NORMALS) {
|
|
784
|
+
triangles_geom_vars.push_back({ "vertex", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, vertex)});
|
|
785
|
+
}
|
|
786
|
+
if constexpr (SHADING_USAGE::USES_TEXTURE) {
|
|
787
|
+
triangles_geom_vars.push_back({ "tex_coord", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, tex_coord)});
|
|
788
|
+
}
|
|
789
|
+
triangles_geom_vars.push_back({ "color", OWL_FLOAT3, OWL_OFFSETOF(TrianglesGeomData, color)});
|
|
790
|
+
if constexpr (SHADING_USAGE::USES_TEXTURE) {
|
|
791
|
+
triangles_geom_vars.push_back({ "texture", OWL_TEXTURE, OWL_OFFSETOF(TrianglesGeomData, texture)});
|
|
792
|
+
triangles_geom_vars.push_back({ "has_texture", OWL_INT, OWL_OFFSETOF(TrianglesGeomData, has_texture)});
|
|
793
|
+
}
|
|
794
|
+
if constexpr (SPEC::SHADING::METALLIC_REFLECTIONS) {
|
|
795
|
+
triangles_geom_vars.push_back({ "metallic", OWL_FLOAT, OWL_OFFSETOF(TrianglesGeomData, metallic)});
|
|
796
|
+
}
|
|
797
|
+
if constexpr (SHADING_USAGE::USES_WORLD) {
|
|
798
|
+
triangles_geom_vars.push_back({ "world", OWL_GROUP, OWL_OFFSETOF(TrianglesGeomData, world)});
|
|
799
|
+
}
|
|
800
|
+
triangles_geom_vars.push_back({});
|
|
801
|
+
triangles_geom_type = owlGeomTypeCreate(context, OWL_TRIANGLES,
|
|
802
|
+
sizeof(TrianglesGeomData),
|
|
803
|
+
triangles_geom_vars.data(), -1);
|
|
804
|
+
owlGeomTypeSetClosestHit(triangles_geom_type, 0, module, rendering::raytracing::detail::closest_hit_program_name<SPEC>());
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
else if constexpr (SPEC::HAS_NORMALS) {
|
|
808
|
+
OWLVarDecl triangles_geom_vars[] = {
|
|
809
|
+
{ "index", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, index)},
|
|
810
|
+
{ "vertex", OWL_BUFPTR, OWL_OFFSETOF(TrianglesGeomData, vertex)},
|
|
811
|
+
{ /* sentinel */ }
|
|
812
|
+
};
|
|
813
|
+
triangles_geom_type = owlGeomTypeCreate(context, OWL_TRIANGLES,
|
|
814
|
+
sizeof(TrianglesGeomData),
|
|
815
|
+
triangles_geom_vars, -1);
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
OWLVarDecl triangles_geom_vars[] = {
|
|
819
|
+
{ /* sentinel */ }
|
|
820
|
+
};
|
|
821
|
+
triangles_geom_type = owlGeomTypeCreate(context, OWL_TRIANGLES,
|
|
822
|
+
sizeof(CollisionGeomData),
|
|
823
|
+
triangles_geom_vars, -1);
|
|
824
|
+
}
|
|
825
|
+
owlGeomTypeSetClosestHit(triangles_geom_type, 1, module, "collisionHit");
|
|
826
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
827
|
+
owlGeomTypeSetClosestHit(triangles_geom_type, 2, module, "normalsHit");
|
|
828
|
+
}
|
|
829
|
+
return triangles_geom_type;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// scene objects (and pool assets) all become the same all_objects order everywhere —
|
|
833
|
+
// part of the deterministic global instance-id layout
|
|
834
|
+
inline void collect_all_objects(const rendering::raytracing::Scene& scene, const rendering::raytracing::AssetPool& pool, std::vector<const rendering::raytracing::Object*>& all_objects){
|
|
835
|
+
all_objects.clear();
|
|
836
|
+
for(const auto& object : scene.objects){
|
|
837
|
+
all_objects.push_back(&object);
|
|
838
|
+
}
|
|
839
|
+
for(const auto& assembly : pool.assemblies){
|
|
840
|
+
for(const auto& object : assembly.objects){
|
|
841
|
+
all_objects.push_back(&object);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// one geometry/texture/BLAS build per unique scene: standalone renderers build into
|
|
847
|
+
// their own context, shared-library renderers reference the library's single build
|
|
848
|
+
template <typename DEVICE, typename SPEC>
|
|
849
|
+
void build_scene_assets(DEVICE& device, OWLContext context, OWLGeomType triangles_geom_type, const rendering::raytracing::Scene& scene, const std::vector<const rendering::raytracing::Object*>& all_objects, rendering::raytracing::backends::SceneState<rendering::raytracing::backends::Optix, SPEC>& assets){
|
|
850
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
851
|
+
RL_TOOLS_RENDERING_RAYTRACING_LOG("building " << scene.objects.size() << " object(s), " << scene.instances.size() << " instance(s), " << (all_objects.size() - scene.objects.size()) << " pool object(s) ...");
|
|
852
|
+
|
|
853
|
+
std::vector<OWLGeom> geoms;
|
|
854
|
+
std::vector<OWLGroup> object_groups;
|
|
855
|
+
for(size_t object_i = 0; object_i < all_objects.size(); object_i++){
|
|
856
|
+
std::vector<OWLGeom> object_geoms;
|
|
857
|
+
for(const auto& md : all_objects[object_i]->meshes){
|
|
858
|
+
size_t num_vertices = md.vertices.size() / 3;
|
|
859
|
+
size_t num_indices = md.indices.size() / 3;
|
|
860
|
+
|
|
861
|
+
OWLBuffer vb = owlDeviceBufferCreate(context, OWL_FLOAT3, num_vertices, md.vertices.data());
|
|
862
|
+
OWLBuffer ib = owlDeviceBufferCreate(context, OWL_INT3, num_indices, md.indices.data());
|
|
863
|
+
|
|
864
|
+
OWLGeom geom = owlGeomCreate(context, triangles_geom_type);
|
|
865
|
+
owlTrianglesSetVertices(geom, vb, num_vertices, sizeof(owl::vec3f), 0);
|
|
866
|
+
owlTrianglesSetIndices(geom, ib, num_indices, sizeof(owl::vec3i), 0);
|
|
867
|
+
{
|
|
868
|
+
using SHADING_USAGE = rendering::raytracing::detail::MediumShadingUsage<SPEC>;
|
|
869
|
+
if constexpr ((SPEC::HAS_RGB && (SPEC::SHADING::PBR_SHADING || SHADING_USAGE::USES_VERTEX)) || SPEC::HAS_NORMALS) {
|
|
870
|
+
owlGeomSetBuffer(geom, "vertex", vb);
|
|
871
|
+
}
|
|
872
|
+
if constexpr ((SPEC::HAS_RGB && (SPEC::SHADING::PBR_SHADING || SHADING_USAGE::USES_INDEX)) || SPEC::HAS_NORMALS) {
|
|
873
|
+
owlGeomSetBuffer(geom, "index", ib);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
877
|
+
owlGeomSet3f(geom, "color", owl3f{md.color[0], md.color[1], md.color[2]});
|
|
878
|
+
|
|
879
|
+
if constexpr (SPEC::SHADING::PBR_SHADING || SPEC::SHADING::LOAD_TEXTURES) {
|
|
880
|
+
if(!md.tex_coords.empty()){
|
|
881
|
+
size_t num_tc = md.tex_coords.size() / 2;
|
|
882
|
+
OWLBuffer tcb = owlDeviceBufferCreate(context, OWL_FLOAT2, num_tc, md.tex_coords.data());
|
|
883
|
+
owlGeomSetBuffer(geom, "tex_coord", tcb);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if(md.texture.present()){
|
|
887
|
+
OWLTexture tex = owlTexture2DCreate(context,
|
|
888
|
+
OWL_TEXEL_FORMAT_RGBA8,
|
|
889
|
+
md.texture.width, md.texture.height,
|
|
890
|
+
md.texture.pixels.data(),
|
|
891
|
+
OWL_TEXTURE_LINEAR,
|
|
892
|
+
OWL_TEXTURE_WRAP,
|
|
893
|
+
OWL_TEXTURE_WRAP,
|
|
894
|
+
OWL_COLOR_SPACE_SRGB);
|
|
895
|
+
owlGeomSetTexture(geom, "texture", tex);
|
|
896
|
+
owlGeomSet1i(geom, "has_texture", 1);
|
|
897
|
+
} else {
|
|
898
|
+
owlGeomSet1i(geom, "has_texture", 0);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
if constexpr (SPEC::SHADING::PBR_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS) {
|
|
903
|
+
owlGeomSet1f(geom, "metallic", md.metallic);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
if constexpr (SPEC::SHADING::PBR_SHADING) {
|
|
907
|
+
if (!md.normals.empty()) {
|
|
908
|
+
size_t num_normals = md.normals.size() / 3;
|
|
909
|
+
OWLBuffer nb = owlDeviceBufferCreate(context, OWL_FLOAT3, num_normals, md.normals.data());
|
|
910
|
+
owlGeomSetBuffer(geom, "normal", nb);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
owlGeomSet1f(geom, "roughness", md.roughness);
|
|
914
|
+
|
|
915
|
+
if (md.normal_map.present()) {
|
|
916
|
+
OWLTexture nm_tex = owlTexture2DCreate(context,
|
|
917
|
+
OWL_TEXEL_FORMAT_RGBA8,
|
|
918
|
+
md.normal_map.width, md.normal_map.height,
|
|
919
|
+
md.normal_map.pixels.data(),
|
|
920
|
+
OWL_TEXTURE_LINEAR,
|
|
921
|
+
OWL_TEXTURE_WRAP,
|
|
922
|
+
OWL_TEXTURE_WRAP,
|
|
923
|
+
OWL_COLOR_SPACE_LINEAR);
|
|
924
|
+
owlGeomSetTexture(geom, "normal_map", nm_tex);
|
|
925
|
+
owlGeomSet1i(geom, "has_normal_map", 1);
|
|
926
|
+
} else {
|
|
927
|
+
owlGeomSet1i(geom, "has_normal_map", 0);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
if (md.metallic_roughness_map.present()) {
|
|
931
|
+
OWLTexture mr_tex = owlTexture2DCreate(context,
|
|
932
|
+
OWL_TEXEL_FORMAT_RGBA8,
|
|
933
|
+
md.metallic_roughness_map.width, md.metallic_roughness_map.height,
|
|
934
|
+
md.metallic_roughness_map.pixels.data(),
|
|
935
|
+
OWL_TEXTURE_LINEAR,
|
|
936
|
+
OWL_TEXTURE_WRAP,
|
|
937
|
+
OWL_TEXTURE_WRAP,
|
|
938
|
+
OWL_COLOR_SPACE_LINEAR);
|
|
939
|
+
owlGeomSetTexture(geom, "metallic_roughness_map", mr_tex);
|
|
940
|
+
owlGeomSet1i(geom, "has_metallic_roughness_map", 1);
|
|
941
|
+
} else {
|
|
942
|
+
owlGeomSet1i(geom, "has_metallic_roughness_map", 0);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
owlGeomSet3f(geom, "emissive", owl3f{md.emissive[0], md.emissive[1], md.emissive[2]});
|
|
946
|
+
if (md.emissive_map.present()) {
|
|
947
|
+
OWLTexture em_tex = owlTexture2DCreate(context,
|
|
948
|
+
OWL_TEXEL_FORMAT_RGBA8,
|
|
949
|
+
md.emissive_map.width, md.emissive_map.height,
|
|
950
|
+
md.emissive_map.pixels.data(),
|
|
951
|
+
OWL_TEXTURE_LINEAR,
|
|
952
|
+
OWL_TEXTURE_WRAP,
|
|
953
|
+
OWL_TEXTURE_WRAP,
|
|
954
|
+
OWL_COLOR_SPACE_SRGB);
|
|
955
|
+
owlGeomSetTexture(geom, "emissive_map", em_tex);
|
|
956
|
+
owlGeomSet1i(geom, "has_emissive_map", 1);
|
|
957
|
+
} else {
|
|
958
|
+
owlGeomSet1i(geom, "has_emissive_map", 0);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
if (md.occlusion_map.present()) {
|
|
962
|
+
OWLTexture ao_tex = owlTexture2DCreate(context,
|
|
963
|
+
OWL_TEXEL_FORMAT_RGBA8,
|
|
964
|
+
md.occlusion_map.width, md.occlusion_map.height,
|
|
965
|
+
md.occlusion_map.pixels.data(),
|
|
966
|
+
OWL_TEXTURE_LINEAR,
|
|
967
|
+
OWL_TEXTURE_WRAP,
|
|
968
|
+
OWL_TEXTURE_WRAP,
|
|
969
|
+
OWL_COLOR_SPACE_LINEAR);
|
|
970
|
+
owlGeomSetTexture(geom, "occlusion_map", ao_tex);
|
|
971
|
+
owlGeomSet1i(geom, "has_occlusion_map", 1);
|
|
972
|
+
} else {
|
|
973
|
+
owlGeomSet1i(geom, "has_occlusion_map", 0);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
owlGeomSet1f(geom, "opacity", md.opacity);
|
|
977
|
+
owlGeomSet1i(geom, "alpha_mode", md.alpha_mode);
|
|
978
|
+
owlGeomSet1f(geom, "alpha_cutoff", md.alpha_cutoff);
|
|
979
|
+
owlGeomSet3f(geom, "ambient_color", owl3f{0.10f, 0.10f, 0.10f});
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
geoms.push_back(geom);
|
|
984
|
+
object_geoms.push_back(geom);
|
|
985
|
+
}
|
|
986
|
+
OWLGroup triangles_group = owlTrianglesGeomGroupCreate(context, object_geoms.size(), object_geoms.data());
|
|
987
|
+
owlGroupBuildAccel(triangles_group);
|
|
988
|
+
object_groups.push_back(triangles_group);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
992
|
+
// degenerate triangle: valid to build, never reported as a hit
|
|
993
|
+
const float filler_vertices[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
994
|
+
const int filler_indices[3] = {0, 1, 2};
|
|
995
|
+
OWLBuffer filler_vertex_buffer = owlDeviceBufferCreate(context, OWL_FLOAT3, 3, filler_vertices);
|
|
996
|
+
OWLBuffer filler_index_buffer = owlDeviceBufferCreate(context, OWL_INT3, 1, filler_indices);
|
|
997
|
+
OWLGeom filler_geom = owlGeomCreate(context, triangles_geom_type);
|
|
998
|
+
owlTrianglesSetVertices(filler_geom, filler_vertex_buffer, 3, sizeof(owl::vec3f), 0);
|
|
999
|
+
owlTrianglesSetIndices(filler_geom, filler_index_buffer, 1, sizeof(owl::vec3i), 0);
|
|
1000
|
+
if constexpr (SPEC::HAS_RGB){
|
|
1001
|
+
owlGeomSet3f(filler_geom, "color", owl3f{0.f, 0.f, 0.f});
|
|
1002
|
+
}
|
|
1003
|
+
geoms.push_back(filler_geom);
|
|
1004
|
+
OWLGroup filler_group = owlTrianglesGeomGroupCreate(context, 1, &filler_geom);
|
|
1005
|
+
owlGroupBuildAccel(filler_group);
|
|
1006
|
+
assets.filler_group = filler_group;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
std::vector<OWLGroup> instance_children;
|
|
1010
|
+
std::vector<uint32_t> instance_ids; // user instance ids == global instance ids (contract: segmentation_object, operations_cpu_common.h)
|
|
1011
|
+
std::vector<float> instance_transforms; // 12 per instance: owl affine3f (linear columns vx, vy, vz, then translation)
|
|
1012
|
+
for(const auto& instance : scene.instances){
|
|
1013
|
+
instance_children.push_back(object_groups[instance.object]);
|
|
1014
|
+
instance_ids.push_back((uint32_t)instance_ids.size());
|
|
1015
|
+
const float* transform = instance.transform; // 3x4 row-major [R|t]
|
|
1016
|
+
const float owl_transform[12] = {
|
|
1017
|
+
transform[0], transform[4], transform[8],
|
|
1018
|
+
transform[1], transform[5], transform[9],
|
|
1019
|
+
transform[2], transform[6], transform[10],
|
|
1020
|
+
transform[3], transform[7], transform[11]
|
|
1021
|
+
};
|
|
1022
|
+
instance_transforms.insert(instance_transforms.end(), owl_transform, owl_transform + 12);
|
|
1023
|
+
}
|
|
1024
|
+
OWLGroup world = owlInstanceGroupCreate(context, instance_children.size(), instance_children.data(), instance_ids.data(), instance_transforms.data(), OWL_MATRIX_FORMAT_OWL);
|
|
1025
|
+
owlGroupBuildAccel(world);
|
|
1026
|
+
|
|
1027
|
+
if constexpr (SPEC::HAS_RGB && (SPEC::SHADING::PBR_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS)) {
|
|
1028
|
+
for(size_t m = 0; m < geoms.size(); m++){
|
|
1029
|
+
owlGeomSetGroup(geoms[m], "world", world);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
if constexpr (SPEC::HAS_RGB && SPEC::SHADING::PBR_SHADING) {
|
|
1034
|
+
const auto scene_lights = rendering::raytracing::detail::effective_scene_lights<true>(scene);
|
|
1035
|
+
OWLBuffer light_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(rendering::raytracing::SceneLight),
|
|
1036
|
+
scene_lights.size(), scene_lights.data());
|
|
1037
|
+
for (size_t m = 0; m < geoms.size(); m++) {
|
|
1038
|
+
owlGeomSetBuffer(geoms[m], "scene_lights", light_buffer);
|
|
1039
|
+
owlGeomSet1i(geoms[m], "num_scene_lights", (int)scene_lights.size());
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
std::vector<unsigned int> host_instance_classes(scene.instances.size() + (SPEC::ENABLE_OVERLAYS ? (size_t)SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES : 0), 0);
|
|
1044
|
+
for(size_t instance_i = 0; instance_i < scene.instances.size(); instance_i++){
|
|
1045
|
+
host_instance_classes[instance_i] = all_objects[scene.instances[instance_i].object]->segmentation_class;
|
|
1046
|
+
}
|
|
1047
|
+
if(host_instance_classes.empty()){
|
|
1048
|
+
host_instance_classes.push_back(0);
|
|
1049
|
+
}
|
|
1050
|
+
OWLBuffer instance_classes_buffer = owlDeviceBufferCreate(context, OWL_UINT, host_instance_classes.size(), host_instance_classes.data());
|
|
1051
|
+
|
|
1052
|
+
assets.world = world;
|
|
1053
|
+
assets.instance_classes_buffer = instance_classes_buffer;
|
|
1054
|
+
assets.num_scene_instances = scene.instances.size();
|
|
1055
|
+
assets.object_groups.clear();
|
|
1056
|
+
for(OWLGroup object_group : object_groups){
|
|
1057
|
+
assets.object_groups.push_back(object_group);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// wires one renderer to a scene build: bounds, overlay state, ray gen vars, launch
|
|
1062
|
+
// params, and the context-level programs/pipeline/SBT rebuild
|
|
1063
|
+
template <typename DEVICE, typename SPEC>
|
|
1064
|
+
void init_renderer_scene(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const rendering::raytracing::Scene& scene, const std::vector<const rendering::raytracing::Object*>& all_objects, const rendering::raytracing::backends::SceneState<rendering::raytracing::backends::Optix, SPEC>& assets){
|
|
1065
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1066
|
+
OWLContext context = (OWLContext)renderer.backend->context;
|
|
1067
|
+
rendering::raytracing::detail::compute_scene_bounds(renderer, scene);
|
|
1068
|
+
OWLGroup world = (OWLGroup)assets.world;
|
|
1069
|
+
OWLBuffer instance_classes_buffer = (OWLBuffer)assets.instance_classes_buffer;
|
|
1070
|
+
|
|
1071
|
+
delete (optix::OverlayState*)renderer.backend->overlay_state;
|
|
1072
|
+
renderer.backend->overlay_state = nullptr;
|
|
1073
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1074
|
+
auto* overlay_state = new optix::OverlayState{};
|
|
1075
|
+
for(OWLGroup object_group : assets.object_groups){
|
|
1076
|
+
overlay_state->object_groups.push_back(object_group);
|
|
1077
|
+
}
|
|
1078
|
+
overlay_state->filler_group = (OWLGroup)assets.filler_group;
|
|
1079
|
+
renderer.backend->overlay_state = overlay_state;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
1083
|
+
owlRayGenSetGroup((OWLRayGen)renderer.backend->ray_gen, "world", world);
|
|
1084
|
+
}
|
|
1085
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
1086
|
+
const float max_depth = renderer.camera_radius > 0 ? renderer.camera_radius * 2.0f : 1e30f;
|
|
1087
|
+
owlRayGenSetGroup((OWLRayGen)renderer.backend->depth_ray_gen, "world", world);
|
|
1088
|
+
owlRayGenSet1f((OWLRayGen)renderer.backend->depth_ray_gen, "max_depth", max_depth);
|
|
1089
|
+
}
|
|
1090
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
1091
|
+
owlRayGenSetGroup((OWLRayGen)renderer.backend->segmentation_ray_gen, "world", world);
|
|
1092
|
+
}
|
|
1093
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
1094
|
+
owlRayGenSetGroup((OWLRayGen)renderer.backend->normals_ray_gen, "world", world);
|
|
1095
|
+
}
|
|
1096
|
+
if(renderer.backend->collision_ray_gen){
|
|
1097
|
+
owlRayGenSetGroup((OWLRayGen)renderer.backend->collision_ray_gen, "world", world);
|
|
1098
|
+
owlRayGenSet1f((OWLRayGen)renderer.backend->collision_ray_gen, "max_dist", renderer.camera_radius * 2.0f);
|
|
1099
|
+
}
|
|
1100
|
+
renderer.backend->world = world;
|
|
1101
|
+
|
|
1102
|
+
// programs/pipeline/SBT must be (re)built after the geometry set changes; the launch
|
|
1103
|
+
// params are spec-dependent and created once. In shared-library mode later scene
|
|
1104
|
+
// builds only append SBT records, so earlier renderers' baked offsets stay valid.
|
|
1105
|
+
owlBuildPrograms(context);
|
|
1106
|
+
owlBuildPipeline(context);
|
|
1107
|
+
owlBuildSBT(context);
|
|
1108
|
+
|
|
1109
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1110
|
+
auto* overlay_state = (optix::OverlayState*)renderer.backend->overlay_state;
|
|
1111
|
+
// per-object BLAS traversables and SBT offsets are only final after owlBuildSBT above;
|
|
1112
|
+
// baked into a device table the fill kernel joins against slot structure
|
|
1113
|
+
std::vector<optix::OverlayObjectEntry> object_entries(overlay_state->object_groups.size());
|
|
1114
|
+
for(size_t object_i = 0; object_i < overlay_state->object_groups.size(); object_i++){
|
|
1115
|
+
object_entries[object_i].traversable = (unsigned long long)owlGroupGetTraversable(overlay_state->object_groups[object_i], 0);
|
|
1116
|
+
object_entries[object_i].sbt_offset = owlGroupGetSBTOffset(overlay_state->object_groups[object_i]);
|
|
1117
|
+
object_entries[object_i].segmentation_class = all_objects[object_i]->segmentation_class;
|
|
1118
|
+
}
|
|
1119
|
+
overlay_state->accel = optix::overlay_accel_create(owlContextGetOptixContext(context, 0), SPEC::NUM_OVERLAYS, SPEC::MAX_OVERLAY_INSTANCES, (unsigned int)scene.instances.size(), (unsigned long long)owlGroupGetTraversable(overlay_state->filler_group, 0));
|
|
1120
|
+
optix::overlay_accel_upload_objects(overlay_state->accel, object_entries.data(), (unsigned int)object_entries.size());
|
|
1121
|
+
overlay_state->structure_staging.assign((size_t)SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES, optix::OverlaySlotStructure{});
|
|
1122
|
+
overlay_state->transforms_staging.assign((size_t)SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES * 12, 0.0f);
|
|
1123
|
+
// published once: raw builds into fixed per-overlay buffers keep the handles stable,
|
|
1124
|
+
// so no per-rebuild re-publication is needed
|
|
1125
|
+
overlay_state->traversables_buffer = owlDeviceBufferCreate(context, OWL_USER_TYPE(unsigned long long), SPEC::NUM_OVERLAYS, optix::overlay_accel_traversables(overlay_state->accel));
|
|
1126
|
+
overlay_state->attachments_buffer = owlDeviceBufferCreate(context, OWL_UINT, (size_t)SPEC::NUM_CAMERAS * SPEC::MAX_OVERLAYS_PER_CAMERA, nullptr);
|
|
1127
|
+
rendering::raytracing::detail::reset_overlay_state(renderer);
|
|
1128
|
+
overlay_state->instance_classes_buffer = instance_classes_buffer;
|
|
1129
|
+
overlay_state->num_scene_instances = scene.instances.size();
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
if(renderer.backend->launch_params == nullptr){
|
|
1133
|
+
OWLVarDecl launch_params_vars[] = {
|
|
1134
|
+
{ "overlays", OWL_BUFPTR, OWL_OFFSETOF(OverlayLaunchParams, overlays)},
|
|
1135
|
+
{ "attachments", OWL_BUFPTR, OWL_OFFSETOF(OverlayLaunchParams, attachments)},
|
|
1136
|
+
{ "overlay_count", OWL_INT, OWL_OFFSETOF(OverlayLaunchParams, overlay_count)},
|
|
1137
|
+
{ "cam_width", OWL_INT, OWL_OFFSETOF(OverlayLaunchParams, cam_width)},
|
|
1138
|
+
{ "cam_height", OWL_INT, OWL_OFFSETOF(OverlayLaunchParams, cam_height)},
|
|
1139
|
+
{ "grid_cols", OWL_INT, OWL_OFFSETOF(OverlayLaunchParams, grid_cols)},
|
|
1140
|
+
{ "instance_classes", OWL_BUFPTR, OWL_OFFSETOF(OverlayLaunchParams, instance_classes)},
|
|
1141
|
+
{ "semantic_segmentation", OWL_INT, OWL_OFFSETOF(OverlayLaunchParams, semantic_segmentation)},
|
|
1142
|
+
{ /* sentinel */ }
|
|
1143
|
+
};
|
|
1144
|
+
OWLParams launch_params = owlParamsCreate(context, sizeof(OverlayLaunchParams), launch_params_vars, -1);
|
|
1145
|
+
renderer.backend->launch_params = launch_params;
|
|
1146
|
+
if(renderer.backend->collision_ray_gen){
|
|
1147
|
+
OWLParams coll_lp = owlParamsCreate(context, sizeof(OverlayLaunchParams), launch_params_vars, -1);
|
|
1148
|
+
renderer.backend->coll_launch_params = coll_lp;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
OWLParams all_launch_params[2] = {(OWLParams)renderer.backend->launch_params, (OWLParams)renderer.backend->coll_launch_params};
|
|
1152
|
+
for(OWLParams launch_params : all_launch_params){
|
|
1153
|
+
if(launch_params == nullptr) continue;
|
|
1154
|
+
owlParamsSet1i(launch_params, "overlay_count", (int)SPEC::MAX_OVERLAYS_PER_CAMERA);
|
|
1155
|
+
owlParamsSet1i(launch_params, "cam_width", (int)SPEC::CAM_WIDTH);
|
|
1156
|
+
owlParamsSet1i(launch_params, "cam_height", (int)SPEC::CAM_HEIGHT);
|
|
1157
|
+
owlParamsSet1i(launch_params, "grid_cols", (int)SPEC::GRID_COLS);
|
|
1158
|
+
owlParamsSet1i(launch_params, "semantic_segmentation", SPEC::SEMANTIC_SEGMENTATION ? 1 : 0);
|
|
1159
|
+
owlParamsSetBuffer(launch_params, "instance_classes", instance_classes_buffer);
|
|
1160
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1161
|
+
auto* overlay_state = (optix::OverlayState*)renderer.backend->overlay_state;
|
|
1162
|
+
owlParamsSetBuffer(launch_params, "overlays", overlay_state->traversables_buffer);
|
|
1163
|
+
owlParamsSetBuffer(launch_params, "attachments", overlay_state->attachments_buffer);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1168
|
+
update(device, renderer); // publish the (empty) overlays and the attachment table
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
template <typename DEVICE, typename SPEC>
|
|
1174
|
+
void init(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const rendering::raytracing::Scene& scene, const rendering::raytracing::AssetPool& pool){
|
|
1175
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1176
|
+
OWLContext context = (OWLContext)renderer.backend->context;
|
|
1177
|
+
OWLModule module = (OWLModule)renderer.backend->module;
|
|
1178
|
+
OWLGeomType triangles_geom_type = optix::detail::create_geom_type<SPEC>(context, module);
|
|
1179
|
+
|
|
1180
|
+
std::vector<const rendering::raytracing::Object*> all_objects;
|
|
1181
|
+
for(const auto& object : scene.objects){
|
|
1182
|
+
all_objects.push_back(&object);
|
|
1183
|
+
}
|
|
1184
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1185
|
+
rendering::raytracing::detail::register_pool_assets(device, renderer, pool, all_objects);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
rendering::raytracing::backends::SceneState<rendering::raytracing::backends::Optix, SPEC> assets;
|
|
1189
|
+
optix::detail::build_scene_assets<DEVICE, SPEC>(device, context, triangles_geom_type, scene, all_objects, assets);
|
|
1190
|
+
optix::detail::init_renderer_scene(device, renderer, scene, all_objects, assets);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// shared-library mode: one geometry/texture/BLAS build per unique scene (content-hash
|
|
1194
|
+
// dedup inside the library), then the renderer is wired to the shared build. Returns the
|
|
1195
|
+
// unique-scene index so callers can key their own per-scene data.
|
|
1196
|
+
template <typename DEVICE, typename SPEC>
|
|
1197
|
+
typename SPEC::TI init(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, rendering::raytracing::AssetLibrary<SPEC, rendering::raytracing::backends::Optix>& library, const char* scene_path){
|
|
1198
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1199
|
+
using TI = typename SPEC::TI;
|
|
1200
|
+
utils::assert_exit(device, renderer.backend->library == &library, "init: the renderer was not malloc'd against this library");
|
|
1201
|
+
bool is_new = false;
|
|
1202
|
+
const TI scene_id = rendering::raytracing::detail::library_lookup_or_load(device, library, scene_path, is_new);
|
|
1203
|
+
const rendering::raytracing::Scene& scene = library.scenes[scene_id];
|
|
1204
|
+
if(is_new){
|
|
1205
|
+
if(library.backend->geom_type == nullptr){
|
|
1206
|
+
library.backend->geom_type = optix::detail::create_geom_type<SPEC>(library.backend->context, library.backend->module);
|
|
1207
|
+
}
|
|
1208
|
+
std::vector<const rendering::raytracing::Object*> build_objects;
|
|
1209
|
+
optix::detail::collect_all_objects(scene, library.pool, build_objects);
|
|
1210
|
+
library.assets[scene_id] = new rendering::raytracing::backends::SceneState<rendering::raytracing::backends::Optix, SPEC>{};
|
|
1211
|
+
optix::detail::build_scene_assets<DEVICE, SPEC>(device, library.backend->context, library.backend->geom_type, scene, build_objects, *library.assets[scene_id]);
|
|
1212
|
+
}
|
|
1213
|
+
std::vector<const rendering::raytracing::Object*> all_objects;
|
|
1214
|
+
for(const auto& object : scene.objects){
|
|
1215
|
+
all_objects.push_back(&object);
|
|
1216
|
+
}
|
|
1217
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1218
|
+
rendering::raytracing::detail::register_pool_assets(device, renderer, library.pool, all_objects);
|
|
1219
|
+
}
|
|
1220
|
+
else{
|
|
1221
|
+
optix::detail::collect_all_objects(scene, library.pool, all_objects);
|
|
1222
|
+
}
|
|
1223
|
+
optix::detail::init_renderer_scene(device, renderer, scene, all_objects, *library.assets[scene_id]);
|
|
1224
|
+
return scene_id;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
template <typename DEVICE, typename SPEC>
|
|
1228
|
+
void init(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const rendering::raytracing::Scene& scene){
|
|
1229
|
+
static const rendering::raytracing::AssetPool empty_pool{};
|
|
1230
|
+
init(device, renderer, scene, empty_pool);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
namespace rendering::raytracing::backends::optix{
|
|
1234
|
+
// producers write the renderer's device tensors on the caller's stream (device.stream);
|
|
1235
|
+
// the launch verbs bridge it to the backend-owned streams with an event so producer
|
|
1236
|
+
// writes are ordered before consumption — callers never handle streams. A CPU device has
|
|
1237
|
+
// no stream member and resolves to the null overload (host writes are synchronous).
|
|
1238
|
+
template <typename DEVICE>
|
|
1239
|
+
auto producer_stream(DEVICE& device, int) -> decltype(device.stream) { return device.stream; }
|
|
1240
|
+
template <typename DEVICE>
|
|
1241
|
+
cudaStream_t producer_stream(DEVICE& device, long){ return nullptr; }
|
|
1242
|
+
|
|
1243
|
+
inline void await_producer(cudaStream_t producer, cudaStream_t consumer){
|
|
1244
|
+
if(producer == nullptr || producer == consumer){
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
cudaEvent_t ready;
|
|
1248
|
+
cudaEventCreateWithFlags(&ready, cudaEventDisableTiming);
|
|
1249
|
+
cudaEventRecord(ready, producer);
|
|
1250
|
+
cudaStreamWaitEvent(consumer, ready, 0);
|
|
1251
|
+
cudaEventDestroy(ready);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// fully stream-ordered on the render stream: staging uploads for host-verb writes, then the
|
|
1256
|
+
// device-side instance fill and per-overlay raw optixAccelBuild — no host synchronization
|
|
1257
|
+
template <typename DEVICE, typename SPEC>
|
|
1258
|
+
void update_launch(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1259
|
+
static_assert(SPEC::ENABLE_OVERLAYS, "update requires an overlay-enabled renderer specification");
|
|
1260
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1261
|
+
using TI = typename SPEC::TI;
|
|
1262
|
+
auto* overlay_state = (optix::OverlayState*)renderer.backend->overlay_state;
|
|
1263
|
+
cudaStream_t cuda_stream = (cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0);
|
|
1264
|
+
cudaStream_t coll_stream = renderer.backend->coll_launch_params != nullptr ? (cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->coll_launch_params, 0) : cuda_stream;
|
|
1265
|
+
optix::await_producer(optix::producer_stream(device, 0), cuda_stream);
|
|
1266
|
+
if(coll_stream != cuda_stream){
|
|
1267
|
+
// probe launches trace the overlay TLASes on their own stream: order this rebuild
|
|
1268
|
+
// after in-flight probes and subsequent probes after this rebuild, without host syncs
|
|
1269
|
+
cudaEvent_t probes_done;
|
|
1270
|
+
cudaEventCreateWithFlags(&probes_done, cudaEventDisableTiming);
|
|
1271
|
+
cudaEventRecord(probes_done, coll_stream);
|
|
1272
|
+
cudaStreamWaitEvent(cuda_stream, probes_done, 0);
|
|
1273
|
+
cudaEventDestroy(probes_done);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
for(TI overlay = 0; overlay < SPEC::NUM_OVERLAYS; overlay++){
|
|
1277
|
+
auto& overlay_host = renderer.overlays[overlay];
|
|
1278
|
+
if(!overlay_host.dirty) continue;
|
|
1279
|
+
const size_t base = (size_t)overlay * SPEC::MAX_OVERLAY_INSTANCES;
|
|
1280
|
+
for(TI slot = 0; slot < SPEC::MAX_OVERLAY_INSTANCES; slot++){
|
|
1281
|
+
const auto& host_slot = overlay_host.slots[slot];
|
|
1282
|
+
auto& row = overlay_state->structure_staging[base + slot];
|
|
1283
|
+
row.active = host_slot.active ? 1u : 0u;
|
|
1284
|
+
row.pose_slot = (unsigned int)host_slot.pose_slot;
|
|
1285
|
+
row.object = (unsigned int)host_slot.object;
|
|
1286
|
+
std::memcpy(row.part_local, host_slot.part_local, sizeof(row.part_local));
|
|
1287
|
+
std::memcpy(&overlay_state->transforms_staging[(base + slot) * 12], host_slot.transform_entry, 12 * sizeof(float));
|
|
1288
|
+
}
|
|
1289
|
+
cudaMemcpyAsync(optix::overlay_accel_structure(overlay_state->accel) + base, &overlay_state->structure_staging[base], SPEC::MAX_OVERLAY_INSTANCES * sizeof(optix::OverlaySlotStructure), cudaMemcpyHostToDevice, cuda_stream);
|
|
1290
|
+
cudaMemcpyAsync(data(renderer.transforms) + base * 12, &overlay_state->transforms_staging[base * 12], SPEC::MAX_OVERLAY_INSTANCES * 12 * sizeof(float), cudaMemcpyHostToDevice, cuda_stream);
|
|
1291
|
+
overlay_host.dirty = false;
|
|
1292
|
+
}
|
|
1293
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR){
|
|
1294
|
+
bool motion_dirty = false;
|
|
1295
|
+
for(TI overlay = 0; overlay < SPEC::NUM_OVERLAYS; overlay++){
|
|
1296
|
+
motion_dirty |= renderer.transforms_motion_dirty[overlay];
|
|
1297
|
+
renderer.transforms_motion_dirty[overlay] = false;
|
|
1298
|
+
}
|
|
1299
|
+
if(motion_dirty){
|
|
1300
|
+
cudaMemcpyAsync(data(renderer.transforms_motion), renderer.transforms_motion_staging.data(), renderer.transforms_motion_staging.size() * sizeof(float), cudaMemcpyHostToDevice, cuda_stream);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
if(renderer.attachments_dirty){
|
|
1304
|
+
std::vector<uint32_t> attachments((size_t)SPEC::NUM_CAMERAS * SPEC::MAX_OVERLAYS_PER_CAMERA);
|
|
1305
|
+
for(size_t index = 0; index < attachments.size(); index++){
|
|
1306
|
+
attachments[index] = (uint32_t)renderer.attachments[index];
|
|
1307
|
+
}
|
|
1308
|
+
owlBufferUpload(overlay_state->attachments_buffer, attachments.data(), 0, attachments.size());
|
|
1309
|
+
renderer.attachments_dirty = false;
|
|
1310
|
+
}
|
|
1311
|
+
optix::overlay_accel_build(overlay_state->accel, data(renderer.transforms), (unsigned int*)owlBufferGetPointer(overlay_state->instance_classes_buffer, 0), 1.0f, nullptr, cuda_stream);
|
|
1312
|
+
if(coll_stream != cuda_stream){
|
|
1313
|
+
cudaEvent_t built;
|
|
1314
|
+
cudaEventCreateWithFlags(&built, cudaEventDisableTiming);
|
|
1315
|
+
cudaEventRecord(built, cuda_stream);
|
|
1316
|
+
cudaStreamWaitEvent(coll_stream, built, 0);
|
|
1317
|
+
cudaEventDestroy(built);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
template <typename DEVICE, typename SPEC>
|
|
1322
|
+
void update_sync(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1323
|
+
static_assert(SPEC::ENABLE_OVERLAYS, "update requires an overlay-enabled renderer specification");
|
|
1324
|
+
cudaStreamSynchronize((cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0));
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// expands the device-resident transforms_pair tensor into the per-sample transforms_motion
|
|
1328
|
+
// slabs (and the close state into transforms) entirely on the render stream — with a CUDA
|
|
1329
|
+
// device argument the kernel is ordered behind the producer stream via an event, so a sim
|
|
1330
|
+
// kernel writing the pair tensor needs no host synchronization
|
|
1331
|
+
template <typename DEVICE, typename SPEC>
|
|
1332
|
+
void expand_motion_transforms_launch(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1333
|
+
static_assert(SPEC::ENABLE_DYNAMIC_MOTION_BLUR, "expand_motion_transforms requires a dynamic-motion-blur renderer specification");
|
|
1334
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1335
|
+
cudaStream_t cuda_stream = (cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0);
|
|
1336
|
+
optix::await_producer(optix::producer_stream(device, 0), cuda_stream);
|
|
1337
|
+
optix::overlay_accel_expand_motion(data(renderer.transforms_pair), data(renderer.transforms_motion), data(renderer.transforms),
|
|
1338
|
+
(unsigned int)((size_t)SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES), (unsigned int)SPEC::MOTION_BLUR_SAMPLES, cuda_stream);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
template <typename DEVICE, typename SPEC>
|
|
1342
|
+
void expand_motion_transforms_sync(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1343
|
+
static_assert(SPEC::ENABLE_DYNAMIC_MOTION_BLUR, "expand_motion_transforms requires a dynamic-motion-blur renderer specification");
|
|
1344
|
+
cudaStreamSynchronize((cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0));
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
template <typename DEVICE, typename SPEC>
|
|
1348
|
+
void expand_motion_transforms(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1349
|
+
expand_motion_transforms_launch(device, renderer);
|
|
1350
|
+
expand_motion_transforms_sync(device, renderer);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
template <typename DEVICE, typename SPEC>
|
|
1354
|
+
void update(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1355
|
+
update_launch(device, renderer);
|
|
1356
|
+
update_sync(device, renderer);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
template <typename DEVICE, typename SPEC>
|
|
1360
|
+
void generate_cameras(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer,
|
|
1361
|
+
const typename SPEC::T center[3], typename SPEC::T radius,
|
|
1362
|
+
const typename SPEC::T up[3], typename SPEC::T fov){
|
|
1363
|
+
std::vector<rendering::raytracing::Camera<typename SPEC::T>> staging(SPEC::NUM_CAMERAS);
|
|
1364
|
+
rendering::raytracing::detail::generate_camera_poses<SPEC>(device, staging.data(), center, radius, up, fov);
|
|
1365
|
+
|
|
1366
|
+
owlBufferUpload((OWLBuffer)renderer.backend->cameras_buffer, staging.data(), 0, SPEC::NUM_CAMERAS);
|
|
1367
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
1368
|
+
owlBufferUpload((OWLBuffer)renderer.backend->cameras_open_buffer, staging.data(), 0, SPEC::NUM_CAMERAS);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
1373
|
+
void copy_to_renderer(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const T* source, T* destination, size_t count){
|
|
1374
|
+
cudaMemcpy(destination, source, count * sizeof(T), cudaMemcpyHostToDevice);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
template <typename DEVICE, typename SPEC, typename T>
|
|
1378
|
+
void copy_from_renderer(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const T* source, T* destination, size_t count){
|
|
1379
|
+
cudaMemcpy(destination, source, count * sizeof(T), cudaMemcpyDeviceToHost);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// =========================================================================
|
|
1383
|
+
// generate_probe_directions: Fibonacci probe directions + upload
|
|
1384
|
+
// =========================================================================
|
|
1385
|
+
template <typename DEVICE, typename SPEC>
|
|
1386
|
+
void generate_probe_directions(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1387
|
+
#if RL_TOOLS_RENDERING_RAYTRACING_DISABLE_PROBE_RAYS
|
|
1388
|
+
RL_TOOLS_RENDERING_RAYTRACING_LOG("Probe rays disabled (RL_TOOLS_RENDERING_RAYTRACING_DISABLE_PROBE_RAYS=1)");
|
|
1389
|
+
return;
|
|
1390
|
+
#else
|
|
1391
|
+
std::vector<float> dirs = rendering::raytracing::detail::generate_probe_direction_vectors<SPEC>();
|
|
1392
|
+
owlBufferUpload((OWLBuffer)renderer.backend->probe_dirs_buffer, dirs.data(), 0, SPEC::NUM_PROBES);
|
|
1393
|
+
#endif
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
template <typename DEVICE, typename SPEC>
|
|
1397
|
+
void render_launch(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1398
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1399
|
+
using TI = typename SPEC::TI;
|
|
1400
|
+
OWLParams launch_params = (OWLParams)renderer.backend->launch_params;
|
|
1401
|
+
cudaStream_t cuda_stream = (cudaStream_t)owlParamsGetCudaStream(launch_params, 0);
|
|
1402
|
+
optix::await_producer(optix::producer_stream(device, 0), cuda_stream);
|
|
1403
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR){
|
|
1404
|
+
// one enqueue-only pass per motion sample: overlay TLAS rebuild from the per-sample
|
|
1405
|
+
// transforms slab (the fill kernel also publishes the pass's shutter time), then the
|
|
1406
|
+
// accumulate ray gens; the shutter-close rebuild restores the steady state for
|
|
1407
|
+
// segmentation/probes before the resolve kernel averages the accumulators
|
|
1408
|
+
auto* overlay_state = (optix::OverlayState*)renderer.backend->overlay_state;
|
|
1409
|
+
unsigned int* instance_classes = (unsigned int*)owlBufferGetPointer(overlay_state->instance_classes_buffer, 0);
|
|
1410
|
+
cudaStream_t coll_stream = renderer.backend->coll_launch_params != nullptr ? (cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->coll_launch_params, 0) : cuda_stream;
|
|
1411
|
+
if(coll_stream != cuda_stream){
|
|
1412
|
+
cudaEvent_t probes_done;
|
|
1413
|
+
cudaEventCreateWithFlags(&probes_done, cudaEventDisableTiming);
|
|
1414
|
+
cudaEventRecord(probes_done, coll_stream);
|
|
1415
|
+
cudaStreamWaitEvent(cuda_stream, probes_done, 0);
|
|
1416
|
+
cudaEventDestroy(probes_done);
|
|
1417
|
+
}
|
|
1418
|
+
if constexpr (SPEC::HAS_RGB){
|
|
1419
|
+
cudaMemsetAsync(data(renderer.rgb_accumulator), 0, decltype(renderer.rgb_accumulator)::SPEC::SIZE_BYTES, cuda_stream);
|
|
1420
|
+
}
|
|
1421
|
+
if constexpr (SPEC::HAS_DEPTH){
|
|
1422
|
+
cudaMemsetAsync(data(renderer.depth_accumulator), 0, decltype(renderer.depth_accumulator)::SPEC::SIZE_BYTES, cuda_stream);
|
|
1423
|
+
}
|
|
1424
|
+
constexpr size_t SLAB = (size_t)SPEC::NUM_OVERLAYS * SPEC::MAX_OVERLAY_INSTANCES * 12;
|
|
1425
|
+
for(TI sample = 0; sample < SPEC::MOTION_BLUR_SAMPLES; sample++){
|
|
1426
|
+
const float shutter_t = ((float)sample + 0.5f) / (float)SPEC::MOTION_BLUR_SAMPLES;
|
|
1427
|
+
optix::overlay_accel_build(overlay_state->accel, data(renderer.transforms_motion) + sample * SLAB, instance_classes, shutter_t, renderer.backend->shutter_device, cuda_stream);
|
|
1428
|
+
if constexpr (SPEC::HAS_RGB){
|
|
1429
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1430
|
+
}
|
|
1431
|
+
if constexpr (SPEC::HAS_DEPTH){
|
|
1432
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->depth_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
optix::overlay_accel_build(overlay_state->accel, data(renderer.transforms), instance_classes, 1.0f, nullptr, cuda_stream);
|
|
1436
|
+
if(coll_stream != cuda_stream){
|
|
1437
|
+
cudaEvent_t built;
|
|
1438
|
+
cudaEventCreateWithFlags(&built, cudaEventDisableTiming);
|
|
1439
|
+
cudaEventRecord(built, cuda_stream);
|
|
1440
|
+
cudaStreamWaitEvent(coll_stream, built, 0);
|
|
1441
|
+
cudaEventDestroy(built);
|
|
1442
|
+
}
|
|
1443
|
+
if constexpr (SPEC::HAS_SEGMENTATION){
|
|
1444
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->segmentation_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1445
|
+
}
|
|
1446
|
+
if constexpr (SPEC::HAS_NORMALS){
|
|
1447
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->normals_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1448
|
+
}
|
|
1449
|
+
const float* rgb_accumulation = nullptr;
|
|
1450
|
+
unsigned int* frame_buffer = nullptr;
|
|
1451
|
+
float* observation = nullptr;
|
|
1452
|
+
const float* depth_accumulation = nullptr;
|
|
1453
|
+
float* depth_buffer = nullptr;
|
|
1454
|
+
if constexpr (SPEC::HAS_RGB){
|
|
1455
|
+
rgb_accumulation = data(renderer.rgb_accumulator);
|
|
1456
|
+
frame_buffer = data(renderer.frame_buffer);
|
|
1457
|
+
}
|
|
1458
|
+
if constexpr (SPEC::HAS_OBSERVATION){
|
|
1459
|
+
observation = data(renderer.observation);
|
|
1460
|
+
}
|
|
1461
|
+
if constexpr (SPEC::HAS_DEPTH){
|
|
1462
|
+
depth_accumulation = data(renderer.depth_accumulator);
|
|
1463
|
+
depth_buffer = data(renderer.depth_buffer);
|
|
1464
|
+
}
|
|
1465
|
+
optix::overlay_accel_resolve(rgb_accumulation, frame_buffer, observation, SPEC::SHADING::SRGB_OUTPUT ? 1 : 0,
|
|
1466
|
+
depth_accumulation, depth_buffer,
|
|
1467
|
+
(unsigned int)((size_t)SPEC::NUM_CAMERAS * SPEC::CAM_PIXELS),
|
|
1468
|
+
(unsigned int)SPEC::MOTION_BLUR_SAMPLES, cuda_stream);
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
1472
|
+
OWLRayGen ray_gen = (OWLRayGen)renderer.backend->ray_gen;
|
|
1473
|
+
owlAsyncLaunch2D(ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1474
|
+
}
|
|
1475
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
1476
|
+
OWLRayGen depth_ray_gen = (OWLRayGen)renderer.backend->depth_ray_gen;
|
|
1477
|
+
owlAsyncLaunch2D(depth_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1478
|
+
}
|
|
1479
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
1480
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->segmentation_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1481
|
+
}
|
|
1482
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
1483
|
+
owlAsyncLaunch2D((OWLRayGen)renderer.backend->normals_ray_gen, SPEC::FB_WIDTH, SPEC::FB_HEIGHT, launch_params);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
template <typename DEVICE, typename SPEC>
|
|
1488
|
+
void render_sync(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1489
|
+
owlLaunchSync((OWLParams)renderer.backend->launch_params);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
template <typename DEVICE, typename SPEC>
|
|
1493
|
+
void render(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1494
|
+
render_launch(device, renderer);
|
|
1495
|
+
render_sync(device, renderer);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// render produces the image outputs the spec declares; the collision-probe pass is the
|
|
1499
|
+
// separate probe verb so it can be scheduled independently (e.g. alongside update)
|
|
1500
|
+
template <typename DEVICE, typename SPEC>
|
|
1501
|
+
void probe_launch(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1502
|
+
namespace optix = rendering::raytracing::backends::optix;
|
|
1503
|
+
if(renderer.backend->collision_ray_gen){
|
|
1504
|
+
OWLRayGen collision_ray_gen = (OWLRayGen)renderer.backend->collision_ray_gen;
|
|
1505
|
+
OWLParams coll_lp = (OWLParams)renderer.backend->coll_launch_params;
|
|
1506
|
+
optix::await_producer(optix::producer_stream(device, 0), (cudaStream_t)owlParamsGetCudaStream(coll_lp, 0));
|
|
1507
|
+
owlAsyncLaunch2D(collision_ray_gen, SPEC::NUM_CAMERAS, SPEC::NUM_PROBES, coll_lp);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
template <typename DEVICE, typename SPEC>
|
|
1512
|
+
void probe_sync(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1513
|
+
if(renderer.backend->coll_launch_params)
|
|
1514
|
+
owlLaunchSync((OWLParams)renderer.backend->coll_launch_params);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
template <typename DEVICE, typename SPEC>
|
|
1518
|
+
void probe(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1519
|
+
probe_launch(device, renderer);
|
|
1520
|
+
probe_sync(device, renderer);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
template <typename DEVICE, typename SPEC>
|
|
1524
|
+
void save_segmentation_image(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1525
|
+
static_assert(SPEC::HAS_SEGMENTATION, "save_segmentation_image requires a segmentation-capable renderer specification");
|
|
1526
|
+
const size_t segmentation_count = (size_t)SPEC::NUM_CAMERAS * SPEC::CAM_PIXELS;
|
|
1527
|
+
std::vector<uint32_t> segmentation_host(segmentation_count);
|
|
1528
|
+
cudaMemcpy(segmentation_host.data(), data(renderer.segmentation_buffer), segmentation_count * sizeof(uint32_t), cudaMemcpyDeviceToHost);
|
|
1529
|
+
rendering::raytracing::detail::write_segmentation_grid_png<SPEC>(segmentation_host.data(), filename);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
template <typename DEVICE, typename SPEC>
|
|
1533
|
+
void save_normals_image(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1534
|
+
static_assert(SPEC::HAS_NORMALS, "save_normals_image requires a normals-capable renderer specification");
|
|
1535
|
+
const size_t normals_count = (size_t)SPEC::NUM_CAMERAS * SPEC::CAM_PIXELS * 3;
|
|
1536
|
+
std::vector<float> normals_host(normals_count);
|
|
1537
|
+
cudaMemcpy(normals_host.data(), data(renderer.normals_buffer), normals_count * sizeof(float), cudaMemcpyDeviceToHost);
|
|
1538
|
+
rendering::raytracing::detail::write_normals_grid_png<SPEC>(normals_host.data(), filename);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
// =========================================================================
|
|
1542
|
+
// save_image: readback framebuffer, rearrange to grid, write PNG
|
|
1543
|
+
// =========================================================================
|
|
1544
|
+
template <typename DEVICE, typename SPEC>
|
|
1545
|
+
void save_image(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1546
|
+
static_assert(SPEC::HAS_RGB, "save_image requires an RGB-capable renderer specification");
|
|
1547
|
+
using TI = typename SPEC::TI;
|
|
1548
|
+
constexpr TI cam_pixels = SPEC::CAM_PIXELS;
|
|
1549
|
+
const size_t fb_count = (size_t)SPEC::NUM_CAMERAS * cam_pixels;
|
|
1550
|
+
|
|
1551
|
+
std::vector<uint32_t> fb_host(fb_count);
|
|
1552
|
+
cudaMemcpy(fb_host.data(), data(renderer.frame_buffer), fb_count * sizeof(uint32_t), cudaMemcpyDeviceToHost);
|
|
1553
|
+
rendering::raytracing::detail::write_grid_png<SPEC>(fb_host.data(), filename);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
template <typename DEVICE, typename SPEC>
|
|
1557
|
+
void save_depth_image(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1558
|
+
static_assert(SPEC::HAS_DEPTH, "save_depth_image requires a depth-capable renderer specification");
|
|
1559
|
+
using TI = typename SPEC::TI;
|
|
1560
|
+
constexpr TI cam_pixels = SPEC::CAM_PIXELS;
|
|
1561
|
+
const size_t depth_count = (size_t)SPEC::NUM_CAMERAS * cam_pixels;
|
|
1562
|
+
|
|
1563
|
+
std::vector<float> depth_host(depth_count);
|
|
1564
|
+
cudaMemcpy(depth_host.data(), data(renderer.depth_buffer), depth_count * sizeof(float), cudaMemcpyDeviceToHost);
|
|
1565
|
+
|
|
1566
|
+
rendering::raytracing::detail::write_depth_grid_png<SPEC>(depth_host.data(), renderer.camera_radius, filename);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
template <typename DEVICE, typename SPEC>
|
|
1570
|
+
void save_depth(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1571
|
+
static_assert(SPEC::HAS_DEPTH, "save_depth requires a depth-capable renderer specification");
|
|
1572
|
+
constexpr size_t depth_count = (size_t)SPEC::NUM_CAMERAS * SPEC::CAM_PIXELS;
|
|
1573
|
+
std::vector<float> depth_host(depth_count);
|
|
1574
|
+
cudaMemcpy(depth_host.data(), data(renderer.depth_buffer), depth_count * sizeof(float), cudaMemcpyDeviceToHost);
|
|
1575
|
+
rendering::raytracing::detail::write_depth_bin<SPEC>(depth_host.data(), filename);
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// =========================================================================
|
|
1579
|
+
// save_probes: readback collision results, write binary
|
|
1580
|
+
// =========================================================================
|
|
1581
|
+
template <typename DEVICE, typename SPEC>
|
|
1582
|
+
void save_probes(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer, const char* filename){
|
|
1583
|
+
#if RL_TOOLS_RENDERING_RAYTRACING_DISABLE_PROBE_RAYS
|
|
1584
|
+
RL_TOOLS_RENDERING_RAYTRACING_LOG("save_probes skipped: probe rays are disabled.");
|
|
1585
|
+
(void)filename;
|
|
1586
|
+
return;
|
|
1587
|
+
#else
|
|
1588
|
+
constexpr size_t probe_count = (size_t)SPEC::NUM_CAMERAS * SPEC::NUM_PROBES;
|
|
1589
|
+
std::vector<CollisionResult> probes_host(probe_count);
|
|
1590
|
+
cudaMemcpy(probes_host.data(), data(renderer.collision_results), probe_count * sizeof(CollisionResult), cudaMemcpyDeviceToHost);
|
|
1591
|
+
rendering::raytracing::detail::write_probes_bin_and_log<SPEC>(probes_host.data(), filename);
|
|
1592
|
+
#endif
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
// render stream shared by render/probe/update launches; producers writing renderer inputs
|
|
1596
|
+
// from their own kernels can run on it to get ordering without events or host syncs
|
|
1597
|
+
template <typename DEVICE, typename SPEC>
|
|
1598
|
+
cudaStream_t stream(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1599
|
+
return (cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
// scoped to the renderer's own streams — never a whole-device barrier
|
|
1603
|
+
template <typename DEVICE, typename SPEC>
|
|
1604
|
+
void synchronize(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1605
|
+
if(renderer.backend->launch_params != nullptr){
|
|
1606
|
+
cudaStreamSynchronize((cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->launch_params, 0));
|
|
1607
|
+
}
|
|
1608
|
+
if(renderer.backend->coll_launch_params != nullptr){
|
|
1609
|
+
cudaStreamSynchronize((cudaStream_t)owlParamsGetCudaStream((OWLParams)renderer.backend->coll_launch_params, 0));
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
template <typename DEVICE, typename SPEC>
|
|
1614
|
+
void free(DEVICE& device, rendering::raytracing::Renderer<SPEC, rendering::raytracing::backends::Optix>& renderer){
|
|
1615
|
+
RL_TOOLS_RENDERING_RAYTRACING_LOG("destroying devicegroups ...");
|
|
1616
|
+
if(renderer.backend != nullptr){
|
|
1617
|
+
if(renderer.backend->context != nullptr && renderer.backend->library == nullptr){
|
|
1618
|
+
owlContextDestroy((OWLContext)renderer.backend->context); // library-backed renderers borrow the context — the library destroys it
|
|
1619
|
+
}
|
|
1620
|
+
if(renderer.backend->overlay_state != nullptr){
|
|
1621
|
+
auto* overlay_state = (rendering::raytracing::backends::optix::OverlayState*)renderer.backend->overlay_state;
|
|
1622
|
+
rendering::raytracing::backends::optix::overlay_accel_destroy(overlay_state->accel);
|
|
1623
|
+
delete overlay_state;
|
|
1624
|
+
}
|
|
1625
|
+
if(renderer.backend->shutter_device != nullptr){
|
|
1626
|
+
cudaFree(renderer.backend->shutter_device);
|
|
1627
|
+
}
|
|
1628
|
+
delete renderer.backend;
|
|
1629
|
+
renderer.backend = nullptr;
|
|
1630
|
+
}
|
|
1631
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1632
|
+
if(renderer.transforms._data != nullptr){
|
|
1633
|
+
cudaFree(renderer.transforms._data);
|
|
1634
|
+
renderer.transforms._data = nullptr;
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
if constexpr (SPEC::ENABLE_DYNAMIC_MOTION_BLUR){
|
|
1638
|
+
if(renderer.transforms_motion._data != nullptr){
|
|
1639
|
+
cudaFree(renderer.transforms_motion._data);
|
|
1640
|
+
renderer.transforms_motion._data = nullptr;
|
|
1641
|
+
}
|
|
1642
|
+
if(renderer.transforms_pair._data != nullptr){
|
|
1643
|
+
cudaFree(renderer.transforms_pair._data);
|
|
1644
|
+
renderer.transforms_pair._data = nullptr;
|
|
1645
|
+
}
|
|
1646
|
+
if constexpr (SPEC::HAS_RGB){
|
|
1647
|
+
renderer.rgb_accumulator._data = nullptr;
|
|
1648
|
+
}
|
|
1649
|
+
if constexpr (SPEC::HAS_DEPTH){
|
|
1650
|
+
renderer.depth_accumulator._data = nullptr;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
// the input and output tensors alias OWL buffers destroyed with the context
|
|
1654
|
+
renderer.cameras._data = nullptr;
|
|
1655
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR) {
|
|
1656
|
+
renderer.cameras_open._data = nullptr;
|
|
1657
|
+
}
|
|
1658
|
+
if constexpr (SPEC::HAS_RGB) {
|
|
1659
|
+
renderer.frame_buffer._data = nullptr;
|
|
1660
|
+
}
|
|
1661
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
1662
|
+
renderer.depth_buffer._data = nullptr;
|
|
1663
|
+
}
|
|
1664
|
+
if constexpr (SPEC::HAS_SEGMENTATION) {
|
|
1665
|
+
renderer.segmentation_buffer._data = nullptr;
|
|
1666
|
+
}
|
|
1667
|
+
if constexpr (SPEC::HAS_NORMALS) {
|
|
1668
|
+
renderer.normals_buffer._data = nullptr;
|
|
1669
|
+
}
|
|
1670
|
+
if constexpr (SPEC::HAS_OBSERVATION) {
|
|
1671
|
+
renderer.observation._data = nullptr;
|
|
1672
|
+
}
|
|
1673
|
+
renderer.collision_results._data = nullptr;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
RL_TOOLS_NAMESPACE_WRAPPER_END
|
|
1677
|
+
|
|
1678
|
+
#endif
|