summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state_tcl.c
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-25 16:53:38 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-25 16:54:47 -0700
commit233c6fb694ebd946ae76cb48701adf4d2086b1c1 (patch)
tree0cd181ee2fc719f52e5b46e31aed356132442fca /src/gallium/drivers/r300/r300_state_tcl.c
parentf45a7a1d1f8a576daf02e94ecabfd42f556dd9b4 (diff)
r300-gallium: Fix vertex shader OVM counting.
Attribs must be packed: position, point size, colors, texcoords. Thanks to osiris for pointing it out.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_tcl.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
index bb96e2ad67..d84912de48 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.c
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -34,14 +34,20 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
assembler->tab[decl->DeclarationRange.First] = 0;
break;
case TGSI_SEMANTIC_COLOR:
- assembler->tab[decl->DeclarationRange.First] = 2;
+ assembler->tab[decl->DeclarationRange.First] =
+ (assembler->point_size ? 1 : 0) +
+ assembler->out_colors;
break;
+ case TGSI_SEMANTIC_FOG:
case TGSI_SEMANTIC_GENERIC:
/* XXX multiple? */
- assembler->tab[decl->DeclarationRange.First] = 6;
+ assembler->tab[decl->DeclarationRange.First] =
+ (assembler->point_size ? 1 : 0) +
+ assembler->out_colors +
+ assembler->out_texcoords;
break;
case TGSI_SEMANTIC_PSIZE:
- assembler->tab[decl->DeclarationRange.First] = 15;
+ assembler->tab[decl->DeclarationRange.First] = 1;
break;
default:
debug_printf("r300: vs: Bad semantic declaration %d\n",
@@ -252,6 +258,28 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
}
}
+static void r300_vs_init(struct r300_vertex_shader* vs,
+ struct r300_vs_asm* assembler)
+{
+ struct tgsi_shader_info* info = &vs->info;
+ int i;
+
+ for (i = 0; i < info->num_outputs; i++) {
+ switch (info->output_semantic_name[i]) {
+ case TGSI_SEMANTIC_PSIZE:
+ assembler->point_size = TRUE;
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ assembler->out_colors++;
+ break;
+ case TGSI_SEMANTIC_FOG:
+ case TGSI_SEMANTIC_GENERIC:
+ assembler->out_texcoords++;
+ break;
+ }
+ }
+}
+
void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs)
{
@@ -264,6 +292,10 @@ void r300_translate_vertex_shader(struct r300_context* r300,
if (assembler == NULL) {
return;
}
+
+ /* Init assembler. */
+ r300_vs_init(vs, assembler);
+
/* Setup starting offset for immediates. */
assembler->imm_offset = consts->user_count;