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) { for (int i = 0; i < loops; ++i) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make(context, GrColorType::kRGBA_8888, p3, auto sdc = skgpu::v1::SurfaceDrawContext::Make(context, GrColorType::kRGBA_8888, p3,
SkBackingFit::kApprox, {100, 100}, SkBackingFit::kApprox, {100, 100},
SkSurfaceProps()); SkSurfaceProps(),
/*label=*/"DrawVertexColorSpaceBench");
SkASSERT(sdc); SkASSERT(sdc);
for (int j = 0; j < kDrawsPerLoop; ++j) { 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(); GrColorType sdcColorType = sdc->colorInfo().colorType();
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make( if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(), 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)) { SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT); topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0)); 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. // Draw the test to an off-screen, bottom-up render target.
if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make( if (auto topLeftSDC = skgpu::v1::SurfaceDrawContext::Make(
rContext, sdcColorType, nullptr, SkBackingFit::kExact, {100, 200}, SkSurfaceProps(), 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)) { SkBudgeted::kYes)) {
topLeftSDC->clear(SK_PMColor4fTRANSPARENT); topLeftSDC->clear(SK_PMColor4fTRANSPARENT);
topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0)); topLeftSDC->addDrawOp(ClockwiseTestOp::Make(rContext, false, 0));

View File

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

View File

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

View File

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

View File

@ -164,7 +164,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
skgpu::Swizzle writeSwizzle, skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin origin, GrSurfaceOrigin origin,
SkBudgeted budgeted, 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 // 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 // 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 // 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, fit,
budgeted, budgeted,
isProtected, isProtected,
/*label=*/"MakeSurfaceDrawContextWithCustomSwizzles"); label);
if (!proxy) { if (!proxy) {
return nullptr; return nullptr;
} }
@ -207,6 +208,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
SkBackingFit fit, SkBackingFit fit,
SkISize dimensions, SkISize dimensions,
const SkSurfaceProps& surfaceProps, const SkSurfaceProps& surfaceProps,
std::string_view label,
int sampleCnt, int sampleCnt,
GrMipmapped mipmapped, GrMipmapped mipmapped,
GrProtected isProtected, GrProtected isProtected,
@ -229,7 +231,7 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::Make(
fit, fit,
budgeted, budgeted,
isProtected, isProtected,
/*label=*/"MakeSurfaceDrawContextUsingDefaultTextureFormat"); label);
if (!proxy) { if (!proxy) {
return nullptr; return nullptr;
} }
@ -260,7 +262,8 @@ std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeWithFallback(
return nullptr; return nullptr;
} }
return SurfaceDrawContext::Make(rContext, ct, colorSpace, fit, dimensions, surfaceProps, 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( std::unique_ptr<SurfaceDrawContext> SurfaceDrawContext::MakeFromBackendTexture(

View File

@ -74,6 +74,7 @@ public:
SkBackingFit, SkBackingFit,
SkISize dimensions, SkISize dimensions,
const SkSurfaceProps&, const SkSurfaceProps&,
std::string_view label,
int sampleCnt = 1, int sampleCnt = 1,
GrMipmapped = GrMipmapped::kNo, GrMipmapped = GrMipmapped::kNo,
GrProtected = GrProtected::kNo, GrProtected = GrProtected::kNo,
@ -96,7 +97,8 @@ public:
skgpu::Swizzle writeSwizzle, skgpu::Swizzle writeSwizzle,
GrSurfaceOrigin, GrSurfaceOrigin,
SkBudgeted, 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 // 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 // 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) { static std::unique_ptr<skgpu::v1::SurfaceDrawContext> new_SDC(GrRecordingContext* rContext) {
return skgpu::v1::SurfaceDrawContext::Make( return skgpu::v1::SurfaceDrawContext::Make(
rContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {128, 128}, rContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {128, 128},
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
} }
static sk_sp<GrSurfaceProxy> create_proxy(GrRecordingContext* rContext) { 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) { std::unique_ptr<SurfaceDrawContext> newSDC(GrRecordingContext* rContext, int w, int h) {
return SurfaceDrawContext::Make(rContext, GrColorType::kRGBA_8888, nullptr, 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) { 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 dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight}, SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps); kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent. // Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc); 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 dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight}, SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps); kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent. // Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc); 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 dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight}, SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps); kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent. // Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc); 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 dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight}, SkBackingFit::kApprox, {kWidth, kHeight},
kDMSAAProps); kDMSAAProps, /*label=*/{});
// Initialize the texture and dmsaa attachment with transparent. // Initialize the texture and dmsaa attachment with transparent.
draw_paint_with_dmsaa(sdc.get(), SK_PMColor4fTRANSPARENT, SkBlendMode::kSrc); 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, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, SkBackingFit::kApprox,
{kBigSize/2 + 1, kBigSize/2 + 1}, {kBigSize/2 + 1, kBigSize/2 + 1},
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
sdc->clear(SK_PMColor4fBLACK); 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, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {kBigSize, kBigSize}, SkBackingFit::kExact, {kBigSize, kBigSize},
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
sdc->clear(SK_PMColor4fBLACK); 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, auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {32, 32}, SkBackingFit::kApprox, {32, 32},
SkSurfaceProps()); SkSurfaceProps(),
/*label=*/"AtlasTextOpPreparation");
SkPaint paint; SkPaint paint;
paint.setColor(SK_ColorRED); paint.setColor(SK_ColorRED);

