diff options
author | Brian Paul <[email protected]> | 2013-07-11 17:02:37 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-07-12 08:32:51 -0600 |
commit | 46205ab8cc03cbda6bbc0c958e277f972973ebfe (patch) | |
tree | bd5f689a9626a410237bbfa8523c59c8299181a5 /src/gallium/auxiliary | |
parent | f501baabdb5cd356faad0e419c64b2ac312c5756 (diff) |
tgsi: rename the TGSI fragment kill opcodes
TGSI_OPCODE_KIL and KILP had confusing names. The former was conditional
kill (if any src component < 0). The later was unconditional kill.
At one time KILP was supposed to work with NV-style condition
codes/predicates but we never had that in TGSI.
This patch renames both opcodes:
TGSI_OPCODE_KIL -> KILL_IF (kill if src.xyzw < 0)
TGSI_OPCODE_KILP -> KILL (unconditional kill)
Note: I didn't just transpose the opcode names to help ensure that I
didn't miss updating any code anywhere.
I believe I've updated all the relevant code and comments but I'm
not 100% sure that some drivers had this right in the first place.
For example, the radeon driver might have llvm.AMDGPU.kill and
llvm.AMDGPU.kilp mixed up. Driver authors should review their code.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_flow.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 16 | ||||
-rw-r--r-- | src/gallium/auxiliary/postprocess/pp_mlaa.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_info.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_pstipple.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mc.c | 2 |
14 files changed, 44 insertions, 46 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index ec703d0b394..0d7b88ee7d1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -308,9 +308,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_W; ctx->emit_instruction(ctx, &newInst); - /* KIL -tmp0.yyyy; # if -tmp0.y < 0, KILL */ + /* KILL_IF -tmp0.yyyy; # if -tmp0.y < 0, KILL */ newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_KIL; + newInst.Instruction.Opcode = TGSI_OPCODE_KILL_IF; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 808c7cdcac2..51f5a860bf9 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -278,7 +278,7 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, /* - * Insert new MUL/TEX/KILP instructions at start of program + * Insert new MUL/TEX/KILL_IF instructions at start of program * Take gl_FragCoord, divide by 32 (stipple size), sample the * texture and kill fragment if needed. * @@ -315,9 +315,9 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Src[1].Register.Index = pctx->freeSampler; ctx->emit_instruction(ctx, &newInst); - /* KIL -texTemp; # if -texTemp < 0, KILL fragment */ + /* KILL_IF -texTemp; # if -texTemp < 0, KILL fragment */ newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_KIL; + newInst.Instruction.Opcode = TGSI_OPCODE_KILL_IF; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; @@ -402,7 +402,7 @@ pstip_update_texture(struct pstip_stage *pstip) /* * Load alpha texture. * Note: 0 means keep the fragment, 255 means kill it. - * We'll negate the texel value and use KILP which kills if value + * We'll negate the texel value and use KILL_IF which kills if value * is negative. */ for (i = 0; i < 32; i++) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c index 30da44e5b9c..f3b3eabb432 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -188,7 +188,7 @@ lp_build_mask_value(struct lp_build_mask_context *mask) /** * Update boolean mask with given value (bitwise AND). * Typically used to update the quad's pixel alive/killed mask - * after depth testing, alpha testing, TGSI_OPCODE_KIL, etc. + * after depth testing, alpha testing, TGSI_OPCODE_KILL_IF, etc. */ void lp_build_mask_update(struct lp_build_mask_context *mask, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c index 1feaa19387a..e65035219ba 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c @@ -396,7 +396,7 @@ frc_emit( TGSI_OPCODE_SUB, emit_data->args[0], tmp); } -/* TGSI_OPCODE_KIL */ +/* TGSI_OPCODE_KILL_IF */ static void kil_fetch_args( @@ -419,7 +419,7 @@ kil_fetch_args( emit_data->dst_type = LLVMVoidTypeInContext(bld_base->base.gallivm->context); } -/* TGSI_OPCODE_KILP */ +/* TGSI_OPCODE_KILL */ static void kilp_fetch_args( @@ -871,8 +871,8 @@ lp_set_default_actions(struct lp_build_tgsi_context * bld_base) bld_base->op_actions[TGSI_OPCODE_EX2].fetch_args = scalar_unary_fetch_args; bld_base->op_actions[TGSI_OPCODE_IF].fetch_args = scalar_unary_fetch_args; bld_base->op_actions[TGSI_OPCODE_UIF].fetch_args = scalar_unary_fetch_args; - bld_base->op_actions[TGSI_OPCODE_KIL].fetch_args = kil_fetch_args; - bld_base->op_actions[TGSI_OPCODE_KILP].fetch_args = kilp_fetch_args; + bld_base->op_actions[TGSI_OPCODE_KILL_IF].fetch_args = kil_fetch_args; + bld_base->op_actions[TGSI_OPCODE_KILL].fetch_args = kilp_fetch_args; bld_base->op_actions[TGSI_OPCODE_RCP].fetch_args = scalar_unary_fetch_args; bld_base->op_actions[TGSI_OPCODE_SIN].fetch_args = scalar_unary_fetch_args; bld_base->op_actions[TGSI_OPCODE_LG2].fetch_args = scalar_unary_fetch_args; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c index 223184d554a..c51fde05273 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c @@ -657,12 +657,10 @@ lp_emit_instruction_aos( case TGSI_OPCODE_DDY: return FALSE; - case TGSI_OPCODE_KILP: - /* predicated kill */ + case TGSI_OPCODE_KILL: return FALSE; - case TGSI_OPCODE_KIL: - /* conditional kill */ + case TGSI_OPCODE_KILL_IF: return FALSE; case TGSI_OPCODE_PK2H: diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 43182eef350..c8d4fb8cd57 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -2043,7 +2043,7 @@ near_end_of_shader(struct lp_build_tgsi_soa_context *bld, * Kill fragment if any of the src register values are negative. */ static void -emit_kil( +emit_kill_if( struct lp_build_tgsi_soa_context *bld, const struct tgsi_full_instruction *inst, int pc) @@ -2101,7 +2101,7 @@ emit_kil( * we're inside a loop or conditional. */ static void -emit_kilp(struct lp_build_tgsi_soa_context *bld, +emit_kill(struct lp_build_tgsi_soa_context *bld, int pc) { LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder; @@ -2319,25 +2319,25 @@ ddy_emit( } static void -kilp_emit( +kill_emit( const struct lp_build_tgsi_action * action, struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data) { struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base); - emit_kilp(bld, bld_base->pc - 1); + emit_kill(bld, bld_base->pc - 1); } static void -kil_emit( +kill_if_emit( const struct lp_build_tgsi_action * action, struct lp_build_tgsi_context * bld_base, struct lp_build_emit_data * emit_data) { struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base); - emit_kil(bld, emit_data->inst, bld_base->pc - 1); + emit_kill_if(bld, emit_data->inst, bld_base->pc - 1); } static void @@ -3168,8 +3168,8 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm, bld.bld_base.op_actions[TGSI_OPCODE_ENDSWITCH].emit = endswitch_emit; bld.bld_base.op_actions[TGSI_OPCODE_IF].emit = if_emit; bld.bld_base.op_actions[TGSI_OPCODE_UIF].emit = uif_emit; - bld.bld_base.op_actions[TGSI_OPCODE_KIL].emit = kil_emit; - bld.bld_base.op_actions[TGSI_OPCODE_KILP].emit = kilp_emit; + bld.bld_base.op_actions[TGSI_OPCODE_KILL_IF].emit = kill_if_emit; + bld.bld_base.op_actions[TGSI_OPCODE_KILL].emit = kill_emit; bld.bld_base.op_actions[TGSI_OPCODE_NRM].emit = nrm_emit; bld.bld_base.op_actions[TGSI_OPCODE_NRM4].emit = nrm_emit; bld.bld_base.op_actions[TGSI_OPCODE_RET].emit = ret_emit; diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.h b/src/gallium/auxiliary/postprocess/pp_mlaa.h index 9972d59c6a6..93a8a8afa90 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.h +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.h @@ -67,7 +67,7 @@ static const char depth1fs[] = "FRAG\n" " 12: DP4 TEMP[0].x, TEMP[2], IMM[0].zzzz\n" " 13: SEQ TEMP[1].x, TEMP[0].xxxx, IMM[0].yyyy\n" " 14: IF TEMP[1].xxxx :16\n" - " 15: KILP\n" + " 15: KILL\n" " 16: ENDIF\n" " 17: MOV OUT[0], TEMP[2]\n" " 18: END\n"; @@ -99,7 +99,7 @@ static const char color1fs[] = "FRAG\n" " 13: DP4 TEMP[0].x, TEMP[2], IMM[1].xxxx\n" " 14: SEQ TEMP[1].x, TEMP[0].xxxx, IMM[1].yyyy\n" " 15: IF TEMP[1].xxxx :17\n" - " 16: KILP\n" + " 16: KILL\n" " 17: ENDIF\n" " 18: MOV OUT[0], TEMP[2]\n" " 19: END\n"; @@ -126,7 +126,7 @@ static const char neigh3fs[] = "FRAG\n" " 8: DP4 TEMP[1].x, TEMP[5], IMM[0].xxxx\n" " 9: SLT TEMP[4].x, TEMP[1].xxxx, IMM[0].yyyy\n" " 10: IF TEMP[4].xxxx :12\n" - " 11: KILP\n" + " 11: KILL\n" " 12: ENDIF\n" " 13: TEX TEMP[4], IN[0].xyyy, SAMP[0], 2D\n" " 14: TEX TEMP[6], IN[1].zwww, SAMP[0], 2D\n" diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 035b1059b83..bed08522fcd 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1578,8 +1578,8 @@ store_dest(struct tgsi_exec_machine *mach, * Kill fragment if any of the four values is less than zero. */ static void -exec_kil(struct tgsi_exec_machine *mach, - const struct tgsi_full_instruction *inst) +exec_kill_if(struct tgsi_exec_machine *mach, + const struct tgsi_full_instruction *inst) { uint uniquemask; uint chan_index; @@ -1617,7 +1617,7 @@ exec_kil(struct tgsi_exec_machine *mach, * Unconditional fragment kill/discard. */ static void -exec_kilp(struct tgsi_exec_machine *mach, +exec_kill(struct tgsi_exec_machine *mach, const struct tgsi_full_instruction *inst) { uint kilmask; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */ @@ -3624,12 +3624,12 @@ exec_instruction( exec_vector_unary(mach, inst, micro_ddy, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; - case TGSI_OPCODE_KILP: - exec_kilp (mach, inst); + case TGSI_OPCODE_KILL: + exec_kill (mach, inst); break; - case TGSI_OPCODE_KIL: - exec_kil (mach, inst); + case TGSI_OPCODE_KILL_IF: + exec_kill_if (mach, inst); break; case TGSI_OPCODE_PK2H: diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 99b1c665d8e..7e930288f55 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -76,7 +76,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, 0, 0, REPL, "COS", TGSI_OPCODE_COS }, { 1, 1, 0, 0, 0, 0, COMP, "DDX", TGSI_OPCODE_DDX }, { 1, 1, 0, 0, 0, 0, COMP, "DDY", TGSI_OPCODE_DDY }, - { 0, 0, 0, 0, 0, 0, NONE, "KILP", TGSI_OPCODE_KILP }, + { 0, 0, 0, 0, 0, 0, NONE, "KILL", TGSI_OPCODE_KILL }, { 1, 1, 0, 0, 0, 0, COMP, "PK2H", TGSI_OPCODE_PK2H }, { 1, 1, 0, 0, 0, 0, COMP, "PK2US", TGSI_OPCODE_PK2US }, { 1, 1, 0, 0, 0, 0, COMP, "PK4B", TGSI_OPCODE_PK4B }, @@ -153,7 +153,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 1, 0, 0, 0, 0, NONE, "CALLNZ", TGSI_OPCODE_CALLNZ }, { 0, 1, 0, 0, 0, 0, NONE, "", 114 }, /* removed */ { 0, 1, 0, 0, 0, 0, NONE, "BREAKC", TGSI_OPCODE_BREAKC }, - { 0, 1, 0, 0, 0, 0, NONE, "KIL", TGSI_OPCODE_KIL }, + { 0, 1, 0, 0, 0, 0, NONE, "KILL_IF", TGSI_OPCODE_KILL_IF }, { 0, 0, 0, 0, 0, 0, NONE, "END", TGSI_OPCODE_END }, { 0, 0, 0, 0, 0, 0, NONE, "", 118 }, /* removed */ { 1, 1, 0, 0, 0, 0, COMP, "F2I", TGSI_OPCODE_F2I }, diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index a6bcbb0f322..b87c4b1f1cf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -92,7 +92,7 @@ OP12(DPH) OP11(COS) OP11(DDX) OP11(DDY) -OP00(KILP) +OP00(KILL) OP11(PK2H) OP11(PK2US) OP11(PK4B) @@ -156,7 +156,7 @@ OP00(NOP) OP11(NRM4) OP01(CALLNZ) OP01(BREAKC) -OP01(KIL) +OP01(KILL_IF) OP00(END) OP11(F2I) OP12(IDIV) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index a07df5c4905..1fe1a07d7c3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -263,8 +263,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens, } } - info->uses_kill = (info->opcode_count[TGSI_OPCODE_KIL] || - info->opcode_count[TGSI_OPCODE_KILP]); + info->uses_kill = (info->opcode_count[TGSI_OPCODE_KILL_IF] || + info->opcode_count[TGSI_OPCODE_KILL]); /* extract simple properties */ for (i = 0; i < info->num_properties; ++i) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index b62c462356a..cfa2b8e66c5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -70,7 +70,7 @@ struct tgsi_shader_info boolean writes_z; /**< does fragment shader write Z value? */ boolean writes_stencil; /**< does fragment shader write stencil value? */ boolean writes_edgeflag; /**< vertex shader outputs edgeflag */ - boolean uses_kill; /**< KIL or KILP instruction used? */ + boolean uses_kill; /**< KILL or KILL_IF instruction used? */ boolean uses_instanceid; boolean uses_vertexid; boolean uses_primid; diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index 68804ae98c6..640305f9ec4 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -75,7 +75,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe, /* * Load alpha texture. * Note: 0 means keep the fragment, 255 means kill it. - * We'll negate the texel value and use KILP which kills if value + * We'll negate the texel value and use KILL_IF which kills if value * is negative. */ for (i = 0; i < 32; i++) { @@ -252,7 +252,7 @@ free_bit(uint bitfield) * declare new registers * MUL texTemp, INPUT[wincoord], 1/32; * TEX texTemp, texTemp, sampler; - * KIL -texTemp; # if -texTemp < 0, KILL fragment + * KILL_IF -texTemp; # if -texTemp < 0, kill fragment * [...original code...] */ static void @@ -340,7 +340,7 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, /* - * Insert new MUL/TEX/KILP instructions at start of program + * Insert new MUL/TEX/KILL_IF instructions at start of program * Take gl_FragCoord, divide by 32 (stipple size), sample the * texture and kill fragment if needed. * @@ -379,9 +379,9 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Src[1].Register.Index = pctx->freeSampler; ctx->emit_instruction(ctx, &newInst); - /* KIL -texTemp; # if -texTemp < 0, KILL fragment */ + /* KILL_IF -texTemp; # if -texTemp < 0, kill fragment */ newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_KIL; + newInst.Instruction.Opcode = TGSI_OPCODE_KILL_IF; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 1fd40c37d16..4877f5ee6c7 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -340,7 +340,7 @@ create_ycbcr_frag_shader(struct vl_mc *r, float scale, bool invert, ureg_IF(shader, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y), &label); - ureg_KILP(shader); + ureg_KILL(shader); ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); ureg_ELSE(shader, &label); |