From: Lingfeng Yang Date: Wed, 18 Jan 2017 17:17:09 +0000 (-0800) Subject: [validation] Correctly compute wanted draw call size when draw count == 0. X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fdevice-generic-goldfish-opengl.git;a=commitdiff_plain;h=5fe9901e6eddcdb0d3e9a00ffcfb7fb51cad7899 [validation] Correctly compute wanted draw call size when draw count == 0. bug: 34378638 Change-Id: I9912436048c28337de40d13536246a6b9e11fc7b --- diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp index af04267..9027b7a 100755 --- a/system/GLESv2_enc/GL2Encoder.cpp +++ b/system/GLESv2_enc/GL2Encoder.cpp @@ -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) {