diff options
author | Dave Airlie <[email protected]> | 2018-06-08 14:38:14 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-06-14 10:36:31 +1000 |
commit | 7b6f2704eb7333689531cc1572648a31319cb5ac (patch) | |
tree | 74c0a026138877d905f31562dd79cd80166f127b /src/gallium/drivers/virgl/virgl_encode.c | |
parent | babd1d526be4690204964f5e0a42f5df12f7f83b (diff) |
virgl: add ARB_tessellation_shader support. (v2)
This should add all the pieces to enable tess shaders on virgl.
v2: fixup transform to handle tess and strip out precise.
set default for max patch varyings to work around issue when
tess gets enabled from v1 caps but v2 caps aren't in place. (Elie)
Reviewed-by: Elie Tournier <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_encode.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index f3cbd1ca4b0..ad018bd1964 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -419,6 +419,8 @@ int virgl_encoder_draw_vbo(struct virgl_context *ctx, const struct pipe_draw_info *info) { uint32_t length = VIRGL_DRAW_VBO_SIZE; + if (info->mode == PIPE_PRIM_PATCHES) + length = VIRGL_DRAW_VBO_SIZE_TESS; if (info->indirect) length = VIRGL_DRAW_VBO_SIZE_INDIRECT; virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_DRAW_VBO, 0, length)); @@ -437,9 +439,11 @@ 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_TESS) { + virgl_encoder_write_dword(ctx->cbuf, info->vertices_per_patch); /* vertices per patch */ + virgl_encoder_write_dword(ctx->cbuf, info->drawid); /* drawid */ + } 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 */ @@ -891,3 +895,16 @@ int virgl_encode_bind_shader(struct virgl_context *ctx, virgl_encoder_write_dword(ctx->cbuf, type); return 0; } + +int virgl_encode_set_tess_state(struct virgl_context *ctx, + const float outer[4], + const float inner[2]) +{ + int i; + virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_TESS_STATE, 0, 6)); + for (i = 0; i < 4; i++) + virgl_encoder_write_dword(ctx->cbuf, fui(outer[i])); + for (i = 0; i < 2; i++) + virgl_encoder_write_dword(ctx->cbuf, fui(inner[i])); + return 0; +} |