From 2ed91e5f8f1ae1b9b7e97588e973a0462809fd9c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 22 Dec 2015 11:40:32 +1000 Subject: ABI break: need to add a new DRAW packet for this --- src/gallium/include/pipe/p_state.h | 1 + src/virgl_protocol.h | 3 ++- src/vrend_decode.c | 2 +- src/vrend_renderer.c | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index e6e38b2..d971777 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -542,6 +542,7 @@ struct pipe_draw_info unsigned start_instance; /**< first instance id */ unsigned instance_count; /**< number of instances */ + unsigned vertices_per_patch; /**< the number of vertices per patch */ /** * For indexed drawing, these fields apply after index lookup. */ diff --git a/src/virgl_protocol.h b/src/virgl_protocol.h index ca3142f..8c906c9 100644 --- a/src/virgl_protocol.h +++ b/src/virgl_protocol.h @@ -274,7 +274,7 @@ enum virgl_context_cmd { #define VIRGL_SET_UNIFORM_BUFFER_RES_HANDLE 5 /* draw VBO */ -#define VIRGL_DRAW_VBO_SIZE 12 +#define VIRGL_DRAW_VBO_SIZE 13 #define VIRGL_DRAW_VBO_START 1 #define VIRGL_DRAW_VBO_COUNT 2 #define VIRGL_DRAW_VBO_MODE 3 @@ -287,6 +287,7 @@ enum virgl_context_cmd { #define VIRGL_DRAW_VBO_MIN_INDEX 10 #define VIRGL_DRAW_VBO_MAX_INDEX 11 #define VIRGL_DRAW_VBO_COUNT_FROM_SO 12 +#define VIRGL_DRAW_VERTICES_PER_PATCH 13 /* create surface */ #define VIRGL_OBJ_SURFACE_SIZE 5 diff --git a/src/vrend_decode.c b/src/vrend_decode.c index 4b0c561..ebde2a2 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -365,7 +365,7 @@ static int vrend_decode_draw_vbo(struct vrend_decode_ctx *ctx, int length) info.restart_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_RESTART_INDEX); info.min_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_MIN_INDEX); info.max_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_MAX_INDEX); - + info.vertices_per_patch = get_buf_entry(ctx, VIRGL_DRAW_VERTICES_PER_PATCH); cso = get_buf_entry(ctx, VIRGL_DRAW_VBO_COUNT_FROM_SO); vrend_draw_vbo(ctx->grctx, &info, cso); diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 791c3d9..e5dfa3b 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2870,6 +2870,10 @@ void vrend_draw_vbo(struct vrend_context *ctx, glPrimitiveRestartIndex(info->restart_index); } } + + if (info->vertices_per_patch) { + glPatchParameteri(GL_PATCH_VERTICES, info->vertices_per_patch); + } /* set the vertex state up now on a delay */ if (!info->indexed) { GLenum mode = info->mode; -- cgit v1.2.3