summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-23 09:56:20 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-23 09:56:20 -0600
commit93f553ed4d94a13ca1bc9c1ed962bd6963cd9ec6 (patch)
treeb92d19be13f9d44b7cb1e74bd22203fa359b63ff
parent0aa0141e0cd7b5231140805b1cda821bb3d32a86 (diff)
gallium: fix translation of extended swizzles, per-component negation
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 150545dfad..9029f12056 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -39,8 +39,6 @@
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
-#define TGSI_DEBUG 0
-
/*
* Map mesa register file to TGSI register file.
@@ -56,8 +54,8 @@ map_register_file(
return TGSI_FILE_NULL;
case PROGRAM_TEMPORARY:
return TGSI_FILE_TEMPORARY;
- //case PROGRAM_LOCAL_PARAM:
- //case PROGRAM_ENV_PARAM:
+ /*case PROGRAM_LOCAL_PARAM:*/
+ /*case PROGRAM_ENV_PARAM:*/
/* Because of the longstanding problem with mesa arb shaders
* where constants, immediates and state variables are all
@@ -230,21 +228,27 @@ compile_instruction(
outputMapping,
immediateMapping);
- for( j = 0; j < 4; j++ ) {
- GLuint swz;
-
- swz = GET_SWZ( inst->SrcReg[i].Swizzle, j );
- if( swz > SWIZZLE_W ) {
- tgsi_util_set_src_register_extswizzle(
- &fullsrc->SrcRegisterExtSwz,
- swz,
- j );
+ /* swizzle (ext swizzle also depends on negation) */
+ {
+ GLuint swz[4];
+ GLboolean extended = (inst->SrcReg[i].NegateBase != NEGATE_NONE &&
+ inst->SrcReg[i].NegateBase != NEGATE_XYZW);
+ for( j = 0; j < 4; j++ ) {
+ swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j );
+ if (swz[j] > SWIZZLE_W)
+ extended = GL_TRUE;
+ }
+ if (extended) {
+ for (j = 0; j < 4; j++) {
+ tgsi_util_set_src_register_extswizzle(&fullsrc->SrcRegisterExtSwz,
+ swz[j], j);
+ }
}
else {
- tgsi_util_set_src_register_swizzle(
- &fullsrc->SrcRegister,
- swz,
- j );
+ for (j = 0; j < 4; j++) {
+ tgsi_util_set_src_register_swizzle(&fullsrc->SrcRegister,
+ swz[j], j);
+ }
}
}