From d640ae026fbfe328f3b7981720234b3fa3e756ed Mon Sep 17 00:00:00 2001 From: Matthew Schwartz Date: Mon, 19 Oct 2026 21:14:42 -0700 Subject: [PATCH] rendervulkan: align upload ring allocations to the uniform offset limit The upload ring aligns every allocation to 16 bytes, but constants are bound as a uniform buffer at that offset and NVIDIA requires 64. With eight composite layers BlitPushData_t is 584 bytes, so the RGB to NV12 constants that follow it in vulkan_screenshot land at offset 592. The convert pass then never writes the NV12 image, and Steam Remote Play shows a green frame. Align to minUniformBufferOffsetAlignment, floored at 16 so buffer to image copies from the same ring keep their texel alignment. Closes: https://github.com/ValveSoftware/gamescope/issues/2489 --- src/rendervulkan.cpp | 1 + src/rendervulkan.hpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp index c2042208a..f98665c10 100644 --- a/src/rendervulkan.cpp +++ b/src/rendervulkan.cpp @@ -537,6 +537,7 @@ bool CVulkanDevice::createDevice() VkPhysicalDeviceProperties deviceProperties; vk.GetPhysicalDeviceProperties( physDev(), &deviceProperties ); m_uVendorID = deviceProperties.vendorID; + m_uUploadAlignment = std::max( 16, deviceProperties.limits.minUniformBufferOffsetAlignment ); } float queuePriorities = 1.0f; diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp index 033fa6671..31cfc7aba 100644 --- a/src/rendervulkan.hpp +++ b/src/rendervulkan.hpp @@ -877,7 +877,7 @@ class CVulkanDevice { assert(size <= upload_buffer_size); - m_uploadBufferOffset = align(m_uploadBufferOffset, 16); + m_uploadBufferOffset = align(m_uploadBufferOffset, m_uUploadAlignment); if (m_uploadBufferOffset + size > upload_buffer_size) { fprintf(stderr, "Exceeded uploadBufferData\n"); @@ -934,6 +934,7 @@ class CVulkanDevice bool m_bSupportsFp16 = false; uint32_t m_uVendorID = 0; + uint32_t m_uUploadAlignment = 16; bool m_bHasDrmPrimaryDevId = false; bool m_bSupportsModifiers = false; bool m_bInitialized = false;