View File

@ -1725,7 +1725,8 @@ DEF_TEST(ClipStack_DiffRects, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(&options); sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(&options);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make( std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(), context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps()); SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false); ClipStack cs(kDeviceBounds, &matrixProvider, false);
@ -1879,7 +1880,8 @@ DEF_TEST(ClipStack_Shader, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr); sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make( std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(), context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps()); SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false); ClipStack cs(kDeviceBounds, &matrixProvider, false);
cs.save(); cs.save();
@ -1932,7 +1934,8 @@ DEF_TEST(ClipStack_SimpleApply, r) {
sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr); sk_sp<GrDirectContext> context = GrDirectContext::MakeMock(nullptr);
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make( std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(), context.get(), GrColorType::kRGBA_8888, SkColorSpace::MakeSRGB(),
SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps()); SkBackingFit::kExact, kDeviceBounds.size(), SkSurfaceProps(),
/*label=*/{});
ClipStack cs(kDeviceBounds, &matrixProvider, false); ClipStack cs(kDeviceBounds, &matrixProvider, false);
@ -2065,7 +2068,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ClipStack_SWMask,
GrDirectContext* context = ctxInfo.directContext(); GrDirectContext* context = ctxInfo.directContext();
std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make( std::unique_ptr<SurfaceDrawContext> sdc = SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, kDeviceBounds.size(), context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, kDeviceBounds.size(),
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
SkMatrixProvider matrixProvider = SkMatrix::I(); SkMatrixProvider matrixProvider = SkMatrix::I();
std::unique_ptr<ClipStack> cs(new ClipStack(kDeviceBounds, &matrixProvider, false)); 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( auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
{kImageWidth, kImageHeight}, SkSurfaceProps()); {kImageWidth, kImageHeight}, SkSurfaceProps(), /*label=*/{});
if (!sdc) { if (!sdc) {
ERRORF(reporter, "could not create render target context."); ERRORF(reporter, "could not create render target context.");
return; return;

View File

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

View File

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

View File

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

View File

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

View File

@ -159,7 +159,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
for (int parentCnt = 0; parentCnt < 2; parentCnt++) { for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
auto sdc = skgpu::v1::SurfaceDrawContext::Make( auto sdc = skgpu::v1::SurfaceDrawContext::Make(
dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1}, dContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1},
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
{ {
sk_sp<GrTextureProxy> proxy = sk_sp<GrTextureProxy> proxy =
proxyProvider->createProxy(format, proxyProvider->createProxy(format,
@ -540,7 +540,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
static constexpr int kRenderSize = 256; static constexpr int kRenderSize = 256;
auto sdc = skgpu::v1::SurfaceDrawContext::Make( auto sdc = skgpu::v1::SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, 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 // 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 // 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; static constexpr int kRenderSize = 1024;
auto sdc = skgpu::v1::SurfaceDrawContext::Make( auto sdc = skgpu::v1::SurfaceDrawContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, 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); std::vector<GrColor> inputPixels = make_input_pixels(kRenderSize, kRenderSize, 0.0f);
GrSurfaceProxyView inputTexture = GrSurfaceProxyView inputTexture =

View File

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

View File

@ -47,7 +47,8 @@ static void run_test(skiatest::Reporter*, GrDirectContext*,
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkSLCross, reporter, ctxInfo) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkSLCross, reporter, ctxInfo) {
GrDirectContext* dContext = ctxInfo.directContext(); GrDirectContext* dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr, 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) { if (!sdc) {
ERRORF(reporter, "could not create render target context."); ERRORF(reporter, "could not create render target context.");
return; return;

View File

@ -21,7 +21,7 @@ static const int kSize = 64;
static std::unique_ptr<skgpu::v1::SurfaceDrawContext> get_sdc(GrRecordingContext* rContext) { static std::unique_ptr<skgpu::v1::SurfaceDrawContext> get_sdc(GrRecordingContext* rContext) {
return skgpu::v1::SurfaceDrawContext::Make(rContext, GrColorType::kRGBA_8888, nullptr, return skgpu::v1::SurfaceDrawContext::Make(rContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kExact, {kSize, kSize}, SkBackingFit::kExact, {kSize, kSize},
SkSurfaceProps()); SkSurfaceProps(), /*label=*/{});
} }
static void check_instantiation_status(skiatest::Reporter* reporter, 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 ctx = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make( auto sdc = skgpu::v1::SurfaceDrawContext::Make(
ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800}, 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) { if (!sdc) {
return; return;
} }