├── alvr ├── xtask │ ├── build.rs │ ├── wix │ │ ├── bundle_logo.png │ │ ├── bundle_sidebar.png │ │ ├── installer_banner.bmp │ │ ├── installer_dialog.bmp │ │ └── bundle.wxs │ ├── README.md │ ├── firewall │ │ ├── ufw-alvr │ │ └── alvr-firewalld.xml │ ├── resources │ │ ├── driver.vrdrivermanifest │ │ └── alvr.desktop │ ├── deb │ │ └── cuda.pc │ ├── flatpak │ │ ├── modules │ │ │ ├── vulkan-headers │ │ │ │ └── vulkan-headers.json │ │ │ └── yasm │ │ │ │ └── yasm.json │ │ └── com.valvesoftware.Steam.Utility.alvr.desktop │ ├── Cargo.toml │ ├── patches │ │ ├── 0001-guid-conftest.patch │ │ ├── 0001-vaapi_encode-Enable-global-header.patch │ │ ├── 0001-vaapi_encode_h265-Set-vui_parameters_present_flag.patch │ │ └── 0001-lavu-hwcontext_vulkan-Fix-importing-RGBx-frames-to-C.patch │ └── LICENSE ├── server_openvr │ ├── cpp │ │ ├── bin │ │ │ ├── .gitignore │ │ │ └── windows │ │ │ │ └── vcruntime140_1.dll │ │ ├── platform │ │ │ ├── win32 │ │ │ │ ├── VideoEncoder.cpp │ │ │ │ ├── rgbtoyuv420.cso │ │ │ │ ├── FrameRenderPS.cso │ │ │ │ ├── FrameRenderVS.cso │ │ │ │ ├── QuadVertexShader.cso │ │ │ │ ├── ColorCorrectionPixelShader.cso │ │ │ │ ├── CompressAxisAlignedPixelShader.cso │ │ │ │ ├── VideoEncoder.h │ │ │ │ ├── d3d-render-utils │ │ │ │ │ └── QuadVertexShader.hlsl │ │ │ │ ├── FFR.h │ │ │ │ ├── CrashHandler.cpp │ │ │ │ └── VideoEncoderNVENC.h │ │ │ ├── linux │ │ │ │ ├── CrashHandler.cpp │ │ │ │ ├── shader │ │ │ │ │ ├── ffr.comp.spv │ │ │ │ │ ├── quad.comp.spv │ │ │ │ │ ├── color.comp.spv │ │ │ │ │ ├── rgbtoyuv420.comp.spv │ │ │ │ │ ├── quad.comp │ │ │ │ │ └── rgbtoyuv420.comp │ │ │ │ ├── protocol.h │ │ │ │ ├── EncodePipelineSW.h │ │ │ │ ├── EncodePipelineNvEnc.h │ │ │ │ ├── CEncoder.h │ │ │ │ ├── EncodePipeline.h │ │ │ │ └── FrameRender.h │ │ │ └── macos │ │ │ │ ├── CrashHandler.cpp │ │ │ │ └── CEncoder.h │ │ ├── alvr_server │ │ │ ├── shader │ │ │ │ ├── FrameRenderPS.hlsl │ │ │ │ ├── FrameRenderVS.hlsl │ │ │ │ ├── FoveatedRendering.hlsli │ │ │ │ └── rgbtoyuv420.hlsl │ │ │ ├── Logger.h │ │ │ ├── TrackedDevice.h │ │ │ ├── IDRScheduler.h │ │ │ ├── driverlog.h │ │ │ ├── PoseHistory.h │ │ │ ├── driverlog.cpp │ │ │ └── ViveTrackerProxy.h │ │ ├── ALVR-common │ │ │ ├── common-utils.h │ │ │ ├── common-utils.cpp │ │ │ ├── exception.h │ │ │ ├── exception.cpp │ │ │ └── packet_types.h │ │ └── shared │ │ │ ├── threadtools.h │ │ │ └── backward.cpp │ ├── Cargo.toml │ └── LICENSE ├── client_core │ ├── cpp │ │ ├── glm │ │ │ ├── gtc │ │ │ │ ├── quaternion_simd.inl │ │ │ │ ├── type_precision.inl │ │ │ │ ├── matrix_transform.inl │ │ │ │ ├── vec1.hpp │ │ │ │ ├── matrix_transform.hpp │ │ │ │ └── matrix_access.inl │ │ │ ├── detail │ │ │ │ ├── func_trigonometric_simd.inl │ │ │ │ ├── type_mat4x4_simd.inl │ │ │ │ ├── func_packing_simd.inl │ │ │ │ ├── func_vector_relational_simd.inl │ │ │ │ ├── type_half.hpp │ │ │ │ ├── _fixes.hpp │ │ │ │ ├── compute_vector_relational.hpp │ │ │ │ ├── func_exponential_simd.inl │ │ │ │ └── compute_common.hpp │ │ │ ├── gtx │ │ │ │ ├── raw_data.inl │ │ │ │ ├── type_aligned.inl │ │ │ │ ├── number_precision.inl │ │ │ │ ├── std_based_type.inl │ │ │ │ ├── matrix_factorisation.inl │ │ │ │ ├── perpendicular.inl │ │ │ │ ├── projection.inl │ │ │ │ ├── mixed_product.inl │ │ │ │ ├── normal.inl │ │ │ │ ├── float_notmalize.inl │ │ │ │ ├── texture.inl │ │ │ │ ├── log_base.inl │ │ │ │ ├── optimum_pow.inl │ │ │ │ ├── normalize_dot.inl │ │ │ │ ├── handed_coordinate_space.inl │ │ │ │ ├── transform.inl │ │ │ │ ├── orthonormalize.inl │ │ │ │ ├── exterior_product.inl │ │ │ │ ├── matrix_cross_product.inl │ │ │ │ ├── functions.inl │ │ │ │ ├── polar_coordinates.inl │ │ │ │ ├── scalar_relational.hpp │ │ │ │ ├── gradient_paint.inl │ │ │ │ ├── extend.inl │ │ │ │ ├── normal.hpp │ │ │ │ ├── mixed_product.hpp │ │ │ │ ├── extend.hpp │ │ │ │ ├── projection.hpp │ │ │ │ ├── perpendicular.hpp │ │ │ │ ├── closest_point.inl │ │ │ │ ├── log_base.hpp │ │ │ │ ├── raw_data.hpp │ │ │ │ └── texture.hpp │ │ │ ├── simd │ │ │ │ ├── packing.h │ │ │ │ ├── vector_relational.h │ │ │ │ ├── trigonometric.h │ │ │ │ └── exponential.h │ │ │ ├── mat3x3.hpp │ │ │ ├── mat3x4.hpp │ │ │ ├── mat4x3.hpp │ │ │ ├── mat2x2.hpp │ │ │ ├── mat2x3.hpp │ │ │ ├── mat2x4.hpp │ │ │ ├── mat3x2.hpp │ │ │ ├── mat4x2.hpp │ │ │ ├── mat4x4.hpp │ │ │ ├── ext │ │ │ │ ├── quaternion_common_simd.inl │ │ │ │ ├── vector_bool2.hpp │ │ │ │ ├── vector_bool3.hpp │ │ │ │ ├── vector_bool4.hpp │ │ │ │ ├── vector_int2.hpp │ │ │ │ ├── vector_int3.hpp │ │ │ │ ├── vector_int4.hpp │ │ │ │ ├── vector_uint2.hpp │ │ │ │ ├── vector_uint3.hpp │ │ │ │ ├── vector_uint4.hpp │ │ │ │ ├── vector_float2.hpp │ │ │ │ ├── vector_float3.hpp │ │ │ │ ├── vector_float4.hpp │ │ │ │ ├── vector_double2.hpp │ │ │ │ ├── vector_double3.hpp │ │ │ │ ├── vector_double4.hpp │ │ │ │ ├── matrix_float3x2.hpp │ │ │ │ ├── matrix_float2x3.hpp │ │ │ │ ├── matrix_float2x4.hpp │ │ │ │ ├── matrix_float3x4.hpp │ │ │ │ ├── matrix_float4x2.hpp │ │ │ │ ├── matrix_float4x3.hpp │ │ │ │ ├── matrix_double2x3.hpp │ │ │ │ ├── matrix_double2x4.hpp │ │ │ │ ├── matrix_double3x2.hpp │ │ │ │ ├── matrix_double3x4.hpp │ │ │ │ ├── matrix_double4x2.hpp │ │ │ │ ├── matrix_double4x3.hpp │ │ │ │ ├── matrix_common.inl │ │ │ │ ├── quaternion_transform.inl │ │ │ │ ├── vector_bool1.hpp │ │ │ │ ├── matrix_float2x2.hpp │ │ │ │ ├── matrix_float3x3.hpp │ │ │ │ ├── matrix_float4x4.hpp │ │ │ │ ├── matrix_double2x2.hpp │ │ │ │ ├── matrix_double3x3.hpp │ │ │ │ ├── matrix_double4x4.hpp │ │ │ │ ├── scalar_constants.inl │ │ │ │ ├── vector_int1.hpp │ │ │ │ ├── vector_uint1.hpp │ │ │ │ ├── vector_float1.hpp │ │ │ │ ├── vector_double1.hpp │ │ │ │ ├── vector_bool1_precision.hpp │ │ │ │ ├── quaternion_trigonometric.inl │ │ │ │ ├── vector_int1_precision.hpp │ │ │ │ ├── matrix_common.hpp │ │ │ │ ├── quaternion_float.hpp │ │ │ │ ├── quaternion_double.hpp │ │ │ │ ├── quaternion_relational.inl │ │ │ │ ├── scalar_constants.hpp │ │ │ │ ├── vector_uint1_precision.hpp │ │ │ │ ├── scalar_relational.inl │ │ │ │ ├── vector_float1_precision.hpp │ │ │ │ ├── quaternion_float_precision.hpp │ │ │ │ ├── vector_double1_precision.hpp │ │ │ │ ├── quaternion_geometric.inl │ │ │ │ ├── vector_bool2_precision.hpp │ │ │ │ ├── vector_bool3_precision.hpp │ │ │ │ └── vector_bool4_precision.hpp │ │ │ ├── vec2.hpp │ │ │ ├── vec3.hpp │ │ │ └── vec4.hpp │ │ ├── srgb_correction_pass.h │ │ ├── VrApi_Version.h │ │ ├── gl_render_utils │ │ │ └── texture.h │ │ ├── bindings.h │ │ └── ffr.h │ ├── resources │ │ ├── Ubuntu-Medium.ttf │ │ ├── staging_vertex.glsl │ │ ├── staging_fragment.glsl │ │ ├── stream_vertex.glsl │ │ └── lobby_line.wgsl │ ├── README.md │ ├── src │ │ ├── graphics │ │ │ └── opengl.rs │ │ └── sockets.rs │ ├── cbindgen.toml │ └── LICENSE ├── gui_common │ ├── src │ │ └── lib.rs │ └── Cargo.toml ├── dashboard │ ├── src │ │ ├── dashboard │ │ │ ├── components │ │ │ │ ├── settings_controls │ │ │ │ │ ├── presets │ │ │ │ │ │ ├── mirror.rs │ │ │ │ │ │ ├── mod.rs │ │ │ │ │ │ └── schema.rs │ │ │ │ │ ├── reset.rs │ │ │ │ │ ├── notice.rs │ │ │ │ │ ├── collapsible.rs │ │ │ │ │ └── up_down.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── debug.rs │ │ │ │ └── about.rs │ │ │ └── basic_components │ │ │ │ ├── mod.rs │ │ │ │ ├── tooltip.rs │ │ │ │ ├── button_group.rs │ │ │ │ └── switch.rs │ │ └── steamvr_launcher │ │ │ └── windows_steamvr.rs │ ├── README.md │ ├── resources │ │ └── dashboard.ico │ ├── build.rs │ └── Cargo.toml ├── server_io │ ├── README.md │ └── Cargo.toml ├── vulkan_layer │ ├── util │ │ ├── logger.h │ │ ├── pose.hpp │ │ └── logger.cpp │ ├── layer │ │ ├── layer.h │ │ ├── settings.h │ │ └── alvr_x86_64.json │ ├── .gitignore │ ├── Cargo.toml │ ├── src │ │ └── lib.rs │ ├── wsi │ │ ├── display.hpp │ │ └── display.cpp │ ├── README.md │ └── LICENSE ├── common │ ├── README.md │ ├── Cargo.toml │ ├── LICENSE │ └── src │ │ ├── average.rs │ │ └── primitives.rs ├── launcher │ ├── build.rs │ └── Cargo.toml ├── filesystem │ └── Cargo.toml ├── client_openxr │ ├── src │ │ └── c_api.rs │ └── cbindgen.toml ├── packets │ └── Cargo.toml ├── events │ └── Cargo.toml ├── server_core │ ├── cbindgen.toml │ ├── src │ │ └── haptics.rs │ └── Cargo.toml ├── client_mock │ └── Cargo.toml ├── vrcompositor_wrapper │ ├── Cargo.toml │ └── build.rs ├── sockets │ ├── Cargo.toml │ └── src │ │ └── backend │ │ └── mod.rs ├── session │ └── Cargo.toml └── audio │ └── Cargo.toml ├── .cargo └── config.toml ├── resources ├── alvr.png └── alvr_combined_logo_hq.png ├── wiki ├── images │ ├── ALVRexe-404.png │ ├── SteamVR-add-ons.png │ ├── SteamVR-waiting.png │ ├── ALVR-audio-crash.png │ ├── ALVRexe-no-devices.png │ ├── latency-graphs │ │ ├── optimal.png │ │ ├── not-enough-buffering.png │ │ ├── overloaded-decoder.png │ │ ├── overloaded-encoder.png │ │ ├── overloaded-network.png │ │ └── overloaded-streamer.png │ └── SteamVR-headset-not-detected.png ├── Home.md ├── Other-resources.md ├── Hand-tracking-controller-bindings.md ├── Roadmap.md ├── My-game-is-not-working-properly!-Help!.md └── ALVR-Checklist.md ├── .gitmodules ├── .clang-format ├── .editorconfig ├── .github ├── workflows │ ├── wiki.yml │ └── stale.yml ├── dependabot.yml └── FUNDING.yml ├── about.toml ├── .gitattributes ├── Cargo.toml └── LICENSE /alvr/xtask/build.rs: -------------------------------------------------------------------------------- 1 | fn main() {} 2 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/bin/.gitignore: -------------------------------------------------------------------------------- 1 | !*.dll -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/quaternion_simd.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /alvr/gui_common/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod theme; 2 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | xtask = "run -p alvr_xtask --" 3 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | 3 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/presets/mirror.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/VideoEncoder.cpp: -------------------------------------------------------------------------------- 1 | #include "VideoEncoder.h" 2 | -------------------------------------------------------------------------------- /resources/alvr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/resources/alvr.png -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/shader/FrameRenderPS.hlsl: -------------------------------------------------------------------------------- 1 | #include "FrameRender.fx" 2 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/shader/FrameRenderVS.hlsl: -------------------------------------------------------------------------------- 1 | #include "FrameRender.fx" 2 | -------------------------------------------------------------------------------- /wiki/images/ALVRexe-404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/ALVRexe-404.png -------------------------------------------------------------------------------- /alvr/xtask/wix/bundle_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/xtask/wix/bundle_logo.png -------------------------------------------------------------------------------- /wiki/images/SteamVR-add-ons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/SteamVR-add-ons.png -------------------------------------------------------------------------------- /wiki/images/SteamVR-waiting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/SteamVR-waiting.png -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /alvr/dashboard/README.md: -------------------------------------------------------------------------------- 1 | # alvr_gui 2 | 3 | Crate for GUI-related code. It needs a backend to display the UI. 4 | -------------------------------------------------------------------------------- /alvr/xtask/wix/bundle_sidebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/xtask/wix/bundle_sidebar.png -------------------------------------------------------------------------------- /wiki/images/ALVR-audio-crash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/ALVR-audio-crash.png -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /alvr/xtask/wix/installer_banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/xtask/wix/installer_banner.bmp -------------------------------------------------------------------------------- /alvr/xtask/wix/installer_dialog.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/xtask/wix/installer_dialog.bmp -------------------------------------------------------------------------------- /resources/alvr_combined_logo_hq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/resources/alvr_combined_logo_hq.png -------------------------------------------------------------------------------- /wiki/images/ALVRexe-no-devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/ALVRexe-no-devices.png -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | 3 | namespace glm 4 | { 5 | 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /alvr/dashboard/resources/dashboard.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/dashboard/resources/dashboard.ico -------------------------------------------------------------------------------- /wiki/images/latency-graphs/optimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/optimal.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "openvr"] 2 | path = openvr 3 | url = https://github.com/ValveSoftware/openvr.git 4 | shallow = true 5 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/CrashHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "../../alvr_server/bindings.h" 2 | 3 | void HookCrashHandler() { } 4 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/macos/CrashHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "../../alvr_server/bindings.h" 2 | 3 | void HookCrashHandler() { } 4 | -------------------------------------------------------------------------------- /alvr/client_core/resources/Ubuntu-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/client_core/resources/Ubuntu-Medium.ttf -------------------------------------------------------------------------------- /wiki/images/SteamVR-headset-not-detected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/SteamVR-headset-not-detected.png -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/matrix_transform.inl: -------------------------------------------------------------------------------- 1 | #include "../geometric.hpp" 2 | #include "../trigonometric.hpp" 3 | #include "../matrix.hpp" 4 | -------------------------------------------------------------------------------- /alvr/xtask/README.md: -------------------------------------------------------------------------------- 1 | # alvr_xtask 2 | 3 | Custom tailored build utilities. Inspired by [cargo-xtask](https://github.com/matklad/cargo-xtask). 4 | -------------------------------------------------------------------------------- /alvr/client_core/README.md: -------------------------------------------------------------------------------- 1 | # alvr_client_core 2 | 3 | Rust crate containing all major components for an ALVR client except the XR-API-related code. 4 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /wiki/images/latency-graphs/not-enough-buffering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/not-enough-buffering.png -------------------------------------------------------------------------------- /wiki/images/latency-graphs/overloaded-decoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/overloaded-decoder.png -------------------------------------------------------------------------------- /wiki/images/latency-graphs/overloaded-encoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/overloaded-encoder.png -------------------------------------------------------------------------------- /wiki/images/latency-graphs/overloaded-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/overloaded-network.png -------------------------------------------------------------------------------- /wiki/images/latency-graphs/overloaded-streamer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/wiki/images/latency-graphs/overloaded-streamer.png -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/client_core/cpp/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/bin/windows/vcruntime140_1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/bin/windows/vcruntime140_1.dll -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/rgbtoyuv420.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/rgbtoyuv420.cso -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/FrameRenderPS.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/FrameRenderPS.cso -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/FrameRenderVS.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/FrameRenderVS.cso -------------------------------------------------------------------------------- /alvr/xtask/firewall/ufw-alvr: -------------------------------------------------------------------------------- 1 | [alvr] 2 | title=ALVR 3 | description=Stream VR games from your PC to your headset via Wi-Fi 4 | ports=9943:9944/tcp|9943:9944/udp 5 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/ffr.comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/linux/shader/ffr.comp.spv -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/quad.comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/linux/shader/quad.comp.spv -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/QuadVertexShader.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/QuadVertexShader.cso -------------------------------------------------------------------------------- /wiki/Home.md: -------------------------------------------------------------------------------- 1 | ALVR is a vr streaming software that allows you to stream SteamVR games to your standalone VR headset. 2 | 3 | Use the sidebar to navigate the wiki. 4 | -------------------------------------------------------------------------------- /alvr/server_io/README.md: -------------------------------------------------------------------------------- 1 | # alvr_server_io 2 | 3 | Contains functionality for data storage and system info retrieval. Shared between server and dashboard executable. 4 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/color.comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/linux/shader/color.comp.spv -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/rgbtoyuv420.comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/linux/shader/rgbtoyuv420.comp.spv -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/basic_components/mod.rs: -------------------------------------------------------------------------------- 1 | mod button_group; 2 | mod switch; 3 | mod tooltip; 4 | 5 | pub use button_group::*; 6 | pub use switch::*; 7 | pub use tooltip::*; 8 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/ColorCorrectionPixelShader.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/ColorCorrectionPixelShader.cso -------------------------------------------------------------------------------- /alvr/client_core/src/graphics/opengl.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | #[cfg(all(target_os = "android", feature = "use-cpp"))] 4 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); 5 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/CompressAxisAlignedPixelShader.cso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LLukas22/ALVR/master/alvr/server_openvr/cpp/platform/win32/CompressAxisAlignedPixelShader.cso -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/ALVR-common/common-utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | std::wstring ToWstring(const std::string& src); 6 | std::string ToUTF8(const std::wstring& src); 7 | -------------------------------------------------------------------------------- /alvr/xtask/resources/driver.vrdrivermanifest: -------------------------------------------------------------------------------- 1 | { 2 | "alwaysActivate": true, 3 | "name" : "alvr_server", 4 | "redirectsDisplay": true, 5 | 6 | "hmd_presence" : 7 | [ 8 | "*.*" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/util/logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void Error(const char *format, ...); 4 | void Warn(const char *format, ...); 5 | void Info(const char *format, ...); 6 | void Debug(const char *format, ...); 7 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/resources/staging_vertex.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | out vec2 uv; 4 | 5 | void main() { 6 | uv = vec2(gl_VertexID & 1, gl_VertexID >> 1); 7 | gl_Position = vec4((uv - 0.5f) * 2.f, 0, 1); 8 | } 9 | -------------------------------------------------------------------------------- /wiki/Other-resources.md: -------------------------------------------------------------------------------- 1 | * Hand tracking OSC for VRChat with ALVR support: https://github.com/A3yuu/FingerTruckerOSC 2 | * ALVR in the browser using WebXR and WebCodecs: https://github.com/rinsuki-lab/ALVR/tree/research/alvr-web -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: WebKit 2 | IndentWidth: 4 3 | ColumnLimit: 100 4 | BinPackArguments: false 5 | BinPackParameters: false 6 | AlignAfterOpenBracket: BlockIndent 7 | BreakBeforeBraces: Attach 8 | InsertNewlineAtEOF: true 9 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/layer/layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | extern "C" const char *g_sessionPath; 6 | 7 | extern "C" VKAPI_ATTR VkResult VKAPI_CALL wsi_layer_Negotiate(VkNegotiateLayerInterface *nli); 8 | -------------------------------------------------------------------------------- /alvr/common/README.md: -------------------------------------------------------------------------------- 1 | # alvr_common 2 | 3 | This crate contains some basic functionality shared across all crates in the workspace. In particular it contains constants, logging front-end, and re-exports frequently-used external dependencies. 4 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/basic_components/tooltip.rs: -------------------------------------------------------------------------------- 1 | use eframe::egui::{self, popup, Ui}; 2 | 3 | pub fn tooltip(ui: &mut Ui, id: &str, text: &str) { 4 | popup::show_tooltip_text(ui.ctx(), ui.layer_id(), egui::Id::new(id), text); 5 | } 6 | -------------------------------------------------------------------------------- /alvr/xtask/deb/cuda.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/lib/cuda 2 | includedir=${prefix}/include 3 | libdir=${prefix}/lib64 4 | 5 | Name: cuda 6 | Description: CUDA Driver Library 7 | Version: 0.0.0 8 | Libs: -L${libdir}/stubs -lcuda 9 | Cflags: -I${includedir} 10 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | CMakeCache.txt 3 | CMakeFiles 4 | CMakeScripts 5 | Testing 6 | Makefile 7 | cmake_install.cmake 8 | install_manifest.txt 9 | compile_commands.json 10 | CTestTestfile.cmake 11 | _deps 12 | build 13 | -------------------------------------------------------------------------------- /alvr/dashboard/build.rs: -------------------------------------------------------------------------------- 1 | #[cfg(windows)] 2 | fn main() { 3 | let mut resource = winres::WindowsResource::new(); 4 | resource.set_icon("resources/dashboard.ico"); 5 | resource.compile().unwrap(); 6 | } 7 | 8 | #[cfg(not(windows))] 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /alvr/launcher/build.rs: -------------------------------------------------------------------------------- 1 | #[cfg(windows)] 2 | fn main() { 3 | let mut resource = winres::WindowsResource::new(); 4 | resource.set_icon("../dashboard/resources/dashboard.ico"); 5 | resource.compile().unwrap(); 6 | } 7 | 8 | #[cfg(not(windows))] 9 | fn main() {} 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x3.hpp" 6 | #include "./ext/matrix_double3x3_precision.hpp" 7 | #include "./ext/matrix_float3x3.hpp" 8 | #include "./ext/matrix_float3x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x4.hpp" 6 | #include "./ext/matrix_double3x4_precision.hpp" 7 | #include "./ext/matrix_float3x4.hpp" 8 | #include "./ext/matrix_float3x4_precision.hpp" 9 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x3.hpp" 6 | #include "./ext/matrix_double4x3_precision.hpp" 7 | #include "./ext/matrix_float4x3.hpp" 8 | #include "./ext/matrix_float4x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /alvr/client_core/resources/staging_fragment.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | #extension GL_OES_EGL_image_external_essl3 : enable 3 | 4 | uniform samplerExternalOES tex; 5 | 6 | in vec2 uv; 7 | out vec4 out_color; 8 | 9 | void main() { 10 | out_color = texture(tex, uv); 11 | } 12 | -------------------------------------------------------------------------------- /alvr/filesystem/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_filesystem" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | dirs = "5" 11 | once_cell = "1" 12 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal) 7 | { 8 | return x - proj(x, Normal); 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x2.hpp" 6 | #include "./ext/matrix_double2x2_precision.hpp" 7 | #include "./ext/matrix_float2x2.hpp" 8 | #include "./ext/matrix_float2x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x3.hpp" 6 | #include "./ext/matrix_double2x3_precision.hpp" 7 | #include "./ext/matrix_float2x3.hpp" 8 | #include "./ext/matrix_float2x3_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x4.hpp" 6 | #include "./ext/matrix_double2x4_precision.hpp" 7 | #include "./ext/matrix_float2x4.hpp" 8 | #include "./ext/matrix_float2x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x2.hpp" 6 | #include "./ext/matrix_double3x2_precision.hpp" 7 | #include "./ext/matrix_float3x2.hpp" 8 | #include "./ext/matrix_float3x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x2.hpp" 6 | #include "./ext/matrix_double4x2_precision.hpp" 7 | #include "./ext/matrix_float4x2.hpp" 8 | #include "./ext/matrix_float4x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/mat4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x4.hpp" 6 | #include "./ext/matrix_double4x4_precision.hpp" 7 | #include "./ext/matrix_float4x4.hpp" 8 | #include "./ext/matrix_float4x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /alvr/client_openxr/src/c_api.rs: -------------------------------------------------------------------------------- 1 | #[cfg(target_os = "android")] 2 | #[no_mangle] 3 | pub extern "C" fn alvr_entry_point(java_vm: *mut std::ffi::c_void, context: *mut std::ffi::c_void) { 4 | unsafe { ndk_context::initialize_android_context(java_vm, context) }; 5 | 6 | crate::entry_point(); 7 | } 8 | -------------------------------------------------------------------------------- /alvr/gui_common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_gui_common" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | 12 | egui = "0.28" 13 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal) 7 | { 8 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /alvr/xtask/flatpak/modules/vulkan-headers/vulkan-headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vulkan-headers", 3 | "buildsystem": "cmake", 4 | "sources": [ 5 | { 6 | "type": "git", 7 | "url": "https://github.com/KhronosGroup/Vulkan-Headers.git", 8 | "tag": "v1.3.249" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /alvr/client_core/resources/stream_vertex.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | uniform lowp int view_idx; 4 | 5 | out vec2 uv; 6 | 7 | void main() { 8 | vec2 screen_uv = vec2(gl_VertexID & 1, gl_VertexID >> 1); 9 | gl_Position = vec4((screen_uv - 0.5f) * 2.f, 0, 1); 10 | uv = vec2((screen_uv.x + float(view_idx)) / 2.0f, 1.0 - screen_uv.y); 11 | } 12 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T mixedProduct 7 | ( 8 | vec<3, T, Q> const& v1, 9 | vec<3, T, Q> const& v2, 10 | vec<3, T, Q> const& v3 11 | ) 12 | { 13 | return dot(cross(v1, v2), v3); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | 5 | namespace glm{ 6 | namespace detail 7 | { 8 | typedef short hdata; 9 | 10 | GLM_FUNC_DECL float toFloat32(hdata value); 11 | GLM_FUNC_DECL hdata toFloat16(float const& value); 12 | 13 | }//namespace detail 14 | }//namespace glm 15 | 16 | #include "type_half.inl" 17 | -------------------------------------------------------------------------------- /alvr/client_core/resources/lobby_line.wgsl: -------------------------------------------------------------------------------- 1 | 2 | var transform: mat4x4f; 3 | 4 | @vertex 5 | fn vertex_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4f { 6 | return transform * vec4f(0.0, 0.0, -f32(vertex_index), 1.0); 7 | } 8 | 9 | @fragment 10 | fn fragment_main() -> @location(0) vec4f { 11 | return vec4f(1.0); 12 | } -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal 7 | ( 8 | vec<3, T, Q> const& p1, 9 | vec<3, T, Q> const& p2, 10 | vec<3, T, Q> const& p3 11 | ) 12 | { 13 | return normalize(cross(p1 - p2, p1 - p3)); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | 3 | [*.{c,cpp,h,hpp}] 4 | indent_style = space 5 | indent_size = 4 6 | tab_width = 4 7 | max_line_length = 100 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | [.editorconfig] 12 | indent_style = space 13 | indent_size = 4 14 | tab_width = 4 15 | end_of_line = lf 16 | insert_final_newline = true 17 | -------------------------------------------------------------------------------- /alvr/packets/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_packets" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_session.workspace = true 12 | 13 | serde = { version = "1", features = ["derive"] } 14 | serde_json = "1" 15 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | 3 | #include 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) 9 | { 10 | return vec(v) / static_cast(std::numeric_limits::max()); 11 | } 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/Logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ALVR-common/exception.h" 4 | 5 | Exception MakeException(const char* format, ...); 6 | 7 | void Error(const char* format, ...); 8 | void Warn(const char* format, ...); 9 | void Info(const char* format, ...); 10 | void Debug(const char* format, ...); 11 | void LogPeriod(const char* tag, const char* format, ...); 12 | -------------------------------------------------------------------------------- /alvr/xtask/flatpak/modules/yasm/yasm.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yasm", 3 | "sources": [ 4 | { 5 | "type": "archive", 6 | "url": "https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz", 7 | "sha256": "3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f" 8 | } 9 | ], 10 | "cleanup": [ 11 | "*" 12 | ] 13 | } -------------------------------------------------------------------------------- /alvr/events/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_events" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_packets.workspace = true 12 | alvr_session.workspace = true 13 | 14 | serde = { version = "1", features = ["derive"] } 15 | serde_json = "1" 16 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/macos/CEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "shared/threadtools.h" 4 | 5 | class CEncoder : public CThread { 6 | public: 7 | CEncoder() { } 8 | ~CEncoder() { } 9 | bool Init() override { return true; } 10 | void Run() override { } 11 | 12 | void Stop() { } 13 | void OnStreamStart() { } 14 | void OnPacketLoss() { } 15 | void InsertIDR() { } 16 | }; 17 | -------------------------------------------------------------------------------- /alvr/xtask/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_xtask" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_filesystem.workspace = true 11 | 12 | pico-args = "0.5" 13 | xshell = "0.2" 14 | walkdir = "2" 15 | 16 | [target.'cfg(target_os = "linux")'.dependencies] 17 | pkg-config = "0.3" 18 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/texture.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | 3 | namespace glm 4 | { 5 | template 6 | inline T levels(vec const& Extent) 7 | { 8 | return glm::log2(compMax(Extent)) + static_cast(1); 9 | } 10 | 11 | template 12 | inline T levels(T Extent) 13 | { 14 | return vec<1, T, defaultp>(Extent).x; 15 | } 16 | }//namespace glm 17 | 18 | -------------------------------------------------------------------------------- /alvr/client_core/cbindgen.toml: -------------------------------------------------------------------------------- 1 | language = "C" 2 | header = "/* ALVR is licensed under the MIT license. https://github.com/alvr-org/ALVR/blob/master/LICENSE */" 3 | pragma_once = true 4 | autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" 5 | cpp_compat = true 6 | tab_width = 4 7 | documentation_style = "c99" 8 | 9 | [enum] 10 | rename_variants = "QualifiedScreamingSnakeCase" 11 | -------------------------------------------------------------------------------- /alvr/client_openxr/cbindgen.toml: -------------------------------------------------------------------------------- 1 | language = "C" 2 | header = "/* ALVR is licensed under the MIT license. https://github.com/alvr-org/ALVR/blob/master/LICENSE */" 3 | pragma_once = true 4 | autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" 5 | cpp_compat = true 6 | tab_width = 4 7 | documentation_style = "c99" 8 | 9 | [enum] 10 | rename_variants = "QualifiedScreamingSnakeCase" 11 | -------------------------------------------------------------------------------- /alvr/server_core/cbindgen.toml: -------------------------------------------------------------------------------- 1 | language = "C" 2 | header = "/* ALVR is licensed under the MIT license. https://github.com/alvr-org/ALVR/blob/master/LICENSE */" 3 | pragma_once = true 4 | autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" 5 | cpp_compat = true 6 | tab_width = 4 7 | documentation_style = "c99" 8 | 9 | [enum] 10 | rename_variants = "QualifiedScreamingSnakeCase" 11 | -------------------------------------------------------------------------------- /alvr/xtask/firewall/alvr-firewalld.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Stream VR games from your PC to your headset via Wi-Fi 4 | ALVR is an open source remote VR display which allows playing SteamVR games on a standalone headset such as Gear VR or Oculus Go/Quest. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.github/workflows/wiki.yml: -------------------------------------------------------------------------------- 1 | name: Publish to GitHub Wiki 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | wiki: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Publish to wiki 14 | uses: cmbrose/github-docs-to-wiki@v0.24 15 | with: 16 | githubToken: ${{ secrets.GH_PAT }} 17 | rootDocsFolder: "wiki" 18 | -------------------------------------------------------------------------------- /alvr/xtask/resources/alvr.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=ALVR 5 | GenericName=Game 6 | Comment=ALVR is an open source remote VR display which allows playing SteamVR games on a standalone headset such as Gear VR or Oculus Go/Quest. 7 | Exec=alvr_dashboard 8 | Icon=alvr 9 | Categories=Game; 10 | StartupNotify=true 11 | PrefersNonDefaultGPU=true 12 | X-KDE-RunOnDiscreteGpu=true 13 | StartupWMClass=ALVR 14 | -------------------------------------------------------------------------------- /alvr/client_mock/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_client_mock" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_client_core.workspace = true 12 | alvr_packets.workspace = true 13 | alvr_session.workspace = true 14 | 15 | eframe = "0.28" 16 | env_logger = "0.11" 17 | rand = "0.8" 18 | -------------------------------------------------------------------------------- /alvr/vrcompositor_wrapper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_vrcompositor_wrapper" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_filesystem.workspace = true 12 | 13 | [build-dependencies] 14 | xshell = "0.2" 15 | 16 | [target.'cfg(target_os = "linux")'.dependencies] 17 | exec = "0.3.1" 18 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) 7 | { 8 | return glm::log(x) / glm::log(base); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) 13 | { 14 | return glm::log(x) / glm::log(base); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/quad.comp: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; 4 | layout (binding = 0) uniform sampler2D in_img; 5 | layout (binding = 1, rgba8) uniform writeonly image2D out_img; 6 | 7 | void main() 8 | { 9 | ivec2 pos = ivec2(gl_GlobalInvocationID.xy); 10 | vec2 npos = (vec2(pos) + 0.5f) / imageSize(out_img); 11 | vec4 res = texture(in_img, npos); 12 | imageStore(out_img, pos, res); 13 | } 14 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_common_simd.inl: -------------------------------------------------------------------------------- 1 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 2 | 3 | namespace glm{ 4 | namespace detail 5 | { 6 | template 7 | struct compute_dot, float, true> 8 | { 9 | static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y) 10 | { 11 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); 12 | } 13 | }; 14 | }//namespace detail 15 | }//namespace glm 16 | 17 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 18 | 19 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/layer/settings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Settings 7 | { 8 | static Settings m_Instance; 9 | bool m_loaded; 10 | 11 | Settings(); 12 | virtual ~Settings(); 13 | 14 | public: 15 | void Load(); 16 | static Settings &Instance() { 17 | return m_Instance; 18 | } 19 | 20 | bool IsLoaded() { 21 | return m_loaded; 22 | } 23 | 24 | int m_refreshRate; 25 | uint32_t m_renderWidth; 26 | uint32_t m_renderHeight; 27 | }; 28 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/reset.rs: -------------------------------------------------------------------------------- 1 | use eframe::{ 2 | egui::{Button, Layout, Response, Ui}, 3 | emath::Align, 4 | }; 5 | 6 | pub fn reset_button(ui: &mut Ui, enabled: bool, default_str: &str) -> Response { 7 | ui.with_layout(Layout::right_to_left(Align::Center), |ui| { 8 | ui.add_space(5.0); 9 | 10 | ui.add_enabled(enabled, Button::new("⟲")) 11 | .on_hover_text(format!("Reset to {}", default_str)) 12 | }) 13 | .inner 14 | } 15 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, bool, defaultp> bvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, bool, defaultp> bvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, bool, defaultp> bvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_vulkan_layer" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | 12 | [dependencies] 13 | alvr_common.workspace = true 14 | alvr_filesystem.workspace = true 15 | 16 | [build-dependencies] 17 | bindgen = "0.69" 18 | cc = { version = "1", features = ["parallel"] } 19 | pkg-config = "0.3" 20 | walkdir = "2" 21 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/VideoEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "NvEncoderD3D11.h" 4 | #include "shared/d3drender.h" 5 | #include 6 | #include 7 | 8 | class VideoEncoder { 9 | public: 10 | virtual void Initialize() = 0; 11 | virtual void Shutdown() = 0; 12 | 13 | virtual void Transmit( 14 | ID3D11Texture2D* pTexture, 15 | uint64_t presentationTime, 16 | uint64_t targetTimestampNs, 17 | bool insertIDR 18 | ) = 0; 19 | }; 20 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType pow2(genType const& x) 7 | { 8 | return x * x; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER genType pow3(genType const& x) 13 | { 14 | return x * x * x; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER genType pow4(genType const& x) 19 | { 20 | return (x * x) * (x * x); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_int2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, int, defaultp> ivec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_int3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, int, defaultp> ivec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_int4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, int, defaultp> ivec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/ALVR-common/common-utils.cpp: -------------------------------------------------------------------------------- 1 | #include "common-utils.h" 2 | 3 | #include 4 | #include 5 | 6 | std::wstring ToWstring(const std::string& src) { 7 | // TODO: src is really UTF-8? 8 | std::wstring_convert> converter; 9 | return converter.from_bytes(src); 10 | } 11 | 12 | std::string ToUTF8(const std::wstring& src) { 13 | std::wstring_convert> converter; 14 | return converter.to_bytes(src); 15 | } 16 | -------------------------------------------------------------------------------- /alvr/sockets/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_sockets" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [features] 10 | trace-performance = ["profiling/profile-with-tracy"] 11 | 12 | [dependencies] 13 | alvr_common.workspace = true 14 | alvr_session.workspace = true 15 | 16 | bincode = "1" 17 | profiling = { version = "1", optional = true } 18 | serde = "1" 19 | serde_json = "1" 20 | socket2 = "0.5" 21 | 22 | -------------------------------------------------------------------------------- /alvr/xtask/flatpak/com.valvesoftware.Steam.Utility.alvr.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=ALVR 5 | GenericName=Game 6 | Comment=ALVR is an open source remote VR display which allows playing SteamVR games on a standalone headset such as Gear VR or Oculus Go/Quest. 7 | Exec=/usr/bin/flatpak run --command=alvr_dashboard com.valvesoftware.Steam 8 | Icon=alvr 9 | Categories=Game; 10 | StartupNotify=true 11 | PrefersNonDefaultGPU=true 12 | X-KDE-RunOnDiscreteGpu=true 13 | StartupWMClass=ALVR 14 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_uint2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, unsigned int, defaultp> uvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_uint3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, unsigned int, defaultp> uvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_uint4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, unsigned int, defaultp> uvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool2.hpp" 6 | #include "./ext/vector_bool2_precision.hpp" 7 | #include "./ext/vector_float2.hpp" 8 | #include "./ext/vector_float2_precision.hpp" 9 | #include "./ext/vector_double2.hpp" 10 | #include "./ext/vector_double2_precision.hpp" 11 | #include "./ext/vector_int2.hpp" 12 | #include "./ext/vector_int2_precision.hpp" 13 | #include "./ext/vector_uint2.hpp" 14 | #include "./ext/vector_uint2_precision.hpp" 15 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool3.hpp" 6 | #include "./ext/vector_bool3_precision.hpp" 7 | #include "./ext/vector_float3.hpp" 8 | #include "./ext/vector_float3_precision.hpp" 9 | #include "./ext/vector_double3.hpp" 10 | #include "./ext/vector_double3_precision.hpp" 11 | #include "./ext/vector_int3.hpp" 12 | #include "./ext/vector_int3_precision.hpp" 13 | #include "./ext/vector_uint3.hpp" 14 | #include "./ext/vector_uint3_precision.hpp" 15 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/ALVR-common/exception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Exception : public std::exception { 7 | public: 8 | Exception(std::string what) 9 | : m_what(what) { } 10 | Exception() { } 11 | 12 | const char* what() const noexcept override { return m_what.c_str(); } 13 | 14 | private: 15 | std::string m_what; 16 | }; 17 | 18 | Exception FormatExceptionV(const char* format, va_list args); 19 | Exception FormatException(const char* format, ...); 20 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //! Workaround for compatibility with other libraries 4 | #ifdef max 5 | #undef max 6 | #endif 7 | 8 | //! Workaround for compatibility with other libraries 9 | #ifdef min 10 | #undef min 11 | #endif 12 | 13 | //! Workaround for Android 14 | #ifdef isnan 15 | #undef isnan 16 | #endif 17 | 18 | //! Workaround for Android 19 | #ifdef isinf 20 | #undef isinf 21 | #endif 22 | 23 | //! Workaround for Chrone Native Client 24 | #ifdef log2 25 | #undef log2 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool4.hpp" 6 | #include "./ext/vector_bool4_precision.hpp" 7 | #include "./ext/vector_float4.hpp" 8 | #include "./ext/vector_float4_precision.hpp" 9 | #include "./ext/vector_double4.hpp" 10 | #include "./ext/vector_double4_precision.hpp" 11 | #include "./ext/vector_int4.hpp" 12 | #include "./ext/vector_int4_precision.hpp" 13 | #include "./ext/vector_uint4.hpp" 14 | #include "./ext/vector_uint4_precision.hpp" 15 | 16 | -------------------------------------------------------------------------------- /alvr/server_core/src/haptics.rs: -------------------------------------------------------------------------------- 1 | use alvr_packets::Haptics; 2 | use alvr_session::HapticsConfig; 3 | use std::time::Duration; 4 | 5 | pub fn map_haptics(config: &HapticsConfig, haptics: Haptics) -> Haptics { 6 | Haptics { 7 | duration: Duration::max( 8 | haptics.duration, 9 | Duration::from_secs_f32(config.min_duration_s), 10 | ), 11 | amplitude: config.intensity_multiplier 12 | * f32::powf(haptics.amplitude, config.amplitude_curve), 13 | ..haptics 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_float2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, float, defaultp> vec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_float3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, float, defaultp> vec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_float4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, float, defaultp> vec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/ALVR-common/exception.cpp: -------------------------------------------------------------------------------- 1 | #include "exception.h" 2 | #include "common-utils.h" 3 | #include 4 | #include 5 | 6 | Exception FormatExceptionV(const char* format, va_list args) { 7 | char buf[1024]; 8 | vsprintf(buf, format, args); 9 | return Exception(buf); 10 | } 11 | 12 | Exception FormatException(const char* format, ...) { 13 | va_list args; 14 | va_start(args, format); 15 | Exception e = FormatExceptionV(format, args); 16 | va_end(args); 17 | 18 | return e; 19 | } 20 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_double2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, double, defaultp> dvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_double3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, double, defaultp> dvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_double4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, double, defaultp> dvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues' 2 | on: 3 | schedule: 4 | - cron: '0 0 * * *' 5 | 6 | jobs: 7 | stale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v9 11 | with: 12 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' 13 | exempt-issue-labels: 'bug,documentation,enhancement,good-first-issue,hep-wanted,needs-testing,release' 14 | exempt-draft-pr: true 15 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, float, defaultp> mat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, float, defaultp> mat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, float, defaultp> mat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, float, defaultp> mat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, float, defaultp> mat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, float, defaultp> mat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, double, defaultp> dmat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, double, defaultp> dmat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, double, defaultp> dmat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, double, defaultp> dmat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, double, defaultp> dmat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, double, defaultp> dmat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /alvr/server_io/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_server_io" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_events.workspace = true 12 | alvr_filesystem.workspace = true 13 | alvr_packets.workspace = true 14 | alvr_session.workspace = true 15 | 16 | cpal = { version = "0.15", features = ["jack"] } 17 | encoding_rs_io = "0.1" 18 | dirs = "5" 19 | runas = "^1.2" # version 1.1 is broken 20 | serde_json = "1" 21 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/d3d-render-utils/QuadVertexShader.hlsl: -------------------------------------------------------------------------------- 1 | struct PixelType { 2 | float2 uv : TEXCOORD0; // TEXCOORD0 must be first if I don't want to define "position" in the pixel shader 3 | float4 position : SV_Position; 4 | }; 5 | 6 | //https://gamedev.stackexchange.com/questions/98283/how-do-i-draw-a-full-screen-quad-in-directx-11 7 | PixelType main(uint vertexID : SV_VertexID) { 8 | PixelType pix; 9 | pix.uv = float2(vertexID & 1, vertexID >> 1); 10 | pix.position = float4((pix.uv.x - 0.5f) * 2, -(pix.uv.y - 0.5f) * 2, 0, 1); 11 | return pix; 12 | } -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/TrackedDevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bindings.h" 4 | #include "openvr_driver.h" 5 | #include 6 | 7 | class TrackedDevice { 8 | public: 9 | uint64_t device_id; 10 | vr::TrackedDeviceIndex_t object_id = vr::k_unTrackedDeviceIndexInvalid; 11 | vr::PropertyContainerHandle_t prop_container = vr::k_ulInvalidPropertyContainer; 12 | 13 | TrackedDevice(uint64_t device_id) 14 | : device_id(device_id) { } 15 | 16 | std::string get_serial_number(); 17 | 18 | void set_prop(FfiOpenvrProperty prop); 19 | }; 20 | -------------------------------------------------------------------------------- /alvr/session/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_session" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | 12 | bytemuck = { version = "1", features = ["derive"] } 13 | serde = { version = "1", features = ["derive"] } 14 | serde_json = "1" 15 | settings-schema = { git = "https://github.com/alvr-org/settings-schema-rs", rev = "676185f" } 16 | 17 | [build-dependencies] 18 | alvr_filesystem.workspace = true 19 | 20 | regex = "1" 21 | -------------------------------------------------------------------------------- /alvr/vrcompositor_wrapper/build.rs: -------------------------------------------------------------------------------- 1 | #[cfg(target_os = "linux")] 2 | fn main() { 3 | use std::{env, path::PathBuf}; 4 | use xshell::{cmd, Shell}; 5 | 6 | let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); 7 | let target_dir = out_dir.join("../../.."); 8 | 9 | let sh = Shell::new().unwrap(); 10 | let command = format!("g++ -shared -fPIC $(pkg-config --cflags libdrm) drm-lease-shim.cpp -o {}/alvr_drm_lease_shim.so", target_dir.display()); 11 | cmd!(sh, "bash -c {command}").run().unwrap(); 12 | } 13 | 14 | #[cfg(not(target_os = "linux"))] 15 | fn main() {} 16 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y) 7 | { 8 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y) 13 | { 14 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/mod.rs: -------------------------------------------------------------------------------- 1 | mod about; 2 | mod debug; 3 | mod devices; 4 | mod logs; 5 | mod notifications; 6 | mod settings; 7 | mod settings_controls; 8 | mod setup_wizard; 9 | mod statistics; 10 | 11 | #[cfg(not(target_arch = "wasm32"))] 12 | mod installation; 13 | 14 | pub use about::*; 15 | pub use debug::*; 16 | pub use devices::*; 17 | pub use logs::*; 18 | pub use notifications::*; 19 | pub use settings::*; 20 | pub use settings_controls::*; 21 | pub use setup_wizard::*; 22 | pub use statistics::*; 23 | 24 | #[cfg(not(target_arch = "wasm32"))] 25 | pub use installation::*; 26 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/protocol.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | struct present_packet { 12 | uint32_t image; 13 | uint32_t frame; 14 | uint64_t semaphore_value; 15 | float pose[3][4]; 16 | }; 17 | 18 | struct init_packet { 19 | uint32_t num_images; 20 | std::array device_uuid; 21 | VkImageCreateInfo image_create_info; 22 | size_t mem_index; 23 | pid_t source_pid; 24 | }; 25 | -------------------------------------------------------------------------------- /about.toml: -------------------------------------------------------------------------------- 1 | accepted = [ 2 | "MIT", 3 | "Apache-2.0", 4 | "Apache-2.0 WITH LLVM-exception", 5 | "BSD-2-Clause", 6 | "BSD-3-Clause", 7 | "BSL-1.0", 8 | "CC0-1.0", 9 | "ISC", 10 | "LicenseRef-UFL-1.0", 11 | "MPL-2.0", 12 | "OFL-1.1", 13 | "OpenSSL", 14 | "Unicode-DFS-2016", 15 | "Unlicense", 16 | "Zlib", 17 | "zlib-acknowledgement", 18 | ] 19 | targets = [ 20 | "x86_64-pc-windows-msvc", 21 | "x86_64-unknown-linux-gnu", 22 | "aarch64-linux-android", 23 | "wasm32-unknown-unknown", 24 | ] 25 | workarounds = ["ring"] 26 | filter-noassertion = true 27 | -------------------------------------------------------------------------------- /alvr/dashboard/src/steamvr_launcher/windows_steamvr.rs: -------------------------------------------------------------------------------- 1 | use std::os::windows::process::CommandExt; 2 | use std::process::Command; 3 | 4 | const CREATE_NO_WINDOW: u32 = 0x0800_0000; 5 | 6 | pub fn start_steamvr() { 7 | Command::new("cmd") 8 | .args(["/C", "start", "steam://rungameid/250820"]) 9 | .creation_flags(CREATE_NO_WINDOW) 10 | .spawn() 11 | .ok(); 12 | } 13 | 14 | pub fn kill_process(pid: u32) { 15 | Command::new("taskkill.exe") 16 | .args(["/PID", &pid.to_string(), "/F"]) 17 | .creation_flags(CREATE_NO_WINDOW) 18 | .output() 19 | .ok(); 20 | } 21 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/notice.rs: -------------------------------------------------------------------------------- 1 | use alvr_gui_common::theme::log_colors; 2 | use eframe::{ 3 | egui::{Frame, RichText, Ui}, 4 | epaint::Color32, 5 | }; 6 | 7 | // Returns true if buttons was clicked 8 | pub fn notice(ui: &mut Ui, text: &str) { 9 | Frame::group(ui.style()) 10 | .inner_margin(0.0) 11 | .fill(log_colors::WARNING_LIGHT) 12 | .show(ui, |ui| { 13 | ui.horizontal(|ui| { 14 | ui.add_space(5.0); 15 | ui.colored_label(Color32::BLACK, RichText::new(text).size(11.0)); 16 | ui.add_space(-5.0); 17 | }); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/FFR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d-render-utils/RenderPipeline.h" 4 | 5 | class FFR { 6 | public: 7 | FFR(ID3D11Device* device); 8 | void Initialize(ID3D11Texture2D* compositionTexture); 9 | void Render(); 10 | void GetOptimizedResolution(uint32_t* width, uint32_t* height); 11 | ID3D11Texture2D* GetOutputTexture(); 12 | 13 | private: 14 | Microsoft::WRL::ComPtr mDevice; 15 | Microsoft::WRL::ComPtr mOptimizedTexture; 16 | Microsoft::WRL::ComPtr mQuadVertexShader; 17 | 18 | std::vector mPipelines; 19 | }; 20 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/basic_components/button_group.rs: -------------------------------------------------------------------------------- 1 | use crate::dashboard::DisplayString; 2 | use eframe::egui::Ui; 3 | 4 | // todo: use a custom widget 5 | pub fn button_group_clicked( 6 | ui: &mut Ui, 7 | options: &[DisplayString], 8 | selection: &mut String, 9 | ) -> bool { 10 | let mut clicked = false; 11 | for id in options { 12 | let res = ui.selectable_value(selection, (**id).clone(), &id.display); 13 | if res.clicked() { 14 | clicked = true; 15 | } 16 | 17 | if cfg!(debug_assertions) { 18 | res.on_hover_text((**id).clone()); 19 | } 20 | } 21 | 22 | clicked 23 | } 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER bool rightHanded 7 | ( 8 | vec<3, T, Q> const& tangent, 9 | vec<3, T, Q> const& binormal, 10 | vec<3, T, Q> const& normal 11 | ) 12 | { 13 | return dot(cross(normal, tangent), binormal) > T(0); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool leftHanded 18 | ( 19 | vec<3, T, Q> const& tangent, 20 | vec<3, T, Q> const& binormal, 21 | vec<3, T, Q> const& normal 22 | ) 23 | { 24 | return dot(cross(normal, tangent), binormal) < T(0); 25 | } 26 | }//namespace glm 27 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "cargo" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "monthly" 12 | ignore: 13 | - dependency-name: "*" 14 | update-types: [ "version-update:semver-minor","version-update:semver-patch" ] 15 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) 7 | { 8 | return translate(mat<4, 4, T, Q>(static_cast(1)), v); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) 13 | { 14 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) 19 | { 20 | return scale(mat<4, 4, T, Q>(static_cast(1)), v); 21 | } 22 | 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: alvr 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_common.inl: -------------------------------------------------------------------------------- 1 | #include "../matrix.hpp" 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, U a) 7 | { 8 | return mat(x) * (static_cast(1) - a) + mat(y) * a; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, mat const& a) 13 | { 14 | return matrixCompMult(mat(x), static_cast(1) - a) + matrixCompMult(mat(y), a); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/util/pose.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct HmdMatrix34_t 4 | { 5 | float m[3][4]; 6 | }; 7 | 8 | struct HmdVector3_t 9 | { 10 | float v[3]; 11 | }; 12 | 13 | struct TrackedDevicePose_t 14 | { 15 | HmdMatrix34_t mDeviceToAbsoluteTracking; 16 | HmdVector3_t vVelocity; // velocity in tracker space in m/s 17 | HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?) 18 | int eTrackingResult; 19 | char bPoseIsValid; 20 | 21 | // This indicates that there is a device connected for this spot in the pose array. 22 | // It could go from true to false if the user unplugs the device. 23 | char bDeviceIsConnected; 24 | }; 25 | 26 | const TrackedDevicePose_t & find_pose_in_call_stack(); 27 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m) 7 | { 8 | mat<3, 3, T, Q> r = m; 9 | 10 | r[0] = normalize(r[0]); 11 | 12 | T d0 = dot(r[0], r[1]); 13 | r[1] -= r[0] * d0; 14 | r[1] = normalize(r[1]); 15 | 16 | T d1 = dot(r[1], r[2]); 17 | d0 = dot(r[0], r[2]); 18 | r[2] -= r[0] * d0 + r[1] * d1; 19 | r[2] = normalize(r[2]); 20 | 21 | return r; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y) 26 | { 27 | return normalize(x - y * dot(y, x)); 28 | } 29 | }//namespace glm 30 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_transform.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& v) 5 | { 6 | vec<3, T, Q> Tmp = v; 7 | 8 | // Axis of rotation must be normalised 9 | T len = glm::length(Tmp); 10 | if(abs(len - static_cast(1)) > static_cast(0.001)) 11 | { 12 | T oneOverLen = static_cast(1) / len; 13 | Tmp.x *= oneOverLen; 14 | Tmp.y *= oneOverLen; 15 | Tmp.z *= oneOverLen; 16 | } 17 | 18 | T const AngleRad(angle); 19 | T const Sin = sin(AngleRad * static_cast(0.5)); 20 | 21 | return q * qua(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 22 | } 23 | }//namespace glm 24 | 25 | -------------------------------------------------------------------------------- /alvr/launcher/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_launcher" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_gui_common.workspace = true 12 | 13 | anyhow = "1" 14 | eframe = "0.28" 15 | flate2 = "1.0.18" 16 | futures-util = "0.3.28" 17 | ico = "0.3" 18 | open = "5" 19 | reqwest = { version = "0.12", default-features = false, features = [ 20 | "rustls-tls", 21 | "stream", 22 | "json", 23 | "http2", 24 | ] } 25 | serde_json = "1" 26 | tar = "0.4" 27 | tokio = { version = "1", features = ["rt-multi-thread"] } 28 | zip = "2" 29 | 30 | [target.'cfg(windows)'.build-dependencies] 31 | winres = "0.1" 32 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/IDRScheduler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Settings.h" 4 | #include 5 | #include 6 | 7 | class IDRScheduler { 8 | public: 9 | IDRScheduler(); 10 | ~IDRScheduler(); 11 | 12 | void OnPacketLoss(); 13 | 14 | void OnStreamStart(); 15 | void InsertIDR(); 16 | 17 | bool CheckIDRInsertion(); 18 | 19 | private: 20 | static const int MIN_IDR_FRAME_INTERVAL = 100 * 1000; // 100-milliseconds 21 | static const int MIN_IDR_FRAME_INTERVAL_AGGRESSIVE 22 | = 5 * 1000; // 5-milliseconds (less than screen refresh interval) 23 | uint64_t m_insertIDRTime = 0; 24 | bool m_scheduled = false; 25 | std::mutex m_mutex; 26 | uint64_t m_minIDRFrameInterval = MIN_IDR_FRAME_INTERVAL; 27 | }; 28 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/compute_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include "compute_common.hpp" 4 | #include "setup.hpp" 5 | #include 6 | 7 | namespace glm{ 8 | namespace detail 9 | { 10 | template 11 | struct compute_equal 12 | { 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b) 14 | { 15 | return a == b; 16 | } 17 | }; 18 | /* 19 | template 20 | struct compute_equal 21 | { 22 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b) 23 | { 24 | return detail::compute_abs::is_signed>::call(b - a) <= static_cast(0); 25 | //return std::memcmp(&a, &b, sizeof(T)) == 0; 26 | } 27 | }; 28 | */ 29 | }//namespace detail 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | 3 | #include 4 | 5 | namespace glm { 6 | namespace detail 7 | { 8 | template 9 | struct compute_cross_vec2 10 | { 11 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 14 | 15 | return v.x * u.y - u.x * v.y; 16 | } 17 | }; 18 | }//namespace detail 19 | 20 | template 21 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 22 | { 23 | return detail::compute_cross_vec2::value>::call(x, y); 24 | } 25 | }//namespace glm 26 | 27 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/driverlog.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation ============// 2 | 3 | #ifndef DRIVERLOG_H 4 | #define DRIVERLOG_H 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | extern void DriverLog(const char* pchFormat, ...); 12 | extern void DriverLogVarArgs(const char* pMsgFormat, va_list args); 13 | 14 | // -------------------------------------------------------------------------- 15 | // Purpose: Write to the log file only in debug builds 16 | // -------------------------------------------------------------------------- 17 | extern void DebugDriverLog(const char* pchFormat, ...); 18 | 19 | extern bool InitDriverLog(vr::IVRDriverLog* pDriverLog); 20 | extern void CleanupDriverLog(); 21 | 22 | #endif // DRIVERLOG_H 23 | -------------------------------------------------------------------------------- /alvr/sockets/src/backend/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod tcp; 2 | pub mod udp; 3 | 4 | use alvr_common::{anyhow::Result, ConResult}; 5 | 6 | pub trait SocketWriter: Send { 7 | fn send(&mut self, buffer: &[u8]) -> Result<()>; 8 | } 9 | 10 | // Trait used to abstract different socket (or other input/output) implementations. The funtionality 11 | // is the intersection of the functionality of each implementation, that is it inheirits all 12 | // limitations 13 | pub trait SocketReader: Send { 14 | // Returns number of bytes written. buffer must be big enough to be able to receive a full 15 | // packet (size of MTU) otherwise data will be corrupted. The size of the data is 16 | fn recv(&mut self, buffer: &mut [u8]) -> ConResult; 17 | 18 | fn peek(&self, buffer: &mut [u8]) -> ConResult; 19 | } 20 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/CrashHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "../../alvr_server/bindings.h" 2 | 3 | #include "../../alvr_server/Logger.h" 4 | #include "../../shared/backward.hpp" 5 | #include 6 | #include 7 | 8 | static LONG WINAPI handler(PEXCEPTION_POINTERS ptrs) { 9 | backward::StackTrace stacktrace; 10 | backward::Printer printer; 11 | std::ostringstream stream; 12 | 13 | stacktrace.load_from(ptrs->ExceptionRecord->ExceptionAddress); 14 | printer.print(stacktrace, stream); 15 | std::string str = stream.str(); 16 | Error("Unhandled exception: %X\n%s", ptrs->ExceptionRecord->ExceptionCode, str.c_str()); 17 | 18 | Sleep(2000); 19 | 20 | return EXCEPTION_EXECUTE_HANDLER; 21 | } 22 | 23 | void HookCrashHandler() { SetUnhandledExceptionFilter(handler); } 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1 2 | /// @file glm/ext/vector_bool1.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes bvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_bool1_precision extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_bool1 extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_bool1 24 | /// @{ 25 | 26 | /// 1 components vector of boolean. 27 | typedef vec<1, bool, defaultp> bvec1; 28 | 29 | /// @} 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | alvr/client_core/cpp/VrApi_* linguist-vendored 4 | alvr/client_core/cpp/glm/** linguist-vendored 5 | alvr/client_core/cpp/tinygltf/** linguist-vendored 6 | alvr/server_openvr/cpp/alvr_server/include/** linguist-vendored 7 | alvr/server_openvr/cpp/alvr_server/nvEncodeAPI.h linguist-vendored 8 | alvr/server_openvr/cpp/platform/win32/NvCodecUtils.h linguist-vendored 9 | alvr/server_openvr/cpp/platform/win32/NvEncoder.cpp linguist-vendored 10 | alvr/server_openvr/cpp/platform/win32/NvEncoder.h linguist-vendored 11 | alvr/server_openvr/cpp/shared/** linguist-vendored 12 | # note: some of these folders contain ALVR code, but only a minor amount 13 | alvr/vulkan_layer/layer/** linguist-vendored 14 | alvr/vulkan_layer/util/** linguist-vendored 15 | alvr/vulkan_layer/wsi/** linguist-vendored 16 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "linux")] 2 | #![allow(clippy::missing_safety_doc)] 3 | 4 | use std::ffi::CString; 5 | 6 | #[allow( 7 | non_camel_case_types, 8 | non_snake_case, 9 | non_upper_case_globals, 10 | dead_code, 11 | clippy::useless_transmute 12 | )] 13 | mod bindings { 14 | include!(concat!(env!("OUT_DIR"), "/layer_bindings.rs")); 15 | } 16 | use bindings::*; 17 | 18 | #[no_mangle] 19 | pub unsafe extern "C" fn ALVR_Negotiate(nli: *mut VkNegotiateLayerInterface) -> VkResult { 20 | g_sessionPath = CString::new( 21 | alvr_filesystem::filesystem_layout_invalid() 22 | .session() 23 | .to_string_lossy() 24 | .to_string(), 25 | ) 26 | .unwrap() 27 | .into_raw(); 28 | 29 | bindings::wsi_layer_Negotiate(nli) 30 | } 31 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/debug.rs: -------------------------------------------------------------------------------- 1 | use alvr_packets::ServerRequest; 2 | use eframe::egui::Ui; 3 | 4 | pub fn debug_tab_ui(ui: &mut Ui) -> Option { 5 | let mut request = None; 6 | 7 | ui.columns(4, |ui| { 8 | if ui[0].button("Capture frame").clicked() { 9 | request = Some(ServerRequest::CaptureFrame); 10 | } 11 | 12 | if ui[1].button("Insert IDR").clicked() { 13 | request = Some(ServerRequest::InsertIdr); 14 | } 15 | 16 | if ui[2].button("Start recording").clicked() { 17 | request = Some(ServerRequest::StartRecording); 18 | } 19 | 20 | if ui[3].button("Stop recording").clicked() { 21 | request = Some(ServerRequest::StopRecording); 22 | } 23 | }); 24 | 25 | request 26 | } 27 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/srgb_correction_pass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "gl_render_utils/render_pipeline.h" 4 | #include 5 | #include 6 | #include 7 | 8 | class SrgbCorrectionPass { 9 | public: 10 | SrgbCorrectionPass(gl_render_utils::Texture *inputSurface); 11 | 12 | void Initialize(uint32_t width, uint32_t height, bool passthrough, bool fixLimitedRange, float encodingGamma); 13 | 14 | void Render() const; 15 | 16 | gl_render_utils::Texture *GetOutputTexture() { return mOutputTexture.get(); } 17 | 18 | private: 19 | gl_render_utils::Texture *mInputSurface; 20 | std::unique_ptr mOutputTexture; 21 | std::unique_ptr mOutputTextureState; 22 | std::unique_ptr mStagingPipeline; 23 | }; 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, float, defaultp> mat2x2; 16 | 17 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, float, defaultp> mat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, float, defaultp> mat3x3; 16 | 17 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, float, defaultp> mat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_float4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @ingroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, float, defaultp> mat4x4; 16 | 17 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, float, defaultp> mat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, double, defaultp> dmat2x2; 16 | 17 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, double, defaultp> dmat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, double, defaultp> dmat3x3; 16 | 17 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, double, defaultp> dmat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_double4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, double, defaultp> dmat4x4; 16 | 17 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, double, defaultp> dmat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/scalar_constants.inl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() 7 | { 8 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); 9 | return std::numeric_limits::epsilon(); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() 14 | { 15 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'pi' only accepts floating-point inputs"); 16 | return static_cast(3.14159265358979323846264338327950288); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType cos_one_over_two() 21 | { 22 | return genType(0.877582561890372716130286068203503191); 23 | } 24 | } //namespace glm 25 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_int1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1 2 | /// @file glm/ext/vector_int1.hpp 3 | /// 4 | /// @defgroup ext_vector_int1 GLM_EXT_vector_int1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes ivec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_uint1 extension. 12 | /// @see ext_vector_int1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_int1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_int1 25 | /// @{ 26 | 27 | /// 1 component vector of signed integer numbers. 28 | typedef vec<1, int, defaultp> ivec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /alvr/server_openvr/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_server_openvr" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors = ["alvr-org", "Valve Corporation"] 7 | license = "MIT" 8 | 9 | [lib] 10 | crate-type = ["cdylib"] 11 | 12 | [features] 13 | gpl = [] # Enable for FFmpeg support on Windows. Always enabled on Linux 14 | 15 | [dependencies] 16 | alvr_common.workspace = true 17 | alvr_filesystem.workspace = true 18 | alvr_packets.workspace = true 19 | alvr_server_core.workspace = true 20 | alvr_server_io.workspace = true 21 | alvr_session.workspace = true 22 | 23 | [build-dependencies] 24 | alvr_filesystem = { path = "../filesystem" } 25 | bindgen = "0.69" 26 | cc = { version = "1", features = ["parallel"] } 27 | walkdir = "2" 28 | 29 | [target.'cfg(target_os = "linux")'.build-dependencies] 30 | pkg-config = "0.3" 31 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/wsi/display.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace wsi { 9 | 10 | class display { 11 | public: 12 | display(); 13 | ~display(); 14 | 15 | VkFence get_vsync_fence(); 16 | VkFence peek_vsync_fence() { return vsync_fence;}; 17 | 18 | bool is_signaled() const { return m_signaled; } 19 | bool wait_for_vsync(uint64_t timeoutNs); 20 | 21 | std::atomic m_vsync_count{0}; 22 | 23 | private: 24 | std::atomic_bool m_thread_running{false}; 25 | std::atomic_bool m_exiting{false}; 26 | std::thread m_vsync_thread; 27 | VkFence vsync_fence = VK_NULL_HANDLE; 28 | std::mutex m_mutex; 29 | std::condition_variable m_cond; 30 | std::atomic_bool m_signaled = false; 31 | }; 32 | 33 | } // namespace wsi 34 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_uint1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1 2 | /// @file glm/ext/vector_uint1.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes uvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_int1 extension. 12 | /// @see ext_vector_uint1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_uint1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_uint1 25 | /// @{ 26 | 27 | /// 1 component vector of unsigned integer numbers. 28 | typedef vec<1, unsigned int, defaultp> uvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 7 | ( 8 | vec<3, T, Q> const& x 9 | ) 10 | { 11 | mat<3, 3, T, Q> Result(T(0)); 12 | Result[0][1] = x.z; 13 | Result[1][0] = -x.z; 14 | Result[0][2] = -x.y; 15 | Result[2][0] = x.y; 16 | Result[1][2] = x.x; 17 | Result[2][1] = -x.x; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 23 | ( 24 | vec<3, T, Q> const& x 25 | ) 26 | { 27 | mat<4, 4, T, Q> Result(T(0)); 28 | Result[0][1] = x.z; 29 | Result[1][0] = -x.z; 30 | Result[0][2] = -x.y; 31 | Result[2][0] = x.y; 32 | Result[1][2] = x.x; 33 | Result[2][1] = -x.x; 34 | return Result; 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/EncodePipelineSW.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "EncodePipeline.h" 4 | 5 | #include 6 | 7 | class FormatConverter; 8 | 9 | namespace alvr { 10 | 11 | class EncodePipelineSW : public EncodePipeline { 12 | public: 13 | ~EncodePipelineSW(); 14 | EncodePipelineSW(Renderer* render, uint32_t width, uint32_t height); 15 | 16 | void PushFrame(uint64_t targetTimestampNs, bool idr) override; 17 | bool GetEncoded(FramePacket& packet) override; 18 | void SetParams(FfiDynamicEncoderParams params) override; 19 | int GetCodec() override; 20 | 21 | private: 22 | x264_t* enc = nullptr; 23 | x264_param_t param; 24 | x264_picture_t picture; 25 | x264_picture_t picture_out; 26 | x264_nal_t* nal = nullptr; 27 | int nal_size = 0; 28 | int64_t pts = 0; 29 | FormatConverter* rgbtoyuv = nullptr; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /alvr/common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_common" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [features] 10 | enable-messagebox = ["rfd"] 11 | 12 | [dependencies] 13 | anyhow = { version = "1", features = ["backtrace"] } 14 | backtrace = "0.3" 15 | glam = { version = "0.28", features = ["serde"] } 16 | log = "0.4" 17 | once_cell = "1" 18 | parking_lot = "0.12" 19 | paste = "1" 20 | semver = { version = "1", features = ["serde"] } 21 | serde = { version = "1", features = ["derive"] } 22 | settings-schema = { git = "https://github.com/alvr-org/settings-schema-rs", rev = "676185f" } 23 | # settings-schema = { path = "../../../../settings-schema-rs/settings-schema" } 24 | 25 | [target.'cfg(not(target_os = "android"))'.dependencies] 26 | rfd = { version = "0.14", optional = true } 27 | -------------------------------------------------------------------------------- /alvr/xtask/patches/0001-guid-conftest.patch: -------------------------------------------------------------------------------- 1 | From 03823ac0c6a38bd6ba972539e3203a592579792f Mon Sep 17 00:00:00 2001 2 | From: Timo Rothenpieler 3 | Date: Thu, 1 Jun 2023 23:24:43 +0200 4 | Subject: [PATCH] configure: use non-deprecated nvenc GUID for conftest 5 | 6 | --- 7 | configure | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/configure b/configure 11 | index 495493aa0e8a..ae56540f4eb0 100755 12 | --- a/configure 13 | +++ b/configure 14 | @@ -7079,7 +7079,7 @@ enabled nvenc && 15 | test_cc -I$source_path < 17 | NV_ENCODE_API_FUNCTION_LIST flist; 18 | -void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; } 19 | +void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_CODEC_H264_GUID } }; } 20 | int main(void) { return 0; } 21 | EOF 22 | 23 | -------------------------------------------------------------------------------- /alvr/audio/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_audio" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_session.workspace = true 12 | alvr_sockets.workspace = true 13 | 14 | cpal = { version = "0.15", features = ["jack"] } 15 | rodio = "0.19" 16 | serde = "1" 17 | 18 | [target.'cfg(windows)'.dependencies] 19 | widestring = "1" 20 | windows = { version = "0.58", features = [ 21 | "Win32_Devices_FunctionDiscovery", 22 | "Win32_Foundation", 23 | "Win32_Media_Audio_Endpoints", 24 | "Win32_System_Com_StructuredStorage", 25 | "Win32_System_Variant", 26 | "Win32_UI_Shell_PropertiesSystem", 27 | ] } 28 | 29 | [target.'cfg(target_os = "linux")'.dependencies] 30 | pipewire = { version = "0.8.0", features = ["v0_3_49"] } 31 | libspa-sys = "0.8.0" -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/collapsible.rs: -------------------------------------------------------------------------------- 1 | use super::NestingInfo; 2 | use alvr_packets::PathValuePair; 3 | use eframe::egui::Ui; 4 | use serde_json as json; 5 | 6 | pub fn collapsible_button( 7 | ui: &mut Ui, 8 | nesting_info: &NestingInfo, 9 | session_fragment: &mut json::Value, 10 | request: &mut Option, 11 | ) -> bool { 12 | let json::Value::Bool(state_mut) = &mut session_fragment["gui_collapsed"] else { 13 | unreachable!() 14 | }; 15 | 16 | if (*state_mut && ui.small_button("Expand").clicked()) 17 | || (!*state_mut && ui.small_button("Collapse").clicked()) 18 | { 19 | *state_mut = !*state_mut; 20 | *request = super::get_single_value( 21 | nesting_info, 22 | "gui_collapsed".into(), 23 | json::Value::Bool(*state_mut), 24 | ); 25 | } 26 | 27 | *state_mut 28 | } 29 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/README.md: -------------------------------------------------------------------------------- 1 | # ALVR capture vulkan layer 2 | 3 | ## Introduction 4 | 5 | The ALVR capture vulkan layer is intended to overcome a limitation of SteamVR runtime on Linux: it does'nt allow software based output devices. 6 | The layer is based on [vulkan wsi layer](https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer), which is meant to implement window system integration as layers. 7 | 8 | The ALVR layer adds a display to the vkGetPhysicalDeviceDisplayPropertiesKHR call, and implements all functions related to that device. It then allows images of the swapchain to be shared to an other process (the alvr server process), and communicates present calls. 9 | 10 | There are unfortunately a few hacks that make it heavily dependent to SteamVR: requested extentions manipulation to enable the required ones, searching through the stack to find the headset position, and not fully implementing the advertised features. 11 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/EncodePipelineNvEnc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "EncodePipeline.h" 4 | #include 5 | 6 | extern "C" struct AVBufferRef; 7 | extern "C" struct AVCodecContext; 8 | extern "C" struct AVFrame; 9 | 10 | class Renderer; 11 | 12 | namespace alvr { 13 | 14 | class EncodePipelineNvEnc : public EncodePipeline { 15 | public: 16 | ~EncodePipelineNvEnc(); 17 | EncodePipelineNvEnc( 18 | Renderer* render, 19 | VkContext& vk_ctx, 20 | VkFrame& input_frame, 21 | VkFrameCtx& vk_frame_ctx, 22 | uint32_t width, 23 | uint32_t height 24 | ); 25 | 26 | void PushFrame(uint64_t targetTimestampNs, bool idr) override; 27 | 28 | private: 29 | Renderer* r = nullptr; 30 | AVBufferRef* hw_ctx = nullptr; 31 | std::unique_ptr> vk_frame; 32 | AVFrame* hw_frame = nullptr; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /wiki/Hand-tracking-controller-bindings.md: -------------------------------------------------------------------------------- 1 | Current bindings for ALVR 20 2 | === 3 | 4 | To control state of gestures, you can toggle `Headset -> Controllers -> Gestures -> Only touch` 5 | Enabled state means that gestures won't be triggered, disabled would mean all gestures are activated. 6 | 7 | Gestures 8 | --- 9 | 10 | | Action | Handtracking pinch | 11 | | -------------- | ----------------------------------- | 12 | | Trigger | Pinch thumb and index | 13 | | Joystick click | Curl thumb to palm | 14 | | Grip | Curl middle, ring and little | 15 | | Y/B | Pinch thumb and middle | 16 | | X/A | Pinch thumb and ring | 17 | | Menu button | Pinch thumb and little on left hand | 18 | 19 | Joystick 20 | --- 21 | 22 | Activation is done through curling all 4 fingers and touching top of hand with thumb 23 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | 3 | #include "../exponential.hpp" 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER T gauss 9 | ( 10 | T x, 11 | T ExpectedValue, 12 | T StandardDeviation 13 | ) 14 | { 15 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER T gauss 20 | ( 21 | vec<2, T, Q> const& Coord, 22 | vec<2, T, Q> const& ExpectedValue, 23 | vec<2, T, Q> const& StandardDeviation 24 | ) 25 | { 26 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 27 | return exp(-(Squared.x + Squared.y)); 28 | } 29 | }//namespace glm 30 | 31 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar 7 | ( 8 | vec<3, T, Q> const& euclidean 9 | ) 10 | { 11 | T const Length(length(euclidean)); 12 | vec<3, T, Q> const tmp(euclidean / Length); 13 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 14 | 15 | return vec<3, T, Q>( 16 | asin(tmp.y), // latitude 17 | atan(tmp.x, tmp.z), // longitude 18 | xz_dist); // xz distance 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean 23 | ( 24 | vec<2, T, Q> const& polar 25 | ) 26 | { 27 | T const latitude(polar.x); 28 | T const longitude(polar.y); 29 | 30 | return vec<3, T, Q>( 31 | cos(latitude) * sin(longitude), 32 | sin(latitude), 33 | cos(latitude) * cos(longitude)); 34 | } 35 | 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/util/logger.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void _log(const char *format, va_list args, bool err) { 6 | vfprintf(err ? stderr : stdout, format, args); 7 | } 8 | 9 | void Error(const char *format, ...) { 10 | va_list args; 11 | va_start(args, format); 12 | _log(format, args, true); 13 | va_end(args); 14 | } 15 | 16 | void Warn(const char *format, ...) { 17 | va_list args; 18 | va_start(args, format); 19 | _log(format, args, true); 20 | va_end(args); 21 | } 22 | 23 | void Info(const char *format, ...) { 24 | va_list args; 25 | va_start(args, format); 26 | _log(format, args, false); 27 | va_end(args); 28 | } 29 | 30 | void Debug(const char *format, ...) { 31 | if (getenv("ALVR_LOG_DEBUG") == NULL) return; 32 | va_list args; 33 | va_start(args, format); 34 | _log(format, args, true); 35 | va_end(args); 36 | } 37 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["alvr/*"] 4 | 5 | [workspace.package] 6 | version = "21.0.0-dev01" 7 | edition = "2021" 8 | rust-version = "1.76" 9 | authors = ["alvr-org"] 10 | license = "MIT" 11 | 12 | [workspace.dependencies] 13 | alvr_audio = { path = "alvr/audio" } 14 | alvr_client_core = { path = "alvr/client_core" } 15 | alvr_common = { path = "alvr/common" } 16 | alvr_events = { path = "alvr/events" } 17 | alvr_filesystem = { path = "alvr/filesystem" } 18 | alvr_gui_common = { path = "alvr/gui_common" } 19 | alvr_packets = { path = "alvr/packets" } 20 | alvr_server_core = { path = "alvr/server_core"} 21 | alvr_server_io = { path = "alvr/server_io" } 22 | alvr_session = { path = "alvr/session" } 23 | alvr_sockets = { path = "alvr/sockets" } 24 | 25 | [profile.release] 26 | debug = "limited" 27 | strip = false 28 | 29 | [profile.distribution] 30 | inherits = "release" 31 | lto = true 32 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_float1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1 2 | /// @file glm/ext/vector_float1.hpp 3 | /// 4 | /// @defgroup ext_vector_float1 GLM_EXT_vector_float1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1_precision extension. 12 | /// @see ext_vector_double1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_float1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_float1 25 | /// @{ 26 | 27 | /// 1 components vector of single-precision floating-point numbers. 28 | typedef vec<1, float, defaultp> vec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /wiki/Roadmap.md: -------------------------------------------------------------------------------- 1 | This post will continue to evolve during ALVR development. 2 | 3 | ## Long-term goal 4 | 5 | Create a universal bridge between XR devices. 6 | 7 | ## What is coming next 8 | 9 | * Compositor rewrite 10 | * **Purpose**: add Linux support for FFR and color correction, preparation for sliced encoding 11 | * **Status**: FFE and color correction done on all platforms 12 | * Encoder rewrite 13 | * **Purpose**: support any OS and hardware with a single API, using [Vulkan video extensions](https://www.khronos.org/blog/an-introduction-to-vulkan-video) 14 | * **Status**: blocked by adoption by AMD and Intel, landing of the feature on stable Nvidia drivers 15 | * Monado Driver 16 | * **Purpose**: support other runtimes with the streamer 17 | * **Status**: blocked on refactors 18 | 19 | Due to the low development capacity, no ETA can be provided. New releases will not have a regular cadence and they do not have scheduled features. 20 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_double1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1 2 | /// @file glm/ext/vector_double1.hpp 3 | /// 4 | /// @defgroup ext_vector_double1 GLM_EXT_vector_double1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1_precision extension. 12 | /// @see ext_vector_float1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_double1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_double1 25 | /// @{ 26 | 27 | /// 1 components vector of double-precision floating-point numbers. 28 | typedef vec<1, double, defaultp> dvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/shader/FoveatedRendering.hlsli: -------------------------------------------------------------------------------- 1 | cbuffer FoveationVars { 2 | uint2 targetResolution; 3 | uint2 optimizedResolution; 4 | float2 eyeSizeRatio; 5 | float2 centerSize; 6 | float2 centerShift; 7 | float2 edgeRatio; 8 | }; 9 | 10 | float2 TextureToEyeUV(float2 textureUV, bool isRightEye) { 11 | // flip distortion horizontally for right eye 12 | // left: x * 2; right: (1 - x) * 2 13 | return float2((textureUV.x + float(isRightEye) * (1. - 2. * textureUV.x)) * 2., textureUV.y); 14 | } 15 | 16 | float2 EyeToTextureUV(float2 eyeUV, bool isRightEye) { 17 | // saturate is used to avoid color bleeding between the two sides of the texture or with the black border when filtering 18 | //float2 clampedUV = saturate(eyeUV); 19 | // left: x / 2; right 1 - (x / 2) 20 | //return float2(clampedUV.x / 2. + float(isRightEye) * (1. - clampedUV.x), clampedUV.y); 21 | return float2(eyeUV.x * .5 + float(isRightEye) * (1. - eyeUV.x), eyeUV.y); 22 | } -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/vec1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_vec1 GLM_GTC_vec1 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Add vec1, ivec1, uvec1 and bvec1 types. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../ext/vector_bool1.hpp" 17 | #include "../ext/vector_bool1_precision.hpp" 18 | #include "../ext/vector_float1.hpp" 19 | #include "../ext/vector_float1_precision.hpp" 20 | #include "../ext/vector_double1.hpp" 21 | #include "../ext/vector_double1_precision.hpp" 22 | #include "../ext/vector_int1.hpp" 23 | #include "../ext/vector_int1_precision.hpp" 24 | #include "../ext/vector_uint1.hpp" 25 | #include "../ext/vector_uint1_precision.hpp" 26 | 27 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTC_vec1 extension included") 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/VrApi_Version.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : VrApi_Version.h 4 | Content : API version 5 | Language : C99 6 | 7 | Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved. 8 | 9 | *************************************************************************************/ 10 | 11 | #ifndef OVR_VrApi_Version_h 12 | #define OVR_VrApi_Version_h 13 | 14 | // Master version numbers 15 | #define VRAPI_PRODUCT_VERSION 1 16 | #define VRAPI_MAJOR_VERSION 1 17 | #define VRAPI_MINOR_VERSION 34 18 | #define VRAPI_PATCH_VERSION 0 19 | 20 | // Internal build identifier 21 | #define VRAPI_BUILD_VERSION 213570615 22 | 23 | // Internal build description 24 | #define VRAPI_BUILD_DESCRIPTION "Development" 25 | 26 | // Minimum version of the driver required for this API 27 | #define VRAPI_DRIVER_VERSION 213570615 28 | 29 | #endif // OVR_VrApi_Version_h 30 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/shared/threadtools.h: -------------------------------------------------------------------------------- 1 | //===================== Copyright (c) Valve Corporation. All Rights Reserved. ====================== 2 | // 3 | // Helper classes for working with threads. 4 | // 5 | //================================================================================================== 6 | #pragma once 7 | 8 | #include 9 | #ifdef _WIN32 10 | #include 11 | #endif 12 | 13 | #define THREAD_PRIORITY_MOST_URGENT 15 14 | 15 | class CThread 16 | { 17 | public: 18 | CThread(); 19 | virtual ~CThread(); 20 | virtual bool Init() { return true; } 21 | virtual void Run() = 0; 22 | void Start(); 23 | void Join(); 24 | private: 25 | std::thread *m_pThread; 26 | }; 27 | 28 | #ifdef _WIN32 29 | class CThreadEvent 30 | { 31 | public: 32 | CThreadEvent( bool bManualReset = false ); 33 | ~CThreadEvent(); 34 | bool Wait( uint32_t nTimeoutMs = INFINITE ); 35 | bool Set(); 36 | bool Reset(); 37 | private: 38 | HANDLE m_hSyncObject; 39 | }; 40 | #endif 41 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt<4, float, Q, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) 15 | { 16 | vec<4, float, Q> Result; 17 | Result.data = _mm_sqrt_ps(v.data); 18 | return Result; 19 | } 20 | }; 21 | 22 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE 23 | template<> 24 | struct compute_sqrt<4, float, aligned_lowp, true> 25 | { 26 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v) 27 | { 28 | vec<4, float, aligned_lowp> Result; 29 | Result.data = glm_vec4_sqrt_lowp(v.data); 30 | return Result; 31 | } 32 | }; 33 | # endif 34 | }//namespace detail 35 | }//namespace glm 36 | 37 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 38 | -------------------------------------------------------------------------------- /alvr/xtask/patches/0001-vaapi_encode-Enable-global-header.patch: -------------------------------------------------------------------------------- 1 | From 03e6b5617c94bf6073a17a0a7054e70345b512ae Mon Sep 17 00:00:00 2001 2 | From: David Rosca 3 | Date: Sat, 1 Jul 2023 10:35:16 +0200 4 | Subject: [PATCH] vaapi_encode: Force enable global header 5 | 6 | --- 7 | libavcodec/vaapi_encode.c | 3 +-- 8 | 1 file changed, 1 insertion(+), 2 deletions(-) 9 | 10 | diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c 11 | index bfca315a7a..ecce9bd721 100644 12 | --- a/libavcodec/vaapi_encode.c 13 | +++ b/libavcodec/vaapi_encode.c 14 | @@ -2719,8 +2719,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) 15 | } 16 | } 17 | 18 | - if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE && 19 | - ctx->codec->write_sequence_header && 20 | + if (ctx->codec->write_sequence_header && 21 | avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { 22 | char data[MAX_PARAM_BUFFER_SIZE]; 23 | size_t bit_len = 8 * sizeof(data); 24 | -- 25 | 2.41.0 26 | 27 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/up_down.rs: -------------------------------------------------------------------------------- 1 | use eframe::{ 2 | egui::{self, Layout, Ui}, 3 | emath::Align, 4 | }; 5 | 6 | #[derive(PartialEq, Eq)] 7 | pub enum UpDownResult { 8 | Up, 9 | Down, 10 | None, 11 | } 12 | 13 | pub fn up_down_buttons(ui: &mut Ui, index: usize, count: usize) -> UpDownResult { 14 | ui.with_layout(Layout::top_down(Align::LEFT), |ui| { 15 | ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0); 16 | 17 | let up_clicked = ui 18 | .add_visible_ui(index > 0, |ui| ui.small_button("⬆")) 19 | .inner 20 | .clicked(); 21 | let down_clicked = ui 22 | .add_visible_ui(index < count - 1, |ui| ui.small_button("⬇")) 23 | .inner 24 | .clicked(); 25 | 26 | if up_clicked { 27 | UpDownResult::Up 28 | } else if down_clicked { 29 | UpDownResult::Down 30 | } else { 31 | UpDownResult::None 32 | } 33 | }) 34 | .inner 35 | } 36 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/ALVR-common/packet_types.h: -------------------------------------------------------------------------------- 1 | #ifndef ALVRCLIENT_PACKETTYPES_H 2 | #define ALVRCLIENT_PACKETTYPES_H 3 | #include "../alvr_server/bindings.h" 4 | #include 5 | #include 6 | 7 | enum ALVR_CODEC { 8 | ALVR_CODEC_H264 = 0, 9 | ALVR_CODEC_HEVC = 1, 10 | ALVR_CODEC_AV1 = 2, 11 | }; 12 | 13 | enum ALVR_H264_PROFILE { 14 | ALVR_H264_PROFILE_HIGH = 0, 15 | ALVR_H264_PROFILE_MAIN = 1, 16 | ALVR_H264_PROFILE_BASELINE = 2, 17 | }; 18 | 19 | enum ALVR_RATE_CONTROL_METHOD { 20 | ALVR_CBR = 0, 21 | ALVR_VBR = 1, 22 | }; 23 | 24 | enum ALVR_ENTROPY_CODING { 25 | ALVR_CABAC = 0, 26 | ALVR_CAVLC = 1, 27 | }; 28 | 29 | enum ALVR_ENCODER_QUALITY_PRESET { ALVR_QUALITY = 0, ALVR_BALANCED = 1, ALVR_SPEED = 2 }; 30 | 31 | enum ALVR_INPUT { 32 | ALVR_INPUT_FINGER_INDEX, 33 | ALVR_INPUT_FINGER_MIDDLE, 34 | ALVR_INPUT_FINGER_RING, 35 | ALVR_INPUT_FINGER_PINKY, 36 | }; 37 | #define ALVR_BUTTON_FLAG(input) (1ULL << input) 38 | 39 | #endif // ALVRCLIENT_PACKETTYPES_H 40 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/CEncoder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "alvr_server/IDRScheduler.h" 4 | #include "shared/threadtools.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class PoseHistory; 11 | 12 | class CEncoder : public CThread { 13 | public: 14 | CEncoder(std::shared_ptr poseHistory); 15 | ~CEncoder(); 16 | bool Init() override { return true; } 17 | void Run() override; 18 | 19 | void Stop(); 20 | void OnStreamStart(); 21 | void OnPacketLoss(); 22 | void InsertIDR(); 23 | bool IsConnected() { return m_connected; } 24 | void CaptureFrame(); 25 | 26 | private: 27 | void GetFds(int client, int (*fds)[6]); 28 | std::shared_ptr m_poseHistory; 29 | std::atomic_bool m_exiting { false }; 30 | IDRScheduler m_scheduler; 31 | pollfd m_socket; 32 | std::string m_socketPath; 33 | int m_fds[6]; 34 | bool m_connected = false; 35 | std::atomic_bool m_captureFrame = false; 36 | }; 37 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/shader/rgbtoyuv420.comp: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; 4 | layout (binding = 0, rgba8) uniform readonly image2D in_img; 5 | layout (binding = 1, r8) uniform writeonly image2D out_img[3]; 6 | 7 | /* FFmpeg/libavfilter/vf_scale_vulkan.c */ 8 | 9 | void main() 10 | { 11 | const mat4 yuv_matrix = mat4( 12 | 0.0, 1.0, 0.0, 0.0, 13 | 0.0, -0.5, 0.5, 0.0, 14 | 0.5, -0.5, 0, 0.0, 15 | 0.0, 0.0, 0.0, 1.0 16 | ); 17 | 18 | ivec2 pos = ivec2(gl_GlobalInvocationID.xy); 19 | vec4 res = imageLoad(in_img, pos); 20 | 21 | res *= yuv_matrix; 22 | res *= vec4(219.0 / 255.0, 224.0 / 255.0, 224.0 / 255.0, 1.0); 23 | res += vec4(16.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 0.0); 24 | 25 | imageStore(out_img[0], pos, vec4(res.r, 0.0, 0.0, 0.0)); 26 | pos /= ivec2(2); 27 | imageStore(out_img[1], pos, vec4(res.g, 0.0, 0.0, 0.0)); 28 | imageStore(out_img[2], pos, vec4(res.b, 0.0, 0.0, 0.0)); 29 | } 30 | -------------------------------------------------------------------------------- /alvr/xtask/patches/0001-vaapi_encode_h265-Set-vui_parameters_present_flag.patch: -------------------------------------------------------------------------------- 1 | From d96227806cab0de91c4db6b808b842c5b1477ebd Mon Sep 17 00:00:00 2001 2 | From: David Rosca 3 | Date: Fri, 21 Jul 2023 21:55:56 +0200 4 | Subject: [PATCH] vaapi_encode_h265: Set vui_parameters_present_flag 5 | 6 | --- 7 | libavcodec/vaapi_encode_h265.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c 11 | index aa7e532f9a..91212dfb58 100644 12 | --- a/libavcodec/vaapi_encode_h265.c 13 | +++ b/libavcodec/vaapi_encode_h265.c 14 | @@ -690,7 +690,7 @@ static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx) 15 | sps->log2_min_pcm_luma_coding_block_size_minus3 + 16 | sps->log2_diff_max_min_pcm_luma_coding_block_size, 17 | 18 | - .vui_parameters_present_flag = 0, 19 | + .vui_parameters_present_flag = 1, 20 | }; 21 | 22 | *vpic = (VAEncPictureParameterBufferHEVC) { 23 | -- 24 | 2.41.0 25 | 26 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/layer/alvr_x86_64.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_format_version" : "1.1.2", 3 | "layer" : { 4 | "name": "VK_LAYER_ALVR_capture", 5 | "type": "GLOBAL", 6 | "library_path": "../../../lib64/libalvr_vulkan_layer.so", 7 | "api_version": "1.0.68", 8 | "implementation_version": "1", 9 | "description": "ALVR display intercept layer", 10 | "instance_extensions": [ 11 | { 12 | "name" : "VK_EXT_headless_surface", 13 | "spec_version" : "1" 14 | }, 15 | { 16 | "name" : "VK_KHR_surface", 17 | "spec_version" : "1" 18 | }, 19 | { 20 | "name" : "VK_EXT_acquire_xlib_display", 21 | "spec_version" : "1" 22 | }, 23 | { 24 | "name" : "VK_KHR_display", 25 | "spec_version" : "1" 26 | } 27 | ], 28 | "device_extensions": [ 29 | { 30 | "name" : "VK_KHR_swapchain", 31 | "spec_version" : "1" 32 | } 33 | ], 34 | "functions": { 35 | "vkNegotiateLoaderLayerInterfaceVersion" : "ALVR_Negotiate" 36 | }, 37 | "disable_environment": { 38 | "DISABLE_ALVR_DISPLAY": "1" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1_precision 2 | /// @file glm/ext/vector_bool1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_bool1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_bool1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of bool values. 25 | typedef vec<1, bool, highp> highp_bvec1; 26 | 27 | /// 1 component vector of bool values. 28 | typedef vec<1, bool, mediump> mediump_bvec1; 29 | 30 | /// 1 component vector of bool values. 31 | typedef vec<1, bool, lowp> lowp_bvec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_trigonometric.inl: -------------------------------------------------------------------------------- 1 | #include "scalar_constants.hpp" 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T angle(qua const& x) 7 | { 8 | if (abs(x.w) > cos_one_over_two()) 9 | { 10 | return asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast(2); 11 | } 12 | 13 | return acos(x.w) * static_cast(2); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<3, T, Q> axis(qua const& x) 18 | { 19 | T const tmp1 = static_cast(1) - x.w * x.w; 20 | if(tmp1 <= static_cast(0)) 21 | return vec<3, T, Q>(0, 0, 1); 22 | T const tmp2 = static_cast(1) / sqrt(tmp1); 23 | return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER qua angleAxis(T const& angle, vec<3, T, Q> const& v) 28 | { 29 | T const a(angle); 30 | T const s = glm::sin(a * static_cast(0.5)); 31 | 32 | return qua(glm::cos(a * static_cast(0.5)), v * s); 33 | } 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_int1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1_precision 2 | /// @file glm/ext/vector_int1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_int1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_int1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of signed integer values. 25 | typedef vec<1, int, highp> highp_ivec1; 26 | 27 | /// 1 component vector of signed integer values. 28 | typedef vec<1, int, mediump> mediump_ivec1; 29 | 30 | /// 1 component vector of signed integer values. 31 | typedef vec<1, int, lowp> lowp_ivec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # else 22 | # pragma message("GLM: GLM_GTX_extend extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_scalar_relational 29 | /// @{ 30 | 31 | 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "scalar_relational.inl" 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T radialGradient 7 | ( 8 | vec<2, T, Q> const& Center, 9 | T const& Radius, 10 | vec<2, T, Q> const& Focal, 11 | vec<2, T, Q> const& Position 12 | ) 13 | { 14 | vec<2, T, Q> F = Focal - Center; 15 | vec<2, T, Q> D = Position - Focal; 16 | T Radius2 = pow2(Radius); 17 | T Fx2 = pow2(F.x); 18 | T Fy2 = pow2(F.y); 19 | 20 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 21 | T Denominator = Radius2 - (Fx2 + Fy2); 22 | return Numerator / Denominator; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER T linearGradient 27 | ( 28 | vec<2, T, Q> const& Point0, 29 | vec<2, T, Q> const& Point1, 30 | vec<2, T, Q> const& Position 31 | ) 32 | { 33 | vec<2, T, Q> Dist = Point1 - Point0; 34 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 35 | } 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/gl_render_utils/texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | // keep order ^ v 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace gl_render_utils { 11 | 12 | class Texture { 13 | public: 14 | Texture(bool external, 15 | GLuint externalHandle, 16 | bool oes, 17 | uint32_t width = 0, 18 | uint32_t height = 0, 19 | GLint internalFormat = GL_SRGB8_ALPHA8, 20 | GLenum format = GL_RGBA, 21 | std::vector content = {}); 22 | 23 | uint32_t GetWidth() const { return mWidth; } 24 | 25 | uint32_t GetHeight() const { return mHeight; } 26 | 27 | GLuint GetGLTexture() const { return mGLTexture; } 28 | 29 | GLenum GetTarget() const { return mTarget; } 30 | 31 | bool IsOES() const { return mOES; } 32 | 33 | ~Texture(); 34 | 35 | private: 36 | bool mOES; 37 | uint32_t mWidth, mHeight; 38 | GLuint mGLTexture; 39 | GLenum mTarget; 40 | bool mExternal; 41 | }; 42 | } // namespace gl_render_utils 43 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/PoseHistory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ALVR-common/packet_types.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class PoseHistory { 10 | public: 11 | struct TrackingHistoryFrame { 12 | uint64_t targetTimestampNs; 13 | FfiDeviceMotion motion; 14 | vr::HmdMatrix34_t rotationMatrix; 15 | }; 16 | 17 | void OnPoseUpdated(uint64_t targetTimestampNs, FfiDeviceMotion motion); 18 | 19 | std::optional GetBestPoseMatch(const vr::HmdMatrix34_t& pose) const; 20 | // Return the most recent pose known at the given timestamp 21 | std::optional GetPoseAt(uint64_t timestampNs) const; 22 | 23 | void SetTransform(const vr::HmdMatrix34_t& transform); 24 | 25 | private: 26 | mutable std::mutex m_mutex; 27 | std::list m_poseBuffer; 28 | vr::HmdMatrix34_t m_transform 29 | = { { { 1.0, 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0 } } }; 30 | bool m_transformIdentity = true; 31 | }; 32 | -------------------------------------------------------------------------------- /alvr/xtask/patches/0001-lavu-hwcontext_vulkan-Fix-importing-RGBx-frames-to-C.patch: -------------------------------------------------------------------------------- 1 | From f867c4c56ee75d633db2300c0822bfa0020a056e Mon Sep 17 00:00:00 2001 2 | From: David Rosca 3 | Date: Tue, 28 Nov 2023 14:04:20 +0100 4 | Subject: [PATCH] lavu/hwcontext_vulkan: Fix importing RGBx frames to CUDA 5 | 6 | RGBx formats needs NumChannels = 4, but the old code would set it to 1. 7 | --- 8 | libavutil/hwcontext_vulkan.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c 12 | index 204b57c011..e3bd6ace9b 100644 13 | --- a/libavutil/hwcontext_vulkan.c 14 | +++ b/libavutil/hwcontext_vulkan.c 15 | @@ -2859,7 +2859,7 @@ static int vulkan_export_to_cuda(AVHWFramesContext *hwfc, 16 | .arrayDesc = { 17 | .Depth = 0, 18 | .Format = cufmt, 19 | - .NumChannels = 1 + ((planes == 2) && i), 20 | + .NumChannels = desc->comp[i].step, 21 | .Flags = 0, 22 | }, 23 | .numLevels = 1, 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType extend 7 | ( 8 | genType const& Origin, 9 | genType const& Source, 10 | genType const& Distance 11 | ) 12 | { 13 | return Origin + (Source - Origin) * Distance; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<2, T, Q> extend 18 | ( 19 | vec<2, T, Q> const& Origin, 20 | vec<2, T, Q> const& Source, 21 | T const& Distance 22 | ) 23 | { 24 | return Origin + (Source - Origin) * Distance; 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER vec<3, T, Q> extend 29 | ( 30 | vec<3, T, Q> const& Origin, 31 | vec<3, T, Q> const& Source, 32 | T const& Distance 33 | ) 34 | { 35 | return Origin + (Source - Origin) * Distance; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER vec<4, T, Q> extend 40 | ( 41 | vec<4, T, Q> const& Origin, 42 | vec<4, T, Q> const& Source, 43 | T const& Distance 44 | ) 45 | { 46 | return Origin + (Source - Origin) * Distance; 47 | } 48 | }//namespace glm 49 | -------------------------------------------------------------------------------- /alvr/common/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2021 alvr-org 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /alvr/xtask/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2024 alvr-org 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /alvr/client_core/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2024 alvr-org 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/basic_components/switch.rs: -------------------------------------------------------------------------------- 1 | use eframe::egui::{self, Response, Sense, Ui, WidgetInfo, WidgetType}; 2 | 3 | pub fn switch(ui: &mut Ui, on: &mut bool) -> Response { 4 | let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0, 1.0); 5 | let (rect, mut response) = ui.allocate_exact_size(desired_size, Sense::click()); 6 | if response.clicked() { 7 | *on = !*on; 8 | response.mark_changed(); 9 | } 10 | response.widget_info(|| WidgetInfo::selected(WidgetType::Checkbox, true, *on, "")); 11 | 12 | let how_on = ui.ctx().animate_bool(response.id, *on); 13 | let visuals = ui.style().interact_selectable(&response, *on); 14 | let rect = rect.expand(visuals.expansion); 15 | let radius = 0.5 * rect.height(); 16 | ui.painter() 17 | .rect(rect, radius, visuals.bg_fill, visuals.bg_stroke); 18 | let circle_x = egui::lerp((rect.left() + radius)..=(rect.right() - radius), how_on); 19 | let center = egui::pos2(circle_x, rect.center().y); 20 | ui.painter() 21 | .circle(center, 0.75 * radius, visuals.bg_fill, visuals.fg_stroke); 22 | 23 | response 24 | } 25 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/bindings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct FfiViewInput { 4 | float orientation[4]; // x, y, z, w 5 | float position[3]; 6 | float fovLeft; 7 | float fovRight; 8 | float fovUp; 9 | float fovDown; 10 | unsigned int swapchainIndex; 11 | }; 12 | 13 | struct FfiStreamConfig { 14 | unsigned int viewWidth; 15 | unsigned int viewHeight; 16 | const unsigned int *swapchainTextures[2]; 17 | unsigned int swapchainLength; 18 | unsigned int enableFoveation; 19 | float foveationCenterSizeX; 20 | float foveationCenterSizeY; 21 | float foveationCenterShiftX; 22 | float foveationCenterShiftY; 23 | float foveationEdgeRatioX; 24 | float foveationEdgeRatioY; 25 | unsigned int enableSrgbCorrection; 26 | unsigned int fixLimitedRange; 27 | float encodingGamma; 28 | }; 29 | 30 | // graphics.h 31 | extern "C" void initGraphicsNative(); 32 | extern "C" void destroyStream(); 33 | extern "C" void streamStartNative(FfiStreamConfig config); 34 | extern "C" void renderStreamNative(void *streamHardwareBuffer, 35 | const unsigned int swapchainIndices[2]); 36 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/about.rs: -------------------------------------------------------------------------------- 1 | use alvr_common::ALVR_VERSION; 2 | use alvr_gui_common::theme; 3 | use eframe::egui::{self, Frame, RichText, ScrollArea, Ui}; 4 | 5 | pub fn about_tab_ui(ui: &mut Ui) { 6 | ui.label(RichText::new(format!("ALVR streamer v{}", *ALVR_VERSION)).size(30.0)); 7 | ui.add_space(10.0); 8 | ui.hyperlink_to("Visit us on GitHub", "https://github.com/alvr-org/ALVR"); 9 | ui.hyperlink_to("Join us on Discord", "https://discord.gg/ALVR"); 10 | ui.hyperlink_to( 11 | "Latest release", 12 | "https://github.com/alvr-org/ALVR/releases/latest", 13 | ); 14 | ui.hyperlink_to( 15 | "Donate to ALVR on Open Collective", 16 | "https://opencollective.com/alvr", 17 | ); 18 | ui.add_space(10.0); 19 | ui.label("License:"); 20 | Frame::group(ui.style()) 21 | .fill(theme::DARKER_BG) 22 | .inner_margin(egui::vec2(15.0, 12.0)) 23 | .show(ui, |ui| { 24 | ScrollArea::new([false, true]) 25 | .id_source("license_scroll") 26 | .show(ui, |ui| ui.label(include_str!("../../../../../LICENSE"))) 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /alvr/client_core/src/sockets.rs: -------------------------------------------------------------------------------- 1 | use crate::platform; 2 | use alvr_common::anyhow::{bail, Result}; 3 | use mdns_sd::{ServiceDaemon, ServiceInfo}; 4 | 5 | pub struct AnnouncerSocket { 6 | hostname: String, 7 | daemon: ServiceDaemon, 8 | } 9 | 10 | impl AnnouncerSocket { 11 | pub fn new(hostname: &str) -> Result { 12 | let daemon = ServiceDaemon::new()?; 13 | 14 | Ok(Self { 15 | daemon, 16 | hostname: hostname.to_owned(), 17 | }) 18 | } 19 | 20 | pub fn announce(&self) -> Result<()> { 21 | let local_ip = platform::local_ip(); 22 | if local_ip.is_unspecified() { 23 | bail!("IP is unspecified"); 24 | } 25 | 26 | self.daemon.register(ServiceInfo::new( 27 | alvr_sockets::MDNS_SERVICE_TYPE, 28 | &format!("alvr{}", rand::random::()), 29 | &self.hostname, 30 | local_ip, 31 | 5353, 32 | &[( 33 | alvr_sockets::MDNS_PROTOCOL_KEY, 34 | alvr_common::protocol_id().as_str(), 35 | )][..], 36 | )?)?; 37 | 38 | Ok(()) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2019 polygraphene 2 | Copyright (c) 2020-2024 alvr-org 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/matrix_common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_matrix_common 2 | /// @file glm/ext/matrix_common.hpp 3 | /// 4 | /// @defgroup ext_matrix_common GLM_EXT_matrix_common 5 | /// @ingroup ext 6 | /// 7 | /// Defines functions for common matrix operations. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_matrix_common 12 | 13 | #pragma once 14 | 15 | #include "../detail/qualifier.hpp" 16 | #include "../detail/_fixes.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_matrix_transform extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_matrix_common 25 | /// @{ 26 | 27 | template 28 | GLM_FUNC_DECL mat mix(mat const& x, mat const& y, mat const& a); 29 | 30 | template 31 | GLM_FUNC_DECL mat mix(mat const& x, mat const& y, U a); 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "matrix_common.inl" 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_float.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float 2 | /// @file glm/ext/quaternion_float.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float GLM_EXT_quaternion_float 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_double 12 | /// @see ext_quaternion_float_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_float extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_float 32 | /// @{ 33 | 34 | /// Quaternion of single-precision floating-point numbers. 35 | typedef qua quat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Arm Limited. 2 | Copyright (c) 2021-2024 alvr-org 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /wiki/My-game-is-not-working-properly!-Help!.md: -------------------------------------------------------------------------------- 1 | While most games do work without any problems, some do only work partially or not at all. This includes 2 | 3 | - headset not found 4 | - warped image 5 | - controller not tracking 6 | - buttons not working 7 | - ... 8 | 9 | Most of the time its the overly specific initialization of the game towards a specific headset that breaks the game. 10 | For example, Vivecraft broke because ALVR reported the headset manufacturer as "Oculus driver 1.38.0" and not as "Oculus". 11 | In general, this is a rather bad practice as all relevant data can be accessed trough SteamVR and the game should not make assumptions based on the manufacturer of the hmd. There are many different fields that a game could require to run. 12 | 13 | Nonetheless, we want to play and support those games. 14 | Problem is, that we don't own all games. This is a Open Source without any funding. We can not buy any games just to fix a bug. In the case of Vivecraft, one user (thanks @Avencore) was generous to gift us a copy and the bug could be fixed. 15 | There are no guaranties! Neither on the time it will take nor if the bug will ever be fixed! Please contact us before buying anything. 16 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_double.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_double 2 | /// @file glm/ext/quaternion_double.hpp 3 | /// 4 | /// @defgroup ext_quaternion_double GLM_EXT_quaternion_double 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_float 12 | /// @see ext_quaternion_double_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_double extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_double 32 | /// @{ 33 | 34 | /// Quaternion of double-precision floating-point numbers. 35 | typedef qua dquat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /alvr/server_openvr/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2019 polygraphene 2 | Copyright (c) 2020-2024 alvr-org 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_relational.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y) 5 | { 6 | vec<4, bool, Q> Result; 7 | for(length_t i = 0; i < x.length(); ++i) 8 | Result[i] = x[i] == y[i]; 9 | return Result; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y, T epsilon) 14 | { 15 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 16 | return lessThan(abs(v), vec<4, T, Q>(epsilon)); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y) 21 | { 22 | vec<4, bool, Q> Result; 23 | for(length_t i = 0; i < x.length(); ++i) 24 | Result[i] = x[i] != y[i]; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y, T epsilon) 30 | { 31 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 32 | return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon)); 33 | } 34 | }//namespace glm 35 | 36 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/scalar_constants.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_scalar_constants 2 | /// @file glm/ext/scalar_constants.hpp 3 | /// 4 | /// @defgroup ext_scalar_constants GLM_EXT_scalar_constants 5 | /// @ingroup ext 6 | /// 7 | /// Provides a list of constants and precomputed useful values. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependencies 14 | #include "../detail/setup.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_scalar_constants extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_scalar_constants 23 | /// @{ 24 | 25 | /// Return the epsilon constant for floating point types. 26 | template 27 | GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon(); 28 | 29 | /// Return the pi constant for floating point types. 30 | template 31 | GLM_FUNC_DECL GLM_CONSTEXPR genType pi(); 32 | 33 | /// Return the value of cos(1 / 2) for floating point types. 34 | template 35 | GLM_FUNC_DECL GLM_CONSTEXPR genType cos_one_over_two(); 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | #include "scalar_constants.inl" 41 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/driverlog.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation ============// 2 | 3 | #include "driverlog.h" 4 | 5 | #include 6 | #include 7 | 8 | static vr::IVRDriverLog* s_pLogFile = NULL; 9 | 10 | #if !defined(WIN32) 11 | #define vsnprintf_s vsnprintf 12 | #endif 13 | 14 | bool InitDriverLog(vr::IVRDriverLog* pDriverLog) { 15 | if (s_pLogFile) 16 | return false; 17 | s_pLogFile = pDriverLog; 18 | return s_pLogFile != NULL; 19 | } 20 | 21 | void CleanupDriverLog() { s_pLogFile = NULL; } 22 | 23 | void DriverLogVarArgs(const char* pMsgFormat, va_list args) { 24 | char buf[1024]; 25 | vsnprintf_s(buf, sizeof(buf), pMsgFormat, args); 26 | 27 | if (s_pLogFile) 28 | s_pLogFile->Log(buf); 29 | } 30 | 31 | void DriverLog(const char* pMsgFormat, ...) { 32 | va_list args; 33 | va_start(args, pMsgFormat); 34 | 35 | DriverLogVarArgs(pMsgFormat, args); 36 | 37 | va_end(args); 38 | } 39 | 40 | void DebugDriverLog(const char* pMsgFormat, ...) { 41 | #ifdef _DEBUG 42 | va_list args; 43 | va_start(args, pMsgFormat); 44 | 45 | DriverLogVarArgs(pMsgFormat, args); 46 | 47 | va_end(args); 48 | #else 49 | (void)pMsgFormat; 50 | #endif 51 | } 52 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Compute the normal of a triangle. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 20 | # ifndef GLM_ENABLE_EXPERIMENTAL 21 | # pragma message("GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 22 | # else 23 | # pragma message("GLM: GLM_GTX_normal extension included") 24 | # endif 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normal 30 | /// @{ 31 | 32 | /// Computes triangle normal from triangle points. 33 | /// 34 | /// @see gtx_normal 35 | template 36 | GLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "normal.inl" 42 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/win32/VideoEncoderNVENC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "NvEncoderD3D11.h" 4 | #include "VideoEncoder.h" 5 | #include "shared/d3drender.h" 6 | #include 7 | 8 | enum AdaptiveQuantizationMode { SpatialAQ = 1, TemporalAQ = 2 }; 9 | 10 | // Video encoder for NVIDIA NvEnc. 11 | class VideoEncoderNVENC : public VideoEncoder { 12 | public: 13 | VideoEncoderNVENC(std::shared_ptr pD3DRender, int width, int height); 14 | ~VideoEncoderNVENC(); 15 | 16 | void Initialize(); 17 | void Shutdown(); 18 | 19 | void Transmit( 20 | ID3D11Texture2D* pTexture, 21 | uint64_t presentationTime, 22 | uint64_t targetTimestampNs, 23 | bool insertIDR 24 | ); 25 | 26 | private: 27 | void FillEncodeConfig( 28 | NV_ENC_INITIALIZE_PARAMS& initializeParams, 29 | int refreshRate, 30 | int renderWidth, 31 | int renderHeight, 32 | uint64_t bitrate_bps 33 | ); 34 | 35 | std::ofstream fpOut; 36 | std::shared_ptr m_NvNecoder; 37 | 38 | std::shared_ptr m_pD3DRender; 39 | 40 | int m_codec; 41 | int m_refreshRate; 42 | int m_renderWidth; 43 | int m_renderHeight; 44 | int m_bitrateInMBits; 45 | }; 46 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Mixed product of 3 vectors. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # else 22 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_mixed_product 29 | /// @{ 30 | 31 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 32 | template 33 | GLM_FUNC_DECL T mixedProduct( 34 | vec<3, T, Q> const& v1, 35 | vec<3, T, Q> const& v2, 36 | vec<3, T, Q> const& v3); 37 | 38 | /// @} 39 | }// namespace glm 40 | 41 | #include "mixed_product.inl" 42 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_uint1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1_precision 2 | /// @file glm/ext/vector_uint1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1_precision GLM_EXT_vector_uint1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_uvec1, mediump_uvec1 and lowp_uvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_uint1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_uint1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of unsigned integer values. 25 | /// 26 | /// @see ext_vector_uint1_precision 27 | typedef vec<1, unsigned int, highp> highp_uvec1; 28 | 29 | /// 1 component vector of unsigned integer values. 30 | /// 31 | /// @see ext_vector_uint1_precision 32 | typedef vec<1, unsigned int, mediump> mediump_uvec1; 33 | 34 | /// 1 component vector of unsigned integer values. 35 | /// 36 | /// @see ext_vector_uint1_precision 37 | typedef vec<1, unsigned int, lowp> lowp_uvec1; 38 | 39 | /// @} 40 | }//namespace glm 41 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # else 22 | # pragma message("GLM: GLM_GTX_extend extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_extend 29 | /// @{ 30 | 31 | /// Extends of Length the Origin position using the (Source - Origin) direction. 32 | /// @see gtx_extend 33 | template 34 | GLM_FUNC_DECL genType extend( 35 | genType const& Origin, 36 | genType const& Source, 37 | typename genType::value_type const Length); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "extend.inl" 43 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/presets/mod.rs: -------------------------------------------------------------------------------- 1 | mod higher_order_choice; 2 | mod mirror; 3 | 4 | pub mod builtin_schema; 5 | pub mod schema; 6 | 7 | use self::schema::PresetSchemaNode; 8 | use alvr_packets::PathValuePair; 9 | use eframe::egui::Ui; 10 | use serde_json as json; 11 | 12 | pub enum PresetControl { 13 | HigherOrderChoice(higher_order_choice::Control), 14 | // Mirror(...) 15 | } 16 | 17 | impl PresetControl { 18 | pub fn new(schema: PresetSchemaNode) -> Self { 19 | match schema { 20 | PresetSchemaNode::HigherOrderChoice(schema) => { 21 | Self::HigherOrderChoice(higher_order_choice::Control::new(schema)) 22 | } 23 | PresetSchemaNode::Mirror(_) => unimplemented!(), 24 | } 25 | } 26 | 27 | pub fn update_session_settings(&mut self, session_settings_json: &json::Value) { 28 | match self { 29 | Self::HigherOrderChoice(control) => { 30 | control.update_session_settings(session_settings_json) 31 | } 32 | } 33 | } 34 | 35 | pub fn ui(&mut self, ui: &mut Ui) -> Vec { 36 | match self { 37 | Self::HigherOrderChoice(control) => control.ui(ui), 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /alvr/dashboard/src/dashboard/components/settings_controls/presets/schema.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use serde_json as json; 3 | use settings_schema::ChoiceControlType; 4 | use std::collections::{HashMap, HashSet}; 5 | 6 | #[derive(Serialize, Deserialize, Clone)] 7 | pub enum PresetModifierOperation { 8 | Assign(json::Value), 9 | } 10 | 11 | #[derive(Serialize, Deserialize)] 12 | pub struct PresetModifier { 13 | // session-style path 14 | pub target_path: String, 15 | pub operation: PresetModifierOperation, 16 | } 17 | 18 | #[derive(Serialize, Deserialize)] 19 | pub struct HigherOrderChoiceOption { 20 | pub display_name: String, 21 | pub modifiers: Vec, 22 | pub content: Option, 23 | } 24 | 25 | #[derive(Serialize, Deserialize)] 26 | pub struct HigherOrderChoiceSchema { 27 | pub name: String, 28 | pub strings: HashMap, 29 | pub flags: HashSet, 30 | pub options: Vec, 31 | pub default_option_index: usize, 32 | pub gui: ChoiceControlType, 33 | } 34 | 35 | #[derive(Serialize, Deserialize)] 36 | pub enum PresetSchemaNode { 37 | HigherOrderChoice(HigherOrderChoiceSchema), 38 | 39 | // session-style path 40 | Mirror(String), 41 | } 42 | -------------------------------------------------------------------------------- /alvr/common/src/average.rs: -------------------------------------------------------------------------------- 1 | use std::{collections::VecDeque, time::Duration}; 2 | 3 | pub struct SlidingWindowAverage { 4 | history_buffer: VecDeque, 5 | max_history_size: usize, 6 | } 7 | 8 | impl SlidingWindowAverage { 9 | pub fn new(initial_value: T, max_history_size: usize) -> Self { 10 | Self { 11 | history_buffer: [initial_value].into_iter().collect(), 12 | max_history_size, 13 | } 14 | } 15 | 16 | pub fn submit_sample(&mut self, sample: T) { 17 | if self.history_buffer.len() >= self.max_history_size { 18 | self.history_buffer.pop_front(); 19 | } 20 | 21 | self.history_buffer.push_back(sample); 22 | } 23 | 24 | pub fn retain(&mut self, count: usize) { 25 | self.history_buffer 26 | .drain(0..self.history_buffer.len().saturating_sub(count)); 27 | } 28 | } 29 | 30 | impl SlidingWindowAverage { 31 | pub fn get_average(&self) -> f32 { 32 | self.history_buffer.iter().sum::() / self.history_buffer.len() as f32 33 | } 34 | } 35 | 36 | impl SlidingWindowAverage { 37 | pub fn get_average(&self) -> Duration { 38 | self.history_buffer.iter().sum::() / self.history_buffer.len() as u32 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /alvr/common/src/primitives.rs: -------------------------------------------------------------------------------- 1 | use std::ops::Mul; 2 | 3 | use glam::{Quat, Vec3}; 4 | use serde::{Deserialize, Serialize}; 5 | 6 | pub use glam; 7 | 8 | // Field of view in radians 9 | #[derive(Serialize, Deserialize, PartialEq, Default, Debug, Clone, Copy)] 10 | pub struct Fov { 11 | pub left: f32, 12 | pub right: f32, 13 | pub up: f32, 14 | pub down: f32, 15 | } 16 | 17 | #[derive(Serialize, Deserialize, Clone, Copy, Default, Debug)] 18 | pub struct Pose { 19 | pub orientation: Quat, // NB: default Quat is identity 20 | pub position: Vec3, 21 | } 22 | 23 | impl Pose { 24 | pub fn inverse(&self) -> Pose { 25 | Pose { 26 | orientation: self.orientation.conjugate(), 27 | position: -self.position, 28 | } 29 | } 30 | } 31 | 32 | impl Mul for Pose { 33 | type Output = Pose; 34 | 35 | fn mul(self, rhs: Pose) -> Pose { 36 | Pose { 37 | orientation: self.orientation * rhs.orientation, 38 | position: self.position + self.orientation * rhs.position, 39 | } 40 | } 41 | } 42 | 43 | #[derive(Serialize, Deserialize, Clone, Copy, Default, Debug)] 44 | pub struct DeviceMotion { 45 | pub pose: Pose, 46 | pub linear_velocity: Vec3, 47 | pub angular_velocity: Vec3, 48 | } 49 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/shader/rgbtoyuv420.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer YUVParams { 2 | float4 offset; 3 | float4 yCoeff; 4 | float4 uCoeff; 5 | float4 vCoeff; 6 | 7 | float renderWidth; 8 | float renderHeight; 9 | float _padding0; 10 | float _padding1; 11 | }; 12 | 13 | Texture2D sourceTexture; 14 | 15 | struct PS_OUTPUT 16 | { 17 | float4 plane_Y: SV_Target0; 18 | float4 plane_UV: SV_Target1; 19 | }; 20 | 21 | SamplerState bilinearSampler { 22 | Filter = MIN_MAG_LINEAR_MIP_POINT; 23 | AddressU = CLAMP; 24 | AddressV = CLAMP; 25 | }; 26 | 27 | PS_OUTPUT main(float2 uv : TEXCOORD0) { 28 | PS_OUTPUT output; 29 | 30 | uint2 uvTexels = uint2(uv * float2(renderWidth, renderHeight)); 31 | 32 | // Y @ 1x for YUV420 33 | float3 point1 = sourceTexture.Sample(bilinearSampler, uv).rgb; 34 | float y = dot(point1, yCoeff.rgb) + offset.x; 35 | 36 | // UV @ 1/2x for YUV420 37 | float2 image_uv = float2((uvTexels.x * 2) % renderWidth / renderWidth, (uvTexels.y * 2) % renderHeight / renderHeight); 38 | float3 point2 = sourceTexture.Sample(bilinearSampler, image_uv).rgb; 39 | float u = dot(point2, uCoeff.rgb) + offset.y; 40 | float v = dot(point2, vCoeff.rgb) + offset.z; 41 | 42 | output.plane_Y = float4(y, 0, 0, 1); 43 | output.plane_UV = float4(u, v, 0, 1); 44 | 45 | return output; 46 | } -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # else 22 | # pragma message("GLM: GLM_GTX_projection extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_projection 29 | /// @{ 30 | 31 | /// Projects x on Normal. 32 | /// 33 | /// @param[in] x A vector to project 34 | /// @param[in] Normal A normal that doesn't need to be of unit length. 35 | /// 36 | /// @see gtx_projection 37 | template 38 | GLM_FUNC_DECL genType proj(genType const& x, genType const& Normal); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "projection.inl" 44 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/shared/backward.cpp: -------------------------------------------------------------------------------- 1 | // Pick your poison. 2 | // 3 | // On GNU/Linux, you have few choices to get the most out of your stack trace. 4 | // 5 | // By default you get: 6 | // - object filename 7 | // - function name 8 | // 9 | // In order to add: 10 | // - source filename 11 | // - line and column numbers 12 | // - source code snippet (assuming the file is accessible) 13 | 14 | // Install one of the following libraries then uncomment one of the macro (or 15 | // better, add the detection of the lib and the macro definition in your build 16 | // system) 17 | 18 | // - apt-get install libdw-dev ... 19 | // - g++/clang++ -ldw ... 20 | // #define BACKWARD_HAS_DW 1 21 | 22 | // - apt-get install binutils-dev ... 23 | // - g++/clang++ -lbfd ... 24 | // #define BACKWARD_HAS_BFD 1 25 | 26 | // - apt-get install libdwarf-dev ... 27 | // - g++/clang++ -ldwarf ... 28 | // #define BACKWARD_HAS_DWARF 1 29 | 30 | // Regardless of the library you choose to read the debug information, 31 | // for potentially more detailed stack traces you can use libunwind 32 | // - apt-get install libunwind-dev 33 | // - g++/clang++ -lunwind 34 | // #define BACKWARD_HAS_LIBUNWIND 1 35 | 36 | #include "backward.hpp" 37 | 38 | namespace backward { 39 | 40 | backward::SignalHandling sh; 41 | 42 | } // namespace backward 43 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Perpendicular of a vector from other one 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # ifndef GLM_ENABLE_EXPERIMENTAL 22 | # pragma message("GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 23 | # else 24 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 25 | # endif 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_perpendicular 31 | /// @{ 32 | 33 | //! Projects x a perpendicular axis of Normal. 34 | //! From GLM_GTX_perpendicular extension. 35 | template 36 | GLM_FUNC_DECL genType perp(genType const& x, genType const& Normal); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "perpendicular.inl" 42 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | #include "../common.hpp" 2 | #include "../ext/scalar_int_sized.hpp" 3 | #include "../ext/scalar_uint_sized.hpp" 4 | #include "../detail/type_float.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon) 10 | { 11 | return abs(x - y) <= epsilon; 12 | } 13 | 14 | template 15 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon) 16 | { 17 | return abs(x - y) > epsilon; 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, int MaxULPs) 22 | { 23 | detail::float_t const a(x); 24 | detail::float_t const b(y); 25 | 26 | // Different signs means they do not match. 27 | if(a.negative() != b.negative()) 28 | return false; 29 | 30 | // Find the difference in ULPs. 31 | typename detail::float_t::int_type const DiffULPs = abs(a.i - b.i); 32 | return DiffULPs <= MaxULPs; 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, int ULPs) 37 | { 38 | return !equal(x, y, ULPs); 39 | } 40 | }//namespace glm 41 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_float1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1_precision 2 | /// @file glm/ext/vector_float1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_float1_precision GLM_EXT_vector_float1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_vec1, mediump_vec1 and lowp_vec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1 extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_float1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_float1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, float, highp> highp_vec1; 28 | 29 | /// 1 component vector of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, float, mediump> mediump_vec1; 31 | 32 | /// 1 component vector of single-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, float, lowp> lowp_vec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_float_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float_precision 2 | /// @file glm/ext/quaternion_float_precision.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type with various precision in term of ULPs. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependency: 14 | #include "../detail/type_quat.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_quaternion_float_precision extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_quaternion_float_precision 23 | /// @{ 24 | 25 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 26 | typedef qua lowp_quat; 27 | 28 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 29 | typedef qua mediump_quat; 30 | 31 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 32 | typedef qua highp_quat; 33 | 34 | /// @} 35 | } //namespace glm 36 | 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_double1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1_precision 2 | /// @file glm/ext/vector_double1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_double1_precision GLM_EXT_vector_double1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_dvec1, mediump_dvec1 and lowp_dvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_double1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_double1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of double-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, double, highp> highp_dvec1; 28 | 29 | /// 1 component vector of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, double, mediump> mediump_dvec1; 31 | 32 | /// 1 component vector of double-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, double, lowp> lowp_dvec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine 7 | ( 8 | vec<3, T, Q> const& point, 9 | vec<3, T, Q> const& a, 10 | vec<3, T, Q> const& b 11 | ) 12 | { 13 | T LineLength = distance(a, b); 14 | vec<3, T, Q> Vector = point - a; 15 | vec<3, T, Q> LineDirection = (b - a) / LineLength; 16 | 17 | // Project Vector to LineDirection to get the distance of point from a 18 | T Distance = dot(Vector, LineDirection); 19 | 20 | if(Distance <= T(0)) return a; 21 | if(Distance >= LineLength) return b; 22 | return a + LineDirection * Distance; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine 27 | ( 28 | vec<2, T, Q> const& point, 29 | vec<2, T, Q> const& a, 30 | vec<2, T, Q> const& b 31 | ) 32 | { 33 | T LineLength = distance(a, b); 34 | vec<2, T, Q> Vector = point - a; 35 | vec<2, T, Q> LineDirection = (b - a) / LineLength; 36 | 37 | // Project Vector to LineDirection to get the distance of point from a 38 | T Distance = dot(Vector, LineDirection); 39 | 40 | if(Distance <= T(0)) return a; 41 | if(Distance >= LineLength) return b; 42 | return a + LineDirection * Distance; 43 | } 44 | 45 | }//namespace glm 46 | -------------------------------------------------------------------------------- /alvr/xtask/wix/bundle.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 12 | 13 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /wiki/ALVR-Checklist.md: -------------------------------------------------------------------------------- 1 | ## Hardware Requirements 2 | 3 | * [ ] Intel Core i5-4590/AMD FX 8350 equivalent or better 4 | * [ ] At least 4GB of Ram 5 | * [ ] NVIDIA GeForce GTX 970, AMD Radeon R9 290 equivalent or better 6 | * [ ] A 5Ghz router/access point or my PC can create its own 5Ghz hotspot 7 | 8 | ## Network settings 9 | 10 | * [ ] My PC has a wired connection to the router/access point 11 | * [ ] The access point is placed in sight of my designated playspace without any obstructions 12 | * [ ] I'm using the 5ghz antenna of the router/access point 13 | * [ ] No one else is using the router/access point 14 | * [ ] I'm the only user of the 5Ghz channel of the router/access point. No one else is using the same channel in the vicinity 15 | * [ ] The 5Ghz and 2.4Ghz parts of the access point have different SSIDs to prevent switching to 2.4ghz 16 | 17 | ## Software settings 18 | 19 | * [ ] I have the latest Windows 10 updates 20 | * [ ] I have a recent version of SteamVR 21 | 22 | ## Troubleshooting 23 | 24 | * [ ] The firewall settings where successfully applied with the setup of ALVR 25 | * [ ] I did not change the network settings since the installation of ALVR (Private/Public/Work) 26 | * [ ] I did not move the installation folder of ALVR since the setup 27 | * [ ] The path to the folder of ALVR does not contain any non latin characters or accents (ツ Л Ö ...) 28 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/matrix_transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_transform 2 | /// @file glm/gtc/matrix_transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_transform 6 | /// @see gtx_transform2 7 | /// 8 | /// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform 9 | /// @ingroup gtc 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Defines functions that generate common transformation matrices. 14 | /// 15 | /// The matrices generated by this extension use standard OpenGL fixed-function 16 | /// conventions. For example, the lookAt function generates a transform from world 17 | /// space into the specific eye space that the projective matrix functions 18 | /// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility 19 | /// specifications defines the particular layout of this eye space. 20 | 21 | #pragma once 22 | 23 | // Dependencies 24 | #include "../mat4x4.hpp" 25 | #include "../vec2.hpp" 26 | #include "../vec3.hpp" 27 | #include "../vec4.hpp" 28 | #include "../ext/matrix_projection.hpp" 29 | #include "../ext/matrix_clip_space.hpp" 30 | #include "../ext/matrix_transform.hpp" 31 | 32 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 33 | # pragma message("GLM: GLM_GTC_matrix_transform extension included") 34 | #endif 35 | 36 | #include "matrix_transform.inl" 37 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/alvr_server/ViveTrackerProxy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Hmd; 6 | 7 | class ViveTrackerProxy final : public vr::ITrackedDeviceServerDriver { 8 | vr::TrackedDeviceIndex_t m_unObjectId; 9 | Hmd* m_HMDOwner; 10 | 11 | public: 12 | ViveTrackerProxy(Hmd& owner); 13 | 14 | ViveTrackerProxy(const ViveTrackerProxy&) = delete; 15 | ViveTrackerProxy& operator=(const ViveTrackerProxy&) = delete; 16 | 17 | constexpr inline const char* GetSerialNumber() const { return "ALVR HMD Tracker Proxy"; } 18 | 19 | virtual vr::EVRInitError Activate(vr::TrackedDeviceIndex_t unObjectId) override; 20 | 21 | virtual inline void Deactivate() override { m_unObjectId = vr::k_unTrackedDeviceIndexInvalid; } 22 | 23 | virtual inline void EnterStandby() override { } 24 | virtual inline void* GetComponent(const char* /*pchComponentNameAndVersion*/) override { 25 | // override this to add a component to a driver 26 | return nullptr; 27 | } 28 | 29 | virtual inline void DebugRequest( 30 | const char* /*pchRequest*/, char* pchResponseBuffer, uint32_t unResponseBufferSize 31 | ) override { 32 | if (unResponseBufferSize >= 1) 33 | pchResponseBuffer[0] = 0; 34 | } 35 | 36 | virtual vr::DriverPose_t GetPose() override; 37 | 38 | void update(); 39 | }; 40 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/quaternion_geometric.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER T dot(qua const& x, qua const& y) 5 | { 6 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); 7 | return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); 8 | } 9 | 10 | template 11 | GLM_FUNC_QUALIFIER T length(qua const& q) 12 | { 13 | return glm::sqrt(dot(q, q)); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER qua normalize(qua const& q) 18 | { 19 | T len = length(q); 20 | if(len <= static_cast(0)) // Problem 21 | return qua(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); 22 | T oneOverLen = static_cast(1) / len; 23 | return qua(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2) 28 | { 29 | return qua( 30 | q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, 31 | q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, 32 | q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, 33 | q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); 34 | } 35 | }//namespace glm 36 | 37 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Logarithm for any base. base can be a vector or a scalar. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # ifndef GLM_ENABLE_EXPERIMENTAL 20 | # pragma message("GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 21 | # else 22 | # pragma message("GLM: GLM_GTX_log_base extension included") 23 | # endif 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_log_base 29 | /// @{ 30 | 31 | /// Logarithm for any base. 32 | /// From GLM_GTX_log_base. 33 | template 34 | GLM_FUNC_DECL genType log( 35 | genType const& x, 36 | genType const& base); 37 | 38 | /// Logarithm for any base. 39 | /// From GLM_GTX_log_base. 40 | template 41 | GLM_FUNC_DECL vec sign( 42 | vec const& x, 43 | vec const& base); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "log_base.inl" 49 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/EncodePipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "alvr_server/bindings.h" 3 | #include 4 | #include 5 | #include 6 | 7 | extern "C" struct AVCodecContext; 8 | extern "C" struct AVPacket; 9 | 10 | class Renderer; 11 | 12 | namespace alvr { 13 | 14 | class VkFrame; 15 | class VkFrameCtx; 16 | class VkContext; 17 | 18 | struct FramePacket { 19 | uint8_t* data; 20 | int size; 21 | uint64_t pts; 22 | bool isIDR; 23 | }; 24 | 25 | class EncodePipeline { 26 | public: 27 | struct Timestamp { 28 | uint64_t gpu = 0; 29 | uint64_t cpu = 0; 30 | }; 31 | 32 | virtual ~EncodePipeline(); 33 | 34 | virtual void PushFrame(uint64_t targetTimestampNs, bool idr) = 0; 35 | virtual bool GetEncoded(FramePacket& data); 36 | virtual Timestamp GetTimestamp() { return timestamp; } 37 | virtual int GetCodec(); 38 | 39 | virtual void SetParams(FfiDynamicEncoderParams params); 40 | static std::unique_ptr Create( 41 | Renderer* render, 42 | VkContext& vk_ctx, 43 | VkFrame& input_frame, 44 | VkFrameCtx& vk_frame_ctx, 45 | uint32_t width, 46 | uint32_t height 47 | ); 48 | 49 | protected: 50 | AVCodecContext* encoder_ctx = nullptr; // shall be initialized by child class 51 | AVPacket* encoder_packet = NULL; 52 | Timestamp timestamp = {}; 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /alvr/server_openvr/cpp/platform/linux/FrameRender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Renderer.h" 4 | #include "ffmpeg_helper.h" 5 | #include "protocol.h" 6 | 7 | class FrameRender : public Renderer { 8 | public: 9 | explicit FrameRender(alvr::VkContext& ctx, init_packet& init, int fds[]); 10 | ~FrameRender(); 11 | 12 | Output CreateOutput(); 13 | uint32_t GetEncodingWidth() const; 14 | uint32_t GetEncodingHeight() const; 15 | 16 | private: 17 | struct ColorCorrection { 18 | float renderWidth; 19 | float renderHeight; 20 | float brightness; 21 | float contrast; 22 | float saturation; 23 | float gamma; 24 | float sharpening; 25 | }; 26 | 27 | struct FoveationVars { 28 | float eyeWidthRatio; 29 | float eyeHeightRatio; 30 | float centerSizeX; 31 | float centerSizeY; 32 | float centerShiftX; 33 | float centerShiftY; 34 | float edgeRatioX; 35 | float edgeRatioY; 36 | }; 37 | 38 | void setupColorCorrection(); 39 | void setupFoveatedRendering(); 40 | void setupCustomShaders(const std::string& stage); 41 | 42 | uint32_t m_width; 43 | uint32_t m_height; 44 | ExternalHandle m_handle = ExternalHandle::None; 45 | ColorCorrection m_colorCorrectionConstants; 46 | FoveationVars m_foveatedRenderingConstants; 47 | std::vector m_pipelines; 48 | }; 49 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType row 7 | ( 8 | genType const& m, 9 | length_t index, 10 | typename genType::row_type const& x 11 | ) 12 | { 13 | assert(index >= 0 && index < m[0].length()); 14 | 15 | genType Result = m; 16 | for(length_t i = 0; i < m.length(); ++i) 17 | Result[i][index] = x[i]; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::row_type row 23 | ( 24 | genType const& m, 25 | length_t index 26 | ) 27 | { 28 | assert(index >= 0 && index < m[0].length()); 29 | 30 | typename genType::row_type Result(0); 31 | for(length_t i = 0; i < m.length(); ++i) 32 | Result[i] = m[i][index]; 33 | return Result; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType column 38 | ( 39 | genType const& m, 40 | length_t index, 41 | typename genType::col_type const& x 42 | ) 43 | { 44 | assert(index >= 0 && index < m.length()); 45 | 46 | genType Result = m; 47 | Result[index] = x; 48 | return Result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER typename genType::col_type column 53 | ( 54 | genType const& m, 55 | length_t index 56 | ) 57 | { 58 | assert(index >= 0 && index < m.length()); 59 | 60 | return m[index]; 61 | } 62 | }//namespace glm 63 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/detail/compute_common.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | #include 5 | 6 | namespace glm{ 7 | namespace detail 8 | { 9 | template 10 | struct compute_abs 11 | {}; 12 | 13 | template 14 | struct compute_abs 15 | { 16 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 17 | { 18 | GLM_STATIC_ASSERT( 19 | std::numeric_limits::is_iec559 || std::numeric_limits::is_signed, 20 | "'abs' only accept floating-point and integer scalar or vector inputs"); 21 | 22 | return x >= genFIType(0) ? x : -x; 23 | // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; 24 | } 25 | }; 26 | 27 | #if GLM_COMPILER & GLM_COMPILER_CUDA 28 | template<> 29 | struct compute_abs 30 | { 31 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static float call(float x) 32 | { 33 | return fabsf(x); 34 | } 35 | }; 36 | #endif 37 | 38 | template 39 | struct compute_abs 40 | { 41 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 42 | { 43 | GLM_STATIC_ASSERT( 44 | (!std::numeric_limits::is_signed && std::numeric_limits::is_integer), 45 | "'abs' only accept floating-point and integer scalar or vector inputs"); 46 | return x; 47 | } 48 | }; 49 | }//namespace detail 50 | }//namespace glm 51 | -------------------------------------------------------------------------------- /alvr/vulkan_layer/wsi/display.cpp: -------------------------------------------------------------------------------- 1 | #include "display.hpp" 2 | 3 | #include"layer/settings.h" 4 | 5 | #include 6 | 7 | wsi::display::display() 8 | { 9 | } 10 | 11 | VkFence wsi::display::get_vsync_fence() 12 | { 13 | if (not std::atomic_exchange(&m_thread_running, true)) 14 | { 15 | vsync_fence = reinterpret_cast(this); 16 | m_vsync_thread = std::thread([this]() 17 | { 18 | auto refresh = Settings::Instance().m_refreshRate; 19 | auto next_frame = std::chrono::steady_clock::now(); 20 | auto frame_time = std::chrono::duration_cast(std::chrono::duration(1. / refresh)); 21 | while (not m_exiting) { 22 | std::this_thread::sleep_until(next_frame); 23 | m_signaled = true; 24 | m_cond.notify_all(); 25 | m_vsync_count += 1; 26 | next_frame += frame_time; 27 | } 28 | }); 29 | } 30 | m_signaled = false; 31 | return vsync_fence; 32 | } 33 | 34 | wsi::display::~display() { 35 | std::unique_lock lock(m_mutex); 36 | m_exiting = true; 37 | if (m_vsync_thread.joinable()) 38 | m_vsync_thread.join(); 39 | } 40 | 41 | bool wsi::display::wait_for_vsync(uint64_t timeoutNs) 42 | { 43 | if (!m_signaled) { 44 | std::unique_lock lock(m_mutex); 45 | return m_cond.wait_for(lock, std::chrono::nanoseconds(timeoutNs)) == std::cv_status::no_timeout; 46 | } 47 | return true; 48 | } 49 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/ffr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "gl_render_utils/render_pipeline.h" 6 | 7 | struct FFRData { 8 | bool enabled; 9 | uint32_t viewWidth; 10 | uint32_t viewHeight; 11 | float centerSizeX; 12 | float centerSizeY; 13 | float centerShiftX; 14 | float centerShiftY; 15 | float edgeRatioX; 16 | float edgeRatioY; 17 | }; 18 | 19 | struct FoveationVars { 20 | uint32_t targetEyeWidth; 21 | uint32_t targetEyeHeight; 22 | uint32_t optimizedEyeWidth; 23 | uint32_t optimizedEyeHeight; 24 | 25 | float eyeWidthRatio; 26 | float eyeHeightRatio; 27 | 28 | float centerSizeX; 29 | float centerSizeY; 30 | float centerShiftX; 31 | float centerShiftY; 32 | float edgeRatioX; 33 | float edgeRatioY; 34 | }; 35 | 36 | FoveationVars CalculateFoveationVars(FFRData data); 37 | 38 | class FFR { 39 | public: 40 | FFR(gl_render_utils::Texture *inputSurface); 41 | 42 | void Initialize(FoveationVars fv); 43 | 44 | void Render() const; 45 | 46 | gl_render_utils::Texture *GetOutputTexture() { return mExpandedTexture.get(); } 47 | 48 | private: 49 | 50 | gl_render_utils::Texture *mInputSurface; 51 | std::unique_ptr mExpandedTexture; 52 | std::unique_ptr mExpandedTextureState; 53 | std::unique_ptr mDecompressAxisAlignedPipeline; 54 | }; 55 | -------------------------------------------------------------------------------- /alvr/server_core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_server_core" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors = ["alvr-org", "Valve Corporation"] 7 | license = "MIT" 8 | 9 | [lib] 10 | crate-type = ["rlib", "cdylib"] 11 | 12 | [features] 13 | trace-performance = ["profiling/profile-with-tracy"] 14 | 15 | [dependencies] 16 | alvr_audio.workspace = true 17 | alvr_common.workspace = true 18 | alvr_events.workspace = true 19 | alvr_filesystem.workspace = true 20 | alvr_packets.workspace = true 21 | alvr_server_io.workspace = true 22 | alvr_session.workspace = true 23 | alvr_sockets.workspace = true 24 | 25 | ash = "0.38" 26 | bincode = "1" 27 | bytes = "1" 28 | chrono = "0.4" 29 | fern = "0.6" 30 | flume = "0.11" 31 | futures = "0.3" 32 | headers = "0.3" 33 | hyper = { version = "0.14", features = [ 34 | "http2", 35 | "server", 36 | "stream", 37 | "runtime", 38 | "tcp", 39 | ] } 40 | mdns-sd = "0.11" 41 | profiling = { version = "1", optional = true } 42 | reqwest = "0.11" # not used but webserver does not work without it. todo: investigate 43 | rosc = "0.10" 44 | tokio = { version = "1", features = [ 45 | "rt-multi-thread", 46 | "macros", 47 | "process", 48 | "io-util", 49 | "net", 50 | "fs", 51 | ] } 52 | tokio-tungstenite = "0.20" 53 | tokio-util = { version = "0.7", features = ["codec"] } 54 | serde = "1" 55 | serde_json = "1" 56 | sysinfo = { version = "0.30", default-features = false } 57 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../ext/scalar_uint_sized.hpp" 17 | #include "../detail/setup.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 20 | # ifndef GLM_ENABLE_EXPERIMENTAL 21 | # pragma message("GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 22 | # else 23 | # pragma message("GLM: GLM_GTX_raw_data extension included") 24 | # endif 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_raw_data 30 | /// @{ 31 | 32 | //! Type for byte numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint8 byte; 35 | 36 | //! Type for word numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint16 word; 39 | 40 | //! Type for dword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint32 dword; 43 | 44 | //! Type for qword numbers. 45 | //! From GLM_GTX_raw_data extension. 46 | typedef detail::uint64 qword; 47 | 48 | /// @} 49 | }// namespace glm 50 | 51 | #include "raw_data.inl" 52 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, bool, highp> highp_bvec2; 17 | 18 | /// 2 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, bool, mediump> mediump_bvec2; 23 | 24 | /// 2 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, bool, lowp> lowp_bvec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, bool, highp> highp_bvec3; 17 | 18 | /// 3 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, bool, mediump> mediump_bvec3; 23 | 24 | /// 3 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, bool, lowp> lowp_bvec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/ext/vector_bool4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, bool, highp> highp_bvec4; 17 | 18 | /// 4 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, bool, mediump> mediump_bvec4; 23 | 24 | /// 4 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, bool, lowp> lowp_bvec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /alvr/client_core/cpp/glm/gtx/texture.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | /// @file glm/gtx/texture.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_texture GLM_GTX_texture 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Wrapping mode of texture coordinates. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | #include "../gtx/component_wise.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # ifndef GLM_ENABLE_EXPERIMENTAL 22 | # pragma message("GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") 23 | # else 24 | # pragma message("GLM: GLM_GTX_texture extension included") 25 | # endif 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_texture 31 | /// @{ 32 | 33 | /// Compute the number of mipmaps levels necessary to create a mipmap complete texture 34 | /// 35 | /// @param Extent Extent of the texture base level mipmap 36 | /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector 37 | /// @tparam T Floating-point or signed integer scalar types 38 | /// @tparam Q Value from qualifier enum 39 | template 40 | T levels(vec const& Extent); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "texture.inl" 46 | 47 | -------------------------------------------------------------------------------- /alvr/dashboard/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "alvr_dashboard" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | authors.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | alvr_common.workspace = true 11 | alvr_events.workspace = true 12 | alvr_filesystem.workspace = true 13 | alvr_packets.workspace = true 14 | alvr_session.workspace = true 15 | alvr_gui_common.workspace = true 16 | 17 | bincode = "1" 18 | chrono = "0.4" 19 | eframe = "0.28" 20 | env_logger = "0.11" 21 | ico = "0.3" 22 | rand = "0.8" 23 | serde = { version = "1", features = ["derive"] } 24 | serde_json = "1" 25 | settings-schema = { git = "https://github.com/alvr-org/settings-schema-rs", rev = "676185f" } 26 | statrs = "0.17" 27 | 28 | [target.'cfg(not(target_arch = "wasm32"))'.dependencies] 29 | alvr_server_io.workspace = true 30 | sysinfo = { version = "0.30", default-features = false } 31 | tungstenite = "0.23" 32 | ureq = { version = "2", features = ["json"] } 33 | 34 | [target.'cfg(target_arch = "wasm32")'.dependencies] 35 | console_error_panic_hook = "0.1" 36 | ewebsock = "0.5" 37 | futures = "0.3" 38 | gloo-net = "0.5" 39 | instant = { version = "0.1", features = ["wasm-bindgen"] } 40 | wasm-bindgen-futures = "0.4" 41 | wasm-logger = "0.2" 42 | 43 | [target.'cfg(target_os = "linux")'.dependencies] 44 | wgpu = "0.20" 45 | libva = { package = "cros-libva", version = "0.0.6" } 46 | nvml-wrapper = "0.10.0" 47 | 48 | [target.'cfg(windows)'.build-dependencies] 49 | winres = "0.1" 50 | --------------------------------------------------------------------------------