This creates the associated MSAA and depth+stencil texture.
16 {
17 if (!transients || !swapchain_image || !swap_callback) {
18 return nullptr;
19 }
20
21 auto context = transients->GetContext().lock();
22 if (!context) {
23 return nullptr;
24 }
25
26 const auto enable_msaa = transients->IsMSAAEnabled();
27
28 const auto swapchain_tex_desc = swapchain_image->GetTextureDescriptor();
29
30 TextureDescriptor resolve_tex_desc;
32 resolve_tex_desc.format = swapchain_tex_desc.format;
33 resolve_tex_desc.size = swapchain_tex_desc.size;
37
38 std::shared_ptr<Texture> resolve_tex =
39 std::make_shared<TextureVK>(context,
40 swapchain_image
41 );
42
43 if (!resolve_tex) {
44 return nullptr;
45 }
46 resolve_tex->SetLabel("ImpellerOnscreenResolve");
47
48 ColorAttachment color0;
51 if (enable_msaa) {
52 color0.texture = transients->GetMSAATexture();
54 color0.resolve_texture = resolve_tex;
55 } else {
56 color0.texture = resolve_tex;
58 }
59
61 render_target_desc.SetColorAttachment(color0, 0u);
62 render_target_desc.SetupDepthStencilAttachments(
63 *context,
64 *context->GetResourceAllocator(),
65 swapchain_tex_desc.size,
66 enable_msaa,
67 "Onscreen",
68
70 transients->GetDepthStencilTexture()
71 );
72
73
74 return std::unique_ptr<SurfaceVK>(
75 new SurfaceVK(render_target_desc, std::move(swap_callback)));
76}
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static constexpr Color DarkSlateGray()