90DrawContext::DrawContext(
const Caps* caps,
96 , fSurfaceProps(props)
104 fReadView = {fTarget, swizzle};
117 fPendingClearColor = pmColor.
array();
131 if (fPendingDraws->renderStepCount() > 0) {
132 fPendingDraws = std::make_unique<DrawList>();
134 if (fComputePathAtlas) {
135 fComputePathAtlas->reset();
138 if (discard_op_should_use_clear(fImageInfo.
colorType())) {
142 fPendingClearColor = {0.f, 0.f, 0.f, 0.f};
157 fPendingDraws->recordDraw(renderer, localToDevice, geometry,
clip, ordering,
paint, stroke);
164 const std::vector<MipLevel>& levels,
166 std::unique_ptr<ConditionalUploadContext> condContext) {
168 SkASSERT(targetProxy->isFullyLazy() ||
170 return fPendingUploads->recordUpload(recorder,
171 std::move(targetProxy),
176 std::move(condContext));
180 if (!fComputePathAtlas) {
183 return fComputePathAtlas.get();
187 if (fPendingUploads->size() > 0) {
189 "# uploads", fPendingUploads->size());
192 SkASSERT(fPendingUploads->size() == 0);
200 if (fComputePathAtlas) {
201 auto dispatchGroup = fComputePathAtlas->recordDispatches(recorder);
202 fComputePathAtlas->reset();
206 SkASSERT(fPendingDraws->hasCoverageMaskDraws());
209 "# dispatches", dispatchGroup->dispatches().size());
216 if (fPendingDraws->renderStepCount() == 0 && fPendingLoadOp !=
LoadOp::kClear) {
229 std::move(fPendingDraws),
232 std::make_pair(fPendingLoadOp, fPendingStoreOp),
234 fPendingDraws = std::make_unique<DrawList>();
241 SkASSERT(fTarget.get() == pass->target());
244 auto [loadOp, storeOp] = pass->ops();
246 fTarget->textureInfo());
249 pass->depthStencilFlags(),
251 pass->requiresMSAA(),
266 this->
flush(recorder);
268 if (!fCurrentDrawTask->hasTasks()) {
272 sk_sp<Task> snappedTask = std::move(fCurrentDrawTask);
273 fCurrentDrawTask = sk_make_sp<DrawTask>(fTarget);
@ kUnknown_SkAlphaType
uninitialized
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
@ kR16G16_float_SkColorType
pixel with a half float for red and green
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static bool contains(const SkRect &r, SkPoint p)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
sk_sp< T > sk_make_sp(Args &&... args)
#define TRACE_EVENT_SCOPE_THREAD
SkAlphaType alphaType() const
std::unique_ptr< ComputePathAtlas > createComputePathAtlas(Recorder *recorder) const
skgpu::Swizzle getReadSwizzle(SkColorType, const TextureInfo &) const
bool isTexturable(const TextureInfo &) const
skgpu::Swizzle getWriteSwizzle(SkColorType, const TextureInfo &) const
virtual bool isRenderable(const TextureInfo &) const =0
static sk_sp< ComputeTask > Make(DispatchGroupList dispatchGroups)
const SkImageInfo & imageInfo() const
void recordDraw(const Renderer *renderer, const Transform &localToDevice, const Geometry &geometry, const Clip &clip, DrawOrder ordering, const PaintParams *paint, const StrokeStyle *stroke)
const SkColorInfo & colorInfo() const
static sk_sp< DrawContext > Make(const Caps *caps, sk_sp< TextureProxy > target, SkISize deviceSize, const SkColorInfo &, const SkSurfaceProps &)
PathAtlas * getComputePathAtlas(Recorder *)
void clear(const SkColor4f &clearColor)
sk_sp< Task > snapDrawTask(Recorder *)
bool recordUpload(Recorder *recorder, sk_sp< TextureProxy > targetProxy, const SkColorInfo &srcColorInfo, const SkColorInfo &dstColorInfo, const std::vector< MipLevel > &levels, const SkIRect &dstRect, std::unique_ptr< ConditionalUploadContext >)
static std::unique_ptr< DrawPass > Make(Recorder *, std::unique_ptr< DrawList >, sk_sp< TextureProxy > target, const SkImageInfo &targetInfo, std::pair< LoadOp, StoreOp >, std::array< float, 4 > clearColor)
AtlasProvider * atlasProvider()
const Caps * caps() const
static sk_sp< RenderPassTask > Make(DrawPassList, const RenderPassDesc &, sk_sp< TextureProxy > target)
SkISize dimensions() const
const TextureInfo & textureInfo() const
static sk_sp< UploadTask > Make(UploadList *)
T & emplace_back(Args &&... args)
static constexpr SkIRect MakeSize(const SkISize &size)
bool contains(int32_t x, int32_t y) const
constexpr int32_t width() const
constexpr int32_t height() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkColorType colorType() const
std::array< float, 4 > array() const
static RenderPassDesc Make(const Caps *caps, const TextureInfo &targetInfo, LoadOp loadOp, StoreOp storeOp, SkEnumBitMask< DepthStencilFlags > depthStencilFlags, const std::array< float, 4 > &clearColor, bool requiresMSAA, Swizzle writeSwizzle)
#define TRACE_EVENT_INSTANT1(category_group, name, arg1_name, arg1_val)