tessellation/transform feedback: add support for tf from tess

This adds the so movs emission along with setting the correct
primitive in begin for tessellation shaders

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 d20856a664
commit d206f5a9be
  1. 22
      src/vrend_renderer.c
  2. 7
      src/vrend_shader.c

@ -927,7 +927,8 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
if (gs->id > 0)
glAttachShader(prog_id, gs->id);
set_stream_out_varyings(prog_id, &gs->sel->sinfo);
}
} else if (tes)
set_stream_out_varyings(prog_id, &tes->sel->sinfo);
else
set_stream_out_varyings(prog_id, &vs->sel->sinfo);
glAttachShader(prog_id, fs->id);
@ -2773,6 +2774,22 @@ static GLenum get_gs_xfb_mode(GLenum mode)
}
}
static GLenum get_tess_xfb_mode(int mode, bool is_point_mode)
{
if (is_point_mode)
return GL_POINTS;
switch (mode) {
case GL_QUADS:
case GL_TRIANGLES:
return GL_TRIANGLES;
case GL_LINES:
return GL_LINES;
default:
fprintf(stderr, "illegal gs transform feedback mode %d\n", mode);
return GL_POINTS;
}
}
static GLenum get_xfb_mode(GLenum mode)
{
switch (mode) {
@ -3225,6 +3242,9 @@ void vrend_draw_vbo(struct vrend_context *ctx,
if (ctx->sub->current_so->xfb_state == XFB_STATE_STARTED_NEED_BEGIN) {
if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY])
glBeginTransformFeedback(get_gs_xfb_mode(ctx->sub->shaders[PIPE_SHADER_GEOMETRY]->sinfo.gs_out_prim));
else if (ctx->sub->shaders[PIPE_SHADER_TESS_EVAL])
glBeginTransformFeedback(get_tess_xfb_mode(ctx->sub->shaders[PIPE_SHADER_TESS_EVAL]->sinfo.tes_prim,
ctx->sub->shaders[PIPE_SHADER_TESS_EVAL]->sinfo.tes_point_mode));
else
glBeginTransformFeedback(get_xfb_mode(info->mode));
ctx->sub->current_so->xfb_state = XFB_STATE_STARTED;

@ -3049,6 +3049,9 @@ iter_instruction(struct tgsi_iterate_context *iter,
if (ret)
return FALSE;
} else if (iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL) {
if (ctx->so && !ctx->key->gs_present)
if (emit_so_movs(ctx))
return FALSE;
ret = emit_clip_dist_movs(ctx);
if (ret)
return FALSE;
@ -3674,7 +3677,9 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
snprintf(outtype, 6, "float");
else
snprintf(outtype, 6, "vec%d", ctx->so->output[i].num_components);
if (ctx->so->output[i].stream && ctx->prog_type == TGSI_PROCESSOR_GEOMETRY)
if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL)
snprintf(buf, 255, "out %s tfout%d[];\n", outtype, i);
else if (ctx->so->output[i].stream && ctx->prog_type == TGSI_PROCESSOR_GEOMETRY)
snprintf(buf, 255, "layout (stream=%d) out %s tfout%d;\n", ctx->so->output[i].stream, outtype, i);
else
snprintf(buf, 255, "out %s tfout%d;\n", outtype, i);

Loading…
Cancel
Save