i965/sf: Reset flag_value to 0xff before emitting SF subroutines.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 25 May 2014 08:08:47 +0000 (01:08 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 27 May 2014 20:46:00 +0000 (13:46 -0700)
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 <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_eu.c
src/mesa/drivers/dri/i965/brw_sf_emit.c

index 4efc1f45a60a77c4ee0c79d9a5c0f9a57d91928d..95bffc4bb0b4d81e14b53ad5ad4d197db955d970 100644 (file)
@@ -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;
index 2488a019d6bcddef12198063720c3cb497306f37..96be91a14d62dc734a12fa79eb591ecd044b6ee5 100644 (file)
@@ -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<<BRW_SPRITE_POINT_ENABLE));
    jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)) - p->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);