iris: Properly unreference extra VBOs for draw parameters
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 8 Oct 2019 17:11:52 +0000 (10:11 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 8 Oct 2019 18:14:21 +0000 (11:14 -0700)
bound_vertex_buffers doesn't include extra draw parameters buffers.
Tracking this correctly is kind of complicated, and iris_destroy_state
isn't exactly in a hot path, so just loop over all VBO bindings.

Fixes: 4122665dd90 (iris: Enable ARB_shader_draw_parameters support)
Reported-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
src/gallium/drivers/iris/iris_state.c

index ab1578fc1848aa9b8c41f1e3da0b6c365e3cbeb8..6f0aa18233964b62f98313f5ebd73516d9fb9576 100644 (file)
@@ -6045,11 +6045,11 @@ iris_destroy_state(struct iris_context *ice)
    pipe_resource_reference(&ice->draw.draw_params.res, NULL);
    pipe_resource_reference(&ice->draw.derived_draw_params.res, NULL);
 
-   uint64_t bound_vbs = ice->state.bound_vertex_buffers;
-   while (bound_vbs) {
-      const int i = u_bit_scan64(&bound_vbs);
+   /* Loop over all VBOs, including ones for draw parameters */
+   for (unsigned i = 0; i < ARRAY_SIZE(genx->vertex_buffers); i++) {
       pipe_resource_reference(&genx->vertex_buffers[i].resource, NULL);
    }
+
    free(ice->state.genx);
 
    for (int i = 0; i < 4; i++) {