/* * Copyright 2023 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_graphite_compute_ComputeStep_DEFINED #define skgpu_graphite_compute_ComputeStep_DEFINED #include "include/core/SkColorType.h" #include "include/core/SkSize.h" #include "include/core/SkSpan.h" #include "include/private/base/SkTArray.h" #include "include/private/base/SkTo.h" #include "src/base/SkEnumBitMask.h" #include "src/gpu/graphite/ComputeTypes.h" #include <optional> #include <string> #include <string_view> #include <tuple> #include <vector> namespace skgpu::graphite { class UniformManager; /** * 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. */ class ComputeStep { … }; SK_MAKE_BITMASK_OPS(…) } // namespace skgpu::graphite #endif // skgpu_graphite_compute_ComputeStep_DEFINED