fix: video without UI + correct colors

1. No UI in video: end render pass before ImGui, capture, start new
   render pass with loadOp=LOAD for ImGui, end again. Video captures
   only the 3D scene.

2. Acid colors fixed: swapchain format changed from B8G8R8A8_SRGB to
   B8G8R8A8_UNORM. SRGB format stores gamma-compressed values that
   vkCmdCopyImageToBuffer reads raw — FFmpeg treated them as linear
   causing acid colors. UNORM stores linear values, copy gives linear
   data, FFmpeg bgra→yuv420p conversion is correct.
This commit is contained in:
emil28092005
2026-06-19 09:13:04 +03:00
parent 2daf10b3b1
commit d6939e9efa
3 changed files with 34 additions and 10 deletions
+3 -3
View File
@@ -361,12 +361,12 @@ internal sealed unsafe class VulkanContext : IDisposable
var formats = stackalloc VkSurfaceFormatKHR[(int)formatCount];
Vk.vkGetPhysicalDeviceSurfaceFormatsKHR(PhysicalDevice, Surface, &formatCount, formats);
SurfaceFormat = VkFormat.B8G8R8A8Srgb;
SurfaceFormat = VkFormat.B8G8R8A8Unorm;
SurfaceColorSpace = VkColorSpaceKHR.SrgbNonlinearKHR;
for (uint i = 0; i < formatCount; i++)
{
if (formats[(int)i].format == VkFormat.B8G8R8A8Srgb &&
if (formats[(int)i].format == VkFormat.B8G8R8A8Unorm &&
formats[(int)i].colorSpace == VkColorSpaceKHR.SrgbNonlinearKHR)
{
SurfaceFormat = formats[(int)i].format;
@@ -375,7 +375,7 @@ internal sealed unsafe class VulkanContext : IDisposable
}
}
if (SurfaceFormat == VkFormat.B8G8R8A8Srgb)
if (SurfaceFormat == VkFormat.B8G8R8A8Unorm)
{
SurfaceFormat = formats[0].format;
SurfaceColorSpace = formats[0].colorSpace;