diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index ca2fe487b35..72f0a9aaceb 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -1091,10 +1091,16 @@ nv50_set_vertex_buffers(struct pipe_context *pipe, unbind_num_trailing_slots, take_ownership); + unsigned clear_mask = ~u_bit_consecutive(start_slot + count, unbind_num_trailing_slots); + nv50->vbo_user &= clear_mask; + nv50->vbo_constant &= clear_mask; + nv50->vtxbufs_coherent &= clear_mask; + if (!vb) { - nv50->vbo_user &= ~(((1ull << count) - 1) << start_slot); - nv50->vbo_constant &= ~(((1ull << count) - 1) << start_slot); - nv50->vtxbufs_coherent &= ~(((1ull << count) - 1) << start_slot); + clear_mask = ~u_bit_consecutive(start_slot, count); + nv50->vbo_user &= clear_mask; + nv50->vbo_constant &= clear_mask; + nv50->vtxbufs_coherent &= clear_mask; return; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index 452c7f072a5..9676016c5b7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -1012,10 +1012,16 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, unbind_num_trailing_slots, take_ownership); + unsigned clear_mask = ~u_bit_consecutive(start_slot + count, unbind_num_trailing_slots); + nvc0->vbo_user &= clear_mask; + nvc0->constant_vbos &= clear_mask; + nvc0->vtxbufs_coherent &= clear_mask; + if (!vb) { - nvc0->vbo_user &= ~(((1ull << count) - 1) << start_slot); - nvc0->constant_vbos &= ~(((1ull << count) - 1) << start_slot); - nvc0->vtxbufs_coherent &= ~(((1ull << count) - 1) << start_slot); + clear_mask = ~u_bit_consecutive(start_slot, count); + nvc0->vbo_user &= clear_mask; + nvc0->constant_vbos &= clear_mask; + nvc0->vtxbufs_coherent &= clear_mask; return; }