diff options
author | Dave Airlie <[email protected]> | 2018-02-13 13:57:28 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-02-14 13:06:07 +1000 |
commit | 9b95b70719bfd19e57a8ae89065eac84f513d297 (patch) | |
tree | 6b99fd6f95589cd8561ab4ed0e4aa0e7f085229a /src/gallium/drivers/virgl/virgl_encode.c | |
parent | f6718baabc7d6fed0d41f72fb22e57c0d67fbf1d (diff) |
virgl: add ARB_draw_indirect support.
This relies on the renderer code landing first.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index ee68fe068f5..2ee8eac771c 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -417,7 +417,10 @@ int virgl_encoder_set_index_buffer(struct virgl_context *ctx, int virgl_encoder_draw_vbo(struct virgl_context *ctx, const struct pipe_draw_info *info) { - virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_DRAW_VBO, 0, VIRGL_DRAW_VBO_SIZE)); + uint32_t length = VIRGL_DRAW_VBO_SIZE; + if (info->indirect) + length = VIRGL_DRAW_VBO_SIZE_INDIRECT; + virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_DRAW_VBO, 0, length)); virgl_encoder_write_dword(ctx->cbuf, info->start); virgl_encoder_write_dword(ctx->cbuf, info->count); virgl_encoder_write_dword(ctx->cbuf, info->mode); @@ -433,6 +436,16 @@ int virgl_encoder_draw_vbo(struct virgl_context *ctx, virgl_encoder_write_dword(ctx->cbuf, info->count_from_stream_output->buffer_size); else virgl_encoder_write_dword(ctx->cbuf, 0); + if (length == VIRGL_DRAW_VBO_SIZE_INDIRECT) { + virgl_encoder_write_dword(ctx->cbuf, 0); /* vertices per patch */ + virgl_encoder_write_dword(ctx->cbuf, 0); /* drawid */ + 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 */ + } return 0; } |