diff options
author | Zack Rusin <[email protected]> | 2007-10-30 06:33:30 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-10-30 06:33:30 -0400 |
commit | ea2c74a25ef4d8bd0cb6fab21913c6a32bcee26f (patch) | |
tree | bd8f3a0ecb8f61ee7daf87777567011f66169b09 /src | |
parent | a94251d081b202e81bcd51db0dd35f1aec82b0c5 (diff) |
Code cleanups.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.cpp | 37 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.h | 2 |
2 files changed, 22 insertions, 17 deletions
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp index 94fc708606b..e7cfeb2c917 100644 --- a/src/mesa/pipe/llvm/llvmtgsi.cpp +++ b/src/mesa/pipe/llvm/llvmtgsi.cpp @@ -164,11 +164,28 @@ translate_immediate(Storage *storage, assert( 0 ); } } - printf("-------------- VEC = %f %f %f %f\n", - vec[0], vec[1], vec[2], vec[3]); storage->addImmediate(vec); } +static inline llvm::Value * +swizzleVector(llvm::Value *val, struct tgsi_full_src_register *src, + Storage *storage) +{ + int swizzle = 0; + int start = 1000; + const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 + + TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W; + for (int k = 0; k < 4; ++k) { + swizzle += tgsi_util_get_full_src_register_extswizzle(src, k) * start; + start /= 10; + } + if (swizzle != NO_SWIZZLE) { + /*fprintf(stderr, "XXXXXXXX swizzle = %d\n", swizzle);*/ + val = storage->shuffleVector(val, swizzle); + } + return val; +} + static void translate_instruction(llvm::Module *module, Storage *storage, @@ -207,19 +224,7 @@ translate_instruction(llvm::Module *module, return; } - int swizzle = 0; - int xstart = 1000; - const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 + - TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W; - for (int k = 0; k < 4; ++k) { - swizzle += tgsi_util_get_full_src_register_extswizzle(src, k) * xstart; - xstart /= 10; - } - if (swizzle != NO_SWIZZLE) { - /*fprintf(stderr, "XXXXXXXX swizzle = %d\n", swizzle);*/ - val = storage->shuffleVector(val, swizzle); - } - inputs[i] = val; + inputs[i] = swizzleVector(val, src, storage); } /*if (inputs[0]) @@ -611,6 +616,7 @@ translate_instruction(llvm::Module *module, assert(!"Unsupported opcode"); } + /* # not sure if we need this */ switch( inst->Instruction.Saturate ) { case TGSI_SAT_NONE: break; @@ -624,6 +630,7 @@ translate_instruction(llvm::Module *module, assert( 0 ); } + /* store results */ for (int i = 0; i < inst->Instruction.NumDstRegs; ++i) { struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; diff --git a/src/mesa/pipe/llvm/llvmtgsi.h b/src/mesa/pipe/llvm/llvmtgsi.h index a76dfd60b5c..dadc0ea4553 100644 --- a/src/mesa/pipe/llvm/llvmtgsi.h +++ b/src/mesa/pipe/llvm/llvmtgsi.h @@ -41,9 +41,7 @@ extern "C" { #ifdef MESA_LLVM -struct tgsi_exec_machine; struct tgsi_token; -struct tgsi_sampler; struct gallivm_prog; struct gallivm_cpu_engine; |