aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-11-30 19:09:45 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-30 19:10:43 +0000
commitbe85ef25111ac59275b1642350ffb608141c404f (patch)
treea609ffb0a84a365d6f6415257a5aeba42020bf44
parent48ed0043a94877a5a8afb837356a036f4b70e711 (diff)
Revert "Use a dst size threshold for multitexturing images."
This reverts commit edfa0d2f623dc66e695fac631d5fb03599b264b7. Reason for revert: ubsan bug Original change's description: > Use a dst size threshold for multitexturing images. > > TODO: Set thresholds based on GPU in use. > > Change-Id: I0aeac596d11ab63922f2df0d76c668b4f8be5353 > Reviewed-on: https://skia-review.googlesource.com/77900 > Reviewed-by: Robert Phillips <robertphillips@google.com> > Commit-Queue: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,robertphillips@google.com Change-Id: Iea56ce73cf8f7bca265fe58907a72ecf96497d22 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/78542 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r--include/gpu/GrCaps.h3
-rw-r--r--include/gpu/GrShaderCaps.h12
-rw-r--r--src/gpu/GrShaderCaps.cpp14
-rw-r--r--src/gpu/ops/GrTextureOp.cpp15
4 files changed, 15 insertions, 29 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index 86b27b066a..b19281b00d 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -225,6 +225,9 @@ protected:
// Vulkan doesn't support this (yet) and some drivers have issues, too
bool fCrossContextTextureSupport : 1;
+ // Disables using multiple texture units to batch multiple SkImages at once.
+ bool fDisableImageMultitexturingSupport : 1;
+
InstancedSupport fInstancedSupport;
BlendEquationSupport fBlendEquationSupport;
diff --git a/include/gpu/GrShaderCaps.h b/include/gpu/GrShaderCaps.h
index 15377ff0b1..4c847ac8b0 100644
--- a/include/gpu/GrShaderCaps.h
+++ b/include/gpu/GrShaderCaps.h
@@ -196,14 +196,7 @@ public:
int maxCombinedSamplers() const { return fMaxCombinedSamplers; }
- /**
- * In general using multiple texture units for image rendering seems to be a win at smaller
- * sizes of dst rects and a loss at larger sizes. Dst rects above this pixel area threshold will
- * not use multitexturing.
- */
- size_t disableImageMultitexturingDstRectAreaThreshold() const {
- return fDisableImageMultitexturingDstRectAreaThreshold;
- }
+ bool disableImageMultitexturingSupport() const { return fDisableImageMultitexturing; }
/**
* Given a texture's config, this determines what swizzle must be appended to accesses to the
@@ -252,6 +245,7 @@ private:
bool fVertexIDSupport : 1;
bool fFloatIs32Bits : 1;
bool fHalfIs32Bits : 1;
+ bool fDisableImageMultitexturing : 1;
// Used for specific driver bug work arounds
bool fCanUseMinAndAbsTogether : 1;
@@ -283,8 +277,6 @@ private:
int fMaxFragmentSamplers;
int fMaxCombinedSamplers;
- size_t fDisableImageMultitexturingDstRectAreaThreshold;
-
AdvBlendEqInteraction fAdvBlendEqInteraction;
GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
index 65721ee897..2d9cd0a39b 100644
--- a/src/gpu/GrShaderCaps.cpp
+++ b/src/gpu/GrShaderCaps.cpp
@@ -68,9 +68,11 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
fMaxCombinedSamplers = 0;
fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
- // TODO: Default this to 0 and only enable image multitexturing when a "safe" threshold is
- // known for a GPU class.
- fDisableImageMultitexturingDstRectAreaThreshold = std::numeric_limits<size_t>::max();
+#if GR_TEST_UTILS
+ fDisableImageMultitexturing = options.fDisableImageMultitexturing;
+#else
+ fDisableImageMultitexturing = false;
+#endif
}
void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
@@ -128,8 +130,7 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
writer->appendS32("Max Combined Samplers", fMaxFragmentSamplers);
writer->appendString("Advanced blend equation interaction",
kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
- writer->appendU64("Disable image multitexturing dst area threshold",
- fDisableImageMultitexturingDstRectAreaThreshold);
+ writer->appendBool("Disable image multitexturing", fDisableImageMultitexturing);
writer->endObject();
}
@@ -137,8 +138,5 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
#if GR_TEST_UTILS
fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppressDualSourceBlending;
- if (options.fDisableImageMultitexturing) {
- fDisableImageMultitexturingDstRectAreaThreshold = 0;
- }
#endif
}
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 565eb88c52..410257cb7c 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -55,7 +55,7 @@ public:
#endif
static int SupportsMultitexture(const GrShaderCaps& caps) {
- return caps.integerSupport() && caps.maxFragmentSamplers() > 1;
+ return caps.integerSupport() && !caps.disableImageMultitexturingSupport();
}
static sk_sp<GrGeometryProcessor> Make(sk_sp<GrTextureProxy> proxies[], int proxyCnt,
@@ -313,8 +313,6 @@ private:
SkRect bounds;
bounds.setBounds(draw.fQuad.points(), 4);
this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
- fMaxApproxDstPixelArea =
- static_cast<size_t>(SkTMax(bounds.width(), 1.f) * SkTMax(bounds.height(), 1.f));
}
void onPrepareDraws(Target* target) override {
@@ -433,18 +431,15 @@ private:
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
const auto* that = t->cast<TextureOp>();
- const auto& shaderCaps = *caps.shaderCaps();
if (!GrColorSpaceXform::Equals(fColorSpaceXform.get(), that->fColorSpaceXform.get())) {
return false;
}
// Because of an issue where GrColorSpaceXform adds the same function every time it is used
// in a texture lookup, we only allow multiple textures when there is no transform.
- if (TextureGeometryProcessor::SupportsMultitexture(shaderCaps) && !fColorSpaceXform &&
- fMaxApproxDstPixelArea <= shaderCaps.disableImageMultitexturingDstRectAreaThreshold() &&
- that->fMaxApproxDstPixelArea <=
- shaderCaps.disableImageMultitexturingDstRectAreaThreshold()) {
+ if (TextureGeometryProcessor::SupportsMultitexture(*caps.shaderCaps()) &&
+ !fColorSpaceXform) {
int map[kMaxTextures];
- int numNewProxies = this->mergeProxies(that, map, shaderCaps);
+ int numNewProxies = this->mergeProxies(that, map, *caps.shaderCaps());
if (numNewProxies < 0) {
return false;
}
@@ -484,7 +479,6 @@ private:
fDraws.push_back_n(that->fDraws.count(), that->fDraws.begin());
}
this->joinBounds(*that);
- fMaxApproxDstPixelArea = SkTMax(that->fMaxApproxDstPixelArea, fMaxApproxDstPixelArea);
return true;
}
@@ -576,7 +570,6 @@ private:
// Used to track whether fProxy is ref'ed or has a pending IO after finalize() is called.
uint8_t fFinalized;
uint8_t fAllowSRGBInputs;
- size_t fMaxApproxDstPixelArea;
typedef GrMeshDrawOp INHERITED;
};