virgl: Fix IB upload when a start >0 is given

We don't need to add an offset in the buffer, because we submit
the offset where the data was written to to the host. The
correction of this offset is also not needed and results in draw
errors.

Fixes: 0cf5d1f226
  gallium: remove PIPE_CAP_INFO_START_WITH_USER_INDICES and fix all drivers

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23196>
(cherry picked from commit d4fc359748)
This commit is contained in:
Gert Wollny 2023-05-24 17:43:57 +02:00 committed by Eric Engestrom
parent 333620d55a
commit 63b4c80c90
3 changed files with 3 additions and 6 deletions

View file

@ -2425,7 +2425,7 @@
"description": "virgl: Fix IB upload when a start >0 is given",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "0cf5d1f22620d67659bbd632a2400c3a6956a011"
},

View file

@ -210,7 +210,6 @@ spec@!opengl 1.2@texwrap 3d bordercolor@GL_RGBA8- border color only,Fail
spec@!opengl 1.2@texwrap 3d proj bordercolor,Fail
spec@!opengl 1.2@texwrap 3d proj bordercolor@GL_RGBA8- projected- border color only,Fail
spec@!opengl 1.5@depth-tex-compare,Fail
spec@!opengl 1.5@draw-elements-user,Fail
spec@!opengl 2.0@gl-2.0-edgeflag,Fail
spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Fail
spec@!opengl 3.2@layered-rendering@clear-color-mismatched-layer-count,Fail

View file

@ -981,13 +981,13 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
if (ib.user_buffer) {
unsigned start_offset = draws[0].start * ib.index_size;
u_upload_data(vctx->uploader, start_offset,
u_upload_data(vctx->uploader, 0,
draws[0].count * ib.index_size, 4,
(char*)ib.user_buffer + start_offset,
&ib.offset, &ib.buffer);
ib.offset -= start_offset;
ib.user_buffer = NULL;
}
virgl_hw_set_index_buffer(vctx, &ib);
}
if (!vctx->num_draws)
@ -995,8 +995,6 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
vctx->num_draws++;
virgl_hw_set_vertex_buffers(vctx);
if (info.index_size)
virgl_hw_set_index_buffer(vctx, &ib);
virgl_encoder_draw_vbo(vctx, &info, drawid_offset, indirect, &draws[0]);