91DrawContext::DrawContext(
const Caps* caps,
97 , fSurfaceProps(props)
105 fReadView = {fTarget, swizzle};
118 fPendingClearColor = pmColor.
array();
132 if (fPendingDraws->renderStepCount() > 0) {
133 fPendingDraws = std::make_unique<DrawList>();
135 if (fComputePathAtlas) {
136 fComputePathAtlas->reset();
139 if (discard_op_should_use_clear(fImageInfo.
colorType())) {
143 fPendingClearColor = {0.f, 0.f, 0.f, 0.f};
165 const std::vector<MipLevel>& levels,
167 std::unique_ptr<ConditionalUploadContext> condContext) {
169 SkASSERT(targetProxy->isFullyLazy() ||
171 return fPendingUploads->recordUpload(recorder,
172 std::move(targetProxy),
177 std::move(condContext));
185 fCurrentDrawTask->addTask(std::move(task));
189 if (!fComputePathAtlas) {
192 return fComputePathAtlas.get();
196 if (fPendingUploads->size() > 0) {
198 "# uploads", fPendingUploads->size());
201 SkASSERT(fPendingUploads->size() == 0);
209 if (fComputePathAtlas) {
211 if (fComputePathAtlas->recordDispatches(recorder, &dispatches)) {
213 SkASSERT(fPendingDraws->hasCoverageMaskDraws());
218 fComputePathAtlas->reset();
221 if (fPendingDraws->renderStepCount() == 0 && fPendingLoadOp !=
LoadOp::kClear) {
236 if (!fPendingDraws->dstCopyBounds().isEmptyNegativeOrNaN()) {
239 dstCopyPixelBounds = fPendingDraws->dstCopyBounds().makeRoundOut().asSkIRect();
250 dstCopyPixelBounds.
size(),
251 fTarget->textureInfo(),
256 std::move(fPendingDraws),
259 std::make_pair(fPendingLoadOp, fPendingStoreOp),
263 fPendingDraws = std::make_unique<DrawList>();
270 SkASSERT(fTarget.get() == pass->target());
275 fTarget, dstCopyPixelBounds, dstCopy, {0, 0}));
279 auto [loadOp, storeOp] = pass->ops();
281 fTarget->textureInfo());
284 pass->depthStencilFlags(),
286 pass->requiresMSAA(),
301 this->
flush(recorder);
303 if (!fCurrentDrawTask->hasTasks()) {
307 sk_sp<Task> snappedTask = std::move(fCurrentDrawTask);
308 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 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)
static sk_sp< CopyTextureToTextureTask > Make(sk_sp< TextureProxy > srcProxy, SkIRect srcRect, sk_sp< TextureProxy > dstProxy, SkIPoint dstPoint, int dstLevel=0)
void recordDependency(sk_sp< Task >)
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, sk_sp< TextureProxy > dstCopy, SkIPoint dstCopyOffset)
AtlasProvider * atlasProvider()
const Caps * caps() const
ResourceProvider * resourceProvider()
static sk_sp< RenderPassTask > Make(DrawPassList, const RenderPassDesc &, sk_sp< TextureProxy > target)
SkISize dimensions() const
static sk_sp< TextureProxy > Make(const Caps *, ResourceProvider *, SkISize dimensions, const TextureInfo &, std::string_view label, skgpu::Budgeted)
const TextureInfo & textureInfo() const
static sk_sp< UploadTask > Make(UploadList *)
T & emplace_back(Args &&... args)
constexpr bool contains(std::string_view str, std::string_view needle)
constexpr SkISize size() const
static constexpr SkIRect MakeSize(const SkISize &size)
static constexpr SkIRect MakeEmpty()
constexpr SkIPoint topLeft() const
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_INSTANT0(category_group, name)
#define TRACE_EVENT_INSTANT1(category_group, name, arg1_name, arg1_val)