summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-04-05 01:32:55 -0700
committerCorbin Simpson <[email protected]>2009-04-05 01:32:55 -0700
commit84d76607ec0e43edd7dd28d1d5b6a538fd087434 (patch)
tree62d2e473f37aa2deac51d9b89bad9ec02874a0a0 /src/gallium/drivers
parent50ee103cf02b66d68a2728840c9c2f990773576b (diff)
r300-gallium: vs: Use a tab to properly set up OVM.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.c55
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.h6
2 files changed, 17 insertions, 44 deletions
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
index d0dc4ef1114..a00abfd02fd 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.c
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -27,12 +27,18 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
{
switch (decl->Declaration.File) {
case TGSI_FILE_INPUT:
+ break;
+ case TGSI_FILE_OUTPUT:
switch (decl->Semantic.SemanticName) {
+ case TGSI_SEMANTIC_POSITION:
+ assembler->tab[decl->DeclarationRange.First] = 0;
+ break;
case TGSI_SEMANTIC_COLOR:
- assembler->color_count++;
+ assembler->tab[decl->DeclarationRange.First] = 2;
break;
case TGSI_SEMANTIC_GENERIC:
- assembler->tex_count++;
+ /* XXX multiple? */
+ assembler->tab[decl->DeclarationRange.First] = 6;
break;
default:
debug_printf("r300: vs: Bad semantic declaration %d\n",
@@ -40,7 +46,6 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
break;
}
break;
- case TGSI_FILE_OUTPUT:
case TGSI_FILE_CONSTANT:
break;
case TGSI_FILE_TEMPORARY:
@@ -50,8 +55,6 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
debug_printf("r300: vs: Bad file %d\n", decl->Declaration.File);
break;
}
-
- assembler->temp_offset = assembler->color_count + assembler->tex_count;
}
static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
@@ -88,46 +91,15 @@ static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler,
return 0;
}
-static INLINE unsigned r300_vs_src(struct r300_vs_asm* assembler,
- struct tgsi_src_register* src)
-{
- switch (src->File) {
- case TGSI_FILE_NULL:
- return 0;
- case TGSI_FILE_INPUT:
- /* XXX may be wrong */
- return src->Index;
- break;
- case TGSI_FILE_TEMPORARY:
- return src->Index + assembler->temp_offset;
- break;
- case TGSI_FILE_IMMEDIATE:
- return (src->Index + assembler->imm_offset) | (1 << 8);
- break;
- case TGSI_FILE_CONSTANT:
- /* XXX magic */
- return src->Index | (1 << 8);
- break;
- default:
- debug_printf("r300: vs: Unimplemented src %d\n", src->File);
- break;
- }
- return 0;
-}
-
static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler,
struct tgsi_dst_register* dst)
{
switch (dst->File) {
- case TGSI_FILE_NULL:
- /* This happens during KIL instructions. */
- return 0;
+ case TGSI_FILE_TEMPORARY:
+ return dst->Index;
break;
case TGSI_FILE_OUTPUT:
- return 0;
- break;
- case TGSI_FILE_TEMPORARY:
- return dst->Index + assembler->temp_offset;
+ return assembler->tab[dst->Index];
break;
default:
debug_printf("r300: vs: Unimplemented dst %d\n", dst->File);
@@ -161,7 +133,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
int i = vs->instruction_count;
vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) |
- R300_PVS_DST_OFFSET(dst->DstRegister.Index);
+ R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister));
switch (count) {
case 3:
vs->instructions[i].inst3 =
@@ -265,6 +237,9 @@ void r300_translate_vertex_shader(struct r300_context* r300,
"%d from user and %d from immediates\n", consts->count,
consts->user_count, assembler->imm_count);
+ debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0],
+ assembler->tab[1], assembler->tab[2], assembler->tab[3]);
+
tgsi_dump(vs->state.tokens);
/* XXX finish r300 vertex shader dumper */
r300_vs_dump(vs);
diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
index ae8ff6c3147..75fe44aec50 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.h
+++ b/src/gallium/drivers/r300/r300_state_tcl.h
@@ -87,10 +87,6 @@ struct r300_vs_asm {
unsigned color_count;
/* Number of texcoords. */
unsigned tex_count;
- /* Offset for temporary registers. Inputs and temporaries have no
- * distinguishing markings, so inputs start at 0 and the first usable
- * temporary register is after all inputs. */
- unsigned temp_offset;
/* Number of requested temporary registers. */
unsigned temp_count;
/* Offset for immediate constants. Neither R300 nor R500 can do four
@@ -99,6 +95,8 @@ struct r300_vs_asm {
unsigned imm_offset;
/* Number of immediate constants. */
unsigned imm_count;
+ /* Offsets into vertex output memory. */
+ unsigned tab[16];
};
static struct r300_vertex_shader r300_passthrough_vertex_shader = {