summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_mesa_to_tgsi.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-07-03 18:53:58 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-07-03 18:53:58 +0200
commit862488075c5537b0613753b0d14c267527fc6199 (patch)
treefd4d51272c86fbc88c12e2d16649547f3ca7b8df /src/mesa/state_tracker/st_mesa_to_tgsi.c
parent060c7f2321f72503c14f9f3f7bb27d59d8a90224 (diff)
parent94e1117c9ba259665cd8e790369dcd4c789a2f93 (diff)
Merge branch 'mesa_7_5_branch'
Conflicts: src/mesa/main/dlist.c src/mesa/vbo/vbo_save_api.c
Diffstat (limited to 'src/mesa/state_tracker/st_mesa_to_tgsi.c')
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 43c9afccc3..3140ebe04a 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -101,8 +101,10 @@ map_register_file(
*/
static GLuint
map_register_file_index(
+ GLuint procType,
GLuint file,
GLuint index,
+ GLuint *swizzle,
const GLuint inputMapping[],
const GLuint outputMapping[],
const GLuint immediateMapping[],
@@ -110,6 +112,20 @@ map_register_file_index(
{
switch( file ) {
case TGSI_FILE_INPUT:
+ if (procType == TGSI_PROCESSOR_FRAGMENT &&
+ index == FRAG_ATTRIB_FOGC) {
+ if (GET_SWZ(*swizzle, 0) == SWIZZLE_X) {
+ /* do nothing we're, ok */
+ } else if (GET_SWZ(*swizzle, 0) == SWIZZLE_Y) {
+ /* replace the swizzle with xxxx */
+ *swizzle = MAKE_SWIZZLE4(SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_X);
+ } else {
+ /* fixme: point coord */
+ }
+ }
/* inputs are mapped according to the user-defined map */
return inputMapping[index];
@@ -236,8 +252,10 @@ compile_instruction(
fulldst = &fullinst->FullDstRegisters[0];
fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL, GL_FALSE );
fulldst->DstRegister.Index = map_register_file_index(
+ procType,
fulldst->DstRegister.File,
inst->DstReg.Index,
+ NULL,
inputMapping,
outputMapping,
NULL,
@@ -246,6 +264,7 @@ compile_instruction(
for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
GLuint j;
+ GLuint swizzle = inst->SrcReg[i].Swizzle;
fullsrc = &fullinst->FullSrcRegisters[i];
@@ -264,8 +283,10 @@ compile_instruction(
immediateMapping,
indirectAccess );
fullsrc->SrcRegister.Index = map_register_file_index(
+ procType,
fullsrc->SrcRegister.File,
inst->SrcReg[i].Index,
+ &swizzle,
inputMapping,
outputMapping,
immediateMapping,
@@ -278,7 +299,7 @@ compile_instruction(
GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE &&
inst->SrcReg[i].Negate != NEGATE_XYZW);
for( j = 0; j < 4; j++ ) {
- swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j );
+ swz[j] = GET_SWZ( swizzle, j );
if (swz[j] > SWIZZLE_W)
extended = GL_TRUE;
}