MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / update_swapchain_impl

Method update_swapchain_impl

framework/rendering/render_context.h:957–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955
956template <vkb::BindingType bindingType>
957inline void RenderContext<bindingType>::update_swapchain_impl(vk::Extent2D const &extent, vk::SurfaceTransformFlagBitsKHR transform)
958{
959 if (!swapchain)
960 {
961 LOGW("Can't update the swapchains extent and surface transform. No swapchain, offscreen rendering detected, skipping.");
962 return;
963 }
964
965 device.get_resource_cache().clear_framebuffers();
966
967 auto width = extent.width;
968 auto height = extent.height;
969 if (transform == vk::SurfaceTransformFlagBitsKHR::eRotate90 || transform == vk::SurfaceTransformFlagBitsKHR::eRotate270)
970 {
971 // Pre-rotation: always use native orientation i.e. if rotated, use width and height of identity transform
972 std::swap(width, height);
973 }
974
975 swapchain = std::make_unique<vkb::core::HPPSwapchain>(*swapchain, vk::Extent2D{width, height}, transform);
976
977 // Save the preTransform attribute for future rotations
978 pre_transform = transform;
979
980 recreate();
981}
982
983template <vkb::BindingType bindingType>
984inline void RenderContext<bindingType>::update_swapchain(const ImageCompressionFlagsType compression,

Callers

nothing calls this directly

Calls 1

clear_framebuffersMethod · 0.45

Tested by

no test coverage detected