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>
This commit is contained in:
Gert Wollny
2023-05-24 17:43:57 +02:00
committed by Marge Bot
parent 8ebb9e2c13
commit d4fc359748
2 changed files with 2 additions and 5 deletions

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

@@ -980,13 +980,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)
@@ -994,8 +994,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]);