diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index e03ba258..b9417e68 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -64,8 +64,7 @@ body:
attributes:
label: Vulkan Info
description: Provide the output of `vulkaninfo --summary` command.
- render: text
- placeholder: Attach the output as a file here.
+ placeholder: Add the output of vulkaninfo command here...
- type: dropdown
id: hmd
@@ -91,5 +90,4 @@ body:
attributes:
label: ADB Logs
description: Provide the output of `adb logcat` command.
- render: plain
- placeholder: Attach the output of adb logcat as a file.
+ placeholder: Add the output of adb logcat command here...
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6842a8fb..585c3434 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,12 +43,12 @@ option(WIVRN_USE_X264 "Enable x264 software encoder" ON)
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" OFF)
-set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite"
+set(OVR_COMPAT_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite:/opt/xrizer"
CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :")
option(WIVRN_FEATURE_DEBUG_GUI "Enable Monado debug GUI" OFF)
option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF)
-set(WIVRN_FEATURE_SOLARXR OFF) # Will be added back when merged in upstream Monado
+option(WIVRN_FEATURE_SOLARXR "Enable SolarXR driver" OFF)
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
diff --git a/client/application.cpp b/client/application.cpp
index 50d77654..b0433274 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -18,7 +18,7 @@
*/
#include "application.h"
-
+#include "asset.h"
#include "hardware.h"
#include "openxr/openxr.h"
#include "scene.h"
@@ -26,7 +26,6 @@
#include "spdlog/spdlog.h"
#include "utils/contains.h"
#include "utils/files.h"
-#include "utils/i18n.h"
#include "vk/check.h"
#include "wifi_lock.h"
#include "xr/actionset.h"
@@ -68,6 +67,7 @@ struct interaction_profile
std::string profile_name;
std::vector required_extensions;
XrVersion min_version = XR_MAKE_VERSION(1, 0, 0);
+ XrVersion max_version = XR_MAKE_VERSION(2, 0, 0); // exclusive
std::vector input_sources;
bool available;
};
@@ -134,7 +134,8 @@ static std::vector interaction_profiles{
},
interaction_profile{
.profile_name = "/interaction_profiles/facebook/touch_controller_pro",
- .required_extensions = {XR_FB_TOUCH_CONTROLLER_PRO_EXTENSION_NAME},
+ .required_extensions = {"XR_FB_touch_controller_pro"},
+ .max_version = XR_MAKE_VERSION(1, 1, 0),
.input_sources = {
"/user/hand/left/output/haptic",
"/user/hand/left/output/haptic_trigger_fb",
@@ -246,7 +247,8 @@ static std::vector interaction_profiles{
},
interaction_profile{
.profile_name = "/interaction_profiles/meta/touch_controller_plus",
- .required_extensions = {XR_META_TOUCH_CONTROLLER_PLUS_EXTENSION_NAME},
+ .required_extensions = {"XR_META_touch_controller_plus"},
+ .max_version = XR_MAKE_VERSION(1, 1, 0),
.input_sources = {
"/user/hand/left/output/haptic",
"/user/hand/right/output/haptic",
@@ -647,7 +649,6 @@ VkBool32 application::vulkan_debug_report_callback(
}
#ifndef NDEBUG
- bool my_error = true;
if (level >= spdlog::level::warn)
{
bool validation_layer_found = false;
@@ -658,13 +659,10 @@ VkBool32 application::vulkan_debug_report_callback(
if (validation_layer_found && i.library != "libVkLayer_khronos_validation.so")
spdlog::log(level, "{:#016x}: {} + {:#x}", i.pc, i.library, i.pc - i.library_base);
-
- if (i.library == "libopenxr_loader.so")
- my_error = false;
}
}
- if (level >= spdlog::level::err and my_error)
+ if (level >= spdlog::level::err)
abort();
#endif
@@ -969,8 +967,7 @@ void application::initialize_actions()
std::vector sources;
for (auto & profile: interaction_profiles)
{
- profile.available = std::ranges::all_of(profile.required_extensions, [&](auto & ext) { return xr_instance.has_extension(ext); }) and
- profile.min_version <= api_version;
+ profile.available = utils::contains_all(xr_extensions, profile.required_extensions) and profile.min_version <= api_version and profile.max_version > api_version;
if (profile.profile_name.ends_with("khr/simple_controller"))
{
@@ -1351,47 +1348,50 @@ void application::initialize()
vk_cmdpool = vk::raii::CommandPool{vk_device, cmdpool_create_info};
initialize_actions();
- load_locale();
-}
-void application::load_locale()
-{
gen.add_messages_domain("wivrn");
std::locale loc = gen("");
- messages_info.encoding = "UTF-8";
- if (config->locale.empty())
- {
#ifdef __ANDROID__
- jni::klass java_util_Locale("java/util/Locale");
- auto default_locale = java_util_Locale.call>("getDefault");
+ jni::klass java_util_Locale("java/util/Locale");
+ auto default_locale = java_util_Locale.call>("getDefault");
- // if (auto language = default_locale.call("toString"))
- if (auto language = default_locale.call("getLanguage"))
- messages_info.language = language;
+ // if (auto language = default_locale.call("toString"))
+ if (auto language = default_locale.call("getLanguage"))
+ messages_info.language = language;
+
+ if (auto country = default_locale.call("getCountry"))
+ messages_info.country = country;
+
+ messages_info.encoding = "UTF-8";
- if (auto country = default_locale.call("getCountry"))
- messages_info.country = country;
#else
- auto & facet = std::use_facet(loc);
- messages_info.language = facet.language();
- messages_info.country = facet.country();
+ auto & facet = std::use_facet(loc);
+ messages_info.language = facet.language();
+ messages_info.country = facet.country();
+ messages_info.encoding = "UTF-8";
#endif
- }
- else
- {
- auto pos = config->locale.find("_");
- messages_info.language = config->locale.substr(0, pos);
- if (pos != std::string::npos)
- messages_info.country = config->locale.substr(pos + 1);
- }
spdlog::info("Current locale: language {}, country {}, encoding {}", messages_info.language, messages_info.country, messages_info.encoding);
messages_info.paths.push_back("locale");
messages_info.domains.push_back(boost::locale::gnu_gettext::messages_info::domain("wivrn"));
- messages_info.callback = open_locale_file;
+ messages_info.callback = [](const std::string & file_name, const std::string & encoding) {
+ std::vector buffer;
+ try
+ {
+ asset file(file_name);
+ buffer.resize(file.size());
+ memcpy(buffer.data(), file.data(), file.size());
+ }
+ catch (...)
+ {
+ }
+
+ return buffer;
+ };
+
loc = std::locale(loc, boost::locale::gnu_gettext::create_messages_facet(messages_info));
std::locale::global(loc);
diff --git a/client/configuration.cpp b/client/configuration.cpp
index 6698a9c9..abe7f15e 100644
--- a/client/configuration.cpp
+++ b/client/configuration.cpp
@@ -214,8 +214,8 @@ configuration::configuration(xr::system & system)
if (auto val = root["resolution_scale"]; val.is_double())
resolution_scale = val.get_double();
- if (auto val = root["enable_stream_gui"]; val.is_bool())
- enable_stream_gui = val.get_bool();
+ if (auto val = root["sgsr"]; val.is_object())
+ parse_sgsr_options(val.get_object());
if (auto val = root["openxr_post_processing"]; val.is_object())
parse_openxr_post_processing_options(val.get_object());
@@ -254,9 +254,6 @@ configuration::configuration(xr::system & system)
if (auto val = root["first_run"]; val.is_bool())
first_run = val.get_bool();
-
- if (auto val = root["locale"]; val.is_string())
- locale = val.get_string().value();
}
catch (std::exception & e)
{
@@ -267,11 +264,31 @@ configuration::configuration(xr::system & system)
preferred_refresh_rate.reset();
minimum_refresh_rate.reset();
resolution_scale = 1.4;
+ sgsr = {};
openxr_post_processing = {};
passthrough_enabled = system.passthrough_supported() == xr::system::passthrough_type::color;
}
}
+void configuration::parse_sgsr_options(simdjson::simdjson_result sgsr_root)
+{
+ sgsr = {};
+ if (auto val = sgsr_root["enabled"]; val.is_bool())
+ sgsr.enabled = val.get_bool();
+
+ if (auto val = sgsr_root["upscaling_factor"]; val.is_double())
+ sgsr.upscaling_factor = val.get_double();
+
+ if (auto val = sgsr_root["use_edge_direction"]; val.is_bool())
+ sgsr.use_edge_direction = val.get_bool();
+
+ if (auto val = sgsr_root["edge_threshold"]; val.is_double())
+ sgsr.edge_threshold = val.get_double();
+
+ if (auto val = sgsr_root["edge_sharpness"]; val.is_double())
+ sgsr.edge_sharpness = val.get_double();
+}
+
void configuration::parse_openxr_post_processing_options(simdjson::simdjson_result openxr_post_processing_root)
{
openxr_post_processing = {};
@@ -287,6 +304,17 @@ static std::ostream & operator<<(std::ostream & stream, feature f)
return stream << "\"" << magic_enum::enum_name(f) << "\"";
}
+static std::ostream & write_sgsr(std::ofstream & stream, const configuration::sgsr_settings & sgsr)
+{
+ stream << "{\"enabled\":" << std::boolalpha << sgsr.enabled;
+ stream << ",\"upscaling_factor\":" << sgsr.upscaling_factor;
+ stream << ",\"use_edge_direction\":" << std::boolalpha << sgsr.use_edge_direction;
+ stream << ",\"edge_threshold\":" << sgsr.edge_threshold;
+ stream << ",\"edge_sharpness\":" << sgsr.edge_sharpness;
+ stream << "}";
+ return stream;
+}
+
static std::ostream & write_openxr_post_processing(std::ofstream & stream, const configuration::openxr_post_processing_settings & openxr_post_processing)
{
stream << "{\"super_sampling\":" << openxr_post_processing.super_sampling;
@@ -329,6 +357,8 @@ void configuration::save()
if (minimum_refresh_rate)
json << ",\"minimum_refresh_rate\":" << *minimum_refresh_rate;
json << ",\"resolution_scale\":" << resolution_scale;
+ json << ",\"sgsr\":";
+ write_sgsr(json, sgsr);
json << ",\"openxr_post_processing\":";
write_openxr_post_processing(json, openxr_post_processing);
json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled;
@@ -342,6 +372,5 @@ void configuration::save()
json << ",\"override_foveation_pitch\":" << override_foveation_pitch;
json << ",\"override_foveation_distance\":" << override_foveation_distance;
json << ",\"first_run\":" << std::boolalpha << first_run;
- json << ",\"locale\":" << json_string(locale);
json << "}";
}
diff --git a/client/configuration.h b/client/configuration.h
index d8dfbf6f..8d34faae 100644
--- a/client/configuration.h
+++ b/client/configuration.h
@@ -56,7 +56,16 @@ public:
bool fb_lower_body = false;
bool fb_hip = true;
- bool enable_stream_gui = true;
+ // Snapdragon Game Super Resolution
+ struct sgsr_settings
+ {
+ bool enabled = false;
+ float upscaling_factor = 1.5;
+ bool use_edge_direction = true;
+ float edge_threshold = 4.0;
+ float edge_sharpness = 2.0;
+ };
+ sgsr_settings sgsr{};
// XR_FB_composition_layer_settings extension flags
struct openxr_post_processing_settings
@@ -74,8 +83,6 @@ public:
bool first_run = true;
- std::string locale;
-
bool check_feature(feature f) const;
void set_feature(feature f, bool state);
@@ -83,6 +90,7 @@ private:
mutable std::mutex mutex;
std::map features;
+ void parse_sgsr_options(simdjson::simdjson_result root);
void parse_openxr_post_processing_options(simdjson::simdjson_result root);
public:
diff --git a/client/decoder/shard_accumulator.h b/client/decoder/shard_accumulator.h
index a0145e22..4777de7f 100644
--- a/client/decoder/shard_accumulator.h
+++ b/client/decoder/shard_accumulator.h
@@ -19,30 +19,27 @@
#pragma once
-#include "decoder.h"
-#include "wivrn_packets.h"
-
#include
+#include
+
+#ifdef __ANDROID__
+#include "decoder/android/android_decoder.h"
+using decoder_impl = ::wivrn::android::decoder;
+#else
+#include "decoder/ffmpeg/ffmpeg_decoder.h"
+using decoder_impl = ::wivrn::ffmpeg::decoder;
+#endif
+
+#include "wivrn_packets.h"
#include
#include
-#include
-
-namespace xr
-{
-class instance;
-}
-
-namespace scenes
-{
-class stream;
-}
namespace wivrn
{
class shard_accumulator
{
- std::shared_ptr decoder_;
+ std::shared_ptr decoder;
public:
using data_shard = wivrn::to_headset::video_stream_data_shard;
@@ -53,7 +50,7 @@ public:
void reset(uint64_t frame_index);
bool empty() const;
- std::optional insert(data_shard &&, xr::instance & instance);
+ std::optional insert(data_shard &&);
wivrn::from_headset::feedback feedback{};
@@ -73,22 +70,19 @@ private:
shard_set current;
shard_set next;
std::weak_ptr weak_scene;
- xr::instance & instance;
public:
explicit shard_accumulator(
vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
- xr::instance & instance,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
std::weak_ptr scene,
uint8_t stream_index) :
- decoder_(decoder::make(device, physical_device, description, fps, stream_index, scene, this)),
+ decoder(std::make_shared(device, physical_device, description, fps, stream_index, scene, this)),
current(stream_index),
next(stream_index),
- weak_scene(scene),
- instance(instance)
+ weak_scene(scene)
{
next.reset(1);
}
@@ -97,20 +91,20 @@ public:
auto & desc() const
{
- return decoder_->description;
+ return decoder->desc();
}
vk::Sampler sampler()
{
- return decoder_->sampler();
+ return decoder->sampler();
}
- const vk::Extent2D extent()
+ vk::Extent2D image_size()
{
- return decoder_->extent();
+ return decoder->image_size();
}
- using blit_handle = decoder::blit_handle;
+ using blit_handle = decoder_impl::blit_handle;
private:
void try_submit_frame(std::optional shard_idx);
diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp
index e79c1305..dc20f14e 100644
--- a/client/scenes/stream.cpp
+++ b/client/scenes/stream.cpp
@@ -17,9 +17,11 @@
* along with this program. If not, see .
*/
#include "constants.h"
-#include "xr/body_tracker.h"
-#include "xr/face_tracker.h"
+#include "utils/overloaded.h"
+#include "xr/fb_body_tracker.h"
#include "xr/fb_face_tracker2.h"
+#include "xr/htc_body_tracker.h"
+#include "xr/pico_body_tracker.h"
#include "xr/space.h"
#include
#include
@@ -38,6 +40,8 @@
#include "utils/contains.h"
#include "utils/named_thread.h"
#include "utils/ranges.h"
+#include "vk/pipeline.h"
+#include "vk/shader.h"
#include "wivrn_packets.h"
#include
#include
@@ -45,11 +49,6 @@
#include
#include
-#include "wivrn_config.h"
-#if WIVRN_FEATURE_RENDERDOC
-#include "vk/renderdoc.h"
-#endif
-
using namespace wivrn;
// clang-format off
@@ -152,8 +151,7 @@ static const std::array supported_depth_formats{
};
scenes::stream::stream() :
- scene_impl(supported_color_formats, supported_depth_formats),
- blitters{blitter(device, 0), blitter(device, 1)}
+ scene_impl(supported_color_formats, supported_depth_formats)
{
}
@@ -191,11 +189,7 @@ std::shared_ptr scenes::stream::create(std::unique_ptrnetwork_session = std::move(network_session);
self->network_session->send_control([&]() {
- from_headset::headset_info_packet info{
- .language = application::get_messages_info().language,
- .country = application::get_messages_info().country,
- .variant = application::get_messages_info().variant,
- };
+ from_headset::headset_info_packet info{};
auto view = self->system.view_configuration_views(self->viewconfig)[0];
view = override_view(view, guess_model());
@@ -257,49 +251,46 @@ std::shared_ptr scenes::stream::create(std::unique_ptrsystem.face_tracker_supported())
- {
- case xr::face_tracker_type::none:
- info.face_tracking = from_headset::face_type::none;
- break;
- case xr::face_tracker_type::fb:
- case xr::face_tracker_type::pico:
- info.face_tracking = from_headset::face_type::fb2;
- break;
- case xr::face_tracker_type::htc:
- info.face_tracking = from_headset::face_type::htc;
- break;
- }
+ info.face_tracking = std::visit(utils::overloaded{
+ [](std::monostate &) {
+ return from_headset::face_type::none;
+ },
+ [](xr::fb_face_tracker2 &) {
+ return from_headset::face_type::fb2;
+ },
+ [](xr::htc_face_tracker &) {
+ return from_headset::face_type::htc;
+ },
+ [](xr::pico_face_tracker &) {
+ return from_headset::face_type::fb2;
+ },
+ },
+ application::get_face_tracker());
}
info.num_generic_trackers = 0;
if (config.check_feature(feature::body_tracking))
{
- switch (self->system.body_tracker_supported())
- {
- case xr::body_tracker_type::none:
- break;
- case xr::body_tracker_type::fb:
- info.num_generic_trackers = xr::fb_body_tracker::get_whitelisted_joints(config.fb_lower_body, config.fb_hip).size();
- break;
- case xr::body_tracker_type::htc:
- info.num_generic_trackers = application::get_generic_trackers().size();
- break;
- case xr::body_tracker_type::pico:
- info.num_generic_trackers = xr::pico_body_tracker::joint_whitelist.size();
- break;
- }
+ info.num_generic_trackers = std::visit(utils::overloaded{
+ [&](std::monostate &) {
+ return size_t(0);
+ },
+ [&](auto & b) {
+ return b.count();
+ },
+ },
+ application::get_body_tracker());
}
info.palm_pose = application::space(xr::spaces::palm_left) or application::space(xr::spaces::palm_right);
- info.passthrough = self->system.passthrough_supported() != xr::passthrough_type::none;
+ info.passthrough = self->system.passthrough_supported() != xr::system::passthrough_type::no_passthrough;
info.system_name = std::string(self->system.properties().systemName);
audio::get_audio_description(info);
if (not(config.check_feature(feature::microphone)))
info.microphone = {};
- info.supported_codecs = decoder::supported_codecs();
+ info.supported_codecs = decoder_impl::supported_codecs();
return info;
}());
@@ -320,6 +311,15 @@ std::shared_ptr scenes::stream::create(std::unique_ptrnetwork_session->send_control(from_headset::get_application_list{
+ .language = info.language,
+ .country = info.country,
+ .variant = info.variant,
+ });
+ }
+
{
const auto & config = application::get_config();
self->override_foveation_enable = config.override_foveation_enable;
@@ -363,7 +363,7 @@ std::shared_ptr scenes::stream::create(std::unique_ptrhaptics_actions.emplace(id, haptics_action{
.action = action.first,
- .path = self->instance.string_to_path(path),
+ .path = application::string_to_path(path),
});
}
}
@@ -394,7 +394,7 @@ std::shared_ptr scenes::stream::create(std::unique_ptrget_default_material());
+ loader.emplace(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
std::string profile = controller_name();
input.emplace(
@@ -470,11 +470,8 @@ void scenes::stream::on_focused()
swapchain_imgui,
std::vector{vp});
- if (application::get_config().enable_stream_gui)
- {
- plots_toggle_1 = get_action("plots_toggle_1").first;
- plots_toggle_2 = get_action("plots_toggle_2").first;
- }
+ plots_toggle_1 = get_action("plots_toggle_1").first;
+ plots_toggle_2 = get_action("plots_toggle_2").first;
recenter_left = get_action("recenter_left").first;
recenter_right = get_action("recenter_right").first;
foveation_pitch = get_action("foveation_pitch").first;
@@ -497,8 +494,6 @@ void scenes::stream::on_unfocused()
loader.reset();
renderer.reset();
clear_swapchains();
- left_hand.reset();
- right_hand.reset();
imgui_ctx.reset();
swapchain_imgui = xr::swapchain();
@@ -529,16 +524,16 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p
{
if (decoder != decoders[stream].decoder.get())
return;
- handle->feedback.received_from_decoder = instance.now();
+ handle->feedback.received_from_decoder = application::now();
std::swap(handle, decoders[stream].latest_frames[handle->feedback.frame_index % decoders[stream].latest_frames.size()]);
}
if (state_ != state::streaming and std::ranges::all_of(decoders, [](accumulator_images & i) {
- return i.alpha() or not i.empty();
+ return i.alpha() or not i.frames().empty();
}))
{
state_ = state::streaming;
- spdlog::info("Stream scene ready at t={}", instance.now());
+ spdlog::info("Stream scene ready at t={}", application::now());
}
}
@@ -553,14 +548,15 @@ bool scenes::stream::accumulator_images::alpha() const
return decoder->desc().channels == wivrn::to_headset::video_stream_description::channels_t::alpha;
}
-bool scenes::stream::accumulator_images::empty() const
+std::vector scenes::stream::accumulator_images::frames() const
{
+ std::vector result;
for (const auto & frame: latest_frames)
{
if (frame)
- return false;
+ result.push_back(frame->feedback.frame_index);
}
- return true;
+ return result;
}
std::vector> scenes::stream::common_frame(XrTime display_time)
@@ -770,17 +766,138 @@ void scenes::stream::render(const XrFrameState & frame_state)
}
if (state_ == state::stalled)
- {
- network_session->send_control(from_headset::get_application_list{
- .language = application::get_messages_info().language,
- .country = application::get_messages_info().country,
- .variant = application::get_messages_info().variant,
- });
-
application::pop_scene();
- }
assert(swapchain);
+ for (auto & i: decoders)
+ {
+ if (auto sampler = i.decoder->sampler(); sampler and not *i.blit_pipeline)
+ {
+ // Create blit pipeline
+ // Create VkDescriptorSetLayout with an immutable sampler
+ vk::DescriptorSetLayoutBinding sampler_layout_binding{
+ .binding = 0,
+ .descriptorType = vk::DescriptorType::eCombinedImageSampler,
+ .descriptorCount = 1,
+ .stageFlags = vk::ShaderStageFlagBits::eFragment,
+ .pImmutableSamplers = &sampler,
+ };
+
+ vk::DescriptorSetLayoutCreateInfo layout_info{
+ .bindingCount = 1,
+ .pBindings = &sampler_layout_binding,
+ };
+
+ i.descriptor_set_layout = vk::raii::DescriptorSetLayout(device, layout_info);
+ i.descriptor_set = device.allocateDescriptorSets(
+ vk::DescriptorSetAllocateInfo{
+ .descriptorPool = *blit_descriptor_pool,
+ .descriptorSetCount = 1,
+ .pSetLayouts = &*i.descriptor_set_layout,
+ })[0]
+ .release();
+
+ const auto & description = i.decoder->desc();
+ vk::Extent2D image_size = i.decoder->image_size();
+ std::array useful_size{
+ float(description.width) / image_size.width,
+ float(description.height) / image_size.height,
+ };
+ spdlog::info("useful size: {}x{} with buffer {}x{}",
+ description.width,
+ description.height,
+ image_size.width,
+ image_size.height);
+
+ std::array specialization_constants_desc{
+ vk::SpecializationMapEntry{
+ .constantID = 0,
+ .offset = 0,
+ .size = sizeof(float),
+ },
+ vk::SpecializationMapEntry{
+ .constantID = 1,
+ .offset = sizeof(float),
+ .size = sizeof(float),
+ }};
+
+ vk::SpecializationInfo vert_specialization_info;
+ vert_specialization_info.setMapEntries(specialization_constants_desc);
+ vert_specialization_info.setData(useful_size);
+
+ std::array constants = {
+ need_srgb_conversion(guess_model()),
+ i.alpha(),
+ };
+ std::array frag_specialization_constant_desc = {
+ vk::SpecializationMapEntry{
+ .constantID = 0,
+ .offset = 0,
+ .size = sizeof(constants[0]),
+ },
+ vk::SpecializationMapEntry{
+ .constantID = 1,
+ .offset = sizeof(constants[0]),
+ .size = sizeof(constants[1]),
+ },
+ };
+ vk::SpecializationInfo frag_specialization_info;
+ frag_specialization_info.setMapEntries(frag_specialization_constant_desc);
+ frag_specialization_info.setData(constants);
+
+ // Create graphics pipeline
+ vk::raii::ShaderModule vertex_shader = load_shader(device, "stream.vert");
+ vk::raii::ShaderModule fragment_shader = load_shader(device, "stream.frag");
+
+ vk::PipelineLayoutCreateInfo pipeline_layout_info{
+ .setLayoutCount = 1,
+ .pSetLayouts = &*i.descriptor_set_layout,
+ };
+
+ i.blit_pipeline_layout = vk::raii::PipelineLayout(device, pipeline_layout_info);
+
+ vk::pipeline_builder pipeline_info{
+ .Stages = {{
+ .stage = vk::ShaderStageFlagBits::eVertex,
+ .module = *vertex_shader,
+ .pName = "main",
+ .pSpecializationInfo = &vert_specialization_info,
+ },
+ {
+ .stage = vk::ShaderStageFlagBits::eFragment,
+ .module = *fragment_shader,
+ .pName = "main",
+ .pSpecializationInfo = &frag_specialization_info,
+ }},
+ .VertexBindingDescriptions = {},
+ .VertexAttributeDescriptions = {},
+ .InputAssemblyState = {{
+ .topology = vk::PrimitiveTopology::eTriangleStrip,
+ }},
+ // With vk::DynamicState::eViewport, vk::DynamicState::eScissor the number of viewports
+ // and scissors is still used, put a vector with one element
+ .Viewports = {{}},
+ .Scissors = {{}},
+ .RasterizationState = {{
+ .polygonMode = vk::PolygonMode::eFill,
+ .lineWidth = 1,
+ }},
+ .MultisampleState = {{
+ .rasterizationSamples = vk::SampleCountFlagBits::e1,
+ }},
+ .ColorBlendAttachments = {
+ {.colorWriteMask = i.alpha() ? vk::ColorComponentFlagBits::eA
+ : vk::ColorComponentFlagBits::eA | vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB}},
+ .DynamicStates = {vk::DynamicState::eViewport, vk::DynamicState::eScissor},
+ .layout = *i.blit_pipeline_layout,
+ .renderPass = *blit_render_pass,
+ .subpass = 0,
+ };
+
+ i.blit_pipeline = vk::raii::Pipeline(device, application::get_pipeline_cache(), pipeline_info);
+ }
+ }
+
if (device.waitForFences(*fence, VK_TRUE, UINT64_MAX) == vk::Result::eTimeout)
throw std::runtime_error("Vulkan fence timeout");
@@ -811,13 +928,11 @@ void scenes::stream::render(const XrFrameState & frame_state)
std::array image_indices;
-#if WIVRN_FEATURE_RENDERDOC
- renderdoc_begin(*vk_instance);
-#endif
command_buffer.reset();
- command_buffer.begin(vk::CommandBufferBeginInfo{
- .flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit,
- });
+
+ vk::CommandBufferBeginInfo begin_info;
+ begin_info.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
+ command_buffer.begin(begin_info);
// Keep a reference to the resources needed to blit the images until vkWaitForFences
@@ -832,12 +947,13 @@ void scenes::stream::render(const XrFrameState & frame_state)
std::array foveation{};
bool use_alpha = false;
- for (auto & blit_handle: current_blit_handles)
+ // Blit images from the decoders
+ for (auto [i, blit_handle]: std::views::zip(decoders, current_blit_handles))
{
- if (not blit_handle)
+ if (not blit_handle or not *i.blit_pipeline)
continue;
- blit_handle->feedback.blitted = instance.now();
+ blit_handle->feedback.blitted = application::now();
if (blit_handle->feedback.blitted - blit_handle->feedback.received_from_decoder > 1'000'000'000)
state_ = stream::state::stalled;
++blit_handle->feedback.times_displayed;
@@ -848,12 +964,27 @@ void scenes::stream::render(const XrFrameState & frame_state)
foveation = blit_handle->view_info.foveation;
use_alpha = blit_handle->view_info.alpha;
- if (blit_handle->current_layout == vk::ImageLayout::eUndefined)
+ vk::DescriptorImageInfo image_info{
+ .imageView = *blit_handle->image_view,
+ .imageLayout = vk::ImageLayout::eGeneral,
+ };
+
+ vk::WriteDescriptorSet descriptor_write{
+ .dstSet = i.descriptor_set,
+ .dstBinding = 0,
+ .dstArrayElement = 0,
+ .descriptorCount = 1,
+ .descriptorType = vk::DescriptorType::eCombinedImageSampler,
+ .pImageInfo = &image_info,
+ };
+
+ device.updateDescriptorSets(descriptor_write, {});
+ if (*blit_handle->current_layout != vk::ImageLayout::eGeneral)
{
vk::ImageMemoryBarrier barrier{
.srcAccessMask = vk::AccessFlagBits::eNone,
.dstAccessMask = vk::AccessFlagBits::eMemoryRead,
- .oldLayout = vk::ImageLayout::eUndefined,
+ .oldLayout = *blit_handle->current_layout,
.newLayout = vk::ImageLayout::eGeneral,
.image = blit_handle->image,
.subresourceRange = {
@@ -864,22 +995,72 @@ void scenes::stream::render(const XrFrameState & frame_state)
};
command_buffer.pipelineBarrier(vk::PipelineStageFlagBits::eAllCommands, vk::PipelineStageFlagBits::eAllCommands, {}, {}, {}, barrier);
- blit_handle->current_layout = vk::ImageLayout::eGeneral;
+ *blit_handle->current_layout = vk::ImageLayout::eGeneral;
}
}
- // Blit images from the decoders
- std::array blitted;
- for (auto [i, b]: utils::enumerate(blitters))
+ uint16_t x_offset = 0;
+ for (auto & out: decoder_output)
{
- b.begin(command_buffer);
- for (auto [j, blit_handle]: utils::enumerate(current_blit_handles))
+ command_buffer.beginRenderPass(
+ {
+ .renderPass = *blit_render_pass,
+ .framebuffer = *out.frame_buffer,
+ .renderArea = {
+ .offset = {0, 0},
+ .extent = decoder_out_size,
+ },
+ .clearValueCount = 0,
+ },
+ vk::SubpassContents::eInline);
+
+ for (const auto & decoder: decoders)
{
- if (not blit_handle)
+ if (not *decoder.blit_pipeline)
continue;
- b.push_image(command_buffer, j, decoders[j].decoder->sampler(), decoders[j].decoder->extent(), blit_handle->image_view, blit_handle->current_layout);
+ if (decoder.alpha() and not use_alpha)
+ continue;
+
+ command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, *decoder.blit_pipeline);
+
+ const auto & description = decoder.decoder->desc();
+ int x0 = description.offset_x - x_offset;
+ int y0 = description.offset_y;
+ int x1 = x0 + description.width * description.subsampling;
+ int y1 = y0 + description.height * description.subsampling;
+
+ vk::Viewport viewport{
+ .x = (float)x0,
+ .y = (float)y0,
+ .width = float(description.width * description.subsampling),
+ .height = float(description.height * description.subsampling),
+ .minDepth = 0,
+ .maxDepth = 1,
+ };
+
+ x0 = std::clamp(x0, 0, decoder_out_size.width);
+ x1 = std::clamp(x1, 0, decoder_out_size.width);
+ y0 = std::clamp(y0, 0, decoder_out_size.height);
+ y1 = std::clamp(y1, 0, decoder_out_size.height);
+
+ vk::Rect2D scissor{
+ .offset = {.x = x0, .y = y0},
+ .extent = {.width = (uint32_t)(x1 - x0), .height = (uint32_t)(y1 - y0)},
+ };
+
+ command_buffer.setViewport(0, viewport);
+ command_buffer.setScissor(0, scissor);
+
+ command_buffer.bindDescriptorSets(
+ vk::PipelineBindPoint::eGraphics,
+ *decoder.blit_pipeline_layout,
+ 0,
+ decoder.descriptor_set,
+ nullptr);
+ command_buffer.draw(3, 1, 0, 0);
}
- blitted[i] = b.end(command_buffer);
+ command_buffer.endRenderPass();
+ x_offset += decoder_out_size.width;
}
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 1);
@@ -890,7 +1071,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
int32_t max_height = 0;
for (size_t i = 0; i < view_count; ++i)
{
- extents[i] = defoveator->defoveated_size(foveation[i]);
+ extents[i] = reprojector->defoveated_size(foveation[i]);
max_width = std::max(max_width, extents[i].width);
max_height = std::max(max_height, extents[i].height);
}
@@ -920,7 +1101,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
// defoveate the image
int image_index = swapchain.acquire();
swapchain.wait();
- defoveator->defoveate(command_buffer, foveation, blitted, image_index);
+ reprojector->reproject(command_buffer, foveation, image_index);
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 2);
@@ -928,9 +1109,6 @@ void scenes::stream::render(const XrFrameState & frame_state)
vk::SubmitInfo submit_info;
submit_info.setCommandBuffers(*command_buffer);
queue.lock()->submit(submit_info, *fence);
-#if WIVRN_FEATURE_RENDERDOC
- renderdoc_end(*vk_instance);
-#endif
swapchain.release();
std::vector layer_view(view_count);
@@ -1097,15 +1275,119 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
}
video_stream_description = description;
- for (auto & b: blitters)
- b.reset(description);
+
+ const uint32_t video_width = description.width / view_count;
+ const uint32_t video_height = description.height;
+
+ // Create renderpass
+ {
+ vk::AttachmentDescription color_desc{
+ .format = vk::Format::eA8B8G8R8SrgbPack32,
+ .samples = vk::SampleCountFlagBits::e1,
+ .loadOp = vk::AttachmentLoadOp::eDontCare,
+ .storeOp = vk::AttachmentStoreOp::eStore,
+ .initialLayout = vk::ImageLayout::eUndefined,
+ .finalLayout = vk::ImageLayout::eShaderReadOnlyOptimal,
+ };
+
+ vk::AttachmentReference color_ref{
+ .attachment = 0,
+ .layout = vk::ImageLayout::eColorAttachmentOptimal,
+ };
+
+ vk::SubpassDescription subpass{
+ .pipelineBindPoint = vk::PipelineBindPoint::eGraphics,
+ };
+ subpass.setColorAttachments(color_ref);
+
+ vk::RenderPassCreateInfo renderpass_info{
+ .flags = {},
+ };
+ renderpass_info.setAttachments(color_desc);
+ renderpass_info.setSubpasses(subpass);
+
+ blit_render_pass = vk::raii::RenderPass(device, renderpass_info);
+ }
+
+ // Create outputs for the decoders
+ decoder_out_size = vk::Extent2D{video_width, video_height};
+ {
+ decoder_out_format = vk::Format::eA8B8G8R8SrgbPack32;
+
+ vk::ImageCreateInfo image_info{
+ .flags = vk::ImageCreateFlags{},
+ .imageType = vk::ImageType::e2D,
+ .format = vk::Format::eA8B8G8R8SrgbPack32,
+ .extent = {video_width, video_height, 1},
+ .mipLevels = 1,
+ .arrayLayers = view_count,
+ .samples = vk::SampleCountFlagBits::e1,
+ .tiling = vk::ImageTiling::eOptimal,
+ .usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eColorAttachment,
+ .sharingMode = vk::SharingMode::eExclusive,
+ .initialLayout = vk::ImageLayout::eUndefined,
+ };
+
+ VmaAllocationCreateInfo alloc_info{
+ .requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
+ };
+
+ decoder_out_image = image_allocation{device, image_info, alloc_info};
+
+ vk::ImageViewCreateInfo image_view_info{
+ .image = vk::Image{decoder_out_image},
+ .viewType = vk::ImageViewType::e2D,
+ .format = vk::Format::eA8B8G8R8SrgbPack32,
+ .components = {},
+ .subresourceRange = {
+ .aspectMask = vk::ImageAspectFlagBits::eColor,
+ .baseMipLevel = 0,
+ .levelCount = 1,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
+ };
+
+ for (uint32_t view = 0; view < view_count; ++view)
+ {
+ auto & output = decoder_output[view];
+
+ image_view_info.subresourceRange.baseArrayLayer = view;
+ output.image_view = vk::raii::ImageView(device, image_view_info);
+
+ output.frame_buffer = vk::raii::Framebuffer(
+ device,
+ vk::FramebufferCreateInfo{
+ .renderPass = *blit_render_pass,
+ .attachmentCount = 1,
+ .pAttachments = &*output.image_view,
+ .width = decoder_out_size.width,
+ .height = decoder_out_size.height,
+ .layers = 1,
+ });
+ }
+ }
+
+ {
+ vk::DescriptorPoolSize pool_size{
+ .type = vk::DescriptorType::eCombinedImageSampler,
+ .descriptorCount = uint32_t(2 * description.items.size()),
+ };
+ blit_descriptor_pool = vk::raii::DescriptorPool(
+ device,
+ vk::DescriptorPoolCreateInfo{
+ .maxSets = uint32_t(2 * description.items.size()),
+ .poolSizeCount = 1,
+ .pPoolSizes = &pool_size,
+ });
+ }
for (const auto & [stream_index, item]: utils::enumerate(description.items))
{
spdlog::info("Creating decoder size {}x{} offset {},{}", item.width, item.height, item.offset_x, item.offset_y);
decoders.push_back(accumulator_images{
- .decoder = std::make_unique(device, physical_device, instance, item, description.fps, shared_from_this(), stream_index),
+ .decoder = std::make_unique(device, physical_device, item, description.fps, shared_from_this(), stream_index),
});
}
}
@@ -1118,6 +1400,15 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
const uint32_t video_width = video_stream_description->width / view_count;
const uint32_t video_height = video_stream_description->height;
+ const configuration::sgsr_settings sgsr = application::get_config().sgsr;
+ if (sgsr.enabled)
+ {
+ const float upscaling_factor = sgsr.upscaling_factor;
+ spdlog::info("Using SGSR with an upscale factor of {}", upscaling_factor);
+ swapchain_width *= upscaling_factor;
+ swapchain_height *= upscaling_factor;
+ }
+
auto views = system.view_configuration_views(viewconfig);
swapchain = xr::swapchain(session, device, swapchain_format, swapchain_width, swapchain_height, 1, views.size());
@@ -1134,9 +1425,12 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
for (auto & image: swapchain.images())
swapchain_images.push_back(image.image);
- defoveator.emplace(
+ reprojector.emplace(
device,
physical_device,
+ decoder_out_image,
+ vk::Extent2D{.width = video_width, .height = video_height},
+ 2,
swapchain_images,
extent,
swapchain.format());
diff --git a/client/scenes/stream.h b/client/scenes/stream.h
index 64cafea0..6f506ab7 100644
--- a/client/scenes/stream.h
+++ b/client/scenes/stream.h
@@ -23,9 +23,8 @@
#include "decoder/shard_accumulator.h"
#include "render/imgui_impl.h"
#include "scene.h"
-#include "scenes/blitter.h"
#include "scenes/input_profile.h"
-#include "stream_defoveator.h"
+#include "stream_reprojection.h"
#include "utils/thread_safe.h"
#include "wifi_lock.h"
#include "wivrn_client.h"
@@ -49,13 +48,6 @@ public:
};
static const size_t image_buffer_size = 3;
- struct app
- {
- std::string id;
- std::string name;
- std::vector image;
- };
-
private:
static const size_t view_count = 2;
@@ -64,12 +56,16 @@ private:
struct accumulator_images
{
std::unique_ptr decoder;
- // latest frames, rolling buffer
+ vk::raii::DescriptorSetLayout descriptor_set_layout = nullptr;
+ vk::DescriptorSet descriptor_set = nullptr;
+ vk::raii::PipelineLayout blit_pipeline_layout = nullptr;
+ vk::raii::Pipeline blit_pipeline = nullptr;
+ // latest frames from oldest to most recent
std::array, image_buffer_size> latest_frames;
std::shared_ptr frame(uint64_t id) const;
bool alpha() const;
- bool empty() const;
+ std::vector frames() const;
};
wifi_lock::wifi wifi;
@@ -81,9 +77,9 @@ private:
std::unique_ptr network_session;
std::atomic exiting = false;
std::thread network_thread;
- thread_safe tracking_control{};
+ std::mutex tracking_control_mutex;
+ to_headset::tracking_control tracking_control{};
std::array, 2> interaction_profiles; // left and right hand
- std::atomic interaction_profile_changed = false;
std::atomic recenter_requested = false;
std::atomic display_time_phase = 0;
std::atomic display_time_period = 0;
@@ -94,10 +90,21 @@ private:
std::shared_mutex decoder_mutex;
std::optional video_stream_description;
std::vector decoders; // Locked by decoder_mutex
+ vk::raii::DescriptorPool blit_descriptor_pool = nullptr;
+ vk::raii::RenderPass blit_render_pass = nullptr;
- std::array blitters;
+ vk::Extent2D decoder_out_size;
+ vk::Format decoder_out_format;
+ image_allocation decoder_out_image;
- std::optional defoveator;
+ struct renderpass_output
+ {
+ vk::raii::ImageView image_view = nullptr;
+ vk::raii::Framebuffer frame_buffer = nullptr;
+ };
+ std::array decoder_output;
+
+ std::optional reprojector;
vk::raii::Fence fence = nullptr;
vk::raii::CommandBuffer command_buffer = nullptr;
@@ -118,8 +125,6 @@ private:
std::optional
"
-msgstr ""
-"Gözlük algılanmadı. Şunlardan emin olun:\n"
-"
"
-
-#: dashboard/qml/WizardPage.qml:280
-#, kde-format
-msgid "Select the application you want to start"
-msgstr "Başlatmak istediğiniz uygulamayı seçin"
-
-#: dashboard/qml/WizardPage.qml:286
-#, kde-format
-msgid ""
-"The application you choose will be started automatically when you connect "
-"your headset."
-msgstr ""
-"Seçtiğiniz uygulama, gözlüğünüzü bağladığınızda otomatik olarak "
-"başlayacaktır."
-
-#: dashboard/qml/WizardPage.qml:301
-#, kde-format
-msgid "Important information"
-msgstr "Önemli bilgi"
-
-#: dashboard/qml/WizardPage.qml:308
-#, kde-format
-msgid ""
-"WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is "
-"running."
-msgstr ""
-"WiVRn, SteamVR'nin yerini tamamen alır, WiVRn çalışırken SteamVR'yi "
-"başlatmamalısınız."
-
-#: dashboard/qml/WizardPage.qml:359
-#, kde-format
-msgid "Start the WiVRn app on your headset"
-msgstr "Gözlüğünüzde WiVRn uygulamasını başlatın"
-
-#: dashboard/qml/WizardPage.qml:364
-#, kde-format
-msgid ""
-"To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" "
-"and enter PIN \"%2\"."
-msgstr ""
-"WiFi üzerinden bağlanmak için, gözlüğünüzde WiVRn uygulamasını başlatın, "
-"\"%1\"e bağlanın ve \"%2\" PIN'ini girin."
-
-#: dashboard/qml/WizardPage.qml:371
-#, kde-format
-msgid "To connect over USB, click on \"Connect by USB\"."
-msgstr "USB üzerinden bağlanmak için \"USB ile bağlan\"a tıklayın."
-
-#: dashboard/qml/WizardPage.qml:384
-#, kde-format
-msgid "Troubleshooting"
-msgstr "Sorun giderme"
-
-#: dashboard/qml/WizardPage.qml:406
-#, kde-format
-msgid "Skip"
-msgstr "Atla"
-
-#: dashboard/qml/WizardPage.qml:426
-#, kde-format
-msgid "Connection established"
-msgstr "Bağlantı kuruldu"
-
-#: dashboard/qml/WizardPage.qml:431
-#, kde-format
-msgid "Your headset is now connected."
-msgstr "Gözlüğünüz şimdi bağlı."
-
-#: dashboard/qml/WizardPage.qml:436 dashboard/qml/WizardPage.qml:478
-#, kde-format
-msgid ""
-"To connect another headset, make sure pairing is enabled in the dashboard "
-"before connecting."
-msgstr ""
-"Başka bir gözlük bağlamak için, bağlanmadan önce kontrol panelinde "
-"eşleştirmenin etkinleştirildiğinden emin olun."
-
-#: dashboard/qml/WizardPage.qml:458 dashboard/qml/WizardPage.qml:495
-#, kde-format
-msgid "Finish"
-msgstr "Bitir"
-
-#: dashboard/qml/WizardPage.qml:473
-#, kde-format
-msgid "Finished"
-msgstr "Bitti"
-
-#: dashboard/wivrn_server.cpp:592
-#, kde-format
-msgid "xrizer"
-msgstr "xrizer"
-
-#: dashboard/wivrn_server.cpp:593
-#, kde-format
-msgid "Open Composite"
-msgstr "Open Composite"
diff --git a/locale/tr/wivrn.po b/locale/tr/wivrn.po
deleted file mode 100644
index ec0520a6..00000000
--- a/locale/tr/wivrn.po
+++ /dev/null
@@ -1,629 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the WiVRn package.
-# FIRST AUTHOR , YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: WiVRn\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2025-09-18 13:35+0200\n"
-"PO-Revision-Date: 2025-09-12 17:35+0300\n"
-"Last-Translator: Hüseyin Fahri Uzun \n"
-"Language-Team: \n"
-"Language: tr\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 3.6\n"
-
-#: client/scene.cpp:72
-msgid "No supported swapchain format"
-msgstr "Desteklenen swapchain formatı yok"
-
-#: client/scenes/lobby.cpp:185
-msgid "Incompatible WiVRn server: no protocol field in TXT"
-msgstr "Uyumsuz WiVRn sunucusu: TXT dosyasında protokol alanı yok"
-
-#: client/scenes/lobby.cpp:188
-#, c++-format
-msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
-msgstr "Uyumsuz WiVRn sunucu protokolü (uçbirim: {}, sunucu: {})"
-
-#: client/scenes/lobby.cpp:203
-#, c++-format
-msgid "Cannot resolve hostname: {}"
-msgstr "Ana bilgisayar adı çözümlenemiyor: {}"
-
-#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296
-#, c++-format
-msgid "Cannot connect to {} ({}): {}"
-msgstr "Bağlanılamıyor {} ({}): {}"
-
-#: client/scenes/lobby.cpp:379
-msgid "Waiting for connection"
-msgstr "Bağlantı için bekleniyor"
-
-#: client/scenes/lobby_gui.cpp:232
-msgctxt "openxr_post_processing"
-msgid "Normal"
-msgstr "Normal"
-
-#: client/scenes/lobby_gui.cpp:235
-msgctxt "openxr_post_processing"
-msgid "Quality"
-msgstr "Kalite"
-
-#: client/scenes/lobby_gui.cpp:237
-msgctxt "openxr_post_processing"
-msgid "Disabled"
-msgstr "Devre dışı"
-
-#: client/scenes/lobby_gui.cpp:245 client/scenes/lobby_gui.cpp:402
-#: client/scenes/stream_gui.cpp:838
-msgid "Disconnect"
-msgstr "Bağlantıyı Kes"
-
-#: client/scenes/lobby_gui.cpp:266 client/scenes/stream_gui.cpp:834
-msgid "Close"
-msgstr "Kapat"
-
-#: client/scenes/lobby_gui.cpp:272
-msgid "Connection"
-msgstr "Bağlantı"
-
-#: client/scenes/lobby_gui.cpp:274
-#, c++-format
-msgid "Connection to {}"
-msgstr "{} Bağlan"
-
-#: client/scenes/lobby_gui.cpp:304
-msgid "PIN"
-msgstr "PIN"
-
-#: client/scenes/lobby_gui.cpp:326
-msgid "Input the PIN displayed on the dashboard"
-msgstr "Gösterilen PIN'i gösterge paneline giriniz"
-
-#: client/scenes/lobby_gui.cpp:397
-msgid "Connected to WiVRn server"
-msgstr "WiVRn sunucusuna bağlanıldı"
-
-#: client/scenes/lobby_gui.cpp:399
-#, c++-format
-msgid "Connected to {}"
-msgstr "{} bağlanıldı"
-
-#: client/scenes/lobby_gui.cpp:409
-msgid "Start an application on the server to start streaming."
-msgstr "Sunucuda bir uygulama başlatarak akışa başlayın."
-
-#: client/scenes/lobby_gui.cpp:421
-msgid "Start an application on your computer or select one to start streaming."
-msgstr ""
-"Bilgisayarınızda bir uygulama başlatın veya akış başlatmak için bir uygulama "
-"seçin."
-
-#: client/scenes/lobby_gui.cpp:423
-#, c++-format
-msgid "Start an application on {} or select one to start streaming."
-msgstr ""
-"{} üzerinde bir uygulama başlatın veya akış başlatmak için bir tane seçin."
-
-#: client/scenes/lobby_gui.cpp:546
-msgid "Name"
-msgstr "Ad"
-
-#: client/scenes/lobby_gui.cpp:557
-msgid "Address"
-msgstr "Adres"
-
-#: client/scenes/lobby_gui.cpp:566
-msgid "Port"
-msgstr "Port"
-
-#: client/scenes/lobby_gui.cpp:574
-msgid "TCP only"
-msgstr "Sadece TCP"
-
-#: client/scenes/lobby_gui.cpp:581
-msgid "Cancel"
-msgstr "İptal"
-
-#: client/scenes/lobby_gui.cpp:595
-msgid "Save"
-msgstr "Kaydet"
-
-#: client/scenes/lobby_gui.cpp:648
-msgid ""
-"Start a WiVRn server on your\n"
-"local network"
-msgstr ""
-"Yerel ağınızda\n"
-"bir WiVRn sunucusu başlatın"
-
-#: client/scenes/lobby_gui.cpp:680
-msgid "Autoconnect"
-msgstr "Oto Bağlan"
-
-#: client/scenes/lobby_gui.cpp:706
-msgid "Connect"
-msgstr "Bağlan"
-
-#: client/scenes/lobby_gui.cpp:716 client/wivrn_client.cpp:186
-msgid "Incompatible server version"
-msgstr "Uyumsuz sunucu versiyonu"
-
-#: client/scenes/lobby_gui.cpp:718
-msgid "Server not available"
-msgstr "Sunucu mevcut değil"
-
-#: client/scenes/lobby_gui.cpp:800
-msgctxt "language selection, replace with the name of the language"
-msgid "English"
-msgstr "Türkçe"
-
-#: client/scenes/lobby_gui.cpp:814
-msgid "Language"
-msgstr ""
-
-#: client/scenes/lobby_gui.cpp:814 client/scenes/lobby_gui.cpp:816
-msgid "System language"
-msgstr ""
-
-#: client/scenes/lobby_gui.cpp:841
-msgid "Refresh rate"
-msgstr "Tazeleme oranı"
-
-#: client/scenes/lobby_gui.cpp:841 client/scenes/lobby_gui.cpp:843
-msgctxt "automatic refresh rate"
-msgid "Automatic"
-msgstr "Otomatik"
-
-#: client/scenes/lobby_gui.cpp:850
-msgid ""
-"Select refresh rate based on measured application performance.\n"
-"May cause flicker when a change happens."
-msgstr ""
-"Ölçülen uygulama performansına göre yenileme hızını seçin.\n"
-"Değişiklik olduğunda titremeye neden olabilir."
-
-#: client/scenes/lobby_gui.cpp:867
-msgid "Minimum refresh rate"
-msgstr "Minimum tazeleme oranı"
-
-#: client/scenes/lobby_gui.cpp:890
-msgid "Resolution scale"
-msgstr "Çözünürlük ölçeği"
-
-#: client/scenes/lobby_gui.cpp:894
-#, c-format, c++-format
-msgid "%d%% - {}x{} per eye"
-msgstr "göz başına %d%% - {}x{}"
-
-#: client/scenes/lobby_gui.cpp:905
-#, c++-format
-msgid "Resolution larger than {}x{} may not be supported by the headset"
-msgstr ""
-"{}x{} 'den daha büyük çözünürlükler gözlük tarafından desteklenmeyebilir"
-
-#: client/scenes/lobby_gui.cpp:911
-msgid "Enable microphone"
-msgstr "Mikrofonu aktif et"
-
-#: client/scenes/lobby_gui.cpp:920
-msgid "Unprocessed Microphone Audio"
-msgstr "İşlenmemiş Mikrofon Sesi"
-
-#: client/scenes/lobby_gui.cpp:926
-msgid "Force disable audio filters, such as noise cancellation"
-msgstr "Gürültü engelleme gibi ses filtrelerini zorla devre dışı bırak"
-
-#: client/scenes/lobby_gui.cpp:933
-msgid "Enable hand tracking"
-msgstr "El izlemeyi etkinleştir"
-
-#: client/scenes/lobby_gui.cpp:939 client/scenes/lobby_gui.cpp:951
-#: client/scenes/lobby_gui.cpp:963 client/scenes/lobby_gui.cpp:980
-#: client/scenes/lobby_gui.cpp:1025
-msgid "This feature is not supported by your headset"
-msgstr "Bu özellik gözlüğünüz tarafından desteklenmemektedir"
-
-#: client/scenes/lobby_gui.cpp:945
-msgid "Enable eye tracking"
-msgstr "Göz takibi aktif et"
-
-#: client/scenes/lobby_gui.cpp:957
-msgid "Enable face tracking"
-msgstr "Yüz takibi aktif et"
-
-#: client/scenes/lobby_gui.cpp:971
-msgid "Enable body tracking"
-msgstr "Vücut takibi aktif et"
-
-#: client/scenes/lobby_gui.cpp:985
-msgid ""
-"Requires 'Hand and body tracking' to be enabled in the Quest movement "
-"tracking settings,\n"
-"otherwise body data will be guessed from controller and headset positions"
-msgstr ""
-"Quest hareket izleme ayarlarında 'El ve vücut izleme' özelliğinin "
-"etkinleştirilmesi gerekir,\n"
-"aksi takdirde vücut verileri kontrol cihazı ve başlık konumlarından tahmin "
-"edilecektir"
-
-#: client/scenes/lobby_gui.cpp:995
-msgid "Enable lower body tracking"
-msgstr "Alt vücut izlemeyi etkinleştir"
-
-#: client/scenes/lobby_gui.cpp:1001
-msgid ""
-"Estimate lower body joint positions using Generative Legs\n"
-"Requires 'Hand and body tracking' to be enabled in the Quest movement "
-"tracking settings"
-msgstr ""
-"Generative Legs kullanarak alt vücut eklem pozisyonlarını tahmin edin\n"
-"Quest hareket izleme ayarlarında 'El ve vücut izleme' özelliğinin "
-"etkinleştirilmesi gerekir"
-
-#: client/scenes/lobby_gui.cpp:1004
-msgid "Enable hip tracking"
-msgstr "Kalça izlemeyi etkinleştir"
-
-#: client/scenes/lobby_gui.cpp:1010
-msgid ""
-"Only takes affect with lower body tracking enabled\n"
-"May be desired when using another source of hip tracking"
-msgstr ""
-"Sadece alt vücut izleme etkinleştirildiğinde geçerlidir\n"
-"Başka bir kalça izleme kaynağı kullanıldığında tercih edilebilir"
-
-#: client/scenes/lobby_gui.cpp:1018
-msgid "Enable video passthrough in lobby"
-msgstr "Lobide video geçişini etkinleştir"
-
-#: client/scenes/lobby_gui.cpp:1029
-msgid "Enable in-stream window"
-msgstr "Akış penceresinde aktif et"
-
-#: client/scenes/lobby_gui.cpp:1032
-msgid ""
-"Enables the configuration window to be shown while the game is streaming.\n"
-"If enabled, the window is activated by pressing both thumbsticks."
-msgstr ""
-"Oyun akışı yapılırken ayar penceresini aktif eder.\n"
-"Aktif iken, pencere her iki başparmak tuşlarına basılınca açılır."
-
-#: client/scenes/lobby_gui.cpp:1046 client/scenes/stream_gui.cpp:445
-msgid "OpenXR post-processing"
-msgstr "OpenXR işlem sonrası"
-
-#: client/scenes/lobby_gui.cpp:1050 client/scenes/stream_gui.cpp:449
-msgid "Supersampling"
-msgstr "Süper örnekleme"
-
-#: client/scenes/lobby_gui.cpp:1070 client/scenes/stream_gui.cpp:470
-msgid ""
-"Reduce flicker for high contrast edges.\n"
-"Useful when the input resolution is high compared to the headset display"
-msgstr ""
-"Yüksek kontrastlı kenarlarda titremeyi azaltın.\n"
-"Giriş çözünürlüğü kulaklık ekranına kıyasla yüksek olduğunda kullanışlıdır"
-
-#: client/scenes/lobby_gui.cpp:1075 client/scenes/stream_gui.cpp:475
-msgid "Sharpening"
-msgstr "Keskinleştirme"
-
-#: client/scenes/lobby_gui.cpp:1095 client/scenes/stream_gui.cpp:496
-msgid ""
-"Improve clarity of high contrast edges and counteract blur.\n"
-"Useful when the input resolution is low compared to the headset display"
-msgstr ""
-"Yüksek kontrastlı kenarların netliğini artırın ve bulanıklığı giderin.\n"
-"Giriş çözünürlüğü kulaklık ekranına kıyasla düşük olduğunda kullanışlıdır"
-
-#: client/scenes/lobby_gui.cpp:1191 client/scenes/lobby_gui.cpp:1199
-#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:424
-msgid "CPU time"
-msgstr "CPU zamanı"
-
-#: client/scenes/lobby_gui.cpp:1195
-msgid "CPU time [ms]"
-msgstr "CPU zamanı [ms]"
-
-#: client/scenes/lobby_gui.cpp:1205 client/scenes/lobby_gui.cpp:1213
-#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:425
-msgid "GPU time"
-msgstr "GPU zamanı"
-
-#: client/scenes/lobby_gui.cpp:1209
-msgid "GPU time [ms]"
-msgstr "GPU zamanı [ms]"
-
-#: client/scenes/lobby_gui.cpp:1252
-msgid "Enable the microphone?"
-msgstr "Mikrofonu aktif et?"
-
-#: client/scenes/lobby_gui.cpp:1257
-msgid "Enable eye tracking?"
-msgstr "Göz takibi aktif et?"
-
-#: client/scenes/lobby_gui.cpp:1262
-msgid "Enable face tracking?"
-msgstr "Yüz takibi aktif et?"
-
-#: client/scenes/lobby_gui.cpp:1267
-msgid "Enable body tracking?"
-msgstr "Vücut takibi aktif et?"
-
-#: client/scenes/lobby_gui.cpp:1275
-msgid "Welcome to WiVRn"
-msgstr "WiVRn'e hoş geldiniz"
-
-#: client/scenes/lobby_gui.cpp:1299
-msgid "Yes"
-msgstr "Evet"
-
-#: client/scenes/lobby_gui.cpp:1306
-msgid "No"
-msgstr "Hayır"
-
-#: client/scenes/lobby_gui.cpp:1325 client/scenes/lobby_gui.cpp:1972
-msgid "Licenses"
-msgstr "Lisanslar"
-
-#: client/scenes/lobby_gui.cpp:1650
-msgid "Microphone is enabled"
-msgstr "Mikrofon aktif"
-
-#: client/scenes/lobby_gui.cpp:1651
-msgid "Microphone is disabled"
-msgstr "Mikrofon devre dışı"
-
-#: client/scenes/lobby_gui.cpp:1660
-msgid "Hand tracking is enabled"
-msgstr "El takibi aktif"
-
-#: client/scenes/lobby_gui.cpp:1661
-msgid "Hand tracking is disabled"
-msgstr "El takibi devre dışı"
-
-#: client/scenes/lobby_gui.cpp:1670
-msgid "Eye tracking is enabled"
-msgstr "Göz takibi aktif"
-
-#: client/scenes/lobby_gui.cpp:1671
-msgid "Eye tracking is disabled"
-msgstr "Göz takibi devre dışı"
-
-#: client/scenes/lobby_gui.cpp:1681
-msgid "Face tracking is enabled"
-msgstr "Yüz takibi aktif"
-
-#: client/scenes/lobby_gui.cpp:1682
-msgid "Face tracking is disabled"
-msgstr "Yüz takibi devre dışı"
-
-#: client/scenes/lobby_gui.cpp:1692
-msgid "Body tracking is enabled"
-msgstr "Vücut takibi aktif"
-
-#: client/scenes/lobby_gui.cpp:1693
-msgid "Body tracking is disabled"
-msgstr "Vücut takibi devre dışı"
-
-#: client/scenes/lobby_gui.cpp:1709
-msgid "Add server"
-msgstr "Sunucu ekle"
-
-#: client/scenes/lobby_gui.cpp:1954
-msgid "Server list"
-msgstr "Sunucu listesi"
-
-#: client/scenes/lobby_gui.cpp:1957 client/scenes/stream_gui.cpp:822
-msgid "Settings"
-msgstr "Ayarlar"
-
-#: client/scenes/lobby_gui.cpp:1960
-msgid "Post-processing"
-msgstr "İşlem sonrası"
-
-#: client/scenes/lobby_gui.cpp:1964
-msgid "Debug"
-msgstr "Hata ayıklama"
-
-#: client/scenes/lobby_gui.cpp:1969
-msgid "About"
-msgstr "Hakkında"
-
-#: client/scenes/lobby_gui.cpp:1975
-msgid "Exit"
-msgstr "Çıkış"
-
-#: client/scenes/lobby_gui.cpp:1992
-msgid ""
-"Press the grip button or put your palm up\n"
-"to move the main window"
-msgstr ""
-"Ana pencereyi hareket ettirmek için tutma düğmesine basın\n"
-"veya avucunuzu yukarı kaldırın"
-
-#: client/scenes/lobby_gui.cpp:1994
-msgid "Press the grip button to move the main window"
-msgstr "Ana pencereyi hareket ettirmek için tutma düğmesine basın"
-
-#: client/scenes/stream_gui.cpp:224
-msgid "Reproject"
-msgstr "Yeniden yansıt"
-
-#: client/scenes/stream_gui.cpp:225
-msgid "Blit"
-msgstr "Blit"
-
-#: client/scenes/stream_gui.cpp:227
-msgid "Network"
-msgstr "Ağ"
-
-#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:422
-msgid "Download"
-msgstr "İndir"
-
-#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:423
-msgid "Upload"
-msgstr "Gönder"
-
-#: client/scenes/stream_gui.cpp:297
-#, c++-format
-msgid "Decoder {}"
-msgstr "Decoder {}"
-
-#: client/scenes/stream_gui.cpp:309
-msgid "Timings [ms]"
-msgstr "Zaman [ms]"
-
-#: client/scenes/stream_gui.cpp:369
-msgid "Encode"
-msgstr "Encode"
-
-#: client/scenes/stream_gui.cpp:370
-msgid "Send"
-msgstr "Gönder"
-
-#: client/scenes/stream_gui.cpp:371
-msgid "Receive"
-msgstr "Al"
-
-#: client/scenes/stream_gui.cpp:372
-msgid "Decode"
-msgstr "Decode"
-
-#: client/scenes/stream_gui.cpp:373
-msgid "Blitted"
-msgstr "Blitted"
-
-#: client/scenes/stream_gui.cpp:374
-msgid "Displayed"
-msgstr "Görüntülenen"
-
-#: client/scenes/stream_gui.cpp:375
-msgid "Predicted"
-msgstr "Tahmin edilen"
-
-#: client/scenes/stream_gui.cpp:395
-#, c++-format
-msgid "Estimated motion to photons latency: {}ms"
-msgstr "Fotonlara tahmini hareket gecikmesi: {}ms"
-
-#: client/scenes/stream_gui.cpp:402
-msgid "Press the grip button to move the window"
-msgstr "Pencereyi hareket ettirmek için tutma düğmesine basın"
-
-#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:776
-msgid "Press both thumbsticks to display the WiVRn window"
-msgstr ""
-"WiVRn penceresini görüntülemek için her iki başparmak çubuklarınıda basın"
-
-#: client/scenes/stream_gui.cpp:426
-msgid "Motion to photon latency"
-msgstr "Hareketin fotona ulaşma gecikmesi"
-
-#: client/scenes/stream_gui.cpp:503
-msgid "Foveation center override"
-msgstr "Foveasyon merkezi geçersiz kılma"
-
-#: client/scenes/stream_gui.cpp:506
-msgid "Enable"
-msgstr "Aktif et"
-
-#: client/scenes/stream_gui.cpp:514 client/scenes/stream_gui.cpp:561
-#, c++-format
-msgid "Height {:.1f} deg"
-msgstr "Boy {:.1f} deg"
-
-#: client/scenes/stream_gui.cpp:515 client/scenes/stream_gui.cpp:562
-#, c++-format
-msgid "Distance {:.2f} m"
-msgstr "Uzaklık {:.2f} m"
-
-#: client/scenes/stream_gui.cpp:516
-msgid "Default"
-msgstr "Varsayılan"
-
-#: client/scenes/stream_gui.cpp:527
-msgid "Change"
-msgstr "Değiştir"
-
-#: client/scenes/stream_gui.cpp:559
-msgid "Use the thumbsticks to move the foveation center"
-msgstr "Başparmak çubuklarını kullanarak odak merkezini hareket ettirin"
-
-#: client/scenes/stream_gui.cpp:560
-msgid "Press A to save or B to cancel"
-msgstr "Kaydetmek için A tuşuna, iptal etmek için B tuşuna basın"
-
-#: client/scenes/stream_gui.cpp:819
-msgid "Stats"
-msgstr "İstatistikler"
-
-#: client/scenes/stream_gui.cpp:828
-msgid "Statistics overlay"
-msgstr "İstatistik katmanı"
-
-#: client/scenes/stream_gui.cpp:831
-msgid "Compact view"
-msgstr "Kompakt görünüm"
-
-#: client/wivrn_client.cpp:98 client/wivrn_client.cpp:202
-msgid "Timeout"
-msgstr "Zaman aşımı"
-
-#: client/wivrn_client.cpp:149
-msgid "Incorrect PIN"
-msgstr "Geçersiz PIN"
-
-#: client/wivrn_client.cpp:153
-msgid "Unable to check PIN"
-msgstr "PIN kontrol edilemiyor"
-
-#: client/wivrn_client.cpp:182
-msgid "Pairing is disabled on server"
-msgstr "Bu sunucuda eşleşme devre dışı"
-
-#~ msgid "Enable Snapdragon Game Super Resolution"
-#~ msgstr "Snapdragon Oyun Süper Çözünürlüğü'nü etkinleştirin"
-
-#~ msgid ""
-#~ "On this headset, this setting has been fully superseded by the native "
-#~ "Sharpening setting above.\n"
-#~ "Only enable if you know what you're doing."
-#~ msgstr ""
-#~ "Bu kulaklıkta, bu ayar yukarıdaki yerel Keskinleştirme ayarı ile tamamen "
-#~ "değiştirilmiştir.\n"
-#~ "Ne yaptığınızı biliyorsanız etkinleştirin."
-
-#~ msgid ""
-#~ "Client-side upscaling and sharpening, adds a performance cost on the "
-#~ "headset"
-#~ msgstr ""
-#~ "İstemci tarafında yükseltme ve keskinleştirme, kulaklıkta performans "
-#~ "düşüşüne neden olur."
-
-#~ msgid "Upscaling factor"
-#~ msgstr "Yükseltme faktörü"
-
-#~ msgid "Use edge direction"
-#~ msgstr "Kenar yönünü kullan"
-
-#~ msgid "Adds an additional performance cost"
-#~ msgstr "Ek bir performans düşüşü ekler"
-
-#~ msgid "Edge threshold"
-#~ msgstr "Kenar eşiği"
-
-#, c++-format
-#~ msgid "Recommended: {:.1f}"
-#~ msgstr "Önerilen: {:.1f}"
-
-#~ msgid "Edge sharpness"
-#~ msgstr "Kenar keskinliği"
diff --git a/patches/monado/0001-c-multi-early-wake-of-compositor.patch b/patches/monado/0001-c-multi-early-wake-of-compositor.patch
index d13bc098..ee810261 100644
--- a/patches/monado/0001-c-multi-early-wake-of-compositor.patch
+++ b/patches/monado/0001-c-multi-early-wake-of-compositor.patch
@@ -1,7 +1,7 @@
-From 84758f77a11a31e144d2120a465a954287eb0f67 Mon Sep 17 00:00:00 2001
+From 18e184e504d9f55dbba3f02c87f96410b2ce04ab Mon Sep 17 00:00:00 2001
From: Patrick Nicolas
Date: Tue, 22 Oct 2024 15:23:19 +0200
-Subject: [PATCH 1/7] c/multi: early wake of compositor
+Subject: [PATCH 01/10] c/multi: early wake of compositor
---
.../compositor/multi/comp_multi_compositor.c | 14 +++++++++
@@ -10,10 +10,10 @@ Subject: [PATCH 1/7] c/multi: early wake of compositor
3 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c
-index 94cea110e..88347a092 100644
+index 553565db4..789a2d042 100644
--- a/src/xrt/compositor/multi/comp_multi_compositor.c
+++ b/src/xrt/compositor/multi/comp_multi_compositor.c
-@@ -236,7 +236,21 @@ wait_for_scheduled_free(struct multi_compositor *mc)
+@@ -232,7 +232,21 @@ wait_for_scheduled_free(struct multi_compositor *mc)
os_mutex_lock(&mc->slot_lock);
slot_move_and_clear_locked(mc, &mc->scheduled, &mc->progress);
os_mutex_unlock(&mc->slot_lock);
@@ -128,5 +128,5 @@ index be763d1c1..22c801f65 100644
//! @todo Make the clients not go from IDLE to READY before we have completed a first frame.
// Make sure there is at least some sort of valid frame data here.
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch
index e8d6e001..ef9c355d 100644
--- a/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch
+++ b/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch
@@ -1,7 +1,7 @@
-From b73d7a32daa626ae401543e1c3ed8fd8d8290f8d Mon Sep 17 00:00:00 2001
+From b31b5aa4e7e890ae079ae2953a1ce3fc2e47b954 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas
Date: Tue, 2 Apr 2024 17:14:42 +0200
-Subject: [PATCH 2/7] ipc/server: Always listen to stdin
+Subject: [PATCH 02/10] ipc/server: Always listen to stdin
---
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 2 +-
@@ -21,5 +21,5 @@ index d364fbed3..ad6b473b7 100644
// default.
// This polls stdin.
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0003-Use-extern-socket-fd.patch b/patches/monado/0003-Use-extern-socket-fd.patch
index ff7baad0..ca626a54 100644
--- a/patches/monado/0003-Use-extern-socket-fd.patch
+++ b/patches/monado/0003-Use-extern-socket-fd.patch
@@ -1,7 +1,7 @@
-From a85beae795aba8f82abab849e9e5c2ce74511357 Mon Sep 17 00:00:00 2001
+From 46cacda03c5552ffb70601dd89e0abe38e97c1d3 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas
Date: Tue, 8 Oct 2024 22:13:15 +0200
-Subject: [PATCH 3/7] Use extern socket fd
+Subject: [PATCH 03/10] Use extern socket fd
---
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++
@@ -34,5 +34,5 @@ index ad6b473b7..ea6fad65b 100644
// We may have been launched with socket activation
int num_fds = sd_listen_fds(0);
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0004-change-environment-blend-mode-selection-logic.patch b/patches/monado/0004-change-environment-blend-mode-selection-logic.patch
index 959f1639..d06ff96f 100644
--- a/patches/monado/0004-change-environment-blend-mode-selection-logic.patch
+++ b/patches/monado/0004-change-environment-blend-mode-selection-logic.patch
@@ -1,7 +1,7 @@
-From f472a02f86bd98e0cb88847fd8c9104bbd5c74f5 Mon Sep 17 00:00:00 2001
+From 9e2288bc85a5be9bb0228a42dc5a9419c4357eb8 Mon Sep 17 00:00:00 2001
From: galister <85970-galister@users.noreply.gitlab.freedesktop.org>
Date: Sat, 23 Nov 2024 02:42:12 +0900
-Subject: [PATCH 4/7] change environment blend mode selection logic
+Subject: [PATCH 05/10] change environment blend mode selection logic
---
src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++-------
@@ -53,5 +53,5 @@ index 22c801f65..1155bc67e 100644
}
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch b/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch
index 11da7918..d3c7b63a 100644
--- a/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch
+++ b/patches/monado/0005-st-oxr-forward-0-refresh-rate.patch
@@ -1,7 +1,7 @@
-From 7c01c47b2a1c4da040e0d25f4b9cb760ae88aa25 Mon Sep 17 00:00:00 2001
+From 53d8509dff69caccecdc38b443864b1a755486dd Mon Sep 17 00:00:00 2001
From: Patrick Nicolas
Date: Sat, 15 Mar 2025 22:19:48 +0100
-Subject: [PATCH 5/7] st/oxr: forward 0 refresh rate
+Subject: [PATCH 09/10] st/oxr: forward 0 refresh rate
---
src/xrt/state_trackers/oxr/oxr_api_session.c | 6 +-----
@@ -29,5 +29,5 @@ index 9c5889f12..c4cdaf8c3 100644
if ((int)(displayRefreshRate * 100.0f) == (int)(sess->sys->xsysc->info.refresh_rates_hz[i] * 100.0f)) {
found = true;
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0006-Replace-distortion-with-foveation.patch b/patches/monado/0006-Replace-distortion-with-foveation.patch
index 9039fe7f..6de3da68 100644
--- a/patches/monado/0006-Replace-distortion-with-foveation.patch
+++ b/patches/monado/0006-Replace-distortion-with-foveation.patch
@@ -1,50 +1,26 @@
-From 240edeee8136b72b0c108b39f9eb032138683a46 Mon Sep 17 00:00:00 2001
+From 437469e6a4de72ab69719cce92b841e4de19156f Mon Sep 17 00:00:00 2001
From: Patrick Nicolas
Date: Wed, 11 Sep 2024 22:56:29 +0200
-Subject: [PATCH 6/7] Replace distortion with foveation
+Subject: [PATCH 06/10] Convert to YCbCr in Monado
---
- src/xrt/compositor/CMakeLists.txt | 4 +-
src/xrt/compositor/main/comp_renderer.c | 6 +-
src/xrt/compositor/main/comp_target.h | 3 +-
- src/xrt/compositor/render/render_compute.c | 267 +++++-------------
- src/xrt/compositor/render/render_interface.h | 48 ++--
- src/xrt/compositor/render/render_resources.c | 106 +++----
- src/xrt/compositor/shaders/clear.comp | 4 +-
- src/xrt/compositor/shaders/distortion.comp | 169 +++++------
+ src/xrt/compositor/render/render_compute.c | 104 ++++++++++++------
+ src/xrt/compositor/render/render_interface.h | 15 ++-
+ src/xrt/compositor/render/render_resources.c | 35 ++++--
+ src/xrt/compositor/shaders/distortion.comp | 62 +++++++----
.../compositor/util/comp_high_level_render.c | 6 +-
.../compositor/util/comp_high_level_render.h | 9 +-
src/xrt/compositor/util/comp_render.h | 11 +-
- src/xrt/compositor/util/comp_render_cs.c | 44 ++-
- 12 files changed, 245 insertions(+), 432 deletions(-)
+ src/xrt/compositor/util/comp_render_cs.c | 19 +++-
+ 10 files changed, 184 insertions(+), 86 deletions(-)
-diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt
-index 1ba5ec438..eb068f5fc 100644
---- a/src/xrt/compositor/CMakeLists.txt
-+++ b/src/xrt/compositor/CMakeLists.txt
-@@ -105,7 +105,7 @@ if(XRT_HAVE_VULKAN)
- spirv_shaders(
- SHADER_HEADERS
- SPIRV_VERSION
-- 1.0 # Currently targeting Vulkan 1.0
-+ 1.3 # Currently targeting Vulkan 1.3
- SOURCES
- ${SHADERS}
- )
-@@ -115,7 +115,7 @@ if(XRT_HAVE_VULKAN)
- ${SHADER_HEADERS}
- render/render_buffer.c
- render/render_compute.c
-- render/render_distortion.c
-+ # render/render_distortion.c implemented in wivrn
- render/render_gfx.c
- render/render_interface.h
- render/render_resources.c
diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c
-index e45d33e22..d2518585c 100644
+index c6f589466..0895ff694 100644
--- a/src/xrt/compositor/main/comp_renderer.c
+++ b/src/xrt/compositor/main/comp_renderer.c
-@@ -936,7 +936,8 @@ dispatch_compute(struct comp_renderer *r,
+@@ -933,7 +933,8 @@ dispatch_compute(struct comp_renderer *r,
// Target Vulkan resources..
VkImage target_image = r->c->target->images[r->acquired_buffer].handle;
@@ -54,7 +30,7 @@ index e45d33e22..d2518585c 100644
// Target view information.
struct render_viewport_data target_viewport_datas[XRT_MAX_VIEWS];
-@@ -952,7 +953,8 @@ dispatch_compute(struct comp_renderer *r,
+@@ -949,7 +950,8 @@ dispatch_compute(struct comp_renderer *r,
eye_poses, //
fovs, //
target_image, //
@@ -79,9 +55,20 @@ index 2122f46e7..53dcd631b 100644
/*!
diff --git a/src/xrt/compositor/render/render_compute.c b/src/xrt/compositor/render/render_compute.c
-index 27b1953cf..44c3f0aee 100644
+index 27b1953cf..fd04801d4 100644
--- a/src/xrt/compositor/render/render_compute.c
+++ b/src/xrt/compositor/render/render_compute.c
+@@ -66,8 +66,8 @@ calc_dispatch_dims_views(const struct render_viewport_data views[XRT_MAX_VIEWS],
+ #undef IMAX
+
+ // Power of two divide and round up.
+- w = uint_divide_and_round_up(w, 8);
+- h = uint_divide_and_round_up(h, 8);
++ w = uint_divide_and_round_up(w, 16);
++ h = uint_divide_and_round_up(h, 16);
+
+ *out_w = w;
+ *out_h = h;
@@ -86,8 +86,10 @@ update_compute_layer_descriptor_set(struct vk_bundle *vk,
VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE],
VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE],
@@ -148,16 +135,12 @@ index 27b1953cf..44c3f0aee 100644
};
vk->vkUpdateDescriptorSets( //
-@@ -152,10 +167,12 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
- VkSampler src_samplers[XRT_MAX_VIEWS],
- VkImageView src_image_views[XRT_MAX_VIEWS],
+@@ -154,8 +169,10 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
uint32_t distortion_binding,
-- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS],
-- VkImageView distortion_image_views[3 * XRT_MAX_VIEWS],
+ VkSampler distortion_samplers[3 * XRT_MAX_VIEWS],
+ VkImageView distortion_image_views[3 * XRT_MAX_VIEWS],
- uint32_t target_binding,
- VkImageView target_image_view,
-+ VkDeviceSize foveation_size,
-+ VkBuffer foveation_buffer,
+ uint32_t target_binding_y,
+ uint32_t target_binding_cbcr,
+ VkImageView target_image_view_y,
@@ -165,22 +148,10 @@ index 27b1953cf..44c3f0aee 100644
uint32_t ubo_binding,
VkBuffer ubo_buffer,
VkDeviceSize ubo_size,
-@@ -169,15 +186,19 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
- src_image_info[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+@@ -176,8 +193,13 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
+ distortion_image_info[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
}
-- VkDescriptorImageInfo distortion_image_info[3 * XRT_MAX_VIEWS];
-- for (uint32_t i = 0; i < 3 * view_count; ++i) {
-- distortion_image_info[i].sampler = distortion_samplers[i];
-- distortion_image_info[i].imageView = distortion_image_views[i];
-- distortion_image_info[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
-- }
-+ VkDescriptorBufferInfo foveation_buffer_info = {
-+ .buffer = foveation_buffer,
-+ .offset = 0,
-+ .range = foveation_size,
-+ };
-
- VkDescriptorImageInfo target_image_info = {
- .imageView = target_image_view,
+ VkDescriptorImageInfo target_image_y_info = {
@@ -193,7 +164,7 @@ index 27b1953cf..44c3f0aee 100644
.imageLayout = VK_IMAGE_LAYOUT_GENERAL,
};
-@@ -187,7 +208,7 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
+@@ -187,7 +209,7 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
.range = ubo_size,
};
@@ -202,17 +173,7 @@ index 27b1953cf..44c3f0aee 100644
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = descriptor_set,
-@@ -200,17 +221,17 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .dstSet = descriptor_set,
- .dstBinding = distortion_binding,
-- .descriptorCount = 3 * view_count,
-- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
-- .pImageInfo = distortion_image_info,
-+ .descriptorCount = 1,
-+ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-+ .pBufferInfo = &foveation_buffer_info,
- },
+@@ -207,10 +229,10 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = descriptor_set,
@@ -225,7 +186,7 @@ index 27b1953cf..44c3f0aee 100644
},
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
-@@ -220,6 +241,14 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
+@@ -220,6 +242,14 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.pBufferInfo = &buffer_info,
},
@@ -240,7 +201,7 @@ index 27b1953cf..44c3f0aee 100644
};
vk->vkUpdateDescriptorSets( //
-@@ -395,7 +424,8 @@ render_compute_layers(struct render_compute *render,
+@@ -395,7 +425,8 @@ render_compute_layers(struct render_compute *render,
VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE],
VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE],
uint32_t num_srcs,
@@ -250,7 +211,7 @@ index 27b1953cf..44c3f0aee 100644
const struct render_viewport_data *view,
bool do_timewarp)
{
-@@ -415,8 +445,10 @@ render_compute_layers(struct render_compute *render,
+@@ -415,8 +446,10 @@ render_compute_layers(struct render_compute *render,
src_samplers, //
src_image_views, //
num_srcs, //
@@ -263,150 +224,39 @@ index 27b1953cf..44c3f0aee 100644
r->compute.ubo_binding, //
ubo, //
VK_WHOLE_SIZE, //
-@@ -450,150 +482,14 @@ render_compute_layers(struct render_compute *render,
- 1); // groupCountZ
- }
-
--void
--render_compute_projection_timewarp(struct render_compute *render,
-- VkSampler src_samplers[XRT_MAX_VIEWS],
-- VkImageView src_image_views[XRT_MAX_VIEWS],
-- const struct xrt_normalized_rect src_norm_rects[XRT_MAX_VIEWS],
-- const struct xrt_pose src_poses[XRT_MAX_VIEWS],
-- const struct xrt_fov src_fovs[XRT_MAX_VIEWS],
-- const struct xrt_pose new_poses[XRT_MAX_VIEWS],
-- VkImage target_image,
+@@ -459,7 +492,8 @@ render_compute_projection_timewarp(struct render_compute *render,
+ const struct xrt_fov src_fovs[XRT_MAX_VIEWS],
+ const struct xrt_pose new_poses[XRT_MAX_VIEWS],
+ VkImage target_image,
- VkImageView target_image_view,
-- const struct render_viewport_data views[XRT_MAX_VIEWS])
--{
-- assert(render->r != NULL);
--
-- struct vk_bundle *vk = vk_from_render(render);
-- struct render_resources *r = render->r;
--
--
-- /*
-- * UBO
-- */
--
-- struct xrt_matrix_4x4 time_warp_matrix[XRT_MAX_VIEWS];
-- for (uint32_t i = 0; i < render->r->view_count; ++i) {
-- render_calc_time_warp_matrix( //
-- &src_poses[i], //
-- &src_fovs[i], //
-- &new_poses[i], //
-- &time_warp_matrix[i]); //
-- }
--
-- struct render_compute_distortion_ubo_data *data =
-- (struct render_compute_distortion_ubo_data *)r->compute.distortion.ubo.mapped;
-- for (uint32_t i = 0; i < render->r->view_count; ++i) {
-- data->views[i] = views[i];
-- data->pre_transforms[i] = r->distortion.uv_to_tanangle[i];
-- data->transforms[i] = time_warp_matrix[i];
-- data->post_transforms[i] = src_norm_rects[i];
-- }
--
-- /*
-- * Source, target and distortion images.
-- */
--
-- VkImageSubresourceRange subresource_range = {
-- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
-- .baseMipLevel = 0,
-- .levelCount = VK_REMAINING_MIP_LEVELS,
-- .baseArrayLayer = 0,
-- .layerCount = VK_REMAINING_ARRAY_LAYERS,
-- };
--
-- vk_cmd_image_barrier_gpu_locked( //
-- vk, //
-- r->cmd, //
-- target_image, //
-- 0, //
-- VK_ACCESS_SHADER_WRITE_BIT, //
-- VK_IMAGE_LAYOUT_UNDEFINED, //
-- VK_IMAGE_LAYOUT_GENERAL, //
-- subresource_range); //
--
-- VkSampler sampler = r->samplers.clamp_to_edge;
-- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
-- for (uint32_t i = 0; i < render->r->view_count; ++i) {
-- distortion_samplers[3 * i + 0] = sampler;
-- distortion_samplers[3 * i + 1] = sampler;
-- distortion_samplers[3 * i + 2] = sampler;
-- }
--
-- update_compute_shared_descriptor_set( //
-- vk, //
-- r->compute.src_binding, //
-- src_samplers, //
-- src_image_views, //
-- r->compute.distortion_binding, //
-- distortion_samplers, //
-- r->distortion.image_views, //
++ VkImageView target_image_view_y,
++ VkImageView target_image_view_cbcr,
+ const struct render_viewport_data views[XRT_MAX_VIEWS])
+ {
+ assert(render->r != NULL);
+@@ -528,8 +562,10 @@ render_compute_projection_timewarp(struct render_compute *render,
+ r->compute.distortion_binding, //
+ distortion_samplers, //
+ r->distortion.image_views, //
- r->compute.target_binding, //
- target_image_view, //
-- r->compute.ubo_binding, //
-- r->compute.distortion.ubo.buffer, //
-- VK_WHOLE_SIZE, //
-- render->shared_descriptor_set, //
-- render->r->view_count); //
--
-- vk->vkCmdBindPipeline( //
-- r->cmd, //
-- VK_PIPELINE_BIND_POINT_COMPUTE, // pipelineBindPoint
-- r->compute.distortion.timewarp_pipeline); // pipeline
--
-- vk->vkCmdBindDescriptorSets( //
-- r->cmd, //
-- VK_PIPELINE_BIND_POINT_COMPUTE, // pipelineBindPoint
-- r->compute.distortion.pipeline_layout, // layout
-- 0, // firstSet
-- 1, // descriptorSetCount
-- &render->shared_descriptor_set, // pDescriptorSets
-- 0, // dynamicOffsetCount
-- NULL); // pDynamicOffsets
--
--
-- uint32_t w = 0, h = 0;
-- calc_dispatch_dims_views(views, render->r->view_count, &w, &h);
-- assert(w != 0 && h != 0);
--
-- vk->vkCmdDispatch( //
-- r->cmd, //
-- w, // groupCountX
-- h, // groupCountY
-- 2); // groupCountZ
--
-- VkImageMemoryBarrier memoryBarrier = {
-- .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
-- .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
-- .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
-- .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
++ r->compute.target_binding_y, //
++ r->compute.target_binding_cbcr, //
++ target_image_view_y, //
++ target_image_view_cbcr, //
+ r->compute.ubo_binding, //
+ r->compute.distortion.ubo.buffer, //
+ VK_WHOLE_SIZE, //
+@@ -567,7 +603,7 @@ render_compute_projection_timewarp(struct render_compute *render,
+ .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
+ .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
+ .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
- .newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
-- .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
-- .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
-- .image = target_image,
-- .subresourceRange = subresource_range,
-- };
--
-- vk->vkCmdPipelineBarrier( //
-- r->cmd, //
-- VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, //
-- VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, //
-- 0, //
-- 0, //
-- NULL, //
-- 0, //
-- NULL, //
-- 1, //
-- &memoryBarrier); //
--}
--
- void
- render_compute_projection(struct render_compute *render,
- VkSampler src_samplers[XRT_MAX_VIEWS],
++ .newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+ .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
+ .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
+ .image = target_image,
+@@ -593,7 +629,8 @@ render_compute_projection(struct render_compute *render,
VkImageView src_image_views[XRT_MAX_VIEWS],
const struct xrt_normalized_rect src_norm_rects[XRT_MAX_VIEWS],
VkImage target_image,
@@ -416,30 +266,12 @@ index 27b1953cf..44c3f0aee 100644
const struct render_viewport_data views[XRT_MAX_VIEWS])
{
assert(render->r != NULL);
-@@ -636,24 +532,18 @@ render_compute_projection(struct render_compute *render,
- VK_IMAGE_LAYOUT_GENERAL, //
- subresource_range); //
-
-- VkSampler sampler = r->samplers.clamp_to_edge;
-- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
-- for (uint32_t i = 0; i < render->r->view_count; ++i) {
-- distortion_samplers[3 * i + 0] = sampler;
-- distortion_samplers[3 * i + 1] = sampler;
-- distortion_samplers[3 * i + 2] = sampler;
-- }
--
- update_compute_shared_descriptor_set( //
- vk, //
- r->compute.src_binding, //
- src_samplers, //
- src_image_views, //
+@@ -652,8 +689,10 @@ render_compute_projection(struct render_compute *render,
r->compute.distortion_binding, //
-- distortion_samplers, //
-- r->distortion.image_views, //
+ distortion_samplers, //
+ r->distortion.image_views, //
- r->compute.target_binding, //
- target_image_view, //
-+ VK_WHOLE_SIZE, //
-+ r->distortion.buffer, //
+ r->compute.target_binding_y, //
+ r->compute.target_binding_cbcr, //
+ target_image_view_y, //
@@ -447,7 +279,7 @@ index 27b1953cf..44c3f0aee 100644
r->compute.ubo_binding, //
r->compute.distortion.ubo.buffer, //
VK_WHOLE_SIZE, //
-@@ -691,7 +581,7 @@ render_compute_projection(struct render_compute *render,
+@@ -691,7 +730,7 @@ render_compute_projection(struct render_compute *render,
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
@@ -456,7 +288,7 @@ index 27b1953cf..44c3f0aee 100644
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = target_image,
-@@ -714,7 +604,8 @@ render_compute_projection(struct render_compute *render,
+@@ -714,7 +753,8 @@ render_compute_projection(struct render_compute *render,
void
render_compute_clear(struct render_compute *render,
VkImage target_image,
@@ -466,30 +298,12 @@ index 27b1953cf..44c3f0aee 100644
const struct render_viewport_data views[XRT_MAX_VIEWS])
{
assert(render->r != NULL);
-@@ -764,13 +655,9 @@ render_compute_clear(struct render_compute *render,
- VkSampler sampler = r->samplers.mock;
- VkSampler src_samplers[XRT_MAX_VIEWS];
- VkImageView src_image_views[XRT_MAX_VIEWS];
-- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
- for (uint32_t i = 0; i < render->r->view_count; ++i) {
- src_samplers[i] = sampler;
- src_image_views[i] = r->mock.color.image_view;
-- distortion_samplers[3 * i + 0] = sampler;
-- distortion_samplers[3 * i + 1] = sampler;
-- distortion_samplers[3 * i + 2] = sampler;
- }
-
- update_compute_shared_descriptor_set( //
-@@ -779,10 +666,12 @@ render_compute_clear(struct render_compute *render,
- src_samplers, //
- src_image_views, //
+@@ -781,8 +821,10 @@ render_compute_clear(struct render_compute *render,
r->compute.distortion_binding, //
-- distortion_samplers, //
-- r->distortion.image_views, //
+ distortion_samplers, //
+ r->distortion.image_views, //
- r->compute.target_binding, //
- target_image_view, //
-+ VK_WHOLE_SIZE, //
-+ r->distortion.buffer, //
+ r->compute.target_binding_y, //
+ r->compute.target_binding_cbcr, //
+ target_image_view_y, //
@@ -497,7 +311,7 @@ index 27b1953cf..44c3f0aee 100644
r->compute.ubo_binding, //
r->compute.clear.ubo.buffer, //
VK_WHOLE_SIZE, // ubo_size
-@@ -820,7 +709,7 @@ render_compute_clear(struct render_compute *render,
+@@ -820,7 +862,7 @@ render_compute_clear(struct render_compute *render,
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
.oldLayout = VK_IMAGE_LAYOUT_GENERAL,
@@ -507,25 +321,10 @@ index 27b1953cf..44c3f0aee 100644
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = target_image,
diff --git a/src/xrt/compositor/render/render_interface.h b/src/xrt/compositor/render/render_interface.h
-index d5d2bc4cb..d74ec78dd 100644
+index d5d2bc4cb..2f8ce5287 100644
--- a/src/xrt/compositor/render/render_interface.h
+++ b/src/xrt/compositor/render/render_interface.h
-@@ -74,12 +74,8 @@ extern "C" {
- #define RENDER_MAX_LAYER_RUNS_SIZE (XRT_MAX_VIEWS)
- #define RENDER_MAX_LAYER_RUNS_COUNT(RENDER_RESOURCES) (RENDER_RESOURCES->view_count)
-
--//! Distortion image dimension in pixels
--#define RENDER_DISTORTION_IMAGE_DIMENSIONS (128)
--
--//! How many distortion images we have, one for each channel (3 rgb) and per view.
--#define RENDER_DISTORTION_IMAGES_SIZE (3 * XRT_MAX_VIEWS)
--#define RENDER_DISTORTION_IMAGES_COUNT(RENDER_RESOURCES) (3 * RENDER_RESOURCES->view_count)
-+//! Foveation buffer dimension in pixels (including past-the end pixel)
-+#define RENDER_FOVEATION_BUFFER_DIMENSIONS (4096 + 1)
-
- //! The binding that the layer projection and quad shader have their UBO on.
- #define RENDER_BINDING_LAYER_SHARED_UBO 0
-@@ -481,7 +477,8 @@ struct render_resources
+@@ -481,7 +481,8 @@ struct render_resources
uint32_t distortion_binding;
//! Writing the image out too.
@@ -535,54 +334,7 @@ index d5d2bc4cb..d74ec78dd 100644
//! Uniform data binding.
uint32_t ubo_binding;
-@@ -518,9 +515,6 @@ struct render_resources
- //! Doesn't depend on target so is static.
- VkPipeline pipeline;
-
-- //! Doesn't depend on target so is static.
-- VkPipeline timewarp_pipeline;
--
- //! Target info.
- struct render_buffer ubo;
- } distortion;
-@@ -542,17 +536,11 @@ struct render_resources
- //! Transform to go from UV to tangle angles.
- struct xrt_normalized_rect uv_to_tanangle[XRT_MAX_VIEWS];
-
-- //! Backing memory to distortion images.
-- VkDeviceMemory device_memories[RENDER_DISTORTION_IMAGES_SIZE];
--
-- //! Distortion images.
-- VkImage images[RENDER_DISTORTION_IMAGES_SIZE];
-+ //! Backing memory to foveation buffers.
-+ VkDeviceMemory device_memory;
-
-- //! The views into the distortion images.
-- VkImageView image_views[RENDER_DISTORTION_IMAGES_SIZE];
--
-- //! Whether distortion images have been pre-rotated 90 degrees.
-- bool pre_rotated;
-+ //! Foveation buffer.
-+ VkBuffer buffer;
- } distortion;
- };
-
-@@ -1297,6 +1285,14 @@ struct render_compute_distortion_ubo_data
- struct xrt_matrix_4x4 transforms[XRT_MAX_VIEWS];
- };
-
-+struct render_compute_distortion_foveation_data
-+{
-+ // For each output pixel: index of the first pixel to read.
-+ // contains 1 additional value at the end for past-the end pixel
-+ uint32_t x[XRT_MAX_VIEWS * RENDER_FOVEATION_BUFFER_DIMENSIONS];
-+ uint32_t y[XRT_MAX_VIEWS * RENDER_FOVEATION_BUFFER_DIMENSIONS];
-+};
-+
- /*!
- * Init struct and create resources needed for compute rendering.
- *
-@@ -1350,7 +1346,8 @@ render_compute_layers(struct render_compute *render,
+@@ -1350,7 +1351,8 @@ render_compute_layers(struct render_compute *render,
VkSampler src_samplers[RENDER_MAX_IMAGES_SIZE],
VkImageView src_image_views[RENDER_MAX_IMAGES_SIZE],
uint32_t num_srcs,
@@ -592,7 +344,7 @@ index d5d2bc4cb..d74ec78dd 100644
const struct render_viewport_data *view,
bool timewarp);
-@@ -1366,7 +1363,8 @@ render_compute_projection_timewarp(struct render_compute *render,
+@@ -1366,7 +1368,8 @@ render_compute_projection_timewarp(struct render_compute *render,
const struct xrt_fov src_fovs[XRT_MAX_VIEWS],
const struct xrt_pose new_poses[XRT_MAX_VIEWS],
VkImage target_image,
@@ -602,7 +354,7 @@ index d5d2bc4cb..d74ec78dd 100644
const struct render_viewport_data views[XRT_MAX_VIEWS]);
/*!
-@@ -1378,7 +1376,8 @@ render_compute_projection(struct render_compute *render,
+@@ -1378,7 +1381,8 @@ render_compute_projection(struct render_compute *render,
VkImageView src_image_views[XRT_MAX_VIEWS],
const struct xrt_normalized_rect src_rects[XRT_MAX_VIEWS],
VkImage target_image,
@@ -612,7 +364,7 @@ index d5d2bc4cb..d74ec78dd 100644
const struct render_viewport_data views[XRT_MAX_VIEWS]);
/*!
-@@ -1387,7 +1386,8 @@ render_compute_projection(struct render_compute *render,
+@@ -1387,7 +1391,8 @@ render_compute_projection(struct render_compute *render,
void
render_compute_clear(struct render_compute *render,
VkImage target_image,
@@ -623,7 +375,7 @@ index d5d2bc4cb..d74ec78dd 100644
diff --git a/src/xrt/compositor/render/render_resources.c b/src/xrt/compositor/render/render_resources.c
-index ccc6f10cf..7d4d9cddb 100644
+index ccc6f10cf..5b9addd59 100644
--- a/src/xrt/compositor/render/render_resources.c
+++ b/src/xrt/compositor/render/render_resources.c
@@ -184,14 +184,15 @@ init_mesh_ubo_buffers(struct vk_bundle *vk, struct render_buffer ubo[XRT_MAX_VIE
@@ -683,14 +435,7 @@ index ccc6f10cf..7d4d9cddb 100644
{
.binding = src_binding,
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
-@@ -250,12 +258,12 @@ create_compute_distortion_descriptor_set_layout(struct vk_bundle *vk,
- },
- {
- .binding = distortion_binding,
-- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
-- .descriptorCount = 6,
-+ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-+ .descriptorCount = 1,
+@@ -255,7 +263,7 @@ create_compute_distortion_descriptor_set_layout(struct vk_bundle *vk,
.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
},
{
@@ -712,57 +457,7 @@ index ccc6f10cf..7d4d9cddb 100644
};
VkDescriptorSetLayoutCreateInfo set_layout_info = {
-@@ -295,12 +309,6 @@ struct compute_layer_params
- uint32_t image_array_size;
- };
-
--struct compute_distortion_params
--{
-- uint32_t distortion_texel_count;
-- VkBool32 do_timewarp;
--};
--
- XRT_CHECK_RESULT static VkResult
- create_compute_layer_pipeline(struct vk_bundle *vk,
- VkPipelineCache pipeline_cache,
-@@ -345,35 +353,15 @@ create_compute_distortion_pipeline(struct vk_bundle *vk,
- VkPipelineCache pipeline_cache,
- VkShaderModule shader,
- VkPipelineLayout pipeline_layout,
-- const struct compute_distortion_params *params,
- VkPipeline *out_compute_pipeline)
- {
--#define ENTRY(ID, FIELD) \
-- { \
-- .constantID = ID, \
-- .offset = offsetof(struct compute_distortion_params, FIELD), \
-- sizeof(params->FIELD), \
-- }
--
-- VkSpecializationMapEntry entries[2] = {
-- ENTRY(0, distortion_texel_count),
-- ENTRY(1, do_timewarp),
-- };
--#undef ENTRY
--
-- VkSpecializationInfo specialization_info = {
-- .mapEntryCount = ARRAY_SIZE(entries),
-- .pMapEntries = entries,
-- .dataSize = sizeof(*params),
-- .pData = params,
-- };
-
- return vk_create_compute_pipeline( //
- vk, // vk_bundle
- pipeline_cache, // pipeline_cache
- shader, // shader
- pipeline_layout, // pipeline_layout
-- &specialization_info, // specialization_info
-+ NULL, // specialization_info
- out_compute_pipeline); // out_compute_pipeline
- }
-
-@@ -539,8 +527,9 @@ render_resources_init(struct render_resources *r,
+@@ -539,8 +553,9 @@ render_resources_init(struct render_resources *r,
}
r->compute.src_binding = 0;
r->compute.distortion_binding = 1;
@@ -773,19 +468,7 @@ index ccc6f10cf..7d4d9cddb 100644
r->compute.layer.image_array_size =
MIN(vk->features.max_per_stage_descriptor_sampled_images, RENDER_MAX_IMAGES_COUNT(r));
-@@ -834,9 +823,9 @@ render_resources_init(struct render_resources *r,
- struct vk_descriptor_pool_info compute_pool_info = {
- .uniform_per_descriptor_count = 1,
- // layer images
-- .sampler_per_descriptor_count = r->compute.layer.image_array_size + RENDER_DISTORTION_IMAGES_COUNT(r),
-+ .sampler_per_descriptor_count = r->compute.layer.image_array_size,
- .storage_image_per_descriptor_count = 1,
-- .storage_buffer_per_descriptor_count = 0,
-+ .storage_buffer_per_descriptor_count = 1,
- .descriptor_count = compute_descriptor_count,
- .freeable = false,
- };
-@@ -856,7 +845,8 @@ render_resources_init(struct render_resources *r,
+@@ -856,7 +871,8 @@ render_resources_init(struct render_resources *r,
ret = create_compute_layer_descriptor_set_layout( //
vk, // vk_bundle
r->compute.src_binding, // src_binding,
@@ -795,7 +478,7 @@ index ccc6f10cf..7d4d9cddb 100644
r->compute.ubo_binding, // ubo_binding,
r->compute.layer.image_array_size, // source_images_count,
&r->compute.layer.descriptor_set_layout); // out_descriptor_set_layout
-@@ -937,7 +927,8 @@ render_resources_init(struct render_resources *r,
+@@ -937,7 +953,8 @@ render_resources_init(struct render_resources *r,
vk, // vk_bundle
r->compute.src_binding, // src_binding,
r->compute.distortion_binding, // distortion_binding,
@@ -805,134 +488,24 @@ index ccc6f10cf..7d4d9cddb 100644
r->compute.ubo_binding, // ubo_binding,
&r->compute.distortion.descriptor_set_layout); // out_descriptor_set_layout
VK_CHK_WITH_RET(ret, "create_compute_distortion_descriptor_set_layout", false);
-@@ -954,39 +945,16 @@ render_resources_init(struct render_resources *r,
- VK_NAME_PIPELINE_LAYOUT(vk, r->compute.distortion.pipeline_layout,
- "render_resources compute distortion pipeline layout");
-
-- struct compute_distortion_params distortion_params = {
-- .distortion_texel_count = RENDER_DISTORTION_IMAGE_DIMENSIONS,
-- .do_timewarp = false,
-- };
--
- ret = create_compute_distortion_pipeline( //
- vk, // vk_bundle
- r->pipeline_cache, // pipeline_cache
- r->shaders->distortion_comp, // shader
- r->compute.distortion.pipeline_layout, // pipeline_layout
-- &distortion_params, // params
- &r->compute.distortion.pipeline); // out_compute_pipeline
- VK_CHK_WITH_RET(ret, "create_compute_distortion_pipeline", false);
-
- VK_NAME_PIPELINE(vk, r->compute.distortion.pipeline, "render_resources compute distortion pipeline");
-
-- struct compute_distortion_params distortion_timewarp_params = {
-- .distortion_texel_count = RENDER_DISTORTION_IMAGE_DIMENSIONS,
-- .do_timewarp = true,
-- };
--
-- ret = create_compute_distortion_pipeline( //
-- vk, // vk_bundle
-- r->pipeline_cache, // pipeline_cache
-- r->shaders->distortion_comp, // shader
-- r->compute.distortion.pipeline_layout, // pipeline_layout
-- &distortion_timewarp_params, // params
-- &r->compute.distortion.timewarp_pipeline); // out_compute_pipeline
-- VK_CHK_WITH_RET(ret, "create_compute_distortion_pipeline", false);
--
-- VK_NAME_PIPELINE(vk, r->compute.distortion.timewarp_pipeline,
-- "render_resources compute distortion timewarp pipeline");
--
- size_t distortion_ubo_size = sizeof(struct render_compute_distortion_ubo_data);
-
- ret = render_buffer_init( //
-@@ -1039,15 +1007,8 @@ render_resources_init(struct render_resources *r,
- * Compute distortion textures, not created until later.
- */
-
-- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
-- r->distortion.image_views[i] = VK_NULL_HANDLE;
-- }
-- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
-- r->distortion.images[i] = VK_NULL_HANDLE;
-- }
-- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
-- r->distortion.device_memories[i] = VK_NULL_HANDLE;
-- }
-+ r->distortion.buffer = VK_NULL_HANDLE;
-+ r->distortion.device_memory = VK_NULL_HANDLE;
-
-
- /*
-@@ -1124,7 +1085,6 @@ render_resources_fini(struct render_resources *r)
-
- D(DescriptorSetLayout, r->compute.distortion.descriptor_set_layout);
- D(Pipeline, r->compute.distortion.pipeline);
-- D(Pipeline, r->compute.distortion.timewarp_pipeline);
- D(PipelineLayout, r->compute.distortion.pipeline_layout);
-
- D(Pipeline, r->compute.clear.pipeline);
-diff --git a/src/xrt/compositor/shaders/clear.comp b/src/xrt/compositor/shaders/clear.comp
-index 036da401a..db8e5178e 100644
---- a/src/xrt/compositor/shaders/clear.comp
-+++ b/src/xrt/compositor/shaders/clear.comp
-@@ -10,7 +10,7 @@
-
- layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-
--layout(set = 0, binding = 2) uniform writeonly restrict image2D target;
-+layout(set = 0, binding = 2) uniform writeonly restrict image2DArray target;
- layout(set = 0, binding = 3) uniform restrict Config
- {
- ivec4 views[2];
-@@ -35,5 +35,5 @@ void main()
-
- vec4 colour = vec4(from_linear_to_srgb(vec3(0.1)), 1.0);
-
-- imageStore(target, ivec2(offset.x + ix, offset.y + iy), colour);
-+ imageStore(target, ivec3(offset.x + ix, offset.y + iy, 0), colour);
- }
diff --git a/src/xrt/compositor/shaders/distortion.comp b/src/xrt/compositor/shaders/distortion.comp
-index 08b44d4cf..cd1828ac9 100644
+index 08b44d4cf..e1dd1cb58 100644
--- a/src/xrt/compositor/shaders/distortion.comp
+++ b/src/xrt/compositor/shaders/distortion.comp
-@@ -4,21 +4,23 @@
+@@ -18,7 +18,7 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
- #version 460
- #extension GL_GOOGLE_include_directive : require
-+#extension GL_KHR_shader_subgroup_basic: require
-+#extension GL_KHR_shader_subgroup_shuffle: require
-
- #include "srgb.inc.glsl"
-
--
--// The size of the distortion texture dimensions in texels.
--layout(constant_id = 0) const int distortion_texel_count = 2;
--
--// Should we do timewarp.
--layout(constant_id = 1) const bool do_timewarp = false;
--
- layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
-
-+#define MAX_DIM 4097
-+
layout(set = 0, binding = 0) uniform sampler2D source[2];
--layout(set = 0, binding = 1) uniform sampler2D distortion[6];
+ layout(set = 0, binding = 1) uniform sampler2D distortion[6];
-layout(set = 0, binding = 2) uniform writeonly restrict image2D target;
-+layout(set = 0, binding = 1, std430) buffer restrict Foveation
-+{
-+ uint x[2*MAX_DIM];
-+ uint y[2*MAX_DIM];
-+} foveation;
-+
-+layout(set = 0, binding = 2) uniform writeonly restrict image2DArray luma;
++layout(set = 0, binding = 2) uniform writeonly restrict image2D luma;
layout(set = 0, binding = 3, std140) uniform restrict Config
{
ivec4 views[2];
-@@ -26,115 +28,74 @@ layout(set = 0, binding = 3, std140) uniform restrict Config
+@@ -26,7 +26,20 @@ layout(set = 0, binding = 3, std140) uniform restrict Config
vec4 post_transform[2];
mat4 transform[2];
} ubo;
-+layout(set = 0, binding = 4) uniform writeonly restrict image2DArray chroma;
++layout(set = 0, binding = 4) uniform writeonly restrict image2D chroma;
+const mat3 color_space = mat3(
+// clang-format off
@@ -941,82 +514,15 @@ index 08b44d4cf..cd1828ac9 100644
+/* Cb*/-0.1146, -0.3854, 0.5,
+/* Cr*/ 0.5 , -0.4542, -0.0458);
+//clang-format: on
-
--vec2 position_to_uv(ivec2 extent, uint ix, uint iy)
--{
-- // Turn the index into floating point.
-- vec2 xy = vec2(float(ix), float(iy));
--
-- // The inverse of the extent of the target image is the pixel size in [0 .. 1] space.
-- vec2 extent_pixel_size = vec2(1.0 / float(extent.x), 1.0 / float(extent.y));
--
-- // Per-target pixel we move the size of the pixels.
-- vec2 dist_uv = xy * extent_pixel_size;
--
-- // Emulate a triangle sample position by offset half target pixel size.
-- dist_uv = dist_uv + extent_pixel_size / 2.0;
--
--
-- // To correctly sample we need to put position (0, 0) in the
-- // middle of the (0, 0) texel in the distortion textures. That's why we
-- // offset with half the texel size, pushing all samples into the middle
-- // of each texels, a kin to a vertex buffer. We need to put uv coord
-- // (1, 1) in the middle of the last texel, that pixel is (size - 1)
-- // texels away from the first texel. So we need to scale [0 .. 1] to
-- // [0 .. size - 1].
--
--#define DIM (float(distortion_texel_count))
--#define STRETCH ((DIM - 1.0) / DIM)
--#define OFFSET (1.0 / (DIM * 2.0))
--
-- dist_uv = (dist_uv * STRETCH) + OFFSET;
--
-- return dist_uv;
--}
--
--vec2 transform_uv_subimage(vec2 uv, uint iz)
++
+vec3 rgb_to_ycbcr(vec3 color)
- {
-- vec2 values = uv;
--
-- // To deal with OpenGL flip and sub image view.
-- values.xy = values.xy * ubo.post_transform[iz].zw + ubo.post_transform[iz].xy;
--
-- // Ready to be used.
-- return values.xy;
--}
--
--vec2 transform_uv_timewarp(vec2 uv, uint iz)
--{
-- vec4 values = vec4(uv, -1, 1);
--
-- // From uv to tan angle (tangent space).
-- values.xy = values.xy * ubo.pre_transform[iz].zw + ubo.pre_transform[iz].xy;
-- values.y = -values.y; // Flip to OpenXR coordinate system.
--
-- // Timewarp.
-- values = ubo.transform[iz] * values;
-- values.xy = values.xy * (1.0 / max(values.w, 0.00001));
--
-- // From [-1, 1] to [0, 1]
-- values.xy = values.xy * 0.5 + 0.5;
--
-- // To deal with OpenGL flip and sub image view.
-- values.xy = values.xy * ubo.post_transform[iz].zw + ubo.post_transform[iz].xy;
--
-- // Done.
-- return values.xy;
--}
--
--vec2 transform_uv(vec2 uv, uint iz)
--{
-- if (do_timewarp) {
-- return transform_uv_timewarp(uv, iz);
-- } else {
-- return transform_uv_subimage(uv, iz);
-- }
++{
+ return transpose(color_space) * color + vec3(0, 0.5, 0.5);
- }
++}
+
+ vec2 position_to_uv(ivec2 extent, uint ix, uint iy)
+ {
+@@ -104,37 +117,40 @@ vec2 transform_uv(vec2 uv, uint iz)
void main()
{
@@ -1026,77 +532,58 @@ index 08b44d4cf..cd1828ac9 100644
ivec2 offset = ivec2(ubo.views[iz].xy);
ivec2 extent = ivec2(ubo.views[iz].zw);
--
++ vec2 cbcrs[4];
++ for (int k = 0; k < 2; k += 1) {
++ uint iy = gl_GlobalInvocationID.y * 2 + k;
++ for (int j = 0; j < 2; j += 1) {
++ uint ix = gl_GlobalInvocationID.x * 2 + j;
+
- if (ix >= extent.x || iy >= extent.y) {
-+ uint iy = gl_GlobalInvocationID.y;
-+ uint ymin = foveation.y[MAX_DIM * iz + iy];
-+ uint ymax = foveation.y[MAX_DIM * iz + iy + 1];
-+ if (ymin == ymax)
- return;
-+ if (ymin > ymax)
-+ {
-+ uint tmp = ymin;
-+ ymin = ymax;
-+ ymax = tmp;
- }
-+ uint ix = gl_GlobalInvocationID.x;
+- return;
+- }
++ vec2 dist_uv = position_to_uv(extent, ix, iy);
- vec2 dist_uv = position_to_uv(extent, ix, iy);
--
++ vec2 uv = texture(distortion[iz + 0], dist_uv).xy;
++ vec2 lod = texture(distortion[iz + 2], dist_uv).xy;
+
- vec2 r_uv = texture(distortion[iz + 0], dist_uv).xy;
- vec2 g_uv = texture(distortion[iz + 2], dist_uv).xy;
- vec2 b_uv = texture(distortion[iz + 4], dist_uv).xy;
--
++ // Do any transformation needed.
++ uv = transform_uv(uv, iz);
+
- // Do any transformation needed.
- r_uv = transform_uv(r_uv, iz);
- g_uv = transform_uv(g_uv, iz);
- b_uv = transform_uv(b_uv, iz);
--
++ // Sample the source
++ vec3 colour = textureLod(source[iz], uv, mix(lod.x, lod.y, 0.5)).rgb;
+
- // Sample the source with distorted and chromatic-aberration corrected samples.
- vec4 colour = vec4(
- texture(source[iz], r_uv).r,
- texture(source[iz], g_uv).g,
- texture(source[iz], b_uv).b,
- 1);
-+ uint xmin = foveation.x[MAX_DIM * iz + ix];
-+ uint xmax = foveation.x[MAX_DIM * iz + ix + 1];
-+ if (xmin == xmax)
-+ return;
++ colour = rgb_to_ycbcr(from_linear_to_srgb(colour));
- // Do colour correction here since there are no automatic conversion in hardware available.
- colour = vec4(from_linear_to_srgb(colour.rgb), 1);
-+ vec4 colour = vec4(0);
-+ for (uint y = ymin ; y < ymax; y += 1) {
-+ for (uint x = xmin ; x < xmax; x += 1) {
-+ colour += texelFetch(source[iz], ivec2(x, y), 0);
-+ }
-+ }
-+ colour /= (xmax - xmin) * (ymax - ymin);
-+ colour.xyz = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb));
-+
-+ imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x));
-+
-+ vec4 sum = colour;
-+ for (uint i = 0 ; i < gl_SubgroupSize; ++i)
-+ {
-+ uvec3 other = subgroupShuffle(gl_GlobalInvocationID, i);
-+ vec4 c = subgroupShuffle(colour, i);
-+ if (
-+ other == gl_GlobalInvocationID + uvec3(1, 0, 0)
-+ || other == gl_GlobalInvocationID + uvec3(0, 1, 0)
-+ || other == gl_GlobalInvocationID + uvec3(1, 1, 0))
-+ {
-+ sum += c;
-+ }
-+ }
++ int i = k * 2 + j;
++ cbcrs[i] = colour.yz;
- imageStore(target, ivec2(offset.x + ix, offset.y + iy), colour);
-+ if (ix %2 == 0 && iy %2 == 0)
-+ {
-+ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 0), vec4(sum.y, sum.z, 0, 0) / 4);
-+ imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 1), vec4(sum.w, 0, 0, 0) / 4);
-+ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy/2, 1), vec4(0.5, 0.5, 0, 0));
++ if (ix < extent.x && iy < extent.y) {
++ imageStore(luma, ivec2(offset.x + ix, offset.y + iy), vec4(colour.x));
++ }
++ }
+ }
++ if (gl_GlobalInvocationID.x >= extent.x || gl_GlobalInvocationID.y >= extent.y) {
++ return;
++ }
++ vec2 cbcr = mix(mix(cbcrs[0], cbcrs[1], 0.5), mix(cbcrs[2], cbcrs[3], 0.5), 0.5);
++ imageStore(chroma, ivec2(offset.xy/2 + gl_GlobalInvocationID.xy), vec4(cbcr.x, cbcr.y, 0, 0));
}
diff --git a/src/xrt/compositor/util/comp_high_level_render.c b/src/xrt/compositor/util/comp_high_level_render.c
index f1c9aa145..2e5e048a5 100644
@@ -1198,7 +685,7 @@ index 334464256..f4a9140a2 100644
bool do_timewarp);
diff --git a/src/xrt/compositor/util/comp_render_cs.c b/src/xrt/compositor/util/comp_render_cs.c
-index 4e20b32f0..69429dc97 100644
+index 4e20b32f0..b2d3ce10d 100644
--- a/src/xrt/compositor/util/comp_render_cs.c
+++ b/src/xrt/compositor/util/comp_render_cs.c
@@ -347,7 +347,8 @@ crc_clear_output(struct render_compute *render, const struct comp_render_dispatc
@@ -1221,45 +708,27 @@ index 4e20b32f0..69429dc97 100644
target_viewport_datas); // views
}
-@@ -464,28 +466,15 @@ crc_distortion_fast_path(struct render_compute *render,
- world_poses[i] = world_pose;
- }
-
-- if (!d->do_timewarp) {
-- render_compute_projection( //
-- render, //
-- src_samplers, //
-- src_image_views, //
-- src_norm_rects, //
-- d->target.cs.image, //
+@@ -471,7 +473,8 @@ crc_distortion_fast_path(struct render_compute *render,
+ src_image_views, //
+ src_norm_rects, //
+ d->target.cs.image, //
- d->target.cs.storage_view, //
-- target_viewport_datas); //
-- } else {
-- render_compute_projection_timewarp( //
-- render, //
-- src_samplers, //
-- src_image_views, //
-- src_norm_rects, //
-- src_poses, //
-- src_fovs, //
-- world_poses, //
-- d->target.cs.image, //
++ d->target.cs.storage_view_y, //
++ d->target.cs.storage_view_cbcr, //
+ target_viewport_datas); //
+ } else {
+ render_compute_projection_timewarp( //
+@@ -483,7 +486,8 @@ crc_distortion_fast_path(struct render_compute *render,
+ src_fovs, //
+ world_poses, //
+ d->target.cs.image, //
- d->target.cs.storage_view, //
-- target_viewport_datas); //
-- }
-+ render_compute_projection( //
-+ render, //
-+ src_samplers, //
-+ src_image_views, //
-+ src_norm_rects, //
-+ d->target.cs.image, //
-+ d->target.cs.storage_view_y, //
-+ d->target.cs.storage_view_cbcr, //
-+ target_viewport_datas); //
++ d->target.cs.storage_view_y, //
++ d->target.cs.storage_view_cbcr, //
+ target_viewport_datas); //
+ }
}
-
-
-@@ -504,7 +493,8 @@ comp_render_cs_layer(struct render_compute *render,
+@@ -504,7 +508,8 @@ comp_render_cs_layer(struct render_compute *render,
const struct xrt_pose *world_pose,
const struct xrt_pose *eye_pose,
const VkImage target_image,
@@ -1269,7 +738,7 @@ index 4e20b32f0..69429dc97 100644
const struct render_viewport_data *target_view,
bool do_timewarp)
{
-@@ -661,7 +651,8 @@ comp_render_cs_layer(struct render_compute *render,
+@@ -661,7 +666,8 @@ comp_render_cs_layer(struct render_compute *render,
src_samplers, //
src_image_views, //
cur_image, //
@@ -1279,7 +748,7 @@ index 4e20b32f0..69429dc97 100644
target_view, //
do_timewarp); //
}
-@@ -697,6 +688,7 @@ comp_render_cs_layers(struct render_compute *render,
+@@ -697,6 +703,7 @@ comp_render_cs_layers(struct render_compute *render,
&view->eye_pose, //
view->squash.image, //
view->squash.cs.storage_view, //
@@ -1288,5 +757,5 @@ index 4e20b32f0..69429dc97 100644
d->do_timewarp); //
}
--
-2.51.0
+2.50.1
diff --git a/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch b/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch
new file mode 100644
index 00000000..63607d0d
--- /dev/null
+++ b/patches/monado/0008-c-main-allow-custom-pacing-app-factory.patch
@@ -0,0 +1,82 @@
+From 877709160be24c4bd504b8d8cd04197cc2bf2b69 Mon Sep 17 00:00:00 2001
+From: Patrick Nicolas
+Date: Thu, 27 Feb 2025 22:45:36 +0100
+Subject: [PATCH 08/10] c/main: allow custom pacing app factory
+
+---
+ src/xrt/compositor/main/comp_compositor.c | 10 ++++++----
+ src/xrt/compositor/main/comp_main_interface.h | 4 ++++
+ src/xrt/targets/common/target_instance.c | 2 +-
+ 3 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c
+index 819c2c8b3..a42d25869 100644
+--- a/src/xrt/compositor/main/comp_compositor.c
++++ b/src/xrt/compositor/main/comp_compositor.c
+@@ -987,6 +987,7 @@ compositor_init_renderer(struct comp_compositor *c)
+ xrt_result_t
+ comp_main_create_system_compositor(struct xrt_device *xdev,
+ const struct comp_target_factory *ctf,
++ struct u_pacing_app_factory *upaf,
+ struct xrt_system_compositor **out_xsysc)
+ {
+ COMP_TRACE_MARKER();
+@@ -1185,10 +1186,11 @@ comp_main_create_system_compositor(struct xrt_device *xdev,
+ }
+
+ // Standard app pacer.
+- struct u_pacing_app_factory *upaf = NULL;
+- xrt_result_t xret = u_pa_factory_create(&upaf);
+- assert(xret == XRT_SUCCESS && upaf != NULL);
+- (void)xret;
++ if (upaf == NULL) {
++ xrt_result_t xret = u_pa_factory_create(&upaf);
++ assert(xret == XRT_SUCCESS && upaf != NULL);
++ (void)xret;
++ }
+
+ return comp_multi_create_system_compositor(&c->base.base, upaf, sys_info, !c->deferred_surface, out_xsysc);
+ }
+diff --git a/src/xrt/compositor/main/comp_main_interface.h b/src/xrt/compositor/main/comp_main_interface.h
+index 0f0678358..f60568b43 100644
+--- a/src/xrt/compositor/main/comp_main_interface.h
++++ b/src/xrt/compositor/main/comp_main_interface.h
+@@ -15,6 +15,7 @@
+ #include "xrt/xrt_compositor.h"
+
+ struct comp_target_factory;
++struct u_pacing_app_factory;
+
+ #ifdef __cplusplus
+ extern "C" {
+@@ -31,11 +32,14 @@ extern "C" {
+ * @param xdev The head device
+ * @param ctf A compositor target factory to force the output device, must remain valid for the lifetime of the
+ * compositor. If NULL, factory is automatically selected
++ * @param upaf A pacing app factory to customize the application pacer, compositor takes ownership.
++ * If NULL, a default factory is used
+ * @param out_xsysc The output compositor
+ */
+ xrt_result_t
+ comp_main_create_system_compositor(struct xrt_device *xdev,
+ const struct comp_target_factory *ctf,
++ struct u_pacing_app_factory *upaf,
+ struct xrt_system_compositor **out_xsysc);
+
+
+diff --git a/src/xrt/targets/common/target_instance.c b/src/xrt/targets/common/target_instance.c
+index 617561c37..e10ba8358 100644
+--- a/src/xrt/targets/common/target_instance.c
++++ b/src/xrt/targets/common/target_instance.c
+@@ -109,7 +109,7 @@ t_instance_create_system(struct xrt_instance *xinst,
+
+ #ifdef XRT_MODULE_COMPOSITOR_MAIN
+ if (xret == XRT_SUCCESS && xsysc == NULL) {
+- xret = comp_main_create_system_compositor(head, NULL, &xsysc);
++ xret = comp_main_create_system_compositor(head, NULL, NULL, &xsysc);
+ }
+ #else
+ if (!use_null) {
+--
+2.50.1
+
diff --git a/server/driver/wivrn_foveation.h b/server/driver/wivrn_foveation.h
index 9b84b19d..e1eb50de 100644
--- a/server/driver/wivrn_foveation.h
+++ b/server/driver/wivrn_foveation.h
@@ -24,8 +24,6 @@
#include "xrt/xrt_defines.h"
#include "xrt/xrt_device.h"
-#include "utils/singleton.h"
-#include
#include
struct render_resources;
@@ -36,7 +34,7 @@ namespace wivrn
struct clock_offset;
struct wivrn_vk_bundle;
-class wivrn_foveation : public singleton
+class wivrn_foveation
{
std::mutex mutex;
@@ -55,8 +53,8 @@ class wivrn_foveation : public singleton
vk::raii::CommandPool command_pool;
vk::raii::CommandBuffer cmd;
- buffer_allocation gpu_buffer;
buffer_allocation host_buffer;
+ vk::Buffer gpu_buffer = nullptr;
// parameters used for last computation
struct P
@@ -83,8 +81,6 @@ public:
void update_foveation_center_override(const from_headset::override_foveation_center &);
std::array get_parameters();
- vk::Buffer get_gpu_buffer();
-
vk::CommandBuffer update_foveation_buffer(
vk::Buffer target,
bool flip_y,
diff --git a/server/main.cpp b/server/main.cpp
index 9867dacc..020e6136 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -18,6 +18,7 @@
#include "hostname.h"
#include "protocol_version.h"
#include "start_application.h"
+#include "utils/flatpak.h"
#include "utils/overloaded.h"
#include "version.h"
#include "wivrn_config.h"
@@ -127,51 +128,46 @@ int create_listen_socket()
return fd;
}
-static bool pressure_vessel_openxr_support()
+static std::filesystem::path flatpak_app_path()
{
- auto pv_var = std::getenv("PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES");
- return pv_var and pv_var == std::string_view("1");
-}
-
-static void append_delim(std::string & to, std::string_view what, char delim)
-{
- if (not to.empty())
- to += delim;
- to += what;
-}
-
-// search for the directory in path named needle
-// with d = /a/b/c/d/e and needle = c
-// return /a/b/c
-// if it can't be found, return the full path
-static std::filesystem::path find_dir(const std::filesystem::path & d, const std::filesystem::path & needle)
-{
- for (auto copy = d; not copy.empty(); copy = copy.parent_path())
+ if (auto value = flatpak_key(flatpak::section::instance, "app-path"))
{
- if (copy.filename() == needle)
- return copy;
+ std::filesystem::path path = *value;
+ while (path != "" and path != path.parent_path() and path.filename() != "io.github.wivrn.wivrn")
+ path = path.parent_path();
+
+ return path;
}
- return d;
+
+ return "/";
}
static std::string steam_command()
{
- std::string command;
+ std::string pressure_vessel_filesystems_rw = "$XDG_RUNTIME_DIR/" XRT_IPC_MSG_SOCK_FILENAME;
+ std::string vr_override;
- if (not pressure_vessel_openxr_support())
- command = "PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1";
-
- if (auto p = active_runtime::openvr_compat_path().string(); not p.empty())
+ // Check if in a flatpak
+ if (is_flatpak())
+ {
+ std::string app_path = flatpak_app_path().string();
+ // /usr and /var are remapped by steam
+ if (app_path.starts_with("/var"))
+ pressure_vessel_filesystems_rw += ":" + app_path;
+ }
+ else if (auto p = active_runtime::openvr_compat_path().string(); not p.empty())
{
// /usr cannot be shared in pressure vessel container
if (p.starts_with("/usr"))
- append_delim(command, " VR_OVERRIDE=/run/host" + p, ' ');
+ vr_override = " VR_OVERRIDE=/run/host" + p;
else if (p.starts_with("/var"))
- append_delim(command, "PRESSURE_VESSEL_FILESYSTEMS_RW=" + find_dir(p, "io.github.wivrn.wivrn").string(), ' ');
+ pressure_vessel_filesystems_rw += ":" + p;
}
- if (not command.empty())
- command += " %command%";
+ std::string command = "PRESSURE_VESSEL_FILESYSTEMS_RW=" + pressure_vessel_filesystems_rw + vr_override + " %command%";
+
+ if (auto p = active_runtime::manifest_path().string(); p.starts_with("/usr"))
+ command = "XR_RUNTIME_JSON=/run/host" + p + " " + command;
return command;
}
@@ -354,7 +350,7 @@ void start_publishing()
sprintf(protocol_string, "%016" PRIx64, wivrn::protocol_version);
std::map TXT = {
{"protocol", protocol_string},
- {"version", wivrn::display_version()},
+ {"version", wivrn::git_version},
{"cookie", server_cookie()},
};
publisher.emplace(poll_api, hostname(), "_wivrn._tcp", wivrn::default_port, TXT);
@@ -439,7 +435,7 @@ gboolean headset_connected_success(void *)
}
catch (std::exception & e)
{
- std::cerr << "Failed to start application: " << e.what() << std::endl;
+ std::cerr << "Failed to start application: " << e.what();
}
delay_next_try = default_delay_next_try;
@@ -692,18 +688,14 @@ void on_json_configuration(WivrnServer * server, const GParamSpec * pspec, gpoin
std::filesystem::path config_new = config;
config_new += ".new";
- {
- std::ofstream file(config_new);
- file.write(json, strlen(json));
- }
+ std::ofstream file(config_new);
+ file.write(json, strlen(json));
std::error_code ec;
std::filesystem::rename(config_new, config, ec);
if (ec)
std::cerr << "Failed to save configuration: " << ec.message() << std::endl;
-
- wivrn_server_set_steam_command(dbus_server, steam_command().c_str());
}
void expose_known_keys_on_dbus()
@@ -889,11 +881,10 @@ auto create_dbus_connection()
int inner_main(int argc, char * argv[], bool show_instructions)
{
- std::cerr << "WiVRn " << wivrn::display_version() << " starting" << std::endl;
+ std::cerr << "WiVRn " << wivrn::git_version << " starting" << std::endl;
if (show_instructions)
{
- if (auto command = steam_command(); not command.empty())
- std::cerr << "For Steam games, set command to " << command << std::endl;
+ std::cerr << "For Steam games, set command to " << steam_command() << std::endl;
}
std::filesystem::create_directories(socket_path().parent_path());
@@ -983,7 +974,6 @@ int main(int argc, char * argv[])
std::string config_file;
app.add_option("-f", config_file, "configuration file")->option_text("FILE")->check(CLI::ExistingFile);
- auto version_flag = app.add_flag("--version")->description("print version and exit");
auto no_active_runtime = app.add_flag("--no-manage-active-runtime")->description("don't set the active runtime on connection");
auto early_active_runtime = app.add_flag("--early-active-runtime")->description("forcibly manages the active runtime even if no headset present");
auto no_instructions = app.add_flag("--no-instructions")->group("");
@@ -996,12 +986,6 @@ int main(int argc, char * argv[])
CLI11_PARSE(app, argc, argv);
- if (*version_flag)
- {
- std::cout << "WiVRn version " << wivrn::display_version() << std::endl;
- return 0;
- }
-
if (not config_file.empty())
configuration::set_config_file(config_file);
diff --git a/server/utils/wivrn_vk_bundle.cpp b/server/utils/wivrn_vk_bundle.cpp
index 088f77c3..5a01c2a9 100644
--- a/server/utils/wivrn_vk_bundle.cpp
+++ b/server/utils/wivrn_vk_bundle.cpp
@@ -83,17 +83,16 @@ wivrn::wivrn_vk_bundle::wivrn_vk_bundle(vk_bundle & vk, std::span
physical_device(instance, vk.physical_device),
device(physical_device, vk.device),
allocator({
- .physicalDevice = vk.physical_device,
- .device = vk.device,
- .instance = vk.instance,
- .vulkanApiVersion = VK_MAKE_VERSION(1, 3, 0), // FIXME: sync with wivrn_session.cpp
- },
- vk.has_EXT_debug_utils),
- queue(device, vk.main_queue.family_index, vk.main_queue.index),
- queue_family_index(vk.main_queue.family_index),
+ .physicalDevice = vk.physical_device,
+ .device = vk.device,
+ .instance = vk.instance,
+ .vulkanApiVersion = VK_MAKE_VERSION(1, 3, 0), // FIXME: sync with wivrn_session.cpp
+ }),
+ queue(device, vk.queue_family_index, vk.queue_index),
+ queue_family_index(vk.queue_family_index),
#ifdef VK_KHR_video_encode_queue
- encode_queue(make_queue(device, vk.encode_queue.queue, vk.encode_queue.family_index, vk.encode_queue.index)),
- encode_queue_family_index(vk.encode_queue.family_index),
+ encode_queue(make_queue(device, vk.encode_queue, vk.encode_queue_family_index, vk.encode_queue_index)),
+ encode_queue_family_index(vk.encode_queue_family_index),
#else
encode_queue(nullptr),
encode_queue_family_index(vk::QueueFamilyIgnored),