We might run into ve->count == 0 and last_velement_edgeflag == true in
gen6_3DSTATE_VERTEX_ELEMENTS() when the state tracker sets an invalid
combination of VS and VE (does not seem to happen with st/mesa). Do not
assume ve->count is positive when last_velement_edgeflag is true.
Reported by Coverity.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
dw += 2;
}
- if (last_velement_edgeflag) {
+ if (last_velement_edgeflag && ve->count) {
struct ilo_ve_cso edgeflag;
for (i = 0; i < ve->count - 1; i++)
edgeflag = ve->cso[i];
ve_set_cso_edgeflag(builder->dev, &edgeflag);
memcpy(&dw[2 * i], edgeflag.payload, sizeof(edgeflag.payload));
- }
- else {
+ } else {
for (i = 0; i < ve->count; i++)
memcpy(&dw[2 * i], ve->cso[i].payload, sizeof(ve->cso[i].payload));
}