swr: Fixed an uncommon freed-memory access during state validation
authorBruce Cherniak <bruce.cherniak@intel.com>
Thu, 9 Nov 2017 00:39:37 +0000 (18:39 -0600)
committerGeorge Kyriazis <george.kyriazis@intel.com>
Fri, 10 Nov 2017 14:55:42 +0000 (08:55 -0600)
commitd473f91758143b1dd320146ddfe6e697ccc77c0d
tree55244ae547aaea122985f6967f7cb318542f4a03
parentfecd04a66ae6207a10dbc6885411e89e1e5299d1
swr: Fixed an uncommon freed-memory access during state validation

State validation is performed during clear and draw calls.  Validation
during clear was still accessing vertex buffer state.  When the currently
set vertex buffers are client arrays, this could lead to accessing freed
memory.  Such is the case with the VMD application.

Previously, vertex buffer validation depended on a dirty bit or the
draw info indicating an indexed draw.  This required special handling for
clears.  But, vertex buffer validation still occurred which was unnecessary
and wrong.

Now, only minimal validation is performed during clear, deferring the
remainder to the next draw.  And, by setting the dirty bit in swr_draw_vbo
for indexed draws, vertex buffer validation is only dependent upon a
single dirty bit.

This fixes a bug exposed by the VMD application when changing models.

Reviewed-By: George Kyriazis <george.kyriazis@intel.com>
src/gallium/drivers/swr/swr_draw.cpp
src/gallium/drivers/swr/swr_state.cpp