Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
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 <array>
9
#include <cstdint>
10
#include <string>
11
12
#include "
fml/status.h
"
13
#include "
impeller/core/resource_binder.h
"
14
#include "
impeller/renderer/compute_pipeline_descriptor.h
"
15
#include "
impeller/renderer/pipeline_descriptor.h
"
16
17
namespace
impeller
{
18
19
//------------------------------------------------------------------------------
20
/// @brief Compute passes encode compute shader into the underlying command
21
/// buffer.
22
///
23
/// @see `CommandBuffer`
24
///
25
class
ComputePass
:
public
ResourceBinder
{
26
public
:
27
virtual
~ComputePass
();
28
29
virtual
bool
IsValid
()
const
= 0;
30
31
void
SetLabel
(
const
std::string& label);
32
33
virtual
void
SetCommandLabel
(std::string_view label) = 0;
34
35
virtual
void
SetPipeline
(
36
const
std::shared_ptr<
Pipeline<ComputePipelineDescriptor>
>&
pipeline
) = 0;
37
38
//----------------------------------------------------------------------------
39
/// @brief Dispatch a grid of compute workgroups.
40
///
41
/// The components of `workgroup_count` are workgroup
42
/// (threadgroup) counts, not invocation counts. The number of
43
/// invocations per workgroup (the local size) is declared by the
44
/// shader. The total invocations along an axis is therefore the
45
/// workgroup count times the shader's local size.
46
///
47
/// @return A cancelled status if any dimension is zero.
48
///
49
virtual
fml::Status
Compute
(std::array<uint32_t, 3> workgroup_count) = 0;
50
51
/// @brief Ensures all previously encoded compute command's buffer writes are
52
/// visible to any subsequent compute commands.
53
///
54
/// On Vulkan, it does not matter if the compute command is in a
55
/// different command buffer, only that it is executed later in queue
56
/// order.
57
virtual
void
AddBufferMemoryBarrier
() = 0;
58
59
/// @brief Ensures all previously encoded compute command's texture writes are
60
/// visible to any subsequent compute commands.
61
///
62
/// On Vulkan, it does not matter if the compute command is in a
63
/// different command buffer, only that it is executed later in queue
64
/// order.
65
virtual
void
AddTextureMemoryBarrier
() = 0;
66
67
//----------------------------------------------------------------------------
68
/// @brief Encode the recorded commands to the underlying command buffer.
69
///
70
/// @return If the commands were encoded to the underlying command
71
/// buffer.
72
///
73
virtual
bool
EncodeCommands
()
const
= 0;
74
75
const
Context
&
GetContext
()
const
{
return
*
context_
; }
76
77
protected
:
78
const
std::shared_ptr<const Context>
context_
;
79
80
explicit
ComputePass
(std::shared_ptr<const Context>
context
);
81
82
virtual
void
OnSetLabel
(
const
std::string& label) = 0;
83
84
private
:
85
ComputePass
(
const
ComputePass
&) =
delete
;
86
87
ComputePass
& operator=(
const
ComputePass
&) =
delete
;
88
};
89
90
}
// namespace impeller
91
92
#endif
// FLUTTER_IMPELLER_RENDERER_COMPUTE_PASS_H_
fml::Status
Definition
status.h:35
impeller::ComputePass
Compute passes encode compute shader into the underlying command buffer.
Definition
compute_pass.h:25
impeller::ComputePass::context_
const std::shared_ptr< const Context > context_
Definition
compute_pass.h:78
impeller::ComputePass::OnSetLabel
virtual void OnSetLabel(const std::string &label)=0
impeller::ComputePass::AddBufferMemoryBarrier
virtual void AddBufferMemoryBarrier()=0
Ensures all previously encoded compute command's buffer writes are visible to any subsequent compute ...
impeller::ComputePass::SetCommandLabel
virtual void SetCommandLabel(std::string_view label)=0
impeller::ComputePass::SetPipeline
virtual void SetPipeline(const std::shared_ptr< Pipeline< ComputePipelineDescriptor > > &pipeline)=0
impeller::ComputePass::Compute
virtual fml::Status Compute(std::array< uint32_t, 3 > workgroup_count)=0
Dispatch a grid of compute workgroups.
impeller::ComputePass::SetLabel
void SetLabel(const std::string &label)
Definition
compute_pass.cc:14
impeller::ComputePass::~ComputePass
virtual ~ComputePass()
impeller::ComputePass::GetContext
const Context & GetContext() const
Definition
compute_pass.h:75
impeller::ComputePass::EncodeCommands
virtual bool EncodeCommands() const =0
Encode the recorded commands to the underlying command buffer.
impeller::ComputePass::IsValid
virtual bool IsValid() const =0
impeller::ComputePass::AddTextureMemoryBarrier
virtual void AddTextureMemoryBarrier()=0
Ensures all previously encoded compute command's texture writes are visible to any subsequent compute...
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition
context.h:69
impeller::Pipeline
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Definition
pipeline.h:53
compute_pipeline_descriptor.h
impeller
Definition
texture.h:16
pipeline_descriptor.h
context
std::shared_ptr< ContextGLES > context
Definition
render_pass_gles_unittests.cc:74
pipeline
std::shared_ptr< PipelineGLES > pipeline
Definition
render_pass_gles_unittests.cc:79
resource_binder.h
status.h
impeller::ResourceBinder
An interface for binding resources. This is implemented by |Command| and |ComputeCommand| to make GPU...
Definition
resource_binder.h:24
impeller
renderer
compute_pass.h
Generated on Sun Jul 5 2026 07:45:16 for Flutter Engine Uber Docs by
1.9.8