├── .clang-format ├── .gitattributes ├── .github ├── deps │ ├── dpcpp-linux-icx.env │ ├── dpcpp-sycl-nightly.env │ ├── dpcpp-windows-icx.env │ ├── gfx-linux-public.env │ └── gfx-windows-public.env ├── env │ └── pvc-runtime-options.env ├── scripts │ ├── run-benchmarks.sh │ ├── run-examples-big-volume-tests.sh │ └── run-examples-tests.py └── workflows │ ├── external.ci.linux.yml │ ├── internal.benchmark.yml │ ├── internal.ci.linux.gpu.icx.yml │ ├── internal.ci.linux.gpu.yml │ ├── internal.ci.linux.single_volume.yml │ ├── internal.ci.linux.yml │ ├── internal.ci.mac.yml │ ├── internal.ci.windows.gpu.icx.yml │ ├── internal.ci.windows.gpu.yml │ ├── internal.ci.windows.yml │ ├── internal.nightly.windows.yml │ └── internal.release.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── cmake ├── check_build.cpp ├── openvklConfig.cmake.in ├── openvkl_dpcpp.cmake ├── openvkl_ispc.cmake └── openvkl_macros.cmake ├── doc ├── Makefile ├── api.md ├── compilation.md ├── examples.md ├── images.md ├── images │ ├── structured_spherical_coords.png │ ├── vdb_structure.png │ ├── vdb_structure.svg │ └── vklExamples.png ├── legal.md ├── links.md ├── overview.md ├── readme_head.md ├── related_projects.md ├── stylesheet.css ├── support.md ├── teaser.html └── webtemplate.html ├── examples ├── CMakeLists.txt ├── from_openvkl_install │ └── CMakeLists.txt ├── interactive │ ├── BatchApplication.cpp │ ├── BatchApplication.h │ ├── CMakeLists.txt │ ├── InteractiveApplication.cpp │ ├── InteractiveApplication.h │ ├── ParameterGui.cpp │ ├── ParameterGui.h │ ├── RenderView.cpp │ ├── RenderView.h │ ├── TransferFunctionWidget.cpp │ ├── TransferFunctionWidget.h │ ├── imgui-1.83 │ │ ├── .editorconfig │ │ ├── .gitattributes │ │ ├── .github │ │ │ ├── FUNDING.yml │ │ │ ├── issue_template.md │ │ │ ├── pull_request_template.md │ │ │ └── workflows │ │ │ │ ├── build.yml │ │ │ │ ├── scheduled.yml │ │ │ │ └── static-analysis.yml │ │ ├── .gitignore │ │ ├── LICENSE.txt │ │ ├── backends │ │ │ ├── imgui_impl_allegro5.cpp │ │ │ ├── imgui_impl_allegro5.h │ │ │ ├── imgui_impl_android.cpp │ │ │ ├── imgui_impl_android.h │ │ │ ├── imgui_impl_dx10.cpp │ │ │ ├── imgui_impl_dx10.h │ │ │ ├── imgui_impl_dx11.cpp │ │ │ ├── imgui_impl_dx11.h │ │ │ ├── imgui_impl_dx12.cpp │ │ │ ├── imgui_impl_dx12.h │ │ │ ├── imgui_impl_dx9.cpp │ │ │ ├── imgui_impl_dx9.h │ │ │ ├── imgui_impl_glfw.cpp │ │ │ ├── imgui_impl_glfw.h │ │ │ ├── imgui_impl_glut.cpp │ │ │ ├── imgui_impl_glut.h │ │ │ ├── imgui_impl_marmalade.cpp │ │ │ ├── imgui_impl_marmalade.h │ │ │ ├── imgui_impl_metal.h │ │ │ ├── imgui_impl_metal.mm │ │ │ ├── imgui_impl_opengl2.cpp │ │ │ ├── imgui_impl_opengl2.h │ │ │ ├── imgui_impl_opengl3.cpp │ │ │ ├── imgui_impl_opengl3.h │ │ │ ├── imgui_impl_osx.h │ │ │ ├── imgui_impl_osx.mm │ │ │ ├── imgui_impl_sdl.cpp │ │ │ ├── imgui_impl_sdl.h │ │ │ ├── imgui_impl_vulkan.cpp │ │ │ ├── imgui_impl_vulkan.h │ │ │ ├── imgui_impl_wgpu.cpp │ │ │ ├── imgui_impl_wgpu.h │ │ │ ├── imgui_impl_win32.cpp │ │ │ ├── imgui_impl_win32.h │ │ │ └── vulkan │ │ │ │ ├── generate_spv.sh │ │ │ │ ├── glsl_shader.frag │ │ │ │ └── glsl_shader.vert │ │ ├── docs │ │ │ ├── BACKENDS.md │ │ │ ├── CHANGELOG.txt │ │ │ ├── EXAMPLES.md │ │ │ ├── FAQ.md │ │ │ ├── FONTS.md │ │ │ ├── README.md │ │ │ └── TODO.txt │ │ ├── examples │ │ │ ├── README.txt │ │ │ ├── example_allegro5 │ │ │ │ ├── README.md │ │ │ │ ├── example_allegro5.vcxproj │ │ │ │ ├── example_allegro5.vcxproj.filters │ │ │ │ ├── imconfig_allegro5.h │ │ │ │ └── main.cpp │ │ │ ├── example_android_opengl3 │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── android │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── app │ │ │ │ │ │ ├── build.gradle │ │ │ │ │ │ └── src │ │ │ │ │ │ │ └── main │ │ │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ │ │ └── java │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ ├── build.gradle │ │ │ │ │ └── settings.gradle │ │ │ │ └── main.cpp │ │ │ ├── example_apple_metal │ │ │ │ ├── README.md │ │ │ │ ├── example_apple_metal.xcodeproj │ │ │ │ │ └── project.pbxproj │ │ │ │ ├── iOS │ │ │ │ │ ├── Info-iOS.plist │ │ │ │ │ └── LaunchScreen.storyboard │ │ │ │ ├── macOS │ │ │ │ │ ├── Info-macOS.plist │ │ │ │ │ └── MainMenu.storyboard │ │ │ │ └── main.mm │ │ │ ├── example_apple_opengl2 │ │ │ │ ├── example_apple_opengl2.xcodeproj │ │ │ │ │ └── project.pbxproj │ │ │ │ └── main.mm │ │ │ ├── example_emscripten_opengl3 │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ ├── main.cpp │ │ │ │ └── shell_minimal.html │ │ │ ├── example_emscripten_wgpu │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ └── main.cpp │ │ │ ├── example_glfw_metal │ │ │ │ ├── Makefile │ │ │ │ └── main.mm │ │ │ ├── example_glfw_opengl2 │ │ │ │ ├── Makefile │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_glfw_opengl2.vcxproj │ │ │ │ ├── example_glfw_opengl2.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_glfw_opengl3 │ │ │ │ ├── Makefile │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_glfw_opengl3.vcxproj │ │ │ │ ├── example_glfw_opengl3.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_glfw_vulkan │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── build_win32.bat │ │ │ │ ├── build_win64.bat │ │ │ │ ├── example_glfw_vulkan.vcxproj │ │ │ │ ├── example_glfw_vulkan.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_glut_opengl2 │ │ │ │ ├── Makefile │ │ │ │ ├── example_glut_opengl2.vcxproj │ │ │ │ ├── example_glut_opengl2.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_marmalade │ │ │ │ ├── data │ │ │ │ │ └── app.icf │ │ │ │ ├── main.cpp │ │ │ │ └── marmalade_example.mkb │ │ │ ├── example_null │ │ │ │ ├── Makefile │ │ │ │ ├── build_win32.bat │ │ │ │ └── main.cpp │ │ │ ├── example_sdl_directx11 │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_sdl_directx11.vcxproj │ │ │ │ ├── example_sdl_directx11.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_sdl_metal │ │ │ │ ├── Makefile │ │ │ │ └── main.mm │ │ │ ├── example_sdl_opengl2 │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_sdl_opengl2.vcxproj │ │ │ │ ├── example_sdl_opengl2.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_sdl_opengl3 │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_sdl_opengl3.vcxproj │ │ │ │ ├── example_sdl_opengl3.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_sdl_vulkan │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_sdl_vulkan.vcxproj │ │ │ │ ├── example_sdl_vulkan.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_win32_directx10 │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_win32_directx10.vcxproj │ │ │ │ ├── example_win32_directx10.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_win32_directx11 │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_win32_directx11.vcxproj │ │ │ │ ├── example_win32_directx11.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_win32_directx12 │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_win32_directx12.vcxproj │ │ │ │ ├── example_win32_directx12.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── example_win32_directx9 │ │ │ │ ├── build_win32.bat │ │ │ │ ├── example_win32_directx9.vcxproj │ │ │ │ ├── example_win32_directx9.vcxproj.filters │ │ │ │ └── main.cpp │ │ │ ├── imgui_examples.sln │ │ │ └── libs │ │ │ │ ├── gl3w │ │ │ │ └── GL │ │ │ │ │ ├── gl3w.c │ │ │ │ │ ├── gl3w.h │ │ │ │ │ └── glcorearb.h │ │ │ │ ├── glfw │ │ │ │ ├── COPYING.txt │ │ │ │ ├── include │ │ │ │ │ └── GLFW │ │ │ │ │ │ ├── glfw3.h │ │ │ │ │ │ └── glfw3native.h │ │ │ │ ├── lib-vc2010-32 │ │ │ │ │ └── glfw3.lib │ │ │ │ └── lib-vc2010-64 │ │ │ │ │ └── glfw3.lib │ │ │ │ └── usynergy │ │ │ │ ├── README.txt │ │ │ │ ├── uSynergy.c │ │ │ │ └── uSynergy.h │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_internal.h │ │ ├── imgui_tables.cpp │ │ ├── imgui_widgets.cpp │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ ├── imstb_truetype.h │ │ └── misc │ │ │ ├── README.txt │ │ │ ├── cpp │ │ │ ├── README.txt │ │ │ ├── imgui_stdlib.cpp │ │ │ └── imgui_stdlib.h │ │ │ ├── debuggers │ │ │ ├── README.txt │ │ │ ├── imgui.gdb │ │ │ ├── imgui.natstepfilter │ │ │ └── imgui.natvis │ │ │ ├── fonts │ │ │ ├── Cousine-Regular.ttf │ │ │ ├── DroidSans.ttf │ │ │ ├── Karla-Regular.ttf │ │ │ ├── ProggyClean.ttf │ │ │ ├── ProggyTiny.ttf │ │ │ ├── Roboto-Medium.ttf │ │ │ └── binary_to_compressed_c.cpp │ │ │ ├── freetype │ │ │ ├── README.md │ │ │ ├── imgui_freetype.cpp │ │ │ └── imgui_freetype.h │ │ │ └── single_file │ │ │ └── imgui_single_file.h │ ├── renderer │ │ ├── ArcballCamera.cpp │ │ ├── ArcballCamera.h │ │ ├── CMakeLists.txt │ │ ├── Camera.ih │ │ ├── CommandLine.h │ │ ├── Random.h │ │ ├── Random.ih │ │ ├── Ray.h │ │ ├── Ray.ih │ │ ├── Renderer.cpp │ │ ├── Renderer.h │ │ ├── Renderer.ispc │ │ ├── RendererGpu.cpp │ │ ├── RendererGpu.h │ │ ├── RendererGpuKernel.h │ │ ├── RendererHost.cpp │ │ ├── RendererHost.h │ │ ├── RendererParams.cpp │ │ ├── RendererParams.h │ │ ├── RendererParams.ih │ │ ├── RendererParamsShared.h │ │ ├── SamplerParams.cpp │ │ ├── SamplerParams.h │ │ ├── Scene.cpp │ │ ├── Scene.h │ │ ├── Scene.ih │ │ ├── Scene.ispc │ │ ├── Scheduler.cpp │ │ ├── Scheduler.h │ │ ├── TransferFunction.h │ │ ├── TransferFunction.ih │ │ ├── Versioned.h │ │ ├── VolumeParams.cpp │ │ ├── VolumeParams.h │ │ ├── density_path_tracer │ │ │ ├── DensityPathTracer.cpp │ │ │ ├── DensityPathTracer.h │ │ │ ├── DensityPathTracer.ispc │ │ │ ├── DensityPathTracerGpu.cpp │ │ │ ├── DensityPathTracerGpu.h │ │ │ ├── DensityPathTracerGpuKernel.cpp │ │ │ ├── DensityPathTracerGpuKernel.h │ │ │ ├── DensityPathTracerIspc.cpp │ │ │ ├── DensityPathTracerIspc.h │ │ │ └── DensityPathTracerParams.h │ │ ├── framebuffer │ │ │ ├── Buffer.h │ │ │ ├── BufferCpu.cpp │ │ │ ├── BufferCpu.h │ │ │ ├── BufferDisplay.h │ │ │ ├── BufferGpu.cpp │ │ │ ├── BufferGpu.h │ │ │ ├── Framebuffer.h │ │ │ ├── Framebuffer.ispc │ │ │ ├── FramebufferCpu.h │ │ │ ├── FramebufferGpu.h │ │ │ └── Stats.h │ │ ├── hit_iterator_renderer │ │ │ ├── HitIteratorRenderer.cpp │ │ │ ├── HitIteratorRenderer.h │ │ │ ├── HitIteratorRenderer.ispc │ │ │ ├── HitIteratorRendererGpu.cpp │ │ │ ├── HitIteratorRendererGpu.h │ │ │ ├── HitIteratorRendererGpuKernel.cpp │ │ │ ├── HitIteratorRendererGpuKernel.h │ │ │ └── HitIteratorRendererParams.h │ │ ├── interval_iterator_debug │ │ │ ├── IntervalIteratorDebug.cpp │ │ │ ├── IntervalIteratorDebug.h │ │ │ ├── IntervalIteratorDebug.ispc │ │ │ ├── IntervalIteratorDebugGpu.cpp │ │ │ ├── IntervalIteratorDebugGpu.h │ │ │ ├── IntervalIteratorDebugGpuKernel.cpp │ │ │ ├── IntervalIteratorDebugGpuKernel.h │ │ │ └── IntervalIteratorDebugParams.h │ │ └── ray_march_iterator │ │ │ ├── RayMarchIterator.cpp │ │ │ ├── RayMarchIterator.h │ │ │ ├── RayMarchIterator.ispc │ │ │ ├── RayMarchIteratorGpu.cpp │ │ │ ├── RayMarchIteratorGpu.h │ │ │ ├── RayMarchIteratorGpuKernel.cpp │ │ │ ├── RayMarchIteratorGpuKernel.h │ │ │ └── RayMarchIteratorParams.h │ ├── vklBenchmark.cpp │ └── vklExamples.cpp ├── ispc │ ├── CMakeLists.txt │ ├── vklTutorialISPC.cpp │ └── vklTutorialISPC.ispc ├── minimal │ ├── CMakeLists.txt │ ├── README.md │ ├── create_voxels.h │ ├── field.h │ ├── framebuffer.h │ ├── minimal_01.cpp │ ├── minimal_02.cpp │ ├── minimal_03.cpp │ ├── minimal_04.cpp │ ├── minimal_05.cpp │ └── minimal_06.cpp ├── vklTutorialCPU.c └── vklTutorialGPU.cpp ├── gitlab ├── build-from-install.sh ├── build.bat ├── build.sh ├── release │ ├── linux-test.sh │ ├── linux.sh │ ├── linux_sycl-test.sh │ ├── linux_sycl-test_run_only.sh │ ├── linux_sycl.sh │ ├── macos-test.sh │ ├── macos.sh │ ├── sign.sh │ ├── windows-test.ps1 │ ├── windows.ps1 │ ├── windows_sycl-test.ps1 │ ├── windows_sycl-test_run_only.ps1 │ └── windows_sycl.ps1 └── run_tests.bat ├── openvkl ├── CMakeLists.txt ├── api │ ├── API.cpp │ ├── Device.cpp │ └── Device.h ├── common │ ├── Data.cpp │ ├── Data.h │ ├── Data.ih │ ├── DataShared.h │ ├── IteratorBase.h │ ├── ManagedObject.cpp │ ├── ManagedObject.h │ ├── ObjectFactory.h │ ├── Traits.cpp │ ├── Traits.h │ ├── VKLCommon.cpp │ ├── VKLCommon.h │ ├── VKLFeatureFlagsInternal.h │ ├── ispc_defs.def │ ├── ispc_util.ispc │ ├── logging.cpp │ ├── logging.h │ ├── math.h │ └── simd.h ├── devices │ ├── CMakeLists.txt │ ├── common │ │ ├── BufferShared.h │ │ └── StructShared.h │ ├── cpu │ │ ├── CMakeLists.txt │ │ ├── api │ │ │ ├── AddDeviceAPIs.h │ │ │ ├── CPUDevice.cpp │ │ │ ├── CPUDevice.h │ │ │ ├── CPUDevice.ispc │ │ │ └── DeviceAPI.cpp │ │ ├── common │ │ │ ├── Allocator.h │ │ │ ├── DeviceTraits.h │ │ │ ├── Hit.ih │ │ │ ├── Interval.ih │ │ │ ├── ValueRanges.ih │ │ │ ├── ValueRangesShared.h │ │ │ ├── align.h │ │ │ ├── device_simd.h │ │ │ ├── export_util.h │ │ │ ├── ispc_isa.h │ │ │ ├── print_debug.ih │ │ │ ├── runtime_error.h │ │ │ ├── temporal_data_interpolation.ih │ │ │ └── temporal_data_verification.h │ │ ├── exports.cpp │ │ ├── include │ │ │ └── openvkl │ │ │ │ └── device │ │ │ │ ├── max_iterator_size.h │ │ │ │ ├── openvkl.h │ │ │ │ └── openvkl.isph │ │ ├── iterator │ │ │ ├── DefaultIterator.cpp │ │ │ ├── DefaultIterator.h │ │ │ ├── DefaultIterator.ih │ │ │ ├── DefaultIterator.ispc │ │ │ ├── GridAcceleratorIterator.cpp │ │ │ ├── GridAcceleratorIterator.h │ │ │ ├── GridAcceleratorIterator.ih │ │ │ ├── GridAcceleratorIterator.ispc │ │ │ ├── GridAcceleratorIteratorSize.ispc │ │ │ ├── Iterator.h │ │ │ ├── Iterator.ih │ │ │ ├── IteratorContext.cpp │ │ │ ├── IteratorContext.h │ │ │ ├── IteratorContext.ispc │ │ │ ├── IteratorContextShared.h │ │ │ ├── IteratorShared.h │ │ │ ├── UnstructuredIterator.cpp │ │ │ ├── UnstructuredIterator.h │ │ │ ├── UnstructuredIterator.ih │ │ │ └── UnstructuredIterator.ispc │ │ ├── math │ │ │ └── box_utility.ih │ │ ├── observer │ │ │ ├── Observer.cpp │ │ │ ├── Observer.h │ │ │ ├── ObserverRegistry.cpp │ │ │ ├── ObserverRegistry.h │ │ │ ├── ObserverRegistry.ih │ │ │ └── ObserverRegistry.ispc │ │ ├── sampler │ │ │ ├── Sampler.cpp │ │ │ ├── Sampler.h │ │ │ ├── Sampler.ih │ │ │ ├── Sampler.ispc │ │ │ └── SamplerShared.h │ │ └── volume │ │ │ ├── GridAccelerator.h │ │ │ ├── GridAccelerator.ih │ │ │ ├── GridAccelerator.ispc │ │ │ ├── GridAcceleratorShared.h │ │ │ ├── SharedStructuredVolume.ih │ │ │ ├── SharedStructuredVolume.ispc │ │ │ ├── StructuredRegularVolume.cpp │ │ │ ├── StructuredRegularVolume.h │ │ │ ├── StructuredSampler.h │ │ │ ├── StructuredSamplerShared.h │ │ │ ├── StructuredSphericalVolume.cpp │ │ │ ├── StructuredSphericalVolume.h │ │ │ ├── StructuredVolume.cpp │ │ │ ├── StructuredVolume.h │ │ │ ├── StructuredVolumeShared.h │ │ │ ├── UnstructuredBVH.h │ │ │ ├── UnstructuredSampler.h │ │ │ ├── UnstructuredSamplerBase.ih │ │ │ ├── UnstructuredSamplerShared.h │ │ │ ├── UnstructuredVolume.cpp │ │ │ ├── UnstructuredVolume.h │ │ │ ├── UnstructuredVolume.ih │ │ │ ├── UnstructuredVolume.ispc │ │ │ ├── UnstructuredVolumeBase.h │ │ │ ├── UnstructuredVolumeBaseShared.h │ │ │ ├── UnstructuredVolumeShared.h │ │ │ ├── Volume.h │ │ │ ├── VolumeShared.h │ │ │ ├── amr │ │ │ ├── AMR.ih │ │ │ ├── AMRAccel.cpp │ │ │ ├── AMRAccel.h │ │ │ ├── AMRData.cpp │ │ │ ├── AMRData.h │ │ │ ├── AMRSampler.h │ │ │ ├── AMRShared.h │ │ │ ├── AMRVolume.cpp │ │ │ ├── AMRVolume.h │ │ │ ├── AMRVolume.ih │ │ │ ├── AMRVolume.ispc │ │ │ ├── AMRVolumeShared.h │ │ │ ├── CellRef.ih │ │ │ ├── CellRef.ispc │ │ │ ├── DualCell.ih │ │ │ ├── DualCell.ispc │ │ │ ├── FindStack.ih │ │ │ ├── KDTree.ih │ │ │ ├── KDTreeShared.h │ │ │ ├── method_current.ispc │ │ │ ├── method_finest.ispc │ │ │ └── method_octant.ispc │ │ │ ├── particle │ │ │ ├── ParticleSampler.h │ │ │ ├── ParticleVolume.cpp │ │ │ ├── ParticleVolume.h │ │ │ ├── ParticleVolume.ispc │ │ │ └── ParticleVolumeShared.h │ │ │ └── vdb │ │ │ ├── Dda.ih │ │ │ ├── DenseVdbVolume.cpp │ │ │ ├── DenseVdbVolume.h │ │ │ ├── HDDA.ih.in │ │ │ ├── VdbGrid.h │ │ │ ├── VdbGridShared.h │ │ │ ├── VdbInnerNodeObserver.cpp │ │ │ ├── VdbInnerNodeObserver.h │ │ │ ├── VdbIterator.cpp │ │ │ ├── VdbIterator.h │ │ │ ├── VdbIterator.ih │ │ │ ├── VdbIterator.ispc │ │ │ ├── VdbLeafAccessObserver.cpp │ │ │ ├── VdbLeafAccessObserver.h │ │ │ ├── VdbLeafAccessObserver.ih │ │ │ ├── VdbQueryVoxel.ih.in │ │ │ ├── VdbQueryVoxelDense.ih │ │ │ ├── VdbSampleInner.ih.in │ │ │ ├── VdbSampler.cpp │ │ │ ├── VdbSampler.h │ │ │ ├── VdbSampler.ih │ │ │ ├── VdbSampler.ispc │ │ │ ├── VdbSamplerDispatchInner.ih.in │ │ │ ├── VdbSamplerShared.h │ │ │ ├── VdbSampler_dense.ih │ │ │ ├── VdbSampler_denseHandler.ih │ │ │ ├── VdbSampler_denseZYX.ih │ │ │ ├── VdbSampler_filter.ih │ │ │ ├── VdbSampler_leafHandler.ih │ │ │ ├── VdbSampler_nearest.ih │ │ │ ├── VdbSampler_packedHandler.ih │ │ │ ├── VdbSampler_packed_denseZYX.ih │ │ │ ├── VdbSampler_packed_tile.ih │ │ │ ├── VdbSampler_stencilDispatch.ih │ │ │ ├── VdbSampler_tile.ih │ │ │ ├── VdbSampler_traverseAndSample.ih │ │ │ ├── VdbSampler_tricubic.ih │ │ │ ├── VdbSampler_trilinear.ih │ │ │ ├── VdbVolume.cpp │ │ │ ├── VdbVolume.h │ │ │ ├── VdbVolume.ispc │ │ │ └── VdbVolumeShared.h │ └── gpu │ │ ├── CMakeLists.txt │ │ ├── api │ │ ├── AddDeviceAPIs.h │ │ ├── DeviceAPI.cpp │ │ ├── GPUDevice.cpp │ │ └── GPUDevice.h │ │ ├── compute │ │ ├── amr │ │ │ ├── AMR.h │ │ │ ├── CellRef.h │ │ │ ├── DualCell.h │ │ │ ├── FindStack.h │ │ │ └── KDTree.h │ │ ├── common.h │ │ ├── feature_flags.h │ │ ├── iterator_common.h │ │ ├── vdb │ │ │ ├── VdbSampleInner.h.in │ │ │ ├── VdbSamplerDispatchInner.h.in │ │ │ ├── VdbSampler_denseZYX.h │ │ │ ├── VdbSampler_filter.h │ │ │ ├── VdbSampler_leafHandler.h │ │ │ ├── VdbSampler_nearest.h │ │ │ ├── VdbSampler_packedHandler.h │ │ │ ├── VdbSampler_packed_denseZYX.h │ │ │ ├── VdbSampler_packed_tile.h │ │ │ ├── VdbSampler_stencilDispatch.h │ │ │ ├── VdbSampler_tile.h │ │ │ ├── VdbSampler_traverseAndSample.h │ │ │ ├── VdbSampler_tricubic.h │ │ │ ├── VdbSampler_trilinear.h │ │ │ └── temporal_data_interpolation.h │ │ ├── vklCompute.h │ │ ├── vklComputeAMR.h │ │ ├── vklComputeParticle.h │ │ ├── vklComputeUnstructured.h │ │ ├── vklComputeVdb.h │ │ ├── vklIterateDefault.h │ │ ├── vklIterateUnstructured.h │ │ ├── vklIterateVdb.h │ │ └── vklIterators.h │ │ ├── include │ │ └── openvkl │ │ │ └── device │ │ │ ├── max_iterator_size.h │ │ │ └── openvkl.h │ │ └── openvkl_module_gpu_device_deps.cpp ├── include │ └── openvkl │ │ ├── VKLBackgroundUndefined.h │ │ ├── VKLDataType.h │ │ ├── VKLError.h │ │ ├── VKLFilter.h │ │ ├── VKLFormat.h │ │ ├── VKLLogLevel.h │ │ ├── VKLTemporalFormat.h │ │ ├── common.h │ │ ├── common.isph │ │ ├── data.h │ │ ├── device.h │ │ ├── ispc_cpp_interop.h │ │ ├── iterator.h │ │ ├── iterator.isph │ │ ├── observer.h │ │ ├── openvkl.h │ │ ├── openvkl.isph │ │ ├── openvkl.rc │ │ ├── parameters.h │ │ ├── sampler.h │ │ ├── sampler.isph │ │ ├── types.h │ │ ├── vdb.h │ │ ├── vdb_topology.h.in │ │ ├── version.h.in │ │ ├── volume.h │ │ └── volume.isph └── util │ └── vklGenerateIteratorSizeHeader.cpp ├── superbuild ├── CMakeLists.txt └── dependencies │ ├── dep_blosc.cmake │ ├── dep_boost.cmake │ ├── dep_embree.cmake │ ├── dep_glfw.cmake │ ├── dep_ilmbase.cmake │ ├── dep_ispc.cmake │ ├── dep_openvdb.cmake │ ├── dep_rkcommon.cmake │ ├── dep_tbb.cmake │ ├── dep_zlib.cmake │ └── glfw.patch ├── testing ├── CMakeLists.txt ├── apps │ ├── AppInit.cpp │ ├── AppInit.h │ ├── CMakeLists.txt │ ├── TestingAllocatorStl.h │ ├── benchmark_env.h │ ├── benchmark_suite │ │ ├── compute_gradient.h │ │ ├── compute_sample.h │ │ ├── compute_sample_multi.h │ │ ├── interval_iterators.h │ │ ├── utility.h │ │ └── volume.h │ ├── tests │ │ ├── alignment.cpp │ │ ├── amr_volume_sampling.cpp │ │ ├── amr_volume_value_range.cpp │ │ ├── aos_soa_conversion.h │ │ ├── background_undefined.cpp │ │ ├── feature_flags.cpp │ │ ├── gradient_utility.h │ │ ├── hit_iterator.cpp │ │ ├── hit_iterator_epsilon.cpp │ │ ├── interval_iterator.cpp │ │ ├── iterator_utility.h │ │ ├── multi_attrib_utility.h │ │ ├── multi_device.cpp │ │ ├── particle_volume_gradients.cpp │ │ ├── particle_volume_interval_iterator.cpp │ │ ├── particle_volume_radius.cpp │ │ ├── particle_volume_sampling.cpp │ │ ├── particle_volume_value_range.cpp │ │ ├── sampling_utility.h │ │ ├── simd_conformance.cpp │ │ ├── simd_conformance.ispc │ │ ├── simd_type_conversion.cpp │ │ ├── stream_gradients.cpp │ │ ├── stream_sampling.cpp │ │ ├── structured_regular_volume.h │ │ ├── structured_regular_volume_gradients_motion_blur.cpp │ │ ├── structured_regular_volume_multi.cpp │ │ ├── structured_regular_volume_sampling.cpp │ │ ├── structured_regular_volume_sampling_motion_blur.cpp │ │ ├── structured_regular_volume_strides.cpp │ │ ├── structured_spherical_volume_bounding_box.cpp │ │ ├── structured_spherical_volume_sampling.cpp │ │ ├── structured_volume_gradients.cpp │ │ ├── structured_volume_value_range.cpp │ │ ├── unstructured_volume.h │ │ ├── unstructured_volume_gradients.cpp │ │ ├── unstructured_volume_sampling.cpp │ │ ├── unstructured_volume_strides.cpp │ │ ├── unstructured_volume_value_range.cpp │ │ ├── vdb_volume.cpp │ │ ├── vdb_volume_dense.cpp │ │ ├── vdb_volume_inner_node_observer.cpp │ │ ├── vdb_volume_motion_blur.cpp │ │ ├── vdb_volume_multi.cpp │ │ ├── vectorized_gradients.cpp │ │ ├── vectorized_hit_iterator.cpp │ │ ├── vectorized_interval_iterator.cpp │ │ ├── vectorized_sampling.cpp │ │ └── wrappers.h │ ├── vklBenchmarkParticleVolume.cpp │ ├── vklBenchmarkStructuredVolume.cpp │ ├── vklBenchmarkStructuredVolumeMulti.cpp │ ├── vklBenchmarkUnstructuredVolume.cpp │ ├── vklBenchmarkVdbVolume.cpp │ ├── vklBenchmarkVdbVolumeMulti.cpp │ └── vklTests.cpp ├── external │ ├── catch.hpp │ └── half.hpp ├── openvkl_testing.h └── volume │ ├── OpenVdbVolume.h │ ├── ProceduralParticleVolume.h │ ├── ProceduralShellsAMRVolume.h │ ├── ProceduralStructuredRegularVolume.h │ ├── ProceduralStructuredSphericalVolume.h │ ├── ProceduralStructuredVolume.h │ ├── ProceduralUnstructuredVolume.h │ ├── ProceduralVdbVolume.h │ ├── ProceduralVdbVolumeMulti.h │ ├── ProceduralVolume.h │ ├── ProceduralVolumeMulti.h │ ├── RawFileStructuredVolume.h │ ├── RawHFileStructuredVolume.h │ ├── TestingAMRVolume.h │ ├── TestingStructuredVolume.h │ ├── TestingStructuredVolumeMulti.h │ ├── TestingUnstructuredMixedSimple.h │ ├── TestingVdbTorusVolume.cpp │ ├── TestingVdbTorusVolume.h │ ├── TestingVolume.h │ ├── makeAMR.md │ └── procedural_functions.h ├── third-party-programs-Embree.txt ├── third-party-programs-OSPRay.txt ├── third-party-programs-TBB.txt ├── third-party-programs.txt └── utility ├── CMakeLists.txt ├── temporal_compression ├── CMakeLists.txt └── include │ └── openvkl │ └── utility │ └── temporal_compression │ └── douglas_peucker.h ├── usda ├── CMakeLists.txt └── include │ └── openvkl │ └── utility │ └── usda │ └── usda.h └── vdb ├── CMakeLists.txt └── include └── openvkl └── utility └── vdb ├── InnerNodes.h ├── OpenVdbGrid.h └── VdbVolumeBuffers.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.rc text working-tree-encoding=UTF-16LE-BOM eol=CRLF 2 | glfw.patch eol=lf 3 | -------------------------------------------------------------------------------- /.github/deps/dpcpp-linux-icx.env: -------------------------------------------------------------------------------- 1 | DPCPP_VERSION=intel/2024.1.0 -------------------------------------------------------------------------------- /.github/deps/dpcpp-sycl-nightly.env: -------------------------------------------------------------------------------- 1 | DPCPP_VERSION=intel-llvm/nightly-2023-10-26-rk 2 | -------------------------------------------------------------------------------- /.github/deps/dpcpp-windows-icx.env: -------------------------------------------------------------------------------- 1 | DPCPP_VERSION=oneAPI/compiler/2024.1 -------------------------------------------------------------------------------- /.github/deps/gfx-linux-public.env: -------------------------------------------------------------------------------- 1 | GFX_DRIVER_VERSION=linux-latest -------------------------------------------------------------------------------- /.github/deps/gfx-windows-public.env: -------------------------------------------------------------------------------- 1 | GFX_DRIVER_VERSION=windows-101.5445 -------------------------------------------------------------------------------- /.github/env/pvc-runtime-options.env: -------------------------------------------------------------------------------- 1 | ## Copyright 2023 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | PrintDebugSettings=1 5 | NEOReadDebugKeys=1 6 | 7 | # Run it on single tile (disable implicit scaling) 8 | EnableImplicitScaling=0 9 | 10 | # Force native SIMD width for PVC 11 | IGC_ForceOCLSIMDWidth=16 -------------------------------------------------------------------------------- /.github/workflows/internal.nightly.windows.yml: -------------------------------------------------------------------------------- 1 | ## Copyright 2023 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | name: (Internal) Nightly Windows 5 | on: 6 | schedule: 7 | - cron: '0 0 * * *' 8 | workflow_dispatch: 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | permissions: read-all 15 | 16 | jobs: 17 | build-windows-msvc15-debug: 18 | secrets: inherit 19 | uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows.yml@main 20 | with: 21 | force-delete: true # guarantees .gitattributes are respected in working dir 22 | submodules: true 23 | runs-on: '[ "Windows", "build" ]' 24 | artifact-out: build-windows-msvc15-debug 25 | artifact-path: ./build/install 26 | cmd: gitlab\build.bat "Visual Studio 15 2017 Win64" "v141" "Debug" 27 | 28 | test-windows-msvc15-debug: 29 | needs: build-windows-msvc15-debug 30 | secrets: inherit 31 | uses: intel-innersource/libraries.devops.renderkit.workflows/.github/workflows/windows.yml@main 32 | with: 33 | runs-on: '[ "Windows", "build" ]' 34 | artifact-in: build-windows-msvc15-debug 35 | cmd: | 36 | gitlab\run_tests.bat -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build*/ 2 | install/ 3 | .vscode/ 4 | .*.swp 5 | imgui.ini 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "testing/external/benchmark"] 2 | path = testing/external/benchmark 3 | url = https://github.com/google/benchmark.git 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | Security Policy 2 | =============== 3 | 4 | Intel is committed to rapidly addressing security vulnerabilities 5 | affecting our customers and providing clear guidance on the solution, 6 | impact, severity and mitigation. 7 | 8 | Reporting a Vulnerability 9 | ------------------------- 10 | 11 | Please [report any security vulnerabilities][guidelines] in this project 12 | utilizing the [guidelines here][guidelines]. 13 | 14 | [guidelines]: https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html "Vulnerability Handling Guidelines" 15 | -------------------------------------------------------------------------------- /cmake/check_build.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | std::cout << "success" << std::endl; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /cmake/openvkl_dpcpp.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2022 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | macro(openvkl_add_sycl_target target) 5 | # "-fsycl" requires at least C++17 6 | target_compile_features(${target} PUBLIC cxx_std_17) 7 | target_compile_options(${target} PUBLIC -fsycl) 8 | target_link_options(${target} PUBLIC -fsycl) 9 | endmacro() 10 | -------------------------------------------------------------------------------- /doc/images.md: -------------------------------------------------------------------------------- 1 | [imgStructuredSphericalCoords]: images/structured_spherical_coords.png 2 | [imgVdbStructure]: images/vdb_structure.png 3 | [imgVklExamples]: images/vklExamples.png 4 | -------------------------------------------------------------------------------- /doc/images/structured_spherical_coords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/doc/images/structured_spherical_coords.png -------------------------------------------------------------------------------- /doc/images/vdb_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/doc/images/vdb_structure.png -------------------------------------------------------------------------------- /doc/images/vklExamples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/doc/images/vklExamples.png -------------------------------------------------------------------------------- /doc/legal.md: -------------------------------------------------------------------------------- 1 | Disclaimer and Legal Information 2 | ================================ 3 | 4 | © 2019-2021 Intel Corporation 5 | 6 | [Privacy Notice](https://www.intel.com/privacy) 7 | 8 | Intel, the Intel logo, Xeon, Intel Xeon Phi, and Intel Core are trademarks of 9 | Intel Corporation in the U.S. and/or other countries. *Other names and brands 10 | may be claimed as the property of others. 11 | 12 | 13 | Optimization Notice: Intel's compilers may or may not optimize to the same 14 | degree for non-Intel microprocessors for optimizations that are not unique to 15 | Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 16 | instruction sets and other optimizations. Intel does not guarantee the 17 | availability, functionality, or effectiveness of any optimization on 18 | microprocessors not manufactured by Intel. Microprocessor-dependent 19 | optimizations in this product are intended for use with Intel microprocessors. 20 | Certain optimizations not specific to Intel microarchitecture are reserved for 21 | Intel microprocessors. Please refer to the applicable product User and Reference 22 | Guides for more information regarding the specific instruction sets covered by 23 | this notice. Notice Revision #20110804 24 | -------------------------------------------------------------------------------- /doc/links.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/doc/links.md -------------------------------------------------------------------------------- /doc/readme_head.md: -------------------------------------------------------------------------------- 1 | Intel® Open Volume Kernel Library 2 | ================================= 3 | 4 | This is release v of Intel® Open VKL. For changes and new 5 | features see the [changelog](CHANGELOG.md). Visit http://www.openvkl.org for 6 | more information. 7 | -------------------------------------------------------------------------------- /doc/related_projects.md: -------------------------------------------------------------------------------- 1 | Projects that make use of Open VKL 2 | ================================== 3 | 4 | This page gives a brief (and incomplete) list of other projects that make use of 5 | Open VKL, as well as a set of related links to other projects and related 6 | information. 7 | 8 | If you have a project that makes use of Open VKL and would like this to be 9 | listed here, please let us know. 10 | 11 | - [Intel® OSPRay](http://www.ospray.org), a ray tracing based rendering engine 12 | for high-fidelity visualization 13 | 14 | 15 | Projects that are closely related to Open VKL 16 | ============================================= 17 | 18 | - The [Intel® oneAPI Rendering Toolkit](https://software.intel.com/en-us/rendering-framework) 19 | 20 | - The [Intel® Embree](http://embree.github.io) Ray Tracing Kernel Framework 21 | -------------------------------------------------------------------------------- /doc/support.md: -------------------------------------------------------------------------------- 1 | Support and Contact 2 | ------------------- 3 | 4 | Open VKL is under active development, and though we do our best to guarantee 5 | stable release versions a certain number of bugs, as-yet-missing features, 6 | inconsistencies, or any other issues are still possible. Should you find any 7 | such issues please report them immediately via [Open VKL's GitHub Issue 8 | Tracker](https://github.com/OpenVKL/openvkl/issues) (or, if you should happen to 9 | have a fix for it, you can also send us a pull request); you may also contact us 10 | via email at . 11 | 12 | Join our [mailing 13 | list](https://groups.google.com/forum/#!forum/openvkl-announce/join) to receive 14 | release announcements and major news regarding Open VKL. 15 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | ## "Hello world" VKL tutorials ## 5 | 6 | add_executable(vklTutorialCPU vklTutorialCPU.c ${VKL_RESOURCE}) 7 | target_link_libraries(vklTutorialCPU PRIVATE openvkl openvkl_module_cpu_device) 8 | install(TARGETS vklTutorialCPU RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 9 | 10 | if (${OPENVKL_ENABLE_DEVICE_GPU}) 11 | add_executable(vklTutorialGPU vklTutorialGPU.cpp ${VKL_RESOURCE}) 12 | target_link_libraries(vklTutorialGPU PRIVATE openvkl openvkl_module_gpu_device) 13 | install(TARGETS vklTutorialGPU RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 14 | endif() 15 | 16 | ## ISPC tutorial ## 17 | 18 | add_subdirectory(ispc) 19 | 20 | ## Interacive Examples ## 21 | 22 | add_subdirectory(interactive) 23 | 24 | ## Minimal Console-based Examples ## 25 | 26 | add_subdirectory(minimal) 27 | -------------------------------------------------------------------------------- /examples/from_openvkl_install/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | # NOTE: This CMakeLists.txt is intended to be used to exercise an OpenVKL 5 | # install and demonstrate how external applications can build against 6 | # OpenVKL using CMake. 7 | # 8 | # Once you have done a 'make install' of an existing OpenVKL 9 | # build, create a separate build directory and invoke CMake on this 10 | # directory. If you have 'openvkl_DIR' setup correctly to point to where 11 | # you just installed OpenVKL, then this should built 12 | # the vklTutorialCPU/vklTutorialGPU app 13 | # from that install and NOT use your local build. 14 | 15 | cmake_minimum_required(VERSION 3.1) 16 | 17 | project(vklTutorial) 18 | 19 | cmake_policy(SET CMP0074 NEW) 20 | 21 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) 22 | 23 | find_package(openvkl REQUIRED) 24 | 25 | if (TARGET openvkl::openvkl_module_cpu_device) 26 | add_executable(vklTutorialCPU ${CMAKE_CURRENT_SOURCE_DIR}/../vklTutorialCPU.c) 27 | set_target_properties(vklTutorialCPU 28 | PROPERTIES 29 | C_STANDARD 99 30 | C_STANDARD_REQUIRED ON 31 | C_EXTENSIONS OFF) 32 | target_link_libraries(vklTutorialCPU PRIVATE openvkl::openvkl openvkl::openvkl_module_cpu_device) 33 | endif() 34 | 35 | if (TARGET openvkl::openvkl_module_gpu_device) 36 | add_executable(vklTutorialGPU ${CMAKE_CURRENT_SOURCE_DIR}/../vklTutorialGPU.cpp) 37 | target_link_libraries(vklTutorialGPU PRIVATE openvkl::openvkl openvkl::openvkl_module_gpu_device) 38 | endif() 39 | -------------------------------------------------------------------------------- /examples/interactive/BatchApplication.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace openvkl { 11 | namespace examples { 12 | 13 | struct Scene; 14 | class Scheduler; 15 | 16 | class BatchApplication 17 | { 18 | public: 19 | BatchApplication(); 20 | ~BatchApplication(); 21 | void run(Scene &scene); 22 | }; 23 | 24 | } // namespace examples 25 | } // namespace openvkl 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/interactive/InteractiveApplication.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | struct GLFWwindow; 11 | 12 | namespace openvkl { 13 | namespace examples { 14 | 15 | struct Scene; 16 | class Scheduler; 17 | class RenderView; 18 | 19 | class InteractiveApplication 20 | { 21 | public: 22 | InteractiveApplication(); 23 | ~InteractiveApplication(); 24 | void run(Scene &scene); 25 | 26 | private: 27 | void initializeImgui(); 28 | void finalizeImgui(); 29 | bool createWindow(bool disableVSync); 30 | void initDockspace(unsigned &leftNodeId, 31 | unsigned ¢erNodeId, 32 | unsigned &rightNodeId); 33 | void showContextMenu(); 34 | void disableInvisibleRenderViews(); 35 | void enableVisibleRenderViews(); 36 | 37 | private: 38 | GLFWwindow *window{nullptr}; 39 | Scheduler *scheduler{nullptr}; 40 | std::list activeViews; 41 | std::list inactiveViews; 42 | std::vector> views; 43 | }; 44 | 45 | } // namespace examples 46 | } // namespace openvkl 47 | 48 | -------------------------------------------------------------------------------- /examples/interactive/ParameterGui.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include // Push/PopDisabled 9 | 10 | #include 11 | 12 | namespace openvkl { 13 | namespace examples { 14 | 15 | class Renderer; 16 | class RendererParams; 17 | class Scheduler; 18 | class Scene; 19 | 20 | class ParameterGui 21 | { 22 | public: 23 | virtual ~ParameterGui(); 24 | virtual bool draw(const Scheduler &scheduler) = 0; 25 | 26 | // Factory methods. 27 | static std::unique_ptr makeRendererGui(Renderer *renderer); 28 | static std::unique_ptr makeRendererParamsGui(Scene *scene); 29 | static std::unique_ptr makeSceneParamsGui(Scene *scene); 30 | }; 31 | 32 | } // namespace examples 33 | } // namespace openvkl 34 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.editorconfig: -------------------------------------------------------------------------------- 1 | # See http://editorconfig.org to read about the EditorConfig format. 2 | # - In theory automatically supported by VS2017+ and most common IDE or text editors. 3 | # - In practice VS2019 stills gets trailing whitespaces wrong :( 4 | # - Suggest install to trim whitespaces: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.TrailingWhitespaceVisualizer 5 | # - Alternative for older VS2010 to VS2015: https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig 6 | 7 | # top-most EditorConfig file 8 | root = true 9 | 10 | # Default settings: 11 | # Use 4 spaces as indentation 12 | [*] 13 | indent_style = space 14 | indent_size = 4 15 | insert_final_newline = true 16 | trim_trailing_whitespace = true 17 | 18 | [imstb_*] 19 | indent_size = 3 20 | trim_trailing_whitespace = false 21 | 22 | [Makefile] 23 | indent_style = tab 24 | indent_size = 4 25 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.c text 4 | *.cpp text 5 | *.h text 6 | *.m text 7 | *.mm text 8 | *.md text 9 | *.txt text 10 | *.html text 11 | *.bat text 12 | *.frag text 13 | *.vert text 14 | *.mkb text 15 | *.icf text 16 | 17 | *.sln text eol=crlf 18 | *.vcxproj text eol=crlf 19 | *.vcxproj.filters text eol=crlf 20 | *.natvis text eol=crlf 21 | 22 | Makefile text eol=lf 23 | *.sh text eol=lf 24 | *.pbxproj text eol=lf 25 | *.storyboard text eol=lf 26 | *.plist text eol=lf 27 | 28 | *.png binary 29 | *.ttf binary 30 | *.lib binary 31 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://github.com/ocornut/imgui/wiki/Sponsors'] 2 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | (Click "Preview" to turn any http URL into a clickable link) 2 | 3 | PLEASE CAREFULLY READ: 4 | https://github.com/ocornut/imgui/issues/2261 5 | 6 | (Clear this template before submitting your PR) 7 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.github/workflows/scheduled.yml: -------------------------------------------------------------------------------- 1 | # 2 | # This is a dummy workflow used to trigger scheduled builds. Forked repositories most likely should disable this 3 | # workflow to avoid daily builds of inactive repositories. 4 | # 5 | name: scheduled 6 | 7 | on: 8 | schedule: 9 | - cron: '0 9 * * *' 10 | 11 | jobs: 12 | scheduled: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - run: exit 0 16 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/.gitignore: -------------------------------------------------------------------------------- 1 | ## OSX artifacts 2 | .DS_Store 3 | 4 | ## Dear ImGui artifacts 5 | imgui.ini 6 | 7 | ## General build artifacts 8 | *.o 9 | *.obj 10 | *.exe 11 | examples/build/* 12 | examples/*/Debug/* 13 | examples/*/Release/* 14 | examples/*/x64/* 15 | 16 | ## Visual Studio artifacts 17 | .vs 18 | ipch 19 | *.opensdf 20 | *.log 21 | *.pdb 22 | *.ilk 23 | *.user 24 | *.sdf 25 | *.suo 26 | *.VC.db 27 | *.VC.VC.opendb 28 | 29 | ## Commonly used CMake directories 30 | /build*/ 31 | 32 | ## Xcode artifacts 33 | project.xcworkspace 34 | xcuserdata 35 | 36 | ## Emscripten artifacts 37 | examples/*.o.tmp 38 | examples/*.out.js 39 | examples/*.out.wasm 40 | examples/example_emscripten_opengl3/web/* 41 | examples/example_emscripten_wgpu/web/* 42 | 43 | ## JetBrains IDE artifacts 44 | .idea 45 | cmake-build-* 46 | 47 | ## Unix executables from our example Makefiles 48 | examples/example_glfw_opengl2/example_glfw_opengl2 49 | examples/example_glfw_opengl3/example_glfw_opengl3 50 | examples/example_glut_opengl2/example_glut_opengl2 51 | examples/example_null/example_null 52 | examples/example_sdl_opengl2/example_sdl_opengl2 53 | examples/example_sdl_opengl3/example_sdl_opengl3 54 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2021 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/imgui_impl_dx10.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX10 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | struct ID3D10Device; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); 20 | IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Use if you want to reset your rendering device without losing Dear ImGui state. 25 | IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects(); 26 | IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects(); 27 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | struct ID3D11Device; 18 | struct ID3D11DeviceContext; 19 | 20 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 23 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 24 | 25 | // Use if you want to reset your rendering device without losing Dear ImGui state. 26 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 27 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 28 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | 17 | struct IDirect3DDevice9; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 20 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Use if you want to reset your rendering device without losing Dear ImGui state. 25 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 26 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 27 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/imgui_impl_osx.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for OSX / Cocoa 2 | // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) 3 | // [ALPHA] Early backend, not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac. 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend). 8 | // Issues: 9 | // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. 10 | // [ ] Platform: Multi-viewport / platform windows. 11 | 12 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 13 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 14 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 15 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 16 | 17 | #include "imgui.h" // IMGUI_IMPL_API 18 | 19 | @class NSEvent; 20 | @class NSView; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplOSX_Init(); 23 | IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown(); 24 | IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view); 25 | IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent* _Nonnull event, NSView* _Nullable view); 26 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/imgui_impl_wgpu.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for WebGPU 2 | // This needs to be used along with a Platform Binding (e.g. GLFW) 3 | // (Please note that WebGPU is currently experimental, will not run on non-beta browsers, and may break.) 4 | 5 | // Implemented features: 6 | // [X] Renderer: User texture binding. Use 'WGPUTextureView' as ImTextureID. Read the FAQ about ImTextureID! 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 12 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 13 | 14 | #pragma once 15 | #include "imgui.h" // IMGUI_IMPL_API 16 | #include 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplWGPU_Init(WGPUDevice device, int num_frames_in_flight, WGPUTextureFormat rt_format); 19 | IMGUI_IMPL_API void ImGui_ImplWGPU_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplWGPU_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder pass_encoder); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API void ImGui_ImplWGPU_InvalidateDeviceObjects(); 25 | IMGUI_IMPL_API bool ImGui_ImplWGPU_CreateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/vulkan/generate_spv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## -V: create SPIR-V binary 3 | ## -x: save binary output as text-based 32-bit hexadecimal numbers 4 | ## -o: output file 5 | glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag 6 | glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert 7 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/vulkan/glsl_shader.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) out vec4 fColor; 3 | 4 | layout(set=0, binding=0) uniform sampler2D sTexture; 5 | 6 | layout(location = 0) in struct { 7 | vec4 Color; 8 | vec2 UV; 9 | } In; 10 | 11 | void main() 12 | { 13 | fColor = In.Color * texture(sTexture, In.UV.st); 14 | } 15 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/backends/vulkan/glsl_shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) in vec2 aPos; 3 | layout(location = 1) in vec2 aUV; 4 | layout(location = 2) in vec4 aColor; 5 | 6 | layout(push_constant) uniform uPushConstant { 7 | vec2 uScale; 8 | vec2 uTranslate; 9 | } pc; 10 | 11 | out gl_PerVertex { 12 | vec4 gl_Position; 13 | }; 14 | 15 | layout(location = 0) out struct { 16 | vec4 Color; 17 | vec2 UV; 18 | } Out; 19 | 20 | void main() 21 | { 22 | Out.Color = aColor; 23 | Out.UV = aUV; 24 | gl_Position = vec4(aPos * pc.uScale + pc.uTranslate, 0, 1); 25 | } 26 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/README.txt: -------------------------------------------------------------------------------- 1 | See BACKENDS and EXAMPLES files in the docs/ folder, or on the web at: https://github.com/ocornut/imgui/tree/master/docs 2 | 3 | Backends = Helper code to facilitate integration with platforms/graphics api (used by Examples + should be used by your app). 4 | Examples = Standalone applications showcasing integration with platforms/graphics api. 5 | 6 | Some Examples have extra README files in their respective directory, please check them too! 7 | 8 | Once Dear ImGui is running (in either examples or your own application/game/engine), 9 | run and refer to ImGui::ShowDemoWindow() in imgui_demo.cpp for the end-user API. 10 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_allegro5/imconfig_allegro5.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI ALLEGRO 5 EXAMPLE 3 | // See imconfig.h for the full template 4 | // Because Allegro doesn't support 16-bit vertex indices, we enable the compile-time option of imgui to use 32-bit indices 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | // Use 32-bit vertex indices because Allegro doesn't support 16-bit ones 10 | // This allows us to avoid converting vertices format at runtime 11 | #define ImDrawIdx int 12 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | 3 | project(ImGuiExample) 4 | 5 | set(CMAKE_CXX_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | set(CMAKE_CXX_EXTENSIONS OFF) 8 | 9 | add_library(${CMAKE_PROJECT_NAME} SHARED 10 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui_demo.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui_draw.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui_tables.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/../../imgui_widgets.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/../../backends/imgui_impl_android.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/../../backends/imgui_impl_opengl3.cpp 18 | ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c 19 | ) 20 | 21 | set(CMAKE_SHARED_LINKER_FLAGS 22 | "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate" 23 | ) 24 | 25 | target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE 26 | IMGUI_IMPL_OPENGL_ES3 27 | ) 28 | 29 | target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE 30 | ${CMAKE_CURRENT_SOURCE_DIR}/../.. 31 | ${CMAKE_CURRENT_SOURCE_DIR}/../../backends 32 | ${ANDROID_NDK}/sources/android/native_app_glue 33 | ) 34 | 35 | target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE 36 | android 37 | EGL 38 | GLESv3 39 | log 40 | ) 41 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/android/.gitignore: -------------------------------------------------------------------------------- 1 | .cxx 2 | .externalNativeBuild 3 | build/ 4 | *.iml 5 | 6 | .idea 7 | .gradle 8 | local.properties 9 | 10 | # Android Studio puts a Gradle wrapper here, that we don't want: 11 | gradle/ 12 | gradlew* 13 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion 29 6 | buildToolsVersion "30.0.3" 7 | ndkVersion "21.4.7075529" 8 | defaultConfig { 9 | applicationId "imgui.example.android" 10 | minSdkVersion 23 11 | targetSdkVersion 29 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') 20 | } 21 | } 22 | 23 | externalNativeBuild { 24 | cmake { 25 | path "../../CMakeLists.txt" 26 | } 27 | } 28 | } 29 | repositories { 30 | mavenCentral() 31 | } 32 | dependencies { 33 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 34 | } 35 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.4.31' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } 25 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_android_opengl3/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_apple_metal/README.md: -------------------------------------------------------------------------------- 1 | # iOS / OSX Metal example 2 | 3 | ## Introduction 4 | 5 | This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9. 6 | 7 | Consider basing your work off the example_glfw_metal/ or example_sdl_metal/ examples. They are better supported and will be portable unlike this one. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_apple_metal/macOS/Info-macOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | imgui 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSMainStoryboardFile 26 | MainMenu 27 | NSPrincipalClass 28 | NSApplication 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_emscripten_wgpu/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions 5 | 6 | - Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools. 7 | 8 | - Then build using `make` while in the `example_emscripten_wgpu/` directory. 9 | 10 | - Requires Emscripten 2.0.10 (December 2020) due to GLFW adaptations 11 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_glfw_metal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # You will need GLFW (http://www.glfw.org): 3 | # brew install glfw 4 | # 5 | 6 | #CXX = g++ 7 | #CXX = clang++ 8 | 9 | EXE = example_glfw_metal 10 | IMGUI_DIR = ../.. 11 | SOURCES = main.mm 12 | SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp 13 | SOURCES += $(IMGUI_DIR)/backends/imgui_impl_glfw.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm 14 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 15 | 16 | LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore 17 | LIBS += -L/usr/local/lib -L/opt/homebrew/lib 18 | LIBS += -lglfw 19 | 20 | CXXFLAGS = -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I/usr/local/include -I/opt/homebrew/include 21 | CXXFLAGS += -Wall -Wformat 22 | CFLAGS = $(CXXFLAGS) 23 | 24 | %.o:%.cpp 25 | $(CXX) $(CXXFLAGS) -c -o $@ $< 26 | 27 | %.o:$(IMGUI_DIR)/%.cpp 28 | $(CXX) $(CXXFLAGS) -c -o $@ $< 29 | 30 | %.o:$(IMGUI_DIR)/backends/%.cpp 31 | $(CXX) $(CXXFLAGS) -c -o $@ $< 32 | 33 | %.o:%.mm 34 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 35 | 36 | %.o:$(IMGUI_DIR)/backends/%.mm 37 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 38 | 39 | all: $(EXE) 40 | @echo Build complete 41 | 42 | $(EXE): $(OBJS) 43 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 44 | 45 | clean: 46 | rm -f $(EXE) $(OBJS) 47 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_glfw_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_glfw_opengl2 4 | @set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_glfw_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_glfw_opengl3 4 | @set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I..\libs\gl3w 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c 6 | @set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_glfw_vulkan/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | 3 | @set OUT_EXE=example_glfw_vulkan 4 | @set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 7 | 8 | @set OUT_DIR=Debug 9 | mkdir %OUT_DIR% 10 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 11 | 12 | @set OUT_DIR=Release 13 | mkdir %OUT_DIR% 14 | cl /nologo /Zi /MD /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 15 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_glfw_vulkan/build_win64.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler. 2 | 3 | @set INCLUDES=/I..\.. /I..\..\backends /I..\libs\glfw\include /I %VULKAN_SDK%\include 4 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\backends\imgui_impl_glfw.cpp ..\..\imgui*.cpp 5 | @set LIBS=/LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 6 | 7 | @set OUT_DIR=Debug 8 | mkdir %OUT_DIR% 9 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 10 | 11 | @set OUT_DIR=Release 12 | mkdir %OUT_DIR% 13 | cl /nologo /Zi /MD /Ox /Oi %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 14 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_marmalade/data/app.icf: -------------------------------------------------------------------------------- 1 | # This file is for configuration settings for your 2 | # application. 3 | # 4 | # The syntax is similar to windows .ini files ie 5 | # 6 | # [GroupName] 7 | # Setting = Value 8 | # 9 | # Which can be read by your application using 10 | # e.g s3eConfigGetString("GroupName", "Setting", string) 11 | # 12 | # All settings must be documented in .config.txt files. 13 | # New settings specific to this application should be 14 | # documented in app.config.txt 15 | # 16 | # Some conditional operations are also permitted, see the 17 | # S3E documentation for details. 18 | 19 | [S3E] 20 | MemSize=6000000 21 | MemSizeDebug=6000000 22 | DispFixRot=FixedLandscape 23 | 24 | # emulate iphone 5 resolution, change these settings to emulate other display resolution 25 | WinWidth=1136 26 | WinHeight=640 27 | 28 | [GX] 29 | DataCacheSize=131070 30 | 31 | [Util] 32 | #MemoryBreakpoint=1282 33 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_marmalade/marmalade_example.mkb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env mkb 2 | 3 | # ImGui - standalone example application for Marmalade 4 | # Copyright (C) 2015 by Giovanni Zito 5 | # This file is part of ImGui 6 | # https://github.com/ocornut/imgui 7 | 8 | define IMGUI_DISABLE_INCLUDE_IMCONFIG_H 9 | define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 10 | define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS 11 | define _snprintf=snprintf 12 | 13 | options 14 | { 15 | optimise-speed=1 16 | } 17 | 18 | includepaths 19 | { 20 | ../.. 21 | ../../backends 22 | } 23 | 24 | subprojects 25 | { 26 | iwgx 27 | } 28 | 29 | files 30 | { 31 | (.) 32 | ["imgui"] 33 | ../../imgui.cpp 34 | ../../imgui_demo.cpp 35 | ../../imgui_draw.cpp 36 | ../../imgui_tables.cpp 37 | ../../imgui_widgets.cpp 38 | ../../imconfig.h 39 | ../../imgui.h 40 | ../../imgui_internal.h 41 | 42 | ["imgui","Marmalade backend"] 43 | ../../backends/imgui_impl_marmalade.h 44 | ../../backends/imgui_impl_marmalade.cpp 45 | main.cpp 46 | 47 | } 48 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_null/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib imm32.lib 4 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_null/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: "null" example application 2 | // (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT) 3 | // This is useful to test building, but you cannot interact with anything here! 4 | #include "imgui.h" 5 | #include 6 | 7 | int main(int, char**) 8 | { 9 | IMGUI_CHECKVERSION(); 10 | ImGui::CreateContext(); 11 | ImGuiIO& io = ImGui::GetIO(); 12 | 13 | // Build atlas 14 | unsigned char* tex_pixels = NULL; 15 | int tex_w, tex_h; 16 | io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); 17 | 18 | for (int n = 0; n < 20; n++) 19 | { 20 | printf("NewFrame() %d\n", n); 21 | io.DisplaySize = ImVec2(1920, 1080); 22 | io.DeltaTime = 1.0f / 60.0f; 23 | ImGui::NewFrame(); 24 | 25 | static float f = 0.0f; 26 | ImGui::Text("Hello, world!"); 27 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); 28 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); 29 | ImGui::ShowDemoWindow(NULL); 30 | 31 | ImGui::Render(); 32 | } 33 | 34 | printf("DestroyContext()\n"); 35 | ImGui::DestroyContext(); 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_sdl_directx11 4 | @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib shell32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_metal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # You will need SDL2 (http://www.libsdl.org): 3 | # brew install sdl2 4 | # 5 | 6 | #CXX = g++ 7 | #CXX = clang++ 8 | 9 | EXE = example_sdl_metal 10 | IMGUI_DIR = ../.. 11 | SOURCES = main.mm 12 | SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp 13 | SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_metal.mm 14 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 15 | 16 | LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore 17 | LIBS += `sdl2-config --libs` 18 | LIBS += -L/usr/local/lib 19 | 20 | CXXFLAGS = -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I/usr/local/include 21 | CXXFLAGS += `sdl2-config --cflags` 22 | CXXFLAGS += -Wall -Wformat 23 | CFLAGS = $(CXXFLAGS) 24 | 25 | %.o:%.cpp 26 | $(CXX) $(CXXFLAGS) -c -o $@ $< 27 | 28 | %.o:$(IMGUI_DIR)/%.cpp 29 | $(CXX) $(CXXFLAGS) -c -o $@ $< 30 | 31 | %.o:$(IMGUI_DIR)/backends/%.cpp 32 | $(CXX) $(CXXFLAGS) -c -o $@ $< 33 | 34 | %.o:%.mm 35 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 36 | 37 | %.o:$(IMGUI_DIR)/backends/%.mm 38 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 39 | 40 | all: $(EXE) 41 | @echo Build complete 42 | 43 | $(EXE): $(OBJS) 44 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 45 | 46 | clean: 47 | rm -f $(EXE) $(OBJS) 48 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_opengl2/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's IDE 5 | 6 | Use the provided project file (.vcxproj). Add to solution (imgui_examples.sln) if necessary. 7 | 8 | - On Windows with Visual Studio's CLI 9 | 10 | ``` 11 | set SDL2_DIR=path_to_your_sdl2_folder 12 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 13 | # ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries 14 | # or for 64-bit: 15 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 16 | ``` 17 | 18 | - On Linux and similar Unixes 19 | 20 | ``` 21 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL 22 | ``` 23 | 24 | - On Mac OS X 25 | 26 | ``` 27 | brew install sdl2 28 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl 29 | ``` 30 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_sdl_opengl2 4 | @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl2.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_sdl_opengl3 4 | @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I..\libs\gl3w 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c 6 | @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib shell32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_sdl_vulkan/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | 3 | @set OUT_EXE=example_sdl_vulkan 4 | @set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include /I %VULKAN_SDK%\include 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_vulkan.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 /libpath:%VULKAN_SDK%\lib32 SDL2.lib SDL2main.lib shell32.lib vulkan-1.lib 7 | 8 | @set OUT_DIR=Debug 9 | mkdir %OUT_DIR% 10 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 11 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_win32_directx10/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_win32_directx10 4 | @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\backends\imgui_impl_dx10.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_win32_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_win32_directx11 4 | @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_dx11.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 9 | 10 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_win32_directx12/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @REM Important: to build on 32-bit systems, the DX12 backends needs '#define ImTextureID ImU64', so we pass it here. 3 | @set OUT_DIR=Debug 4 | @set OUT_EXE=example_win32_directx12 5 | @set INCLUDES=/I..\.. /I..\..\backends /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" 6 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_dx12.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp 7 | @set LIBS=d3d12.lib d3dcompiler.lib dxgi.lib 8 | mkdir Debug 9 | cl /nologo /Zi /MD %INCLUDES% /D ImTextureID=ImU64 /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 10 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/example_win32_directx9/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | @set OUT_DIR=Debug 3 | @set OUT_EXE=example_win32_directx9 4 | @set INCLUDES=/I..\.. /I..\..\backends /I "%DXSDK_DIR%/Include" 5 | @set SOURCES=main.cpp ..\..\backends\imgui_impl_dx9.cpp ..\..\backends\imgui_impl_win32.cpp ..\..\imgui*.cpp 6 | @set LIBS=/LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/libs/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/libs/glfw/lib-vc2010-32/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/examples/libs/glfw/lib-vc2010-32/glfw3.lib -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/libs/glfw/lib-vc2010-64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/examples/libs/glfw/lib-vc2010-64/glfw3.lib -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/examples/libs/usynergy/README.txt: -------------------------------------------------------------------------------- 1 | 2 | uSynergy client -- Implementation for the embedded Synergy client library 3 | version 1.0.0, July 7th, 2012 4 | Copyright (c) 2012 Alex Evans 5 | 6 | This is a copy of the files once found at: 7 | https://github.com/symless/synergy-core/tree/790d108a56ada9caad8e56ff777d444485a69da9/src/micro 8 | 9 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/README.txt: -------------------------------------------------------------------------------- 1 | 2 | misc/cpp/ 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | misc/debuggers/ 7 | Helper files for popular debuggers. 8 | With the .natvis file, types like ImVector<> will be displayed nicely in Visual Studio debugger. 9 | 10 | misc/fonts/ 11 | Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts). 12 | Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code. 13 | Suggested fonts and links. 14 | 15 | misc/freetype/ 16 | Font atlas builder/rasterizer using FreeType instead of stb_truetype. 17 | Benefit from better FreeType rasterization, in particular for small fonts. 18 | 19 | misc/single_file/ 20 | Single-file header stub. 21 | We use this to validate compiling all *.cpp files in a same compilation unit. 22 | Users of that technique (also called "Unity builds") can generally provide this themselves, 23 | so we don't really recommend you use this in your projects. 24 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/cpp/README.txt: -------------------------------------------------------------------------------- 1 | 2 | imgui_stdlib.h + imgui_stdlib.cpp 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | imgui_scoped.h 7 | [Experimental, not currently in main repository] 8 | Additional header file with some RAII-style wrappers for common Dear ImGui functions. 9 | Try by merging: https://github.com/ocornut/imgui/pull/2197 10 | Discuss at: https://github.com/ocornut/imgui/issues/2096 11 | 12 | See more C++ related extension on Wiki 13 | https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness 14 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/cpp/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Compatibility: 5 | // - std::string support is only guaranteed to work from C++11. 6 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 7 | 8 | // Changelog: 9 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace ImGui 16 | { 17 | // ImGui::InputText() with std::string 18 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 19 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 20 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 21 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 22 | } 23 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/debuggers/README.txt: -------------------------------------------------------------------------------- 1 | 2 | HELPER FILES FOR POPULAR DEBUGGERS 3 | 4 | imgui.gdb 5 | GDB: disable stepping into trivial functions. 6 | (read comments inside file for details) 7 | 8 | imgui.natstepfilter 9 | Visual Studio Debugger: disable stepping into trivial functions. 10 | (read comments inside file for details) 11 | 12 | imgui.natvis 13 | Visual Studio Debugger: describe Dear ImGui types for better display. 14 | With this, types like ImVector<> will be displayed nicely in the debugger. 15 | (read comments inside file for details) 16 | 17 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/debuggers/imgui.gdb: -------------------------------------------------------------------------------- 1 | # GDB configuration to aid debugging experience 2 | 3 | # To enable these customizations edit $HOME/.gdbinit (or ./.gdbinit if local gdbinit is enabled) and add: 4 | # add-auto-load-safe-path /path/to/imgui.gdb 5 | # source /path/to/imgui.gdb 6 | # 7 | # More Information at: 8 | # * https://sourceware.org/gdb/current/onlinedocs/gdb/gdbinit-man.html 9 | # * https://sourceware.org/gdb/current/onlinedocs/gdb/Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory 10 | 11 | # Disable stepping into trivial functions 12 | skip -rfunction Im(Vec2|Vec4|Strv|Vector|Span)::.+ 13 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/debuggers/imgui.natstepfilter: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | (ImVec2|ImVec4|ImStrv)::.+ 23 | NoStepInto 24 | 25 | 26 | (ImVector|ImSpan).*::operator.+ 27 | NoStepInto 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/examples/interactive/imgui-1.83/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /examples/interactive/imgui-1.83/misc/single_file/imgui_single_file.h: -------------------------------------------------------------------------------- 1 | // dear imgui: single-file wrapper include 2 | // We use this to validate compiling all *.cpp files in a same compilation unit. 3 | // Users of that technique (also called "Unity builds") can generally provide this themselves, 4 | // so we don't really recommend you use this in your projects. 5 | 6 | // Do this: 7 | // #define IMGUI_IMPLEMENTATION 8 | // Before you include this file in *one* C++ file to create the implementation. 9 | // Using this in your project will leak the contents of imgui_internal.h and ImVec2 operators in this compilation unit. 10 | #include "../../imgui.h" 11 | 12 | #ifdef IMGUI_IMPLEMENTATION 13 | #include "../../imgui.cpp" 14 | #include "../../imgui_demo.cpp" 15 | #include "../../imgui_draw.cpp" 16 | #include "../../imgui_tables.cpp" 17 | #include "../../imgui_widgets.cpp" 18 | #endif 19 | -------------------------------------------------------------------------------- /examples/interactive/renderer/Camera.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "Ray.ih" 7 | 8 | struct Camera 9 | { 10 | float sensorWidth; 11 | float focalLength; 12 | vec3f ctw_R[3]; // Three rows of the rotation camera -> world. 13 | vec3f ctw_t; // Translation camera -> world. 14 | }; 15 | 16 | inline void Camera_createRay(const uniform Camera &camera, 17 | const uniform vec2i &res, 18 | const vec2f &p, 19 | Ray &ray) 20 | { 21 | // Note: units of sensor width! 22 | const uniform float irx = rcp((uniform float)res.x); 23 | const vec2f pSensor = 24 | make_vec2f((p.x - 0.5f * res.x) * irx, -(p.y - 0.5f * res.y) * irx); 25 | const vec3f pCamera = make_vec3f( 26 | camera.sensorWidth * pSensor.x, camera.sensorWidth * pSensor.y, 0.f); 27 | 28 | // This is where the aperture is located, in camera coordinates. 29 | const vec3f pAperture = make_vec3f(0.f, 0.f, -camera.focalLength); 30 | const vec3f dCamera = pAperture - pCamera; 31 | 32 | ray.org = make_vec3f(dot(camera.ctw_R[0], pCamera) + camera.ctw_t.x, 33 | dot(camera.ctw_R[1], pCamera) + camera.ctw_t.y, 34 | dot(camera.ctw_R[2], pCamera) + camera.ctw_t.z); 35 | ray.dir = normalize(make_vec3f(dot(camera.ctw_R[0], dCamera), 36 | dot(camera.ctw_R[1], dCamera), 37 | dot(camera.ctw_R[2], dCamera))); 38 | ray.tnear = 0.f; 39 | ray.tfar = inf; 40 | } 41 | -------------------------------------------------------------------------------- /examples/interactive/renderer/Ray.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rkcommon/math/box.h" 7 | #include "rkcommon/math/vec.h" 8 | 9 | namespace openvkl { 10 | namespace examples { 11 | 12 | using namespace rkcommon::math; 13 | 14 | struct Ray 15 | { 16 | vec3f org; 17 | vec3f dir; 18 | range1f t; 19 | }; 20 | 21 | } // namespace examples 22 | } // namespace openvkl 23 | -------------------------------------------------------------------------------- /examples/interactive/renderer/Ray.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rkcommon/math/vec.ih" 7 | #include "rkcommon/math/box.ih" 8 | 9 | struct Ray 10 | { 11 | vec3f org; 12 | vec3f dir; 13 | float tnear; 14 | float tfar; 15 | }; 16 | 17 | inline void intersectBox(const Ray &ray, 18 | const uniform box3f &box, 19 | float &tnear, 20 | float &tfar) 21 | { 22 | const vec3f mins = (box.lower - ray.org) * rcp_safe(ray.dir); 23 | const vec3f maxs = (box.upper - ray.org) * rcp_safe(ray.dir); 24 | tnear = reduce_max(make_vec4f(min(mins, maxs), ray.tnear)); 25 | tfar = reduce_min(make_vec4f(max(mins, maxs), ray.tfar)); 26 | } 27 | -------------------------------------------------------------------------------- /examples/interactive/renderer/Renderer.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export uniform int Renderer_pixelsPerJob() 5 | { 6 | return programCount; 7 | } 8 | -------------------------------------------------------------------------------- /examples/interactive/renderer/RendererParams.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "TransferFunction.h" 7 | #include 8 | #include 9 | #include 10 | 11 | namespace openvkl { 12 | namespace examples { 13 | 14 | using namespace rkcommon::math; 15 | 16 | struct Scene; 17 | 18 | struct RendererParams 19 | { 20 | int attributeIndex{0}; 21 | float time {0.f}; 22 | 23 | // When this is on, ask all renderers to use this framebuffer size. 24 | bool fixedFramebufferSize {false}; 25 | vec2i framebufferSize {1024, 768}; 26 | 27 | // Only render pixels in this range. 28 | bool restrictPixelRange {false}; 29 | region2i pixelRange {vec2i(0, 0), vec2i(1024, 768)}; 30 | 31 | TransferFunction transferFunction; 32 | 33 | void parseCommandLine(std::list &args); 34 | void usage() const; 35 | }; 36 | 37 | } // namespace examples 38 | } // namespace openvkl 39 | -------------------------------------------------------------------------------- /examples/interactive/renderer/RendererParams.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | struct RendererParams 10 | { 11 | int attributeIndex; 12 | float time; 13 | 14 | // Only render pixels in this range. 15 | bool restrictPixelRange; 16 | box2i pixelRange; 17 | }; 18 | -------------------------------------------------------------------------------- /examples/interactive/renderer/RendererParamsShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // This is only needed for getting TRANSFER_FUNCTION_DEFAULT_NUM_SAMPLES 7 | // definition 8 | #include "TransferFunction.h" 9 | 10 | namespace openvkl { 11 | namespace examples { 12 | 13 | struct TransferFunctionShared 14 | { 15 | vec4f colorsAndOpacities[TRANSFER_FUNCTION_DEFAULT_NUM_SAMPLES]; 16 | unsigned int numValues = 0; 17 | range1f valueRange; 18 | }; 19 | 20 | struct RendererParamsShared 21 | { 22 | int attributeIndex; 23 | float time; 24 | bool fixedFramebufferSize; 25 | bool restrictPixelRange; 26 | box2i pixelRange; 27 | TransferFunctionShared transferFunction; 28 | }; 29 | 30 | } // namespace examples 31 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/Scene.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include "Camera.ih" 9 | #include "RendererParams.ih" 10 | #include "TransferFunction.ih" 11 | 12 | struct Scene 13 | { 14 | VKLVolume volume; 15 | VKLSampler sampler; 16 | Camera camera; 17 | RendererParams rendererParams; 18 | TransferFunction transferFunction; 19 | }; 20 | 21 | // Returns false for pixels outside the valid range. 22 | // pixelIdx is the linear pixel index for each lane. 23 | inline bool Scene_computePixel(const uniform Scene &scene, 24 | int w, 25 | int h, 26 | uint32 pixelIdx, 27 | vec2i &pixel) 28 | { 29 | bool inRange = false; 30 | 31 | if (w > 0) { 32 | const int x = pixelIdx % w; 33 | const int y = pixelIdx / w; 34 | inRange = (x < w && y < h); 35 | 36 | if (scene.rendererParams.restrictPixelRange) { 37 | const uniform box2i &range = scene.rendererParams.pixelRange; 38 | inRange = inRange && (h - y - 1) >= range.lower.y && 39 | (h - y - 1) < range.upper.y && (w - x - 1) >= range.lower.x && 40 | (w - x - 1) < range.upper.x; 41 | } 42 | 43 | if (inRange) { 44 | pixel.x = x; 45 | pixel.y = y; 46 | } 47 | } 48 | 49 | return inRange; 50 | } 51 | -------------------------------------------------------------------------------- /examples/interactive/renderer/TransferFunction.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | struct TransferFunction 10 | { 11 | box1f valueRange; 12 | size_t numValues; 13 | const vec4f *uniform colorsAndOpacities; 14 | }; 15 | 16 | inline vec4f TransferFunction_sample(const uniform TransferFunction &self, 17 | float value) 18 | { 19 | vec4f colorAndOpacity = make_vec4f(0.f); 20 | 21 | if (isnan(value) || self.numValues == 0) { 22 | return colorAndOpacity; 23 | } 24 | 25 | if (value <= self.valueRange.lower) { 26 | return self.colorsAndOpacities[0]; 27 | } 28 | 29 | if (value >= self.valueRange.upper) { 30 | return self.colorsAndOpacities[self.numValues - 1]; 31 | } 32 | 33 | // map the value into the range [0, size - 1] 34 | value = (value - self.valueRange.lower) / 35 | (self.valueRange.upper - self.valueRange.lower) * 36 | (self.numValues - 1.f); 37 | 38 | // index and fractional offset 39 | const int index = floor(value); 40 | const float remainder = value - index; 41 | 42 | // the final interpolated value 43 | return ( 44 | (1.f - remainder) * self.colorsAndOpacities[index] + 45 | remainder * 46 | self.colorsAndOpacities[min( 47 | ((int32)(index + 1)), ((uniform int32)(self.numValues - 1)))]); 48 | } 49 | -------------------------------------------------------------------------------- /examples/interactive/renderer/Versioned.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include "Scheduler.h" 9 | 10 | namespace openvkl { 11 | namespace examples { 12 | 13 | template 14 | class Versioned : public Scheduler::Lockable 15 | { 16 | public: 17 | uint64_t getVersion() const 18 | { 19 | return version.load(); 20 | } 21 | 22 | void incrementVersion() 23 | { 24 | ++version; 25 | } 26 | 27 | /* 28 | * Copy our internal object if the version has changed. 29 | * Returns true if the output was updated. 30 | */ 31 | bool updateIfChanged(const Versioned &other) 32 | { 33 | bool changed = (version != other.version); 34 | if (changed) { 35 | obj = other.obj; 36 | version.store(other.version.load()); 37 | } 38 | return changed; 39 | } 40 | 41 | template 42 | Versioned(Args &&...args) : obj{std::forward(args)...} 43 | { 44 | } 45 | 46 | T &operator*() 47 | { 48 | return obj; 49 | } 50 | 51 | const T &operator*() const 52 | { 53 | return obj; 54 | } 55 | 56 | T *operator->() 57 | { 58 | return &obj; 59 | } 60 | 61 | const T *operator->() const 62 | { 63 | return &obj; 64 | } 65 | 66 | private: 67 | std::atomic version{static_cast(-1)}; 68 | T obj; 69 | }; 70 | 71 | } // namespace examples 72 | } // namespace openvkl 73 | -------------------------------------------------------------------------------- /examples/interactive/renderer/density_path_tracer/DensityPathTracerGpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../Random.h" 7 | #include "../RendererGpu.h" 8 | #include "DensityPathTracerGpuKernel.h" 9 | #include "DensityPathTracerParams.h" 10 | 11 | namespace openvkl { 12 | namespace examples { 13 | 14 | // Note: This renderer stops itself in the destructor, so it should never 15 | // call virtual functions in derived classes in the render loop. 16 | // We use final to ensure whoever tries to derive is aware of this. 17 | class DensityPathTracerGpu final 18 | : public RendererGpu 19 | { 20 | public: 21 | DensityPathTracerGpu(Scene &scene); 22 | ~DensityPathTracerGpu(); 23 | void beforeFrame(bool &needToClear) override final; 24 | 25 | protected: 26 | sycl::event invokeGpuRenderPixel( 27 | sycl::queue &syclQueue, 28 | BufferGpu &buffer, 29 | const Ray *rayBuffer, 30 | const bool clearFramebuffer) override final; 31 | 32 | private: 33 | void setKernelObjectAttributes( 34 | DensityPathTracerGpuKernel *gpuKernelRenderer) override final; 35 | }; 36 | 37 | } // namespace examples 38 | } // namespace openvkl 39 | -------------------------------------------------------------------------------- /examples/interactive/renderer/density_path_tracer/DensityPathTracerIspc.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../Random.h" 7 | #include "../RendererHost.h" 8 | #include "DensityPathTracerParams.h" 9 | 10 | namespace openvkl { 11 | namespace examples { 12 | 13 | // Note: This renderer stops itself in the destructor, so it should never 14 | // call virtual functions in derived classes in the render loop. 15 | // We use final to ensure whoever tries to derive is aware of this. 16 | class DensityPathTracerIspc final : public IspcRenderer 17 | { 18 | public: 19 | DensityPathTracerIspc(Scene &scene); 20 | ~DensityPathTracerIspc(); 21 | void beforeFrame(bool &needToClear) override final; 22 | void afterFrame() override final; 23 | 24 | Versioned &getGuiParams() { 25 | return guiParams; 26 | } 27 | 28 | protected: 29 | void renderPixelBlock(const vec2i &resolution, 30 | uint32_t offset, 31 | vec4f *rgbas, 32 | float *weights) const override final; 33 | 34 | private: 35 | Versioned guiParams; 36 | Versioned params; // Used by the worker. 37 | void *ispcParams{nullptr}; 38 | size_t frame{0}; // This is used for random sampling. 39 | }; 40 | 41 | } // namespace examples 42 | } // namespace openvkl 43 | -------------------------------------------------------------------------------- /examples/interactive/renderer/density_path_tracer/DensityPathTracerParams.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | namespace openvkl { 7 | namespace examples { 8 | 9 | struct DensityPathTracerParams 10 | { 11 | float shutter{0.5f}; 12 | bool motionBlur{false}; 13 | float sigmaTScale{1.f}; 14 | float sigmaSScale{1.f}; 15 | int maxNumScatters{1}; 16 | float ambientLightIntensity{1.f}; 17 | bool showBbox{false}; 18 | }; 19 | } // namespace examples 20 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/Buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../Scheduler.h" 7 | #include 8 | 9 | namespace openvkl { 10 | namespace examples { 11 | class Buffer : public Scheduler::Lockable 12 | { 13 | public: 14 | using vec4f = rkcommon::math::vec4f; 15 | 16 | size_t getWidth() const 17 | { 18 | return w; 19 | } 20 | size_t getHeight() const 21 | { 22 | return h; 23 | } 24 | 25 | virtual vec4f *getRgba() = 0; 26 | 27 | virtual const vec4f *getRgba() const = 0; 28 | 29 | virtual void resize(size_t _w, size_t _h) = 0; 30 | 31 | protected: 32 | size_t w{0}; 33 | size_t h{0}; 34 | }; 35 | } // namespace examples 36 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/BufferCpu.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include 5 | 6 | #include "BufferCpu.h" 7 | #include "Framebuffer_ispc.h" 8 | #include "Renderer_ispc.h" 9 | 10 | namespace openvkl { 11 | namespace examples { 12 | 13 | void BufferCpu::resize(size_t _w, size_t _h) 14 | { 15 | const size_t numPixels = _w * _h; 16 | 17 | bufRgba.resize(numPixels); 18 | bufWeight.resize(numPixels); 19 | 20 | w = _w; 21 | h = _h; 22 | } 23 | 24 | void BufferCpu::tonemap(BufferDisplay &outputBuffer) 25 | { 26 | const auto start = Stats::Clock::now(); 27 | 28 | const size_t numPixels = w * h; 29 | const size_t pixelsPerJob = ispc::Renderer_pixelsPerJob(); 30 | const size_t numJobs = numPixels / pixelsPerJob; 31 | rkcommon::tasking::parallel_for(numJobs, [&](size_t i) { 32 | const size_t ib = i * pixelsPerJob; 33 | ispc::tonemap(static_cast(ib), 34 | static_cast(numPixels), 35 | bufWeight.data(), 36 | reinterpret_cast(bufRgba.data()), 37 | reinterpret_cast(outputBuffer.getRgba())); 38 | }); 39 | 40 | const auto end = Stats::Clock::now(); 41 | outputBuffer.getStats().tonemapTime = end - start; 42 | } 43 | 44 | } // namespace examples 45 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/BufferCpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "../Scheduler.h" 10 | #include "Buffer.h" 11 | #include "BufferCpu.h" 12 | #include "BufferDisplay.h" 13 | #include "Stats.h" 14 | 15 | namespace openvkl { 16 | namespace examples { 17 | class BufferCpu : public Buffer 18 | { 19 | public: 20 | vec4f *getRgba() override final 21 | { 22 | return bufRgba.data(); 23 | } 24 | const vec4f *getRgba() const override final 25 | { 26 | return bufRgba.data(); 27 | } 28 | 29 | float *getWeight() 30 | { 31 | return bufWeight.data(); 32 | } 33 | const float *getWeight() const 34 | { 35 | return bufWeight.data(); 36 | } 37 | 38 | void resize(size_t _w, size_t _h) override final; 39 | 40 | void tonemap(BufferDisplay &outputBuffer); 41 | 42 | private: 43 | rkcommon::containers::AlignedVector bufRgba; 44 | rkcommon::containers::AlignedVector bufWeight; 45 | }; 46 | } // namespace examples 47 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/Framebuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "BufferDisplay.h" 7 | 8 | namespace openvkl { 9 | namespace examples { 10 | 11 | class Framebuffer 12 | { 13 | public: 14 | BufferDisplay &getFrontBuffer() 15 | { 16 | return frontBuffer; 17 | } 18 | const BufferDisplay &getFrontBuffer() const 19 | { 20 | return frontBuffer; 21 | } 22 | 23 | virtual void resize(size_t w, size_t h) 24 | { 25 | frontBuffer.resize(w, h); 26 | width = w; 27 | height = h; 28 | } 29 | 30 | size_t getWidth() const 31 | { 32 | return width; 33 | } 34 | 35 | size_t getHeight() const 36 | { 37 | return height; 38 | } 39 | 40 | protected: 41 | size_t width{0}; 42 | size_t height{0}; 43 | /* It's used directly to display */ 44 | BufferDisplay frontBuffer; 45 | }; 46 | 47 | } // namespace examples 48 | } // namespace openvkl 49 | -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/Framebuffer.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include 5 | 6 | inline vec4f linearToSrgba(const vec4f &rgba) 7 | { 8 | const uniform float gamma = 1.f / 2.2f; 9 | return make_vec4f(powf(rgba.x * rgba.w, gamma), 10 | powf(rgba.y * rgba.w, gamma), 11 | powf(rgba.z * rgba.w, gamma), 12 | 1.f); 13 | } 14 | 15 | export void tonemap(uniform uint32 offset, 16 | uniform uint32 size, 17 | const float *uniform _weight, 18 | const vec4f *uniform _rgba, 19 | vec4f *uniform _outputRgba) 20 | { 21 | const uint32 idx = offset + programIndex; 22 | if (idx >= size) { 23 | return; 24 | } 25 | 26 | vec4f rgba = _rgba[idx]; 27 | const float weight = _weight[idx]; 28 | 29 | if (weight > 0.f) { 30 | const float rweight = 1.f / weight; 31 | rgba = linearToSrgba(rweight * rgba); 32 | } else { 33 | rgba = make_vec4f(0.f, 0.f, 0.f, 1.f); 34 | } 35 | 36 | _outputRgba[idx] = rgba; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/FramebufferCpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "BufferCpu.h" 7 | #include "Framebuffer.h" 8 | 9 | namespace openvkl { 10 | namespace examples { 11 | class FramebufferCpu : public Framebuffer 12 | { 13 | public: 14 | BufferCpu &getBackBuffer() 15 | { 16 | return backBuffer; 17 | } 18 | 19 | void resize(size_t w, size_t h) override final 20 | { 21 | backBuffer.resize(w, h); 22 | Framebuffer::resize(w, h); 23 | } 24 | 25 | private: 26 | BufferCpu backBuffer; 27 | }; 28 | 29 | } // namespace examples 30 | } // namespace openvkl 31 | -------------------------------------------------------------------------------- /examples/interactive/renderer/framebuffer/FramebufferGpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "BufferGpu.h" 7 | #include "Framebuffer.h" 8 | 9 | namespace openvkl { 10 | namespace examples { 11 | class FramebufferGpu : public Framebuffer 12 | { 13 | public: 14 | BufferGpu &getBackBuffer() 15 | { 16 | return backBuffer; 17 | } 18 | void resize(size_t w, size_t h) override final 19 | { 20 | backBuffer.resize(w, h); 21 | Framebuffer::resize(w, h); 22 | } 23 | 24 | private: 25 | BufferGpu backBuffer; 26 | }; 27 | 28 | } // namespace examples 29 | } // namespace openvkl 30 | -------------------------------------------------------------------------------- /examples/interactive/renderer/hit_iterator_renderer/HitIteratorRendererGpuKernel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | #include "openvkl_testing.h" 6 | 7 | #include "../Ray.h" 8 | #include "../RendererGpuKernel.h" 9 | #include "../RendererParams.h" 10 | #include "HitIteratorRendererGpuKernel.h" 11 | #include "HitIteratorRendererParams.h" 12 | 13 | namespace openvkl { 14 | namespace examples { 15 | 16 | class HitIteratorRendererGpuKernel final : public RendererGpuKernel 17 | { 18 | public: 19 | void setObjectAttributes(const VKLSampler sampler, 20 | const box3f volumeBounds, 21 | const RendererParams &rendererParams); 22 | 23 | SYCL_EXTERNAL void renderPixel(const unsigned int seed, 24 | const Ray *inputRay, 25 | vec4f &rgba, 26 | float &weight, 27 | void *hitIteratorBuffer, 28 | void *shadowHitIteratorBuffer, 29 | const VKLHitIteratorContext hitContext, 30 | const VKLFeatureFlags featureFlags) const; 31 | }; 32 | 33 | } // namespace examples 34 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/hit_iterator_renderer/HitIteratorRendererParams.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | #include 6 | 7 | namespace openvkl { 8 | namespace examples { 9 | 10 | struct HitIteratorRendererParams 11 | { 12 | std::vector isoValues{-1.f, 0.f, 1.f}; 13 | }; 14 | } // namespace examples 15 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/interval_iterator_debug/IntervalIteratorDebugGpuKernel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | #include "openvkl_testing.h" 6 | 7 | #include "../Ray.h" 8 | #include "../RendererGpuKernel.h" 9 | #include "../RendererParams.h" 10 | #include "IntervalIteratorDebugParams.h" 11 | 12 | namespace openvkl { 13 | namespace examples { 14 | 15 | class IntervalIteratorDebugGpuKernel final : public RendererGpuKernel 16 | { 17 | private: 18 | IntervalIteratorDebugParams params; 19 | 20 | public: 21 | void setObjectAttributes(const VKLSampler sampler, 22 | const box3f volumeBounds, 23 | const RendererParams &rendererParams, 24 | const IntervalIteratorDebugParams ¶ms); 25 | 26 | SYCL_EXTERNAL void renderPixel( 27 | const unsigned int seed, 28 | const Ray *inputRay, 29 | vec4f &rgba, 30 | float &weight, 31 | void *intervalIteratorBuffer, 32 | const VKLIntervalIteratorContext intervalContext, 33 | const VKLFeatureFlags featureFlags) const; 34 | }; 35 | } // namespace examples 36 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/interval_iterator_debug/IntervalIteratorDebugParams.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | namespace openvkl { 7 | namespace examples { 8 | 9 | struct IntervalIteratorDebugParams 10 | { 11 | float intervalResolutionHint{0.5f}; 12 | float intervalColorScale{4.f}; 13 | float intervalOpacity{0.25f}; 14 | bool firstIntervalOnly{false}; 15 | bool showIntervalBorders{false}; 16 | }; 17 | } // namespace examples 18 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/ray_march_iterator/RayMarchIteratorGpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../RendererGpu.h" 7 | #include "RayMarchIteratorGpuKernel.h" 8 | 9 | namespace openvkl { 10 | namespace examples { 11 | 12 | // Note: This renderer stops itself in the destructor, so it should never 13 | // call virtual functions in derived classes in the render loop. 14 | // We use final to ensure whoever tries to derive is aware of this. 15 | class RayMarchIteratorGpu final 16 | : public RendererGpu 17 | { 18 | public: 19 | RayMarchIteratorGpu(Scene &scene); 20 | ~RayMarchIteratorGpu(); 21 | void beforeFrame(bool &needToClear) override final; 22 | 23 | protected: 24 | sycl::event invokeGpuRenderPixel( 25 | sycl::queue &syclQueue, 26 | BufferGpu &buffer, 27 | const Ray *rayBuffer, 28 | const bool clearFramebuffer) override final; 29 | 30 | private: 31 | void onBufferResize(const size_t width, 32 | const size_t height) override final; 33 | void setKernelObjectAttributes( 34 | RayMarchIteratorGpuKernel *gpuKernelRenderer) override final; 35 | void updateIntervalContext(); 36 | void reallocateBuffers(const size_t width, const size_t height); 37 | void deallocateBuffers(); 38 | 39 | VKLIntervalIteratorContext intervalContext; 40 | char *iteratorBuffer{nullptr}; 41 | size_t iteratorSize{0}; 42 | }; 43 | 44 | } // namespace examples 45 | } // namespace openvkl 46 | -------------------------------------------------------------------------------- /examples/interactive/renderer/ray_march_iterator/RayMarchIteratorGpuKernel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | #pragma once 4 | 5 | #include "openvkl_testing.h" 6 | 7 | #include "../Ray.h" 8 | #include "../RendererGpuKernel.h" 9 | #include "../RendererParams.h" 10 | #include "RayMarchIteratorParams.h" 11 | 12 | namespace openvkl { 13 | namespace examples { 14 | 15 | class RayMarchIteratorGpuKernel final : public RendererGpuKernel 16 | { 17 | private: 18 | RayMarchIteratorParams params; 19 | 20 | public: 21 | void setObjectAttributes(const VKLSampler sampler, 22 | const box3f volumeBounds, 23 | const RendererParams &rendererParams, 24 | const RayMarchIteratorParams ¶ms); 25 | 26 | SYCL_EXTERNAL void renderPixel( 27 | const unsigned int seed, 28 | const Ray *ray, 29 | vec4f &rgba, 30 | float &weight, 31 | void *intervalIteratorBuffer, 32 | const VKLIntervalIteratorContext intervalContext, 33 | const VKLFeatureFlags featureFlags) const; 34 | }; 35 | } // namespace examples 36 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/renderer/ray_march_iterator/RayMarchIteratorParams.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | namespace openvkl { 7 | namespace examples { 8 | 9 | struct RayMarchIteratorParams 10 | { 11 | float intervalResolutionHint{0.5f}; 12 | float samplingRate{1.f}; 13 | }; 14 | } // namespace examples 15 | } // namespace openvkl -------------------------------------------------------------------------------- /examples/interactive/vklExamples.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "BatchApplication.h" 5 | #include "InteractiveApplication.h" 6 | #include "renderer/Scene.h" 7 | 8 | using namespace openvkl::examples; 9 | 10 | int main(int argc, char **argv) 11 | { 12 | Scene scene; 13 | 14 | std::list args(argv, argv + argc); 15 | 16 | if (!scene.parseCommandLine(args)) { 17 | return 0; 18 | } 19 | 20 | initializeOpenVKL(); 21 | 22 | try { 23 | if (scene.interactive) { 24 | InteractiveApplication app; 25 | app.run(scene); 26 | } else { 27 | BatchApplication app; 28 | app.run(scene); 29 | } 30 | } catch (const std::exception &e) { 31 | // Handle fatal errors here. This mainly applies when invalid 32 | // volume parameters are specified on the command line, so that no volume 33 | // can be created at all. 34 | std::cerr << e.what() << std::endl; 35 | } 36 | 37 | shutdownOpenVKL(); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /examples/ispc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | macro(add_executable_ispc name) 5 | set(ISPC_SOURCES "") 6 | set(OTHER_SOURCES "") 7 | foreach(src ${ARGN}) 8 | get_filename_component(ext ${src} EXT) 9 | if (ext STREQUAL ".ispc") 10 | set(ISPC_SOURCES ${ISPC_SOURCES} ${src}) 11 | else() 12 | set(OTHER_SOURCES ${OTHER_SOURCES} ${src}) 13 | endif () 14 | endforeach() 15 | openvkl_ispc_compile(${ISPC_SOURCES}) 16 | add_executable(${name} ${ISPC_OBJECTS} ${OTHER_SOURCES} ${ISPC_SOURCES} ${VKL_RESOURCE}) 17 | endmacro() 18 | 19 | include_directories_ispc( 20 | ${PROJECT_SOURCE_DIR}/openvkl/include 21 | ${RKCOMMON_INCLUDE_DIRS} 22 | ) 23 | 24 | get_target_property(CPU_DEVICE_INCLUDE_DIRS openvkl_module_cpu_device INTERFACE_INCLUDE_DIRECTORIES) 25 | include_directories_ispc(${CPU_DEVICE_INCLUDE_DIRS}) 26 | 27 | add_executable_ispc(vklTutorialISPC 28 | vklTutorialISPC.ispc 29 | vklTutorialISPC.cpp 30 | ) 31 | 32 | target_include_directories(vklTutorialISPC PRIVATE ${ISPC_TARGET_DIR}) 33 | 34 | target_link_libraries(vklTutorialISPC PRIVATE openvkl openvkl_module_cpu_device) 35 | 36 | install(TARGETS vklTutorialISPC 37 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 38 | ) 39 | -------------------------------------------------------------------------------- /examples/minimal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2022 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | # The minimal_01 ... minimal_06 examples gradually increase in complexity 5 | foreach(i 01 02 03 04 05 06) 6 | add_executable(vklMinimal_${i} minimal_${i}.cpp ${VKL_RESOURCE}) 7 | target_link_libraries(vklMinimal_${i} PRIVATE openvkl openvkl_module_cpu_device) 8 | install(TARGETS vklMinimal_${i} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 9 | endforeach() 10 | -------------------------------------------------------------------------------- /examples/minimal/README.md: -------------------------------------------------------------------------------- 1 | # Intel® Open Volume Kernel Library: Minimal Examples 2 | 3 | This directory contains a sequence of minimal code examples that make use of 4 | Open VKL. These examples are designed to be read and understood in sequence; 5 | each example builds upon the previous one. 6 | 7 | The examples provided are: 8 | 9 | - `minimal_01.cpp`: prerequisite code infrastructure for managing a framebuffer, 10 | using a transfer function, and drawing the frame buffer to the terminal. 11 | - `minimal_02.cpp`: initializing Open VKL 12 | - `minimal_03.cpp`: instantiating a VKL volume, sampler, and rendering a slice 13 | - `minimal_04.cpp`: changing volume types 14 | - `minimal_05.cpp`: creating a ray marching volume renderer 15 | - `minimal_06.cpp`: creating an isosurface renderer 16 | 17 | For more complex examples, see the `vklExamples` application and corresponding 18 | code. 19 | -------------------------------------------------------------------------------- /examples/minimal/create_voxels.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "field.h" 7 | 8 | #include 9 | #include 10 | 11 | // The structured regular volume expects a data buffer that contains 12 | // all voxel values. We create it here by sampling the field() function, but 13 | // this data could be the output of a simulation, or loaded from disk. 14 | inline std::vector createVoxels(size_t res) 15 | { 16 | std::vector voxels(res * res * res); 17 | for (size_t z = 0; z < res; ++z) 18 | for (size_t y = 0; y < res; ++y) 19 | for (size_t x = 0; x < res; ++x) { 20 | const float fx = x / static_cast(res); 21 | const float fy = y / static_cast(res); 22 | const float fz = z / static_cast(res); 23 | const size_t idx = z * res * res + y * res + x; 24 | voxels[idx] = field(fx, fy, fz); 25 | } 26 | return voxels; 27 | } 28 | -------------------------------------------------------------------------------- /examples/minimal/field.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #if defined(_MSC_VER) && !defined(NOMINMAX) 7 | #define NOMINMAX 8 | #endif 9 | 10 | #include 11 | inline float field(float x, float y, float z) 12 | { 13 | constexpr float freq = 11.f; 14 | return (std::sin(freq * x * x * x) + std::sin(freq * y * y) + 15 | std::cos(freq * z)) / 16 | 3.f; 17 | } 18 | -------------------------------------------------------------------------------- /examples/minimal/minimal_01.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "framebuffer.h" 5 | 6 | int main(int argc, char **argv) 7 | { 8 | Framebuffer fb(64, 32); 9 | 10 | fb.generate([&](float fx, float fy) { 11 | return transferFunction(2*fx-1); 12 | }); 13 | fb.drawToTerminal(); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /examples/minimal/minimal_02.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "framebuffer.h" 5 | 6 | // We must include the openvkl header. 7 | #include 8 | #include 9 | 10 | int main(int argc, char **argv) 11 | { 12 | // To initialize Open VKL, load the device module, which is essentially the 13 | // backend implementation. Our current release supports only "cpu_device", 14 | // which is highly optimized for vector CPU architectures. 15 | vklInit(); 16 | 17 | // The device itself will be manage all resources. "cpu" is the default and 18 | // selects the native vector width for best performance. 19 | VKLDevice device = vklNewDevice("cpu"); 20 | 21 | // Devices must be committed before use. This is because they support 22 | // parameters, such as logging verbosity. 23 | vklCommitDevice(device); 24 | 25 | Framebuffer fb(64, 32); 26 | 27 | fb.generate([&](float fx, float fy) { 28 | return transferFunction(2*fx-1); 29 | }); 30 | fb.drawToTerminal(); 31 | 32 | // When the application is done with the device, release it! 33 | // This will clean up the internal state. 34 | vklReleaseDevice(device); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /gitlab/build-from-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | ## Copyright 2019 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | export ROOT_DIR=`pwd` 6 | export DEP_INSTALL_DIR="${ROOT_DIR}/build/install" 7 | 8 | export openvkl_DIR=${DEP_INSTALL_DIR} 9 | 10 | mkdir build_from_install 11 | cd build_from_install 12 | 13 | cmake --version 14 | 15 | cmake \ 16 | "$@" ../examples/from_openvkl_install 17 | 18 | cmake --build . 19 | 20 | if [ -f "./vklTutorialCPU" ]; then 21 | ./vklTutorialCPU 22 | fi 23 | 24 | if [ -f "./vklTutorialGPU" ]; then 25 | ./vklTutorialGPU 26 | fi 27 | -------------------------------------------------------------------------------- /gitlab/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright 2019 Intel Corporation 3 | rem SPDX-License-Identifier: Apache-2.0 4 | 5 | setlocal 6 | 7 | md build 8 | cd build 9 | 10 | cmake --version 11 | 12 | cmake -L ^ 13 | -G "%~1" ^ 14 | -T "%~2" ^ 15 | -D CMAKE_INSTALL_LIBDIR=lib ^ 16 | -D BUILD_OPENVKL_BENCHMARKS=OFF ^ 17 | -D BUILD_OPENVKL_TESTING=ON ^ 18 | %~4 %~5 %~6 %~7 %~8 %~9 ^ 19 | ../superbuild 20 | 21 | cmake --build . --verbose --config "%~3" --target ALL_BUILD -- /m /nologo 22 | 23 | :abort 24 | endlocal 25 | :end 26 | 27 | rem propagate any error to calling PowerShell script: 28 | exit 29 | -------------------------------------------------------------------------------- /gitlab/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Copyright 2019 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | MACOSX_DEPLOYMENT_TARGET="10.13" 6 | 7 | mkdir build 8 | cd build 9 | 10 | cmake --version 11 | 12 | cmake \ 13 | -DCMAKE_INSTALL_LIBDIR=lib \ 14 | -DBUILD_OPENVKL_BENCHMARKS=ON \ 15 | "$@" ../superbuild 16 | 17 | cmake --build . 18 | -------------------------------------------------------------------------------- /gitlab/release/linux-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Copyright 2020 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | # abort on any error 6 | set -e 7 | 8 | ROOT_DIR=$PWD 9 | 10 | #### Extract release package #### 11 | 12 | OPENVKL_PKG_BASE=openvkl-${OPENVKL_RELEASE_PACKAGE_VERSION}.x86_64.linux 13 | tar -zxvf ${OPENVKL_PKG_BASE}.tar.gz 14 | 15 | #### Build tutorial against release package #### 16 | 17 | export openvkl_DIR="${ROOT_DIR}/${OPENVKL_PKG_BASE}" 18 | 19 | mkdir build_from_release 20 | cd build_from_release 21 | 22 | cmake --version 23 | 24 | cmake ../examples/from_openvkl_install 25 | 26 | cmake --build . 27 | 28 | #### Run tutorial to verify functionality #### 29 | 30 | export LD_LIBRARY_PATH=${openvkl_DIR}/lib:${LD_LIBRARY_PATH} 31 | 32 | ./vklTutorialCPU 33 | 34 | #### Run binaries from release package to verify functionality #### 35 | 36 | ${openvkl_DIR}/bin/vklMinimal_06 37 | -------------------------------------------------------------------------------- /gitlab/release/linux_sycl-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Copyright 2023 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | # abort on any error 6 | set -e 7 | 8 | ROOT_DIR=$PWD 9 | 10 | #### Extract release package #### 11 | 12 | OPENVKL_PKG_BASE=openvkl-${OPENVKL_RELEASE_PACKAGE_VERSION}.sycl.x86_64.linux 13 | tar -zxvf ${OPENVKL_PKG_BASE}.tar.gz 14 | 15 | #### Build tutorial against release package #### 16 | 17 | export openvkl_DIR="${ROOT_DIR}/${OPENVKL_PKG_BASE}" 18 | 19 | mkdir build_from_release 20 | cd build_from_release 21 | 22 | cmake --version 23 | 24 | cmake ../examples/from_openvkl_install 25 | 26 | cmake --build . 27 | 28 | #### Run tutorial to verify functionality #### 29 | 30 | export LD_LIBRARY_PATH=${openvkl_DIR}/lib:${LD_LIBRARY_PATH} 31 | 32 | ./vklTutorialGPU 33 | 34 | #### Run binaries from release package to verify functionality #### 35 | 36 | ${openvkl_DIR}/bin/vklTutorialGPU 37 | 38 | ${openvkl_DIR}/bin/vklMinimal_06 39 | -------------------------------------------------------------------------------- /gitlab/release/linux_sycl-test_run_only.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Copyright 2023 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | # this job does not do any test builds, but rather verifies that the SYCL 6 | # binaries can run without a SYCL compiler (driver is still needed). 7 | 8 | # abort on any error 9 | set -e 10 | 11 | ROOT_DIR=$PWD 12 | 13 | #### Extract release package #### 14 | 15 | OPENVKL_PKG_BASE=openvkl-${OPENVKL_RELEASE_PACKAGE_VERSION}.sycl.x86_64.linux 16 | tar -zxvf ${OPENVKL_PKG_BASE}.tar.gz 17 | 18 | #### Run binaries from release package to verify functionality #### 19 | 20 | export openvkl_DIR="${ROOT_DIR}/${OPENVKL_PKG_BASE}" 21 | export LD_LIBRARY_PATH=${openvkl_DIR}/lib:${LD_LIBRARY_PATH} 22 | 23 | ${openvkl_DIR}/bin/vklTutorialGPU 24 | 25 | ${openvkl_DIR}/bin/vklMinimal_06 26 | -------------------------------------------------------------------------------- /gitlab/release/macos-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Copyright 2020 Intel Corporation 3 | ## SPDX-License-Identifier: Apache-2.0 4 | 5 | # abort on any error 6 | set -e 7 | 8 | ROOT_DIR=$PWD 9 | 10 | #### Extract release package #### 11 | 12 | OPENVKL_PKG_BASE=openvkl-${OPENVKL_RELEASE_PACKAGE_VERSION}.x86_64.macos 13 | unzip ${OPENVKL_PKG_BASE}.zip 14 | 15 | #### Build tutorial against release package #### 16 | 17 | export openvkl_DIR="${ROOT_DIR}/${OPENVKL_PKG_BASE}" 18 | 19 | mkdir build_from_release 20 | cd build_from_release 21 | 22 | cmake --version 23 | 24 | cmake ../examples/from_openvkl_install 25 | 26 | cmake --build . 27 | 28 | #### Run tutorial to verify functionality #### 29 | 30 | export DYLD_LIBRARY_PATH=${openvkl_DIR}/lib:${DYLD_LIBRARY_PATH} 31 | 32 | ./vklTutorialCPU 33 | 34 | #### Run binaries from release package to verify functionality #### 35 | 36 | ${openvkl_DIR}/bin/vklMinimal_06 37 | -------------------------------------------------------------------------------- /gitlab/release/windows-test.ps1: -------------------------------------------------------------------------------- 1 | ## Copyright 2020 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | $ROOT_DIR = pwd 5 | 6 | #### Extract release package #### 7 | 8 | $OPENVKL_PKG_BASE = "openvkl-$OPENVKL_RELEASE_PACKAGE_VERSION.x86_64.windows" 9 | Expand-Archive .\$OPENVKL_PKG_BASE.zip -DestinationPath $ROOT_DIR 10 | 11 | #### Build tutorial against release package #### 12 | 13 | $env:openvkl_DIR = "$ROOT_DIR\$OPENVKL_PKG_BASE" 14 | 15 | mkdir build_from_release 16 | cd build_from_release 17 | 18 | cmake --version 19 | 20 | cmake -L ` 21 | -G $args[0] ` 22 | -T $args[1] ` 23 | ../examples/from_openvkl_install 24 | 25 | cmake --build . --config Release --target ALL_BUILD -- /m /nologo 26 | 27 | #### Run tutorial to verify functionality #### 28 | 29 | $env:PATH += ";$env:openvkl_DIR\bin" 30 | 31 | .\Release\vklTutorialCPU.exe 32 | 33 | #### Run binaries from release package to verify functionality #### 34 | 35 | vklMinimal_06.exe 36 | 37 | exit $LASTEXITCODE 38 | -------------------------------------------------------------------------------- /gitlab/release/windows_sycl-test.ps1: -------------------------------------------------------------------------------- 1 | ## Copyright 2023 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | $ROOT_DIR = pwd 5 | 6 | #### Extract release package #### 7 | 8 | $OPENVKL_PKG_BASE = "openvkl-$OPENVKL_RELEASE_PACKAGE_VERSION.sycl.x86_64.windows" 9 | Expand-Archive .\$OPENVKL_PKG_BASE.zip -DestinationPath $ROOT_DIR 10 | 11 | #### Build tutorial against release package #### 12 | 13 | $env:openvkl_DIR = "$ROOT_DIR\$OPENVKL_PKG_BASE" 14 | 15 | mkdir build_from_release 16 | cd build_from_release 17 | 18 | cmake --version 19 | 20 | # CMAKE_SUPPRESS_REGENERATION=ON works around a Ninja issue specific to our runners. 21 | cmake -L ` 22 | -G Ninja ` 23 | -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang ` 24 | -D CMAKE_BUILD_TYPE=Release ` 25 | -D CMAKE_SUPPRESS_REGENERATION=ON ` 26 | ../examples/from_openvkl_install 27 | 28 | cmake --build . --config Release --verbose 29 | 30 | ls 31 | 32 | echo "=== build done ===" 33 | 34 | #### Run tutorial to verify functionality #### 35 | 36 | $env:PATH += ";$env:openvkl_DIR\bin" 37 | 38 | ./vklTutorialGPU.exe 39 | 40 | # Note, binaries from the release package are verified in another job. 41 | 42 | exit $LASTEXITCODE 43 | -------------------------------------------------------------------------------- /gitlab/release/windows_sycl-test_run_only.ps1: -------------------------------------------------------------------------------- 1 | ## Copyright 2023 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | $ROOT_DIR = pwd 5 | 6 | #### Extract release package #### 7 | 8 | $OPENVKL_PKG_BASE = "openvkl-$OPENVKL_RELEASE_PACKAGE_VERSION.sycl.x86_64.windows" 9 | Expand-Archive .\$OPENVKL_PKG_BASE.zip -DestinationPath $ROOT_DIR 10 | 11 | #### Run binaries from release package to verify functionality #### 12 | 13 | $env:openvkl_DIR = "$ROOT_DIR\$OPENVKL_PKG_BASE" 14 | $env:PATH += ";$env:openvkl_DIR\bin" 15 | 16 | vklTutorialGPU.exe 17 | 18 | vklMinimal_06.exe 19 | 20 | exit $LASTEXITCODE 21 | -------------------------------------------------------------------------------- /gitlab/run_tests.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Copyright 2019 Intel Corporation 3 | rem SPDX-License-Identifier: Apache-2.0 4 | 5 | setlocal 6 | 7 | echo Running tests 8 | 9 | set PATH=%PATH%;.\build\install\bin 10 | 11 | call .\build\install\bin\vklTutorialCPU.exe 12 | call .\build\install\bin\vklTutorialISPC.exe 13 | call .\build\install\bin\vklExamplesCPU -batch -printStats -spp 50 -framebufferSize 1024 1024 14 | call .\build\install\bin\vklTestsCPU.exe 15 | 16 | :abort 17 | endlocal 18 | :end 19 | 20 | rem propagate any error to calling PowerShell script: 21 | exit 22 | 23 | -------------------------------------------------------------------------------- /openvkl/common/DataShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | #ifndef __ISPC_STRUCT_Data1D__ 13 | #define __ISPC_STRUCT_Data1D__ 14 | struct Data1D 15 | { 16 | const vkl_uint8 *addr; 17 | vkl_uint64 byteStride; 18 | vkl_uint64 numItems; 19 | vkl_uint32 dataType; 20 | bool compact; 21 | }; 22 | #endif 23 | 24 | #ifdef __cplusplus 25 | } // namespace ispc 26 | #endif // __cplusplus 27 | -------------------------------------------------------------------------------- /openvkl/common/IteratorBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../api/Device.h" 7 | #include "rkcommon/memory/IntrusivePtr.h" 8 | 9 | namespace openvkl { 10 | 11 | struct IteratorBase 12 | { 13 | // Not a Ref<>! Destructors will not run. 14 | Device *device; 15 | 16 | // WORKAROUND ICC 15: This destructor must be public! 17 | virtual ~IteratorBase() = default; 18 | }; 19 | 20 | } // namespace openvkl 21 | -------------------------------------------------------------------------------- /openvkl/common/ManagedObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "ManagedObject.h" 11 | 12 | #include 13 | 14 | namespace openvkl { 15 | 16 | ManagedObject::~ManagedObject() 17 | { 18 | // make sure all ManagedObject parameter refs are decremented 19 | std::for_each(params_begin(), params_end(), [&](std::shared_ptr &p) { 20 | auto ¶m = *p; 21 | if (param.data.is()) { 22 | auto *obj = param.data.get(); 23 | if (obj != nullptr) 24 | obj->refDec(); 25 | } 26 | }); 27 | } 28 | 29 | std::string ManagedObject::toString() const 30 | { 31 | return "openvkl::ManagedObject"; 32 | } 33 | 34 | } // namespace openvkl 35 | -------------------------------------------------------------------------------- /openvkl/common/ispc_defs.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | get_programCount 3 | -------------------------------------------------------------------------------- /openvkl/common/ispc_util.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // utility function to read the value of programCount from C/C++ 5 | export uniform int32 get_programCount() 6 | { 7 | return programCount; 8 | } 9 | -------------------------------------------------------------------------------- /openvkl/common/logging.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "../api/Device.h" 11 | #include "logging.h" 12 | #include "rkcommon/utility/StringManip.h" 13 | #include "rkcommon/utility/getEnvVar.h" 14 | 15 | #define LOG_PREFIX "[openvkl] " 16 | 17 | namespace openvkl { 18 | 19 | LogMessageStream postLogMessage(Device *device, VKLLogLevel postAtLogLevel) 20 | { 21 | return LogMessageStream(device, postAtLogLevel); 22 | } 23 | 24 | void postLogMessage(Device *device, 25 | const std::string &msg, 26 | VKLLogLevel postAtLogLevel) 27 | { 28 | if (device && postAtLogLevel >= device->logLevel) { 29 | device->logCallback(device->logUserData, 30 | (LOG_PREFIX + msg + '\n').c_str()); 31 | } else if (postAtLogLevel >= LOG_LEVEL_DEFAULT) { 32 | std::cout << LOG_PREFIX << msg << std::endl; 33 | } 34 | } 35 | 36 | } // namespace openvkl 37 | -------------------------------------------------------------------------------- /openvkl/common/logging.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include "VKLCommon.h" 10 | #include "openvkl/VKLLogLevel.h" 11 | 12 | namespace openvkl { 13 | 14 | OPENVKL_CORE_INTERFACE VKLLogLevel logLevel(); 15 | 16 | OPENVKL_CORE_INTERFACE void postLogMessage( 17 | Device *device, 18 | const std::string &msg, 19 | VKLLogLevel postAtLogLevel = VKL_LOG_DEBUG); 20 | 21 | // stream class to facilitate usage as e.g.: 22 | // postLogMessage(VKL_LOG_ERROR) << "my error" << std::endl; 23 | struct LogMessageStream : public std::stringstream 24 | { 25 | LogMessageStream(Device *device, 26 | VKLLogLevel postAtLogLevel = VKL_LOG_DEBUG); 27 | LogMessageStream(LogMessageStream &&other); 28 | ~LogMessageStream(); 29 | 30 | private: 31 | Device *device{nullptr}; 32 | VKLLogLevel logLevel{VKL_LOG_DEBUG}; 33 | }; 34 | 35 | inline LogMessageStream::LogMessageStream(Device *device, 36 | VKLLogLevel postAtLogLevel) 37 | : device(device), logLevel(postAtLogLevel) 38 | { 39 | } 40 | 41 | inline LogMessageStream::~LogMessageStream() 42 | { 43 | auto msg = str(); 44 | if (!msg.empty()) 45 | postLogMessage(device, msg, logLevel); 46 | } 47 | 48 | inline LogMessageStream::LogMessageStream(LogMessageStream &&other) 49 | { 50 | this->str(other.str()); 51 | } 52 | 53 | OPENVKL_CORE_INTERFACE LogMessageStream 54 | postLogMessage(Device *device, VKLLogLevel postAtLogLevel = VKL_LOG_DEBUG); 55 | 56 | } // namespace openvkl 57 | -------------------------------------------------------------------------------- /openvkl/common/math.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace openvkl { 9 | 10 | inline std::pair intersectBox(const vec3f &origin, 11 | const vec3f &direction, 12 | const box3f &box, 13 | const range1f &rangeLimit) 14 | { 15 | const vec3f mins = (box.lower - origin) * rcp(direction); 16 | const vec3f maxs = (box.upper - origin) * rcp(direction); 17 | 18 | const vec3f min1 = min(mins, maxs); 19 | const vec3f max1 = max(mins, maxs); 20 | 21 | return {reduce_max(vec4f{min1.x, min1.y, min1.z, rangeLimit.lower}), 22 | reduce_min(vec4f{max1.x, max1.y, max1.z, rangeLimit.upper})}; 23 | } 24 | 25 | inline vec3f nextafter(const vec3i &a, const vec3i &b) 26 | { 27 | return vec3f( 28 | nextafterf(a.x, b.x), nextafterf(a.y, b.y), nextafterf(a.z, b.z)); 29 | } 30 | 31 | } // namespace openvkl 32 | -------------------------------------------------------------------------------- /openvkl/devices/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | add_subdirectory(cpu) 5 | 6 | option(OPENVKL_ENABLE_DEVICE_GPU "Enables GPU device." OFF) 7 | 8 | if (${OPENVKL_ENABLE_DEVICE_GPU}) 9 | add_subdirectory(gpu) 10 | endif() 11 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/api/CPUDevice.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../common/export_util.h" 5 | #include "../common/ispc_isa.h" 6 | 7 | export uniform int32 EXPORT_UNIQUE(ISPC_getProgramCount) 8 | { 9 | return programCount; 10 | } 11 | 12 | // see 13 | // https://ispc.github.io/faq.html#how-can-i-determine-at-run-time-which-vector-instruction-set-s-instructions-were-selected-to-execute 14 | export uniform uint32 EXPORT_UNIQUE(ISPC_getTarget) 15 | { 16 | #if defined(ISPC_TARGET_NEON) 17 | return VKL_ISPC_TARGET_NEON; // same for both NEON and NEON2X 18 | #elif defined(ISPC_TARGET_SSE2) 19 | return VKL_ISPC_TARGET_SSE2; 20 | #elif defined(ISPC_TARGET_SSE4) 21 | return VKL_ISPC_TARGET_SSE4; 22 | #elif defined(ISPC_TARGET_AVX) 23 | return VKL_ISPC_TARGET_AVX; 24 | #elif defined(ISPC_TARGET_AVX2) 25 | return VKL_ISPC_TARGET_AVX2; 26 | #elif defined(ISPC_TARGET_AVX512KNL) 27 | return VKL_ISPC_TARGET_AVX512KNL; 28 | #elif defined(ISPC_TARGET_AVX512SKX) 29 | return VKL_ISPC_TARGET_AVX512SKX; 30 | #else 31 | return VKL_ISPC_TARGET_UNKNOWN; 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/Hit.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // this should match the layout of VKLHit 7 | struct Hit 8 | { 9 | float t; 10 | float sample; 11 | float epsilon; 12 | }; 13 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/Interval.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rkcommon/math/box.ih" 7 | 8 | // this should match the layout of VKLInterval 9 | struct Interval 10 | { 11 | box1f tRange; 12 | box1f valueRange; 13 | float nominalDeltaT; 14 | }; 15 | 16 | inline void resetInterval(Interval &interval) 17 | { 18 | interval.tRange.lower = 1.f; 19 | interval.tRange.upper = -1.f; 20 | interval.valueRange.lower = 0.f; 21 | interval.valueRange.upper = 0.f; 22 | interval.nominalDeltaT = 0.f; 23 | } 24 | 25 | inline void resetInterval(uniform Interval &interval) 26 | { 27 | interval.tRange.lower = 1.f; 28 | interval.tRange.upper = -1.f; 29 | interval.valueRange.lower = 0.f; 30 | interval.valueRange.upper = 0.f; 31 | interval.nominalDeltaT = 0.f; 32 | } 33 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/ValueRangesShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifdef __cplusplus 7 | namespace ispc { 8 | #endif // __cplusplus 9 | 10 | #ifndef __ISPC_STRUCT_ValueRanges__ 11 | #define __ISPC_STRUCT_ValueRanges__ 12 | struct ValueRanges 13 | { 14 | int numRanges; 15 | box1f *ranges; 16 | box1f rangesMinMax; 17 | }; 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif // __cplusplus 23 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/export_util.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifndef VKL_TARGET_WIDTH 7 | #error "export_util.h included without VKL_TARGET_WIDTH defined" 8 | #endif 9 | 10 | #define CONCAT2(A, B) A##B 11 | #define CONCAT1(A, B) CONCAT2(A, B) 12 | 13 | #define CONCAT_ARGS_V(A, ...) A(__VA_ARGS__) 14 | 15 | #define EXPORT_UNIQUE(name, ...) \ 16 | CONCAT_ARGS_V(CONCAT1(name, VKL_TARGET_WIDTH), __VA_ARGS__) 17 | 18 | #if defined(ISPC) 19 | #define CALL_ISPC(function, ...) \ 20 | CONCAT_ARGS_V(CONCAT1(function, VKL_TARGET_WIDTH), __VA_ARGS__) 21 | #else 22 | #define CALL_ISPC(function, ...) \ 23 | CONCAT_ARGS_V(CONCAT1(ispc::function, VKL_TARGET_WIDTH), __VA_ARGS__) 24 | #endif 25 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/ispc_isa.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // this header is shared with ISPC 7 | 8 | #ifdef __cplusplus 9 | #include 10 | #include 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | typedef enum : uint32_t 15 | #else 16 | typedef enum 17 | #endif 18 | { 19 | VKL_ISPC_TARGET_NEON, 20 | VKL_ISPC_TARGET_SSE2, 21 | VKL_ISPC_TARGET_SSE4, 22 | VKL_ISPC_TARGET_AVX, 23 | VKL_ISPC_TARGET_AVX2, 24 | VKL_ISPC_TARGET_AVX512KNL, 25 | VKL_ISPC_TARGET_AVX512SKX, 26 | 27 | // Guard value. 28 | VKL_ISPC_TARGET_UNKNOWN = 9999999 29 | } VKLISPCTarget; 30 | 31 | #ifdef __cplusplus 32 | inline std::string stringForVKLISPCTarget(VKLISPCTarget target) 33 | { 34 | switch (target) { 35 | case VKL_ISPC_TARGET_NEON: 36 | return "NEON"; // same for both NEON and NEON2X 37 | case VKL_ISPC_TARGET_SSE2: 38 | return "SSE2"; 39 | case VKL_ISPC_TARGET_SSE4: 40 | return "SSE4"; 41 | case VKL_ISPC_TARGET_AVX: 42 | return "AVX"; 43 | case VKL_ISPC_TARGET_AVX2: 44 | return "AVX2"; 45 | case VKL_ISPC_TARGET_AVX512KNL: 46 | return "AVX512KNL"; 47 | case VKL_ISPC_TARGET_AVX512SKX: 48 | return "AVX512SKX"; 49 | case VKL_ISPC_TARGET_UNKNOWN: 50 | default: 51 | return "UNKNOWN"; 52 | } 53 | } 54 | #endif 55 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/print_debug.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifdef PRINT_DEBUG_ENABLE 7 | #define PRINT_DEBUG print 8 | #else 9 | #define PRINT_DEBUG(...) 10 | #endif 11 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/common/runtime_error.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace openvkl { 10 | namespace cpu_device { 11 | 12 | /* 13 | * A helper for runtime errors that works a bit like Python's print, 14 | * turning all arguments into strings and joining them. 15 | */ 16 | template 17 | void runtimeError(Args &&...args) 18 | { 19 | std::ostringstream os; 20 | int dummy[sizeof...(Args)] = {(os << std::forward(args), 0)...}; 21 | (void)dummy; 22 | throw std::runtime_error(os.str()); 23 | } 24 | 25 | } // namespace cpu_device 26 | } // namespace openvkl 27 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/exports.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "../common/ManagedObject.h" 11 | #include "../common/VKLCommon.h" 12 | #include "api/CPUDevice.h" 13 | 14 | // For Windows in particular, we need registered object creation functions 15 | // available in the top level module library, as exports from dependencies will 16 | // not be visible. 17 | 18 | #define VKL_WRAP_MODULE_REGISTRATION(module_name) \ 19 | extern "C" OPENVKL_DLLEXPORT void openvkl_init_module_##module_name(); 20 | 21 | #if VKL_TARGET_WIDTH_ENABLED_4 22 | VKL_WRAP_MODULE_REGISTRATION(cpu_device_4) 23 | #endif 24 | 25 | #if VKL_TARGET_WIDTH_ENABLED_8 26 | VKL_WRAP_MODULE_REGISTRATION(cpu_device_8) 27 | #endif 28 | 29 | #if VKL_TARGET_WIDTH_ENABLED_16 30 | VKL_WRAP_MODULE_REGISTRATION(cpu_device_16) 31 | #endif 32 | 33 | // calls init functions in [4, 8, 16] devices to ensure proper linkage 34 | extern "C" OPENVKL_DLLEXPORT void openvkl_init_module_cpu_device() 35 | { 36 | #if VKL_TARGET_WIDTH_ENABLED_4 37 | openvkl_init_module_cpu_device_4(); 38 | #endif 39 | 40 | #if VKL_TARGET_WIDTH_ENABLED_8 41 | openvkl_init_module_cpu_device_8(); 42 | #endif 43 | 44 | #if VKL_TARGET_WIDTH_ENABLED_16 45 | openvkl_init_module_cpu_device_16(); 46 | #endif 47 | } 48 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/include/openvkl/device/max_iterator_size.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // Maximum iterator size over all supported volume types, and for each target 7 | // SIMD width. 8 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE_4 1007 9 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE_8 1951 10 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE_16 3903 11 | 12 | #if defined(TARGET_WIDTH) && (TARGET_WIDTH == 4) 13 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE VKL_MAX_INTERVAL_ITERATOR_SIZE_4 14 | #elif defined(TARGET_WIDTH) && (TARGET_WIDTH == 8) 15 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE VKL_MAX_INTERVAL_ITERATOR_SIZE_8 16 | #else 17 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE VKL_MAX_INTERVAL_ITERATOR_SIZE_16 18 | #endif 19 | #define VKL_MAX_HIT_ITERATOR_SIZE_4 1279 20 | #define VKL_MAX_HIT_ITERATOR_SIZE_8 2463 21 | #define VKL_MAX_HIT_ITERATOR_SIZE_16 4927 22 | 23 | #if defined(TARGET_WIDTH) && (TARGET_WIDTH == 4) 24 | #define VKL_MAX_HIT_ITERATOR_SIZE VKL_MAX_HIT_ITERATOR_SIZE_4 25 | #elif defined(TARGET_WIDTH) && (TARGET_WIDTH == 8) 26 | #define VKL_MAX_HIT_ITERATOR_SIZE VKL_MAX_HIT_ITERATOR_SIZE_8 27 | #else 28 | #define VKL_MAX_HIT_ITERATOR_SIZE VKL_MAX_HIT_ITERATOR_SIZE_16 29 | #endif 30 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/iterator/GridAcceleratorIterator.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "IteratorShared.h" 7 | 8 | struct IntervalIteratorContext; 9 | 10 | struct GridAcceleratorIteratorIntervalState 11 | { 12 | vec3i currentCellIndex; 13 | float nominalDeltaT; // constant for all intervals 14 | }; 15 | 16 | struct GridAcceleratorIteratorHitState 17 | { 18 | bool activeCell; 19 | vec3i currentCellIndex; 20 | box1f currentCellTRange; 21 | }; 22 | 23 | struct GridAcceleratorIterator 24 | { 25 | uniform IntervalIteratorShared super; 26 | 27 | vec3f origin; 28 | vec3f direction; 29 | box1f tRange; 30 | float time; 31 | 32 | // common state 33 | box1f boundingBoxTRange; 34 | 35 | // interval iterator state 36 | GridAcceleratorIteratorIntervalState intervalState; 37 | 38 | // hit iterator state 39 | GridAcceleratorIteratorHitState hitState; 40 | }; 41 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/iterator/GridAcceleratorIteratorSize.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/box.ih" 5 | #include "rkcommon/math/vec.ih" 6 | 7 | #include "../common/export_util.h" 8 | #include "GridAcceleratorIterator.ih" 9 | 10 | // this export ensures the GridAcceleratorIterator struct will be published in 11 | // the _ispc.h header, so we can compute the size at compile time as needed. We 12 | // do it separately here so we can avoid transitively exporting other structs 13 | // (through use of forward declarations only). 14 | 15 | // Ignore warning about exporting uniform-pointer-to-varying, as this is in 16 | // fact legal. 17 | #pragma ignore warning(all) 18 | export void EXPORT_UNIQUE(GridAcceleratorIterator_export, 19 | uniform vec3f &dummy_vec3f, 20 | const varying GridAcceleratorIterator *uniform it) 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/iterator/IteratorContextShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | struct SamplerShared; 13 | 14 | #ifndef __ISPC_STRUCT_IteratorContext__ 15 | #define __ISPC_STRUCT_IteratorContext__ 16 | struct IteratorContext 17 | { 18 | const SamplerShared *VKL_INTEROP_UNIFORM sampler; 19 | 20 | VKL_INTEROP_UNIFORM uint32 attributeIndex; 21 | 22 | VKL_INTEROP_UNIFORM ValueRanges valueRanges; 23 | 24 | VKL_INTEROP_UNIFORM uint32 maxIteratorDepth; 25 | VKL_INTEROP_UNIFORM bool elementaryCellIteration; 26 | }; 27 | #endif 28 | 29 | #ifndef __ISPC_STRUCT_IntervalIteratorContext__ 30 | #define __ISPC_STRUCT_IntervalIteratorContext__ 31 | struct IntervalIteratorContext 32 | { 33 | VKL_INTEROP_UNIFORM IteratorContext super; 34 | }; 35 | #endif 36 | 37 | #ifndef __ISPC_STRUCT_HitIteratorContext__ 38 | #define __ISPC_STRUCT_HitIteratorContext__ 39 | 40 | // hit iterator contexts inherit from interval contexts; this is because hit 41 | // iteration is often implemented using interval iteration, and we would like 42 | // to use the same context for that purpose. 43 | struct HitIteratorContext 44 | { 45 | VKL_INTEROP_UNIFORM IntervalIteratorContext super; 46 | 47 | VKL_INTEROP_UNIFORM int numValues; 48 | float *VKL_INTEROP_UNIFORM values; 49 | }; 50 | 51 | #endif 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif // __cplusplus 56 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/iterator/IteratorShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | struct IntervalIteratorContext; 13 | struct HitIteratorContext; 14 | 15 | #ifndef __ISPC_STRUCT_IntervalIteratorShared__ 16 | #define __ISPC_STRUCT_IntervalIteratorShared__ 17 | // must be first member of interval iterator structs 18 | struct IntervalIteratorShared 19 | { 20 | const IntervalIteratorContext *VKL_INTEROP_UNIFORM context; 21 | }; 22 | #endif 23 | 24 | #ifndef __ISPC_STRUCT_HitIteratorShared__ 25 | #define __ISPC_STRUCT_HitIteratorShared__ 26 | // must be first member of hit iterator structs 27 | struct HitIteratorShared 28 | { 29 | const HitIteratorContext *VKL_INTEROP_UNIFORM context; 30 | }; 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif // __cplusplus 36 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/iterator/UnstructuredIterator.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "Iterator.ih" 7 | #include "IteratorContextShared.h" 8 | #include "DefaultIterator.ih" 9 | #include "../volume/UnstructuredSamplerBase.ih" 10 | #include "../volume/UnstructuredVolume.ih" 11 | 12 | struct UnstructuredTraversalStatePublic 13 | { 14 | uint64 node; // can't export structs with varying pointers 15 | uint32 bitstack; 16 | }; 17 | 18 | struct UnstructuredTraversalState 19 | { 20 | uniform Node *node; 21 | uint32 bitstack; 22 | }; 23 | 24 | struct UnstructuredIterator 25 | { 26 | uniform DefaultHitIteratorIntervalIterator super; 27 | 28 | UnstructuredSamplerBase *uniform sampler; 29 | vec3f origin; 30 | vec3f direction; 31 | box1f tRange; 32 | 33 | UnstructuredTraversalStatePublic traversalState; 34 | }; 35 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/observer/Observer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "Observer.h" 11 | 12 | namespace openvkl { 13 | namespace cpu_device { 14 | 15 | template 16 | Observer::Observer(ManagedObject &target) 17 | : ManagedObject(target.getDevice()), target(&target) 18 | { 19 | } 20 | 21 | template 22 | Observer::~Observer() 23 | { 24 | } 25 | 26 | template 27 | std::string Observer::toString() const 28 | { 29 | return "openvkl::Observer"; 30 | } 31 | 32 | template struct Observer; 33 | 34 | } // namespace cpu_device 35 | } // namespace openvkl 36 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/observer/Observer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../common/ManagedObject.h" 7 | #include "openvkl/openvkl.h" 8 | 9 | namespace openvkl { 10 | namespace cpu_device { 11 | 12 | template 13 | struct Observer : public ManagedObject 14 | { 15 | explicit Observer(ManagedObject &target); 16 | 17 | Observer() = delete; 18 | ~Observer() override; 19 | 20 | std::string toString() const override; 21 | 22 | virtual const void *map() = 0; 23 | virtual void unmap() = 0; 24 | virtual VKLDataType getElementType() const = 0; 25 | virtual size_t getElementSize() const = 0; 26 | virtual size_t getNumElements() const = 0; 27 | 28 | protected: 29 | rkcommon::memory::Ref target; 30 | }; 31 | 32 | } // namespace cpu_device 33 | } // namespace openvkl 34 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/observer/ObserverRegistry.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "../common/export_util.h" 11 | #include "ObserverRegistry.h" 12 | #include "ObserverRegistry_ispc.h" 13 | 14 | namespace openvkl { 15 | namespace cpu_device { 16 | 17 | template 18 | ObserverRegistry::ObserverRegistry() 19 | { 20 | ispcEquivalent = CALL_ISPC(ObserverRegistry_create); 21 | } 22 | 23 | template 24 | ObserverRegistry::~ObserverRegistry() 25 | { 26 | CALL_ISPC(ObserverRegistry_destroy, ispcEquivalent); 27 | ispcEquivalent = nullptr; 28 | } 29 | 30 | template 31 | void ObserverRegistry::add(void *ptr) 32 | { 33 | std::lock_guard g(mtx); 34 | CALL_ISPC(ObserverRegistry_add, ispcEquivalent, ptr); 35 | } 36 | 37 | template 38 | void ObserverRegistry::remove(void *ptr) 39 | { 40 | std::lock_guard g(mtx); 41 | CALL_ISPC(ObserverRegistry_remove, ispcEquivalent, ptr); 42 | } 43 | 44 | template struct ObserverRegistry; 45 | 46 | } // namespace cpu_device 47 | } // namespace openvkl 48 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/observer/ObserverRegistry.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../common/ManagedObject.h" 7 | #include 8 | 9 | namespace openvkl { 10 | namespace cpu_device { 11 | 12 | /* 13 | * Registry that can be used to keep track of observers that are relevant 14 | * for a given entity. 15 | * 16 | * This registry should be stored in the respective entity as a Ref<> 17 | * to ensure robust life time. Observers will call remove() when they are 18 | * destroyed. 19 | */ 20 | template 21 | class ObserverRegistry 22 | { 23 | public: 24 | ObserverRegistry(); 25 | ~ObserverRegistry(); 26 | 27 | ObserverRegistry(const ObserverRegistry &) = delete; 28 | ObserverRegistry &operator=(const ObserverRegistry &) = delete; 29 | ObserverRegistry(ObserverRegistry &&other) = delete; 30 | ObserverRegistry &operator=(ObserverRegistry &&other) = delete; 31 | 32 | void add(void *ptr); 33 | 34 | void remove(void *ptr); 35 | 36 | inline void *getIE() { 37 | return ispcEquivalent; 38 | } 39 | 40 | private: 41 | void *ispcEquivalent{nullptr}; 42 | std::recursive_mutex mtx; 43 | }; 44 | 45 | } // namespace cpu_device 46 | } // namespace openvkl 47 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/observer/ObserverRegistry.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | struct ObserverRegistry 7 | { 8 | size_t size; 9 | size_t capacity; 10 | void *uniform *uniform data; 11 | }; 12 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/sampler/Sampler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/AffineSpace.h" 5 | #include "rkcommon/math/box.h" 6 | #include "rkcommon/math/vec.h" 7 | using namespace rkcommon; 8 | using namespace rkcommon::math; 9 | 10 | #include "../volume/Volume.h" 11 | #include "Sampler.h" 12 | 13 | namespace openvkl { 14 | namespace cpu_device { 15 | 16 | template 17 | Sampler::~Sampler() 18 | { 19 | } 20 | 21 | template 22 | Observer *Sampler::newObserver(const char *type) 23 | { 24 | return nullptr; 25 | } 26 | 27 | template struct Sampler; 28 | 29 | } // namespace cpu_device 30 | } // namespace openvkl 31 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/sampler/Sampler.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../common/export_util.h" 7 | #include "openvkl/VKLFilter.h" 8 | #include "openvkl/ispc_cpp_interop.h" 9 | 10 | #include "SamplerShared.h" 11 | 12 | /* 13 | * Initialize the given sampler object. Use this from your derived samplers 14 | * to initialize the super member. 15 | */ 16 | 17 | export void EXPORT_UNIQUE(Sampler_create, 18 | const void *uniform _volume, 19 | void *uniform _sampler); 20 | 21 | export void EXPORT_UNIQUE(Sampler_destroy, void *uniform _sampler); 22 | 23 | export void EXPORT_UNIQUE(Sampler_setFilters, 24 | void *uniform _sampler, 25 | uniform VKLFilter filter, 26 | uniform VKLFilter gradientFilter); 27 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/GridAccelerator.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // bit count used to represent the brick width in macrocells 7 | #define BRICK_WIDTH_BITCOUNT (4) 8 | 9 | // brick width in macrocells 10 | #define BRICK_WIDTH (1 << BRICK_WIDTH_BITCOUNT) 11 | 12 | // brick count in macrocells 13 | #define BRICK_CELL_COUNT (BRICK_WIDTH * BRICK_WIDTH * BRICK_WIDTH) 14 | 15 | // bit count used to represent the macrocell width in volume cells 16 | #define CELL_WIDTH_BITCOUNT (4) 17 | 18 | // macrocell width in volume cells 19 | #define CELL_WIDTH (1 << CELL_WIDTH_BITCOUNT) 20 | 21 | // reciprocal of macrocell width in volume cells 22 | #define RCP_CELL_WIDTH 1.f / CELL_WIDTH 23 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/GridAccelerator.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../iterator/Iterator.ih" 7 | 8 | #include "GridAcceleratorShared.h" 9 | 10 | struct GridAcceleratorIterator; 11 | struct SharedStructuredVolume; 12 | 13 | bool GridAccelerator_nextCell(const GridAccelerator *uniform accelerator, 14 | const varying GridAcceleratorIterator *uniform 15 | iterator, 16 | varying vec3i &cellIndex, 17 | varying box1f &cellTRange); 18 | 19 | uniform bool GridAccelerator_nextCell( 20 | const GridAccelerator *uniform accelerator, 21 | const uniform GridAcceleratorIterator *uniform iterator, 22 | uniform vec3i &cellIndex, 23 | uniform box1f &cellTRange); 24 | 25 | void GridAccelerator_getCellValueRange(GridAccelerator *uniform accelerator, 26 | const varying vec3i &cellIndex, 27 | uniform uint32 attributeIndex, 28 | varying box1f &valueRange); 29 | 30 | void GridAccelerator_getCellValueRange(GridAccelerator *uniform accelerator, 31 | const uniform vec3i &cellIndex, 32 | uniform uint32 attributeIndex, 33 | uniform box1f &valueRange); 34 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/GridAcceleratorShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | struct SharedStructuredVolume; 13 | 14 | struct GridAccelerator 15 | { 16 | VKL_INTEROP_UNIFORM vec3i bricksPerDimension; 17 | VKL_INTEROP_UNIFORM int spacer; // enforce alignment between cpp and ispc 18 | VKL_INTEROP_UNIFORM size_t cellCount; 19 | box1f *VKL_INTEROP_UNIFORM cellValueRanges; 20 | SharedStructuredVolume *VKL_INTEROP_UNIFORM volume; 21 | }; 22 | #ifdef __cplusplus 23 | } 24 | #endif // __cplusplus 25 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/StructuredRegularVolume.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "StructuredVolume.h" 7 | 8 | namespace openvkl { 9 | namespace cpu_device { 10 | 11 | template 12 | struct StructuredRegularVolume : public StructuredVolume 13 | { 14 | StructuredRegularVolume(Device *device) : StructuredVolume(device) {}; 15 | std::string toString() const override; 16 | 17 | void commit() override; 18 | }; 19 | 20 | // Inlined definitions //////////////////////////////////////////////////// 21 | 22 | template 23 | inline std::string StructuredRegularVolume::toString() const 24 | { 25 | return "openvkl::StructuredRegularVolume"; 26 | } 27 | 28 | } // namespace cpu_device 29 | } // namespace openvkl 30 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/StructuredSamplerShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../sampler/SamplerShared.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | struct StructuredSamplerShared 13 | { 14 | SamplerBaseShared super; 15 | }; 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif // __cplusplus 20 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/StructuredSphericalVolume.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "StructuredVolume.h" 7 | 8 | #include "../iterator/DefaultIterator.h" 9 | 10 | namespace openvkl { 11 | namespace cpu_device { 12 | 13 | template 14 | struct StructuredSphericalVolume : public StructuredVolume 15 | { 16 | StructuredSphericalVolume(Device *device) 17 | : StructuredVolume(device){}; 18 | std::string toString() const override; 19 | 20 | void commit() override; 21 | 22 | Sampler *newSampler() override; 23 | }; 24 | 25 | // Inlined definitions //////////////////////////////////////////////////// 26 | 27 | template 28 | inline std::string StructuredSphericalVolume::toString() const 29 | { 30 | return "openvkl::StructuredSphericalVolume"; 31 | } 32 | 33 | } // namespace cpu_device 34 | } // namespace openvkl 35 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/UnstructuredSamplerBase.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../sampler/Sampler.ih" 5 | 6 | struct UnstructuredSamplerBase 7 | { 8 | SamplerShared super; 9 | }; 10 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/UnstructuredSamplerShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../sampler/SamplerShared.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | #ifndef __ISPC_STRUCT_UnstructuredSamplerShared__ 13 | #define __ISPC_STRUCT_UnstructuredSamplerShared__ 14 | struct UnstructuredSamplerShared 15 | { 16 | SamplerBaseShared super; 17 | }; 18 | #endif 19 | #ifdef __cplusplus 20 | } 21 | #endif // __cplusplus 22 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/UnstructuredVolumeBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../common/Data.h" 7 | #include "../common/export_util.h" 8 | #include "../common/math.h" 9 | #include "Volume.h" 10 | #include "UnstructuredVolumeBaseShared.h" 11 | #include "openvkl/devices/common/StructShared.h" 12 | 13 | namespace openvkl { 14 | namespace cpu_device { 15 | 16 | template 17 | struct UnstructuredVolumeBase 18 | : public AddStructShared, ispc::VKLUnstructuredBase> 19 | { 20 | std::string toString() const override; 21 | 22 | UnstructuredVolumeBase(Device *device) : AddStructShared, ispc::VKLUnstructuredBase>(device) {}; // not = default, due to ICC 19 compiler bug 23 | ~UnstructuredVolumeBase(){}; 24 | 25 | virtual void commit() override; 26 | }; 27 | 28 | // Inlined definitions //////////////////////////////////////////////////// 29 | 30 | template 31 | inline std::string UnstructuredVolumeBase::toString() const 32 | { 33 | return "openvkl::UnstructuredVolumeBase"; 34 | } 35 | 36 | template 37 | void UnstructuredVolumeBase::commit() 38 | { 39 | Volume::commit(); 40 | } 41 | 42 | } // namespace cpu_device 43 | } // namespace openvkl 44 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/UnstructuredVolumeBaseShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "VolumeShared.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | struct Node 13 | { 14 | VKL_INTEROP_UNIFORM vec3f nominalLength; 15 | VKL_INTEROP_UNIFORM box1f valueRange; 16 | VKL_INTEROP_UNIFORM int level; 17 | VKL_INTEROP_UNIFORM Node *VKL_INTEROP_UNIFORM parent; 18 | }; 19 | 20 | struct VKLUnstructuredBase 21 | { 22 | VolumeShared super; 23 | 24 | VKL_INTEROP_UNIFORM box3f boundingBox; 25 | VKL_INTEROP_UNIFORM Node *VKL_INTEROP_UNIFORM bvhRoot; 26 | }; 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif // __cplusplus 31 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/VolumeShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | #ifndef __ISPC_ENUM_DeviceVolumeType__ 13 | #define __ISPC_ENUM_DeviceVolumeType__ 14 | 15 | enum DeviceVolumeType 16 | { 17 | VOLUME_TYPE_UNKNOWN = 18 | 0, // must be zero, as memset() will be used for initialization 19 | VOLUME_TYPE_STRUCTURED_REGULAR_LEGACY, 20 | VOLUME_TYPE_STRUCTURED_REGULAR, 21 | VOLUME_TYPE_STRUCTURED_SPHERICAL, 22 | VOLUME_TYPE_VDB, 23 | VOLUME_TYPE_AMR, 24 | VOLUME_TYPE_UNSTRUCTURED, 25 | VOLUME_TYPE_PARTICLE 26 | }; 27 | 28 | #endif 29 | 30 | // this hack prevents .ispc -> ispc.h code from redeclaring. TODO: something 31 | // better 32 | #ifndef __ISPC_STRUCT_VolumeShared__ 33 | #define __ISPC_STRUCT_VolumeShared__ 34 | 35 | struct VolumeShared 36 | { 37 | DeviceVolumeType type; 38 | 39 | // Background value, per attribute. 40 | const float *VKL_INTEROP_UNIFORM background; 41 | }; 42 | 43 | #endif 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif // __cplusplus 48 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/AMRVolume.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "AMRVolumeShared.h" 7 | 8 | inline void AMRVolume_transformObjectToLocal( 9 | const AMRVolume *VKL_INTEROP_UNIFORM volume, 10 | const varying vec3f &objectCoordinates, 11 | varying vec3f &localCoordinates) 12 | { 13 | localCoordinates = 14 | rcp(volume->gridSpacing) * (objectCoordinates - volume->gridOrigin); 15 | } 16 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/AMRVolumeShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "AMRShared.h" 7 | #include "../UnstructuredVolumeBaseShared.h" 8 | 9 | #ifdef __cplusplus 10 | namespace ispc { 11 | #endif // __cplusplus 12 | 13 | struct AMRVolume 14 | { 15 | VKLUnstructuredBase super; 16 | 17 | VKL_INTEROP_UNIFORM vec3f gridSpacing; 18 | VKL_INTEROP_UNIFORM vec3f gridOrigin; 19 | VKL_INTEROP_UNIFORM box3f boundingBox; 20 | VKL_INTEROP_UNIFORM float samplingStep; 21 | 22 | AMR amr; 23 | }; 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif // __cplusplus 28 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/CellRef.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // ours 7 | #include "AMR.ih" 8 | 9 | /*! a reference to a given cell on a given level; this is what a 'node location' kernel will return */ 10 | struct CellRef 11 | { 12 | //! lower left front position, in unit grid space 13 | vec3f pos; 14 | //! width of cell, also doubles as level indicator 15 | float width; 16 | //! value at this cell 17 | float value; 18 | }; 19 | 20 | inline vec3f centerOf(const CellRef &cr) 21 | { 22 | return cr.pos + make_vec3f(0.5f*cr.width); 23 | } 24 | 25 | inline void set(CellRef &cr, const vec3f &pos, 26 | const float width, const float value) 27 | { 28 | cr.pos = pos; 29 | cr.width = width; 30 | cr.value = value; 31 | } 32 | 33 | /* packet-based variant of findCell kernel */ 34 | extern CellRef findCell(const AMR *uniform self, 35 | const varying vec3f &_worldSpacePos, 36 | const float minWidth); 37 | 38 | extern CellRef findLeafCell(const AMR *uniform self, 39 | const varying vec3f &_worldSpacePos); 40 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/FindStack.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | struct FindStack 7 | { 8 | varying bool active; 9 | uniform int32 nodeID; 10 | }; 11 | 12 | inline uniform FindStack *uniform pushStack(uniform FindStack *uniform stackPtr, 13 | uniform int nodeID) 14 | { 15 | unmasked { 16 | stackPtr->active = false; 17 | } 18 | 19 | stackPtr->active = true; 20 | stackPtr->nodeID = nodeID; 21 | return stackPtr+1; 22 | } 23 | 24 | inline uniform FindStack *uniform pushStack(uniform FindStack *uniform stackPtr, 25 | uniform int nodeID, 26 | varying bool valid) 27 | { 28 | unmasked { 29 | stackPtr->active = false; 30 | } 31 | 32 | stackPtr->active = valid; 33 | stackPtr->nodeID = nodeID; 34 | return stackPtr+1; 35 | } -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/KDTree.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "KDTreeShared.h" 7 | 8 | inline uint32 getDim(const KDTreeNode & node) 9 | { 10 | return node.dim_and_ofs >> 30; 11 | } 12 | 13 | inline uint32 getOfs(const KDTreeNode & node) 14 | { 15 | return node.dim_and_ofs & ((1<<30)-1); 16 | } 17 | 18 | inline bool isLeaf(const KDTreeNode & node) 19 | { 20 | return getDim(node) == 3; 21 | } 22 | 23 | inline float getPos(const KDTreeNode & node) 24 | { 25 | return floatbits(node.pos_or_numItems); 26 | } 27 | 28 | inline float getNumItems(const KDTreeNode & node) 29 | { 30 | return node.pos_or_numItems; 31 | } 32 | 33 | inline uniform uint32 getDim(const uniform KDTreeNode & node) 34 | { 35 | return node.dim_and_ofs >> 30; 36 | } 37 | 38 | inline uniform uint32 getOfs(const uniform KDTreeNode & node) 39 | { 40 | return node.dim_and_ofs & ((1<<30)-1); 41 | } 42 | 43 | inline uniform bool isLeaf(const uniform KDTreeNode & node) 44 | { 45 | return getDim(node) == 3; 46 | } 47 | 48 | inline uniform float getPos(const uniform KDTreeNode & node) 49 | { 50 | return floatbits(node.pos_or_numItems); 51 | } 52 | 53 | inline uniform float getNumItems(const uniform KDTreeNode & node) 54 | { 55 | return node.pos_or_numItems; 56 | } 57 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/KDTreeShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | /*! ispc equivalent of the c++-side kdtree that we build over the 7 | boxes */ 8 | struct KDTreeNode 9 | { 10 | vkl_uint32 dim_and_ofs; 11 | vkl_uint32 pos_or_numItems; 12 | }; 13 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/method_current.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/box.ih" 5 | #include "rkcommon/math/vec.ih" 6 | 7 | #include "AMRVolume.ih" 8 | #include "CellRef.ih" 9 | #include "DualCell.ih" 10 | #include "../../common/export_util.h" 11 | #include "../../sampler/SamplerShared.h" 12 | 13 | varying float AMR_current(const SamplerShared *uniform self, 14 | const varying vec3f &P, 15 | const uniform uint32 _attributeIndex, 16 | const varying float &_time) 17 | { 18 | const AMRVolume *uniform volume = (const AMRVolume *uniform)self->volume; 19 | const AMR *uniform amr = &volume->amr; 20 | 21 | if (!box_contains(volume->boundingBox, P)) { 22 | return volume->super.super.background[0]; 23 | } 24 | 25 | vec3f lP; // local amr space 26 | AMRVolume_transformObjectToLocal(volume, P, lP); 27 | 28 | const CellRef C = findLeafCell(amr, lP); 29 | 30 | DualCell D; 31 | initDualCell(D, lP, C.width); 32 | findDualCell(amr, D); 33 | 34 | return lerp(D); 35 | } 36 | 37 | export void EXPORT_UNIQUE(AMR_install_current, void *uniform _sampler) 38 | { 39 | SamplerShared *uniform sampler = (SamplerShared * uniform) _sampler; 40 | sampler->computeSample_varying = AMR_current; 41 | } 42 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/amr/method_finest.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/box.ih" 5 | #include "rkcommon/math/vec.ih" 6 | 7 | #include "AMRVolume.ih" 8 | #include "CellRef.ih" 9 | #include "DualCell.ih" 10 | #include "../../common/export_util.h" 11 | #include "../../sampler/SamplerShared.h" 12 | 13 | varying float AMR_finest(const SamplerShared *uniform self, 14 | const varying vec3f &P, 15 | const uniform uint32 _attributeIndex, 16 | const varying float &_time) 17 | { 18 | const AMRVolume *uniform volume = (const AMRVolume *uniform)self->volume; 19 | const AMR *uniform amr = &volume->amr; 20 | 21 | if (!box_contains(volume->boundingBox, P)) { 22 | return volume->super.super.background[0]; 23 | } 24 | 25 | vec3f lP; // local amr space 26 | AMRVolume_transformObjectToLocal(volume, P, lP); 27 | 28 | DualCell D; 29 | initDualCell(D, lP, *amr->finestLevel); 30 | findDualCell(amr, D); 31 | return lerp(D); 32 | } 33 | 34 | export void EXPORT_UNIQUE(AMR_install_finest, void *uniform _sampler) 35 | { 36 | SamplerShared *uniform sampler = (SamplerShared * uniform) _sampler; 37 | sampler->computeSample_varying = AMR_finest; 38 | } 39 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/particle/ParticleVolumeShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../UnstructuredVolumeBaseShared.h" 7 | #include "../common/DataShared.h" 8 | 9 | #ifdef __cplusplus 10 | namespace ispc { 11 | #endif // __cplusplus 12 | 13 | struct VKLParticleVolume 14 | { 15 | VKLUnstructuredBase super; 16 | 17 | VKL_INTEROP_UNIFORM float clampMaxCumulativeValue; 18 | VKL_INTEROP_UNIFORM float radiusSupportFactor; 19 | VKL_INTEROP_UNIFORM Data1D positions; 20 | VKL_INTEROP_UNIFORM Data1D radii; 21 | VKL_INTEROP_UNIFORM Data1D weights; 22 | }; 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif // __cplusplus 27 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbInnerNodeObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../common/Allocator.h" 7 | #include "../../observer/Observer.h" 8 | #include "../../observer/ObserverRegistry.h" 9 | #include "openvkl/ispc_cpp_interop.h" 10 | 11 | namespace openvkl { 12 | namespace cpu_device { 13 | 14 | template 15 | class VdbVolume; 16 | 17 | template 18 | struct VdbInnerNodeObserver : public Observer 19 | { 20 | VdbInnerNodeObserver(VdbVolume &target); 21 | 22 | VdbInnerNodeObserver(VdbInnerNodeObserver &&) = delete; 23 | VdbInnerNodeObserver &operator=(VdbInnerNodeObserver &&) = delete; 24 | VdbInnerNodeObserver(const VdbInnerNodeObserver &) = delete; 25 | VdbInnerNodeObserver &operator=(const VdbInnerNodeObserver &) = delete; 26 | 27 | ~VdbInnerNodeObserver(); 28 | 29 | const void *map() override; 30 | void unmap() override; 31 | VKLDataType getElementType() const override; 32 | size_t getElementSize() const override; 33 | size_t getNumElements() const override; 34 | 35 | void commit() override; 36 | 37 | private: 38 | void clear(); 39 | 40 | private: 41 | Allocator allocator{this->getDevice()}; 42 | size_t numFloats{0}; 43 | size_t size{0}; 44 | float *buffer{nullptr}; 45 | using Observer::target; 46 | }; 47 | 48 | } // namespace cpu_device 49 | } // namespace openvkl 50 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbIterator.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../../iterator/DefaultIterator.ih" 5 | #include "../../iterator/IteratorContextShared.h" 6 | #include "Dda.ih" 7 | #include "VdbGrid.h" 8 | 9 | struct VdbIterator 10 | { 11 | uniform DefaultHitIteratorIntervalIterator super; 12 | 13 | uniform const VdbGrid *uniform grid; 14 | 15 | float tMax; 16 | float nominalDeltaT; 17 | 18 | DdaState dda; 19 | }; 20 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbLeafAccessObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../common/Allocator.h" 7 | #include "../../observer/Observer.h" 8 | #include "../../observer/ObserverRegistry.h" 9 | #include "openvkl/ispc_cpp_interop.h" 10 | 11 | namespace openvkl { 12 | namespace cpu_device { 13 | 14 | template 15 | class VdbSampler; 16 | using ispc::VdbGrid; 17 | 18 | /* 19 | * The leaf access observer simply wraps the buffer allocated by VdbVolume. 20 | */ 21 | template 22 | struct VdbLeafAccessObserver : public Observer 23 | { 24 | VdbLeafAccessObserver(VdbSampler &target, const VdbGrid &grid); 25 | 26 | VdbLeafAccessObserver(VdbLeafAccessObserver &&) = delete; 27 | VdbLeafAccessObserver &operator=(VdbLeafAccessObserver &&) = delete; 28 | VdbLeafAccessObserver(const VdbLeafAccessObserver &) = delete; 29 | VdbLeafAccessObserver &operator=(const VdbLeafAccessObserver &) = delete; 30 | 31 | ~VdbLeafAccessObserver(); 32 | 33 | const void *map() override; 34 | void unmap() override; 35 | VKLDataType getElementType() const override; 36 | size_t getElementSize() const override; 37 | size_t getNumElements() const override; 38 | 39 | private: 40 | ObserverRegistry &getRegistry(); 41 | 42 | private: 43 | Allocator allocator{this->getDevice()}; 44 | size_t size{0}; 45 | vkl_uint32 *accessBuffer{nullptr}; 46 | }; 47 | 48 | } // namespace cpu_device 49 | } // namespace openvkl 50 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbLeafAccessObserver.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../observer/ObserverRegistry.ih" 7 | #include "VdbSamplerShared.h" 8 | 9 | inline uniform bool VdbLeafAccessObserver_isObservable( 10 | const VdbSamplerShared *uniform sampler) 11 | { 12 | assert(sampler); 13 | return sampler->leafAccessObservers && 14 | (((ObserverRegistry * uniform) sampler->leafAccessObservers)->size > 15 | 0); 16 | } 17 | 18 | #define __define_leaf_access_observer(univary) \ 19 | inline void VdbLeafAccessObserver_observe_##univary( \ 20 | const VdbSamplerShared *uniform sampler, const univary uint32 leafIndex) \ 21 | { \ 22 | assert(sampler->leafAccessObservers); \ 23 | ObserverRegistry *uniform registry = \ 24 | ((ObserverRegistry * uniform) sampler->leafAccessObservers); \ 25 | for (uniform size_t i = 0; i < registry->size; ++i) { \ 26 | uint32 *uniform accessBuffer = ((uint32 * uniform) registry->data[i]); \ 27 | /* NOTE: this is not synchronized between threads! */ \ 28 | accessBuffer[leafIndex] = 1; \ 29 | } \ 30 | } 31 | 32 | __define_leaf_access_observer(uniform) 33 | __define_leaf_access_observer(varying) 34 | 35 | #undef __define_leaf_access_observer 36 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbSampler.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "VdbSamplerShared.h" 7 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbSamplerShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl/ispc_cpp_interop.h" 7 | 8 | #include "../../sampler/SamplerShared.h" 9 | 10 | #ifdef __cplusplus 11 | namespace ispc { 12 | #endif // __cplusplus 13 | 14 | #ifdef __cplusplus 15 | typedef void *DenseLeafSamplingVaryingFunc; 16 | 17 | typedef void *DenseLeafSamplingUniformFunc; 18 | #else 19 | typedef varying float (*uniform DenseLeafSamplingVaryingFunc)( 20 | const VdbGrid *uniform grid, 21 | uniform uint32 attributeIndex, 22 | const varying vec3ui &offset, 23 | const varying float &time); 24 | 25 | typedef uniform float (*uniform DenseLeafSamplingUniformFunc)( 26 | const VdbGrid *uniform grid, 27 | uniform uint32 attributeIndex, 28 | const uniform vec3ui &offset, 29 | uniform float time); 30 | #endif 31 | 32 | #ifndef __ISPC_STRUCT_VdbSamplerShared__ 33 | #define __ISPC_STRUCT_VdbSamplerShared__ 34 | 35 | struct VdbSamplerShared 36 | { 37 | SamplerBaseShared super; 38 | 39 | const VdbGrid *VKL_INTEROP_UNIFORM grid; 40 | const void *VKL_INTEROP_UNIFORM leafAccessObservers; 41 | vkl_uint32 maxSamplingDepth; 42 | 43 | DenseLeafSamplingVaryingFunc *VKL_INTEROP_UNIFORM denseLeafSample_varying; 44 | DenseLeafSamplingUniformFunc *VKL_INTEROP_UNIFORM denseLeafSample_uniform; 45 | }; 46 | 47 | #endif 48 | #ifdef __cplusplus 49 | } 50 | #endif // __cplusplus 51 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbSampler_filter.ih: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "VdbSampler_nearest.ih" 7 | #include "VdbSampler_tricubic.ih" 8 | #include "VdbSampler_trilinear.ih" 9 | 10 | // This macro centralizes filter dispatch for the public API. 11 | // To add a filter, add the enum and than add a case here. 12 | // Then, implement all of the filter-specific functions above. 13 | #define __vkl_switch_filter(FilterEnum, F, ...) \ 14 | { \ 15 | switch (FilterEnum) { \ 16 | case VKL_FILTER_LINEAR: { \ 17 | F##Trilinear(__VA_ARGS__); \ 18 | break; \ 19 | } \ 20 | case VKL_FILTER_CUBIC: { \ 21 | F##Tricubic(__VA_ARGS__); \ 22 | break; \ 23 | } \ 24 | default: { \ 25 | assert(FilterEnum == VKL_FILTER_NEAREST); \ 26 | F##Nearest(__VA_ARGS__); \ 27 | break; \ 28 | } \ 29 | } \ 30 | } 31 | 32 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbVolume.ispc: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "rkcommon/math/box.ih" 5 | #include "rkcommon/math/vec.ih" 6 | 7 | #include "VdbGridShared.h" 8 | #include "VdbVolumeShared.h" 9 | #include "../../common/export_util.h" 10 | 11 | /* 12 | * This is a dummy export to make sure ISPC generates code 13 | * for the parameter type. 14 | */ 15 | export void EXPORT_UNIQUE(VdbVolume__declare_types_dummy, 16 | uniform vec3i &dummy_vec3i, 17 | uniform range1f &dummy_range1f) 18 | { 19 | } 20 | 21 | /* 22 | * Factory for ISPC versions of the volume. 23 | */ 24 | export void EXPORT_UNIQUE(VdbVolume_Constructor, void *uniform _self) 25 | { 26 | uniform VdbVolume *uniform self = (uniform VdbVolume * uniform) _self; 27 | memset(self, 0, sizeof(uniform VdbVolume)); 28 | } 29 | 30 | /* 31 | * Destructor for ISPC versions of the volume. 32 | */ 33 | export void EXPORT_UNIQUE(VdbVolume_destroy, void *uniform _self) {} 34 | 35 | /* 36 | * Initialize the volume data structure. 37 | */ 38 | export void EXPORT_UNIQUE(VdbVolume_setGrid, 39 | void *uniform _self, 40 | const VdbGrid *uniform grid) 41 | { 42 | assert(_self); 43 | VdbVolume *uniform volume = (VdbVolume * uniform) _self; 44 | volume->grid = grid; 45 | } 46 | -------------------------------------------------------------------------------- /openvkl/devices/cpu/volume/vdb/VdbVolumeShared.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../VolumeShared.h" 7 | 8 | #ifdef __cplusplus 9 | namespace ispc { 10 | #endif // __cplusplus 11 | 12 | VKL_INTEROP_VARYING float VdbVolume_sample( 13 | const VdbGrid *VKL_INTEROP_UNIFORM grid, 14 | const VKL_INTEROP_VARYING vec3i &ic); 15 | 16 | struct VdbVolume 17 | { 18 | VolumeShared super; 19 | const VdbGrid *VKL_INTEROP_UNIFORM grid; 20 | }; 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif // __cplusplus 25 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/api/AddDeviceAPIs.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../../api/Device.h" 7 | 8 | namespace openvkl { 9 | namespace gpu_device { 10 | 11 | struct AddDeviceAPIs : public api::Device 12 | { 13 | }; 14 | 15 | } // namespace gpu_device 16 | } // namespace openvkl 17 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/compute/amr/AMR.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../../cpu/volume/amr/AMRShared.h" 7 | 8 | namespace ispc { 9 | 10 | inline vec3f lerp(const box3f box, const vec3f w) 11 | { 12 | return box.lower + (box.upper - box.lower) * w; 13 | } 14 | 15 | inline float max(float a, float b, float c) 16 | { 17 | return max(max(a, b), c); 18 | } 19 | 20 | inline float min(float a, float b, float c) 21 | { 22 | return min(min(a, b), c); 23 | } 24 | 25 | inline float max( 26 | float a, float b, float c, float d, float e, float f, float g, float h) 27 | { 28 | return max(max(max(a, b), max(c, d)), max(max(e, f), max(g, h))); 29 | } 30 | 31 | inline float min( 32 | float a, float b, float c, float d, float e, float f, float g, float h) 33 | { 34 | return min(min(min(a, b), min(c, d)), min(min(e, f), min(g, h))); 35 | } 36 | 37 | inline vec3f nextafter(const vec3f v, const vec3f sign) 38 | { 39 | return make_vec3f( 40 | nextafter(v.x, sign.x), nextafter(v.y, sign.y), nextafter(v.z, sign.z)); 41 | } 42 | 43 | } // namespace ispc 44 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/compute/amr/FindStack.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | namespace ispc { 7 | 8 | struct FindStack 9 | { 10 | bool active; 11 | int32 nodeID; 12 | }; 13 | 14 | inline FindStack *pushStack(FindStack *stackPtr, int nodeID) 15 | { 16 | stackPtr->active = false; 17 | 18 | stackPtr->active = true; 19 | stackPtr->nodeID = nodeID; 20 | return stackPtr + 1; 21 | } 22 | 23 | inline FindStack *pushStack(FindStack *stackPtr, int nodeID, bool valid) 24 | { 25 | stackPtr->active = false; 26 | 27 | stackPtr->active = valid; 28 | stackPtr->nodeID = nodeID; 29 | return stackPtr + 1; 30 | } 31 | 32 | } // namespace ispc 33 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/compute/amr/KDTree.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../../cpu/volume/amr/KDTreeShared.h" 7 | 8 | namespace ispc { 9 | 10 | inline uint32 getDim(const KDTreeNode &node) 11 | { 12 | return node.dim_and_ofs >> 30; 13 | } 14 | 15 | inline uint32 getOfs(const KDTreeNode &node) 16 | { 17 | return node.dim_and_ofs & ((1 << 30) - 1); 18 | } 19 | 20 | inline bool isLeaf(const KDTreeNode &node) 21 | { 22 | return getDim(node) == 3; 23 | } 24 | 25 | inline float getPos(const KDTreeNode &node) 26 | { 27 | return floatbits(node.pos_or_numItems); 28 | } 29 | 30 | inline float getNumItems(const KDTreeNode &node) 31 | { 32 | return node.pos_or_numItems; 33 | } 34 | 35 | } // namespace ispc 36 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/compute/iterator_common.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "../../cpu/common/ValueRangesShared.h" 7 | #include "../../cpu/math/box_utility.ih" 8 | 9 | namespace ispc { 10 | 11 | // from Interval.ih; we use this instead of VKLInterval for box1f types 12 | struct Interval 13 | { 14 | box1f tRange; 15 | box1f valueRange; 16 | float nominalDeltaT; 17 | }; 18 | 19 | inline void resetInterval(Interval &interval) 20 | { 21 | interval.tRange.lower = 1.f; 22 | interval.tRange.upper = -1.f; 23 | interval.valueRange.lower = 0.f; 24 | interval.valueRange.upper = 0.f; 25 | interval.nominalDeltaT = 0.f; 26 | } 27 | 28 | // from ValueRanges.ih 29 | inline bool valueRangesOverlap(const ValueRanges &valueRanges, const box1f &r) 30 | { 31 | if (valueRanges.numRanges == 0) { 32 | return true; 33 | } 34 | 35 | if (overlaps1f(valueRanges.rangesMinMax, r)) { 36 | for (int i = 0; i < valueRanges.numRanges; i++) { 37 | if (overlaps1f(valueRanges.ranges[i], r)) { 38 | return true; 39 | } 40 | } 41 | } 42 | 43 | return false; 44 | } 45 | } // namespace ispc -------------------------------------------------------------------------------- /openvkl/devices/gpu/compute/vdb/VdbSampler_stencilDispatch.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | /* 7 | * Version for uniform IC and TIME. 8 | * 9 | * This parallelizes over the stencil, so BODY sees coord and tgtIdx as 10 | * varying quantities! 11 | */ 12 | #define __vkl_stencil_dispatch_uniform(FILTER, IC, TIME, BODY) \ 13 | { \ 14 | const vec3i offset[] = VKL_STENCIL_##FILTER##_OFFSETS; \ 15 | const size_t N = VKL_STENCIL_##FILTER##_SIZE; \ 16 | \ 17 | { \ 18 | const float TIME##Disp = TIME; \ 19 | for (uint32_t o = 0; o < N; o++) { \ 20 | const vec3i IC##Disp = make_vec3i( \ 21 | IC.x + offset[o].x, IC.y + offset[o].y, IC.z + offset[o].z); \ 22 | const uint32 tgtIdx = o; \ 23 | BODY \ 24 | } \ 25 | } \ 26 | } 27 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/include/openvkl/device/max_iterator_size.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // Maximum iterator size over all supported volume types. These sizes are 7 | // validated by static_assert()s in DeviceAPI.cpp. 8 | #define VKL_MAX_INTERVAL_ITERATOR_SIZE 256 9 | #define VKL_MAX_HIT_ITERATOR_SIZE 320 10 | -------------------------------------------------------------------------------- /openvkl/devices/gpu/openvkl_module_gpu_device_deps.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/openvkl/devices/gpu/openvkl_module_gpu_device_deps.cpp -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLBackgroundUndefined.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "ispc_cpp_interop.h" 7 | 8 | // A special value we use to distinguish an undefined field value. This could 9 | // be the result of sampling out of bounds, or sampling at a position in bounds 10 | // but not covered by any input data. 11 | // This value is a quiet NaN. 12 | #define VKL_BACKGROUND_UNDEFINED floatbits(0xFFC068B5u) 13 | 14 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLError.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // Error codes returned by various API and callback functions 7 | typedef enum 8 | #if __cplusplus >= 201103L 9 | : uint32_t 10 | #endif 11 | { 12 | VKL_NO_ERROR = 0, // No error has been recorded 13 | VKL_UNKNOWN_ERROR = 1, // An unknown error has occured 14 | VKL_INVALID_ARGUMENT = 2, // An invalid argument is specified 15 | VKL_INVALID_OPERATION = 16 | 3, // The operation is not allowed for the specified object 17 | VKL_OUT_OF_MEMORY = 18 | 4, // There is not enough memory left to execute the command 19 | VKL_UNSUPPORTED_CPU = 20 | 5, // The CPU is not supported as it does not support SSE4.1 21 | } VKLError; 22 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLFilter.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "ispc_cpp_interop.h" 7 | 8 | // ======================================================================== // 9 | // An enum that represents the different filter types available in volumes. 10 | // ======================================================================== // 11 | enum VKLFilter 12 | #if __cplusplus >= 201103L 13 | : vkl_uint32 14 | #endif 15 | { 16 | // Only read the voxel the sample position is in, treating it as 17 | // constant. 18 | VKL_FILTER_NEAREST = 0, 19 | // Read the eight voxels surrounding the sample position, and 20 | // interpolate trilinearly. 21 | VKL_FILTER_LINEAR = 100, 22 | // Tricubic interpolation. 23 | VKL_FILTER_CUBIC = 200, 24 | }; 25 | 26 | 27 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLFormat.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "ispc_cpp_interop.h" 7 | 8 | // ========================================================================== // 9 | // An enum for data format constants. 10 | // This value determines how voxel data buffers are interpreted by VKL. 11 | // ========================================================================== // 12 | #if __cplusplus > 201103L 13 | enum VKLFormat : vkl_uint32 14 | #else 15 | enum VKLFormat 16 | #endif 17 | { 18 | // The node has no spatial variation. 19 | VKL_FORMAT_TILE = 0, 20 | // The buffer contains a dense grid of voxels. 21 | // The suffix _ZYX indicates z-major ordering, i.e., the z-coordinate 22 | // advances most quickly. 23 | VKL_FORMAT_DENSE_ZYX, 24 | VKL_FORMAT_INVALID = 100 25 | }; 26 | 27 | 28 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLLogLevel.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | // Log levels which can be set on a device via "logLevel" parameter or 7 | // "OPENVKL_LOG_LEVEL" environment variable 8 | typedef enum 9 | #if __cplusplus >= 201103L 10 | : uint32_t 11 | #endif 12 | { 13 | VKL_LOG_DEBUG = 1, 14 | VKL_LOG_INFO = 2, 15 | VKL_LOG_WARNING = 3, 16 | VKL_LOG_ERROR = 4, 17 | VKL_LOG_NONE = 5, 18 | } VKLLogLevel; 19 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/VKLTemporalFormat.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "ispc_cpp_interop.h" 7 | 8 | // ========================================================================== // 9 | // An enum for temporal format constants. 10 | // ========================================================================== // 11 | #if __cplusplus > 201103L 12 | enum VKLTemporalFormat : vkl_uint32 13 | #else 14 | enum VKLTemporalFormat 15 | #endif 16 | { 17 | // There is no temporal variation. 18 | VKL_TEMPORAL_FORMAT_CONSTANT = 0, 19 | // Each voxel contains the same number of temporal samples and they 20 | // are placed regularly in [0, 1]. 21 | VKL_TEMPORAL_FORMAT_STRUCTURED, 22 | // Temporal resolution is adaptive, such that voxels may have different 23 | // numbers of time steps. See the api documentation for more detail. 24 | VKL_TEMPORAL_FORMAT_UNSTRUCTURED, 25 | VKL_TEMPORAL_FORMAT_INVALID = 100 26 | }; 27 | 28 | 29 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/common.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "types.h" 7 | 8 | #if !defined(VKL_API) 9 | #define VKL_API extern "C" unmasked 10 | #endif 11 | 12 | #if !defined(VKL_FORCEINLINE) 13 | #define VKL_FORCEINLINE inline 14 | #endif 15 | 16 | // Force expansion on two tokens and concatenate them. 17 | #define __vkl_concat(A, B) __vkl_concat_impl(A, B) 18 | #define __vkl_concat_impl(A, B) A##B 19 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/data.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifdef __cplusplus 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | #include "VKLDataType.h" 13 | #include "device.h" 14 | 15 | // flags that can be passed to vklNewData(), which can be OR'ed together 16 | typedef enum 17 | #if __cplusplus >= 201103L 18 | : uint32_t 19 | #endif 20 | { 21 | VKL_DATA_DEFAULT = 0, 22 | VKL_DATA_SHARED_BUFFER = (1 << 0), 23 | } VKLDataCreationFlags; 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #ifdef __cplusplus 30 | struct VKLData : public VKLObject 31 | { 32 | }; 33 | #else 34 | typedef VKLObject VKLData; 35 | #endif 36 | 37 | NOWARN_C_LINKAGE_PUSH 38 | OPENVKL_INTERFACE VKLData vklNewData(VKLDevice device, 39 | size_t numItems, 40 | VKLDataType dataType, 41 | const void *source, 42 | VKLDataCreationFlags dataCreationFlags 43 | VKL_DEFAULT_VAL(= VKL_DATA_DEFAULT), 44 | size_t byteStride VKL_DEFAULT_VAL(= 0)); 45 | NOWARN_C_LINKAGE_POP 46 | 47 | #ifdef __cplusplus 48 | } // extern "C" 49 | #endif 50 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/iterator.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "common.h" 7 | #include "sampler.h" 8 | 9 | #ifdef __cplusplus 10 | struct VKLIntervalIteratorContext : public VKLObject 11 | { 12 | }; 13 | struct VKLHitIteratorContext : public VKLObject 14 | { 15 | }; 16 | #else 17 | typedef VKLObject VKLIntervalIteratorContext; 18 | typedef VKLObject VKLHitIteratorContext; 19 | #endif 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | NOWARN_C_LINKAGE_PUSH 26 | 27 | /* 28 | * Interval iterators require a context. 29 | */ 30 | OPENVKL_INTERFACE 31 | VKLIntervalIteratorContext vklNewIntervalIteratorContext(VKLSampler sampler); 32 | 33 | /* 34 | * Hit iterators require a context. 35 | */ 36 | OPENVKL_INTERFACE 37 | VKLHitIteratorContext vklNewHitIteratorContext(VKLSampler sampler); 38 | 39 | NOWARN_C_LINKAGE_POP 40 | 41 | #ifdef __cplusplus 42 | } // extern "C" 43 | #endif 44 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/iterator.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "common.isph" 7 | 8 | typedef uniform VKLObject VKLIntervalIteratorContext; 9 | typedef uniform VKLObject VKLHitIteratorContext; 10 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/openvkl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "VKLBackgroundUndefined.h" 7 | #include "VKLDataType.h" 8 | #include "VKLError.h" 9 | #include "VKLFilter.h" 10 | #include "VKLFormat.h" 11 | #include "VKLLogLevel.h" 12 | #include "VKLTemporalFormat.h" 13 | 14 | #include "common.h" 15 | #include "data.h" 16 | #include "device.h" 17 | #include "iterator.h" 18 | #include "observer.h" 19 | #include "parameters.h" 20 | #include "sampler.h" 21 | #include "version.h" 22 | #include "volume.h" 23 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/openvkl.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "VKLBackgroundUndefined.h" 7 | #include "VKLFormat.h" 8 | #include "common.isph" 9 | #include "iterator.isph" 10 | #include "sampler.isph" 11 | #include "version.h" 12 | #include "volume.isph" 13 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/openvkl.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/openvkl/include/openvkl/openvkl.rc -------------------------------------------------------------------------------- /openvkl/include/openvkl/parameters.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "common.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | OPENVKL_INTERFACE void vklSetBool(VKLObject object, const char *name, int b); 13 | OPENVKL_INTERFACE void vklSetFloat(VKLObject object, const char *name, float x); 14 | OPENVKL_INTERFACE void vklSetVec3f( 15 | VKLObject object, const char *name, float x, float y, float z); 16 | OPENVKL_INTERFACE void vklSetInt(VKLObject object, const char *name, int x); 17 | OPENVKL_INTERFACE void vklSetVec3i( 18 | VKLObject object, const char *name, int x, int y, int z); 19 | OPENVKL_INTERFACE void vklSetData(VKLObject object, 20 | const char *name, 21 | VKLData data); 22 | OPENVKL_INTERFACE void vklSetString(VKLObject object, 23 | const char *name, 24 | const char *s); 25 | OPENVKL_INTERFACE void vklSetVoidPtr(VKLObject object, 26 | const char *name, 27 | void *v); 28 | 29 | OPENVKL_INTERFACE void vklSetParam(VKLObject object, 30 | const char *name, 31 | VKLDataType dataType, 32 | const void *mem); 33 | 34 | #ifdef __cplusplus 35 | } // extern "C" 36 | #endif 37 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/sampler.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifdef __cplusplus 7 | #include 8 | #include 9 | #else 10 | #include 11 | #include 12 | #endif 13 | 14 | #include "common.h" 15 | #include "volume.h" 16 | 17 | #ifdef __cplusplus 18 | struct VKLSampler : public VKLObject 19 | { 20 | }; 21 | #else 22 | typedef VKLObject VKLSampler; 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | NOWARN_C_LINKAGE_PUSH 30 | OPENVKL_INTERFACE VKLSampler vklNewSampler(VKLVolume volume); 31 | NOWARN_C_LINKAGE_POP 32 | 33 | typedef vkl_uint64 VKLFeatureFlags; 34 | 35 | #define VKL_FEATURE_FLAGS_NONE 0 36 | 37 | // equivalent to all feature flags enabled 38 | #define VKL_FEATURE_FLAGS_DEFAULT -1 39 | 40 | OPENVKL_INTERFACE 41 | VKLFeatureFlags vklGetFeatureFlags(VKLSampler sampler); 42 | 43 | #ifdef __cplusplus 44 | } // extern "C" 45 | #endif 46 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/sampler.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | typedef vkl_uint64 VKLFeatureFlags; 7 | 8 | #define VKL_FEATURE_FLAGS_NONE 0 9 | 10 | // equivalent to all feature flags enabled 11 | #define VKL_FEATURE_FLAGS_DEFAULT -1 12 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #define OPENVKL_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ 7 | #define OPENVKL_VERSION_MINOR @PROJECT_VERSION_MINOR@ 8 | #define OPENVKL_VERSION_PATCH @PROJECT_VERSION_PATCH@ 9 | #define OPENVKL_VERSION "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" 10 | -------------------------------------------------------------------------------- /openvkl/include/openvkl/volume.isph: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "common.isph" 7 | 8 | typedef uniform VKLObject VKLVolume; 9 | 10 | VKL_API void vklGetBoundingBoxRef(const VKLVolume *uniform volume, 11 | vkl_box3f *uniform boundingBox); 12 | 13 | VKL_FORCEINLINE uniform vkl_box3f vklGetBoundingBox(VKLVolume volume) 14 | { 15 | uniform vkl_box3f result; 16 | vklGetBoundingBoxRef(&volume, &result); 17 | return result; 18 | } 19 | 20 | VKL_API uniform unsigned int vklGetNumAttributesRef( 21 | const VKLVolume *uniform volume); 22 | 23 | VKL_FORCEINLINE uniform unsigned int vklGetNumAttributes(VKLVolume volume) 24 | { 25 | return vklGetNumAttributesRef(&volume); 26 | } 27 | 28 | VKL_API void vklGetValueRangeRef(const VKLVolume *uniform volume, 29 | uniform unsigned int attributeIndex, 30 | vkl_range1f *uniform valueRange); 31 | 32 | VKL_FORCEINLINE uniform vkl_range1f 33 | vklGetValueRange(VKLVolume volume, uniform unsigned int attributeIndex = 0) 34 | { 35 | uniform vkl_range1f result; 36 | vklGetValueRangeRef(&volume, attributeIndex, &result); 37 | return result; 38 | } 39 | -------------------------------------------------------------------------------- /superbuild/dependencies/dep_blosc.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2020 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | set(COMPONENT_NAME c-blosc) 5 | 6 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) 7 | if (INSTALL_IN_SEPARATE_DIRECTORIES) 8 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) 9 | endif() 10 | 11 | ExternalProject_Add(${COMPONENT_NAME} 12 | PREFIX ${COMPONENT_NAME} 13 | DOWNLOAD_DIR ${COMPONENT_NAME} 14 | STAMP_DIR ${COMPONENT_NAME}/stamp 15 | SOURCE_DIR ${COMPONENT_NAME}/src 16 | BINARY_DIR ${COMPONENT_NAME}/build 17 | URL ${BLOSC_URL} 18 | URL_HASH SHA256=${BLOSC_HASH} 19 | CMAKE_ARGS 20 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} 21 | -DCMAKE_INSTALL_PREFIX:PATH=${COMPONENT_PATH} 22 | -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} 23 | -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} 24 | -DCMAKE_INSTALL_DOCDIR=${CMAKE_INSTALL_DOCDIR} 25 | -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} 26 | -DCMAKE_BUILD_TYPE=Release 27 | -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} 28 | -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} 29 | -DPREFER_EXTERNAL_ZLIB=ON 30 | -DZLIB_ROOT=${ZLIB_PATH} 31 | BUILD_COMMAND ${DEFAULT_BUILD_COMMAND} 32 | BUILD_ALWAYS OFF 33 | ) 34 | 35 | set(BLOSC_PATH ${COMPONENT_PATH}) 36 | 37 | ExternalProject_Add_StepDependencies(c-blosc 38 | configure 39 | zlib 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /superbuild/dependencies/dep_boost.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2020 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | set(COMPONENT_NAME boost) 5 | 6 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) 7 | if (INSTALL_IN_SEPARATE_DIRECTORIES) 8 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) 9 | endif() 10 | 11 | set(BOOST_CONF "./bootstrap.sh") 12 | set(BOOST_BUILD "./b2") 13 | set(BOOST_LINK "shared") 14 | 15 | if (WIN32) 16 | set(BOOST_CONF "bootstrap.bat") 17 | set(BOOST_BUILD "b2.exe") 18 | endif() 19 | 20 | if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64|aarch64") 21 | set(BOOST_ARCH "arm") 22 | else() 23 | set(BOOST_ARCH "x86") 24 | endif() 25 | 26 | 27 | ExternalProject_Add(${COMPONENT_NAME} 28 | PREFIX ${COMPONENT_NAME} 29 | DOWNLOAD_DIR ${COMPONENT_NAME} 30 | STAMP_DIR ${COMPONENT_NAME}/stamp 31 | SOURCE_DIR ${COMPONENT_NAME}/src 32 | BINARY_DIR ${COMPONENT_NAME}/src 33 | URL ${BOOST_URL} 34 | URL_HASH SHA256=${BOOST_HASH} 35 | CONFIGURE_COMMAND ${BOOST_CONF} 36 | BUILD_COMMAND ${BOOST_BUILD} -d0 --with-system --with-iostreams --with-regex --layout=system 37 | --prefix=${COMPONENT_PATH} variant=release threading=multi address-model=64 -s NO_ZSTD=1 38 | link=${BOOST_LINK} architecture=${BOOST_ARCH} install 39 | INSTALL_COMMAND "" 40 | BUILD_ALWAYS OFF 41 | ) 42 | 43 | mark_as_advanced(BOOST_CONF) 44 | mark_as_advanced(BOOST_BUILD) 45 | mark_as_advanced(BOOST_LINK) 46 | 47 | set(BOOST_PATH ${COMPONENT_PATH}) 48 | 49 | -------------------------------------------------------------------------------- /superbuild/dependencies/dep_ilmbase.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2020 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | set(COMPONENT_NAME ilmbase) 5 | 6 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) 7 | if (INSTALL_IN_SEPARATE_DIRECTORIES) 8 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) 9 | endif() 10 | 11 | # The options we set contain an empty lib suffix as well as an empty debug 12 | # suffix. This is so that the build works in windows in the default 13 | # configuration of `cmake --build .` (without specifying --config Release). 14 | 15 | ExternalProject_Add(${COMPONENT_NAME} 16 | PREFIX ${COMPONENT_NAME} 17 | DOWNLOAD_DIR ${COMPONENT_NAME} 18 | STAMP_DIR ${COMPONENT_NAME}/stamp 19 | SOURCE_DIR ${COMPONENT_NAME}/src 20 | BINARY_DIR ${COMPONENT_NAME}/build 21 | URL ${ILMBASE_URL} 22 | URL_HASH SHA256=${ILMBASE_HASH} 23 | SOURCE_SUBDIR IlmBase 24 | CMAKE_ARGS 25 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} 26 | -DCMAKE_INSTALL_PREFIX:PATH=${COMPONENT_PATH} 27 | -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} 28 | -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} 29 | -DCMAKE_INSTALL_DOCDIR=${CMAKE_INSTALL_DOCDIR} 30 | -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} 31 | -DCMAKE_BUILD_TYPE=Release 32 | -DILMBASE_LIB_SUFFIX:STRING= 33 | -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} 34 | -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} 35 | BUILD_COMMAND ${DEFAULT_BUILD_COMMAND} 36 | BUILD_ALWAYS OFF 37 | ) 38 | 39 | set(ILMBASE_PATH ${COMPONENT_PATH}) 40 | -------------------------------------------------------------------------------- /superbuild/dependencies/dep_ispc.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | set(COMPONENT_NAME ispc) 5 | 6 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) 7 | if (INSTALL_IN_SEPARATE_DIRECTORIES) 8 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) 9 | endif() 10 | 11 | ExternalProject_Add(${COMPONENT_NAME} 12 | PREFIX ${COMPONENT_NAME} 13 | STAMP_DIR ${COMPONENT_NAME}/stamp 14 | URL ${ISPC_URL} 15 | URL_HASH SHA256=${ISPC_HASH} 16 | CONFIGURE_COMMAND "" 17 | BUILD_COMMAND "" 18 | INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_if_different 19 | /bin/ispc${CMAKE_EXECUTABLE_SUFFIX} 20 | ${COMPONENT_PATH}/bin/ispc${CMAKE_EXECUTABLE_SUFFIX} 21 | BUILD_ALWAYS OFF 22 | ) 23 | 24 | set(ISPC_PATH "${COMPONENT_PATH}/bin/ispc${CMAKE_EXECUTABLE_SUFFIX}") 25 | -------------------------------------------------------------------------------- /superbuild/dependencies/dep_zlib.cmake: -------------------------------------------------------------------------------- 1 | ## Copyright 2020 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | set(COMPONENT_NAME zlib) 5 | 6 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}) 7 | if (INSTALL_IN_SEPARATE_DIRECTORIES) 8 | set(COMPONENT_PATH ${INSTALL_DIR_ABSOLUTE}/${COMPONENT_NAME}) 9 | endif() 10 | 11 | ExternalProject_Add(${COMPONENT_NAME} 12 | PREFIX ${COMPONENT_NAME} 13 | DOWNLOAD_DIR ${COMPONENT_NAME} 14 | STAMP_DIR ${COMPONENT_NAME}/stamp 15 | SOURCE_DIR ${COMPONENT_NAME}/src 16 | BINARY_DIR ${COMPONENT_NAME}/build 17 | URL "${ZLIB_URL}" 18 | URL_HASH SHA256=${ZLIB_HASH} 19 | CMAKE_ARGS 20 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 21 | -DCMAKE_INSTALL_PREFIX:PATH=${COMPONENT_PATH} 22 | -DCMAKE_BUILD_TYPE=Release 23 | -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} 24 | -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} 25 | BUILD_COMMAND ${DEFAULT_BUILD_COMMAND} 26 | BUILD_ALWAYS OFF 27 | ) 28 | 29 | set(ZLIB_PATH ${COMPONENT_PATH}) 30 | 31 | -------------------------------------------------------------------------------- /testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2019 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | add_library(openvkl_testing_cpu STATIC 5 | apps/AppInit.cpp 6 | volume/TestingVdbTorusVolume.cpp 7 | ) 8 | 9 | target_link_libraries(openvkl_testing_cpu PUBLIC 10 | openvkl 11 | rkcommon::rkcommon 12 | openvkl_utility 13 | openvkl_module_cpu_device 14 | ) 15 | 16 | target_include_directories(openvkl_testing_cpu 17 | INTERFACE 18 | ${CMAKE_CURRENT_SOURCE_DIR} 19 | ) 20 | 21 | target_compile_definitions(openvkl_testing_cpu PUBLIC 22 | OPENVKL_TESTING_CPU 23 | ) 24 | 25 | if (${OPENVKL_ENABLE_DEVICE_GPU}) 26 | add_library(openvkl_testing_gpu STATIC 27 | apps/AppInit.cpp 28 | ) 29 | 30 | target_link_libraries(openvkl_testing_gpu PUBLIC 31 | openvkl 32 | rkcommon::rkcommon 33 | openvkl_utility 34 | openvkl_module_gpu_device 35 | ) 36 | 37 | target_include_directories(openvkl_testing_gpu 38 | INTERFACE 39 | ${CMAKE_CURRENT_SOURCE_DIR} 40 | ) 41 | 42 | target_compile_definitions(openvkl_testing_gpu PUBLIC 43 | OPENVKL_TESTING_GPU 44 | ) 45 | endif() 46 | 47 | if (BUILD_BENCHMARKS) 48 | set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE) 49 | set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) 50 | 51 | add_subdirectory(external/benchmark) 52 | endif() 53 | 54 | add_subdirectory(apps) 55 | -------------------------------------------------------------------------------- /testing/apps/AppInit.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | #include 9 | 10 | void initializeOpenVKL(); 11 | void shutdownOpenVKL(); 12 | VKLDevice getOpenVKLDevice(); 13 | #ifdef OPENVKL_TESTING_GPU 14 | sycl::queue &getSyclQueue(); 15 | 16 | void setUseDeviceOnlySharedBuffers(bool enabled); 17 | bool getUseDeviceOnlySharedBuffers(); 18 | #endif -------------------------------------------------------------------------------- /testing/apps/benchmark_env.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "rkcommon/utility/getEnvVar.h" 7 | 8 | inline int getEnvBenchmarkVolumeDim() 9 | { 10 | const int defaultDim = 128; 11 | 12 | auto OPENVKL_BENCHMARK_VOLUME_DIM = 13 | rkcommon::utility::getEnvVar("OPENVKL_BENCHMARK_VOLUME_DIM"); 14 | int dim = OPENVKL_BENCHMARK_VOLUME_DIM.value_or(defaultDim); 15 | 16 | static bool printOnce = false; 17 | 18 | if (!printOnce && dim != defaultDim) { 19 | printOnce = true; 20 | std::cerr << "using benchmark volume dimension = " << dim << std::endl; 21 | } 22 | 23 | return dim; 24 | } 25 | -------------------------------------------------------------------------------- /testing/apps/tests/alignment.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../../external/catch.hpp" 5 | #include "../openvkl/devices/cpu/common/align.h" 6 | 7 | #include 8 | 9 | using namespace openvkl::cpu_device; 10 | 11 | TEST_CASE("Alignment", "") 12 | { 13 | SECTION("Untyped alignment") 14 | { 15 | for (std::intptr_t p = 0; p < 100000; ++p) 16 | for (size_t a = 1; a < 1024; a<<=1) 17 | { 18 | void *ptr = reinterpret_cast(p); 19 | void *alignedPtr = align(ptr, a); 20 | REQUIRE(reinterpret_cast(alignedPtr) % a == 0); 21 | } 22 | } 23 | SECTION("Typed alignment") 24 | { 25 | for (std::intptr_t p = 0; p < 100000; ++p) 26 | { 27 | void *ptr = reinterpret_cast(p); 28 | void *alignedPtr = align(ptr); 29 | REQUIRE(reinterpret_cast(alignedPtr) % alignof(std::uint64_t) == 0); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /testing/apps/tests/amr_volume_value_range.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../../external/catch.hpp" 5 | #include "openvkl_testing.h" 6 | #include "rkcommon/utility/multidim_index_sequence.h" 7 | 8 | using namespace rkcommon; 9 | using namespace openvkl::testing; 10 | 11 | void computed_vs_api_value_range(vec3i dimensions) 12 | { 13 | std::unique_ptr> v( 14 | new ProceduralShellsAMRVolume<>(dimensions, vec3f(0.f), vec3f(1.f))); 15 | 16 | VKLVolume vklVolume = v->getVKLVolume(getOpenVKLDevice()); 17 | 18 | vkl_range1f apiValueRange = vklGetValueRange(vklVolume); 19 | 20 | range1f computedValueRange = v->getComputedValueRange(); 21 | 22 | INFO("api valueRange = " << apiValueRange.lower << " " 23 | << apiValueRange.upper); 24 | INFO("computed valueRange = " << computedValueRange.lower << " " 25 | << computedValueRange.upper); 26 | 27 | REQUIRE((apiValueRange.lower == computedValueRange.lower && 28 | apiValueRange.upper == computedValueRange.upper)); 29 | } 30 | 31 | #if OPENVKL_DEVICE_CPU_AMR 32 | TEST_CASE("AMR volume value range", "[volume_value_range]") 33 | { 34 | initializeOpenVKL(); 35 | 36 | computed_vs_api_value_range(vec3i(256)); 37 | 38 | shutdownOpenVKL(); 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /testing/apps/tests/background_undefined.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "../../external/catch.hpp" 5 | #include "openvkl/VKLBackgroundUndefined.h" 6 | 7 | #include 8 | 9 | TEST_CASE("Background undefined", "") 10 | { 11 | SECTION("Is NaN") 12 | { 13 | REQUIRE(std::isnan(VKL_BACKGROUND_UNDEFINED)); 14 | } 15 | 16 | SECTION("Is non signalling") 17 | { 18 | REQUIRE(!(VKL_BACKGROUND_UNDEFINED == VKL_BACKGROUND_UNDEFINED)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testing/apps/tests/iterator_utility.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #include "openvkl_testing.h" 7 | 8 | inline vkl_range1f computeIntervalValueRange(VKLSampler sampler, 9 | const unsigned int attributeIndex, 10 | const vkl_vec3f &origin, 11 | const vkl_vec3f &direction, 12 | const vkl_range1f &tRange) 13 | { 14 | float infinity(std::numeric_limits::infinity()); 15 | float neg_infinity(-std::numeric_limits::infinity()); 16 | vkl_range1f sampledValueRange{infinity, neg_infinity}; 17 | 18 | constexpr int numValueRangeSamples = 100; 19 | 20 | for (int i = 0; i < numValueRangeSamples; i++) { 21 | float t = tRange.lower + float(i) / float(numValueRangeSamples - 1) * 22 | (tRange.upper - tRange.lower); 23 | 24 | vkl_vec3f c{origin.x + t * direction.x, 25 | origin.y + t * direction.y, 26 | origin.z + t * direction.z}; 27 | 28 | float sample = vklComputeSample(&sampler, &c, attributeIndex); 29 | 30 | sampledValueRange.lower = std::min(sampledValueRange.lower, sample); 31 | sampledValueRange.upper = std::max(sampledValueRange.upper, sample); 32 | } 33 | 34 | return sampledValueRange; 35 | } 36 | 37 | inline bool rangesIntersect(const vkl_range1f &range1, 38 | const vkl_range1f &range2) 39 | { 40 | return range1.upper >= range2.lower && range1.lower <= range2.upper; 41 | } 42 | -------------------------------------------------------------------------------- /testing/apps/tests/multi_attrib_utility.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include "openvkl_testing.h" 5 | 6 | template 7 | inline void num_attributes(std::shared_ptr v) 8 | { 9 | VKLVolume vklVolume = v->getVKLVolume(getOpenVKLDevice()); 10 | REQUIRE(vklGetNumAttributes(vklVolume) == v->getNumAttributes()); 11 | } 12 | 13 | template 14 | void computed_vs_api_value_range(std::shared_ptr v, 15 | unsigned int attributeIndex) 16 | { 17 | VKLVolume vklVolume = v->getVKLVolume(getOpenVKLDevice()); 18 | 19 | vkl_range1f apiValueRange = vklGetValueRange(vklVolume, attributeIndex); 20 | 21 | range1f computedValueRange = v->getComputedValueRange(attributeIndex); 22 | 23 | INFO("api valueRange = " << apiValueRange.lower << " " 24 | << apiValueRange.upper); 25 | INFO("computed valueRange = " << computedValueRange.lower << " " 26 | << computedValueRange.upper); 27 | 28 | REQUIRE((apiValueRange.lower == computedValueRange.lower && 29 | apiValueRange.upper == computedValueRange.upper)); 30 | } 31 | -------------------------------------------------------------------------------- /testing/apps/tests/stream_gradients.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #include 5 | #include "../../external/catch.hpp" 6 | #include "gradient_utility.h" 7 | #include "openvkl_testing.h" 8 | 9 | using namespace rkcommon; 10 | using namespace openvkl::testing; 11 | 12 | TEST_CASE("Stream gradients", "[volume_gradients]") 13 | { 14 | initializeOpenVKL(); 15 | 16 | #if OPENVKL_DEVICE_CPU_STRUCTURED_REGULAR 17 | SECTION("structuredRegular") 18 | { 19 | auto v = std::make_shared>( 20 | vec3i(128), vec3f(0.f), vec3f(1.f)); 21 | test_stream_gradients(v); 22 | } 23 | #endif 24 | 25 | #if OPENVKL_DEVICE_CPU_STRUCTURED_SPHERICAL 26 | SECTION("structuredSpherical") 27 | { 28 | auto v = std::make_shared>( 29 | vec3i(128), vec3f(0.f), vec3f(1.f)); 30 | test_stream_gradients(v); 31 | } 32 | #endif 33 | 34 | #if OPENVKL_DEVICE_CPU_UNSTRUCTURED 35 | SECTION("unstructured") 36 | { 37 | auto v = std::make_shared( 38 | vec3i(128), vec3f(0.f), vec3f(1.f)); 39 | test_stream_gradients(v); 40 | } 41 | #endif 42 | 43 | #if OPENVKL_DEVICE_CPU_VDB 44 | SECTION("vdb") 45 | { 46 | auto v1 = std::make_shared( 47 | getOpenVKLDevice(), vec3i(128), vec3f(0.f), vec3f(1.f), true); 48 | test_stream_gradients(v1); 49 | 50 | auto v2 = std::make_shared( 51 | getOpenVKLDevice(), vec3i(128), vec3f(0.f), vec3f(1.f), false); 52 | test_stream_gradients(v2); 53 | } 54 | #endif 55 | 56 | shutdownOpenVKL(); 57 | } 58 | -------------------------------------------------------------------------------- /testing/apps/vklTests.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #define CATCH_CONFIG_MAIN 5 | #include "../external/catch.hpp" 6 | -------------------------------------------------------------------------------- /testing/openvkl_testing.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | #pragma once 5 | 6 | #ifdef OPENVKL_TESTING_CPU 7 | #define HALF_FLOAT_SUPPORT 1 8 | #define DOUBLE_SUPPORT 1 9 | #endif 10 | 11 | #ifdef OPENVKL_TESTING_GPU 12 | #define HALF_FLOAT_SUPPORT 0 13 | #define DOUBLE_SUPPORT 0 14 | #endif 15 | 16 | #include "apps/AppInit.h" 17 | #include "volume/OpenVdbVolume.h" 18 | #include "volume/ProceduralParticleVolume.h" 19 | #include "volume/ProceduralShellsAMRVolume.h" 20 | #include "volume/ProceduralStructuredRegularVolume.h" 21 | #include "volume/ProceduralStructuredSphericalVolume.h" 22 | #include "volume/ProceduralStructuredVolume.h" 23 | #include "volume/ProceduralUnstructuredVolume.h" 24 | #include "volume/ProceduralVdbVolume.h" 25 | #include "volume/ProceduralVdbVolumeMulti.h" 26 | #include "volume/RawFileStructuredVolume.h" 27 | #include "volume/RawHFileStructuredVolume.h" 28 | #include "volume/TestingStructuredVolumeMulti.h" 29 | #include "volume/TestingUnstructuredMixedSimple.h" 30 | #include "volume/TestingVdbTorusVolume.h" 31 | -------------------------------------------------------------------------------- /third-party-programs-OSPRay.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/third-party-programs-OSPRay.txt -------------------------------------------------------------------------------- /third-party-programs-TBB.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RenderKit/openvkl/05f2016c8a53bce60f56fe4a41f8507cdaff0394/third-party-programs-TBB.txt -------------------------------------------------------------------------------- /utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2021 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | cmake_minimum_required(VERSION 3.1) 5 | 6 | add_library(openvkl_utility INTERFACE) 7 | 8 | add_subdirectory(temporal_compression) 9 | target_link_libraries(openvkl_utility INTERFACE openvkl_utility_temporal_compression) 10 | 11 | add_subdirectory(usda) 12 | target_link_libraries(openvkl_utility INTERFACE openvkl_utility_usda) 13 | 14 | add_subdirectory(vdb) 15 | target_link_libraries(openvkl_utility INTERFACE openvkl_utility_vdb) 16 | 17 | -------------------------------------------------------------------------------- /utility/temporal_compression/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2021 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | cmake_minimum_required(VERSION 3.1) 5 | 6 | add_library(openvkl_utility_temporal_compression INTERFACE) 7 | 8 | target_include_directories(openvkl_utility_temporal_compression 9 | INTERFACE 10 | $ 11 | $ 12 | ) 13 | 14 | install(DIRECTORY 15 | ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/utility/temporal_compression 16 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/utility 17 | FILES_MATCHING 18 | PATTERN "*.h" 19 | ) 20 | -------------------------------------------------------------------------------- /utility/usda/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## Copyright 2021 Intel Corporation 2 | ## SPDX-License-Identifier: Apache-2.0 3 | 4 | cmake_minimum_required(VERSION 3.1) 5 | 6 | add_library(openvkl_utility_usda INTERFACE) 7 | 8 | target_include_directories(openvkl_utility_usda 9 | INTERFACE 10 | $ 11 | $ 12 | ) 13 | 14 | install(DIRECTORY 15 | ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}/utility/usda 16 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/utility 17 | FILES_MATCHING 18 | PATTERN "*.h" 19 | ) 20 | --------------------------------------------------------------------------------