14 vk::PipelineStageFlagBits::eColorAttachmentOutput;
16 vk::AccessFlagBits::eColorAttachmentWrite;
19 vk::PipelineStageFlagBits::eFragmentShader;
21 vk::AccessFlagBits::eInputAttachmentRead;
35 vk::AttachmentDescription
desc;
40 desc.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
41 desc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
42 desc.initialLayout = vk::ImageLayout::eGeneral;
43 desc.finalLayout = vk::ImageLayout::eGeneral;
44 colors_[index] =
desc;
49 resolves_[index] =
desc;
51 resolves_.erase(index);
61 vk::AttachmentDescription
desc;
68 desc.initialLayout = vk::ImageLayout::eUndefined;
69 desc.finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
70 depth_stencil_ =
desc;
79 vk::AttachmentDescription
desc;
82 desc.loadOp = vk::AttachmentLoadOp::eDontCare;
83 desc.storeOp = vk::AttachmentStoreOp::eDontCare;
86 desc.initialLayout = vk::ImageLayout::eUndefined;
87 desc.finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
88 depth_stencil_ =
desc;
93 const vk::Device&
device)
const {
96 const auto color_attachments_count =
97 colors_.empty() ? 0u : colors_.rbegin()->first + 1u;
99 std::vector<vk::AttachmentDescription> attachments;
101 std::vector<vk::AttachmentReference> color_refs(color_attachments_count,
103 std::vector<vk::AttachmentReference> resolve_refs(color_attachments_count,
107 for (
const auto&
color : colors_) {
108 vk::AttachmentReference color_ref;
109 color_ref.attachment = attachments.size();
110 color_ref.layout = vk::ImageLayout::eGeneral;
111 color_refs[
color.first] = color_ref;
112 attachments.push_back(
color.second);
114 if (
auto found = resolves_.find(
color.first); found != resolves_.end()) {
115 vk::AttachmentReference resolve_ref;
116 resolve_ref.attachment = attachments.size();
117 resolve_ref.layout = vk::ImageLayout::eGeneral;
118 resolve_refs[
color.first] = resolve_ref;
119 attachments.push_back(found->second);
123 if (depth_stencil_.has_value()) {
124 depth_stencil_ref.attachment = attachments.size();
125 depth_stencil_ref.layout = vk::ImageLayout::eGeneral;
126 attachments.push_back(depth_stencil_.value());
129 vk::SubpassDescription subpass0;
130 subpass0.pipelineBindPoint = vk::PipelineBindPoint::eGraphics;
131 subpass0.setInputAttachments(color_refs);
132 subpass0.setColorAttachments(color_refs);
133 subpass0.setResolveAttachments(resolve_refs);
134 subpass0.setPDepthStencilAttachment(&depth_stencil_ref);
136 vk::SubpassDependency self_dep;
137 self_dep.srcSubpass = 0u;
138 self_dep.dstSubpass = 0u;
145 vk::RenderPassCreateInfo render_pass_desc;
146 render_pass_desc.setAttachments(attachments);
147 render_pass_desc.setSubpasses(subpass0);
148 render_pass_desc.setDependencies(self_dep);
150 auto [
result, pass] =
device.createRenderPassUnique(render_pass_desc);
151 if (
result != vk::Result::eSuccess) {
155 return std::move(pass);
162 vk::ImageMemoryBarrier barrier;
165 barrier.oldLayout = vk::ImageLayout::eGeneral;
166 barrier.newLayout = vk::ImageLayout::eGeneral;
169 barrier.image =
image;
171 vk::ImageSubresourceRange image_levels;
172 image_levels.aspectMask = vk::ImageAspectFlagBits::eColor;
173 image_levels.baseArrayLayer = 0u;
174 image_levels.baseMipLevel = 0u;
177 barrier.subresourceRange = image_levels;
188const std::map<size_t, vk::AttachmentDescription>&
193const std::map<size_t, vk::AttachmentDescription>&
198const std::optional<vk::AttachmentDescription>&
200 return depth_stencil_;
RenderPassBuilderVK & SetDepthStencilAttachment(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
const std::map< size_t, vk::AttachmentDescription > & GetColorAttachments() const
const std::map< size_t, vk::AttachmentDescription > & GetResolves() const
RenderPassBuilderVK & SetStencilAttachment(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
const std::optional< vk::AttachmentDescription > & GetDepthStencil() const
RenderPassBuilderVK & SetColorAttachment(size_t index, PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action)
vk::UniqueRenderPass Build(const vk::Device &device) const
uint32_t uint32_t * format
sk_sp< const SkImage > image
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static constexpr vk::AttachmentReference kUnusedAttachmentReference
constexpr auto kSelfDependencyDstAccessMask
constexpr auto kSelfDependencySrcAccessMask
constexpr bool StoreActionPerformsResolve(StoreAction store_action)
constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp(LoadAction load_action)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp(StoreAction store_action, bool is_resolve_texture)
constexpr auto kSelfDependencySrcStageMask
constexpr auto kSelfDependencyDstStageMask
constexpr vk::SampleCountFlagBits ToVKSampleCount(SampleCount sample_count)
constexpr vk::Format ToVKImageFormat(PixelFormat format)
constexpr auto kSelfDependencyFlags
void InsertBarrierForInputAttachmentRead(const vk::CommandBuffer &buffer, const vk::Image &image)
Inserts the appropriate barriers to ensure that subsequent commands can read from the specified image...
static SkString to_string(int n)
#define VK_REMAINING_MIP_LEVELS
#define VK_REMAINING_ARRAY_LAYERS
#define VK_QUEUE_FAMILY_IGNORED