| Flutter Impeller |

compute_pass_vk.h
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
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMPUTE_PASS_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMPUTE_PASS_VK_H_
7
8 #include "impeller/renderer/backend/vulkan/pipeline_vk.h"
9 #include "impeller/renderer/backend/vulkan/vk.h"
10 #include "impeller/renderer/compute_pass.h"
11
12 namespace impeller {
13
14 class CommandBufferVK;
15
16 class ComputePassVK final : public ComputePass {
17 public:
18 // |ComputePass|
19 ~ComputePassVK() override;
20
21 private:
22 friend class CommandBufferVK;
23
24 std::shared_ptr<CommandBufferVK> command_buffer_;
25 std::string label_;
26 std::array<uint32_t, 3> max_wg_size_ = {};
27 bool is_valid_ = false;
28
29 // Per-command state.
30 std::array<vk::DescriptorImageInfo, kMaxBindings> image_workspace_;
31 std::array<vk::DescriptorBufferInfo, kMaxBindings> buffer_workspace_;
32 std::array<vk::WriteDescriptorSet, kMaxBindings + kMaxBindings>
33 write_workspace_;
34 size_t bound_image_offset_ = 0u;
35 size_t bound_buffer_offset_ = 0u;
36 size_t descriptor_write_offset_ = 0u;
37 bool has_label_ = false;
38 bool pipeline_valid_ = false;
39 vk::DescriptorSet descriptor_set_ = {};
40 vk::PipelineLayout pipeline_layout_ = {};
41
42 ComputePassVK(std::shared_ptr<const Context> context,
43 std::shared_ptr<CommandBufferVK> command_buffer);
44
45 // |ComputePass|
46 bool IsValid() const override;
47
48 // |ComputePass|
49 void OnSetLabel(const std::string& label) override;
50
51 // |ComputePass|
52 bool EncodeCommands() const override;
53
54 // |ComputePass|
55 void SetCommandLabel(std::string_view label) override;
56
57 // |ComputePass|
58 void SetPipeline(const std::shared_ptr<Pipeline<ComputePipelineDescriptor>>&
59 pipeline) override;
60
61 // |ComputePass|
62 void AddBufferMemoryBarrier() override;
63
64 // |ComputePass|
65 void AddTextureMemoryBarrier() override;
66
67 // |ComputePass|
68 fml::Status Compute(const ISize& grid_size) override;
69
70 // |ResourceBinder|
71 bool BindResource(ShaderStage stage,
72 DescriptorType type,
73 const ShaderUniformSlot& slot,
74 const ShaderMetadata& metadata,
75 BufferView view) override;
76
77 // |ResourceBinder|
78 bool BindResource(ShaderStage stage,
79 DescriptorType type,
80 const SampledImageSlot& slot,
81 const ShaderMetadata& metadata,
82 std::shared_ptr<const Texture> texture,
83 const std::unique_ptr<const Sampler>& sampler) override;
84
85 bool BindResource(size_t binding,
86 DescriptorType type,
87 const BufferView& view);
88 };
89
90 } // namespace impeller
91 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMPUTE_PASS_VK_H_
impeller::ISize
ISize64 ISize
Definition: size.h:140
impeller::ComputePassVK::~ComputePassVK
~ComputePassVK() override
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:22
pipeline_vk.h
vk.h
type
GLenum type
Definition: blit_command_gles.cc:127
impeller::CommandBufferVK
Definition: command_buffer_vk.h:23
compute_pass.h
impeller
Definition: allocation.cc:12
impeller::ComputePassVK
Definition: compute_pass_vk.h:16
impeller::ComputePass
Compute passes encode compute shader into the underlying command buffer.
Definition: compute_pass.h:23
impeller::DescriptorType
DescriptorType
Definition: shader_types.h:156