fMaxTileSize = options.fMaxTileSizeOverride;
}
if (fMaxWindowRectangles > GrWindowRectangles::kMaxWindows) {
+ SkDebugf("WARNING: capping window rectangles at %i. HW advertises support for %i.\n",
+ GrWindowRectangles::kMaxWindows, fMaxWindowRectangles);
fMaxWindowRectangles = GrWindowRectangles::kMaxWindows;
}
}
class GrWindowRectangles {
public:
- constexpr static int kMaxWindows = 16;
+ constexpr static int kMaxWindows = 8;
enum class Mode : bool {
kExclusive,
~GrWindowRectangles() { SkSafeUnref(this->rec()); }
Mode mode() const { return fMode; }
- uint16_t count() const { return fCount; }
+ int count() const { return fCount; }
bool disabled() const { return Mode::kExclusive == fMode && !fCount; }
const SkIRect* data() const;
if (!this->caps()->maxWindowRectangles() ||
fHWWindowRects.equal(rt->origin(), rt->getViewport(), windows)) {
return;
-
}
+ // This is purely a workaround for a spurious warning generated by gcc. Otherwise the above
+ // assert would be sufficient. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=5912
+ int numWindows = SkTMin(windows.count(), int(GrWindowRectangles::kMaxWindows));
+ SkASSERT(windows.count() == numWindows);
+
GrGLIRect glwindows[GrWindowRectangles::kMaxWindows];
const SkIRect* skwindows = windows.data();
- for (int i = 0; i < windows.count(); ++i) {
+ for (int i = 0; i < numWindows; ++i) {
glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin());
}
GrGLenum glmode = (Mode::kExclusive == windows.mode()) ? GR_GL_EXCLUSIVE : GR_GL_INCLUSIVE;
- GL_CALL(WindowRectangles(glmode, windows.count(), glwindows->asInts()));
+ GL_CALL(WindowRectangles(glmode, numWindows, glwindows->asInts()));
fHWWindowRects.set(rt->origin(), rt->getViewport(), windows);
}