Acquire the next surface that can be used to present to the swapchain.
89 {
90 {
92 if (!pending_presents_->Wait()) {
93 return nullptr;
94 }
95 }
96
97 AutoSemaSignaler auto_sema_signaler =
98 std::make_shared<fml::ScopedCleanupClosure>(
99 [sema = pending_presents_]() { sema->Signal(); });
100
101 if (!is_valid_) {
102 return nullptr;
103 }
104
105 auto pool_entry = pool_->Pop();
106
107 if (!pool_entry.IsValid()) {
109 return nullptr;
110 }
111
112 auto context = transients_->GetContext().lock();
113 if (context) {
115 }
116
117
118
119 if (!SubmitWaitForRenderReady(pool_entry.render_ready_fence,
120 pool_entry.texture)) {
121 VALIDATION_LOG <<
"Could not submit a command to the GPU to wait on render "
122 "readiness.";
123 return nullptr;
124 }
125
127 transients_, pool_entry.texture,
128 [signaler = auto_sema_signaler, weak = weak_from_this(),
129 texture = pool_entry.texture]() {
130 auto thiz = weak.lock();
131 if (!thiz) {
132 VALIDATION_LOG << "Swapchain died before image could be presented.";
133 return false;
134 }
135 return thiz->Present(signaler,
texture);
136 });
137
139 return nullptr;
140 }
141
143}
static ContextVK & Cast(Context &base)
std::shared_ptr< GPUTracerVK > GetGPUTracer() const
static std::unique_ptr< SurfaceVK > WrapSwapchainImage(const std::shared_ptr< SwapchainTransientsVK > &transients, const std::shared_ptr< TextureSourceVK > &swapchain_image, SwapCallback swap_callback)
Wrap the swapchain image in a Surface, which provides the additional configuration required for usage...
#define TRACE_EVENT0(category_group, name)