From a5bb24d7692367a38f46449141bc57397d33dfc2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 25 May 2014 01:08:47 -0700 Subject: [PATCH] i965/sf: Reset flag_value to 0xff before emitting SF subroutines. When compiling any of the SF program variants, flag_value starts off as 0xff and will be modified when generating code. brw_emit_anyprim_setup emits several subroutines, saving and restoring flag_value across each of them. Since it starts out as 0xff, this is equivalent to simply setting it to 0xff at the start of each subroutine. Resetting the value makes more logical sense; each subroutine doesn't know whether one of the others even executed, much less what it did to the flag register. This also lets us to drop the brw_set_predicate_control_flag_value call from brw_init_compile: predicate is already initialized to BRW_PREDICATE_NONE by the memset, and the value of flag_value is irrelevant (as it's only used by the SF compiler). Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_eu.c | 1 - src/mesa/drivers/dri/i965/brw_sf_emit.c | 18 ++++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c index 4efc1f45a60..95bffc4bb0b 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.c +++ b/src/mesa/drivers/dri/i965/brw_eu.c @@ -230,7 +230,6 @@ brw_init_compile(struct brw_context *brw, struct brw_compile *p, void *mem_ctx) brw_set_mask_control(p, BRW_MASK_ENABLE); /* what does this do? */ brw_set_saturate(p, 0); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_set_predicate_control_flag_value(p, 0xff); /* Set up control flow stack */ p->if_stack_depth = 0; diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index 2488a019d6b..96be91a14d6 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -422,6 +422,7 @@ void brw_emit_tri_setup(struct brw_sf_compile *c, bool allocate) struct brw_compile *p = &c->func; GLuint i; + p->flag_value = 0xff; c->nr_verts = 3; if (allocate) @@ -508,7 +509,7 @@ void brw_emit_line_setup(struct brw_sf_compile *c, bool allocate) struct brw_compile *p = &c->func; GLuint i; - + p->flag_value = 0xff; c->nr_verts = 2; if (allocate) @@ -578,6 +579,7 @@ void brw_emit_point_sprite_setup(struct brw_sf_compile *c, bool allocate) struct brw_compile *p = &c->func; GLuint i; + p->flag_value = 0xff; c->nr_verts = 1; if (allocate) @@ -668,6 +670,7 @@ void brw_emit_point_setup(struct brw_sf_compile *c, bool allocate) struct brw_compile *p = &c->func; GLuint i; + p->flag_value = 0xff; c->nr_verts = 1; if (allocate) @@ -745,8 +748,6 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) int jmp; struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD)); - GLuint saveflag; - c->nr_verts = 3; alloc_regs(c); @@ -765,15 +766,9 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_TRIFAN_NOSTIPPLE))); jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->store; { - saveflag = p->flag_value; brw_push_insn_state(p); brw_emit_tri_setup( c, false ); brw_pop_insn_state(p); - p->flag_value = saveflag; - /* note - thread killed in subroutine, so must - * restore the flag which is changed when building - * the subroutine. fix #13240 - */ } brw_land_fwd_jump(p, jmp); @@ -786,12 +781,9 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) (1<<_3DPRIM_LINESTRIP_CONT_BF))); jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->store; { - saveflag = p->flag_value; brw_push_insn_state(p); brw_emit_line_setup( c, false ); brw_pop_insn_state(p); - p->flag_value = saveflag; - /* note - thread killed in subroutine */ } brw_land_fwd_jump(p, jmp); @@ -799,11 +791,9 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c ) brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<store; { - saveflag = p->flag_value; brw_push_insn_state(p); brw_emit_point_sprite_setup( c, false ); brw_pop_insn_state(p); - p->flag_value = saveflag; } brw_land_fwd_jump(p, jmp); -- 2.30.2