[virglrenderer-devel] [PATCH 20/21] tessellation/transform feedback: add support for tf from tess
Dave Airlie
airlied at gmail.com
Mon Jun 11 05:11:11 UTC 2018
From: Dave Airlie <airlied at redhat.com>
This adds the so movs emission along with setting the correct
primitive in begin for tessellation shaders
---
src/vrend_renderer.c | 22 +++++++++++++++++++++-
src/vrend_shader.c | 7 ++++++-
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 33883a3..4bad802 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.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;
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 61b7f72..9d838af 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -3033,6 +3033,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;
@@ -3658,7 +3661,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);
--
2.14.3
More information about the virglrenderer-devel
mailing list