/* * Copyright 2021 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_DrawList_DEFINED #define skgpu_graphite_DrawList_DEFINED #include "include/core/SkPaint.h" #include "src/base/SkTBlockList.h" #include "src/gpu/graphite/DrawOrder.h" #include "src/gpu/graphite/DrawParams.h" #include "src/gpu/graphite/PaintParams.h" #include "src/gpu/graphite/geom/Geometry.h" #include "src/gpu/graphite/geom/Rect.h" #include "src/gpu/graphite/geom/Transform_graphite.h" #include <limits> #include <optional> namespace skgpu::graphite { class Renderer; /** * A DrawList represents a collection of drawing commands (and related clip/shading state) in * a form that closely mirrors what can be rendered efficiently and directly by the GPU backend * (while balancing how much pre-processing to do for draws that might get eliminated later due to * occlusion culling). * * A draw command combines: * - a shape * - a transform * - a primitive clip (not affected by the transform) * - optional shading description (shader, color filter, blend mode, etc) * - a draw ordering (compressed painters index, stencil set, and write/test depth) * * Commands are accumulated in an arbitrary order and then sorted by increasing sort z when the list * is prepared into an actual command buffer. The result of a draw command is the rasterization of * the transformed shape, restricted by its primitive clip (e.g. a scissor rect) and a depth test * of "GREATER" vs. its write/test z. (A test of GREATER, as opposed to GEQUAL, avoids double hits * for draws that may have overlapping geometry, e.g. stroking.) If the command has a shading * description, the color buffer will be modified; if not, it will be a depth-only draw. * * In addition to sorting the collected commands, the command list can be optimized during * preparation. Commands that are fully occluded by later operations can be skipped entirely without * affecting the final results. Adjacent commands (post sort) that would use equivalent GPU * pipelines are merged to produce fewer (but larger) operations on the GPU. * * Other than flush-time optimizations (sort, cull, and merge), the command list does what you tell * it to. Draw-specific simplification, style application, and advanced clipping should be handled * at a higher layer. */ class DrawList { … }; } // namespace skgpu::graphite #endif // skgpu_graphite_DrawList_DEFINED