summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-09-11 11:41:12 -0400
committerRob Clark <[email protected]>2014-09-12 16:26:09 -0400
commit59ff81663affa173ad80bb314eff8e9ec0ff1f4d (patch)
tree1e49ee2106c9fc756227d9804a1d068128cebf66 /src/gallium/drivers/freedreno
parentdb1a94b1cc91179de2a02f24b002b300e06c78b2 (diff)
freedreno/ir3: catch incorrect usage of tmp-dst
Each get_dst() should have a matching put_dst(). Add a bit of checking to catch mistakes. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index 08c2119e403..36c6a1b83b0 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -115,6 +115,10 @@ struct ir3_compile_context {
*/
struct tgsi_dst_register tmp_dst;
struct tgsi_src_register *tmp_src;
+
+ /* just for catching incorrect use of get_dst()/put_dst():
+ */
+ bool using_tmp_dst;
};
@@ -167,6 +171,8 @@ compile_init(struct ir3_compile_context *ctx, struct ir3_shader_variant *so,
ctx->atomic = false;
ctx->frag_pos = NULL;
ctx->frag_face = NULL;
+ ctx->tmp_src = NULL;
+ ctx->using_tmp_dst = false;
memset(ctx->frag_coord, 0, sizeof(ctx->frag_coord));
@@ -897,6 +903,10 @@ get_dst(struct ir3_compile_context *ctx, struct tgsi_full_instruction *inst)
{
struct tgsi_dst_register *dst = &inst->Dst[0].Register;
unsigned i;
+
+ compile_assert(ctx, !ctx->using_tmp_dst);
+ ctx->using_tmp_dst = true;
+
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
struct tgsi_src_register *src = &inst->Src[i].Register;
if ((src->File == dst->File) && (src->Index == dst->Index)) {
@@ -919,6 +929,9 @@ static void
put_dst(struct ir3_compile_context *ctx, struct tgsi_full_instruction *inst,
struct tgsi_dst_register *dst)
{
+ compile_assert(ctx, ctx->using_tmp_dst);
+ ctx->using_tmp_dst = false;
+
/* if necessary, add mov back into original dst: */
if (dst != &inst->Dst[0].Register) {
create_mov(ctx, &inst->Dst[0].Register, ctx->tmp_src);
@@ -2523,6 +2536,8 @@ compile_instructions(struct ir3_compile_context *ctx)
if (t->fxn) {
t->fxn(t, ctx, inst);
ctx->num_internal_temps = 0;
+
+ compile_assert(ctx, !ctx->using_tmp_dst);
} else {
compile_error(ctx, "unknown TGSI opc: %s\n",
tgsi_get_opcode_name(opc));