Correctly handle larger swapchains

This commit is contained in:
Patrick Nicolas
2025-09-10 22:23:02 +02:00
parent adc07e8f50
commit 891a087ccc
+19 -12
View File
@@ -178,18 +178,8 @@ stream_defoveator::pipeline_t & stream_defoveator::ensure_pipeline(size_t view,
.InputAssemblyState = {{
.topology = vk::PrimitiveTopology::eTriangleStrip,
}},
.Viewports = {{
.x = 0,
.y = 0,
.width = (float)output_extent.width,
.height = (float)output_extent.height,
.minDepth = 0,
.maxDepth = 1,
}},
.Scissors = {{
.offset = {.x = 0, .y = 0},
.extent = output_extent,
}},
.Viewports = {{}},
.Scissors = {{}},
.RasterizationState = {{
.polygonMode = vk::PolygonMode::eFill,
.lineWidth = 1,
@@ -201,6 +191,7 @@ stream_defoveator::pipeline_t & stream_defoveator::ensure_pipeline(size_t view,
.ColorBlendAttachments = {{
.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA,
}},
.DynamicStates = {vk::DynamicState::eViewport, vk::DynamicState::eScissor},
.layout = *target.layout,
.renderPass = *renderpass,
.subpass = 0,
@@ -390,6 +381,22 @@ void stream_defoveator::defoveate(vk::raii::CommandBuffer & command_buffer,
const int n_ratio_y = (py.size() - 1) / 2;
const int n_ratio_x = (px.size() - 1) / 2;
command_buffer.setScissor(
0,
vk::Rect2D{
.extent = {.width = uint32_t(out_size.width), .height = uint32_t(out_size.height)},
});
command_buffer.setViewport(
0,
vk::Viewport{
.x = 0,
.y = 0,
.width = float(out_size.width),
.height = float(out_size.height),
.minDepth = 0,
.maxDepth = 1,
});
glm::uvec2 in(0);
glm::vec2 out(-0.5 * out_size.width, -0.5 * out_size.height); // pixel coordinates
glm::vec2 out_pixel_size(2. / out_size.width,