X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fr300%2Fr300_tgsi_to_rc.c;h=21a1c45982d3b09d7ca54c24ca0d19dfc6d71ed5;hb=905fa3a07bdd3615e67b5d19708f96f124600066;hp=1c82fccd9c09429d7c6914c30f62b9b74b020d63;hpb=dbc13401915b345df584a621b1b2aaa9030bfac5;p=mesa.git diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 1c82fccd9c0..21a1c45982d 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -25,12 +25,11 @@ #include "radeon_compiler.h" #include "radeon_program.h" +#include "tgsi/tgsi_info.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_scan.h" #include "tgsi/tgsi_util.h" -#include "util/u_debug.h" - static unsigned translate_opcode(unsigned opcode) { switch(opcode) { @@ -145,7 +144,7 @@ static unsigned translate_opcode(unsigned opcode) case TGSI_OPCODE_KIL: return RC_OPCODE_KIL; } - debug_printf("r300: Unknown TGSI/RC opcode: %i\n", opcode); + fprintf(stderr, "r300: Unknown TGSI/RC opcode: %s\n", tgsi_get_opcode_name(opcode)); return RC_OPCODE_ILLEGAL_OPCODE; } @@ -272,9 +271,6 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst struct rc_instruction * dst; int i; - if (src->Instruction.Opcode == TGSI_OPCODE_END) - return; - dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev); dst->U.I.Opcode = translate_opcode(src->Instruction.Opcode); dst->U.I.SaturateMode = translate_saturate(src->Instruction.Saturate); @@ -307,7 +303,7 @@ static void handle_immediate(struct tgsi_to_rc * ttr, for (i = 0; i < 4; i++) { if (imm->u[i].Float == 0.0f) { swizzle |= RC_SWIZZLE_ZERO << (i * 3); - } else if (imm->u[i].Float == 0.5f) { + } else if (imm->u[i].Float == 0.5f && ttr->use_half_swizzles) { swizzle |= RC_SWIZZLE_HALF << (i * 3); } else if (imm->u[i].Float == 1.0f) { swizzle |= RC_SWIZZLE_ONE << (i * 3); @@ -330,8 +326,10 @@ static void handle_immediate(struct tgsi_to_rc * ttr, } } -void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens) +void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, + const struct tgsi_token * tokens) { + struct tgsi_full_instruction *inst; struct tgsi_parse_context parser; unsigned imm_index = 0; int i; @@ -366,7 +364,15 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens) imm_index++; break; case TGSI_TOKEN_TYPE_INSTRUCTION: - transform_instruction(ttr, &parser.FullToken.FullInstruction); + inst = &parser.FullToken.FullInstruction; + /* This hack with the RET opcode woudn't work with + * conditionals. */ + if (inst->Instruction.Opcode == TGSI_OPCODE_END || + inst->Instruction.Opcode == TGSI_OPCODE_RET) { + break; + } + + transform_instruction(ttr, inst); break; } } @@ -377,4 +383,3 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens) rc_calculate_inputs_outputs(ttr->compiler); } -