#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkArc.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkDrawable.h"
#include "include/core/SkMesh.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathTypes.h"
#include "include/core/SkPoint3.h"
#include "include/core/SkRRect.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
#include "include/core/SkVertices.h"
#include "include/gpu/ganesh/GrBackendSemaphore.h"
#include "include/gpu/ganesh/GrBackendSurface.h"
#include "include/gpu/ganesh/GrDirectContext.h"
#include "include/gpu/ganesh/GrRecordingContext.h"
#include "include/private/base/SingleOwner.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "include/utils/SkShadowUtils.h"
#include "src/core/SkDevice.h"
#include "src/core/SkDrawProcs.h"
#include "src/core/SkDrawShadowInfo.h"
#include "src/core/SkLatticeIter.h"
#include "src/core/SkMeshPriv.h"
#include "src/core/SkPointPriv.h"
#include "src/core/SkRRectPriv.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/RefCntedCallback.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrAppliedClip.h"
#include "src/gpu/ganesh/GrAuditTrail.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrColor.h"
#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrColorSpaceXform.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrDrawingManager.h"
#include "src/gpu/ganesh/GrDstProxyView.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrProcessorSet.h"
#include "src/gpu/ganesh/GrProxyProvider.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrScissorState.h"
#include "src/gpu/ganesh/GrSemaphore.h"
#include "src/gpu/ganesh/GrStencilSettings.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/GrTextureResolveManager.h"
#include "src/gpu/ganesh/GrTracing.h"
#include "src/gpu/ganesh/GrUserStencilSettings.h"
#include "src/gpu/ganesh/GrXferProcessor.h"
#include "src/gpu/ganesh/PathRenderer.h"
#include "src/gpu/ganesh/PathRendererChain.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrDisableColorXP.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrQuad.h"
#include "src/gpu/ganesh/geometry/GrQuadUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/ops/ClearOp.h"
#include "src/gpu/ganesh/ops/DrawAtlasOp.h"
#include "src/gpu/ganesh/ops/DrawMeshOp.h"
#include "src/gpu/ganesh/ops/DrawableOp.h"
#include "src/gpu/ganesh/ops/FillRRectOp.h"
#include "src/gpu/ganesh/ops/FillRectOp.h"
#include "src/gpu/ganesh/ops/GrDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
#include "src/gpu/ganesh/ops/GrOvalOpFactory.h"
#include "src/gpu/ganesh/ops/LatticeOp.h"
#include "src/gpu/ganesh/ops/RegionOp.h"
#include "src/gpu/ganesh/ops/ShadowRRectOp.h"
#include "src/gpu/ganesh/ops/StrokeRectOp.h"
#include "src/gpu/ganesh/ops/TextureOp.h"
#include "src/text/gpu/SubRunContainer.h"
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
#include <algorithm>
#include <map>
#include <string>
struct GrShaderCaps;
#define ASSERT_OWNED_RESOURCE(R) …
#define ASSERT_SINGLE_OWNER …
#define RETURN_IF_ABANDONED …
#define RETURN_FALSE_IF_ABANDONED …
usingnamespaceskia_private;
namespace {
void op_bounds(SkRect* bounds, const GrOp* op) { … }
}
namespace skgpu::ganesh {
DoSimplify;
class AutoCheckFlush { … };
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(GrRecordingContext* rContext,
GrColorType colorType,
sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
GrSurfaceOrigin origin,
const SkSurfaceProps& surfaceProps) { … }
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(GrRecordingContext* rContext,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
SkISize dimensions,
const GrBackendFormat& format,
int sampleCnt,
skgpu::Mipmapped mipmapped,
GrProtected isProtected,
skgpu::Swizzle readSwizzle,
skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin origin,
skgpu::Budgeted budgeted,
const SkSurfaceProps& surfaceProps,
std::string_view label) { … }
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(GrRecordingContext* rContext,
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
SkISize dimensions,
const SkSurfaceProps& surfaceProps,
std::string_view label,
int sampleCnt,
skgpu::Mipmapped mipmapped,
GrProtected isProtected,
GrSurfaceOrigin origin,
skgpu::Budgeted budgeted) { … }
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
GrRecordingContext* rContext,
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
SkBackingFit fit,
SkISize dimensions,
const SkSurfaceProps& surfaceProps,
int sampleCnt,
skgpu::Mipmapped mipmapped,
GrProtected isProtected,
GrSurfaceOrigin origin,
skgpu::Budgeted budgeted) { … }
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeFromBackendTexture(
GrRecordingContext* rContext,
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
const GrBackendTexture& tex,
int sampleCnt,
GrSurfaceOrigin origin,
const SkSurfaceProps& surfaceProps,
sk_sp<skgpu::RefCntedCallback> releaseHelper) { … }
SurfaceDrawContext::SurfaceDrawContext(GrRecordingContext* rContext,
GrSurfaceProxyView readView,
GrSurfaceProxyView writeView,
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps& surfaceProps)
: … { … }
SurfaceDrawContext::~SurfaceDrawContext() { … }
void SurfaceDrawContext::willReplaceOpsTask(OpsTask* prevTask, OpsTask* nextTask) { … }
void SurfaceDrawContext::drawGlyphRunList(SkCanvas* canvas,
const GrClip* clip,
const SkMatrix& viewMatrix,
const sktext::GlyphRunList& glyphRunList,
SkStrikeDeviceInfo strikeDeviceInfo,
const SkPaint& paint) { … }
void SurfaceDrawContext::drawPaint(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix) { … }
enum class SurfaceDrawContext::QuadOptimization { … };
SurfaceDrawContext::QuadOptimization SurfaceDrawContext::attemptQuadOptimization(
const GrClip* clip,
const GrUserStencilSettings* stencilSettings,
DrawQuad* quad,
GrPaint* paint) { … }
void SurfaceDrawContext::drawFilledQuad(const GrClip* clip,
GrPaint&& paint,
DrawQuad* quad,
const GrUserStencilSettings* ss) { … }
void SurfaceDrawContext::drawTexture(const GrClip* clip,
GrSurfaceProxyView view,
SkAlphaType srcAlphaType,
GrSamplerState::Filter filter,
GrSamplerState::MipmapMode mm,
SkBlendMode blendMode,
const SkPMColor4f& color,
const SkRect& srcRect,
const SkRect& dstRect,
GrQuadAAFlags edgeAA,
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> colorSpaceXform) { … }
void SurfaceDrawContext::drawTexturedQuad(const GrClip* clip,
GrSurfaceProxyView proxyView,
SkAlphaType srcAlphaType,
sk_sp<GrColorSpaceXform> textureXform,
GrSamplerState::Filter filter,
GrSamplerState::MipmapMode mm,
const SkPMColor4f& color,
SkBlendMode blendMode,
DrawQuad* quad,
const SkRect* subset) { … }
void SurfaceDrawContext::drawRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRect& rect,
const GrStyle* style) { … }
void SurfaceDrawContext::fillRectToRect(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRect& rectToDraw,
const SkRect& localRect) { … }
void SurfaceDrawContext::drawQuadSet(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
const GrQuadSetEntry quads[],
int cnt) { … }
int SurfaceDrawContext::maxWindowRectangles() const { … }
OpsTask::CanDiscardPreviousOps SurfaceDrawContext::canDiscardPreviousOpsOnFullClear() const { … }
void SurfaceDrawContext::setNeedsStencil() { … }
void SurfaceDrawContext::internalStencilClear(const SkIRect* scissor, bool insideStencilMask) { … }
bool SurfaceDrawContext::stencilPath(const GrHardClip* clip,
GrAA doStencilMSAA,
const SkMatrix& viewMatrix,
const SkPath& path) { … }
void SurfaceDrawContext::drawTextureSet(const GrClip* clip,
GrTextureSetEntry set[],
int cnt,
int proxyRunCnt,
GrSamplerState::Filter filter,
GrSamplerState::MipmapMode mm,
SkBlendMode mode,
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> texXform) { … }
void SurfaceDrawContext::drawVertices(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
sk_sp<SkVertices> vertices,
GrPrimitiveType* overridePrimType,
bool skipColorXform) { … }
void SurfaceDrawContext::drawMesh(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
const SkMesh& mesh,
TArray<std::unique_ptr<GrFragmentProcessor>> children) { … }
void SurfaceDrawContext::drawAtlas(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
int spriteCount,
const SkRSXform xform[],
const SkRect texRect[],
const SkColor colors[]) { … }
void SurfaceDrawContext::drawRRect(const GrClip* origClip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRRect& rrect,
const GrStyle& style) { … }
bool SurfaceDrawContext::drawFastShadow(const GrClip* clip,
const SkMatrix& viewMatrix,
const SkPath& path,
const SkDrawShadowRec& rec) { … }
void SurfaceDrawContext::drawRegion(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRegion& region,
const GrStyle& style,
const GrUserStencilSettings* ss) { … }
void SurfaceDrawContext::drawOval(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRect& oval,
const GrStyle& style) { … }
void SurfaceDrawContext::drawArc(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkArc& arc,
const GrStyle& style) { … }
void SurfaceDrawContext::drawImageLattice(const GrClip* clip,
GrPaint&& paint,
const SkMatrix& viewMatrix,
GrSurfaceProxyView view,
SkAlphaType alphaType,
sk_sp<GrColorSpaceXform> csxf,
GrSamplerState::Filter filter,
std::unique_ptr<SkLatticeIter> iter,
const SkRect& dst) { … }
void SurfaceDrawContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
const SkRect& bounds) { … }
void SurfaceDrawContext::setLastClip(uint32_t clipStackGenID,
const SkIRect& devClipBounds,
int numClipAnalyticElements) { … }
bool SurfaceDrawContext::mustRenderClip(uint32_t clipStackGenID,
const SkIRect& devClipBounds,
int numClipAnalyticElements) { … }
bool SurfaceDrawContext::waitOnSemaphores(int numSemaphores,
const GrBackendSemaphore waitSemaphores[],
bool deleteSemaphoresAfterWait) { … }