This relies on the renderer code landing first.
Signed-off-by: Dave Airlie <airlied@redhat.com>
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);
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;
}
/* draw VBO */
#define VIRGL_DRAW_VBO_SIZE 12
+#define VIRGL_DRAW_VBO_SIZE_TESS 14
+#define VIRGL_DRAW_VBO_SIZE_INDIRECT 20
#define VIRGL_DRAW_VBO_START 1
#define VIRGL_DRAW_VBO_COUNT 2
#define VIRGL_DRAW_VBO_MODE 3
#define VIRGL_DRAW_VBO_MIN_INDEX 10
#define VIRGL_DRAW_VBO_MAX_INDEX 11
#define VIRGL_DRAW_VBO_COUNT_FROM_SO 12
+/* tess packet */
+#define VIRGL_DRAW_VBO_VERTICES_PER_PATCH 13
+#define VIRGL_DRAW_VBO_DRAWID 14
+/* indirect packet */
+#define VIRGL_DRAW_VBO_INDIRECT_HANDLE 15
+#define VIRGL_DRAW_VBO_INDIRECT_OFFSET 16
+#define VIRGL_DRAW_VBO_INDIRECT_STRIDE 17
+#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT 18
+#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_OFFSET 19
+#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_HANDLE 20
/* create surface */
#define VIRGL_OBJ_SURFACE_SIZE 5
return vscreen->caps.caps.v1.bset.texture_query_lod;
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
return vscreen->caps.caps.v1.max_texture_gather_components;
+ case PIPE_CAP_DRAW_INDIRECT:
+ return vscreen->caps.caps.v1.bset.has_indirect_draw;
case PIPE_CAP_TEXTURE_GATHER_SM5:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_MAX_VERTEX_STREAMS:
- case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_MULTI_DRAW_INDIRECT:
case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: