Revert "Remove maxTileSize from GrCaps, bleed GMs use max texture size override."

This reverts commit 0bad6cf145.

Reason for revert: breaking perf bot!?!?

Original change's description:
> Remove maxTileSize from GrCaps, bleed GMs use max texture size override.
>
> This existed to enable shader-based versions of the old bleed GM that no
> longer exist. It is currently making it harder to simplify image->view
> consolidation without accidentally limiting the testing. This is because
> an attempt to create a texture from a bitmap will succeed if max texture
> size is not overridden by the test.
>
> Bug: skia:11208
> Change-Id: I432d1d2ab66c1e888c9d77583b3c9a9d673e7e8f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360609
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:11208
Change-Id: Ib8643aec37ac312ac0a2fb834cc3dbf116f7a898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2021-01-29 15:46:42 +00:00 committed by Skia Commit-Bot
parent c1ea3d9b8e
commit c621dcf354
5 changed files with 27 additions and 10 deletions

View File

@ -115,11 +115,7 @@ public:
SrcRectConstraintGM(const char* shortName, SkCanvas::SrcRectConstraint constraint, bool batch)
: fShortName(shortName)
, fConstraint(constraint)
, fBatch(batch) {
// Make sure GPU SkSurfaces can be created for this GM.
SkASSERT(this->onISize().width() <= kMaxTextureSize &&
this->onISize().height() <= kMaxTextureSize);
}
, fBatch(batch) {}
protected:
SkString onShortName() override { return fShortName; }
@ -217,7 +213,7 @@ protected:
}
void onOnceBeforeDraw() override {
std::tie(fBigImage, fBigSrcRect) = make_ringed_image(2*kMaxTextureSize, 2*kMaxTextureSize);
std::tie(fBigImage, fBigSrcRect) = make_ringed_image(2*kMaxTileSize, 2*kMaxTileSize);
std::tie(fSmallImage, fSmallSrcRect) = make_ringed_image(kSmallSize, kSmallSize);
}
@ -295,7 +291,7 @@ protected:
}
void modifyGrContextOptions(GrContextOptions* options) override {
options->fMaxTextureSizeOverride = kMaxTextureSize;
options->fMaxTileSizeOverride = kMaxTileSize;
}
private:
@ -314,8 +310,7 @@ private:
static constexpr int kRow4Y = 5*kBlockSpacing + 4*kBlockSize;
static constexpr int kSmallSize = 6;
// This must be at least as large as the GM width and height so that a surface can be made.
static constexpr int kMaxTextureSize = 1000;
static constexpr int kMaxTileSize = 32;
SkString fShortName;
sk_sp<SkImage> fBigImage;

View File

@ -245,6 +245,12 @@ struct SK_API GrContextOptions {
* Private options that are only meant for testing within Skia's tools.
*/
/**
* If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
* by SkGpuDevice.
*/
int fMaxTileSizeOverride = 0;
/**
* Prevents use of dual source blending, to test that all xfer modes work correctly without it.
*/

View File

@ -139,7 +139,12 @@ void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
fAllowCoverageCounting = !options.fDisableCoverageCountingPaths;
fMaxTextureSize = std::min(fMaxTextureSize, options.fMaxTextureSizeOverride);
fMaxTileSize = fMaxTextureSize;
#if GR_TEST_UTILS
// If the max tile override is zero, it means we should use the max texture size.
if (options.fMaxTileSizeOverride && options.fMaxTileSizeOverride < fMaxTextureSize) {
fMaxTileSize = options.fMaxTileSizeOverride;
}
if (options.fSuppressDualSourceBlending) {
// GrShaderCaps::applyOptionsOverrides already handled the rest; here we just need to make
// sure mixed samples gets disabled if dual source blending is suppressed.

View File

@ -190,6 +190,13 @@ public:
int maxTextureSize() const { return fMaxTextureSize; }
/** This is the maximum tile size to use by GPU devices for rendering sw-backed images/bitmaps.
It is usually the max texture size, unless we're overriding it for testing. */
int maxTileSize() const {
SkASSERT(fMaxTileSize <= fMaxTextureSize);
return fMaxTileSize;
}
int maxWindowRectangles() const { return fMaxWindowRectangles; }
// Returns whether mixed samples is supported for the given backend render target.
@ -555,6 +562,7 @@ protected:
int fMaxPreferredRenderTargetSize;
int fMaxVertexAttributes;
int fMaxTextureSize;
int fMaxTileSize;
int fMaxWindowRectangles;
int fInternalMultisampleCount;
uint32_t fMaxPushConstantsSize = 0;

View File

@ -620,6 +620,9 @@ void draw_tiled_bitmap(GrRecordingContext* context,
// We should have already handled bitmaps larger than the max texture size.
SkASSERT(tmpB.width() <= context->priv().caps()->maxTextureSize() &&
tmpB.height() <= context->priv().caps()->maxTextureSize());
// We should be respecting the max tile size by the time we get here.
SkASSERT(tmpB.width() <= context->priv().caps()->maxTileSize() &&
tmpB.height() <= context->priv().caps()->maxTileSize());
GrBitmapTextureMaker tileProducer(context, tmpB, GrImageTexGenPolicy::kDraw);
@ -769,7 +772,7 @@ void SkGpuDevice::drawImageQuad(const SkImage* image, const SkRect* srcRect, con
} else {
tileFilterPad = 1;
}
int maxTileSize = fContext->priv().caps()->maxTextureSize() - 2*tileFilterPad;
int maxTileSize = fContext->priv().caps()->maxTileSize() - 2 * tileFilterPad;
int tileSize;
SkIRect clippedSubset;
if (should_tile_image_id(fContext.get(), fSurfaceDrawContext->dimensions(), clip,