Label intermediate texture.

Label temprory offscreen textures for draws. In this CL, we will
label texture for a part of blur from SkGpuBlurUtils..

Bug: chromium:1164111
Change-Id: Ibfe1c16efa57b6a134a763bc918411108e286704
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549057
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Aditya Kushwah 2022-06-10 12:37:39 -07:00 committed by SkCQ
parent 03086320be
commit a080f9d6e9
24 changed files with 298 additions and 177 deletions

View File

@ -311,7 +311,8 @@ public:
for (int i = 0; i < loops; ++i) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(context, GrColorType::kRGBA_8888, p3,
SkBackingFit::kApprox, {100, 100},
SkSurfaceProps());
SkSurfaceProps(),
/*label=*/"DrawVertexColorSpaceBench");
SkASSERT(sdc);
for (int j = 0; j < kDrawsPerLoop; ++j) {

View File

@ -275,7 +275,7 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
GrColorType sdcColorType = sdc->colorInfo().colorType();
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(),
1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin,
/*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin,
SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0));
@ -298,7 +298,7 @@ DrawResult ClockwiseGM::onDraw(GrRecordingContext* rContext, SkCanvas* canvas, S
// Draw the test to an off-screen, bottom-up render target.
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(),
1, GrMipmapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin,
/*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin,
SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0));

View File

@ -26,8 +26,8 @@
using Direction = GrGaussianConvolutionFragmentProcessor::Direction;
static void fill_in_2D_gaussian_kernel(float* kernel, int width, int height,
SkScalar sigmaX, SkScalar sigmaY) {
static void fill_in_2D_gaussian_kernel(
float* kernel, int width, int height, SkScalar sigmaX, SkScalar sigmaY) {
const float twoSigmaSqrdX = 2.0f * SkScalarToFloat(SkScalarSquare(sigmaX));
const float twoSigmaSqrdY = 2.0f * SkScalarToFloat(SkScalarSquare(sigmaY));
@ -114,9 +114,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
!SkGpuBlurUtils::IsEffectivelyZeroSigma(sigmaY));
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
rContext, srcColorType, std::move(finalCS), dstFit, dstBounds.size(), SkSurfaceProps(),
1, GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
auto sdc =
skgpu::v1::SurfaceDrawContext::Make(rContext,
srcColorType,
std::move(finalCS),
dstFit,
dstBounds.size(),
SkSurfaceProps(),
/*label=*/"SurfaceDrawContext_ConvolveGaussian2d",
1,
GrMipmapped::kNo,
srcView.proxy()->isProtected(),
srcView.origin());
if (!sdc) {
return nullptr;
}
@ -132,8 +141,16 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
SkASSERT(size.area() <= GrMatrixConvolutionEffect::kMaxUniformSize);
float kernel[GrMatrixConvolutionEffect::kMaxUniformSize];
fill_in_2D_gaussian_kernel(kernel, size.width(), size.height(), sigmaX, sigmaY);
auto conv = GrMatrixConvolutionEffect::Make(rContext, std::move(srcView), srcBounds,
size, kernel, 1.0f, 0.0f, kernelOffset, wm, true,
auto conv = GrMatrixConvolutionEffect::Make(rContext,
std::move(srcView),
srcBounds,
size,
kernel,
1.0f,
0.0f,
kernelOffset,
wm,
true,
*sdc->caps());
paint.setColorFragmentProcessor(std::move(conv));
@ -142,8 +159,12 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian_2d(
// 'dstBounds' is actually in 'srcView' proxy space. It represents the blurred area from src
// space that we want to capture in the new RTC at {0, 0}. Hence, we use its size as the rect to
// draw and it directly as the local rect.
sdc->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstBounds.size()), SkRect::Make(dstBounds));
sdc->fillRectToRect(nullptr,
std::move(paint),
GrAA::kNo,
SkMatrix::I(),
SkRect::Make(dstBounds.size()),
SkRect::Make(dstBounds));
return sdc;
}
@ -169,9 +190,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
//
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, srcColorType, std::move(finalCS), fit, dstBounds.size(), SkSurfaceProps(), 1,
GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
auto dstSDC =
skgpu::v1::SurfaceDrawContext::Make(rContext,
srcColorType,
std::move(finalCS),
fit,
dstBounds.size(),
SkSurfaceProps(),
/*label=*/"SurfaceDrawContext_ConvolveGaussian",
1,
GrMipmapped::kNo,
srcView.proxy()->isProtected(),
srcView.origin());
if (!dstSDC) {
return nullptr;
}
@ -184,13 +214,21 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
bool canSplit = mode == SkTileMode::kDecal || mode == SkTileMode::kClamp;
// ...but it's not worth doing the splitting if we'll get HW tiling instead of shader tiling.
bool canHWTile =
srcBounds.contains(srcBackingBounds) &&
!rContext->priv().caps()->reducedShaderMode() && // this mode always uses shader tiling
srcBounds.contains(srcBackingBounds) &&
!rContext->priv().caps()->reducedShaderMode() && // this mode always uses shader tiling
!(mode == SkTileMode::kDecal && !rContext->priv().caps()->clampToBorderSupport());
if (!canSplit || canHWTile) {
auto dstRect = SkIRect::MakeSize(dstBounds.size());
convolve_gaussian_1d(dstSDC.get(), std::move(srcView), srcBounds,
rtcToSrcOffset, dstRect, srcAlphaType, direction, radius, sigma, mode);
convolve_gaussian_1d(dstSDC.get(),
std::move(srcView),
srcBounds,
rtcToSrcOffset,
dstRect,
srcAlphaType,
direction,
radius,
sigma,
mode);
return dstSDC;
}
@ -206,12 +244,12 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// Direction::kY.
SkIRect top, bottom;
if (Direction::kX == direction) {
top = {dstBounds.left(), dstBounds.top() , dstBounds.right(), srcBounds.top() };
top = {dstBounds.left(), dstBounds.top(), dstBounds.right(), srcBounds.top()};
bottom = {dstBounds.left(), srcBounds.bottom(), dstBounds.right(), dstBounds.bottom()};
// Inset for sub-rect of 'srcBounds' where the x-dir kernel doesn't reach the edges, clipped
// vertically to dstBounds.
int midA = std::max(srcBounds.top() , dstBounds.top() );
int midA = std::max(srcBounds.top(), dstBounds.top());
int midB = std::min(srcBounds.bottom(), dstBounds.bottom());
mid = {srcBounds.left() + radius, midA, srcBounds.right() - radius, midB};
if (mid.isEmpty()) {
@ -219,32 +257,40 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// width of dst and we will not draw mid or right.
left = {dstBounds.left(), mid.top(), dstBounds.right(), mid.bottom()};
} else {
left = {dstBounds.left(), mid.top(), mid.left() , mid.bottom()};
right = {mid.right(), mid.top(), dstBounds.right(), mid.bottom()};
left = {dstBounds.left(), mid.top(), mid.left(), mid.bottom()};
right = {mid.right(), mid.top(), dstBounds.right(), mid.bottom()};
}
} else {
// This is the same as the x direction code if you turn your head 90 degrees CCW. Swap x and
// y and swap top/bottom with left/right.
top = {dstBounds.left(), dstBounds.top(), srcBounds.left() , dstBounds.bottom()};
top = {dstBounds.left(), dstBounds.top(), srcBounds.left(), dstBounds.bottom()};
bottom = {srcBounds.right(), dstBounds.top(), dstBounds.right(), dstBounds.bottom()};
int midA = std::max(srcBounds.left() , dstBounds.left() );
int midA = std::max(srcBounds.left(), dstBounds.left());
int midB = std::min(srcBounds.right(), dstBounds.right());
mid = {midA, srcBounds.top() + radius, midB, srcBounds.bottom() - radius};
if (mid.isEmpty()) {
left = {mid.left(), dstBounds.top(), mid.right(), dstBounds.bottom()};
} else {
left = {mid.left(), dstBounds.top(), mid.right(), mid.top() };
right = {mid.left(), mid.bottom() , mid.right(), dstBounds.bottom()};
left = {mid.left(), dstBounds.top(), mid.right(), mid.top()};
right = {mid.left(), mid.bottom(), mid.right(), dstBounds.bottom()};
}
}
auto convolve = [&](SkIRect rect) {
// Transform rect into the render target's coord system.
rect.offset(-rtcToSrcOffset);
convolve_gaussian_1d(dstSDC.get(), srcView, srcBounds, rtcToSrcOffset, rect,
srcAlphaType, direction, radius, sigma, mode);
convolve_gaussian_1d(dstSDC.get(),
srcView,
srcBounds,
rtcToSrcOffset,
rect,
srcAlphaType,
direction,
radius,
sigma,
mode);
};
auto clear = [&](SkIRect rect) {
// Transform rect into the render target's coord system.
@ -258,7 +304,7 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> convolve_gaussian(
// very arbitrary right now. It is believed that a 21x44 mid on a Moto G4 is a significant
// regression compared to doing one draw but it has not been locally evaluated or tuned.
// The optimal cutoff is likely to vary by GPU.
if (!mid.isEmpty() && mid.width()*mid.height() < 256*256) {
if (!mid.isEmpty() && mid.width() * mid.height() < 256 * 256) {
left.join(mid);
left.join(right);
mid = SkIRect::MakeEmpty();
@ -316,26 +362,38 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> reexpand(
GrColorType srcColorType = src->colorInfo().colorType();
SkAlphaType srcAlphaType = src->colorInfo().alphaType();
src.reset(); // no longer needed
src.reset(); // no longer needed
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, srcColorType, std::move(colorSpace), fit, dstSize, SkSurfaceProps(), 1,
GrMipmapped::kNo, srcView.proxy()->isProtected(), srcView.origin());
auto dstSDC = skgpu::v1::SurfaceDrawContext::Make(rContext,
srcColorType,
std::move(colorSpace),
fit,
dstSize,
SkSurfaceProps(),
/*label=*/"SurfaceDrawContext_Reexpand",
1,
GrMipmapped::kNo,
srcView.proxy()->isProtected(),
srcView.origin());
if (!dstSDC) {
return nullptr;
}
GrPaint paint;
auto fp = GrTextureEffect::MakeSubset(std::move(srcView), srcAlphaType, SkMatrix::I(),
GrSamplerState::Filter::kLinear, srcBounds, srcBounds,
auto fp = GrTextureEffect::MakeSubset(std::move(srcView),
srcAlphaType,
SkMatrix::I(),
GrSamplerState::Filter::kLinear,
srcBounds,
srcBounds,
*rContext->priv().caps());
paint.setColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
dstSDC->fillRectToRect(nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(dstSize), srcBounds);
dstSDC->fillRectToRect(
nullptr, std::move(paint), GrAA::kNo, SkMatrix::I(), SkRect::Make(dstSize), srcBounds);
return dstSDC;
}
@ -375,15 +433,15 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
float floatH = srcH;
// First row above the dst rect where we should restart the tile mode.
int n = sk_float_floor2int_no_saturate((xPassDstBounds.top() - srcTop)/floatH);
int topClip = srcTop + n*srcH;
int n = sk_float_floor2int_no_saturate((xPassDstBounds.top() - srcTop) / floatH);
int topClip = srcTop + n * srcH;
// First row above below the dst rect where we should restart the tile mode.
n = sk_float_ceil2int_no_saturate(
(xPassDstBounds.bottom() - srcBounds.bottom())/floatH);
int bottomClip = srcBounds.bottom() + n*srcH;
n = sk_float_ceil2int_no_saturate((xPassDstBounds.bottom() - srcBounds.bottom()) /
floatH);
int bottomClip = srcBounds.bottom() + n * srcH;
xPassDstBounds.fTop = std::max(xPassDstBounds.top(), topClip);
xPassDstBounds.fTop = std::max(xPassDstBounds.top(), topClip);
xPassDstBounds.fBottom = std::min(xPassDstBounds.bottom(), bottomClip);
} else {
if (xPassDstBounds.fBottom <= srcBounds.top()) {
@ -399,15 +457,15 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
xPassDstBounds.fBottom = srcBounds.bottom();
xPassDstBounds.fTop = xPassDstBounds.fBottom - 1;
} else {
xPassDstBounds.fTop = std::max(xPassDstBounds.fTop, srcBounds.top());
xPassDstBounds.fTop = std::max(xPassDstBounds.fTop, srcBounds.top());
xPassDstBounds.fBottom = std::min(xPassDstBounds.fBottom, srcBounds.bottom());
}
int leftSrcEdge = srcBounds.fLeft - radiusX ;
int leftSrcEdge = srcBounds.fLeft - radiusX;
int rightSrcEdge = srcBounds.fRight + radiusX;
if (mode == SkTileMode::kClamp) {
// In clamp the column just outside the src bounds has the same value as the
// column just inside, unlike decal.
leftSrcEdge += 1;
leftSrcEdge += 1;
rightSrcEdge -= 1;
}
if (xPassDstBounds.fRight <= leftSrcEdge) {
@ -428,9 +486,18 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
}
}
}
dstSDC = convolve_gaussian(
rContext, std::move(srcView), srcColorType, srcAlphaType, srcBounds, xPassDstBounds,
Direction::kX, radiusX, sigmaX, mode, colorSpace, xFit);
dstSDC = convolve_gaussian(rContext,
std::move(srcView),
srcColorType,
srcAlphaType,
srcBounds,
xPassDstBounds,
Direction::kX,
radiusX,
sigmaX,
mode,
colorSpace,
xFit);
if (!dstSDC) {
return nullptr;
}
@ -444,10 +511,20 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> two_pass_gaussian(
return dstSDC;
}
return convolve_gaussian(rContext, std::move(srcView), srcColorType, srcAlphaType, srcBounds,
dstBounds, Direction::kY, radiusY, sigmaY, mode, colorSpace, fit);
return convolve_gaussian(rContext,
std::move(srcView),
srcColorType,
srcAlphaType,
srcBounds,
dstBounds,
Direction::kY,
radiusY,
sigmaY,
mode,
colorSpace,
fit);
}
#endif // SK_GPU_V1
#endif // SK_GPU_V1
namespace SkGpuBlurUtils {
@ -522,16 +599,18 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
if (!radiusX && !radiusY) {
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto result = skgpu::v1::SurfaceDrawContext::Make(rContext,
srcColorType,
std::move(colorSpace),
fit,
dstBounds.size(),
SkSurfaceProps(),
1,
GrMipmapped::kNo,
srcView.proxy()->isProtected(),
srcView.origin());
auto result =
skgpu::v1::SurfaceDrawContext::Make(rContext,
srcColorType,
std::move(colorSpace),
fit,
dstBounds.size(),
SkSurfaceProps(),
/*label=*/"SurfaceDrawContext_GaussianBlur",
1,
GrMipmapped::kNo,
srcView.proxy()->isProtected(),
srcView.origin());
if (!result) {
return nullptr;
}
@ -557,31 +636,50 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
kernelSize <= GrMatrixConvolutionEffect::kMaxUniformSize &&
!rContext->priv().caps()->reducedShaderMode()) {
// Apply the proxy offset to src bounds and offset directly
return convolve_gaussian_2d(rContext, std::move(srcView), srcColorType, srcBounds,
dstBounds, radiusX, radiusY, sigmaX, sigmaY, mode,
std::move(colorSpace), fit);
return convolve_gaussian_2d(rContext,
std::move(srcView),
srcColorType,
srcBounds,
dstBounds,
radiusX,
radiusY,
sigmaX,
sigmaY,
mode,
std::move(colorSpace),
fit);
}
// This will automatically degenerate into a single pass of X or Y if only one of the
// radii are non-zero.
return two_pass_gaussian(rContext, std::move(srcView), srcColorType, srcAlphaType,
std::move(colorSpace), srcBounds, dstBounds, sigmaX, sigmaY,
radiusX, radiusY, mode, fit);
return two_pass_gaussian(rContext,
std::move(srcView),
srcColorType,
srcAlphaType,
std::move(colorSpace),
srcBounds,
dstBounds,
sigmaX,
sigmaY,
radiusX,
radiusY,
mode,
fit);
}
GrColorInfo colorInfo(srcColorType, srcAlphaType, colorSpace);
auto srcCtx = rContext->priv().makeSC(srcView, colorInfo);
SkASSERT(srcCtx);
float scaleX = sigmaX > kMaxSigma ? kMaxSigma/sigmaX : 1.f;
float scaleY = sigmaY > kMaxSigma ? kMaxSigma/sigmaY : 1.f;
float scaleX = sigmaX > kMaxSigma ? kMaxSigma / sigmaX : 1.f;
float scaleY = sigmaY > kMaxSigma ? kMaxSigma / sigmaY : 1.f;
// We round down here so that when we recalculate sigmas we know they will be below
// kMaxSigma (but clamp to 1 do we don't have an empty texture).
SkISize rescaledSize = {std::max(sk_float_floor2int(srcBounds.width() *scaleX), 1),
std::max(sk_float_floor2int(srcBounds.height()*scaleY), 1)};
SkISize rescaledSize = {std::max(sk_float_floor2int(srcBounds.width() * scaleX), 1),
std::max(sk_float_floor2int(srcBounds.height() * scaleY), 1)};
// Compute the sigmas using the actual scale factors used once we integerized the
// rescaledSize.
scaleX = static_cast<float>(rescaledSize.width()) /srcBounds.width();
scaleY = static_cast<float>(rescaledSize.height())/srcBounds.height();
scaleX = static_cast<float>(rescaledSize.width()) / srcBounds.width();
scaleY = static_cast<float>(rescaledSize.height()) / srcBounds.height();
sigmaX *= scaleX;
sigmaY *= scaleY;
@ -602,10 +700,10 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// that is greater than kMaxSigma. By using a pad and making the src 3 wide/tall instead of
// 1 we can recurse again and do another downscale. Since mirror and repeat modes are trivial
// for a single col/row we only add padding based on sigma exceeding kMaxSigma for decal.
int padX = mode == SkTileMode::kClamp ||
(mode == SkTileMode::kDecal && sigmaX > kMaxSigma) ? 1 : 0;
int padY = mode == SkTileMode::kClamp ||
(mode == SkTileMode::kDecal && sigmaY > kMaxSigma) ? 1 : 0;
int padX = mode == SkTileMode::kClamp || (mode == SkTileMode::kDecal && sigmaX > kMaxSigma) ? 1
: 0;
int padY = mode == SkTileMode::kClamp || (mode == SkTileMode::kDecal && sigmaY > kMaxSigma) ? 1
: 0;
// Create the sdc with default SkSurfaceProps. Gaussian blurs will soon use a
// SurfaceFillContext, at which point the SkSurfaceProps won't exist anymore.
auto rescaledSDC = skgpu::v1::SurfaceDrawContext::Make(
@ -613,8 +711,9 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
colorInfo.colorType(),
colorInfo.refColorSpace(),
SkBackingFit::kApprox,
{rescaledSize.width() + 2*padX, rescaledSize.height() + 2*padY},
{rescaledSize.width() + 2 * padX, rescaledSize.height() + 2 * padY},
SkSurfaceProps(),
/*label=*/"RescaledSurfaceDrawContext",
1,
GrMipmapped::kNo,
srcCtx->asSurfaceProxy()->isProtected(),
@ -666,26 +765,19 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// Downscale the edges from the original source. These draws should batch together (and with
// the above interior rescaling when it is a single pass).
cheapDownscale(SkIRect::MakeXYWH( 0, 1, 1, dh),
SkIRect::MakeXYWH( sLCol, sy, 1, sh));
cheapDownscale(SkIRect::MakeXYWH( 1, 0, dw, 1),
SkIRect::MakeXYWH( sx, sTRow, sw, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1, 1, 1, dh),
SkIRect::MakeXYWH( sRCol, sy, 1, sh));
cheapDownscale(SkIRect::MakeXYWH( 1, dh + 1, dw, 1),
SkIRect::MakeXYWH( sx, sBRow, sw, 1));
cheapDownscale(SkIRect::MakeXYWH(0, 1, 1, dh), SkIRect::MakeXYWH(sLCol, sy, 1, sh));
cheapDownscale(SkIRect::MakeXYWH(1, 0, dw, 1), SkIRect::MakeXYWH(sx, sTRow, sw, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1, 1, 1, dh), SkIRect::MakeXYWH(sRCol, sy, 1, sh));
cheapDownscale(SkIRect::MakeXYWH(1, dh + 1, dw, 1), SkIRect::MakeXYWH(sx, sBRow, sw, 1));
// Copy the corners from the original source. These would batch with the edges except that
// at time of writing we recognize these can use kNearest and downgrade the filter. So they
// batch with each other but not the edge draws.
cheapDownscale(SkIRect::MakeXYWH( 0, 0, 1, 1),
SkIRect::MakeXYWH(sLCol, sTRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1, 0, 1, 1),
SkIRect::MakeXYWH(sRCol, sTRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1,dh + 1, 1, 1),
SkIRect::MakeXYWH(sRCol, sBRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH( 0, dh + 1, 1, 1),
SkIRect::MakeXYWH(sLCol, sBRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(0, 0, 1, 1), SkIRect::MakeXYWH(sLCol, sTRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1, 0, 1, 1), SkIRect::MakeXYWH(sRCol, sTRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(dw + 1, dh + 1, 1, 1),
SkIRect::MakeXYWH(sRCol, sBRow, 1, 1));
cheapDownscale(SkIRect::MakeXYWH(0, dh + 1, 1, 1), SkIRect::MakeXYWH(sLCol, sBRow, 1, 1));
}
srcView = rescaledSDC->readSurfaceView();
// Drop the contexts so we don't hold the proxies longer than necessary.
@ -696,9 +788,9 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// left since we trimmed off everything above and to the left of the original src bounds during
// the rescale.
SkRect scaledDstBounds = SkRect::Make(dstBounds.makeOffset(-srcBounds.topLeft()));
scaledDstBounds.fLeft *= scaleX;
scaledDstBounds.fTop *= scaleY;
scaledDstBounds.fRight *= scaleX;
scaledDstBounds.fLeft *= scaleX;
scaledDstBounds.fTop *= scaleY;
scaledDstBounds.fRight *= scaleX;
scaledDstBounds.fBottom *= scaleY;
// Account for padding in our rescaled src, if any.
scaledDstBounds.offset(padX, padY);
@ -723,20 +815,26 @@ std::unique_ptr<skgpu::v1::SurfaceDrawContext> GaussianBlur(GrRecordingContext*
// We rounded out the integer scaled dst bounds. Select the fractional dst bounds from the
// integer dimension blurred result when we scale back up.
scaledDstBounds.offset(-scaledDstBoundsI.left(), -scaledDstBoundsI.top());
return reexpand(rContext, std::move(sdc), scaledDstBounds, dstBounds.size(),
std::move(colorSpace), fit);
return reexpand(rContext,
std::move(sdc),
scaledDstBounds,
dstBounds.size(),
std::move(colorSpace),
fit);
}
#endif // SK_GPU_V1
#endif // SK_GPU_V1
bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
SkScalar sigma, SkScalar xformedSigma,
bool ComputeBlurredRRectParams(const SkRRect& srcRRect,
const SkRRect& devRRect,
SkScalar sigma,
SkScalar xformedSigma,
SkRRect* rrectToDraw,
SkISize* widthHeight,
SkScalar rectXs[kBlurRRectMaxDivisions],
SkScalar rectYs[kBlurRRectMaxDivisions],
SkScalar texXs[kBlurRRectMaxDivisions],
SkScalar texYs[kBlurRRectMaxDivisions]) {
unsigned int devBlurRadius = 3*SkScalarCeilToInt(xformedSigma-1/6.0f);
unsigned int devBlurRadius = 3 * SkScalarCeilToInt(xformedSigma - 1 / 6.0f);
SkScalar srcBlurRadius = 3.0f * sigma;
const SkRect& devOrig = devRRect.getBounds();
@ -745,14 +843,14 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
const SkVector& devRadiiLR = devRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& devRadiiLL = devRRect.radii(SkRRect::kLowerLeft_Corner);
const int devLeft = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
const int devTop = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
const int devLeft = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
const int devTop = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
const int devRight = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUR.fX, devRadiiLR.fX));
const int devBot = SkScalarCeilToInt(std::max<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
const int devBot = SkScalarCeilToInt(std::max<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
// This is a conservative check for nine-patchability
if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight - devBlurRadius ||
devOrig.fTop + devTop + devBlurRadius >= devOrig.fBottom - devBot - devBlurRadius) {
if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight - devBlurRadius ||
devOrig.fTop + devTop + devBlurRadius >= devOrig.fBottom - devBot - devBlurRadius) {
return false;
}
@ -761,36 +859,36 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
const SkVector& srcRadiiLR = srcRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& srcRadiiLL = srcRRect.radii(SkRRect::kLowerLeft_Corner);
const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
const SkScalar srcRight = std::max<SkScalar>(srcRadiiUR.fX, srcRadiiLR.fX);
const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
int newRRWidth = 2*devBlurRadius + devLeft + devRight + 1;
int newRRHeight = 2*devBlurRadius + devTop + devBot + 1;
int newRRWidth = 2 * devBlurRadius + devLeft + devRight + 1;
int newRRHeight = 2 * devBlurRadius + devTop + devBot + 1;
widthHeight->fWidth = newRRWidth + 2 * devBlurRadius;
widthHeight->fHeight = newRRHeight + 2 * devBlurRadius;
const SkRect srcProxyRect = srcRRect.getBounds().makeOutset(srcBlurRadius, srcBlurRadius);
rectXs[0] = srcProxyRect.fLeft;
rectXs[1] = srcProxyRect.fLeft + 2*srcBlurRadius + srcLeft;
rectXs[2] = srcProxyRect.fRight - 2*srcBlurRadius - srcRight;
rectXs[1] = srcProxyRect.fLeft + 2 * srcBlurRadius + srcLeft;
rectXs[2] = srcProxyRect.fRight - 2 * srcBlurRadius - srcRight;
rectXs[3] = srcProxyRect.fRight;
rectYs[0] = srcProxyRect.fTop;
rectYs[1] = srcProxyRect.fTop + 2*srcBlurRadius + srcTop;
rectYs[2] = srcProxyRect.fBottom - 2*srcBlurRadius - srcBot;
rectYs[1] = srcProxyRect.fTop + 2 * srcBlurRadius + srcTop;
rectYs[2] = srcProxyRect.fBottom - 2 * srcBlurRadius - srcBot;
rectYs[3] = srcProxyRect.fBottom;
texXs[0] = 0.0f;
texXs[1] = 2.0f*devBlurRadius + devLeft;
texXs[2] = 2.0f*devBlurRadius + devLeft + 1;
texXs[1] = 2.0f * devBlurRadius + devLeft;
texXs[2] = 2.0f * devBlurRadius + devLeft + 1;
texXs[3] = SkIntToScalar(widthHeight->fWidth);
texYs[0] = 0.0f;
texYs[1] = 2.0f*devBlurRadius + devTop;
texYs[2] = 2.0f*devBlurRadius + devTop + 1;
texYs[1] = 2.0f * devBlurRadius + devTop;
texYs[2] = 2.0f * devBlurRadius + devTop + 1;
texYs[3] = SkIntToScalar(widthHeight->fHeight);
const SkRect newRect = SkRect::MakeXYWH(SkIntToScalar(devBlurRadius),
@ -798,10 +896,10 @@ bool ComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
SkIntToScalar(newRRWidth),
SkIntToScalar(newRRHeight));
SkVector newRadii[4];
newRadii[0] = { SkScalarCeilToScalar(devRadiiUL.fX), SkScalarCeilToScalar(devRadiiUL.fY) };
newRadii[1] = { SkScalarCeilToScalar(devRadiiUR.fX), SkScalarCeilToScalar(devRadiiUR.fY) };
newRadii[2] = { SkScalarCeilToScalar(devRadiiLR.fX), SkScalarCeilToScalar(devRadiiLR.fY) };
newRadii[3] = { SkScalarCeilToScalar(devRadiiLL.fX), SkScalarCeilToScalar(devRadiiLL.fY) };
newRadii[0] = {SkScalarCeilToScalar(devRadiiUL.fX), SkScalarCeilToScalar(devRadiiUL.fY)};
newRadii[1] = {SkScalarCeilToScalar(devRadiiUR.fX), SkScalarCeilToScalar(devRadiiUR.fY)};
newRadii[2] = {SkScalarCeilToScalar(devRadiiLR.fX), SkScalarCeilToScalar(devRadiiLR.fY)};
newRadii[3] = {SkScalarCeilToScalar(devRadiiLL.fX), SkScalarCeilToScalar(devRadiiLL.fY)};
rrectToDraw->setRectRadii(newRect, newRadii);
return true;
@ -839,7 +937,6 @@ int CreateIntegralTable(float sixSigma, SkBitmap* table) {
return table->width();
}
void Compute1DGaussianKernel(float* kernel, float sigma, int radius) {
SkASSERT(radius == SigmaRadius(sigma));
if (SkGpuBlurUtils::IsEffectivelyZeroSigma(sigma)) {
@ -905,8 +1002,10 @@ void Compute1DLinearGaussianKernel(float* kernel, float* offset, float sigma, in
// | | | |
// \-----^---/ Lower sample
// \---^-----/ Upper sample
get_new_weight(&kernel[halfradius], &offset[halfradius],
temp_kernel[index] * 0.5f, temp_kernel[index + 1]);
get_new_weight(&kernel[halfradius],
&offset[halfradius],
temp_kernel[index] * 0.5f,
temp_kernel[index + 1]);
kernel[low_index] = kernel[halfradius];
offset[low_index] = -offset[halfradius];
index++;

View File

@ -168,6 +168,7 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(GrIma
fit,
info.dimensions(),
SkSurfaceProps(),
/*label=*/"RecordingContextPriv_MakeSFC",
sampleCount,
mipmapped,
isProtected,
@ -225,19 +226,21 @@ std::unique_ptr<skgpu::SurfaceFillContext> GrRecordingContextPriv::makeSFC(
SkASSERT(sampleCount >= 1);
SkASSERT(format.isValid() && format.backend() == fContext->backend());
if (alphaType == kPremul_SkAlphaType || alphaType == kOpaque_SkAlphaType) {
return skgpu::v1::SurfaceDrawContext::Make(this->context(),
std::move(colorSpace),
fit,
dimensions,
format,
sampleCount,
mipmapped,
isProtected,
readSwizzle,
writeSwizzle,
origin,
budgeted,
SkSurfaceProps());
return skgpu::v1::SurfaceDrawContext::Make(
this->context(),
std::move(colorSpace),
fit,
dimensions,
format,
sampleCount,
mipmapped,
isProtected,
readSwizzle,
writeSwizzle,
origin,
budgeted,
SkSurfaceProps(),
/*label=*/"MakeCustomConfiguredSurfaceFillContextUsingCustomSwizzles");
}
sk_sp<GrTextureProxy> proxy =

View File

@ -173,6 +173,7 @@ sk_sp<BaseDevice> Device::Make(GrRecordingContext* rContext,
fit,
ii.dimensions(),
props,
/*label=*/"MakeDevice",
sampleCount,
mipmapped,
isProtected,

View File

@ -164,7 +164,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin origin,
SkBudgeted budgeted,
const SkSurfaceProps& surfaceProps) {
const SkSurfaceProps& surfaceProps,
std::string_view label) {
// It is probably not necessary to check if the context is abandoned here since uses of the
// SurfaceDrawContext which need the context will mostly likely fail later on without an
// issue. However having this hear adds some reassurance in case there is a path doesn't handle
@ -182,7 +183,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
fit,
budgeted,
isProtected,
/*label=*/"MakeSurfaceDrawContextWithCustomSwizzles");
label);
if (!proxy) {
return nullptr;
}
@ -207,6 +208,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
SkBackingFit fit,
SkISize dimensions,
const SkSurfaceProps& surfaceProps,
std::string_view label,
int sampleCnt,
GrMipmapped mipmapped,
GrProtected isProtected,
@ -229,7 +231,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
fit,
budgeted,
isProtected,
/*label=*/"MakeSurfaceDrawContextUsingDefaultTextureFormat");
label);
if (!proxy) {
return nullptr;
}
@ -260,7 +262,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
return nullptr;
}
return SurfaceDrawContext::Make(rContext, ct, colorSpace, fit, dimensions, surfaceProps,
sampleCnt, mipmapped, isProtected, origin, budgeted);
/*label=*/"MakeSurfaceDrawContextWithFallback", sampleCnt,
mipmapped, isProtected, origin, budgeted);
}
std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeFromBackendTexture(

View File

@ -74,6 +74,7 @@ public:
SkBackingFit,
SkISize dimensions,
const SkSurfaceProps&,
std::string_view label,
int sampleCnt = 1,
GrMipmapped = GrMipmapped::kNo,
GrProtected = GrProtected::kNo,
@ -96,7 +97,8 @@ public:
skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin,
SkBudgeted,
const SkSurfaceProps&);
const SkSurfaceProps&,
std::string_view label);
// Same as previous factory but will try to use fallback GrColorTypes if the one passed in
// fails. The fallback GrColorType will have at least the number of channels and precision per

View File

@ -20,7 +20,7 @@
static std::unique_ptr<skgpu::v1::SurfaceDrawContext> new_SDC(GrRecordingContext* rContext) {
return skgpu::v1::SurfaceDrawContext::Make(
rContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {128, 128},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
}
static sk_sp<GrSurfaceProxy> create_proxy(GrRecordingContext* rContext) {

View File

@ -70,7 +70,8 @@ static bool check_rect(GrDirectContext* dContext,
std::unique_ptr<SurfaceDrawContext> newSDC(GrRecordingContext* rContext, int w, int h) {
return SurfaceDrawContext::Make(rContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {w, h}, SkSurfaceProps());
SkBackingFit::kExact, {w, h}, SkSurfaceProps(),
/*label=*/{});
}
static void clear_op_test(skiatest::Reporter* reporter, GrDirectContext* dContext) {

View File

@ -90,7 +90,7 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_preserve_contents,
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps);
kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
@ -121,7 +121,7 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read, &sk_gpu_test::GrContextFactory::IsRende
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps);
kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
@ -145,7 +145,7 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_aa_dst_read_after_dmsaa,
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps);
kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);
@ -170,7 +170,7 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read_with_existing_barrier,
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps);
kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc);

