OSDN Git Service

virgl: work around bad assumptions in virglrenderer
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 11 Dec 2018 14:02:53 +0000 (14:02 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 11 Jan 2019 16:43:42 +0000 (16:43 +0000)
commitd66fcd1969979c7efa1861563236b4c2ff5a2d4d
treee005200c53f5a02d9ee555e16c04f66dba7bffb7
parent31198005ec2589dc1abfa902137ffc3b2c055e02
virgl: work around bad assumptions in virglrenderer

Virglrenderer does the wrong thing when given an instance divisor;
it tries to use the element-index rather than the binding-index as
the argument to glVertexBindingDivisor(). This worked fine as long
as there was a 1:1 relationship between elements and bindings,
which was the case util 19a91841c34 "st/mesa: Use Array._DrawVAO in
st_atom_array.c.".

So let's detect instance divisors, and restore a 1:1 relationship in
that case. This will make old versions of virglrenderer behave
correctly. For newer versions, we can consider making a better
interface, where the instance divisor isn't specified per element,
but rather per binding. But let's save that for another day.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 19a91841c34 "st/mesa: Use Array._DrawVAO in st_atom_array.c."
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-By: Gert Wollny <gert.wollny@collabora.com>
(cherry picked from commit e888f28d1fd9f125fc70b2f5d1b3c42d8f25ae53)
src/gallium/drivers/virgl/virgl_context.c