diff options
author | Zack Rusin <zack@kde.org> | 2009-07-01 10:42:58 -0400 |
---|---|---|
committer | Zack Rusin <zack@kde.org> | 2009-07-01 10:45:55 -0400 |
commit | 1c04731b8721850b6abb12a43a3eec616b850e86 (patch) | |
tree | 1b172fcb4b651718b39a613c2267b76b457ccf8e /src/gallium | |
parent | e8c4663c11cfbb80ed23b1581cf1f3ccaef28bce (diff) |
gallium: fix the front face semantics
mesa allocates both frontface and pointcoord registers within the fog
coordinate register, by using swizzling. to make it cleaner and easier
for drivers we want each of them in its own register. so when doing
compilation from the mesa IR to tgsi allocate new registers for both
and add new semantics to the respective declarations.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_setup.c | 27 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_derived.c | 1 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_shader_tokens.h | 3 |
3 files changed, 15 insertions, 16 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index e5be65242d..1eb23cd6b6 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -785,11 +785,10 @@ static void setup_tri_coefficients( struct setup_context *setup ) assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } } @@ -1096,11 +1095,10 @@ setup_line_coefficients(struct setup_context *setup, assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } return TRUE; @@ -1342,11 +1340,10 @@ setup_point( struct setup_context *setup, assert(0); } - if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) { - /* FOG.y = front/back facing XXX fix this */ - setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing; - setup->coef[fragSlot].dadx[1] = 0.0; - setup->coef[fragSlot].dady[1] = 0.0; + if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { + setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].dadx[0] = 0.0; + setup->coef[fragSlot].dady[0] = 0.0; } } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 6b6a4c3ff3..75551000c9 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -110,6 +110,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) break; case TGSI_SEMANTIC_GENERIC: + case TGSI_SEMANTIC_FACE: /* this includes texcoords and varying vars */ src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC, spfs->info.input_semantic_index[i]); diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 4dafdd6f0a..b00cfe3423 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -131,7 +131,8 @@ struct tgsi_declaration_range #define TGSI_SEMANTIC_PSIZE 4 #define TGSI_SEMANTIC_GENERIC 5 #define TGSI_SEMANTIC_NORMAL 6 -#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */ +#define TGSI_SEMANTIC_FACE 7 +#define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */ struct tgsi_declaration_semantic { |