Skip to content

vrend: check the pointer when checking index buffer update

Gert Wollny requested to merge gerddie/virglrenderer:fix-buffer-caching into main

So far the ID of the currently bound index buffer was kept in the sub context, and if a new index buffer was to be bound, we would check the ID and not do anything, if the new buffer had the same ID.

This is fine, if the ID is created by the guest, however, with protocol version 3 resource IDs are generated at the host and they may be re-used.

Now destroying a buffer in the guest would result in destroying the corresponding buffer-resource in virglrenderer, but if the buffer was bound as index buffer in the OpenGL context, its backing OpenGL resource will not be destroyed. If now a new buffer is created it might get the same resource ID like the buffer that was just destroyed, and if one then tries to bind it as index buffer, nothing will be done because the IDs match.

Such a case is actually triggered by the piglit spec@arb_query_buffer_object@coherency

To avoid this, don't check the resource IDs, but the actual buffer resource pointer.

In addition update the host_feature_check_version to signal the guest that using protocol version 3 can be enabled.

These changes are required by mesa/mesa!31624 (merged) to get blob support with VirGL/vtest.

Edited by Gert Wollny

Merge request reports

Loading