Skip to content

mesa/draw: Make sure all the unused fields are initialized to zero

Ian Romanick requested to merge idr/mesa:review/initialize-mesa-prim into master

Not initializing prim.indexed caused a few thousand failures on Intel drivers.

I also compared the generated assembly with this change and before a6d31589. The code is still somewhat improved, which I am assuming was the original goal. _mesa_DrawArrays, for example, appears to drop an instruction or two... though the body of the function is only one byte shorter.

MR !3591 (merged) will eventually delete the uninitialized fields. However, I believe that explicitly initializing the whole thing is more future proof. This ensures that if someone adds fields in the future, they will also be initialized. Once the extra fields are removed, the two implementations should generate idential code.

Fixes: a6d31589 ("mesa: don't use memset in glDrawArrays")

@mareko @anholt @kwg @craftyguy

@brianp: I just want to be sure that C99 initializers are acceptable in core Mesa code.

Merge request reports