From 9bb39c4809f8658223e6d90335394861eb7bf59e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 11 Apr 2026 16:41:23 +0200 Subject: [PATCH] Drop staging buffer for foveation --- server/compositor/foveation.cpp | 24 +++--------------------- server/compositor/foveation.h | 1 - 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/server/compositor/foveation.cpp b/server/compositor/foveation.cpp index acf04671..614355dc 100644 --- a/server/compositor/foveation.cpp +++ b/server/compositor/foveation.cpp @@ -384,8 +384,8 @@ foveation::foveation(wivrn::vk_bundle & bundle, vk::Extent3D foveated_size) : .usage = vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eStorageBuffer, }, VmaAllocationCreateInfo{ - .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT, - .usage = VMA_MEMORY_USAGE_AUTO, + .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, + .usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, }, "foveation storage buffer"), sampler(make_sampler(bundle)), @@ -400,21 +400,6 @@ foveation::foveation(wivrn::vk_bundle & bundle, vk::Extent3D foveated_size) : })[0] .release()) { - if (not(gpu_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) - { - host_buffer = buffer_allocation( - bundle.device, - { - .size = gpu_buffer.info().size, - .usage = vk::BufferUsageFlagBits::eTransferSrc, - }, - { - .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, - .usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST, - }, - "foveation staging buffer"); - } - bundle.name(descriptor_set, "foveation descriptor set"); } @@ -515,9 +500,6 @@ void foveation::update_ubo( std::abs(last.manual_foveation.distance - manual_foveation.distance) < 0.0005) return; - if (host_buffer) - cmd.copyBuffer(host_buffer, gpu_buffer, vk::BufferCopy{.size = sizeof(ubo_data)}); - last = { .gaze = gaze, .flip_y = flip_y, @@ -529,7 +511,7 @@ void foveation::update_ubo( compute_params(); - auto ubo = host_buffer ? host_buffer.data() : gpu_buffer.data(); + auto ubo = gpu_buffer.data(); ubo->alpha_width = foveated_size.width / 2; for (size_t view = 0; view < 2; ++view) { diff --git a/server/compositor/foveation.h b/server/compositor/foveation.h index 3a320ab6..57c3d216 100644 --- a/server/compositor/foveation.h +++ b/server/compositor/foveation.h @@ -51,7 +51,6 @@ class foveation std::array params; buffer_allocation gpu_buffer; - buffer_allocation host_buffer; vk::raii::Sampler sampler; vk::raii::DescriptorSetLayout ds_layout;