49#if defined(GR_TEST_UTILS)
66 float dw = std::fabs(quad.
x(2) - quad.
x(0)) + std::fabs(quad.
y(2) - quad.
y(0));
67 float dh = std::fabs(quad.
x(1) - quad.
x(0)) + std::fabs(quad.
y(1) - quad.
y(0));
73struct NormalizationParams {
78NormalizationParams proxy_normalization_params(
const GrSurfaceProxy* proxy,
88 iw = 1.f / dimensions.
width();
89 ih = 1.f / dimensions.
height();
96 return {iw, ih, 0.0f};
105 const NormalizationParams&
params,
106 const SkRect* subsetRect) {
107 static constexpr SkRect kLargeRect = {-100000, -100000, 1000000, 1000000};
124 auto mid = (skvx::shuffle<2, 3, 0, 1>(ltrb) + ltrb)*0.5f;
125 ltrb =
skvx::min(ltrb*flipHi, mid*flipHi)*flipHi;
132 ltrb = skvx::shuffle<0, 3, 2, 1>(ltrb);
141void normalize_src_quad(
const NormalizationParams&
params,
155 int actualProxyRunCount = 0;
158 if (
set[
i].fProxyView.proxy() != lastProxy) {
159 actualProxyRunCount++;
160 lastProxy =
set[
i].fProxyView.proxy();
163 return actualProxyRunCount;
213 return GrOp::Make<TextureOpImpl>(context, std::move(proxyView), std::move(textureXform),
214 filter, mm,
color, saturate, aaType, quad, subset);
230 return GrOp::MakeWithExtraMemory<TextureOpImpl>(
231 context,
sizeof(ViewCountPair) * (proxyRunCnt - 1),
232 set, cnt, proxyRunCnt, filter, mm, saturate, aaType, constraint,
233 viewMatrix, std::move(textureColorSpaceXform));
236 ~TextureOpImpl()
override {
237 for (
unsigned p = 1;
p < fMetadata.fProxyCount; ++
p) {
238 fViewCountPairs[
p].~ViewCountPair();
242 const char*
name()
const override {
return "TextureOp"; }
246 for (
unsigned p = 0;
p < fMetadata.fProxyCount; ++
p) {
249 if (fDesc && fDesc->fProgramInfo) {
250 fDesc->fProgramInfo->visitFPProxies(func);
255 static void ValidateResourceLimits() {
259 using CountStorage =
decltype(Metadata::fTotalQuadCount);
262 int resourceLimit = SkTo<int>(maxQuadCount);
271 auto iter = fQuads.metadata();
279 fMetadata.fColorType =
static_cast<uint16_t
>(
colorType);
294 struct ColorSubsetAndAA {
297 , fSubsetRect(subsetRect)
298 , fAAFlags(static_cast<uint16_t>(aaFlags)) {
299 SkASSERT(fAAFlags ==
static_cast<uint16_t
>(aaFlags));
306 unsigned fAAFlags : 4;
311 struct ViewCountPair {
332 , fFilter(static_cast<uint16_t>(filter))
333 , fMipmapMode(static_cast<uint16_t>(mm))
336 , fSubset(static_cast<uint16_t>(subset))
337 , fSaturate(static_cast<uint16_t>(saturate)) {}
340 uint16_t fProxyCount;
342 uint16_t fTotalQuadCount;
345 uint16_t fFilter : 2;
346 uint16_t fMipmapMode : 2;
347 uint16_t fAAType : 2;
349 uint16_t fSubset : 1;
350 uint16_t fSaturate : 1;
351 uint16_t fUnused : 6;
361 Subset subset()
const {
return static_cast<Subset>(fSubset); }
368 static_assert(
sizeof(Metadata) == 8);
383 int fNumTotalQuads = 0;
386 char* fPrePreparedVertices =
nullptr;
395 size_t totalSizeInBytes()
const {
396 return this->totalNumVertices() * fVertexSpec.
vertexSize();
399 int totalNumVertices()
const {
404 fPrePreparedVertices = arena->
makeArrayDefault<
char>(this->totalSizeInBytes());
419 , fTextureColorSpaceXform(
std::move(textureColorSpaceXform))
421 , fMetadata(proxyView.swizzle(), filter, mm,
Subset(!!subsetRect), saturate) {
426 fMetadata.fAAType =
static_cast<uint16_t
>(aaType);
435 if (safe_to_ignore_subset_rect(aaType, filter, *quad, *subsetRect)) {
436 subsetRect =
nullptr;
437 fMetadata.fSubset =
static_cast<uint16_t
>(
Subset::kNo);
442 NormalizationParams
params = proxy_normalization_params(proxyView.
proxy(),
445 SkRect subset = normalize_and_inset_subset(filter,
params, subsetRect);
451 hairline ? IsHairline::kYes : IsHairline::kNo);
452 int quadCount = this->appendQuad(quad,
color, subset);
453 fViewCountPairs[0] = {proxyView.
detachProxy(), quadCount};
468 , fTextureColorSpaceXform(
std::move(textureColorSpaceXform))
470 , fMetadata(
set[0].fProxyView.swizzle(),
476 fMetadata.fProxyCount =
SkToUInt(proxyRunCnt);
477 fMetadata.fTotalQuadCount =
SkToUInt(cnt);
485 bool hasSubpixel =
false;
492 for (
int q = 0; q < cnt; ++q) {
494 (
set[0].fProxyView.proxy()->asTextureProxy()->mipmapped() ==
499 fViewCountPairs[0].fProxy =
set[0].fProxyView.detachProxy();
500 fViewCountPairs[0].fQuadCnt = 0;
501 curProxy = fViewCountPairs[0].fProxy.get();
502 }
else if (
set[q].fProxyView.proxy() != curProxy) {
505 new(&fViewCountPairs[++
p])ViewCountPair({
set[q].fProxyView.detachProxy(), 0});
507 curProxy = fViewCountPairs[
p].fProxy.get();
509 curProxy, fViewCountPairs[0].
fProxy.get()));
510 SkASSERT(fMetadata.fSwizzle ==
set[q].fProxyView.swizzle());
514 if (
set[q].fPreViewMatrix) {
521 if (
set[q].fDstClipQuad) {
535 if (netFilter != filter || netMM != mm) {
571 const SkRect* subsetForQuad =
nullptr;
576 if (!safe_to_ignore_subset_rect(aaForQuad, filterForQuad, quad, *subsetRect)) {
578 subsetForQuad = subsetRect;
584 NormalizationParams proxyParams = proxy_normalization_params(
585 curProxy,
set[q].fProxyView.origin());
586 normalize_src_quad(proxyParams, &quad.
fLocal);
590 SkRect subset = normalize_and_inset_subset(filter, proxyParams, subsetForQuad);
594 fViewCountPairs[
p].fQuadCnt += this->appendQuad(&quad,
set[q].fColor, subset);
598 SkASSERT((
p + 1) == fMetadata.fProxyCount);
599 SkASSERT(fQuads.count() == fMetadata.fTotalQuadCount);
601 fMetadata.fAAType =
static_cast<uint16_t
>(netAAType);
602 fMetadata.fFilter =
static_cast<uint16_t
>(netFilter);
603 fMetadata.fSubset =
static_cast<uint16_t
>(netSubset);
606 hasSubpixel ? IsHairline::kYes : IsHairline::kNo);
613 if (quadCount == 0) {
619 fQuads.append(quad->
fDevice, {color, subset, quad->fEdgeFlags}, &quad->
fLocal);
621 fQuads.append(extra.
fDevice, {color, subset, extra.fEdgeFlags}, &extra.
fLocal);
622 fMetadata.fTotalQuadCount++;
630 return (fDesc) ? fDesc->fProgramInfo :
nullptr;
636 bool usesMSAASurface,
647 fViewCountPairs[0].fProxy->backendFormat();
659 std::move(fTextureColorSpaceXform),
660 fMetadata.saturate());
666 caps, arena, writeView, usesMSAASurface, std::move(appliedClip), dstProxyView, gp,
684 fDesc = arena->
make<Desc>();
685 this->characterize(fDesc);
686 fDesc->allocatePrePreparedVertices(arena);
687 FillInVertices(*context->
priv().
caps(),
this, fDesc, fDesc->fPrePreparedVertices);
691 renderPassXferBarriers, colorLoadOp);
694 static void FillInVertices(
const GrCaps& caps,
695 TextureOpImpl* texOp,
705 desc->fVertexSpec, vertexData);
706 for (
const auto& op : ChainRange<TextureOpImpl>(texOp)) {
707 auto iter = op.fQuads.iterator();
708 for (
unsigned p = 0;
p < op.fMetadata.fProxyCount; ++
p) {
709 const int quadCnt = op.fViewCountPairs[
p].fQuadCnt;
710 SkDEBUGCODE(
int meshVertexCnt = quadCnt *
desc->fVertexSpec.verticesPerQuad());
712 for (
int i = 0;
i < quadCnt && iter.next(); ++
i) {
714 const ColorSubsetAndAA&
info = iter.metadata();
716 tessellator.append(iter.deviceQuad(), iter.localQuad(),
info.fColor,
720 SkASSERT((totVerticesSeen + meshVertexCnt) * vertexSize
721 == (
size_t)(tessellator.vertexMark() - startMark));
725 SkASSERT(totQuadsSeen *
desc->fVertexSpec.verticesPerQuad() == totVerticesSeen);
733 SkASSERT(
desc->totalSizeInBytes() == (
size_t)(tessellator.vertexMark() - startMark));
742 const TextureOpImpl* op) {
743 SkASSERT(op->fMetadata.fSwizzle == swizzle);
746 for (
unsigned p = 0;
p < op->fMetadata.fProxyCount; ++
p) {
748 quadCount += op->fViewCountPairs[
p].fQuadCnt;
750 SkASSERT(proxy->textureType() == textureType);
753 SkASSERT(aaType == op->fMetadata.aaType());
757 void validate()
const override {
759 auto textureType = fViewCountPairs[0].fProxy->asTextureProxy()->textureType();
760 GrAAType aaType = fMetadata.aaType();
763 int quadCount = validate_op(textureType, aaType, swizzle,
this);
765 for (
const GrOp* tmp = this->prevInChain(); tmp; tmp = tmp->
prevInChain()) {
766 quadCount += validate_op(textureType, aaType, swizzle,
767 static_cast<const TextureOpImpl*
>(tmp));
770 for (
const GrOp* tmp = this->nextInChain(); tmp; tmp = tmp->
nextInChain()) {
771 quadCount += validate_op(textureType, aaType, swizzle,
772 static_cast<const TextureOpImpl*
>(tmp));
775 SkASSERT(quadCount == this->numChainedQuads());
780#if defined(GR_TEST_UTILS)
781 int numQuads() const final {
return this->totNumQuads(); }
784 void characterize(Desc*
desc)
const {
791 GrAAType overallAAType = fMetadata.aaType();
793 desc->fNumProxies = 0;
794 desc->fNumTotalQuads = 0;
795 int maxQuadsPerMesh = 0;
797 for (
const auto& op : ChainRange<TextureOpImpl>(
this)) {
798 if (op.fQuads.deviceQuadType() > quadType) {
799 quadType = op.fQuads.deviceQuadType();
801 if (op.fQuads.localQuadType() > srcQuadType) {
802 srcQuadType = op.fQuads.localQuadType();
808 desc->fNumProxies += op.fMetadata.fProxyCount;
810 for (
unsigned p = 0;
p < op.fMetadata.fProxyCount; ++
p) {
811 maxQuadsPerMesh =
std::max(op.fViewCountPairs[
p].fQuadCnt, maxQuadsPerMesh);
813 desc->fNumTotalQuads += op.totNumQuads();
820 SkASSERT(
desc->fNumTotalQuads == this->numChainedQuads());
822 SkASSERT(!CombinedQuadCountWillOverflow(overallAAType,
false,
desc->fNumTotalQuads));
824 auto indexBufferOption =
828 subset, overallAAType,
true,
835 int totNumQuads()
const {
838 for (
unsigned p = 0;
p < fMetadata.fProxyCount; ++
p) {
839 tmp += fViewCountPairs[
p].fQuadCnt;
841 SkASSERT(tmp == fMetadata.fTotalQuadCount);
844 return fMetadata.fTotalQuadCount;
847 int numChainedQuads()
const {
848 int numChainedQuads = this->totNumQuads();
850 for (
const GrOp* tmp = this->prevInChain(); tmp; tmp = tmp->
prevInChain()) {
851 numChainedQuads += ((
const TextureOpImpl*)tmp)->totNumQuads();
854 for (
const GrOp* tmp = this->nextInChain(); tmp; tmp = tmp->
nextInChain()) {
855 numChainedQuads += ((
const TextureOpImpl*)tmp)->totNumQuads();
858 return numChainedQuads;
867 SkASSERT(!fDesc || fDesc->fPrePreparedVertices);
871 fDesc = arena->
make<Desc>();
872 this->characterize(fDesc);
873 SkASSERT(!fDesc->fPrePreparedVertices);
876 size_t vertexSize = fDesc->fVertexSpec.vertexSize();
878 void* vdata =
target->makeVertexSpace(vertexSize, fDesc->totalNumVertices(),
879 &fDesc->fVertexBuffer, &fDesc->fBaseVertex);
881 SkDebugf(
"Could not allocate vertices\n");
885 if (fDesc->fVertexSpec.needsIndexBuffer()) {
887 target, fDesc->fVertexSpec.indexBufferOption());
888 if (!fDesc->fIndexBuffer) {
889 SkDebugf(
"Could not allocate indices\n");
894 if (fDesc->fPrePreparedVertices) {
895 memcpy(vdata, fDesc->fPrePreparedVertices, fDesc->totalSizeInBytes());
897 FillInVertices(
target->caps(),
this, fDesc, (
char*) vdata);
902 if (!fDesc->fVertexBuffer) {
906 if (fDesc->fVertexSpec.needsIndexBuffer() && !fDesc->fIndexBuffer) {
910 if (!fDesc->fProgramInfo) {
911 this->createProgramInfo(flushState);
916 flushState->
bindBuffers(std::move(fDesc->fIndexBuffer),
nullptr,
917 std::move(fDesc->fVertexBuffer));
919 int totQuadsSeen = 0;
921 for (
const auto& op : ChainRange<TextureOpImpl>(
this)) {
922 for (
unsigned p = 0;
p < op.fMetadata.fProxyCount; ++
p) {
923 const int quadCnt = op.fViewCountPairs[
p].fQuadCnt;
924 SkASSERT(numDraws < fDesc->fNumProxies);
925 flushState->
bindTextures(fDesc->fProgramInfo->geomProc(),
926 *op.fViewCountPairs[
p].fProxy,
927 fDesc->fProgramInfo->pipeline());
933 fDesc->totalNumVertices(),
935 totQuadsSeen += quadCnt;
940 SkASSERT(totQuadsSeen == fDesc->fNumTotalQuads);
941 SkASSERT(numDraws == fDesc->fNumProxies);
944 void propagateCoverageAAThroughoutChain() {
948 auto tex =
static_cast<TextureOpImpl*
>(tmp);
955 auto tex =
static_cast<TextureOpImpl*
>(tmp);
964 auto that = t->
cast<TextureOpImpl>();
969 if (fDesc || that->fDesc) {
972 return CombineResult::kCannotCombine;
975 if (fMetadata.subset() != that->fMetadata.subset()) {
979 return CombineResult::kCannotCombine;
982 that->fTextureColorSpaceXform.get())) {
983 return CombineResult::kCannotCombine;
986 bool upgradeToCoverageAAOnMerge =
false;
987 if (fMetadata.aaType() != that->fMetadata.aaType()) {
988 if (!CanUpgradeAAOnMerge(fMetadata.aaType(), that->fMetadata.aaType())) {
989 return CombineResult::kCannotCombine;
991 upgradeToCoverageAAOnMerge =
true;
994 if (CombinedQuadCountWillOverflow(fMetadata.aaType(), upgradeToCoverageAAOnMerge,
995 this->numChainedQuads() + that->numChainedQuads())) {
996 return CombineResult::kCannotCombine;
999 if (fMetadata.saturate() != that->fMetadata.saturate()) {
1000 return CombineResult::kCannotCombine;
1002 if (fMetadata.filter() != that->fMetadata.filter()) {
1003 return CombineResult::kCannotCombine;
1005 if (fMetadata.mipmapMode() != that->fMetadata.mipmapMode()) {
1006 return CombineResult::kCannotCombine;
1008 if (fMetadata.fSwizzle != that->fMetadata.fSwizzle) {
1009 return CombineResult::kCannotCombine;
1011 const auto* thisProxy = fViewCountPairs[0].fProxy.get();
1012 const auto* thatProxy = that->fViewCountPairs[0].fProxy.get();
1013 if (fMetadata.fProxyCount > 1 || that->fMetadata.fProxyCount > 1 ||
1014 thisProxy != thatProxy) {
1018 fMetadata.aaType() == that->fMetadata.aaType()) {
1027 return CombineResult::kMayChain;
1029 return CombineResult::kCannotCombine;
1032 fMetadata.fSubset |= that->fMetadata.fSubset;
1033 fMetadata.fColorType =
std::max(fMetadata.fColorType, that->fMetadata.fColorType);
1036 fQuads.concat(that->fQuads);
1037 fViewCountPairs[0].fQuadCnt += that->fQuads.count();
1038 fMetadata.fTotalQuadCount += that->fQuads.count();
1040 if (upgradeToCoverageAAOnMerge) {
1049 this->propagateCoverageAAThroughoutChain();
1050 that->propagateCoverageAAThroughoutChain();
1055 return CombineResult::kMerged;
1058#if defined(GR_TEST_UTILS)
1059 SkString onDumpInfo()
const override {
1061 auto iter = fQuads.iterator();
1062 for (
unsigned p = 0;
p < fMetadata.fProxyCount; ++
p) {
1063 SkString proxyStr = fViewCountPairs[
p].fProxy->dump();
1065 str.
appendf(
", Filter: %d, MM: %d\n",
1066 static_cast<int>(fMetadata.fFilter),
1067 static_cast<int>(fMetadata.fMipmapMode));
1068 for (
int i = 0;
i < fViewCountPairs[
p].fQuadCnt && iter.next(); ++
i) {
1069 const GrQuad* quad = iter.deviceQuad();
1070 GrQuad uv = iter.isLocalValid() ? *(iter.localQuad()) :
GrQuad();
1071 const ColorSubsetAndAA&
info = iter.metadata();
1073 "%d: Color: 0x%08x, Subset(%d): [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n"
1074 " UVs [(%.2f, %.2f), (%.2f, %.2f), (%.2f, %.2f), (%.2f, %.2f)]\n"
1075 " Quad [(%.2f, %.2f), (%.2f, %.2f), (%.2f, %.2f), (%.2f, %.2f)]\n",
1076 i,
info.fColor.toBytes_RGBA(), fMetadata.fSubset,
info.fSubsetRect.fLeft,
1077 info.fSubsetRect.fTop,
info.fSubsetRect.fRight,
info.fSubsetRect.fBottom,
1099 ViewCountPair fViewCountPairs[1];
1108#if defined(GR_TEST_UTILS)
1109uint32_t TextureOp::ClassID() {
1110 return TextureOpImpl::ClassID();
1119 return {
true,
true};
1124 if (srcQuad.
asRect(&srcRect) && dstQuad.
asRect(&dstRect)) {
1133 return {filter, mm};
1136 SkSize srcSize = axis_aligned_quad_size(srcQuad);
1137 SkSize dstSize = axis_aligned_quad_size(dstQuad);
1142 bool filter = srcSize != dstSize || !
SkScalarIsInt(srcQuad.
x(0)) ||
1146 return {filter, mm};
1178 return TextureOpImpl::Make(context, std::move(proxyView), std::move(textureXform), filter,
1179 mm,
color, saturate, aaType, std::move(quad), subset);
1187 std::unique_ptr<GrFragmentProcessor>
fp;
1188 const auto& caps = *context->
priv().
caps();
1193 samplerState, *subset, localRect, caps);
1196 samplerState, *subset, caps);
1203 fp = GrBlendFragmentProcessor::Make<SkBlendMode::kModulate>(std::move(
fp),
nullptr);
1207 paint.setColorFragmentProcessor(std::move(
fp));
1227 , fContext(rContext)
1230 , fSaturate(saturate)
1231 , fConstraint(constraint)
1232 , fViewMatrix(viewMatrix)
1233 , fTextureColorSpaceXform(textureColorSpaceXform)
1234 , fNumLeft(numEntries) {}
1238 int clumpProxyCount = proxy_run_count(&
set[fNumClumped], clumpSize);
1249 fTextureColorSpaceXform);
1252 fNumLeft -= clumpSize;
1253 fNumClumped += clumpSize;
1271 int fNumClumped = 0;
1291 SkDEBUGCODE(TextureOpImpl::ValidateResourceLimits();)
1292 SkASSERT(proxy_run_count(
set, cnt) == proxyRunCnt);
1301 for (
int i = 0;
i < cnt; ++
i) {
1303 if (
set[
i].fPreViewMatrix) {
1309 if (
set[
i].fDstClipQuad) {
1321 ? &
set[
i].fSrcRect :
nullptr;
1323 auto op =
Make(context,
set[
i].fProxyView,
set[
i].fSrcAlphaType, textureColorSpaceXform,
1324 filter, mm,
set[
i].fColor, saturate, blendMode, aaType, &quad, subset);
1335 constraint, viewMatrix, std::move(textureColorSpaceXform));
1341 std::move(textureColorSpaceXform));
1346 while (
state.numLeft() > 0) {
1349 state.createOp(
set, clumpSize, aaType);
1357 while (
state.numLeft() > 0) {
1359 bool clumped =
false;
1361 for (
int i = 0;
i <
state.numLeft(); ++
i) {
1362 int absIndex =
state.baseIndex() +
i;
1405#if defined(GR_TEST_UTILS)
1406GR_DRAW_OP_TEST_DEFINE(TextureOpImpl) {
1408 dims.
fHeight = random->nextULessThan(90) + 10;
1409 dims.
fWidth = random->nextULessThan(90) + 10;
1434 srcRect.
fLeft = random->nextRangeScalar(0.f, proxy->
width() / 2.f);
1435 srcRect.
fRight = random->nextRangeScalar(0.f, proxy->
width()) + proxy->
width() / 2.f;
1436 srcRect.
fTop = random->nextRangeScalar(0.f, proxy->
height() / 2.f);
1438 SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
1448 auto texXform = GrTest::TestColorXform(random);
1450 if (random->nextBool()) {
1458 bool useSubset = random->nextBool();
1459 auto saturate = random->nextBool() ? TextureOp::Saturate::kYes
1460 : TextureOp::Saturate::kNo;
1462 std::move(proxy), origin,
1469 std::move(texXform), filter, mm,
color, saturate,
1471 useSubset ? &srcRect :
nullptr);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
skgpu::ganesh::QuadPerEdgeAA::VertexSpec VertexSpec
const TextureProxy * fProxy
#define DEFINE_OP_CLASS_ID
static void GrMapRectPoints(const SkRect &inRect, const SkRect &outRect, const SkPoint inPts[], SkPoint outPts[], int ptCount)
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
static const int kGrAATypeCount
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
@ kUnknown_SkAlphaType
uninitialized
@ kLastEnum_SkAlphaType
last valid value
@ kSrcOver
r = s + (1-sa)*d
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static GrColor SkColorToPremulGrColor(SkColor c)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define INHERITED(method,...)
static bool SkScalarIsInt(SkScalar x)
static SkScalar SkScalarFraction(SkScalar x)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr unsigned SkToUInt(S x)
sk_sp< const GrBuffer > fIndexBuffer
sk_sp< const GrBuffer > fVertexBuffer
const GrCaps * caps() const
bool reducedShaderMode() const
const GrShaderCaps * shaderCaps() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
bool dynamicStateArrayGeometryProcessorTextureSupport() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
virtual FixedFunctionFlags fixedFunctionFlags() const
virtual GrProcessorSet::Analysis finalize(const GrCaps &, const GrAppliedClip *, GrClampType)=0
static std::unique_ptr< GrFragmentProcessor > ClampOutput(std::unique_ptr< GrFragmentProcessor >)
size_t vertexStride() const
virtual GrProgramInfo * programInfo()=0
virtual void onPrePrepareDraws(GrRecordingContext *, const GrSurfaceProxyView &writeView, GrAppliedClip *, const GrDstProxyView &, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
virtual void onCreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&, const GrDstProxyView &, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)=0
void bindPipelineAndScissorClip(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void bindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart primitiveRestart=GrPrimitiveRestart::kNo)
const GrCaps & caps() const final
GrOpsRenderPass * opsRenderPass()
void bindTextures(const GrGeometryProcessor &geomProc, const GrSurfaceProxy &singleGeomProcTexture, const GrPipeline &pipeline)
GrOp * prevInChain() const
static Owner Make(GrRecordingContext *context, Args &&... args)
std::unique_ptr< GrOp > Owner
GrOp * nextInChain() const
virtual const char * name() const =0
virtual void visitProxies(const GrVisitProxyFunc &) const
void setBounds(const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
static constexpr Analysis EmptySetAnalysis()
static GrProcessorSet MakeEmptySet()
sk_sp< GrTextureProxy > createProxy(const GrBackendFormat &, SkISize dimensions, GrRenderable, int renderTargetSampleCnt, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted, GrProtected, std::string_view label, GrInternalSurfaceFlags=GrInternalSurfaceFlags::kNone, UseAllocator useAllocator=UseAllocator::kYes)
static GrQuad MakeFromRect(const SkRect &, const SkMatrix &)
skvx::Vec< 4, float > y4f() const
bool hasPerspective() const
bool asRect(SkRect *rect) const
static GrQuad MakeFromSkQuad(const SkPoint pts[4], const SkMatrix &)
skvx::Vec< 4, float > x4f() const
SkPoint point(int i) const
GrProxyProvider * proxyProvider()
SkArenaAlloc * recordTimeAllocator()
GrRecordingContextPriv priv()
static int MaxNumNonAAQuads()
static int MaxNumAAQuads()
static constexpr int kFilterCount
static GrProgramInfo * CreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrPipeline *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrGeometryProcessor *, GrPrimitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp, const GrUserStencilSettings *=&GrUserStencilSettings::kUnused)
sk_sp< GrSurfaceProxy > detachProxy()
GrSurfaceOrigin origin() const
GrSurfaceProxy * proxy() const
SkISize backingStoreDimensions() const
SkRect backingStoreBoundsRect() const
const GrBackendFormat & backendFormat() const
virtual GrTextureProxy * asTextureProxy()
static std::unique_ptr< GrFragmentProcessor > MakeSubset(GrSurfaceProxyView, SkAlphaType, const SkMatrix &, GrSamplerState, const SkRect &subset, const GrCaps &caps, const float border[4]=kDefaultBorder, bool alwaysUseShaderTileMode=false)
static constexpr float kLinearInset
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
static bool ProxiesAreCompatibleAsDynamicState(const GrSurfaceProxy *first, const GrSurfaceProxy *second)
static const GrXPFactory * FromBlendMode(SkBlendMode)
T * makeArrayDefault(size_t count)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
static const SkMatrix & I()
SkMatrix & preConcat(const SkMatrix &other)
static constexpr SkRect MakeLargestInverted()
void append(const char text[])
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
static GrOp::Owner Make(GrRecordingContext *, GrPaint &&, GrAAType, DrawQuad *, const GrUserStencilSettings *=nullptr, InputFlags=InputFlags::kNone)
void addDrawOp(const GrClip *, GrOp::Owner, const std::function< WillAddOpFn > &=std::function< WillAddOpFn >())
void createOp(GrTextureSetEntry set[], int clumpSize, GrAAType aaType)
BatchSizeLimiter(ganesh::SurfaceDrawContext *sdc, const GrClip *clip, GrRecordingContext *rContext, int numEntries, GrSamplerState::Filter filter, GrSamplerState::MipmapMode mm, Saturate saturate, SkCanvas::SrcRectConstraint constraint, const SkMatrix &viewMatrix, sk_sp< GrColorSpaceXform > textureColorSpaceXform)
static void AddTextureSetOps(skgpu::ganesh::SurfaceDrawContext *, const GrClip *, GrRecordingContext *, GrTextureSetEntry[], int cnt, int proxyRunCnt, GrSamplerState::Filter, GrSamplerState::MipmapMode, Saturate, SkBlendMode, GrAAType, SkCanvas::SrcRectConstraint, const SkMatrix &viewMatrix, sk_sp< GrColorSpaceXform > textureXform)
static GrOp::Owner Make(GrRecordingContext *, GrSurfaceProxyView, SkAlphaType srcAlphaType, sk_sp< GrColorSpaceXform >, GrSamplerState::Filter, GrSamplerState::MipmapMode, const SkPMColor4f &, Saturate, SkBlendMode, GrAAType, DrawQuad *, const SkRect *subset=nullptr)
const EmbeddedViewParams * params
uint32_t uint32_t * format
static float max(float r, float g, float b)
static float min(float r, float g, float b)
bool WillUseHairline(const GrQuad &quad, GrAAType aaType, GrQuadAAFlags edgeFlags)
void ResolveAAType(GrAAType requestedAAType, GrQuadAAFlags requestedEdgeFlags, const GrQuad &quad, GrAAType *outAAType, GrQuadAAFlags *outEdgeFlags)
int ClipToW0(DrawQuad *quad, DrawQuad *extraVertices)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
int QuadLimit(IndexBufferOption option)
skgpu::ganesh::TextureOp::Saturate Saturate
IndexBufferOption CalcIndexBufferOption(GrAAType aa, int numQuads)
GrGeometryProcessor * MakeTexturedProcessor(SkArenaAlloc *arena, const VertexSpec &spec, const GrShaderCaps &caps, const GrBackendFormat &backendFormat, GrSamplerState samplerState, const skgpu::Swizzle &swizzle, sk_sp< GrColorSpaceXform > textureColorSpaceXform, Saturate saturate)
ColorType MinColorType(SkPMColor4f color)
sk_sp< const GrBuffer > GetIndexBuffer(GrMeshDrawTarget *target, IndexBufferOption indexBufferOption)
void IssueDraw(const GrCaps &caps, GrOpsRenderPass *renderPass, const VertexSpec &spec, int runningQuadCount, int quadsInDraw, int maxVerts, int absVertBufferOffset)
static const int kColorTypeCount
std::tuple< bool, bool > FilterAndMipmapHaveNoEffect(const GrQuad &srcQuad, const GrQuad &dstQuad)
SIT T min(const Vec< 1, T > &x)
SIN Vec< N, float > floor(const Vec< N, float > &x)
constexpr int32_t width() const
constexpr int32_t height() const
static SkRGBA4f FromBytes_RGBA(uint32_t color)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkRect makeInset(float dx, float dy) const
SkScalar fRight
larger x-axis bounds
bool contains(SkScalar x, SkScalar y) const
constexpr float height() const
constexpr float width() const
SkScalar fTop
smaller y-axis bounds
size_t vertexSize() const
int verticesPerQuad() const
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)
SKVX_ALWAYS_INLINE void store(void *ptr) const
#define TRACE_EVENT0(category_group, name)