Fix PUBG on emulator
Vertex attributes with non-zero divisors should be treated as instanced
attributes.
BUG: 120159550
BUG: 120548998
Test: manual
Test: CtsDeqpTestCases
Change-Id: I33c2fa85fec6fead123927c5ea11c3338173cdcf
(cherry picked from commit 804b0f9b3b3901a2f6d2090698a39d03d6251432)
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index daa891d..2be0699 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -1209,7 +1209,7 @@
if (bufferObject == 0) {
unsigned int datalen = state.elementSize * count;
- if (divisor && primcount) {
+ if (divisor) {
ALOGV("%s: divisor for att %d: %d, w/ stride %d (effective stride %d) size %d type 0x%x) datalen %u",
__FUNCTION__, i, divisor, state.stride, effectiveStride, state.elementSize, state.type, datalen);
int actual_count = std::max(1, (int)((primcount + divisor - 1) / divisor));
@@ -1239,7 +1239,7 @@
// But the last element doesn't have to fill up the whole stride.
// So it becomes the current form.
unsigned int bufLen = effectiveStride * (count ? (count - 1) : 0) + state.elementSize;
- if (divisor && primcount) {
+ if (divisor) {
int actual_count = std::max(1, (int)((primcount + divisor - 1) / divisor));
bufLen = effectiveStride * (actual_count ? (actual_count - 1) : 0) + state.elementSize;
}