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_context.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_context.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_context.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 8d701bb8f40..e6f8dc85256 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -492,6 +492,18 @@ static void *virgl_create_vs_state(struct pipe_context *ctx, return virgl_shader_encoder(ctx, shader, PIPE_SHADER_VERTEX); } +static void *virgl_create_tcs_state(struct pipe_context *ctx, + const struct pipe_shader_state *shader) +{ + return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_CTRL); +} + +static void *virgl_create_tes_state(struct pipe_context *ctx, + const struct pipe_shader_state *shader) +{ + return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_EVAL); +} + static void *virgl_create_gs_state(struct pipe_context *ctx, const struct pipe_shader_state *shader) { @@ -534,6 +546,26 @@ virgl_delete_vs_state(struct pipe_context *ctx, virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER); } +static void +virgl_delete_tcs_state(struct pipe_context *ctx, + void *tcs) +{ + uint32_t handle = (unsigned long)tcs; + struct virgl_context *vctx = virgl_context(ctx); + + virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER); +} + +static void +virgl_delete_tes_state(struct pipe_context *ctx, + void *tes) +{ + uint32_t handle = (unsigned long)tes; + struct virgl_context *vctx = virgl_context(ctx); + + virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER); +} + static void virgl_bind_vs_state(struct pipe_context *ctx, void *vss) { @@ -543,6 +575,24 @@ static void virgl_bind_vs_state(struct pipe_context *ctx, virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_VERTEX); } +static void virgl_bind_tcs_state(struct pipe_context *ctx, + void *vss) +{ + uint32_t handle = (unsigned long)vss; + struct virgl_context *vctx = virgl_context(ctx); + + virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_TESS_CTRL); +} + +static void virgl_bind_tes_state(struct pipe_context *ctx, + void *vss) +{ + uint32_t handle = (unsigned long)vss; + struct virgl_context *vctx = virgl_context(ctx); + + virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_TESS_EVAL); +} + static void virgl_bind_gs_state(struct pipe_context *ctx, void *vss) { @@ -801,6 +851,18 @@ static void virgl_set_clip_state(struct pipe_context *ctx, virgl_encoder_set_clip_state(vctx, clip); } +static void virgl_set_tess_state(struct pipe_context *ctx, + const float default_outer_level[4], + const float default_inner_level[2]) +{ + struct virgl_context *vctx = virgl_context(ctx); + struct virgl_screen *rs = virgl_screen(ctx->screen); + + if (!rs->caps.caps.v1.bset.has_tessellation_shaders) + return; + virgl_encode_set_tess_state(vctx, default_outer_level, default_inner_level); +} + static void virgl_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dst_level, @@ -893,15 +955,22 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen, vctx->base.set_vertex_buffers = virgl_set_vertex_buffers; vctx->base.set_constant_buffer = virgl_set_constant_buffer; + vctx->base.set_tess_state = virgl_set_tess_state; vctx->base.create_vs_state = virgl_create_vs_state; + vctx->base.create_tcs_state = virgl_create_tcs_state; + vctx->base.create_tes_state = virgl_create_tes_state; vctx->base.create_gs_state = virgl_create_gs_state; vctx->base.create_fs_state = virgl_create_fs_state; vctx->base.bind_vs_state = virgl_bind_vs_state; + vctx->base.bind_tcs_state = virgl_bind_tcs_state; + vctx->base.bind_tes_state = virgl_bind_tes_state; vctx->base.bind_gs_state = virgl_bind_gs_state; vctx->base.bind_fs_state = virgl_bind_fs_state; vctx->base.delete_vs_state = virgl_delete_vs_state; + vctx->base.delete_tcs_state = virgl_delete_tcs_state; + vctx->base.delete_tes_state = virgl_delete_tes_state; vctx->base.delete_gs_state = virgl_delete_gs_state; vctx->base.delete_fs_state = virgl_delete_fs_state; |