From: Dave Airlie Date: Mon, 11 Feb 2019 00:51:01 +0000 (+1000) Subject: virgl: add support for ARB_multi_draw_indirect X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=05ff2dbf137c03b7c7e47f606b930e0afddaedee;p=mesa.git virgl: add support for ARB_multi_draw_indirect This will pass the multi draw through to the host if it has support for it instead of using the st to emulate it Reviewed-By: Gert Wollny --- diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index a3029e6f213..a0da36cdb89 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -469,10 +469,13 @@ int virgl_encoder_draw_vbo(struct virgl_context *ctx, if (length == VIRGL_DRAW_VBO_SIZE_INDIRECT) { virgl_encoder_write_res(ctx, virgl_resource(info->indirect->buffer)); virgl_encoder_write_dword(ctx->cbuf, info->indirect->offset); - virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect stride */ - virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count */ - virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count offset */ - virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count handle */ + virgl_encoder_write_dword(ctx->cbuf, info->indirect->stride); /* indirect stride */ + virgl_encoder_write_dword(ctx->cbuf, info->indirect->draw_count); /* indirect draw count */ + virgl_encoder_write_dword(ctx->cbuf, info->indirect->indirect_draw_count_offset); /* indirect draw count offset */ + if (info->indirect->indirect_draw_count) + virgl_encoder_write_res(ctx, virgl_resource(info->indirect->indirect_draw_count)); + else + virgl_encoder_write_dword(ctx->cbuf, 0); /* indirect draw count handle */ } return 0; } diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h index e193752c498..1cd7bf01aa6 100644 --- a/src/gallium/drivers/virgl/virgl_hw.h +++ b/src/gallium/drivers/virgl/virgl_hw.h @@ -238,6 +238,7 @@ enum virgl_formats { #define VIRGL_CAP_FBO_MIXED_COLOR_FORMATS (1 << 18) #define VIRGL_CAP_FAKE_FP64 (1 << 19) #define VIRGL_CAP_BIND_COMMAND_ARGS (1 << 20) +#define VIRGL_CAP_MULTI_DRAW_INDIRECT (1 << 21) #define VIRGL_CAP_TRANSFORM_FEEDBACK3 (1 << 23) /* virgl bind flags - these are compatible with mesa 10.5 gallium. diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 5dd7f559948..edcc4aa374d 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -271,11 +271,12 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) /* If the host supports only one sample (e.g., if it is using softpipe), * fake multisampling to able to advertise higher GL versions. */ return (vscreen->caps.caps.v1.max_samples == 1) ? 1 : 0; + case PIPE_CAP_MULTI_DRAW_INDIRECT: + return !!(vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_MULTI_DRAW_INDIRECT); case PIPE_CAP_TEXTURE_GATHER_SM5: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: - case PIPE_CAP_MULTI_DRAW_INDIRECT: case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS: case PIPE_CAP_CLIP_HALFZ: case PIPE_CAP_VERTEXID_NOBASE: