From 5ce0598a034179eaacff96f39eaebf0ba0f30d4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 3 Apr 2012 22:37:30 +0200 Subject: [PATCH] r300g/swtcl: don't print an error when getting ClipVertex Draw can do it just fine. --- src/gallium/drivers/r300/r300_state.c | 4 ++-- src/gallium/drivers/r300/r300_vs.c | 16 +++++++++++++--- src/gallium/drivers/r300/r300_vs.h | 5 +++-- src/gallium/drivers/r300/r300_vs_draw.c | 5 +++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 940443050ba..a623ff898a7 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1759,10 +1759,10 @@ static void* r300_create_vs_state(struct pipe_context* pipe, vs->state.tokens = tgsi_dup_tokens(shader->tokens); if (r300->screen->caps.has_tcl) { - r300_init_vs_outputs(vs); + r300_init_vs_outputs(r300, vs); r300_translate_vertex_shader(r300, vs); } else { - r300_draw_init_vertex_shader(r300->draw, vs); + r300_draw_init_vertex_shader(r300, vs); } return vs; diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 1eef071c87f..4faf2b58b0f 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -36,6 +36,7 @@ /* Convert info about VS output semantics into r300_shader_semantics. */ static void r300_shader_read_vs_outputs( + struct r300_context *r300, struct tgsi_shader_info* info, struct r300_shader_semantics* vs_outputs) { @@ -83,6 +84,14 @@ static void r300_shader_read_vs_outputs( fprintf(stderr, "r300 VP: cannot handle edgeflag output.\n"); break; + case TGSI_SEMANTIC_CLIPVERTEX: + assert(index == 0); + /* Draw does clip vertex for us. */ + if (r300->screen->caps.has_tcl) { + fprintf(stderr, "r300 VP: cannot handle clip vertex output.\n"); + } + break; + default: fprintf(stderr, "r300 VP: unknown vertex output semantic: %i.\n", info->output_semantic_name[i]); @@ -160,10 +169,11 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) c->code->outputs[outputs->wpos] = reg++; } -void r300_init_vs_outputs(struct r300_vertex_shader *vs) +void r300_init_vs_outputs(struct r300_context *r300, + struct r300_vertex_shader *vs) { tgsi_scan_shader(vs->state.tokens, &vs->info); - r300_shader_read_vs_outputs(&vs->info, &vs->outputs); + r300_shader_read_vs_outputs(r300, &vs->info, &vs->outputs); } static void r300_dummy_vertex_shader( @@ -187,7 +197,7 @@ static void r300_dummy_vertex_shader( ureg_destroy(ureg); shader->dummy = TRUE; - r300_init_vs_outputs(shader); + r300_init_vs_outputs(r300, shader); r300_translate_vertex_shader(r300, shader); } diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h index a482ddce9c9..b02d5d79731 100644 --- a/src/gallium/drivers/r300/r300_vs.h +++ b/src/gallium/drivers/r300/r300_vs.h @@ -56,12 +56,13 @@ struct r300_vertex_shader { void *draw_vs; }; -void r300_init_vs_outputs(struct r300_vertex_shader *vs); +void r300_init_vs_outputs(struct r300_context *r300, + struct r300_vertex_shader *vs); void r300_translate_vertex_shader(struct r300_context *r300, struct r300_vertex_shader *vs); -void r300_draw_init_vertex_shader(struct draw_context *draw, +void r300_draw_init_vertex_shader(struct r300_context *r300, struct r300_vertex_shader *vs); #endif /* R300_VS_H */ diff --git a/src/gallium/drivers/r300/r300_vs_draw.c b/src/gallium/drivers/r300/r300_vs_draw.c index 2939963c355..ce85a0c843d 100644 --- a/src/gallium/drivers/r300/r300_vs_draw.c +++ b/src/gallium/drivers/r300/r300_vs_draw.c @@ -309,9 +309,10 @@ static void transform_inst(struct tgsi_transform_context *ctx, ctx->emit_instruction(ctx, inst); } -void r300_draw_init_vertex_shader(struct draw_context *draw, +void r300_draw_init_vertex_shader(struct r300_context *r300, struct r300_vertex_shader *vs) { + struct draw_context *draw = r300->draw; struct pipe_shader_state new_vs; struct vs_transform_context transform; const uint newLen = tgsi_num_tokens(vs->state.tokens) + 100 /* XXX */; @@ -350,7 +351,7 @@ void r300_draw_init_vertex_shader(struct draw_context *draw, vs->state.tokens = new_vs.tokens; /* Init the VS output table for the rasterizer. */ - r300_init_vs_outputs(vs); + r300_init_vs_outputs(r300, vs); /* Make the last generic be WPOS. */ vs->outputs.wpos = vs->outputs.generic[transform.last_generic + 1]; -- 2.30.2