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

Use of uninit memory in bench fixed here:
 https://skia-review.googlesource.com/c/skia/+/362478

This reverts commit c621dcf354.

Bug: skia:11208
Change-Id: Ia13dde689a982f485a93daf8eeb8b716c9c23796
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362456
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2021-01-29 14:42:38 -05:00 committed by Skia Commit-Bot
parent bb61768266
commit 010bb4659b
5 changed files with 10 additions and 27 deletions

View File

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

View File

@ -245,12 +245,6 @@ 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

@ -140,12 +140,7 @@ 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

@ -196,13 +196,6 @@ 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.
@ -569,7 +562,6 @@ protected:
int fMaxPreferredRenderTargetSize;
int fMaxVertexAttributes;
int fMaxTextureSize;
int fMaxTileSize;
int fMaxWindowRectangles;
int fInternalMultisampleCount;
uint32_t fMaxPushConstantsSize = 0;

View File

@ -620,9 +620,6 @@ 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);
@ -772,7 +769,7 @@ void SkGpuDevice::drawImageQuad(const SkImage* image, const SkRect* srcRect, con
} else {
tileFilterPad = 1;
}
int maxTileSize = fContext->priv().caps()->maxTileSize() - 2 * tileFilterPad;
int maxTileSize = fContext->priv().caps()->maxTextureSize() - 2*tileFilterPad;
int tileSize;
SkIRect clippedSubset;
if (should_tile_image_id(fContext.get(), fSurfaceDrawContext->dimensions(), clip,