OSDN Git Service

[validation] Correctly compute wanted draw call size when draw count == 0.
authorLingfeng Yang <lfy@google.com>
Wed, 18 Jan 2017 17:17:09 +0000 (09:17 -0800)
committerLingfeng Yang <lfy@google.com>
Wed, 18 Jan 2017 18:52:50 +0000 (18:52 +0000)
bug: 34378638

Change-Id: I9912436048c28337de40d13536246a6b9e11fc7b

system/GLESv2_enc/GL2Encoder.cpp

index af04267..9027b7a 100755 (executable)
@@ -918,10 +918,10 @@ void GL2Encoder::sendVertexAttributes(GLint first, GLsizei count, bool hasClient
                 // The following expression actually means bufLen = stride*count;
                 // But the last element doesn't have to fill up the whole stride.
                 // So it becomes the current form.
-                unsigned int bufLen = effectiveStride * (count - 1) + state.elementSize;
+                unsigned int bufLen = effectiveStride * (count ? (count - 1) : 0) + state.elementSize;
                 if (divisor && primcount) {
                     int actual_count = std::max(1, (int)((primcount + divisor - 1) / divisor));
-                    bufLen = effectiveStride * (actual_count - 1) + state.elementSize;
+                    bufLen = effectiveStride * (actual_count ? (actual_count - 1) : 0) + state.elementSize;
                 }
                 if (buf && firstIndex >= 0 && firstIndex + bufLen <= buf->m_size) {
                     if (hasClientArrays) {