aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-09 17:40:32 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-09 17:40:32 +0000
commitf04c40ef1e60e21f3e1b2a03b910211bf895b339 (patch)
tree9595053b7debbd74b2173e4fdffe5bb641361c24 /src
parenta1c3d78f224874833920c8017f4287a3ec538779 (diff)
Fixed xoom bug introduced in r5830
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index ae6d0f24b7..678a9c566e 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -92,9 +92,34 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
bool appendToPreviousDraw = false;
GrVertexLayout layout = GetRectVertexLayout(srcRects);
- // When we batch rects we store the color at each vertex in order
- // to allow batching when only the draw color is changing (the usual case)
- layout |= kColor_VertexLayoutBit;
+ // Batching across colors means we move the draw color into the
+ // rect's vertex colors to allow greater batching (a lot of rects
+ // in a row differing only in color is a common occurence in tables).
+ bool batchAcrossColors = true;
+ if (!this->getCaps().dualSourceBlendingSupport()) {
+ for (int s = 0; s < GrDrawState::kNumStages; ++s) {
+ if (this->getDrawState().isStageEnabled(s)) {
+ // We disable batching across colors when there is a texture
+ // present because (by pushing the the color to the vertices)
+ // Ganesh loses track of the rect's opacity. This, in turn, can
+ // cause some of the blending optimizations to be disabled. This
+ // becomes a huge problem on some of the smaller devices where
+ // shader derivatives and dual source blending aren't supported.
+ // In those cases paths are often drawn to a texture and then
+ // drawn as a texture (using this method). Because dual source
+ // blending is disabled (and the blend optimizations are short
+ // circuited) some of the more esoteric blend modes can no longer
+ // be supported.
+ // TODO: add tracking of batchAcrossColors's opacity
+ batchAcrossColors = false;
+ break;
+ }
+ }
+ }
+
+ if (batchAcrossColors) {
+ layout |= kColor_VertexLayoutBit;
+ }
AutoReleaseGeometry geo(this, layout, 4, 0);
if (!geo.succeeded()) {
@@ -129,7 +154,9 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
// Now that the paint's color is stored in the vertices set it to
// white so that the following code can batch all the rects regardless
// of paint color
- GrDrawState::AutoColorRestore acr(this->drawState(), SK_ColorWHITE);
+ GrDrawState::AutoColorRestore acr(this->drawState(),
+ batchAcrossColors ? SK_ColorWHITE
+ : this->getDrawState().getColor());
// we don't want to miss an opportunity to batch rects together
// simply because the clip has changed if the clip doesn't affect