return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
return GL_FALSE;
}
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
FLUSH_CURRENT(ctx, 0);
for (i = 0; i < primcount; i++) {
- if (count[i] <= 0) {
- if (count[i] < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMultiDrawElements(count)" );
+ if (count[i] < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMultiDrawElements(count)" );
return GL_FALSE;
}
}
return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
return GL_FALSE;
}
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
= ctx->TransformFeedback.CurrentObject;
FLUSH_CURRENT(ctx, 0);
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
return GL_FALSE;
}
xfb_obj->GlesRemainingPrims -= prim_count;
}
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
= ctx->TransformFeedback.CurrentObject;
FLUSH_CURRENT(ctx, 0);
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glDrawArraysInstanced(count=%d)", count);
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDrawArraysInstanced(count=%d)", count);
return GL_FALSE;
}
xfb_obj->GlesRemainingPrims -= prim_count;
}
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glDrawElementsInstanced(count=%d)", count);
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDrawElementsInstanced(count=%d)", count);
return GL_FALSE;
}
return GL_FALSE;
}
+ if (count == 0)
+ return GL_FALSE;
+
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
}
}
+ /* Draw primitives individually if one count is zero, so we can easily skip
+ * that primitive.
+ */
+ for (i = 0; i < primcount; i++) {
+ if (count[i] == 0) {
+ fallback = GL_TRUE;
+ break;
+ }
+ }
+
/* If the index buffer isn't in a VBO, then treating the application's
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
} else {
/* render one prim at a time */
for (i = 0; i < primcount; i++) {
+ if (count[i] == 0)
+ continue;
ib.count = count[i];
ib.type = type;
ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;