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