Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
compute_pass.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_COMPUTE_PASS_H_
6#define FLUTTER_IMPELLER_RENDERER_COMPUTE_PASS_H_
7
8#include <string>
9
10#include "fml/status.h"
14
15namespace impeller {
16
17//------------------------------------------------------------------------------
18/// @brief Compute passes encode compute shader into the underlying command
19/// buffer.
20///
21/// @see `CommandBuffer`
22///
24 public:
25 virtual ~ComputePass();
26
27 virtual bool IsValid() const = 0;
28
29 void SetLabel(const std::string& label);
30
31 virtual void SetCommandLabel(std::string_view label) = 0;
32
33 virtual void SetPipeline(
34 const std::shared_ptr<Pipeline<ComputePipelineDescriptor>>& pipeline) = 0;
35
36 virtual fml::Status Compute(const ISize& grid_size) = 0;
37
38 /// @brief Ensures all previously encoded compute command's buffer writes are
39 /// visible to any subsequent compute commands.
40 ///
41 /// On Vulkan, it does not matter if the compute command is in a
42 /// different command buffer, only that it is executed later in queue
43 /// order.
44 virtual void AddBufferMemoryBarrier() = 0;
45
46 /// @brief Ensures all previously encoded compute command's texture writes are
47 /// visible to any subsequent compute commands.
48 ///
49 /// On Vulkan, it does not matter if the compute command is in a
50 /// different command buffer, only that it is executed later in queue
51 /// order.
52 virtual void AddTextureMemoryBarrier() = 0;
53
54 //----------------------------------------------------------------------------
55 /// @brief Encode the recorded commands to the underlying command buffer.
56 ///
57 /// @return If the commands were encoded to the underlying command
58 /// buffer.
59 ///
60 virtual bool EncodeCommands() const = 0;
61
62 const Context& GetContext() const { return *context_; }
63
64 protected:
65 const std::shared_ptr<const Context> context_;
66
67 explicit ComputePass(std::shared_ptr<const Context> context);
68
69 virtual void OnSetLabel(const std::string& label) = 0;
70
71 private:
72 ComputePass(const ComputePass&) = delete;
73
74 ComputePass& operator=(const ComputePass&) = delete;
75};
76
77} // namespace impeller
78
79#endif // FLUTTER_IMPELLER_RENDERER_COMPUTE_PASS_H_
Compute passes encode compute shader into the underlying command buffer.
const std::shared_ptr< const Context > context_
virtual void OnSetLabel(const std::string &label)=0
virtual void AddBufferMemoryBarrier()=0
Ensures all previously encoded compute command's buffer writes are visible to any subsequent compute ...
virtual void SetCommandLabel(std::string_view label)=0
virtual void SetPipeline(const std::shared_ptr< Pipeline< ComputePipelineDescriptor > > &pipeline)=0
virtual fml::Status Compute(const ISize &grid_size)=0
void SetLabel(const std::string &label)
const Context & GetContext() const
virtual bool EncodeCommands() const =0
Encode the recorded commands to the underlying command buffer.
virtual bool IsValid() const =0
virtual void AddTextureMemoryBarrier()=0
Ensures all previously encoded compute command's texture writes are visible to any subsequent compute...
To do anything rendering related with Impeller, you need a context.
Definition context.h:46
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition pipeline.h:49
An interface for binding resources. This is implemented by |Command| and |ComputeCommand| to make GPU...