tessellation: add protocol support for set tess state. (v2)

This passes the default tessellation factors from the guest to
the host.

v2: fix warnings

Tested-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 2d02aadc6e
commit 05554838b0
  1. 4
      src/virgl_protocol.h
  2. 19
      src/vrend_decode.c
  3. 8
      src/vrend_renderer.c
  4. 2
      src/vrend_renderer.h

@ -83,6 +83,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_CREATE_SUB_CTX,
VIRGL_CCMD_DESTROY_SUB_CTX,
VIRGL_CCMD_BIND_SHADER,
VIRGL_CCMD_SET_TESS_STATE,
};
/*
@ -481,4 +482,7 @@ enum virgl_context_cmd {
#define VIRGL_BIND_SHADER_HANDLE 1
#define VIRGL_BIND_SHADER_TYPE 2
/* tess state */
#define VIRGL_TESS_STATE_SIZE 6
#endif

@ -1050,6 +1050,22 @@ static int vrend_decode_bind_shader(struct vrend_decode_ctx *ctx, int length)
return 0;
}
static int vrend_decode_set_tess_state(struct vrend_decode_ctx *ctx,
int length)
{
float tess_factors[6];
int i;
if (length != VIRGL_TESS_STATE_SIZE)
return EINVAL;
for (i = 0; i < 6; i++) {
tess_factors[i] = uif(get_buf_entry(ctx, i + 1));
}
vrend_set_tess_state(ctx->grctx, tess_factors);
return 0;
}
static int vrend_decode_set_streamout_targets(struct vrend_decode_ctx *ctx,
uint16_t length)
{
@ -1272,6 +1288,9 @@ int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
case VIRGL_CCMD_BIND_SHADER:
ret = vrend_decode_bind_shader(gdctx, len);
break;
case VIRGL_CCMD_SET_TESS_STATE:
ret = vrend_decode_set_tess_state(gdctx, len);
break;
default:
ret = EINVAL;
}

@ -5791,6 +5791,14 @@ void vrend_set_sample_mask(UNUSED struct vrend_context *ctx, unsigned sample_mas
glSampleMaski(0, sample_mask);
}
void vrend_set_tess_state(UNUSED struct vrend_context *ctx, const float tess_factors[6])
{
if (vrend_state.have_tessellation) {
glPatchParameterfv(GL_PATCH_DEFAULT_OUTER_LEVEL, tess_factors);
glPatchParameterfv(GL_PATCH_DEFAULT_INNER_LEVEL, &tess_factors[4]);
}
}
static void vrend_hw_emit_streamout_targets(UNUSED struct vrend_context *ctx, struct vrend_streamout_object *so_obj)
{
uint i;

@ -276,6 +276,8 @@ void vrend_set_uniform_buffer(struct vrend_context *ctx, uint32_t shader,
uint32_t index, uint32_t offset, uint32_t length,
uint32_t res_handle);
void vrend_set_tess_state(struct vrend_context *ctx, const float tess_factors[6]);
void vrend_renderer_fini(void);
int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw);

Loading…
Cancel
Save