Flutter Engine
The Flutter Engine
|
#include <ComputeStep.h>
Classes | |
struct | NativeShaderSource |
struct | ResourceDesc |
struct | WorkgroupBufferDesc |
Public Types | |
enum class | DataFlow { kPrivate , kShared } |
enum class | ResourceType { kUniformBuffer , kStorageBuffer , kReadOnlyStorageBuffer , kIndirectBuffer , kWriteOnlyStorageTexture , kReadOnlyTexture , kSampledTexture } |
enum class | ResourcePolicy { kNone , kClear , kMapped } |
enum class | NativeShaderFormat { kWGSL , kMSL } |
Public Member Functions | |
virtual | ~ComputeStep ()=default |
virtual std::string | computeSkSL () const |
virtual NativeShaderSource | nativeShaderSource (NativeShaderFormat) const |
virtual size_t | calculateBufferSize (int resourceIndex, const ResourceDesc &) const |
virtual std::tuple< SkISize, SkColorType > | calculateTextureParameters (int resourceIndex, const ResourceDesc &) const |
virtual SamplerDesc | calculateSamplerParameters (int resourceIndex, const ResourceDesc &) const |
virtual WorkgroupSize | calculateGlobalDispatchSize () const |
virtual void | prepareStorageBuffer (int resourceIndex, const ResourceDesc &resource, void *buffer, size_t bufferSize) const |
virtual void | prepareUniformBuffer (int resourceIndex, const ResourceDesc &, UniformManager *) const |
SkSpan< const ResourceDesc > | resources () const |
SkSpan< const WorkgroupBufferDesc > | workgroupBuffers () const |
uint32_t | uniqueID () const |
const char * | name () const |
WorkgroupSize | localDispatchSize () const |
bool | supportsNativeShader () const |
Protected Types | |
enum class | Flags : uint8_t { kNone = 0b00000 , kSupportsNativeShader = 0b00010 } |
Protected Member Functions | |
ComputeStep (std::string_view name, WorkgroupSize localDispatchSize, SkSpan< const ResourceDesc > resources, SkSpan< const WorkgroupBufferDesc > workgroupBuffers={}, Flags baseFlags=Flags::kNone) | |
A ComputeStep
represents a compute pass within a wider draw operation. A ComputeStep
implementation describes an invocation of a compute program and its data binding layout.
A ComputeStep
can perform arbitrary operations on the GPU over various types of data, including geometry and image processing. The data processed by a ComputeStep
can be inputs (textures or buffers) populated on the CPU, data forwarded to and from other ComputeStep
invocations (via "slots"), transient storage buffers/textures that are only used within an individual dispatch, geometry attribute (vertex/index/instance) and indirect draw parameters of a subsequent raster pipeline stage, as well as texture outputs.
The data flow between sequential ComputeStep
invocations within a DispatchGroup is achieved by operating over a shared "resource table". ComputeStep
s can declare a resource with a slot number. Multiple ComputeStep
s in a group that declare a resource with the same slot number will have access to the same backing resource object through that slot:
_______________ _______________ | | | | | ---[Slot 0]--- | | | | | | ---[Slot 1]--- | | ComputeStep 1 | | ComputeStep 2 | | ---[Slot 2] | | | | | | | | [Slot 3]--- | | | | | --------------- ---------------
In the example above, slots 0 and 1 are accessed by both ComputeSteps, while slots 2 and 3 are exclusively accessed by ComputeStep 1 and 2 respectively. Alternately, slots 2 and 3 could be declared as "private" resources which are visible to a single ComputeStep.
Similarly, raster stage geometry buffers that are specified as the output of a ComputeStep can be used to assign the draw buffers of a RenderStep.
It is the responsibility of the owning entity (e.g. a RendererProvider) to ensure that a chain of ComputeStep and RenderStep invocations have a compatible resource and data-flow layout.
Definition at line 67 of file ComputeStep.h.
|
strong |
Enumerator | |
---|---|
kPrivate | |
kShared |
Definition at line 69 of file ComputeStep.h.
|
strongprotected |
Enumerator | |
---|---|
kNone | |
kSupportsNativeShader |
Definition at line 254 of file ComputeStep.h.
|
strong |
Enumerator | |
---|---|
kWGSL | |
kMSL |
Definition at line 171 of file ComputeStep.h.
|
strong |
Enumerator | |
---|---|
kNone | |
kClear | |
kMapped |
Definition at line 95 of file ComputeStep.h.
|
strong |
Enumerator | |
---|---|
kUniformBuffer | |
kStorageBuffer | |
kReadOnlyStorageBuffer | |
kIndirectBuffer | |
kWriteOnlyStorageTexture | |
kReadOnlyTexture | |
kSampledTexture |
Definition at line 79 of file ComputeStep.h.
|
virtualdefault |
|
protected |
Definition at line 28 of file ComputeStep.cpp.
|
virtual |
Reimplemented in skgpu::graphite::VelloFineMsaaStepBase< S, T, MaskLutBuilder >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa16R8, kAlpha_8_SkColorType, vello_cpp::build_mask_lut_16 >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa16, kRGBA_8888_SkColorType, vello_cpp::build_mask_lut_16 >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa8R8, kAlpha_8_SkColorType, vello_cpp::build_mask_lut_8 >, and skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa8, kRGBA_8888_SkColorType, vello_cpp::build_mask_lut_8 >.
Definition at line 72 of file ComputeStep.cpp.
|
virtual |
Definition at line 89 of file ComputeStep.cpp.
|
virtual |
Definition at line 83 of file ComputeStep.cpp.
|
virtual |
Reimplemented in skgpu::graphite::VelloFineStepBase< S, T >, skgpu::graphite::VelloFineStepBase< vello_cpp::ShaderStage::FineAreaR8, kAlpha_8_SkColorType >, and skgpu::graphite::VelloFineStepBase< vello_cpp::ShaderStage::FineArea, kRGBA_8888_SkColorType >.
Definition at line 77 of file ComputeStep.cpp.
|
virtual |
Definition at line 62 of file ComputeStep.cpp.
|
inline |
Definition at line 249 of file ComputeStep.h.
|
inline |
Definition at line 244 of file ComputeStep.h.
|
virtual |
Reimplemented in skgpu::graphite::VelloStep< S >.
Definition at line 67 of file ComputeStep.cpp.
|
virtual |
Reimplemented in skgpu::graphite::VelloFineMsaaStepBase< S, T, MaskLutBuilder >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa16R8, kAlpha_8_SkColorType, vello_cpp::build_mask_lut_16 >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa16, kRGBA_8888_SkColorType, vello_cpp::build_mask_lut_16 >, skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa8R8, kAlpha_8_SkColorType, vello_cpp::build_mask_lut_8 >, and skgpu::graphite::VelloFineMsaaStepBase< vello_cpp::ShaderStage::FineMsaa8, kRGBA_8888_SkColorType, vello_cpp::build_mask_lut_8 >.
Definition at line 53 of file ComputeStep.cpp.
|
virtual |
Definition at line 58 of file ComputeStep.cpp.
|
inline |
Definition at line 236 of file ComputeStep.h.
|
inline |
Definition at line 251 of file ComputeStep.h.
|
inline |
Definition at line 241 of file ComputeStep.h.
|
inline |
Definition at line 237 of file ComputeStep.h.