24std::unique_ptr<TestVulkanSurface> TestVulkanSurface::Create(
27 auto image_result = context.
CreateImage(surface_size);
29 if (!image_result.has_value()) {
30 FML_LOG(ERROR) <<
"Could not create VkImage.";
34 GrVkImageInfo image_info = {
35 .fImage = image_result.value().GetImage(),
36 .fImageTiling = VK_IMAGE_TILING_OPTIMAL,
37 .fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED,
38 .fFormat = VK_FORMAT_R8G8B8A8_UNORM,
39 .fImageUsageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
40 VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
41 VK_IMAGE_USAGE_TRANSFER_DST_BIT |
42 VK_IMAGE_USAGE_SAMPLED_BIT,
46 auto backend_texture = GrBackendTextures::MakeVk(
47 surface_size.
width, surface_size.
height, image_info);
49 SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);
52 auto result = std::unique_ptr<TestVulkanSurface>(
54 result->surface_ = SkSurfaces::WrapBackendTexture(
57 kTopLeft_GrSurfaceOrigin,
59 kRGBA_8888_SkColorType,
60 SkColorSpace::MakeSRGB(),
66 if (!result->surface_) {
68 <<
"Could not wrap VkImage as an SkSurface Vulkan render texture.";
sk_sp< GrDirectContext > GetGrDirectContext() const
std::optional< TestVulkanImage > CreateImage(const DlISize &size) const