Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
11
12namespace impeller {
13
14class CommandBufferVK;
15
16class 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 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(std::array<uint32_t, 3> workgroup_count) override;
68
69 // |ResourceBinder|
70 bool BindResource(ShaderStage stage,
72 const ShaderUniformSlot& slot,
73 const ShaderMetadata* metadata,
74 BufferView view) override;
75
76 // |ResourceBinder|
77 bool BindResource(ShaderStage stage,
79 const SampledImageSlot& slot,
80 const ShaderMetadata* metadata,
81 std::shared_ptr<const Texture> texture,
82 raw_ptr<const Sampler> sampler) override;
83
84 bool BindResource(size_t binding, DescriptorType type, BufferView view);
85};
86
87} // namespace impeller
88#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMPUTE_PASS_VK_H_
Compute passes encode compute shader into the underlying command buffer.
FlTexture * texture
std::shared_ptr< ContextGLES > context
std::shared_ptr< PipelineGLES > pipeline
std::shared_ptr< CommandBuffer > command_buffer
impeller::ShaderType type