View File

@ -87,7 +87,7 @@ static void run_test(GrDirectContext* dContext, skiatest::Reporter* reporter) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox,
{kBigSize/2 + 1, kBigSize/2 + 1},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
sdc->clear(SK_PMColor4fBLACK);
@ -105,7 +105,7 @@ static void run_test(GrDirectContext* dContext, skiatest::Reporter* reporter) {
{
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {kBigSize, kBigSize},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
sdc->clear(SK_PMColor4fBLACK);

View File

@ -205,7 +205,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {32, 32},
SkSurfaceProps());
SkSurfaceProps(),
/*label=*/"AtlasTextOpPreparation");
SkPaint paint;
paint.setColor(SK_ColorRED);

View File

@ -1725,7 +1725,8 @@ DEF_TEST(ClipStack_DiffRects, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(&options);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps());
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false);
@ -1879,7 +1880,8 @@ DEF_TEST(ClipStack_Shader, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps());
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false);
cs.save();
@ -1932,7 +1934,8 @@ DEF_TEST(ClipStack_SimpleApply, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps());
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false);
@ -2065,7 +2068,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ClipStack_SWMask,
GrDirectContext* context = ctxInfo.directContext();
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, kDeviceBounds.size(),
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
SkMatrixProvider matrixProvider = SkMatrix::I();
std::unique_ptr<ClipStack> cs(new ClipStack(kDeviceBounds, &matrixProvider, false));

