Flutter Engine
The Flutter Engine
khr_swapchain_image_vk.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace impeller {
8
10 const vk::Device& device,
12 : TextureSourceVK(desc), image_(image) {
13 vk::ImageViewCreateInfo view_info;
14 view_info.image = image_;
15 view_info.viewType = vk::ImageViewType::e2D;
16 view_info.format = ToVKImageFormat(desc.format);
17 view_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
18 view_info.subresourceRange.baseMipLevel = 0u;
19 view_info.subresourceRange.baseArrayLayer = 0u;
20 view_info.subresourceRange.levelCount = desc.mip_count;
21 view_info.subresourceRange.layerCount = ToArrayLayerCount(desc.type);
22
23 auto [view_result, view] = device.createImageViewUnique(view_info);
24 if (view_result != vk::Result::eSuccess) {
25 return;
26 }
27
28 image_view_ = std::move(view);
29 is_valid_ = true;
30}
31
33
35 return is_valid_;
36}
37
38// |TextureSourceVK|
40 return image_;
41}
42
43// |TextureSourceVK|
44vk::ImageView KHRSwapchainImageVK::GetImageView() const {
45 return image_view_.get();
46}
47
48// |TextureSourceVK|
50 return image_view_.get();
51}
52
53// |TextureSourceVK|
55 return true;
56}
57
58} // namespace impeller
KHRSwapchainImageVK(TextureDescriptor desc, const vk::Device &device, vk::Image image)
vk::Image GetImage() const override
Get the image handle for this texture source.
vk::ImageView GetImageView() const override
Retrieve the image view used for sampling/blitting/compute with this texture source.
bool IsSwapchainImage() const override
Determines if swapchain image. That is, an image used as the root render target.
vk::ImageView GetRenderTargetView() const override
Retrieve the image view used for render target attachments with this texture source.
Abstract base class that represents a vkImage and an vkImageView.
VkDevice device
Definition: main.cc:53
sk_sp< const SkImage > image
Definition: SkRecords.h:269
CanvasImage Image
Definition: dart_ui.cc:55
constexpr uint32_t ToArrayLayerCount(TextureType type)
Definition: formats_vk.h:516
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:133
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...