From d4fc35974816a9a6e0a19a05e9b7ff384ee31306 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 24 May 2023 17:43:57 +0200 Subject: [PATCH] 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: 0cf5d1f22620d67659bbd632a2400c3a6956a011 gallium: remove PIPE_CAP_INFO_START_WITH_USER_INDICES and fix all drivers Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt | 1 - src/gallium/drivers/virgl/virgl_context.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt index 1d2e1b48dbe..792ceea0da2 100644 --- a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt +++ b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt @@ -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 diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 398c3655186..399089ca0fd 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -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]);