View File

@ -115,7 +115,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kImageWidth, kImageHeight}, SkSurfaceProps());
{kImageWidth, kImageHeight}, SkSurfaceProps(), /*label=*/{});
if (!sdc) {
ERRORF(reporter, "could not create render target context.");
return;

View File

@ -193,7 +193,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kScreenSize, kScreenSize}, SkSurfaceProps());
{kScreenSize, kScreenSize}, SkSurfaceProps(), /*label=*/{});
if (!sdc) {
ERRORF(reporter, "could not create render target context.");
return;

View File

@ -46,6 +46,7 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> new_SDC(GrRecordingContext
SkBackingFit::kExact,
{wh, wh},
SkSurfaceProps(),
/*label=*/{},
1,
GrMipmapped::kNo,
GrProtected::kNo,

View File

@ -229,11 +229,12 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
ctx->priv().addOnFlushCallbackObject(&test);
auto sdc = skgpu::v1::SurfaceDrawContext::Make(ctx.get(), GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {100, 100},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
REPORTER_ASSERT(reporter, sdc);
auto mockAtlas = skgpu::v1::SurfaceDrawContext::Make(ctx.get(), GrColorType::kAlpha_F16,
nullptr, SkBackingFit::kExact,
{10, 10}, SkSurfaceProps());
{10, 10}, SkSurfaceProps(),
/*label=*/{});
REPORTER_ASSERT(reporter, mockAtlas);
LazyProxyTest::Clip clip(&test, mockAtlas->asTextureProxy());
sdc->addDrawOp(&clip,
@ -417,7 +418,7 @@ DEF_GPUTEST(LazyProxyFailedInstantiationTest, reporter, /* options */) {
for (bool failInstantiation : {false, true}) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(ctx.get(), GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {100, 100},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
REPORTER_ASSERT(reporter, sdc);
sdc->clear(SkPMColor4f::FromBytes_RGBA(0xbaaaaaad));

View File

@ -87,7 +87,8 @@ static void test_path(skiatest::Reporter* reporter,
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800},
SkSurfaceProps(), 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
SkSurfaceProps(), /*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo,
kTopLeft_GrSurfaceOrigin);
if (!sdc) {
return;
}

View File

@ -184,7 +184,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
nullptr,
SkBackingFit::kApprox,
{1, 1},
SkSurfaceProps());
SkSurfaceProps(),
/*label=*/{});
if (!sdc) {
ERRORF(reporter, "Could not create render target context.");
return;

View File

@ -159,7 +159,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
{
sk_sp<GrTextureProxy> proxy =
proxyProvider->createProxy(format,
@ -540,7 +540,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
static constexpr int kRenderSize = 256;
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kRenderSize, kRenderSize}, SkSurfaceProps());
{kRenderSize, kRenderSize}, SkSurfaceProps(), /*label=*/{});
// Coverage optimization uses three frames with a linearly transformed input texture. The first
// frame has no offset, second frames add .2 and .4, which should then be present as a fixed
@ -901,7 +901,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
static constexpr int kRenderSize = 1024;
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kRenderSize, kRenderSize}, SkSurfaceProps());
{kRenderSize, kRenderSize}, SkSurfaceProps(), /*label=*/{});
std::vector<GrColor> inputPixels = make_input_pixels(kRenderSize, kRenderSize, 0.0f);
GrSurfaceProxyView inputTexture =

View File

@ -152,8 +152,8 @@ static std::unique_ptr<skgpu::v1::SurfaceDrawContext> random_surface_draw_contex
return skgpu::v1::SurfaceDrawContext::Make(
rContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kRenderTargetWidth, kRenderTargetHeight}, SkSurfaceProps(), sampleCnt,
GrMipmapped::kNo, GrProtected::kNo, origin);
{kRenderTargetWidth, kRenderTargetHeight}, SkSurfaceProps(), /*label=*/{},
sampleCnt, GrMipmapped::kNo, GrProtected::kNo, origin);
}
#if GR_TEST_UTILS
@ -301,7 +301,8 @@ bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, i
// Validate that GrFPs work correctly without an input.
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
direct, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kRenderTargetWidth, kRenderTargetHeight}, SkSurfaceProps());
{kRenderTargetWidth, kRenderTargetHeight}, SkSurfaceProps(),
/*label=*/{});
if (!sdc) {
SkDebugf("Could not allocate a surfaceDrawContext");
return false;

View File

@ -47,7 +47,8 @@ static void run_test(skiatest::Reporter*, GrDirectContext*,
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkSLCross, reporter, ctxInfo) {
GrDirectContext* dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {1, 1}, SkSurfaceProps());
SkBackingFit::kExact, {1, 1}, SkSurfaceProps(),
/*label=*/"SkSLCross_Test");
if (!sdc) {
ERRORF(reporter, "could not create render target context.");
return;

View File

@ -21,7 +21,7 @@ static const int kSize = 64;
static std::unique_ptr<skgpu::v1::SurfaceDrawContext> get_sdc(GrRecordingContext* rContext) {
return skgpu::v1::SurfaceDrawContext::Make(rContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {kSize, kSize},
SkSurfaceProps());
SkSurfaceProps(), /*label=*/{});
}
static void check_instantiation_status(skiatest::Reporter* reporter,

View File

@ -827,7 +827,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TriangulatingPathRendererTests, reporter, ctxInfo)
auto ctx = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(
ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800},
SkSurfaceProps(), 1, GrMipmapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
SkSurfaceProps(),/*label=*/{}, 1, GrMipmapped::kNo, GrProtected::kNo,
kTopLeft_GrSurfaceOrigin);
if (!sdc) {
return;
}