14 const std::shared_ptr<SwapchainTransientsVK>& transients,
15 const std::shared_ptr<TextureSourceVK>& swapchain_image,
17 if (!transients || !swapchain_image || !swap_callback) {
21 auto context = transients->GetContext().lock();
26 const auto enable_msaa = transients->IsMSAAEnabled();
28 const auto swapchain_tex_desc = swapchain_image->GetTextureDescriptor();
32 resolve_tex_desc.
format = swapchain_tex_desc.format;
33 resolve_tex_desc.
size = swapchain_tex_desc.size;
38 std::shared_ptr<Texture> resolve_tex =
39 std::make_shared<TextureVK>(context,
46 resolve_tex->SetLabel(
"ImpellerOnscreenResolve");
52 color0.
texture = transients->GetMSAATexture();
64 *context->GetResourceAllocator(),
65 swapchain_tex_desc.size,
70 transients->GetDepthStencilTexture()
74 return std::unique_ptr<SurfaceVK>(
75 new SurfaceVK(render_target_desc, std::move(swap_callback)));
83bool SurfaceVK::Present()
const {
84 return swap_callback_ ? swap_callback_() :
false;
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
void SetupDepthStencilAttachments(const Context &context, Allocator &allocator, ISize size, bool msaa, const std::string &label="Offscreen", RenderTarget::AttachmentConfig stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &depth_stencil_texture=nullptr)
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
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...
std::function< bool(void)> SwapCallback
std::shared_ptr< Texture > resolve_texture
std::shared_ptr< Texture > texture
static constexpr Color DarkSlateGray()
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...